Files
2026-05-22 07:29:40 +02:00

26 lines
374 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mock-home-DSCkHwNM.js","./pwa-viewport-D2m4FCVR.js","./ScheduledAtField-Crk-z6KL.js","./ICONS-BxS0OyEd.js","./year-in-posts-CCySMT55.js","./__vite-browser-external-BDDwtokW.js"])))=>i.map(i=>d[i]);
import{$ as e,$t as n,A as r,B as i,Bt as a,C as o,Ct as s,D as c,Et as l,F as u,G as d,Gt as f,H as p,Ht as m,I as h,J as g,Jt as _,K as v,Kt as y,L as b,M as x,Mt as S,O as C,Ot as w,Q as T,Qt as E,R as D,S as O,St as k,T as A,Tt as j,U as M,Ut as ee,V as N,Vt as P,W as F,Wt as I,Y as L,Yt as R,Z as z,_t as B,a as te,an as V,at as ne,b as re,bt as ie,c as ae,cn as oe,ct as H,d as U,et as se,ft as W,g as G,gt as ce,h as le,ht as ue,i as de,in as K,it as fe,jt as pe,lt as me,mt as q,n as he,o as ge,ot as _e,p as ve,pt as ye,q as be,qt as xe,r as Se,rt as Ce,st as we,t as Te,tn as Ee,tt as De,u as Oe,ut as J,vt as ke,w as Ae,wt as je,x as Me,xt as Ne,y as Pe,yt as Fe,z as Ie,zt as Le}from"./pwa-viewport-D2m4FCVR.js";import{$ as Re,A as ze,C as Be,Ct as Ve,Dt as Y,E as He,Et as Ue,F as We,G as Ge,H as Ke,J as qe,K as Je,L as Ye,M as Xe,N as Ze,O as Qe,Ot as $e,P as et,Q as tt,S as nt,St as rt,T as it,Tt as at,U as ot,W as st,X as ct,Y as lt,Z as ut,_ as dt,a as ft,b as pt,bt as mt,c as ht,ct as X,d as gt,dt as _t,et as vt,ft as yt,g as bt,ht as xt,i as St,it as Ct,j as wt,k as Tt,kt as Et,l as Dt,lt as Ot,m as kt,mt as At,n as jt,o as Mt,ot as Nt,pt as Pt,q as Ft,r as It,rt as Lt,s as Rt,st as Z,tt as zt,u as Bt,ut as Vt,v as Ht,vt as Ut,w as Wt,wt as Q,x as Gt,xt as Kt,y as qt,yt as Jt,z as Yt}from"./ScheduledAtField-Crk-z6KL.js";import{t as Xt}from"./ICONS-BxS0OyEd.js";(function(e,n){typeof e.CustomEvent!=`function`&&(e.CustomEvent=function(e,r){r||={bubbles:!1,cancelable:!1,detail:void 0};var i=n.createEvent(`CustomEvent`);return i.initCustomEvent(e,r.bubbles,r.cancelable,r.detail),i},e.CustomEvent.prototype=e.Event.prototype),n.addEventListener(`touchstart`,d,!1),n.addEventListener(`touchmove`,f,!1),n.addEventListener(`touchend`,u,!1);var r=null,i=null,a=null,o=null,s=null,c=null,l=0;function u(e){if(c===e.target){var u=parseInt(p(c,`data-swipe-threshold`,`20`),10),d=p(c,`data-swipe-unit`,`px`),f=parseInt(p(c,`data-swipe-timeout`,`500`),10),m=Date.now()-s,h=``,g=e.changedTouches||e.touches||[];if(d===`vh`&&(u=Math.round(u/100*n.documentElement.clientHeight)),d===`vw`&&(u=Math.round(u/100*n.documentElement.clientWidth)),Math.abs(a)>Math.abs(o)?Math.abs(a)>u&&m<f&&(h=a>0?`swiped-left`:`swiped-right`):Math.abs(o)>u&&m<f&&(h=o>0?`swiped-up`:`swiped-down`),h!==``){var _={dir:h.replace(/swiped-/,``),touchType:(g[0]||{}).touchType||`direct`,fingers:l,xStart:parseInt(r,10),xEnd:parseInt((g[0]||{}).clientX||-1,10),yStart:parseInt(i,10),yEnd:parseInt((g[0]||{}).clientY||-1,10)};c.dispatchEvent(new CustomEvent(`swiped`,{bubbles:!0,cancelable:!0,detail:_})),c.dispatchEvent(new CustomEvent(h,{bubbles:!0,cancelable:!0,detail:_}))}r=null,i=null,s=null}}function d(e){e.target.getAttribute(`data-swipe-ignore`)!==`true`&&(c=e.target,s=Date.now(),r=e.touches[0].clientX,i=e.touches[0].clientY,a=0,o=0,l=e.touches.length)}function f(e){if(!(!r||!i)){var n=e.touches[0].clientX,s=e.touches[0].clientY;a=r-n,o=i-s}}function p(e,r,i){for(;e&&e!==n.documentElement;){var a=e.getAttribute(r);if(a)return a;e=e.parentNode}return i}})(window,document);var Zt=Qt;function Qt(e,n,r){var i=null,a=null,o=function(){i&&=(clearTimeout(i),a=null,null)},s=function(){var e=a;o(),e&&e()},c=function(){if(!n)return e.apply(this,arguments);var s=this,c=arguments,l=r&&!i;if(o(),a=function(){e.apply(s,c)},i=setTimeout(function(){if(i=null,!l){var e=a;return a=null,e()}},n),l)return a()};return c.cancel=o,c.flush=s,c}var $t=oe(Et(),1),en=window.alert;window.__nativeAlert||(window.__nativeAlert=en),window.alert=function(e){e instanceof Error&&e?.message&&(e=e.message),typeof e!=`string`&&(e=JSON.stringify(e));let n=(0,$t.default)({text:e,className:`alert`,gravity:`top`,position:`center`,duration:1e4,offset:{y:48},onClick:()=>{n.hideToast()}});n.showToast()};var tn=Ee(!1);function nn({children:e,value:n}){return R(tn.Provider,{value:n,children:e})}function rn(){return xe(tn)}function an(e=()=>{},n=[]){let r=a(e);_(()=>{r.current=e},[n]),_(()=>{let e=()=>{let e=document.hidden||document.visibilityState===`hidden`;r.current(!e)};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[])}var on=1e3*3,sn=2e4,cn=pe(function(){let e=rn(),{_:n}=l(),[r,i]=I(!0),s=a();an(e=>{clearTimeout(s.current),e?i(!0):s.current=setTimeout(()=>{i(!1)},sn)});let c=async(e,n,r)=>{if(o.notificationsLast){let{value:n}=await e.v1.notifications.list({limit:1,sinceId:o.notificationsLast.id}).values().next();if(n?.length)if(r)o.notificationsShowNew=!0;else{let r;try{r=(await e.v1.markers.fetch({timeline:`notifications`}))?.notifications?.lastReadId}catch{}r?o.notificationsShowNew=n[0].id!==r:o.notificationsShowNew=!0}}};_(()=>{let n,i,a;if(e&&r){let{masto:e,streaming:s,instance:l}=u();(async()=>{await c(e,l);let u=!1;s&&(i=setTimeout(()=>{(async()=>{try{u=!0,n=s.user.notification.subscribe();for await(let e of n){if(!n||!r)break;e.event===`notification`&&O(e.payload,l,{skipThreading:!0}),o.notificationsShowNew=!0}}catch{u=!1}u||(a=setInterval(()=>{c(e,l,!0)},sn))})()},on))})()}return()=>{n?.unsubscribe?.(),n=null,clearTimeout(i),clearInterval(a)}},[r,e]);let d=a(),f=()=>{d.current=Date.now(),fetch(`./version.json`).then(e=>e.json()).then(e=>{e&&(o.appVersion=e)}).catch(e=>{})};return Ue(f,r&&1e3*60*30),an(e=>{e&&(d.current?Date.now()-d.current>1e3*60*60&&f():f())}),$e(`shift+alt+k`,e=>{if(!e.shiftKey||!e.altKey)return;let r=o.settings.cloakMode;o.settings.cloakMode=!r,Y({text:n(r?{id:`oguMwa`}:{id:`IXZLPs`})})},{ignoreEventWhen:e=>e.metaKey||e.ctrlKey}),null}),ln=r(async(e,n)=>{let{value:r}=await e.v1.accounts.$select(n).statuses.list({limit:3,exclude_replies:!0,exclude_reblogs:!0}).values().next();return r||[]},{expires:6e4});function un(){let{_:e}=l(),r=W(o),{masto:i}=u(),[s,c]=I(!1),[d,f]=I([]),[p,m]=I(!1),h=a(null),g=a(null),v=r.settings.shortcutsViewMode===`multi-column`;function b(e){if(e.key&&e.key.toLowerCase()!==`c`)return;if(r.composerState.minimized){o.composerState.minimized=!1,Pt();return}let n=document.querySelectorAll(`data.compose-data`),i=!v&&n.length===1?JSON.parse(n[0].value):void 0;e.shiftKey?At(i)||(o.showCompose=i||!0):(Pt(),o.showCompose=i||!0)}$e(`c, shift+c`,b,{useKey:!0,ignoreEventWhen:e=>!!document.querySelector(`#modal-container > *`)||e.metaKey||e.ctrlKey||e.altKey});let x=Jt(()=>{c(!0)},{threshold:600}),S=y(async()=>{try{m(!0);let e=T();if(!e)return;f(await ln(i,e))}catch{}finally{m(!1)}},[i]),C=y(e=>{_t({replyToStatus:e}),c(!1)},[]);return _(()=>{s&&S()},[S,s]),R(n,{children:[R(`button`,{ref:h,type:`button`,id:`compose-button`,onClick:e=>{Ut.trigger(`light`),b(e)},onContextMenu:e=>{e.preventDefault(),c(!0)},...x(),class:`${r.composerState.minimized?`min`:``} ${r.composerState.publishing?`loading`:``} ${r.composerState.publishingError?`error`:``}`,children:R(X,{icon:`quill`,size:`xl`,alt:e({id:`QOhkyl`})})}),R(at,{ref:g,state:s?`open`:void 0,anchorRef:h,onClose:()=>c(!1),direction:`top`,gap:8,unmountOnClose:!0,portal:{target:document.body},boundingBoxPadding:yt(),containerProps:{style:{zIndex:19},onClick:()=>{g.current?.closeMenu?.()}},submenuOpenDelay:600,children:[R(Nt,{to:`/sp`,children:[R(X,{icon:`schedule`}),` `,R(`span`,{children:R(j,{id:`-GkIdc`})})]}),R(rt,{}),R(Lt,{align:`end`,direction:`top`,shift:-8,disabled:p||d.length===0,label:R(n,{children:[R(X,{icon:`comment`}),` `,R(`span`,{className:`menu-grow`,children:R(j,{id:`LwOr4P`})}),p?``:R(X,{icon:`chevron-right`})]}),children:d.length>0&&d.map(e=>{let r=new Date(e.createdAt),i=Date.now()-r.getTime()<864e5;return R(Q,{onClick:()=>C(e),children:R(`small`,{children:[R(`div`,{class:`menu-post-text`,children:Ot(e)}),R(`span`,{className:`more-insignificant`,children:[i&&R(n,{children:[R(Ct,{datetime:r,format:`micro`}),` `,``,` `]}),R(`time`,{className:`created`,dateTime:r.toISOString(),title:r.toLocaleString(),children:xt(e.createdAt)})]})]})},e.id)})})]})]})}function dn({key1:e,key2:n}){return R(j,{id:`Qh-0sm`,values:{key1:e,key2:n},components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})}var fn=pe(function(){let{_:e}=l(),n=W(o);function r(){o.showKeyboardShortcutsHelp=!1}return $e(`?`,()=>{o.showKeyboardShortcutsHelp=!0},{useKey:!0,ignoreModifiers:!0,ignoreEventWhen:e=>/\/catchup/i.test(location.hash)||e.metaKey||e.ctrlKey||e.altKey}),!!n.showKeyboardShortcutsHelp&&R(zt,{onClose:r,children:R(`div`,{id:`keyboard-shortcuts-help-container`,class:`sheet`,tabindex:`-1`,children:[R(`button`,{type:`button`,class:`sheet-close`,onClick:r,children:R(X,{icon:`x`,alt:e({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`77Emn0`})})}),R(`main`,{children:R(`table`,{children:R(`tbody`,{children:[{action:e({id:`ulXSNi`}),keys:R(`kbd`,{children:`?`})},{action:e({id:`Gy9P9T`}),keys:R(`kbd`,{children:`j`})},{action:e({id:`6XYpYY`}),keys:R(`kbd`,{children:`k`})},{action:e({id:`DYowFe`}),keys:R(j,{id:`mzjGX4`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`S5ez7Y`}),keys:R(j,{id:`Fd8FaU`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`VkLESX`}),keys:R(`kbd`,{children:`.`})},{action:e({id:`jsFF8C`}),keys:R(`kbd`,{children:`Enter`})},{action:e({id:`9VPqHP`}),keys:R(`kbd`,{children:`o`})},{action:R(j,{id:`41gejM`,components:{0:R(`br`,{})}}),keys:R(`kbd`,{children:`x`})},{action:e({id:`jAj8rv`}),keys:R(j,{id:`evz6c6`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`duF1lx`}),keys:R(j,{id:`nhpsIN`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`YrR3Co`}),keys:R(`kbd`,{children:`]`})},{action:e({id:`noxAFR`}),keys:R(`kbd`,{children:`[`})},{action:e({id:`AIa_f7`}),keys:R(`kbd`,{children:`c`})},{action:e({id:`snPx8X`}),className:`insignificant`,keys:R(j,{id:`-Cxvld`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`1pKapz`}),keys:R(j,{id:`py67WT`,components:{0:R(`kbd`,{}),1:R(`kbd`,{}),2:R(`kbd`,{}),3:R(`kbd`,{})}})},{action:e({id:`A1taO8`}),keys:R(`kbd`,{children:`/`})},{action:e({id:`ImOQa9`}),keys:R(`kbd`,{children:`r`})},{action:e({id:`KFs8c6`}),className:`insignificant`,keys:R(j,{id:`XpQLJF`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`cqi4Mx`}),keys:R(j,{id:`84WuL2`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`kulphB`}),keys:R(j,{id:`yrz6Ck`,components:{0:R(`kbd`,{}),1:R(`kbd`,{})}})},{action:e({id:`ZhhOwV`}),keys:R(`kbd`,{children:`q`})},{action:e({id:`PZlHt8`}),keys:R(`kbd`,{children:`d`})},{action:e({id:`C7ujRh`}),keys:R(j,{id:`v4TbMP`,components:{0:R(`kbd`,{}),1:R(`kbd`,{}),2:R(`kbd`,{})}})},{action:e({id:`UmuIdg`}),keys:R(dn,{key1:`g`,key2:`h`})},{action:e({id:`0YgcH9`}),keys:R(dn,{key1:`g`,key2:`n`})},{action:e({id:`mT57-Q`}),keys:R(dn,{key1:`g`,key2:`s`})},{action:e({id:`T1_8PL`}),keys:R(dn,{key1:`g`,key2:`p`})},{action:e({id:`29r697`}),keys:R(dn,{key1:`g`,key2:`b`})}].map(({action:e,className:n,keys:r})=>R(`tr`,{children:[R(`th`,{class:n,children:e}),R(`td`,{children:r})]},e))})})})]})})}),pn=new Set,mn=new WeakMap,hn=new WeakMap,gn=new WeakMap,_n=new WeakMap,vn=new WeakMap,yn=new WeakMap,bn=new WeakMap,xn=new WeakMap,Sn=new WeakSet,Cn,wn=0,Tn=0,En=`__aa_tgt`,Dn=`__aa_del`,On=`__aa_new`,kn=e=>{let n=zn(e);n&&n.forEach(e=>Vn(e))},An=e=>{e.forEach(e=>{e.target===Cn&&Pn(),mn.has(e.target)&&Nn(e.target)})};function jn(e){let n=e.getBoundingClientRect(),r=Cn?.clientWidth||0,i=Cn?.clientHeight||0;return n.bottom<0||n.top>i||n.right<0||n.left>r}function Mn(e){_n.get(e)?.disconnect();let n=mn.get(e),r=0;n||(n=Wn(e),mn.set(e,n));let{offsetWidth:i,offsetHeight:a}=Cn,o=[n.top-5,i-(n.left+5+n.width),a-(n.top+5+n.height),n.left-5].map(e=>`${-1*Math.floor(e)}px`).join(` `),s=new IntersectionObserver(()=>{++r>1&&Nn(e)},{root:Cn,threshold:1,rootMargin:o});s.observe(e),_n.set(e,s)}function Nn(e,n=!0){clearTimeout(xn.get(e));let r=Kn(e),i=n?Zn(r)?500:r.duration:0;xn.set(e,setTimeout(async()=>{let n=gn.get(e);try{await n?.finished,mn.set(e,Wn(e)),Mn(e)}catch{}},i))}function Pn(){clearTimeout(xn.get(Cn)),xn.set(Cn,setTimeout(()=>{pn.forEach(e=>Yn(e,e=>In(()=>Nn(e))))},100))}function Fn(e){setTimeout(()=>{yn.set(e,setInterval(()=>In(Nn.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function In(e){typeof requestIdleCallback==`function`?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}var Ln,Rn=typeof window<`u`&&`ResizeObserver`in window;Rn&&(Cn=document.documentElement,new MutationObserver(kn),Ln=new ResizeObserver(An),window.addEventListener(`scroll`,()=>{Tn=window.scrollY,wn=window.scrollX}),Ln.observe(Cn));function zn(e){return e.reduce((e,n)=>[...e,...Array.from(n.addedNodes),...Array.from(n.removedNodes)],[]).every(e=>e.nodeName===`#comment`)?!1:e.reduce((e,n)=>{if(e===!1)return!1;if(n.target instanceof Element){if(Bn(n.target),!e.has(n.target)){e.add(n.target);for(let r=0;r<n.target.children.length;r++){let i=n.target.children.item(r);if(i){if(Dn in i)return!1;Bn(n.target,i),e.add(i)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){let i=n.removedNodes[r];if(Dn in i)return!1;i instanceof Element&&(e.add(i),Bn(n.target,i),hn.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function Bn(e,n){!n&&!(En in e)?Object.defineProperty(e,En,{value:e}):n&&!(En in n)&&Object.defineProperty(n,En,{value:e})}function Vn(e){let n=e.isConnected,r=mn.has(e);n&&hn.has(e)&&hn.delete(e),gn.get(e)?.playState!==`finished`&&gn.get(e)?.cancel(),On in e?$n(e):r&&n?Qn(e):r&&!n?tr(e):$n(e)}function Hn(e){return Number(e.replace(/[^0-9.\-]/g,``))}function Un(e){let n=e.parentElement;for(;n;){if(n.scrollLeft||n.scrollTop)return{x:n.scrollLeft,y:n.scrollTop};n=n.parentElement}return{x:0,y:0}}function Wn(e){let n=e.getBoundingClientRect(),{x:r,y:i}=Un(e);return{top:n.top+i,left:n.left+r,width:n.width,height:n.height}}function Gn(e,n,r){let i=n.width,a=n.height,o=r.width,s=r.height,c=getComputedStyle(e);if(c.getPropertyValue(`box-sizing`)===`content-box`){let e=Hn(c.paddingTop)+Hn(c.paddingBottom)+Hn(c.borderTopWidth)+Hn(c.borderBottomWidth),n=Hn(c.paddingLeft)+Hn(c.paddingRight)+Hn(c.borderRightWidth)+Hn(c.borderLeftWidth);i-=n,o-=n,a-=e,s-=e}return[i,o,a,s].map(Math.round)}function Kn(e){return En in e&&bn.has(e[En])?bn.get(e[En]):{duration:250,easing:`ease-in-out`}}function qn(e){if(En in e)return e[En]}function Jn(e){let n=qn(e);return n?Sn.has(n):!1}function Yn(e,...n){n.forEach(n=>n(e,bn.has(e)));for(let r=0;r<e.children.length;r++){let i=e.children.item(r);i&&n.forEach(e=>e(i,bn.has(i)))}}function Xn(e){return Array.isArray(e)?e:[e]}function Zn(e){return typeof e==`function`}function Qn(e){let n=mn.get(e),r=Wn(e);if(!Jn(e))return mn.set(e,r);if(jn(e)){mn.set(e,r),Mn(e);return}let i;if(!n)return;let a=Kn(e);if(typeof a!=`function`){let o=n.left-r.left,s=n.top-r.top,c=n.left+n.width-(r.left+r.width);n.top+n.height-(r.top+r.height)==0&&(s=0),c==0&&(o=0);let[l,u,d,f]=Gn(e,n,r),p={transform:`translate(${o}px, ${s}px)`},m={transform:`translate(0, 0)`};l!==u&&(p.width=`${l}px`,m.width=`${u}px`),d!==f&&(p.height=`${d}px`,m.height=`${f}px`),i=e.animate([p,m],{duration:a.duration,easing:a.easing})}else{let[o]=Xn(a(e,`remain`,n,r));i=new Animation(o),i.play()}gn.set(e,i),mn.set(e,r),i.addEventListener(`finish`,Nn.bind(null,e,!1),{once:!0})}function $n(e){On in e&&delete e[On];let n=Wn(e);mn.set(e,n);let r=Kn(e);if(!Jn(e))return;if(jn(e)){Mn(e);return}let i;if(typeof r!=`function`)i=e.animate([{transform:`scale(.98)`,opacity:0},{transform:`scale(0.98)`,opacity:0,offset:.5},{transform:`scale(1)`,opacity:1}],{duration:r.duration*1.5,easing:`ease-in`});else{let[a]=Xn(r(e,`add`,n));i=new Animation(a),i.play()}gn.set(e,i),i.addEventListener(`finish`,Nn.bind(null,e,!1),{once:!0})}function er(e,n){e.remove(),mn.delete(e),hn.delete(e),gn.delete(e),_n.get(e)?.disconnect(),setTimeout(()=>{if(Dn in e&&delete e[Dn],Object.defineProperty(e,On,{value:!0,configurable:!0}),n&&e instanceof HTMLElement)for(let r in n)e.style[r]=``},0)}function tr(e){if(!hn.has(e)||!mn.has(e))return;let[n,r]=hn.get(e);Object.defineProperty(e,Dn,{value:!0,configurable:!0});let i=window.scrollX,a=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(e,r):n&&n.parentNode?n.parentNode.appendChild(e):qn(e)?.appendChild(e),!Jn(e))return er(e);let[o,s,c,l]=rr(e),u=Kn(e),d=mn.get(e);(i!==wn||a!==Tn)&&nr(e,i,a,u);let f,p={position:`absolute`,top:`${o}px`,left:`${s}px`,width:`${c}px`,height:`${l}px`,margin:`0`,pointerEvents:`none`,transformOrigin:`center`,zIndex:`100`};if(!Zn(u))Object.assign(e.style,p),f=e.animate([{transform:`scale(1)`,opacity:1},{transform:`scale(.98)`,opacity:0}],{duration:u.duration,easing:`ease-out`});else{let[n,r]=Xn(u(e,`remove`,d));r?.styleReset!==!1&&(p=r?.styleReset||p,Object.assign(e.style,p)),f=new Animation(n),f.play()}gn.set(e,f),f.addEventListener(`finish`,()=>er(e,p),{once:!0})}function nr(e,n,r,i){let a=wn-n,o=Tn-r,s=document.documentElement.style.scrollBehavior;if(getComputedStyle(Cn).scrollBehavior===`smooth`&&(document.documentElement.style.scrollBehavior=`auto`),window.scrollTo(window.scrollX+a,window.scrollY+o),!e.parentElement)return;let c=e.parentElement,l=c.clientHeight,u=c.clientWidth,d=performance.now();function f(){requestAnimationFrame(()=>{if(!Zn(i)){let e=l-c.clientHeight,n=u-c.clientWidth;d+i.duration>performance.now()?(window.scrollTo({left:window.scrollX-n,top:window.scrollY-e}),l=c.clientHeight,u=c.clientWidth,f()):document.documentElement.style.scrollBehavior=s}})}f()}function rr(e){let n=mn.get(e),[r,,i]=Gn(e,n,Wn(e)),a=e.parentElement;for(;a&&(getComputedStyle(a).position===`static`||a instanceof HTMLBodyElement);)a=a.parentElement;a||=document.body;let o=getComputedStyle(a),s=!gn.has(e)||gn.get(e)?.playState===`finished`?Wn(a):mn.get(a);return[Math.round(n.top-s.top)-Hn(o.borderTopWidth),Math.round(n.left-s.left)-Hn(o.borderLeftWidth),r,i]}function ir(e,n={}){if(Rn&&Ln&&!(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches&&!Zn(n)&&!n.disrespectUserMotionPreference)){Sn.add(e),getComputedStyle(e).position===`static`&&Object.assign(e.style,{position:`relative`}),Yn(e,Nn,Fn,e=>Ln?.observe(e)),Zn(n)?bn.set(e,n):bn.set(e,{duration:250,easing:`ease-in-out`,...n});let r=new MutationObserver(kn);r.observe(e,{childList:!0}),vn.set(e,r),pn.add(e)}return Object.freeze({parent:e,enable:()=>{Sn.add(e)},disable:()=>{Sn.delete(e),Yn(e,e=>{let n=gn.get(e);try{n?.cancel()}catch{}gn.delete(e);let r=xn.get(e);r&&clearTimeout(r),xn.delete(e);let i=yn.get(e);i&&clearInterval(i),yn.delete(e)})},isEnabled:()=>Sn.has(e),destroy:()=>{Sn.delete(e),pn.delete(e),bn.delete(e),vn.get(e)?.disconnect(),vn.delete(e),Yn(e,e=>{Ln?.unobserve(e);let n=gn.get(e);try{n?.cancel()}catch{}gn.delete(e),_n.get(e)?.disconnect(),_n.delete(e);let r=yn.get(e);r&&clearInterval(r),yn.delete(e);let i=xn.get(e);i&&clearTimeout(i),xn.delete(e),mn.delete(e),hn.delete(e)})}})}function ar(e){let n=a(null),[r,i]=I();return _(()=>{n.current instanceof HTMLElement&&i(ir(n.current,e||{}))},[]),_(()=>()=>{(r?.destroy)?.call(r)},[r]),[n,e=>{r&&(e?r.enable():r.disable())}]}function or(e){return(`0`+e.toString(16)).slice(-2)}function sr(){var e=new Uint32Array(56/2);return window.crypto.getRandomValues(e),Array.from(e,or).join(``)}function cr(e){let n=new TextEncoder().encode(e);return window.crypto.subtle.digest(`SHA-256`,n)}function lr(e){let n=``,r=new Uint8Array(e),i=r.byteLength;for(var a=0;a<i;a++)n+=String.fromCharCode(r[a]);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}async function ur(e){return lr(await cr(e))}async function dr({instanceURL:e}){if(!e)return!1;try{let n=await fetch(`https://${e}/.well-known/oauth-authorization-server`);return!n.ok||n.status!==200?!1:!!(await n.json()).code_challenge_methods_supported?.includes(`S256`)}catch{return!1}}window.__generateCodeChallenge=ur;var{DEV:fr,PHANPY_CLIENT_NAME:pr,PHANPY_WEBSITE:mr}={DEV:!1,PHANPY_CLIENT_NAME:`Phanpy`},hr=`read write follow push`,gr=mr?mr.toLowerCase().includes(location.hostname):!1,_r=location.origin+location.pathname,vr=fr||!gr?_r:mr;async function yr({instanceURL:e}){let n=new URLSearchParams({client_name:pr,redirect_uris:vr,scopes:hr,website:mr||vr});return await(await fetch(`https://${e}/api/v1/apps`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n.toString()})).json()}async function br({instanceURL:e,client_id:n,forceLogin:r=!1}){let i=sr(),a=await ur(i),o=new URLSearchParams({client_id:n,code_challenge_method:`S256`,code_challenge:a,redirect_uri:vr,response_type:`code`,scope:hr});return r&&o.append(`force_login`,!0),[`https://${e}/oauth/authorize?${o.toString()}`,i]}async function xr({instanceURL:e,client_id:n,forceLogin:r=!1}){let i=new URLSearchParams({client_id:n,scope:hr,redirect_uri:vr,response_type:`code`});return r&&i.append(`force_login`,!0),`https://${e}/oauth/authorize?${i.toString()}`}async function Sr({instanceURL:e,client_id:n,client_secret:r,code:i,code_verifier:a}){let o=new URLSearchParams({client_id:n,redirect_uri:vr,grant_type:`authorization_code`,code:i});return r&&o.append(`client_secret`,r),a&&o.append(`code_verifier`,a),await(await fetch(`https://${e}/oauth/token`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:o.toString()})).json()}async function Cr({instanceURL:e,client_id:n,client_secret:r,token:i}){try{let a=new URLSearchParams({client_id:n,client_secret:r,token:i});return(await fetch(`https://${e}/oauth/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:a.toString(),keepalive:!0})).ok}catch{return!1}}var wr=window.matchMedia(`(display-mode: standalone)`).matches;function Tr({onClose:e}){let{_:r}=l(),{masto:i}=u(),a=g(),s=T(),c=a.length>1,[d,p]=f(e=>e+1,0),[m]=ar();return R(`div`,{id:`accounts-container`,class:`sheet`,tabIndex:`-1`,children:[!!e&&R(`button`,{type:`button`,class:`sheet-close`,onClick:e,children:R(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),R(`header`,{class:`header-grid`,children:R(`h2`,{children:R(j,{id:`bPwFdf`})})}),R(`main`,{children:R(`section`,{children:[R(`ul`,{class:`accounts-list`,ref:m,children:a.map((l,u)=>{let d=l.info.id===s,f=u===0,m=!l.accessToken,h=()=>{a.splice(u,1),_e(a);try{F.session.get(`currentAccount`)===l.info.id&&F.session.del(`currentAccount`)}catch{}},g=async()=>{await Cr({instanceURL:l.instanceURL,client_id:l.clientId,client_secret:l.clientSecret,token:l.accessToken})};return R(`li`,{children:[R(`div`,{children:[c&&R(`span`,{class:`current ${d?`is-current`:``}`,children:R(X,{icon:`check-circle`,alt:r({id:`Hp1l6f`})})}),R(vt,{url:l.info.avatarStatic,size:`xxl`,onDblClick:async()=>{if(d)try{l.info=await i.v1.accounts.$select(l.info.id).fetch(),_e(a),p()}catch{}}}),R(qe,{account:c?{...l.info,acct:/@/.test(l.info.acct)?l.info.acct:`${l.info.acct}@${l.instanceURL}`}:l.info,showAcct:!0,onClick:()=>{Ut.trigger(`medium`),m?(location.href=`/#/login?instance=${l.instanceURL}`,e()):d?o.showAccount=`${l.info.username}@${l.instanceURL}`:(we(l.info.id),location.reload())}})]}),R(`div`,{class:`actions`,children:[m&&R(`span`,{class:`tag`,children:R(j,{id:`mxY4xF`})}),f&&c&&R(n,{children:[R(`span`,{class:`tag`,children:R(j,{id:`ovBPCi`})}),` `]}),R(tt,{align:`end`,menuButton:R(`button`,{type:`button`,class:`plain more-button`,children:R(X,{icon:`more`,size:`l`,alt:r({id:`2FYpfJ`})})}),children:[c&&R(n,{children:[R(Q,{disabled:d||m,onClick:()=>{we(l.info.id),location.reload()},children:[R(X,{icon:`transfer`}),` `,R(j,{id:`3t_Nrv`})]}),!wr&&!d&&!m&&R(Nt,{href:`./?account=${l.info.id}`,target:`_blank`,children:[R(X,{icon:`external`}),R(`span`,{children:R(j,{id:`PZgZtY`})})]}),R(rt,{})]}),R(Q,{onClick:()=>{o.showAccount=`${l.info.username}@${l.instanceURL}`},children:[R(X,{icon:`user`}),R(`span`,{children:R(j,{id:`40z2Fm`})})]}),R(rt,{}),c&&R(n,{children:[R(Q,{disabled:f||m,onClick:()=>{a.splice(u,1),a.unshift(l),_e(a),p()},children:[R(X,{icon:`check-circle`}),R(`span`,{children:R(j,{id:`PPcets`})})]}),R(Q,{disabled:u<=1,onClick:()=>{a.splice(u,1),a.splice(u-1,0,l),_e(a),p()},children:[R(X,{icon:`arrow-up`}),R(`span`,{children:R(j,{id:`QyioBP`})})]}),R(Q,{disabled:u===0||u===a.length-1,onClick:()=>{a.splice(u,1),a.splice(u+1,0,l),_e(a),p()},children:[R(X,{icon:`arrow-down`}),R(`span`,{children:R(j,{id:`3Ib6FN`})})]}),R(rt,{})]}),m?R(ut,{subMenu:!0,confirmLabel:R(n,{children:[R(X,{icon:`x`}),R(`span`,{children:R(j,{id:`yyX15r`,values:{0:l.info.acct},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}),menuItemClassName:`danger`,onClick:()=>{h(),p()},children:[R(X,{icon:`x`}),R(`span`,{children:R(j,{id:`9OzDUH`})})]}):R(ut,{subMenu:!0,confirmLabel:R(n,{children:[R(X,{icon:`exit`}),R(`span`,{children:R(j,{id:`k08LxG`,values:{0:l.info.acct},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}),menuItemClassName:`danger`,onClick:async()=>{await g(),delete l.accessToken,_e(a),p()},menuExtras:R(Q,{className:`danger`,onClick:async()=>{await g(),h(),location.href=location.pathname||`/`},children:[R(X,{icon:`x`}),R(`span`,{children:R(j,{id:`A3GDG1`,values:{0:l.info.acct},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}),children:[R(X,{icon:`exit`}),R(`span`,{children:R(j,{id:`CXk1bI`})})]}),!!l?.createdAt&&R(`div`,{class:`footer`,children:[R(X,{icon:`account-add`}),R(`span`,{children:R(j,{id:`-9E7iR`,values:{0:xt(l.createdAt)},components:{0:R(Ct,{datetime:l.createdAt})}})})]})]})]})]},l.info.id)})}),R(`p`,{children:R(Z,{to:`/login`,class:`button plain2`,onClick:e,children:[R(X,{icon:`plus`}),` `,R(`span`,{children:R(j,{id:`Is7_PB`})})]})}),c&&R(`p`,{children:R(`small`,{children:R(j,{id:`52x24e`,components:{0:R(`i`,{})}})})}),R(`p`,{children:R(`button`,{type:`button`,class:`light`,onClick:()=>o.showImportExportAccounts=!0,children:R(j,{id:`bgVLbt`})})})]})})]})}var Er=class extends HTMLElement{connectedCallback(){if(this.button=this.querySelector(`button`),window.matchMedia(`(display-mode: standalone)`).matches){this.button.remove();return}if(!navigator.install){this.button.remove();return}this.button.addEventListener(`click`,async e=>{await navigator.install()})}};customElements.define(`button-install`,Er);var Dr=`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='%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`,Or={"zh-CN":`zh-Hans`,"zh-TW":`zh-Hant`,"pt-BR":`pt-BR`};function kr(){let{i18n:e}=l(),n=m(()=>Oe.map(n=>{let r=Or[n]||n.replace(/-[a-z]+$/i,``),i=st({code:r,locale:n,fallback:ae.find(e=>e.code===n)?.nativeName});return{code:n,regionlessCode:r,_common:st({code:r,locale:e.locale,fallback:ae.find(e=>e.code===n)?.name}),native:i}}).sort((n,r)=>{let i=n._common.localeCompare(r._common,e.locale);return i===0?n.code<r.code?-1:+(n.code>r.code):i}),[]);return R(`label`,{class:`lang-selector`,children:[`🌐`,` `,R(`select`,{class:`small`,value:e.locale||`en`,onChange:e=>{F.local.set(`lang`,e.target.value),te(e.target.value)},children:[n.map(({code:n,regionlessCode:r,native:i})=>{let a=st({code:r,locale:e.locale,fallback:ae.find(e=>e.code===n)?.name});return R(`option`,{value:n,"data-regionless-code":r,children:a&&a!==i?`${i} - ${a}`:i},n)}),void 0]})]})}function Ar(e){let{masto:n}=u();return n.v1.push.subscription.create(e)}function jr(){let{masto:e}=u();return e.v1.push.subscription.fetch()}function Mr(e){let{masto:n}=u();return n.v1.push.subscription.update(e)}function Nr(){let{masto:e}=u();return e.v1.push.subscription.remove()}function Pr(){return`serviceWorker`in navigator&&`PushManager`in window}function Fr(){return navigator.serviceWorker.getRegistration()}async function Ir(){let e=await Fr();return{registration:e,subscription:e?await e.pushManager.getSubscription():void 0}}function Lr(e){let n=`${e}${`=`.repeat((4-e.length%4)%4)}`.replace(/-/g,`+`).replace(/_/g,`/`),r=window.atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;++e)i[e]=r.charCodeAt(e);return i}async function Rr(){if(!Pr())return;let{subscription:e}=await Ir(),n=null;try{n=await jr()}catch(e){if(!/(not found|unknown)/i.test(e.message))throw e}if(n&&e){let r=n.endpoint===e.endpoint,i=Ce(),a=n.serverKey===i;if(!r)throw Error(`Backend subscription endpoint changed`);if(!a)throw Error(`Backend subscription key and vapid key changed`)}if(e&&!n){let n=Ce();if(n){let{applicationServerKey:r}=e.options;if(Lr(n).toString()!==new Uint8Array(r).toString())throw await e.unsubscribe(),Error(`Subscription key and vapid key changed`)}}return{subscription:e,backendSubscription:n}}async function zr({data:e,policy:n}){if(!Pr())return;let{registration:r,subscription:i}=await Ir(),a=null;if(i)try{a=await Mr({data:e,policy:n})}catch{a=await Ar({subscription:i,data:e,policy:n})}else{let o=Ce();if(!o)throw Error(`No server key found`);i=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Lr(o)}),a=await Ar({subscription:i,data:e,policy:n})}return{subscription:i,backendSubscription:a}}async function Br(){if(!Pr())return;let{subscription:e}=await Ir();e&&(await Nr(),await e.unsubscribe())}var Vr=16,Hr=[14,15,16,17,18,19,20],Ur=Hr[0],Wr=Hr[Hr.length-1],{PHANPY_WEBSITE:Gr,PHANPY_PRIVACY_POLICY_URL:Kr,PHANPY_TRANSLANG_INSTANCES:qr,PHANPY_IMG_ALT_API_URL:Jr,PHANPY_GIPHY_API_KEY:Yr,PHANPY_CLIENT_NAME:Xr}={PHANPY_CLIENT_NAME:`Phanpy`,PHANPY_PRIVACY_POLICY_URL:`https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD`,PHANPY_TRANSLANG_INSTANCES:`translang.phanpy.social`},Zr=Object.entries(ot.tl).map(([e,n])=>({code:e,name:n})),Qr=`TransLang API`;function $r({onClose:e}){let{_:r}=l(),i=W(o),s=F.local.get(`theme`)||`auto`,c=a(),d=i.settings.contentTranslationTargetLanguage||null,f=st(Ke()),p=F.local.get(`textSize`)||Vr,[m,g]=I(h()),{masto:_,authenticated:v,instance:y}=u(),[b,x]=I(F.local.get(`experiments-tabBarV2`)??!1),S=m[`posting:default:visibility`]===`private`;return R(`div`,{id:`settings-container`,class:`sheet`,tabIndex:`-1`,style:{"--current-text-size":`${p}px`},children:[!!e&&R(`button`,{type:`button`,class:`sheet-close`,onClick:e,children:R(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`Tz0i8g`})})}),R(`main`,{children:[R(`section`,{children:R(`ul`,{children:[R(`li`,{children:[R(`div`,{children:R(`label`,{children:R(j,{id:`aAIQg2`})})}),R(`div`,{children:R(`form`,{ref:c,onInput:e=>{e.preventDefault();let n=new FormData(c.current).get(`theme`),r=document.documentElement;if(n===`auto`){r.classList.remove(`is-light`,`is-dark`);let e=document.querySelector(`meta[data-theme-setting="manual"]`);e&&(e.name=``),document.querySelectorAll(`meta[data-theme-setting="auto"]`).forEach(e=>{e.name=`theme-color`})}else{r.classList.toggle(`is-light`,n===`light`),r.classList.toggle(`is-dark`,n===`dark`);let e=document.querySelector(`meta[data-theme-setting="manual"]`);e&&(e.name=`theme-color`,e.content=n===`light`?e.dataset.themeLightColor:e.dataset.themeDarkColor),document.querySelectorAll(`meta[data-theme-setting="auto"]`).forEach(e=>{e.name=``})}document.querySelector(`meta[name="color-scheme"]`).setAttribute(`content`,n===`auto`?`light dark`:n),n===`auto`?F.local.del(`theme`):F.local.set(`theme`,n)},children:R(`div`,{class:`radio-group`,children:[R(`label`,{children:[R(`input`,{type:`radio`,name:`theme`,value:`light`,defaultChecked:s===`light`}),R(`span`,{children:R(j,{id:`1njn7W`})})]}),R(`label`,{children:[R(`input`,{type:`radio`,name:`theme`,value:`dark`,defaultChecked:s===`dark`}),R(`span`,{children:R(j,{id:`pvnfJD`})})]}),R(`label`,{children:[R(`input`,{type:`radio`,name:`theme`,value:`auto`,defaultChecked:s!==`light`&&s!==`dark`}),R(`span`,{children:R(j,{id:`R9Khdg`})})]})]})})})]}),R(`li`,{children:[R(`div`,{children:R(`label`,{children:R(j,{id:`7r6sCa`})})}),R(ei,{currentTextSize:p})]}),R(`li`,{children:[R(`span`,{children:[R(`label`,{children:R(j,{id:`CeJHfb`})}),` `,R(`small`,{children:R(`a`,{href:`https://crowdin.com/project/phanpy`,target:`_blank`,rel:`noopener`,children:R(j,{id:`FFmj1D`})})})]}),R(kr,{})]}),R(`li`,{class:`block`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,checked:!i.settings.autoHideBars,onChange:e=>{o.settings.autoHideBars=!e.target.checked}}),` `,R(j,{id:`S8Y1Xb`})]})})]})}),v&&R(n,{children:[R(`h3`,{children:R(j,{id:`PcoS3v`})}),R(`section`,{children:R(`ul`,{children:[R(`li`,{children:[R(`label`,{for:`posting-privacy-field`,children:[R(j,{id:`NAjVvt`}),` `,R(X,{icon:`cloud`,alt:r({id:`N2FcBE`}),class:`synced-icon`})]}),R(`select`,{id:`posting-privacy-field`,value:m[`posting:default:visibility`]||`public`,onChange:e=>{let{value:n}=e.target;(async()=>{try{await _.v1.accounts.updateCredentials({source:{privacy:n}});let e={...m,"posting:default:visibility":n};n===`private`&&(e[`posting:default:quote_policy`]=`nobody`),g(e),M(e),Y(r({id:`4uflEE`}))}catch{alert(r({id:`hFs2qq`}))}})()},children:[R(`option`,{value:`public`,children:R(j,{id:`7d1a0d`})}),R(`option`,{value:`unlisted`,children:R(j,{id:`pPYeIN`})}),R(`option`,{value:`private`,children:R(j,{id:`x5LEuB`})})]})]}),Yt()&&R(`li`,{children:[R(`label`,{for:`posting-quote-policy-field`,children:[R(j,{id:`eKInue`}),` `,R(X,{icon:`cloud`,alt:r({id:`N2FcBE`}),class:`synced-icon`})]}),R(`select`,{id:`posting-quote-policy-field`,value:S?`nobody`:m[`posting:default:quote_policy`]||`public`,disabled:S,onChange:e=>{let{value:n}=e.target;(async()=>{try{await _.v1.accounts.updateCredentials({source:{quote_policy:n}});let e={...m,"posting:default:quote_policy":n};g(e),M(e),Y(r({id:`3P1r1z`}))}catch{alert(r({id:`hEe3YR`}))}})()},children:[R(`option`,{value:`public`,disabled:S,children:R(j,{id:`hDWXuG`})}),R(`option`,{value:`followers`,disabled:S,children:R(j,{id:`9Ko-Xp`})}),R(`option`,{value:`nobody`,children:R(j,{id:`-bAQ3S`})})]})]})]})}),R(`p`,{class:`section-postnote`,children:[R(X,{icon:`cloud`,alt:r({id:`N2FcBE`}),class:`synced-icon`}),` `,R(`small`,{children:R(j,{id:`cR6K65`,values:{instance:y},components:{0:R(`a`,{href:`https://${y}/`,target:`_blank`,rel:`noopener`})}})})]})]}),v&&R(n,{children:[R(`h3`,{children:R(j,{id:`sG7QTC`})}),R(`section`,{children:R(`ul`,{children:[R(`li`,{class:`block`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.hideTrendingTimeline,onChange:e=>{o.settings.hideTrendingTimeline=e.target.checked}}),` `,R(j,{id:`jyo0K2`})]})}),R(`li`,{class:`block`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.hideLocalTimeline,onChange:e=>{o.settings.hideLocalTimeline=e.target.checked}}),` `,R(j,{id:`1HxK8h`})]})}),R(`li`,{class:`block`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.hideFederatedTimeline,onChange:e=>{o.settings.hideFederatedTimeline=e.target.checked}}),` `,R(j,{id:`KI7v-9`})]})})]})})]}),R(`h3`,{children:R(j,{id:`ivdhsq`})}),R(`section`,{children:R(`ul`,{children:[R(`li`,{class:`block`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.autoRefresh,onChange:e=>{o.settings.autoRefresh=e.target.checked}}),` `,R(j,{id:`0mC0SF`})]})}),R(`li`,{class:`block`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.boostsCarousel,onChange:e=>{o.settings.boostsCarousel=e.target.checked}}),` `,R(j,{id:`TSbnoW`})]})}),!!qr&&R(`li`,{class:`block`,children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.contentTranslation,onChange:e=>{let{checked:n}=e.target;o.settings.contentTranslation=n,n||(o.settings.contentTranslationTargetLanguage=null)}}),` `,R(j,{id:`0SdaOt`})]}),R(`div`,{class:`sub-section ${i.settings.contentTranslation?``:`more-insignificant`}`,children:[R(`div`,{children:R(`label`,{children:[R(j,{id:`zXCa9e`}),` `,R(`select`,{value:d||``,disabled:!i.settings.contentTranslation,style:{width:`10em`},onChange:e=>{o.settings.contentTranslationTargetLanguage=e.target.value||null},children:[R(`option`,{value:``,children:R(j,{id:`jNCSyx`,values:{systemTargetLanguageText:f}})}),R(`option`,{disabled:!0,children:`──────────`}),Zr.map(e=>{let n=st({code:e.code,fallback:e.name}),r=st({code:e.code,locale:e.code}),i=r&&n!==r;return R(`option`,{value:e.code,children:i?`${r} - ${n}`:n})})]})]})}),R(`hr`,{}),R(`div`,{class:`checkbox-fieldset`,children:[R(j,{id:`cc0NrU`,values:{0:i.settings.contentTranslationHideLanguages.length}}),R(`div`,{class:`checkbox-fields`,children:Zr.map(e=>{let n=st({code:e.code,fallback:e.name}),r=st({code:e.code,locale:e.code}),a=r&&n!==r;return R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.contentTranslationHideLanguages.includes(e.code),onChange:n=>{let{checked:r}=n.target;r?o.settings.contentTranslationHideLanguages.push(e.code):o.settings.contentTranslationHideLanguages=i.settings.contentTranslationHideLanguages.filter(n=>n!==e.code)}}),` `,a?R(`span`,{children:[r,` `,R(`span`,{class:`insignificant ib`,children:[`- `,n]})]}):n]})})})]}),R(`p`,{class:`insignificant`,children:R(`small`,{children:R(j,{id:`7I3sDQ`,values:{TRANSLATION_API_NAME:Qr},components:{0:R(`a`,{href:`https://github.com/cheeaun/translang-api`,target:`_blank`,rel:`noopener`})}})})}),R(`hr`,{}),R(`div`,{children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.contentTranslationAutoInline,disabled:!i.settings.contentTranslation,onChange:e=>{o.settings.contentTranslationAutoInline=e.target.checked}}),` `,R(j,{id:`gURvmk`})]}),R(`p`,{class:`insignificant`,children:R(`small`,{children:R(j,{id:`PbHARL`,components:{0:R(`b`,{})}})})})]})]})]}),v&&R(`li`,{class:`block`,children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.paginatedTimeline,onChange:e=>{o.settings.paginatedTimeline=e.target.checked}}),` `,R(j,{id:`Cf1xHf`})]}),R(`div`,{class:`sub-section insignificant`,children:R(`small`,{children:R(j,{id:`rYXCO0`})})})]}),!!Yr&&v&&R(`li`,{class:`block`,children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.composerGIFPicker,onChange:e=>{o.settings.composerGIFPicker=e.target.checked}}),` `,R(j,{id:`D7_2jB`})]}),R(`div`,{class:`sub-section insignificant`,children:R(`small`,{children:R(j,{id:`_CLBTL`,components:{0:R(`a`,{href:`https://developers.giphy.com/`,target:`_blank`,rel:`noopener`})}})})})]}),!!Jr&&v&&R(`li`,{class:`block`,children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.mediaAltGenerator,onChange:e=>{o.settings.mediaAltGenerator=e.target.checked}}),` `,R(j,{id:`9q5uor`}),` `,R(X,{icon:`sparkles2`,class:`more-insignificant`})]}),R(`div`,{class:`sub-section insignificant`,children:R(`small`,{children:R(j,{id:`faZ9RI`})})}),R(`div`,{class:`sub-section insignificant`,children:R(`small`,{children:R(j,{id:`fHZgvt`,components:{0:R(`a`,{href:`https://github.com/cheeaun/img-alt-api`,target:`_blank`,rel:`noopener`})}})})})]}),v&&R(`li`,{class:`block`,children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.shortcutSettingsCloudImportExport,onChange:e=>{o.settings.shortcutSettingsCloudImportExport=e.target.checked}}),` `,R(j,{id:`570qTm`}),` `,R(X,{icon:`cloud`,class:`more-insignificant`})]}),R(`div`,{class:`sub-section insignificant`,children:R(`small`,{children:R(j,{id:`0tZAhT`,components:{0:R(`br`,{})}})})}),R(`div`,{class:`sub-section insignificant`,children:R(`small`,{children:R(j,{id:`Iq3FHt`})})})]}),R(`li`,{class:`block`,children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:i.settings.cloakMode,onChange:e=>{o.settings.cloakMode=e.target.checked}}),` `,R(j,{id:`lxYe-I`,components:{0:R(`span`,{class:`insignificant`}),1:R(`samp`,{}),2:R(`samp`,{})}})]}),R(`div`,{class:`sub-section insignificant`,children:R(`small`,{children:R(j,{id:`T_hglb`})})})]}),v&&R(`li`,{children:R(`button`,{type:`button`,class:`light`,onClick:()=>{o.showDrafts=!0,o.showSettings=!1},children:R(j,{id:`krk5ws`})})}),R(`li`,{children:R(Z,{to:`/yip`,onClick:e,class:`button light`,children:`Year in Posts`})}),R(`li`,{children:R(`button-install`,{children:R(`button`,{type:`button`,class:`light`,children:R(j,{id:`vOsY-K`,values:{CLIENT_NAME:Xr}})})})})]})}),v&&R(ti,{onClose:e}),R(`h3`,{children:R(j,{id:`uyJsf6`})}),R(`section`,{children:[R(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:8,lineHeight:1.25,alignItems:`center`,marginTop:8},children:[R(`img`,{src:Dr,alt:``,width:`64`,height:`64`,style:{aspectRatio:`1/1`,verticalAlign:`middle`,background:`#b7cdf9`,borderRadius:12}}),R(`div`,{children:[R(`b`,{children:`Phanpy`}),` `,R(`a`,{href:`https://hachyderm.io/@phanpy`,rel:`noopener`,onClick:e=>{e.preventDefault(),o.showAccount=`phanpy@hachyderm.io`},children:`@phanpy`}),R(`br`,{}),R(j,{id:`AZ2EoP`,components:{0:R(`a`,{href:`https://github.com/cheeaun/phanpy`,target:`_blank`,rel:`noopener`}),1:R(`a`,{href:`https://mastodon.social/@cheeaun`,rel:`noopener`,onClick:e=>{e.preventDefault(),o.showAccount=`cheeaun@mastodon.social`}})}})]})]}),R(`p`,{children:[R(`a`,{href:`https://github.com/sponsors/cheeaun`,target:`_blank`,rel:`noopener`,children:R(j,{id:`O4cLCR`})}),` `,`·`,` `,R(`a`,{href:`https://www.buymeacoffee.com/cheeaun`,target:`_blank`,rel:`noopener`,children:R(j,{id:`Ng063n`})}),` `,`·`,` `,R(`a`,{href:`https://patreon.com/cheeaun`,target:`_blank`,rel:`noopener`,children:`Patreon`}),` `,`·`,` `,R(`a`,{href:`https://github.com/cheeaun/phanpy/blob/main/CHANGELOG.md`,target:`_blank`,rel:`noopener`,children:R(j,{id:`3ePd3I`})}),` `,`·`,` `,R(`a`,{href:Kr,target:`_blank`,rel:`noopener`,children:R(j,{id:`LcET2C`})})]}),R(`p`,{children:[Gr&&R(n,{children:[R(j,{id:`pFnMHn`,values:{0:Gr.replace(/https?:\/\//g,``).replace(/\/$/,``)},components:{0:R(`span`,{class:`insignificant`})}}),R(`br`,{})]}),R(j,{id:`6KkH-2`,values:{0:R(`span`,{class:`ib insignificant`,children:[`(`,R(`a`,{href:`https://github.com/cheeaun/phanpy/commit/387a188`,target:`_blank`,rel:`noopener`,children:R(Ct,{datetime:new Date(`2026-05-21T12:34:15.025Z`)})}),`)`]})},components:{0:R(`span`,{class:`insignificant`}),1:R(`input`,{type:`text`,class:`version-string`,readOnly:!0,size:`18`,value:`${`2026-05-21`.replace(/-/g,`.`)}.387a188`,onClick:e=>{e.target.select();try{navigator.clipboard.writeText(e.target.value),Y(r({id:`PiPfua`}))}catch{Y(r({id:`gdxreD`}))}}})}})]})]}),void 0]})]})}function ei({currentTextSize:e}){let n=a(null),[r,i]=I(e),[o]=Ft(r,1e3);return _(()=>{document.documentElement.style.setProperty(`--text-size`,`${o}px`),o===Vr?F.local.del(`textSize`):F.local.set(`textSize`,o)},[o]),R(`div`,{class:`text-size-control ${r===o?``:`loading`}`,children:[R(`button`,{type:`button`,style:{fontSize:Ur},class:`small light ${r===Vr?`default-size`:``}`,disabled:r===Ur,onClick:()=>{i(Math.max(Ur,r-1))},children:R(j,{id:`J6ypuD`})}),` `,R(`input`,{ref:n,type:`range`,min:Ur,max:Wr,step:`1`,value:r,list:`sizes`,onChange:e=>{i(parseInt(e.target.value,10))}}),` `,R(`button`,{type:`button`,style:{fontSize:Wr},class:`small light ${r===Vr?`default-size`:``}`,disabled:r===Wr,onClick:()=>{i(Math.min(Wr,r+1))},children:R(j,{id:`J6ypuD`})}),R(`datalist`,{id:`sizes`,children:Hr.map(e=>R(`option`,{value:e}))})]})}function ti({onClose:e}){let{_:n}=l();if(!Pr())return null;let{instance:r}=u(),[i,o]=I(`default`),s=a(),[c,d]=I(!1),[f,p]=I(!1),m=a();_(()=>{(async()=>{o(`loading`);try{let{subscription:e,backendSubscription:n}=await Rr();if(n?.policy&&n.policy!==`none`){d(!0);let{alerts:e,policy:r}=n;m.current=r;let{elements:i}=s.current,a=i.namedItem(`policy`);a&&(a.value=r),Object.entries(e).forEach(([e,n])=>{let r=i.namedItem(e);r?.type===`checkbox`&&(r.checked=!!n)})}o(`default`)}catch(e){/outside.*authorized/i.test(e.message)?p(!0):alert(e?.message||e),o(`error`)}})()},[]);let h=i===`loading`;return R(`form`,{ref:s,onChange:()=>{setTimeout(()=>{let e=Object.fromEntries(new FormData(s.current)),r=!!e[`policy-allow`],i={data:{policy:e.policy,alerts:{mention:!!e.mention,favourite:!!e.favourite,reblog:!!e.reblog,follow:!!e.follow,follow_request:!!e.followRequest,poll:!!e.poll,update:!!e.update,status:!!e.status}}},a=0;Object.keys(i.data.alerts).forEach(e=>{i.data.alerts[e]?a++:delete i.data.alerts[e]});let o=m.current!==i.data.policy;r&&a>0?o?Br().then(()=>{zr(i)}).catch(e=>{alert(n({id:`I6pdY3`}))}):zr(i).catch(e=>{alert(n({id:`I6pdY3`}))}):Br().catch(e=>{alert(n({id:`q1zFd-`}))})},100)},children:[R(`h3`,{children:R(j,{id:`WUHLnz`})}),R(`section`,{children:R(`ul`,{children:R(`li`,{children:[R(`label`,{children:[R(`input`,{type:`checkbox`,disabled:h||f,name:`policy-allow`,checked:c,onChange:async e=>{let{checked:r}=e.target;if(r){let e=await Notification.requestPermission();e===`granted`?d(!0):(d(!1),e===`denied`&&alert(n({id:`6LUsk7`})))}else d(!1)}}),` `,R(j,{id:`qYNCa1`,values:{0:[{value:`all`,label:n({id:`-niKJH`})},{value:`followed`,label:n({id:`x2NYtp`})},{value:`follower`,label:n({id:`PBFNgg`})}].map(e=>R(`option`,{value:e.value,children:e.label}))},components:{0:R(`select`,{name:`policy`,disabled:h||f||!c})}})]}),R(`div`,{class:`shazam-container no-animation`,style:{width:`100%`},hidden:!c,children:R(`div`,{class:`shazam-container-inner`,children:R(`div`,{class:`sub-section`,children:R(`ul`,{children:[{value:`mention`,label:n({id:`_bZzdR`})},{value:`favourite`,label:n({id:`zZOZj7`})},{value:`reblog`,label:n({id:`puY2t0`})},{value:`follow`,label:n({id:`aaJhcT`})},{value:`followRequest`,label:n({id:`6Fs1Ba`})},{value:`poll`,label:n({id:`wNExRS`})},{value:`update`,label:n({id:`K_EtE6`})},{value:`status`,label:n({id:`2yr1_p`})}].map(e=>R(`li`,{children:R(`label`,{children:[R(`input`,{type:`checkbox`,name:e.value}),` `,e.label]})}))})})})}),f&&R(`div`,{class:`sub-section`,children:R(`p`,{children:R(j,{id:`8d0b8B`,components:{0:R(Z,{to:`/login?instance=${r}`,onClick:e}),1:R(`b`,{})}})})})]})})}),R(`p`,{class:`section-postnote`,children:R(`small`,{children:R(j,{id:`z96cOX`,components:{0:R(`b`,{})}})})})]})}var ni=()=>{let e=setTimeout(()=>{let e=document.getElementById(`columns`);if(e){let n=e.querySelector(`.deck-container.focus`);if(n)n.focus();else{let n=Array.from(e.querySelectorAll(`.deck-container`)).find(e=>e.getBoundingClientRect().left>=0);n?n.focus():e.querySelector(`.deck-container`)?.focus?.()}}else{let e=document.querySelectorAll(`#modal-container > *`);if(e?.length){let n=e[e.length-1],r=n.querySelector(`[tabindex="-1"]`)||n;if(r){r.focus();return}}if(document.querySelector(`.deck-backdrop`))return;let n=document.querySelectorAll(`.deck-container`),r=n[n.length-1];r&&r.tabIndex===-1&&r.focus()}},100);return()=>clearTimeout(e)};function ri(e){if(!e)return;let n=ie(),r=a(n.pathname);_(()=>{r.current&&n.pathname!==r.current&&e?.()},[n.pathname,e])}function ii({acct:e,instance:n}){let[r,i]=e.split(`@`);return i||=n,R(`div`,{class:`handle-info`,children:[R(`span`,{class:`handle-handle`,title:C.toASCII(e),children:[R(`b`,{class:`handle-username`,children:r}),R(`span`,{class:`handle-at`,children:`@`}),R(`b`,{class:`handle-server`,children:i})]}),R(`div`,{class:`handle-legend`,children:[R(`span`,{class:`ib`,children:[R(`span`,{class:`handle-legend-icon username`}),` `,R(j,{id:`silO9A`})]}),` `,R(`span`,{class:`ib`,children:[R(`span`,{class:`handle-legend-icon server`}),` `,R(j,{id:`rZgCpJ`})]})]})]})}var ai=typeof Intl?.Segmenter==`function`?new Intl.Segmenter:null,oi=class extends HTMLElement{#e;#t;#n;connectedCallback(){setTimeout(()=>{if(!this.isConnected)return;let e=this.querySelector(`input, textarea`);if(!e)return;let n=e.getAttribute(`maxlength`);if(!n)return;let r=parseInt(n,10);if(isNaN(r))return;e.removeAttribute(`maxlength`),this.setAttribute(`maxlength`,n),this.#e=e,this.#n=r,this.#t=()=>this.#r(),e.addEventListener(`input`,this.#t);let i=e.value,a;a=ai?[...ai.segment(i)].length:[...i].length,this.setAttribute(`current-length`,a)},0)}#r(){let e=this.#e,n=this.#n,r=e.value,i,a;if(ai){let e=[...ai.segment(r)];a=e.length,e.length>n&&(i=e.slice(0,n).map(e=>e.segment).join(``),a=n)}else{let e=[...r];a=e.length,e.length>n&&(i=e.slice(0,n).join(``),a=n)}this.setAttribute(`current-length`,a),i!==void 0&&(e.value=i,e.dispatchEvent(new Event(`input`,{bubbles:!0,cancelable:!0,composed:!0})))}disconnectedCallback(){this.#e&&this.#e.removeEventListener(`input`,this.#t)}};customElements.define(`grapheme-input`,oi);var si=0;function ci(){return++si}var li=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`].join(`,`);function ui({defaultName:e,defaultValue:n,disabled:r,index:i,nameMaxLength:a=255,valueMaxLength:o=255,onDelete:s,onMoveUp:c,onMoveDown:u,canMoveUp:d,canMoveDown:f}){let{_:p}=l();return R(`tr`,{children:[R(`td`,{children:R(`grapheme-input`,{children:R(`input`,{type:`text`,name:`fields_attributes[${i}][name]`,defaultValue:e,disabled:r,maxLength:a,required:!0,dir:`auto`,enterKeyHint:`next`})})}),R(`td`,{children:R(`grapheme-input`,{children:R(`input`,{type:`text`,name:`fields_attributes[${i}][value]`,defaultValue:n,disabled:r,maxLength:o,required:!0,dir:`auto`,enterKeyHint:`done`})})}),R(`td`,{style:{width:36},children:R(tt,{align:`end`,menuButton:R(`button`,{type:`button`,class:`plain4 small more-button`,disabled:r,children:R(X,{icon:`more`,size:`l`,alt:p({id:`2FYpfJ`})})}),children:[R(Q,{disabled:!d,onClick:c,children:[R(X,{icon:`arrow-up`}),` `,R(`span`,{children:R(j,{id:`QyioBP`})})]}),R(Q,{disabled:!f,onClick:u,children:[R(X,{icon:`arrow-down`}),` `,R(`span`,{children:R(j,{id:`3Ib6FN`})})]}),R(rt,{}),e.trim()===``&&n.trim()===``?R(Q,{menuItemClassName:`danger`,onClick:s,children:[R(X,{icon:`trash`}),` `,R(`span`,{children:R(j,{id:`Jb6_SB`})})]}):R(ut,{subMenu:!0,menuItemClassName:`danger`,confirmLabel:R(j,{id:`QfD1qq`}),onClick:s,children:[R(X,{icon:`trash`,size:`s`}),` `,R(`span`,{children:R(j,{id:`Jb6_SB`})})]})]})})]})}function di({onClose:e=()=>{}}){let{_:r}=l(),{masto:i}=u(),[a,s]=I(`start`),[c,f]=I(null),[p,m]=I(null),[h,g]=I(null),[v,y]=I(null),[b,x]=I([]),S=!!p,{accounts:{maxDisplayNameLength:C,maxNoteLength:w,maxProfileFields:T,profileFieldNameLimit:E,profileFieldValueLimit:D,maxAvatarDescriptionLength:O,maxHeaderDescriptionLength:k}={}}=De()||{};_(()=>{(async()=>{try{if(d()?.mastodon>=9)try{let e=await i.v1.profile.fetch();m(e),x((e?.fields||[]).map(e=>({...e,_key:ci()}))),s(`default`);return}catch{}let e=await i.v1.accounts.verifyCredentials();f(e),x((e?.source?.fields||[]).map(e=>({...e,_key:ci()}))),s(`default`)}catch{s(`error`)}})()},[]);let{note:A}=(p??c?.source)||{},{avatarDescription:M=``,headerDescription:ee=``,displayName:N=``,avatar:P=``,header:F=``}=(p??c)||{},L=[...P?[{type:`image`,url:P}]:[],...v?[{type:`image`,url:v}]:[]],z=[...F?[{type:`image`,url:F}]:[],...h?[{type:`image`,url:h}]:[]];return _(()=>()=>{h&&URL.revokeObjectURL(h),v&&URL.revokeObjectURL(v)},[h,v]),R(`div`,{class:`sheet`,id:`edit-profile-container`,children:[!!e&&R(`button`,{type:`button`,class:`sheet-close`,onClick:e,children:R(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:[R(j,{id:`9OpVZg`}),` `,R(U,{hidden:a!==`loading`})]})}),R(`main`,{children:a===`start`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):R(`form`,{onSubmit:n=>{n.preventDefault();let a=new FormData(n.target),o=a.get(`header`),c=a.get(`avatar`),l=a.get(`display_name`),u=a.get(`note`);if(S){let e=a.get(`avatar_description`),n=a.get(`header_description`),i=(!!P||!!v)&&!e?.trim(),o=(!!F||!!h)&&!n?.trim();if(i&&o){if(!confirm(r({id:`zckhCq`})))return}else if(i){if(!confirm(r({id:`fvc_zp`})))return}else if(o&&!confirm(r({id:`QPtB2n`})))return}let d=T||4,f=[];for(let e=0;e<d;e++){let n=a.get(`fields_attributes[${e}][name]`)?.trim(),r=a.get(`fields_attributes[${e}][value]`)?.trim();n&&r&&f.push({name:n,value:r})}(async()=>{s(`loading`);try{let n;if(S){let e=a.get(`avatar_description`),n=a.get(`header_description`),r={};f.forEach((e,n)=>{r[n]=e});let s={displayName:l,note:u,fieldsAttributes:r};e&&(s.avatarDescription=e),n&&(s.headerDescription=n),c?.size&&(s.avatar=c),o?.size&&(s.header=o),await i.v1.profile.update(s)}else n=await i.v1.accounts.updateCredentials({header:o,avatar:c,displayName:l,note:u,fieldsAttributes:f});s(`default`),e?.({state:`success`,account:n})}catch(e){s(`error`),alert(e?.message||r({id:`FwMMx0`})),s(`default`)}})()},onReset:()=>{h&&(URL.revokeObjectURL(h),g(null)),v&&(URL.revokeObjectURL(v),y(null))},children:[R(`fieldset`,{class:`edit-profile-media-container`,children:[R(`legend`,{children:R(j,{id:`C5zXYJ`})}),R(`input`,{type:`file`,name:`header`,accept:li,onChange:e=>{let n=e.target.files[0];n&&(h&&URL.revokeObjectURL(h),g(URL.createObjectURL(n)))}}),R(`div`,{class:`edit-profile-media-field`,children:[F?R(`div`,{class:`edit-media`,tabIndex:`0`,onClick:()=>{o.showMediaModal={mediaAttachments:z,mediaIndex:0}},children:R(`img`,{src:F,alt:ee||``})}):R(`div`,{class:`edit-media`}),h&&R(n,{children:[R(X,{icon:`arrow-right`}),R(`div`,{class:`edit-media`,tabIndex:`0`,onClick:()=>{o.showMediaModal={mediaAttachments:z,mediaIndex:1}},children:R(`img`,{src:h,alt:``})})]})]}),S&&(!!F||!!h)&&R(`p`,{children:R(`label`,{children:[R(j,{id:`Lh8B0N`}),` `,R(`grapheme-input`,{children:R(`textarea`,{name:`header_description`,defaultValue:ee,disabled:a===`loading`,maxLength:k||150,rows:`2`,dir:`auto`})})]})}),S&&!!F&&R(`div`,{class:`footer`,children:[R(`div`,{class:`spacer`}),R(ut,{confirmLabel:R(j,{id:`p7M2tI`}),menuItemClassName:`danger`,align:`end`,disabled:a===`loading`,onClick:async()=>{if(p){s(`loading`);try{await i.v1.profile.header.remove(),i.v1.profile.update({headerDescription:``}).catch(()=>{}),s(`default`),e?.({state:`success`})}catch{s(`error`),Y(r({id:`551IUY`})),s(`default`)}}},children:R(`button`,{type:`button`,class:`light danger`,disabled:a===`loading`,children:R(j,{id:`MWIaew`})})})]})]}),R(`fieldset`,{class:`edit-profile-media-container`,children:[R(`legend`,{children:R(j,{id:`4XF0BB`})}),R(`input`,{type:`file`,name:`avatar`,accept:li,onChange:e=>{let n=e.target.files[0];n&&(v&&URL.revokeObjectURL(v),y(URL.createObjectURL(n)))}}),R(`div`,{class:`edit-profile-media-field`,children:[P?R(`div`,{class:`edit-media`,tabIndex:`0`,onClick:()=>{o.showMediaModal={mediaAttachments:L,mediaIndex:0}},children:R(`img`,{src:P,alt:M||``})}):R(`div`,{class:`edit-media`}),v&&R(n,{children:[R(X,{icon:`arrow-right`}),R(`div`,{class:`edit-media`,tabIndex:`0`,onClick:()=>{o.showMediaModal={mediaAttachments:L,mediaIndex:1}},children:R(`img`,{src:v,alt:``})})]})]}),S&&(!!P||!!v)&&R(`p`,{children:R(`label`,{children:[R(j,{id:`Lh8B0N`}),` `,R(`grapheme-input`,{children:R(`textarea`,{name:`avatar_description`,defaultValue:M,disabled:a===`loading`,maxLength:O||150,rows:`2`,dir:`auto`})})]})}),S&&!!P&&R(`div`,{class:`footer`,children:[R(`div`,{class:`spacer`}),R(ut,{confirmLabel:R(j,{id:`jsXSTc`}),menuItemClassName:`danger`,align:`end`,disabled:a===`loading`,onClick:async()=>{if(p){s(`loading`);try{await i.v1.profile.avatar.remove(),i.v1.profile.update({avatarDescription:``}).catch(()=>{}),s(`default`),e?.({state:`success`})}catch{s(`error`),Y(r({id:`eJ6Y9F`})),s(`default`)}}},children:R(`button`,{type:`button`,class:`light danger`,disabled:a===`loading`,children:R(j,{id:`MWIaew`})})})]})]}),R(`fieldset`,{children:[R(`p`,{children:R(`label`,{children:[R(j,{id:`6YtxFj`}),` `,R(`grapheme-input`,{children:R(`input`,{type:`text`,name:`display_name`,defaultValue:N,maxLength:C||30,disabled:a===`loading`,dir:`auto`,enterKeyHint:`done`})})]})}),R(`p`,{children:R(`label`,{children:[R(j,{id:`E-oKCO`}),R(`grapheme-input`,{children:R(`textarea`,{defaultValue:A,name:`note`,maxLength:w||500,rows:`5`,disabled:a===`loading`,dir:`auto`})})]})})]}),R(`fieldset`,{children:[R(`legend`,{children:R(j,{id:`oPwQt4`})}),R(`table`,{children:[R(`thead`,{children:R(`tr`,{children:[R(`th`,{children:R(j,{id:`87a_t_`})}),R(`th`,{children:R(j,{id:`4b3oEV`})}),R(`th`,{})]})}),R(`tbody`,{children:b.map((e,n)=>{let{name:r=``,value:i=``}=e;return R(ui,{defaultName:r,defaultValue:i,index:n,disabled:a===`loading`,nameMaxLength:E||255,valueMaxLength:D||255,onDelete:()=>{x(b.filter((e,r)=>r!==n))},onMoveUp:()=>{if(n>0){let e=[...b];[e[n-1],e[n]]=[e[n],e[n-1]],x(e)}},onMoveDown:()=>{if(n<b.length-1){let e=[...b];[e[n],e[n+1]]=[e[n+1],e[n]],x(e)}},canMoveUp:n>0,canMoveDown:n<b.length-1},e._key)})})]}),b.length<(T||4)&&R(`p`,{children:R(`button`,{type:`button`,class:`light`,disabled:a===`loading`,onClick:()=>{x([...b,{name:``,value:``,_key:ci()}])},children:R(j,{id:`Va3xJe`})})})]}),R(`footer`,{children:[R(`button`,{type:`button`,class:`light`,disabled:a===`loading`,onClick:()=>{e?.()},children:R(j,{id:`dEgA5A`})}),R(`button`,{type:`submit`,disabled:a===`loading`,children:R(j,{id:`tfDRzk`})})]})]})})]})}var fi=80;function pi({accountID:e,info:n,open:r=!1,onlyOpenIfHasEndorsements:i=!1}){let{masto:o}=u(),s=a(),[c,l]=I(`default`),[d,f]=I([]),[p,m]=I({});return _(()=>{Xe(`@mastodon/endorsements`)&&r&&(async()=>{l(`loading`);try{let n=await o.v1.accounts.$select(e).endorsements.list({limit:fi});if(!n.length){l(`default`);return}f(n),l(`default`),setTimeout(()=>{s.current.scrollIntoView({behavior:`smooth`,block:`nearest`})},300);let r=await ze(n,p);r&&m(r)}catch{l(`error`)}})()},[r,e]),(i?r&&d.length>0:r)?R(`div`,{class:`shazam-container`,children:R(`div`,{class:`shazam-container-inner`,children:R(`div`,{class:`endorsements-container`,ref:s,children:[R(`h3`,{children:R(j,{id:`UIfdY1`,values:{0:n.username}})}),c===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):d.length>0?R(`ul`,{class:`endorsements ${d.length>10?`expanded`:``}`,children:d.map(e=>R(`li`,{children:R(wt,{account:e,showStats:!0,avatarSize:`xxl`,relationship:p[e.id]},e.id)}))}):R(`p`,{class:`ui-state insignificant`,children:R(j,{id:`AgkUZa`})})]})})}):null}async function mi(e){let{masto:n}=u({instance:e});return!!(await n.v2.search.list({q:`from:me`,type:`statuses`,limit:1}))?.statuses?.length}var hi=r(mi),gi=1e3*60,_i=1440*60*1e3,vi=r(async()=>{let{masto:e}=u(),n=await e.v1.lists.list();return n.sort((e,n)=>e.title.localeCompare(n.title)),n.length&&setTimeout(()=>{F.account.set(`lists`,{lists:n,updatedAt:Date.now()})},1),n},{expires:gi});async function yi(){try{let{lists:e,updatedAt:n}=F.account.get(`lists`)||{};return e?.length?(Date.now()-n>_i&&vi(),e):await vi()}catch{return[]}}var bi=r(e=>{let{masto:n}=u();return n.v1.lists.$select(e).fetch()},{expires:gi});async function xi(e){let{lists:n}=F.account.get(`lists`)||{};if(n?.length){let r=n.find(n=>n.id===e);if(r)return r}try{return bi(e)}catch{return null}}async function Si(e){return(await xi(e))?.title||``}function Ci(e){let{lists:n}=F.account.get(`lists`)||{};n?.length&&(n.push(e),n.sort((e,n)=>e.title.localeCompare(n.title)),F.account.set(`lists`,{lists:n,updatedAt:Date.now()}))}function wi(e){let{lists:n}=F.account.get(`lists`)||{};if(n?.length){let r=n.findIndex(n=>n.id===e.id);r!==-1&&(n[r]=e,n.sort((e,n)=>e.title.localeCompare(n.title)),F.account.set(`lists`,{lists:n,updatedAt:Date.now()}))}}function Ti(e){let{lists:n}=F.account.get(`lists`)||{};if(n?.length){let r=n.findIndex(n=>n.id===e);r!==-1&&(n.splice(r,1),F.account.set(`lists`,{lists:n,updatedAt:Date.now()}))}}function Ei({insignificant:e}){let{_:n}=l();return R(X,{icon:`filter`,size:`xs`,class:`list-exclusive-badge ${e?`insignificant`:``}`,title:n({id:`FNptcJ`})})}function Di({list:e,onClose:n}){let{_:r}=l(),{masto:i}=u(),[o,s]=I(`default`),c=!!e,d=a(),f=a(),p=a();_(()=>{c&&(d.current.value=e.title,f.current.value=e.repliesPolicy,p.current&&(p.current.checked=e.exclusive))},[c]);let m=Xe(`@mastodon/list-exclusive`)||Xe(`@gotosocial/list-exclusive`);return R(`div`,{class:`sheet`,children:[!!n&&R(`button`,{type:`button`,class:`sheet-close`,onClick:n,children:R(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),` `,R(`header`,{children:R(`h2`,{children:r(c?{id:`tuhghE`}:{id:`Sb2gYF`})})}),R(`main`,{children:R(`form`,{class:`list-form`,onSubmit:a=>{a.preventDefault();let o=new FormData(a.target),l=o.get(`title`),u=o.get(`replies_policy`),d=o.get(`exclusive`)===`on`;s(`loading`),(async()=>{try{let r;r=c?await i.v1.lists.$select(e.id).update({title:l,replies_policy:u,exclusive:d}):await i.v1.lists.create({title:l,replies_policy:u,exclusive:d}),s(`default`),n?.({state:`success`,list:r}),setTimeout(()=>{c?wi(r):Ci(r)},1)}catch{s(`error`),alert(r(c?{id:`R7ep1i`}:{id:`KPoj8w`}))}})()},children:[R(`div`,{class:`list-form-row`,children:R(`label`,{for:`list-title`,children:[R(j,{id:`6YtxFj`}),` `,R(`input`,{ref:d,type:`text`,id:`list-title`,name:`title`,required:!0,disabled:o===`loading`,dir:`auto`})]})}),R(`div`,{class:`list-form-row`,children:R(`select`,{ref:f,name:`replies_policy`,required:!0,disabled:o===`loading`,children:[R(`option`,{value:`list`,children:R(j,{id:`ei6pnR`})}),R(`option`,{value:`followed`,children:R(j,{id:`Mr53YX`})}),R(`option`,{value:`none`,children:R(j,{id:`PM7llw`})})]})}),m&&R(`div`,{class:`list-form-row`,children:R(`label`,{class:`label-block`,children:[R(`input`,{ref:p,type:`checkbox`,name:`exclusive`,disabled:o===`loading`}),` `,R(Ei,{insignificant:!0}),` `,R(j,{id:`jxxYp0`})]})}),R(`div`,{class:`list-form-footer`,children:[R(`button`,{type:`submit`,disabled:o===`loading`,children:r(c?{id:`tfDRzk`}:{id:`hYgDIe`})}),c&&R(ut,{disabled:o===`loading`,align:`end`,menuItemClassName:`danger`,confirmLabel:r({id:`-kQ_cY`}),onClick:()=>{s(`loading`),(async()=>{try{await i.v1.lists.$select(e.id).remove(),s(`default`),n?.({state:`deleted`}),setTimeout(()=>{Ti(e.id)},1)}catch{s(`error`),alert(r({id:`tqUaGL`}))}})()},children:R(`button`,{type:`button`,class:`light danger`,disabled:o===`loading`,children:R(j,{id:`Jb6_SB`})})})]})]})})]})}function Oi({accountID:e,onClose:n}){let{_:r}=l(),{masto:i}=u(),[a,o]=I(`default`),[s,c]=I([]),[d,p]=I([]),[m,h]=f(e=>e+1,0);_(()=>{o(`loading`),(async()=>{try{c(await yi()),p(await i.v1.accounts.$select(e).lists.list()),o(`default`)}catch{o(`error`)}})()},[m]);let[g,v]=I(!1);return R(`div`,{class:`sheet`,id:`list-add-remove-container`,children:[!!n&&R(`button`,{type:`button`,class:`sheet-close`,onClick:n,children:R(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`sJ2yQc`})})}),R(`main`,{children:[s.length>0?R(`ul`,{class:`list-add-remove`,children:s.map(n=>{let s=d.some(e=>e.id===n.id);return R(`li`,{children:R(`button`,{type:`button`,class:`light ${s?`checked`:``}`,disabled:a===`loading`,onClick:()=>{o(`loading`),(async()=>{try{s?await i.v1.lists.$select(n.id).accounts.remove({accountIds:[e]}):await i.v1.lists.$select(n.id).accounts.create({accountIds:[e]}),h()}catch{o(`error`),alert(r(s?{id:`7KnEYa`}:{id:`Tba8uO`}))}})()},children:[R(X,{icon:`check-circle`,alt:`☑️`}),R(`span`,{children:n.title})]})})})}):a===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):a===`error`?R(`p`,{class:`ui-state`,children:R(j,{id:`v_l5uA`})}):R(`p`,{class:`ui-state`,children:R(j,{id:`_MJ7gZ`})}),R(`button`,{type:`button`,class:`plain2`,onClick:()=>v(!0),disabled:a!==`default`,children:[R(X,{icon:`plus`,size:`l`}),` `,R(`span`,{children:R(j,{id:`Sb2gYF`})})]})]}),g&&R(zt,{onClick:e=>{e.target===e.currentTarget&&v(!1)},children:R(Di,{list:g?.list,onClose:e=>{e.state===`success`&&h(),v(!1)}})})]})}function ki({account:e,note:n,onRelationshipChange:r=()=>{},onClose:i=()=>{}}){let{_:o}=l(),{masto:s}=u(),[c,d]=I(`default`),f=a(null);return _(()=>{let e;return f.current&&!n&&(e=setTimeout(()=>{f.current.focus?.()},100)),()=>{clearTimeout(e)}},[]),R(`div`,{class:`sheet`,id:`private-note-container`,children:[!!i&&R(`button`,{type:`button`,class:`sheet-close`,onClick:i,children:R(X,{icon:`x`,alt:o({id:`yz7wBu`})})}),R(`header`,{children:[R(`b`,{children:R(j,{id:`1DBGsz`})}),` `,R(`small`,{class:`insignificant`,children:R(j,{id:`XHVHK2`})})]}),R(`main`,{children:R(`form`,{onSubmit:a=>{a.preventDefault();let c=new FormData(a.target).get(`note`);c?.trim()!==n?.trim()&&(d(`loading`),(async()=>{try{let n=await s.v1.accounts.$select(e?.id).note.create({comment:c});d(`default`),r(n),i()}catch(e){d(`error`),alert(e?.message||o({id:`ot8LpF`}))}})())},children:[R(`textarea`,{ref:f,name:`note`,disabled:c===`loading`,dir:`auto`,children:n}),R(`footer`,{children:[R(`button`,{type:`button`,class:`light`,disabled:c===`loading`,onClick:()=>{i?.()},children:R(j,{id:`dEgA5A`})}),R(`span`,{children:[R(U,{abrupt:!0,hidden:c!==`loading`}),R(`button`,{disabled:c===`loading`,type:`submit`,children:R(j,{id:`SrwrEj`})})]})]})]})})]})}function Ai({note:e,fields:n,onClose:r}){let{_:i}=l(),a=n?.map(({name:e,value:n})=>`${e}\n${Vt(n)}`).join(`
`)||``,o=Vt(e)+(a?`\n\n${a}`:``);return R(`div`,{class:`sheet`,children:[!!r&&R(`button`,{type:`button`,class:`sheet-close`,onClick:r,children:R(X,{icon:`x`,alt:i({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`9groMz`})})}),R(`main`,{children:[R(`p`,{style:{whiteSpace:`pre-wrap`},children:o}),R(it,{forceTranslate:!0,text:o})]})]})}var ji=[300,1800,3600,3600*6,3600*24,3600*24*3,3600*24*7,3600*24*30,0],Mi={0:{id:`9ZP9cc`},300:Tt(5,`minute`),1800:Tt(30,`minute`),3600:Tt(1,`hour`),21600:Tt(6,`hour`),86400:Tt(1,`day`),259200:Tt(3,`day`),604800:Tt(1,`week`),2592e3:Tt(30,`day`)};function Ni({info:e,instance:r,standalone:i,authenticated:s,onRelationshipChange:c=()=>{},setShowEditProfile:d=()=>{},showEndorsements:f=!1,renderEndorsements:p=!1,setRenderEndorsements:m=()=>{}}){if(!e)return null;let{_:h,_:g}=l(),{masto:v,instance:y,authenticated:b}=u(),x=r===y,[S,C]=I(`default`),[w,E]=I(null),{id:D,acct:O,url:k,username:A,locked:M,lastStatusAt:ee,note:N,fields:P,moved:F}=e,L=a(D),{following:z,showingReblogs:B,notifying:te,followedBy:V,blocking:ne,blockedBy:re,muting:ie,mutingNotifications:ae,requested:oe,domainBlocking:H,endorsed:se,note:W}=w||{},[G,ce]=I(null),[le,ue]=I(!1),de=O.includes(`@`)?O:`${O}@${r}`,K=Xe(`@mastodon/endorsements`);_(()=>{if(e){let n=T(),i;(async()=>{if(x&&s)i=D;else if(!x&&b){let n=e.acct.includes(`@`);try{let a=await v.v2.search.list({q:n?e.acct:`${e.username}@${r}`,type:`accounts`,limit:1,resolve:!0});a.accounts.length&&(i=a.accounts[0].id,ce(a.accounts[0]))}catch{}}if(!i)return;if(n===i){ue(!0);return}L.current=i,C(`loading`);let a=v.v1.accounts.relationships.fetch({id:[i]});try{let e=await a;if(C(`default`),e.length){let n=e[0];E(n),c({relationship:n,currentID:i})}}catch{C(`error`)}})()}},[e,s]),_(()=>{e&&le&&me(e)},[e,le]);let fe=S===`loading`,[pe,q]=I(!1),[he,ge]=I(!1),[_e,ve]=I(!1),[ye,be]=I([]),[xe,Se]=I(!1);_(()=>{b&&(async()=>{Se(await hi(y))})()},[y,b]);let{headerStatic:Ce,avatarStatic:we}=e;return(!Ce||/missing\.png$/.test(Ce))&&we&&!/missing\.png$/.test(we)&&(Ce=we),R(n,{children:[R(`div`,{class:`actions`,children:[R(`span`,{children:[V?R(`span`,{class:`tag`,children:R(j,{id:`p3UO_y`})}):ee?R(`small`,{class:`insignificant`,children:R(j,{id:`F3cM1G`,values:{0:xt(ee,{hideTime:!0})},components:{0:R(`span`,{class:`ib`})}})}):R(`span`,{}),ie&&R(`span`,{class:`tag danger`,children:R(j,{id:`-IJm1Z`})}),ne&&R(`span`,{class:`tag danger`,children:R(j,{id:`32TndD`})})]}),` `,R(`span`,{class:`buttons`,children:[!!W&&R(`button`,{type:`button`,class:`private-note-tag`,title:g({id:`1DBGsz`}),onClick:()=>{ve(!0)},dir:`auto`,children:R(`span`,{children:W})}),R(tt,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:`center`,position:`anchor`,overflow:`auto`,menuButton:R(`button`,{type:`button`,class:`plain4`,disabled:fe,children:R(X,{icon:`more2`,size:`l`,alt:g({id:`2FYpfJ`})})}),onMenuChange:e=>{z&&e.open&&(async()=>{try{be(await v.v1.accounts.$select(L.current).lists.list())}catch{}})()},children:[b&&!le?R(n,{children:[R(Q,{onClick:()=>{_t({draftStatus:{status:`@${G?.acct||O} `}})},children:[R(X,{icon:`at`}),R(`span`,{children:R(j,{id:`3LkfZu`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}),xe&&R(Q,{onClick:()=>{o.showSearchCommand={query:`from:${O} `}},children:[R(X,{icon:`search`}),R(`span`,{children:R(j,{id:`LCX3ys`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}),R(Q,{onClick:()=>{q(!0)},children:[R(X,{icon:`translate`}),R(`span`,{children:R(j,{id:`R8mSiS`})})]}),Xe(`@mastodon/profile-private-note`)&&R(Q,{onClick:()=>{ve(!0)},children:[R(X,{icon:`note`}),R(`span`,{children:g(W?{id:`-kQy_G`}:{id:`GquPwe`})})]}),z&&!!w&&R(n,{children:[R(Q,{onClick:()=>{C(`loading`),(async()=>{try{let e=await v.v1.accounts.$select(L.current).follow({notify:!te});e&&E(e),C(`default`),Y(e.notifying?g({id:`jL3N0G`,values:{username:A}}):g({id:`0h4_9h`,values:{username:A}}))}catch(e){alert(e),C(`error`)}})()},children:[R(X,{icon:`notification`}),R(`span`,{children:g(te?{id:`osJmEN`}:{id:`I92Z-b`})})]}),R(Q,{onClick:()=>{C(`loading`),(async()=>{try{let e=await v.v1.accounts.$select(L.current).follow({reblogs:!B});e&&E(e),C(`default`),Y(e.showingReblogs?g({id:`0X2KC8`,values:{username:A}}):g({id:`cXWjH0`,values:{username:A}}))}catch(e){alert(e),C(`error`)}})()},children:[R(X,{icon:`rocket`}),R(`span`,{children:g(B?{id:`GRUr8d`}:{id:`uREpT3`})})]})]}),K&&z&&R(Q,{onClick:()=>{C(`loading`),(async()=>{try{se?(E(await v.v1.accounts.$select(G?.id||D).unpin()),C(`default`),Y(g({id:`pWFLFk`,values:{username:A}}))):(E(await v.v1.accounts.$select(G?.id||D).pin()),C(`default`),Y(g({id:`xhiXaF`,values:{username:A}})))}catch{C(`error`),Y(g(se?{id:`xHq5L2`,values:{username:A}}:{id:`Owr_5-`,values:{username:A}}))}})()},children:[R(X,{icon:`endorsement`}),g(se?{id:`S9JvjK`}:{id:`UlJ3QN`})]}),f&&K&&!p&&R(Q,{onClick:()=>m(!0),children:[R(X,{icon:`endorsement`}),R(`span`,{children:R(j,{id:`Qopbnd`})})]}),z&&R(Q,{onClick:()=>{ge(!0)},children:[R(X,{icon:`list`}),ye.length?R(n,{children:[R(`small`,{class:`menu-grow`,children:[R(j,{id:`sJ2yQc`}),R(`br`,{}),R(`span`,{class:`more-insignificant`,children:ye.map(e=>e.title).join(`, `)})]}),R(`small`,{class:`more-insignificant`,children:ye.length})]}):R(`span`,{children:R(j,{id:`sJ2yQc`})})]}),R(rt,{})]}):R(n,{children:[xe&&le&&R(Q,{onClick:()=>{o.showSearchCommand={query:`from:me `}},children:[R(X,{icon:`search`}),R(`span`,{children:R(j,{id:`BmW9JG`})})]}),K&&!p&&R(n,{children:R(Q,{onClick:()=>m(!0),children:[R(X,{icon:`endorsement`}),R(j,{id:`Qopbnd`})]})}),(xe&&le||K&&!p)&&R(rt,{})]}),R(Q,{onClick:()=>{let e=`@${G?.acct||de}`;try{navigator.clipboard.writeText(e),Y(g({id:`zJoEwS`}))}catch{Y(g({id:`BC0lSD`}))}},children:[R(X,{icon:`copy`}),R(`small`,{children:[R(j,{id:`27x6gl`}),R(`br`,{}),R(`span`,{class:`more-insignificant bidi-isolate`,children:[`@`,G?.acct||de]})]})]}),R(Q,{href:k,target:`_blank`,children:[R(X,{icon:`external`}),R(`small`,{class:`menu-double-lines`,children:Pi(k)})]}),R(`div`,{class:`menu-horizontal`,children:[R(Q,{onClick:()=>{try{navigator.clipboard.writeText(k),Y(g({id:`edWbV6`}))}catch{Y(g({id:`W1ewR0`}))}},children:[R(X,{icon:`link`}),R(`span`,{children:R(j,{id:`he3ygx`})})]}),navigator?.share&&navigator?.canShare?.({url:k})&&R(Q,{onClick:()=>{try{navigator.share({url:k})}catch{alert(g({id:`TtG3Uh`}))}},children:[R(X,{icon:`share`}),R(`span`,{children:R(j,{id:`LFKLqp`})})]})]}),R(Q,{onClick:()=>{o.showQrCodeModal={text:k,arena:we,backgroundMask:Ce,caption:O.includes(`@`)?O:`${O}@${r}`,onScannerClick:Hi}},children:[R(X,{icon:`qrcode`}),R(`span`,{children:R(j,{id:`gCX4Z9`})})]}),!!w&&R(n,{children:[R(rt,{}),ie?R(Q,{onClick:()=>{C(`loading`),(async()=>{try{E(await v.v1.accounts.$select(G?.id||D).unmute()),C(`default`),Y(g({id:`B4Xkly`,values:{username:A}})),o.reloadGenericAccounts.id=`mute`,o.reloadGenericAccounts.counter++}catch{C(`error`)}})()},children:[R(X,{icon:`unmute`}),R(`span`,{children:R(j,{id:`Q_HUhC`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}):R(Lt,{menuClassName:`menu-blur`,openTrigger:`clickOnly`,direction:`bottom`,overflow:`auto`,shift:16,label:R(n,{children:[R(X,{icon:`mute`}),R(`span`,{class:`menu-grow`,children:R(j,{id:`xhPEH3`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})}),R(`span`,{style:{textOverflow:`clip`},children:[R(X,{icon:`time`}),R(X,{icon:`chevron-right`})]})]}),children:R(`div`,{class:`menu-wrap`,children:ji.map(e=>R(Q,{onClick:()=>{C(`loading`),(async()=>{try{E(await v.v1.accounts.$select(G?.id||D).mute({duration:e})),C(`default`),Y(g({id:`_plB9m`,values:{0:typeof Mi[e]==`function`?Mi[e]():h(Mi[e]),username:A}})),o.reloadGenericAccounts.id=`mute`,o.reloadGenericAccounts.counter++}catch{C(`error`),Y(g({id:`vWGBjT`,values:{username:A}}))}})()},children:typeof Mi[e]==`function`?Mi[e]():h(Mi[e])}))})}),V&&R(ut,{subMenu:!0,menuItemClassName:`danger`,confirmLabel:R(n,{children:[R(X,{icon:`user-x`}),R(`span`,{children:R(j,{id:`unyq2W`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}),onClick:()=>{C(`loading`),(async()=>{try{E(await v.v1.accounts.$select(G?.id||D).removeFromFollowers()),C(`default`),Y(g({id:`AgkcM_`,values:{username:A}})),o.reloadGenericAccounts.id=`followers`,o.reloadGenericAccounts.counter++}catch{C(`error`)}})()},children:[R(X,{icon:`user-x`}),R(`span`,{children:R(j,{id:`VCZ0OT`})})]}),R(ut,{subMenu:!0,confirm:!ne,confirmLabel:R(n,{children:[R(X,{icon:`block`}),R(`span`,{children:R(j,{id:`aforS9`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}),itemProps:{className:`danger`},menuItemClassName:`danger`,onClick:()=>{C(`loading`),(async()=>{try{ne?(E(await v.v1.accounts.$select(G?.id||D).unblock()),C(`default`),Y(g({id:`sI9N29`,values:{username:A}}))):(E(await v.v1.accounts.$select(G?.id||D).block()),C(`default`),Y(g({id:`uYcYzu`,values:{username:A}}))),o.reloadGenericAccounts.id=`block`,o.reloadGenericAccounts.counter++}catch{C(`error`),Y(g(ne?{id:`0tG4wG`,values:{username:A}}:{id:`pA-qEx`,values:{username:A}}))}})()},children:ne?R(n,{children:[R(X,{icon:`unblock`}),R(`span`,{children:R(j,{id:`_3LJfX`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]}):R(n,{children:[R(X,{icon:`block`}),R(`span`,{children:R(j,{id:`JRswkR`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]})}),R(Q,{className:`danger`,onClick:()=>{o.showReportModal={account:G||e}},children:[R(X,{icon:`flag`}),R(`span`,{children:R(j,{id:`qTJgpR`,values:{username:A},components:{0:R(`span`,{class:`bidi-isolate`})}})})]})]}),!1]}),b&&le&&R(`button`,{type:`button`,class:`plain`,onClick:()=>{o.showQrCodeModal={text:k,arena:we,backgroundMask:Ce,caption:O.includes(`@`)?O:`${O}@${r}`,onScannerClick:Hi}},children:R(X,{icon:`qrcode`,alt:g({id:`gCX4Z9`})})}),!w&&S===`loading`&&R(U,{abrupt:!0}),b&&le&&i?R(`button`,{type:`button`,class:`light`,onClick:()=>{d(!0)},children:R(j,{id:`9OpVZg`})}):!le&&!!w&&!F&&R(ut,{confirm:z||oe,confirmLabel:R(`span`,{children:g(oe?{id:`e7qQIH`}:{id:`eYsAQr`,values:{0:e.acct||e.username}})}),menuItemClassName:`danger`,align:`end`,disabled:fe,onClick:()=>{C(`loading`),(async()=>{try{let e;e=z||oe?await v.v1.accounts.$select(L.current).unfollow():await v.v1.accounts.$select(L.current).follow(),e&&(E(e),f&&K&&!p&&e.following&&m(`onlyOpenIfHasEndorsements`)),C(`default`)}catch(e){alert(e),C(`error`)}})()},children:R(`button`,{type:`button`,class:`${z||oe?`light swap`:``}`,"data-swap-state":z||oe?`danger`:``,disabled:fe,children:z?R(n,{children:[R(`span`,{children:R(j,{id:`y6sq5j`})}),R(`span`,{children:R(j,{id:`HKrBPX`})})]}):oe?R(n,{children:[R(`span`,{children:R(j,{id:`Yx0Ud8`})}),R(`span`,{children:R(j,{id:`yTVtKs`})})]}):M?R(n,{children:[R(X,{icon:`lock`}),` `,R(`span`,{children:R(j,{id:`MKEPCY`})})]}):g({id:`MKEPCY`})})})]})]}),!!pe&&R(zt,{onClose:()=>{q(!1)},children:R(Ai,{note:N,fields:P,onClose:()=>q(!1)})}),!!he&&R(zt,{onClose:()=>{ge(!1)},children:R(Oi,{accountID:L.current,onClose:()=>ge(!1)})}),!!_e&&R(zt,{onClose:()=>{ve(!1)},children:R(ki,{account:e,note:W,onRelationshipChange:e=>{E(e)},onClose:()=>ve(!1)})})]})}function Pi(e){if(!e)return;let r=URL.parse(e);if(!r)return;let{host:i,pathname:a}=r,o=a.replace(/\/$/,``).replace(/^\//,``);return R(n,{children:[R(`span`,{class:`more-insignificant`,children:[C.toUnicode(i),`/`]}),R(`wbr`,{}),R(`span`,{children:o})]})}var Fi=80,Ii=1e3*60*10;function Li(e,n){return n.v1.accounts.familiarFollowers.fetch({id:[e]})}var Ri=r(Li,{expires:Ii});async function zi(e,n){let{value:r}=await n.v1.accounts.$select(e).statuses.list({limit:20}).values().next(),i={total:r.length,originals:0,replies:0,boosts:0,quotes:0};return r.forEach(e=>{e.reblog?i.boosts++:e.inReplyToId&&e.inReplyToAccountId!==e.account.id?i.replies++:Yt()&&(e.quote?.id||e.quote?.quotedStatus?.id)?i.quotes++:i.originals++}),r.length&&(i.daysSinceLastPost=Math.ceil((Date.now()-Date.parse(r[r.length-1].createdAt))/864e5)),i}var Bi=r(zi,{expires:Ii}),Vi=e=>{try{return new URL(e),!0}catch{return!1}},Hi=()=>{o.showQrScannerModal={checkValidity:Vi,actionableText:{id:`73lp8c`},onClose:({text:e}={})=>{e&&(re(),location.hash=`/${e}`)}}};function Ui({account:e,fetchAccount:r=()=>{},standalone:i,instance:s,authenticated:d,showEndorsements:p=!1}){let{i18n:h,_:v}=l(),{masto:b,authenticated:x}=u({instance:s}),{masto:S,instance:C}=u(),[w,E]=I(`default`),D=typeof e==`string`,[O,k]=I(D?null:e),[A,M]=f(e=>e+1,0),ee=m(()=>s===C,[s,C]);_(()=>{if(!D){k(e);return}E(`loading`),(async()=>{try{let e=await r();o.accounts[`${e.id}@${s}`]=e,k(e),E(`default`)}catch{k(null),E(`error`)}})()},[D,e,r,A]);let{acct:N,avatar:P,avatarStatic:F,avatarDescription:L,bot:z,createdAt:B,displayName:te,emojis:V,fields:ne,followersCount:re,followingCount:ie,group:ae,headerDescription:oe,id:H,lastStatusAt:U,locked:se,note:W,statusesCount:G,url:ce,username:le,memorial:ue,moved:de,roles:fe,hideCollections:pe}=O||{},me=!1,{header:q,headerStatic:he}=O||{};(!q||/missing\.png$/.test(q))&&P&&!/missing\.png$/.test(P)&&(q=P,me=!0,F&&!/missing\.png$/.test(F)&&(he=F));let ge=m(()=>H===T(),[H]);_(()=>{let e=!!(O?.id&&O?.username&&O?.acct&&O?.avatar&&O?.avatarStatic&&O?.displayName&&O?.url);if(ge&&s&&e){let e=g(),n=!1;e.forEach(e=>{e.info.id===O.id&&e.instanceURL===s&&(e.info=O,n=!0)}),n&&_e(e)}},[ge,O,s]),c(ce);let[ve,ye]=I([]),be=a(),xe=a([]);async function Se(e){(e||!be.current)&&(be.current=b.v1.accounts.$select(H).followers.list({limit:Fi}).values());let n=await be.current.next();if(ge||!ee)return n;let{value:r}=n,i=[];if(e){let e=[];try{e=await b.v1.accounts.familiarFollowers.fetch({id:[H]})}catch{}xe.current=e?.[0]?.accounts||[],i=[...xe.current,...r.filter(e=>!xe.current.some(n=>n.id===e.id))]}else r?.length&&(i=r.filter(e=>!xe.current.some(n=>n.id===e.id)));return{...n,value:i}}let Ce=a();async function we(e){return(e||!Ce.current)&&(Ce.current=b.v1.accounts.$select(H).following.list({limit:Fi}).values()),await Ce.current.next()}let Te=i?`div`:Z,Ee=s?`/${s}/a/${H}`:`/a/${H}`,[De,Oe]=I([]),[J,ke]=I(),[Ae,je]=I(`default`),Me=!!J?.total,Ne=async e=>{try{Oe((await Ri(e,S))[0].accounts.slice(0,Wi))}catch{}},Pe=async()=>{if(H){je(`loading`);try{ke(await Bi(H,b)),je(`default`)}catch{je(`error`)}}},Fe=y(({relationship:e,currentID:n})=>{e.following||(Ne(n),!i&&G>0&&Pe())},[i,H,G]),Ie=y(e=>{e.id===H&&(k(e),o.accounts[`${e.id}@${s}`]=e)},[H,s]),Le=D&&e&&/^https?:\/\//.test(e),[Re,ze]=I(!1),[Be,Ve]=I(!1);return R(n,{children:[R(`div`,{tabIndex:`-1`,class:`account-container ${w===`loading`?`skeleton`:``}`,style:{"--header-color-1":ve[0],"--header-color-2":ve[1],"--header-color-3":ve[2],"--header-color-4":ve[3]},children:[w===`error`&&R(`div`,{class:`ui-state`,children:[R(`p`,{children:R(j,{id:`44hICK`})}),D?R(`p`,{children:Le?R(`a`,{href:e,target:`_blank`,rel:`noopener`,children:e}):R(`code`,{class:`insignificant`,children:e})}):R(`p`,{children:R(`a`,{href:ce,target:`_blank`,rel:`noopener`,children:[R(j,{id:`Aadw0-`}),` `,R(X,{icon:`external`})]})}),D&&R(`button`,{type:`button`,onClick:M,children:R(j,{id:`KDw4GX`})})]}),w===`loading`?R(n,{children:[R(`header`,{children:R(wt,{avatarSize:`xxxl`,skeleton:!0})}),R(`main`,{children:[R(`div`,{class:`note`,children:[R(`p`,{children:`███████ ████ ████`}),R(`p`,{children:`████ ████████ ██████ █████████ ████ ██`})]}),R(`div`,{class:`account-metadata-box`,children:[R(`div`,{class:`profile-metadata`,children:[R(`div`,{class:`profile-field`,children:[R(`b`,{class:`more-insignificant`,children:`███`}),R(`p`,{children:`██████`})]}),R(`div`,{class:`profile-field`,children:[R(`b`,{class:`more-insignificant`,children:`████`}),R(`p`,{children:`███████████`})]})]}),R(`div`,{class:`stats`,children:[R(`div`,{children:[R(`span`,{children:`██`}),` ██████`]}),R(`div`,{children:[R(`span`,{children:`██`}),` ██████`]}),R(`div`,{children:[R(`span`,{children:`██`}),` █████`]})]})]}),R(`div`,{class:`actions`,children:[R(`span`,{}),R(`span`,{class:`buttons`,children:R(`button`,{type:`button`,class:`plain4`,disabled:!0,children:R(X,{icon:`more2`,size:`l`})})})]})]})]}):O&&R(n,{children:[!!de&&R(`div`,{class:`account-moved`,children:[R(`p`,{children:R(j,{id:`C6cVP_`,values:{displayName:te},components:{0:R(`b`,{})}})}),R(wt,{account:de,instance:s,onClick:e=>{e.stopPropagation(),o.showAccount=de}})]}),!!q&&!/missing\.png$/.test(q)&&R(`img`,{src:q,alt:oe||``,class:`header-banner ${me?`header-is-avatar`:``}`,onError:e=>{e.target.crossOrigin?e.target.src===he?(e.target.removeAttribute(`crossorigin`),e.target.src=q):e.target.src=he:e.target.src===he?e.target.remove():e.target.src=he},crossOrigin:`anonymous`,onLoad:e=>{e.target.classList.add(`loaded`);let{width:n,height:r}=e.target;e.target.style.setProperty(`--anim-duration`,`${Math.min(Math.max(Math.max(n,r)/25,10),120)}s`);try{let i=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement(`canvas`),a=i.getContext(`2d`,{willReadFrequently:!0});i.width=n,i.height=r,a.imageSmoothingEnabled=!1,a.drawImage(e.target,0,0),ye([a.getImageData(0,0,10,10).data,a.getImageData(e.target.width-10,0,10,10).data,a.getImageData(0,e.target.height-10,10,10).data,a.getImageData(e.target.width-10,e.target.height-10,10,10).data].map(e=>{let n=0,r=0,i=0,a=0;for(let o=0;o<e.length;o+=4)n+=e[o],r+=e[o+1],i+=e[o+2],a+=e[o+3];let o=e.length/4;return[n/o,r/o,i/o,a/o]}).map(e=>{let[n,r,i,a]=Gi(e);return`rgba(${n}, ${r}, ${i}, ${a})`}))}catch{}}}),R(`header`,{children:i?R(tt,{shift:window.matchMedia(`(min-width: calc(40em))`).matches?114:64,menuButton:R(`div`,{children:R(wt,{account:O,instance:s,avatarSize:`xxxl`,avatarDescription:L,onClick:()=>{}})}),children:[R(`div`,{class:`szh-menu__header`,children:R(ii,{acct:N,instance:s})}),R(Q,{onClick:()=>{let e=N.includes(`@`)?`@${N}`:`@${N}@${s}`;try{navigator.clipboard.writeText(e),Y(v({id:`zJoEwS`}))}catch{Y(v({id:`BC0lSD`}))}},children:[R(X,{icon:`link`}),R(`span`,{children:R(j,{id:`27x6gl`})})]}),R(Q,{onClick:()=>{o.showQrCodeModal={text:ce,arena:F,backgroundMask:he,caption:N.includes(`@`)?N:`${N}@${s}`,onScannerClick:Hi}},children:[R(X,{icon:`qrcode`}),R(`span`,{children:R(j,{id:`gCX4Z9`})})]}),R(Q,{href:ce,target:`_blank`,children:[R(X,{icon:`external`}),R(`span`,{children:R(j,{id:`Bz5hLl`})})]}),R(rt,{}),R(Q,{onClick:()=>{o.showMediaModal={mediaAttachments:[{type:`image`,url:F,description:L}]}},children:[R(X,{icon:`user`}),R(`span`,{children:R(j,{id:`7WYl2I`})})]}),!!he&&!me&&R(Q,{onClick:()=>{o.showMediaModal={mediaAttachments:[{type:`image`,url:he,description:oe}]}},children:[R(X,{icon:`media`}),R(`span`,{children:R(j,{id:`ZNme5R`})})]}),x&&ge&&Xe(`@mastodon/profile-edit`)&&R(n,{children:[R(rt,{}),R(Q,{onClick:()=>{ze(!0)},children:[R(X,{icon:`pencil`}),R(`span`,{children:R(j,{id:`9OpVZg`})})]})]})]}):R(wt,{account:O,instance:s,avatarSize:`xxxl`,internal:!0})}),R(`div`,{class:`faux-header-bg`,"aria-hidden":`true`}),R(`main`,{children:[!!ue&&R(`span`,{class:`tag`,children:R(j,{id:`prdIOK`})}),!!z&&R(`span`,{class:`tag`,children:[R(X,{icon:`bot`}),` `,R(j,{id:`9Vdq-j`})]}),!!ae&&R(`span`,{class:`tag`,children:[R(X,{icon:`group`}),` `,R(j,{id:`L8fEEm`})]}),R(`div`,{class:`note`,dir:`auto`,onClick:et({instance:C}),dangerouslySetInnerHTML:{__html:We(W,{emojis:V})}}),R(`div`,{class:`account-metadata-box`,children:[ne?.length>0&&R(`div`,{class:`profile-metadata`,children:ne.map(({name:e,value:n,verifiedAt:r},i)=>R(`div`,{class:`profile-field ${r?`profile-verified`:``}`,dir:`auto`,children:[R(`b`,{children:[R(lt,{text:e,emojis:V}),` `,!!r&&R(X,{icon:`check-circle`,size:`s`,alt:v({id:`QDEWii`})})]}),R(`p`,{dangerouslySetInnerHTML:{__html:We(n,{emojis:V})}})]},e+i))}),R(`div`,{class:`stats`,children:[R(Te,{tabIndex:0,to:Ee,onClick:()=>{setTimeout(()=>{o.showGenericAccounts={id:`followers`,heading:v({id:`x5LEuB`}),fetchAccounts:Se,instance:s,excludeRelationshipAttrs:ge?[`followedBy`]:[],blankCopy:pe?v({id:`BRV_wh`}):void 0}},0)},children:[!!De.length&&R(`span`,{class:`shazam-container-horizontal`,children:R(`span`,{class:`shazam-container-inner stats-avatars-bunch`,children:De.map(e=>R(vt,{url:e.avatarStatic,size:`s`,alt:`${e.displayName} @${e.acct}`,squircle:e?.bot}))})}),R(j,{id:`TbttfX`,values:{0:Ze(re),1:Ze(re),followersCount:re},components:{0:R(`span`,{title:re}),1:R(`span`,{title:re})}})]}),R(Te,{class:`insignificant`,tabIndex:0,to:Ee,onClick:()=>{setTimeout(()=>{o.showGenericAccounts={heading:v({id:`following.stats`}),fetchAccounts:we,instance:s,excludeRelationshipAttrs:ge?[`following`]:[],blankCopy:pe?v({id:`BRV_wh`}):void 0}},0)},children:[R(j,{id:`SGcIK-`,values:{0:Ze(ie),followingCount:ie},components:{0:R(`span`,{title:ie})}}),R(`br`,{})]}),R(Te,{class:`insignificant`,to:Ee,children:R(j,{id:`C4x3-X`,values:{0:Ze(G),1:Ze(G),statusesCount:G},components:{0:R(`span`,{title:G}),1:R(`span`,{title:G})}})}),!!B&&R(`div`,{class:`insignificant`,children:R(j,{id:`PCcEFZ`,values:{0:xt(B,{hideTime:!0})},components:{0:R(`time`,{datetime:B})}})})]})]}),!!J&&R(Te,{to:Ee,class:`account-metadata-box`,onClick:void 0,children:R(`div`,{class:`shazam-container`,children:R(`div`,{class:`shazam-container-inner`,children:Me?R(`div`,{class:`posting-stats`,title:Yt()?v({id:`CKHUZ2`,values:{0:(J.originals/J.total).toLocaleString(h.locale||void 0,{style:`percent`}),1:(J.replies/J.total).toLocaleString(h.locale||void 0,{style:`percent`}),2:(J.quotes/J.total).toLocaleString(h.locale||void 0,{style:`percent`}),3:(J.boosts/J.total).toLocaleString(h.locale||void 0,{style:`percent`})}}):v({id:`wiuWLe`,values:{0:(J.originals/J.total).toLocaleString(h.locale||void 0,{style:`percent`}),1:(J.replies/J.total).toLocaleString(h.locale||void 0,{style:`percent`}),2:(J.boosts/J.total).toLocaleString(h.locale||void 0,{style:`percent`})}}),children:[R(`div`,{children:J.daysSinceLastPost<365?K._({id:`oZUtTk`,values:{0:J.total,1:J.daysSinceLastPost,2:J.daysSinceLastPost,3:J.daysSinceLastPost,4:J.total,5:J.total,6:J.daysSinceLastPost}}):K._({id:`JvA7Mo`,values:{0:J.total,1:J.total}})}),R(`div`,{class:`posting-stats-bar`,children:[J.originals>0&&R(`div`,{class:`posting-stats-bar-section posting-stats-bar-originals`,style:{"--percentage":`${J.originals/J.total*100}%`}}),J.replies>0&&R(`div`,{class:`posting-stats-bar-section posting-stats-bar-replies`,style:{"--percentage":`${J.replies/J.total*100}%`}}),J.quotes>0&&R(`div`,{class:`posting-stats-bar-section posting-stats-bar-quotes`,style:{"--percentage":`${J.quotes/J.total*100}%`}}),J.boosts>0&&R(`div`,{class:`posting-stats-bar-section posting-stats-bar-boosts`,style:{"--percentage":`${J.boosts/J.total*100}%`}})]}),R(`div`,{class:`posting-stats-legends`,children:[R(`span`,{class:`ib`,children:[R(`span`,{class:`posting-stats-legend-item posting-stats-bar-originals`}),` `,R(j,{id:`HxF6Fk`})]}),` `,R(`span`,{class:`ib`,children:[R(`span`,{class:`posting-stats-legend-item posting-stats-bar-replies`}),` `,R(j,{id:`N8UzTV`})]}),` `,Yt()&&R(`span`,{class:`ib`,children:[R(`span`,{class:`posting-stats-legend-item posting-stats-bar-quotes`}),` `,R(j,{id:`eWLklq`})]}),R(`span`,{class:`ib`,children:[R(`span`,{class:`posting-stats-legend-item posting-stats-bar-boosts`}),` `,R(j,{id:`puY2t0`})]})]})]}):R(`div`,{class:`posting-stats`,children:R(j,{id:`vl3XTJ`})})})})}),!de&&R(`div`,{class:`account-metadata-box`,children:R(`div`,{class:`shazam-container no-animation`,hidden:!!J,children:R(`div`,{class:`shazam-container-inner`,children:R(`button`,{type:`button`,class:`posting-stats-button`,disabled:Ae===`loading`,onClick:()=>{Pe()},children:[R(`div`,{class:`posting-stats-icon ${Ae===`loading`?`loading`:``}`}),R(j,{id:`PjP87f`}),` `]})})})})]}),R(`footer`,{children:R(Ni,{info:O,instance:s,standalone:i,authenticated:d,onRelationshipChange:Fe,onProfileUpdate:Ie,setShowEditProfile:ze,showEndorsements:p,renderEndorsements:Be,setRenderEndorsements:Ve})}),R(pi,{accountID:H,info:O,open:Be,onlyOpenIfHasEndorsements:Be===`onlyOpenIfHasEndorsements`})]})]}),!!Re&&R(zt,{onClose:()=>{ze(!1)},children:R(di,{onClose:({state:e,account:n}={})=>{ze(!1),e===`success`&&(n?Ie(n):(async()=>{try{Ie(await b.v1.accounts.verifyCredentials())}catch{}})())}})})]})}var Wi=3;function Gi([e,n,r]){let i=.2126*e+.7152*n+.0722*r,a;return a=i>=220?1:i<=50?.1:i/255,a=Math.min(1,a),[e,n,r,a]}function Ki({account:e,instance:n,onClose:r}){let{_:i}=l(),{masto:a,instance:s,authenticated:c}=u({instance:n}),d=typeof e==`string`;return _(()=>{d||(o.accounts[`${e.id}@${s}`]=e)},[e]),ri(r),R(`div`,{class:`sheet`,children:[!!r&&R(`button`,{type:`button`,class:`sheet-close outer`,onClick:r,children:R(X,{icon:`x`,alt:i({id:`yz7wBu`})})}),R(Ui,{instance:s,authenticated:c,account:e,fetchAccount:async()=>{if(d)try{return await a.v1.accounts.lookup({acct:e,skip_webfinger:!1})}catch{let n=await a.v2.search.list({q:e,type:`accounts`,limit:c?1:11,resolve:c});if(n.accounts.length){let r=n.accounts.find(n=>n.url===e||e.startsWith(n.url));if(r)return r}if(/^https?:\/\/[^/]+\/@[^/]+$/.test(e)){let n=URL.parse(e);if(n){let{hostname:e,pathname:r}=n,i=r.replace(/^\//,``).replace(/\/$/,``)+`@`+e,o=await a.v2.search.list({q:i,type:`accounts`,limit:1,resolve:c});if(o.accounts.length)return o.accounts[0]}}}else return e}})]})}function qi({onClose:r}){let{_:i}=l(),{masto:a}=u(),[s,c]=I(`default`),[d,p]=I([]),[m,h]=f(e=>e+1,0);_(()=>{c(`loading`),(async()=>{try{let n=await Wt.drafts.keys();if(n.length){let r=e(),i=n.filter(e=>e.startsWith(r));if(i.length){let e=await Wt.drafts.getMany(i);e.sort((e,n)=>Date.parse(n.updatedAt)-Date.parse(e.updatedAt)),p(e)}else p([])}else p([]);c(`default`)}catch{c(`error`)}})()},[m]);let g=d?.length>0;return R(`div`,{class:`sheet`,children:[!!r&&R(`button`,{type:`button`,class:`sheet-close`,onClick:r,children:R(X,{icon:`x`,alt:i({id:`yz7wBu`})})}),R(`header`,{children:[R(`h2`,{children:[R(j,{id:`krk5ws`}),` `,R(U,{abrupt:!0,hidden:s!==`loading`})]}),g&&R(`div`,{class:`insignificant`,children:R(j,{id:`Ap_10-`})})]}),R(`main`,{children:g?R(n,{children:[R(`ul`,{class:`drafts-list`,children:d.map(e=>{let{updatedAt:r,key:l,draftStatus:u,replyTo:d,quote:f}=e,p=new Date(r);return R(`li`,{children:[R(`div`,{class:`mini-draft-meta`,children:[R(`b`,{children:[R(X,{icon:d?`reply`:`quill`,size:`s`}),` `,R(`time`,{children:[!!d&&R(n,{children:[R(`span`,{class:`bidi-isolate`,children:[`@`,d.account.acct]}),R(`br`,{})]}),xt(p)]})]}),R(ut,{confirmLabel:R(`span`,{children:R(j,{id:`_W5yFF`})}),menuItemClassName:`danger`,align:`end`,disabled:s===`loading`,onClick:()=>{(async()=>{try{await Wt.drafts.del(l),h()}catch{alert(i({id:`rEYoku`}))}})()},children:R(`button`,{type:`button`,class:`small light`,disabled:s===`loading`,children:R(j,{id:`Jb6_SB`})})})]}),R(`button`,{type:`button`,disabled:s===`loading`,class:`draft-item`,onClick:async()=>{let e,n;if(d?.id||f?.id){if(c(`loading`),d)try{e=await a.v1.statuses.$select(d.id).fetch()}catch{alert(i({id:`tMwimH`})),c(`default`);return}if(f)try{n=await a.v1.statuses.$select(f.id).fetch()}catch{alert(i({id:`2oZ4Iw`})),c(`default`)}c(`default`)}window.__COMPOSE__={draftStatus:u,replyToStatus:e,quoteStatus:n},o.showCompose=!0,o.showDrafts=!1},children:R(Ji,{draft:e})})]},r)})}),d.length>1&&R(`p`,{children:R(ut,{confirmLabel:R(`span`,{children:R(j,{id:`3IakFR`})}),menuItemClassName:`danger`,disabled:s===`loading`,onClick:()=>{(async()=>{c(`loading`);try{await Wt.drafts.delMany(d.map(e=>e.key)),c(`default`),h()}catch{alert(i({id:`0J4sZq`})),c(`error`)}})()},children:R(`button`,{type:`button`,class:`light danger`,disabled:s===`loading`,children:R(j,{id:`hOg-Mt`})})})})]}):R(`p`,{children:R(j,{id:`8iQ-jk`})})})]})}function Ji({draft:e}){let{_:r}=l(),{draftStatus:i,replyTo:a,quote:o}=e,{status:s,spoilerText:c,poll:u,mediaAttachments:d}=i,f=u?.options?.length>0,p=d?.length>0,h=!!o?.id,g=f||p||h,v=m(()=>{if(!p)return;let e=d.find(e=>/image/.test(e.type));if(!e)return;let{fileData:n,type:r,file:i,url:a}=e;if(n){let e=new Blob([n],{type:r});return URL.createObjectURL(e)}return i?URL.createObjectURL(i):a||null},[p,d]);return _(()=>()=>{v?.startsWith(`blob:`)&&URL.revokeObjectURL(v)},[v]),R(n,{children:R(`div`,{class:`mini-draft`,children:[g&&R(`div`,{class:`mini-draft-aside ${v?`has-image`:``}`,style:v?{"--bg-image":`url(${v})`}:{},children:[f&&R(X,{icon:`poll`,alt:r({id:`4WUbF1`})}),p&&R(`span`,{children:[R(X,{icon:`attachment`,alt:r({id:`xYilR2`})}),` `,R(`small`,{children:d?.length})]}),h&&R(X,{icon:`quote`,alt:r({id:`ZhhOwV`})})]}),R(`div`,{class:`mini-draft-main`,children:[!!c&&R(`div`,{class:`mini-draft-spoiler`,children:c}),!!s&&R(`div`,{class:`mini-draft-status`,children:s})]})]})})}function Yi({html:e,url:n,width:r,height:i,onClose:a=()=>{}}){let{_:o}=l();return R(`div`,{class:`embed-modal-container`,children:[R(`div`,{class:`top-controls`,children:[R(`button`,{type:`button`,class:`light`,onClick:()=>a(),children:R(X,{icon:`x`,alt:o({id:`yz7wBu`})})}),n&&R(`a`,{href:n,target:`_blank`,rel:`noopener`,class:`button plain`,children:[R(`span`,{children:R(j,{id:`4_RpOy`})}),` `,R(X,{icon:`external`})]})]}),R(`div`,{class:`embed-content`,dangerouslySetInnerHTML:{__html:e},style:{"--width":r+`px`,"--height":i+`px`,"--aspect-ratio":`${r}/${i}`}})]})}function Xi({instance:e,excludeRelationshipAttrs:r=[],postID:i,onClose:s=()=>{},blankCopy:c}){let{_:d}=l(),{masto:f,instance:p}=u(),m=e?e===p:!0,h=W(o),[g,v]=I(`default`),[y,b]=I(!1);if(ri(s),!h.showGenericAccounts)return null;let{id:x,heading:S,fetchAccounts:C,accounts:w,showReactions:T}=h.showGenericAccounts,[E,D]=I(w?.length?w:[]),[O,k]=I({}),A=async e=>{if(!e?.length||!m)return;let n=await ze(e,O);n&&k({...O,...n})},M=e=>{C&&(e&&!E?.length&&D([]),v(`loading`),(async()=>{try{let{done:n,value:r}=await C(e);if(Array.isArray(r)){if(e){let e=[];for(let n=0;n<r.length;n++){let i=r[n],a=e.find((e,r)=>e.id===i.id&&n!==r);a?a._types.push(...i._types):e.push({_types:[],...i})}D(e)}else D(e=>{let n=e;for(let e of r){let r=n.find(n=>n.id===e.id);r?r._types.push(...e._types):n.push(e)}return n});b(!n),A(r)}else b(!1);v(`default`)}catch{v(`error`)}})())},ee=a(!0);_(()=>{E?.length>0?C?(M(!0),ee.current=!1):A(E):(M(!0),ee.current=!1)},[C]),_(()=>{ee.current||h.reloadGenericAccounts?.id===x&&M(!0)},[h.reloadGenericAccounts.counter]);let N=o.statuses[i];return R(`div`,{id:`generic-accounts-container`,class:`sheet`,tabindex:`-1`,children:[R(`button`,{type:`button`,class:`sheet-close`,onClick:s,children:R(X,{icon:`x`,alt:d({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:S||d({id:`bPwFdf`})})}),R(`main`,{children:[N&&R(Z,{to:`/${e||p}/s/${N.id}`,class:`post-preview`,children:R(Mt,{status:N,size:`s`,readOnly:!0})}),E.length>0?R(n,{children:[R(`ul`,{class:`accounts-list`,children:E.map(e=>{let n=O[e.id],i=`${e.id}-${e._types?.length||``}`;return R(`li`,{children:[T&&e._types?.length>0&&R(`div`,{class:`reactions-block`,children:e._types.map(e=>R(X,{icon:{reblog:`rocket`,favourite:`heart`}[e],class:`${e}-icon`}))}),R(`div`,{class:`account-relationships`,children:R(wt,{account:e,showStats:!0,relationship:n,excludeRelationshipAttrs:r})})]},i)})}),g===`default`?y?R(He,{onChange:e=>{e&&M()},children:R(`button`,{type:`button`,class:`plain block`,onClick:()=>M(),children:R(j,{id:`uXRAkV`})})}):R(`p`,{class:`ui-state insignificant`,children:R(j,{id:`2EYeAZ`})}):g===`loading`&&R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})})]}):g===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):g===`error`?R(`p`,{class:`ui-state`,children:R(j,{id:`AThL_k`})}):R(`p`,{class:`ui-state insignificant`,children:c||d({id:`10OlfF`})})]})]})}function Zi({accounts:e,onClose:n}){let{_:r}=l(),i=g(),{accountsToImport:a}=m(()=>{if(!e)return{accountsToImport:[]};let n={duplicate:0,new:1};return{accountsToImport:e.map(e=>{let n=i.find(n=>n.info.id===e.info.id&&n.instanceURL===e.instanceURL)?`duplicate`:`new`;return{...e,__status:n}}).sort((e,r)=>n[e.__status]-n[r.__status])}},[e,i]),[s,c]=I(()=>{let e={};return a.forEach(n=>{n.__status===`duplicate`?e[n.info.id+n.instanceURL]=!1:e[n.info.id+n.instanceURL]=!0}),e}),[u,d]=I(`default`),f=()=>{d(`importing`),_e([...i,...e.filter(e=>s[e.info.id+e.instanceURL])]),n(),o.showImportExportAccounts=!1,o.showAccounts=!0},p=Object.values(s).filter(Boolean).length;return R(`div`,{id:`import-accounts-selection-container`,class:`sheet`,children:[!!n&&R(`button`,{type:`button`,class:`sheet-close`,onClick:n,disabled:u===`importing`,children:R(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),R(`header`,{children:R(`b`,{children:R(j,{id:`jiFPsN`})})}),R(`main`,{children:R(`div`,{class:`import-selection`,children:[a.filter(e=>e.__status!==`duplicate`).length>3&&R(`div`,{class:`accounts-list-header`,children:R(`label`,{class:`account-item`,children:[R(`input`,{type:`checkbox`,checked:a.filter(e=>e.__status!==`duplicate`).length>0&&a.filter(e=>e.__status!==`duplicate`).every(e=>s[e.info.id+e.instanceURL]),onChange:e=>{let n={...s},r=e.target.checked;a.forEach(e=>{e.__status!==`duplicate`&&(n[e.info.id+e.instanceURL]=r)}),c(n)},disabled:u===`importing`}),R(`span`,{class:`account-info`,children:R(j,{id:`wgNoIs`})})]})}),R(`ul`,{class:`accounts-list`,children:a.map(e=>{let n=e.info.id+e.instanceURL,r=s[n],{__status:i}=e;return R(`li`,{children:R(`label`,{class:`account-item`,children:[R(`input`,{type:`checkbox`,checked:r,onChange:e=>{c({...s,[n]:e.target.checked})},disabled:u===`importing`||i===`duplicate`}),R(vt,{url:e.info.avatarStatic,size:`xl`}),R(`div`,{class:`account-info`,children:R(qe,{account:{...e.info,acct:/@/.test(e.info.acct)?e.info.acct:`${e.info.acct}@${e.instanceURL}`},showAcct:!0})}),R(`div`,{class:`account-meta`,children:i===`duplicate`&&R(`span`,{class:`tag collapsed`,children:R(j,{id:`5Lvp3B`})})})]})},n)})}),R(`footer`,{children:[R(`button`,{type:`button`,class:`light`,onClick:n,disabled:u===`importing`,children:R(j,{id:`dEgA5A`})}),R(U,{hidden:u!==`importing`}),R(`button`,{type:`button`,disabled:p===0||u===`importing`,onClick:f,children:R(j,{id:`0mebiX`,values:{selectedCount:p}})})]})]})})]})}function Qi({onClose:e}){let{_:n}=l(),r=g(),[i,a]=I(`default`),[o,s]=I(null),[c,u]=I(!1),d=async()=>{a(`exporting`);try{let n={accounts:g().map(e=>{let{accessToken:n,...r}=e;return r}),createdAt:Date.now()},r=JSON.stringify(n),i=new Blob([r],{type:`application/json`}),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a;let s=new Date;o.download=`accounts-${`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,`0`)}-${String(s.getDate()).padStart(2,`0`)}_${String(s.getHours()).padStart(2,`0`)}-${String(s.getMinutes()).padStart(2,`0`)}`}.phanpy.json`,o.click(),URL.revokeObjectURL(a),e()}catch{Y(n({id:`lpYill`})),a(`error`)}},f=async e=>{if(e){a(`importing`);try{let n=await e.text(),r=JSON.parse(n)?.accounts;if(!Array.isArray(r))throw Error(`Invalid backup file`);s(r),a(`default`)}catch{Y(n({id:`BEVzjL`})),a(`error`)}}};return R(`div`,{id:`import-export-accounts-container`,class:`sheet`,onDragOver:e=>{e.preventDefault(),u(!0)},onDragLeave:()=>{u(!1)},onDrop:e=>{e.preventDefault(),u(!1);let n=e.dataTransfer.files[0];f(n)},children:[!!e&&R(`button`,{type:`button`,class:`sheet-close`,onClick:e,children:R(X,{icon:`x`,alt:n({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`k30qb8`,components:{0:R(`small`,{class:`ib insignificant`})}})})}),R(`main`,{children:[R(`section`,{children:[R(`label`,{class:`section-button button-import button plain4 ${c?`drag-over`:``}`,tabindex:`0`,children:[R(X,{icon:`arrow-down-circle`,size:`xxl`}),R(`b`,{children:R(j,{id:`l3s5ri`})}),R(`input`,{type:`file`,accept:`.json`,onChange:e=>{let n=e.target.files[0];f(n)},disabled:i===`importing`,style:{display:`none`}}),R(`div`,{children:R(`small`,{class:`insignificant`,children:R(j,{id:`SdA74G`})})})]}),` `,R(`button`,{type:`button`,class:`section-button button-export plain4`,onClick:d,disabled:i===`exporting`||r.length===0,children:[R(X,{icon:`arrow-up-circle`,size:`xxl`}),R(`b`,{children:R(j,{id:`GS-Mus`})}),R(`div`,{children:R(`small`,{class:`insignificant`,children:R(j,{id:`A7kMZX`,values:{0:r.length}})})})]})]}),R(`p`,{class:`insignificant`,children:R(`small`,{children:R(j,{id:`R-Pgtr`})})})]}),o&&R(zt,{onClose:()=>{s(null)},children:R(Zi,{accounts:o,onClose:()=>{s(null)}})})]})}var $i=140;function ea({alt:e,lang:n,onClose:r}){let{_:i}=l(),a=W(o),[s,c]=I(!1),u=Ke(!0),d=a.settings.contentTranslationHideLanguages||[],f=!!n&&n!==u&&!G([n],[u])&&!d.find(e=>n===e||G([n],[e]));return _(()=>{let n=e?.length>0&&e?.length<=$i;f&&n&&c(!0)},[f,e]),R(`div`,{class:`sheet`,tabindex:`-1`,children:[!!r&&R(`button`,{type:`button`,class:`sheet-close outer`,onClick:r,children:R(X,{icon:`x`,alt:i({id:`yz7wBu`})})}),R(`header`,{class:`header-grid`,children:[R(`h2`,{children:R(j,{id:`5gfDMm`})}),R(`div`,{class:`header-side`,children:R(tt,{align:`end`,menuButton:R(`button`,{type:`button`,class:`plain4`,children:R(X,{icon:`more`,alt:i({id:`2FYpfJ`}),size:`xl`})}),children:[R(Q,{disabled:s,onClick:()=>{c(!0)},children:[R(X,{icon:`translate`}),R(`span`,{children:R(j,{id:`pi8x_S`})})]}),dt&&R(Q,{onClick:()=>{bt(e,n)},children:[R(X,{icon:`speak`}),R(`span`,{children:R(j,{id:`yIBLq8`})})]})]})})]}),R(`main`,{lang:n,dir:`auto`,children:[R(`p`,{style:{whiteSpace:`pre-wrap`,textWrap:`pretty`},children:e}),(f||s)&&R(it,{forceTranslate:s,sourceLanguage:n,text:e})]})]})}var{min:ta,max:na}=Math,ra={};for(let e of[`Boolean`,`Number`,`String`,`Function`,`Array`,`Date`,`RegExp`,`Undefined`,`Null`])ra[`[object ${e}]`]=e.toLowerCase();function ia(e){return ra[Object.prototype.toString.call(e)]||`object`}var aa=(e,n=null)=>e.length>=3?Array.prototype.slice.call(e):ia(e[0])==`object`&&n?n.split(``).filter(n=>e[0][n]!==void 0).map(n=>e[0][n]):e[0].slice(0),{PI:oa,min:sa,max:ca}=Math;oa*2,oa/3;var la=oa/180,ua=180/oa;function da(e,n){let r=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(n[0])||(n=n.map(e=>[e]));let i=n[0].length,a=n[0].map((e,r)=>n.map(e=>e[r])),o=e.map(e=>a.map(n=>Array.isArray(e)?e.reduce((e,r,i)=>e+r*(n[i]||0),0):n.reduce((n,r)=>n+r*e,0)));return r===1&&(o=o[0]),i===1?o.map(e=>e[0]):o}var fa={Kn:18,labWhitePoint:`d65`,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},pa=e=>{let n=Math.sign(e);return e=Math.abs(e),(e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055)*n},ma=(e,n,r)=>{let{MtxAdaptMa:i,MtxAdaptMaI:a,MtxXYZ2RGB:o,RefWhiteRGB:s,Xn:c,Yn:l,Zn:u}=fa,d=c*i.m00+l*i.m10+u*i.m20,f=c*i.m01+l*i.m11+u*i.m21,p=c*i.m02+l*i.m12+u*i.m22,m=s.X*i.m00+s.Y*i.m10+s.Z*i.m20,h=s.X*i.m01+s.Y*i.m11+s.Z*i.m21,g=s.X*i.m02+s.Y*i.m12+s.Z*i.m22,_=(e*i.m00+n*i.m10+r*i.m20)*(m/d),v=(e*i.m01+n*i.m11+r*i.m21)*(h/f),y=(e*i.m02+n*i.m12+r*i.m22)*(g/p),b=_*a.m00+v*a.m10+y*a.m20,x=_*a.m01+v*a.m11+y*a.m21,S=_*a.m02+v*a.m12+y*a.m22,C=pa(b*o.m00+x*o.m10+S*o.m20),w=pa(b*o.m01+x*o.m11+S*o.m21),T=pa(b*o.m02+x*o.m12+S*o.m22);return[C*255,w*255,T*255]},ha=(...e)=>{e=aa(e,`lab`);let[n,r,i,...a]=e,[o,s,c]=ga([n,r,i]),[l,u,d]=ma(o,s,c);return[l,u,d,...a.length>0&&a[0]<1?[a[0]]:[]]};function ga(e){return da([[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],da([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],e).map(e=>e**3))}function _a(e){let n=Math.sign(e);return e=Math.abs(e),(e<=.04045?e/12.92:((e+.055)/1.055)**2.4)*n}var va=(e,n,r)=>{e=_a(e/255),n=_a(n/255),r=_a(r/255);let{MtxRGB2XYZ:i,MtxAdaptMa:a,MtxAdaptMaI:o,Xn:s,Yn:c,Zn:l,As:u,Bs:d,Cs:f}=fa,p=e*i.m00+n*i.m10+r*i.m20,m=e*i.m01+n*i.m11+r*i.m21,h=e*i.m02+n*i.m12+r*i.m22,g=s*a.m00+c*a.m10+l*a.m20,_=s*a.m01+c*a.m11+l*a.m21,v=s*a.m02+c*a.m12+l*a.m22,y=p*a.m00+m*a.m10+h*a.m20,b=p*a.m01+m*a.m11+h*a.m21,x=p*a.m02+m*a.m12+h*a.m22;return y*=g/u,b*=_/d,x*=v/f,p=y*o.m00+b*o.m10+x*o.m20,m=y*o.m01+b*o.m11+x*o.m21,h=y*o.m02+b*o.m12+x*o.m22,[p,m,h]},ya=(...e)=>{let[n,r,i,...a]=aa(e,`rgb`);return[...ba(va(n,r,i)),...a.length>0&&a[0]<1?[a[0]]:[]]};function ba(e){return da([[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],da([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],e).map(e=>Math.cbrt(e)))}var{sin:xa,cos:Sa}=Math,Ca=(...e)=>{let[n,r,i]=aa(e,`lch`);return isNaN(i)&&(i=0),i*=la,[n,Sa(i)*r,xa(i)*r]},wa=(...e)=>{e=aa(e,`lch`);let[n,r,i,...a]=e,[o,s,c]=Ca(n,r,i),[l,u,d]=ha(o,s,c);return[l,u,d,...a.length>0&&a[0]<1?[a[0]]:[]]},{sqrt:Ta,atan2:Ea,round:Da}=Math,Oa=(...e)=>{let[n,r,i]=aa(e,`lab`),a=Ta(r*r+i*i),o=(Ea(i,r)*ua+360)%360;return Da(a*1e4)===0&&(o=NaN),[n,a,o]},ka=(...e)=>{let[n,r,i,...a]=aa(e,`rgb`),[o,s,c]=ya(n,r,i),[l,u,d]=Oa(o,s,c);return[l,u,d,...a.length>0&&a[0]<1?[a[0]]:[]]},{PHANPY_IMG_ALT_API_URL:Aa}={};function ja({mediaAttachments:e,statusID:n,instance:r,lang:i,index:s=0,onClose:c=()=>{}}){let{_:u}=l(),[d,f]=I(`default`),p=a(null),[h,g]=I(s),v=a(null);ee(()=>{v.current?.scrollIntoView()},[]);let y=a(n);_(()=>{let e=s*p.current.clientWidth,r=y.current!==n;r&&(y.current=n),p.current.focus(),p.current.scrollTo({left:e*(Re()?-1:1),behavior:r?`auto`:`smooth`})},[s,n]);let[b,x]=I(!0);_(()=>{let n=n=>{c(n,h,e,p)};return p.current&&p.current.addEventListener(`swiped-down`,n),()=>{p.current&&p.current.removeEventListener(`swiped-down`,n)}},[h,e]),$e(`esc`,n=>{c(n,h,e,p)},{ignoreEventWhen:e=>!!document.querySelector(`#modal-container > *`)||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey,useKey:!0},[c,h,e]),_(()=>{let e=()=>{let{clientWidth:e,scrollLeft:n}=p.current;g(Math.round(Math.abs(n)/e))};return p.current&&p.current.addEventListener(`scroll`,e,{passive:!0}),()=>{p.current&&p.current.removeEventListener(`scroll`,e)}},[]),_(()=>{let e=setTimeout(()=>{p.current?.focus?.()},100);return()=>clearTimeout(e)},[]);let S=m(()=>e?.map(e=>{let{blurhash:n}=e;return n?ka(gt(n)):null}),[e]),C=m(()=>S?.map(e=>e?{light:wa([.95,.01,e[2]]),dark:wa([.35,.01,e[2]]),default:wa([.6,e[1],e[2]])}:null)),w=m(()=>{let e=100/C.length,n=C.map((n,r)=>{let i=r*e+5,a=(r+1)*e-5;return n?.light&&n?.dark?{light:`
rgb(${n.light?.join(`,`)}) ${i}%,
rgb(${n.light?.join(`,`)}) ${a}%
`,dark:`
rgb(${n.dark?.join(`,`)}) ${i}%,
rgb(${n.dark?.join(`,`)}) ${a}%
`}:{light:`
transparent ${i}%,
transparent ${a}%
`,dark:`
transparent ${i}%,
transparent ${a}%
`}});return{light:n.map(e=>e.light).join(`, `),dark:n.map(e=>e.dark).join(`, `)}},[C]),T=a(null);return _(()=>()=>{T.current?.hideToast?.()},[]),ee(()=>{let e=C[h],n,r;if(e){let i=F.local.get(`theme`);if(i){let a=`rgb(${e[i].join(`,`)})`;n=document.querySelector(`meta[name="theme-color"][data-theme-setting="manual"]`),n&&(r=n.content,n.content=a),document.documentElement.style.setProperty(`--meta-theme-color`,a)}else{let i=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`,a=`rgb(${e[i].join(`,`)})`;n=document.querySelector(`meta[name="theme-color"][media*="${i}"]`),n&&(r=n.content,n.content=a),document.documentElement.style.setProperty(`--meta-theme-color`,a)}}return()=>{n&&r&&(n.content=r),document.documentElement.style.removeProperty(`--meta-theme-color`)}},[h,C]),R(`div`,{class:`media-modal-container media-modal-count-${e?.length}`,children:[R(`div`,{ref:p,tabIndex:`0`,"data-swipe-threshold":`44`,class:`carousel`,onClick:n=>{(n.target.classList.contains(`carousel-item`)||n.target.classList.contains(`media`)||n.target.classList.contains(`media-zoom`))&&c(n,h,e,p)},style:e.length>1?{backgroundAttachment:`local`,"--accent-gradient-light":w?.light,"--accent-gradient-dark":w?.dark}:{},children:e?.map((n,r)=>{let a=e.length===1?C[r]:null;return R(`div`,{class:`carousel-item`,style:a?{"--accent-color":`rgb(${a.default.join(`,`)})`,"--accent-light-color":`rgb(${a.light?.join(`,`)})`,"--accent-dark-color":`rgb(${a.dark?.join(`,`)})`,"--accent-alpha-color":`rgba(${a.default.join(`,`)}, 0.4)`}:{},tabindex:`0`,ref:r===h?v:null,onClick:e=>{e.target.classList.contains(`media`)||x(!b)},children:[!!n.description&&R(`button`,{type:`button`,class:`media-alt`,hidden:!b,onClick:()=>{o.showMediaAlt={alt:n.description,lang:i}},children:[R(`span`,{class:`alt-badge`,children:`ALT`}),R(`span`,{class:`media-alt-desc`,lang:i,dir:`auto`,children:n.description})]}),R(Bt,{media:n,showOriginal:!0,lang:i})]},n.id)})}),R(`div`,{class:`carousel-top-controls`,hidden:!b,children:[R(`span`,{children:R(`button`,{type:`button`,class:`carousel-button`,onClick:n=>c(n,h,e,p),children:R(X,{icon:`x`,alt:u({id:`yz7wBu`})})})}),e?.length>1?R(`span`,{class:`carousel-dots`,children:e?.map((e,n)=>R(`button`,{type:`button`,disabled:n===h,class:`carousel-dot ${n===h?`active`:``}`,onClick:e=>{e.preventDefault(),e.stopPropagation();let r=p.current.clientWidth*n*(Re()?-1:1);p.current.focus(),p.current.scrollTo({left:r,behavior:`smooth`})},children:R(X,{icon:`round`,size:`s`,alt:``})},e.id))}):R(`span`,{}),R(`span`,{children:[R(tt,{overflow:`auto`,align:`end`,position:`anchor`,gap:4,menuClassName:`glass-menu`,menuButton:R(`button`,{type:`button`,class:`carousel-button`,children:R(X,{icon:`more2`,alt:u({id:`2FYpfJ`})})}),children:[R(Nt,{href:e[h]?.remoteUrl||e[h]?.url,class:`carousel-button`,target:`_blank`,title:u({id:`5hXGws`}),children:[R(X,{icon:`popout`}),R(`span`,{children:R(j,{id:`aDr7Vc`})})]}),!1]}),` `,!!n&&R(Z,{to:`${r?`/${r}`:``}/s/${n}${window.matchMedia(`(min-width: calc(40em + 350px))`).matches?`?media=${h+1}`:``}`,class:`button carousel-button media-post-link`,children:[R(`span`,{class:`button-label`,children:[R(j,{id:`ISg5SQ`}),` `]}),`»`]})]})]}),e?.length>1&&R(`div`,{class:`carousel-controls`,hidden:!b,children:[R(`button`,{type:`button`,class:`carousel-button`,hidden:h===0,onClick:e=>{e.preventDefault(),e.stopPropagation(),p.current.focus(),p.current.scrollTo({left:p.current.clientWidth*(h-1)*(Re()?-1:1),behavior:`smooth`})},children:R(X,{icon:`arrow-left`,alt:u({id:`DHhJ7s`})})}),R(`button`,{type:`button`,class:`carousel-button`,hidden:h===e.length-1,onClick:e=>{e.preventDefault(),e.stopPropagation(),p.current.focus(),p.current.scrollTo({left:p.current.clientWidth*(h+1)*(Re()?-1:1),behavior:`smooth`})},children:R(X,{icon:`arrow-right`,alt:u({id:`hXzOVo`})})})]})]})}function Ma({url:e,linkText:r,onClose:i}){let{_:a}=l();if(!e)return null;let o=e;try{let r=URL.parse(e),i=r.protocol,a=r.hostname,s=e.slice(r.origin.length);o=R(n,{children:[i,`//`,R(`strong`,{children:a}),s]})}catch{}return R(`div`,{class:`sheet sheet-modal`,id:`open-link-sheet`,tabindex:`-1`,children:[!!i&&R(`button`,{type:`button`,class:`sheet-close`,onClick:i,children:R(X,{icon:`x`,alt:a({id:`yz7wBu`})})}),R(`header`,{class:`header-grid`,children:R(`h2`,{children:R(j,{id:`Gj4mrz`})})}),R(`main`,{children:[!!r&&R(n,{children:[R(`p`,{class:`link-text`,children:[R(X,{icon:`cursor-hand`,size:`xl`}),` `,r]}),R(`div`,{class:`arrow`,children:R(X,{icon:`arrow-down`})})]}),R(`p`,{class:`full-url`,children:o})]}),R(`footer`,{children:[R(`button`,{type:`button`,class:`light`,onClick:i,children:R(j,{id:`dEgA5A`})}),R(`span`,{class:`spacer`}),R(`button`,{type:`button`,class:`plain6`,onClick:()=>{try{navigator.clipboard.writeText(e),Y(a({id:`edWbV6`}))}catch{Y(a({id:`W1ewR0`}))}},children:R(X,{icon:`copy`,alt:a({id:`he3ygx`})})}),navigator.canShare&&navigator.canShare({url:e})&&R(`button`,{type:`button`,class:`plain6`,onClick:()=>{if(navigator.share&&navigator.canShare({url:e}))try{navigator.share({url:e})}catch{}},children:R(X,{icon:`share`,alt:a({id:`LFKLqp`})})}),R(`a`,{class:`button`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:i,children:R(j,{id:`1TNIig`})})]})]})}var Na={newline:10,reset:27};function Pa(e){if(!Number.isSafeInteger(e))throw Error(`integer expected: ${e}`)}function Fa(e){if(!Number.isSafeInteger(e)||e<1||e>40)throw Error(`Invalid version=${e}. Expected number [1..40]`)}function Ia(e,n){return e.toString(2).padStart(n,`0`)}function La(e,n){let r=e%n;return r>=0?r:n+r}function Ra(e,n){return Array(e).fill(n)}function za(e){return e-=e>>>1&1431655765,e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}function Ba(e){let n=0,r=0;for(let i of e)n=Math.max(n,i.length),r+=i.length;let i=new Uint8Array(r),a=0;for(let r=0;r<n;r++)for(let n of e)r<n.length&&(i[a++]=n[r]);return i}function Va(){let e,n=1/0;return{add(r,i){r>=n||(e=i,n=r)},get:()=>e,score:()=>n}}function Ha(e){return Object.freeze({has:n=>e.includes(n),decode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!=`string`)throw Error(`alphabet.decode input should be array of strings`);return n.map(n=>{if(typeof n!=`string`)throw Error(`alphabet.decode: not string element=${n}`);let r=e.indexOf(n);if(r===-1)throw Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})},encode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!=`number`)throw Error(`alphabet.encode input should be an array of numbers`);return n.map(n=>{if(Pa(n),n<0||n>=e.length)throw Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})}})}function Ua(e){if(e.length!==32)throw Error(`expects 32 element matrix`);let n=[1431655765,858993459,252645135,16711935,65535];for(let r=0;r<5;r++){let i=n[r]>>>0,a=1<<r,o=a<<1;for(let n=0;n<32;n+=o)for(let r=0;r<a;r++){let o=n+r,s=o+a,c=e[o]>>>0,l=e[s]>>>0,u=(c>>>a^l)&i;e[o]=(c^u<<a)>>>0,e[s]=(l^u)>>>0}}}var Wa=e=>1<<(e&31)>>>0,Ga=(e,n)=>n===0?0:n===32?4294967295:(1<<n)-1<<e>>>0,Ka=class e{static size(e,n){if(typeof e==`number`&&(e={height:e,width:e}),!Number.isSafeInteger(e.height)&&e.height!==1/0)throw Error(`Bitmap: invalid height=${e.height} (${typeof e.height})`);if(!Number.isSafeInteger(e.width)&&e.width!==1/0)throw Error(`Bitmap: invalid width=${e.width} (${typeof e.width})`);return n!==void 0&&(e={width:Math.min(e.width,n.width),height:Math.min(e.height,n.height)}),e}static fromString(n){n=n.replace(/^\n+/g,``).replace(/\n+$/g,``);let r=n.split(String.fromCharCode(Na.newline)),i=r.length,a,o=[];for(let e of r){let n=e.split(``).map(e=>{if(e===`X`)return!0;if(e===` `)return!1;if(e!==`?`)throw Error(`Bitmap.fromString: unknown symbol=${e}`)});if(a!==void 0&&n.length!==a)throw Error(`Bitmap.fromString different row sizes: width=${a} cur=${n.length}`);a=n.length,o.push(n)}return a===void 0&&(a=0),new e({height:i,width:a},o)}defined;value;tailMask;words;fullWords;height;width;constructor(n,r){let{height:i,width:a}=e.size(n);if(!Number.isSafeInteger(i)||i<=0)throw Error(`Bitmap: invalid height=${i}, expected positive safe integer dimension`);if(!Number.isSafeInteger(a)||a<=0)throw Error(`Bitmap: invalid width=${a}, expected positive safe integer dimension`);if(this.height=i,this.width=a,this.tailMask=Ga(0,a&31||32),this.words=Math.ceil(a/32)|0,this.fullWords=Math.floor(a/32)|0,this.value=new Uint32Array(this.words*i),this.defined=new Uint32Array(this.value.length),r){if(r.length!==i)throw Error(`Bitmap: data height mismatch: exp=${i} got=${r.length}`);for(let e=0;e<i;e++){let n=r[e];if(!n||n.length!==a)throw Error(`Bitmap: data width mismatch at y=${e}: exp=${a} got=${n?.length}`);for(let r=0;r<a;r++)this.set(r,e,n[r])}}}point(e){return this.get(e.x,e.y)}isInside(e){return 0<=e.x&&e.x<this.width&&0<=e.y&&e.y<this.height}size(e){if(!e)return{height:this.height,width:this.width};let{x:n,y:r}=this.xy(e);return{height:this.height-r,width:this.width-n}}xy(e){if(typeof e==`number`&&(e={x:e,y:e}),!Number.isSafeInteger(e.x))throw Error(`Bitmap: invalid x=${e.x}`);if(!Number.isSafeInteger(e.y))throw Error(`Bitmap: invalid y=${e.y}`);return e.x=La(e.x,this.width),e.y=La(e.y,this.height),e}wordIndex(e,n){return n*this.words+(e>>>5)}bitIndex(e,n){return{word:this.wordIndex(e,n),bit:e&31}}isDefined(e,n){let r=this.wordIndex(e,n),i=Wa(e);return(this.defined[r]&i)!==0}get(e,n){let r=this.wordIndex(e,n),i=Wa(e);return(this.value[r]&i)!==0}maskWord(e,n,r){let{defined:i,value:a}=this;i[e]|=n,a[e]=a[e]&~n|-r&n}set(e,n,r){r!==void 0&&this.maskWord(this.wordIndex(e,n),Wa(e),r)}fillRectConst(e,n,r,i,a){if(r<=0||i<=0||a===void 0)return;let{value:o,defined:s,words:c}=this,l=e>>>5,u=e+r-1>>>5,d=e&31,f=e+r-1&31;for(let e=0;e<i;e++){let r=(n+e)*c;if(l===u){let e=Ga(d,f-d+1);this.maskWord(r+l,e,a);continue}this.maskWord(r+l,Ga(d,32-d),a);for(let e=l+1;e<u;e++)s[r+e]=4294967295,o[r+e]=a?4294967295:0;this.maskWord(r+u,Ga(0,f+1),a)}}rectWords(e,n,r,i,a){for(let o=0;o<i;o++){let i=n+o;for(let n=0;n<r;){let s=e+n,{bit:c,word:l}=this.bitIndex(s,i),u=Math.min(32-c,r-n);a(l,s,n,o,u),n+=u}}}rect(n,r,i){let{x:a,y:o}=this.xy(n),{height:s,width:c}=e.size(r,this.size({x:a,y:o}));if(typeof i!=`function`)return this.fillRectConst(a,o,c,s,i),this;let{defined:l,value:u}=this;return this.rectWords(a,o,c,s,(e,n,r,a,o)=>{let s=0,c=u[e];for(let e=0;e<o;e++){let o=Wa(n+e),l=i({x:r+e,y:a},(c&o)!==0);l!==void 0&&(s|=o,c=c&~o|-l&o)}l[e]|=s,u[e]=c}),this}rectRead(n,r,i){let{x:a,y:o}=this.xy(n),{height:s,width:c}=e.size(r,this.size({x:a,y:o})),{value:l}=this;return this.rectWords(a,o,c,s,(e,n,r,a,o)=>{let s=l[e];for(let e=0;e<o;e++){let o=Wa(n+e);i({x:r+e,y:a},(s&o)!==0)}}),this}hLine(e,n,r){return this.rect(e,{width:n,height:1},r)}vLine(e,n,r){return this.rect(e,{width:1,height:n},r)}border(n=2,r){if(!Number.isSafeInteger(n)||n<=0)throw Error(`Bitmap.border: invalid size=${n}`);let i=new e({height:this.height+2*n,width:this.width+2*n});return i.rect(0,1/0,r),i.embed({x:n,y:n},this),i}embed(n,r){let{x:i,y:a}=this.xy(n),{height:o,width:s}=e.size(r.size(),this.size({x:i,y:a}));if(s<=0||o<=0)return this;let{value:c,defined:l}=this,{words:u,value:d}=r;for(let e=0;e<o;e++){let n=e*u;for(let o=0;o<s;){let f=i+o,{word:p,bit:m}=this.bitIndex(f,a+e),{word:h,bit:g}=r.bitIndex(o,e),_=Math.min(32-m,s-o),v=d[h],y=g&&h+1<n+u?d[h+1]:0,b=g?(v>>>g|y<<32-g)>>>0:v,x=Ga(m,_),S=(b&Ga(0,_))<<m>>>0;l[p]|=x,c[p]=c[p]&~x|S,o+=_}}return this}rectSlice(n,r=this.size()){let{x:i,y:a}=this.xy(n),{height:o,width:s}=e.size(r,this.size({x:i,y:a})),c=new e({height:o,width:s});return this.rectRead({x:i,y:a},{height:o,width:s},(e,n)=>{this.isDefined(i+e.x,a+e.y)&&c.set(e.x,e.y,n)}),c}transpose(){let{height:n,width:r,value:i,defined:a,words:o}=this,s=new e({height:r,width:n}),{words:c,value:l,defined:u,tailMask:d}=s,f=new Uint32Array(32),p=new Uint32Array(32);for(let e=0;e<n;e+=32)for(let m=0;m<o;m++){let o=Math.min(32,n-e);for(let n=0;n<o;n++){let r=this.wordIndex(32*m,e+n);f[n]=i[r],p[n]=a[r]}f.fill(0,o),p.fill(0,o),Ua(f),Ua(p);for(let n=0;n<32;n++){let i=m*32+n;if(i>=r)break;let a=s.wordIndex(e,i),o=e>>>5==c-1?d:4294967295;l[a]=f[n]&o,u[a]=p[n]&o}}return s}negate(){let e=this.defined.length;for(let n=0;n<e;n++)this.value[n]=~this.value[n],this.defined[n]=4294967295;return this}scale(n){if(!Number.isSafeInteger(n)||n>1024)throw Error(`invalid scale factor: ${n}`);let{height:r,width:i}=this;return new e({height:n*r,width:n*i}).rect({x:0,y:0},1/0,({x:e,y:r})=>this.get(e/n|0,r/n|0))}clone(){let n=new e(this.size());return n.defined.set(this.defined),n.value.set(this.value),n}assertDrawn(){let{height:e,width:n,defined:r,tailMask:i,fullWords:a,words:o}=this;if(!(!e||!n))for(let n=0;n<e;n++){let e=n*o;for(let n=0;n<a;n++)if(r[e+n]!==4294967295)throw Error(`Invalid color type=undefined`);if(o!==a&&(r[e+a]&i)!==i)throw Error(`Invalid color type=undefined`)}}countPatternInRow(e,n,...r){if(!Number.isSafeInteger(n)||n<=0||n>=32)throw Error(`wrong patternLen`);let i=(1<<n)-1,{height:a,width:o,value:s,words:c}=this;if(!Number.isSafeInteger(e)||e<0||e>=a)return 0;let l=0,u=this.wordIndex(0,e);for(let e=0,a=0;e<c;e++){let d=s[u+e],f=e===c-1&&o&31||32;for(let o=0;o<f;o++)if(a=(a<<1|d>>>o&1)&i,!(e*32+o+1<n)){for(let e of r)if(a===e){l++;break}}}return l}getRuns(e,n){let{height:r,width:i,value:a,words:o}=this;if(i===0||!Number.isSafeInteger(e)||e<0||e>=r)return;let s=0,c,l=this.wordIndex(0,e);for(let e=0;e<o;e++){let r=a[l+e],u=e===o-1&&i&31||32;for(let e=0;e<u;e++){let i=(r&1<<e)!=0;if(i===c){s++;continue}c!==void 0&&n(s,c),c=i,s=1}}c!==void 0&&n(s,c)}popcnt(){let{height:e,width:n,words:r,fullWords:i,tailMask:a}=this;if(!e||!n)return 0;let o=0;for(let n=0;n<e;n++){let e=n*r;for(let n=0;n<i;n++)o+=za(this.value[e+n]);r!==i&&(o+=za(this.value[e+i]&a))}return o}countBoxes2x2(e){let{height:n,width:r,words:i}=this;if(r<2||!Number.isSafeInteger(e)||e<0||e+1>=n)return 0;let a=this.wordIndex(0,e),o=this.wordIndex(0,e+1),s=r&31?Ga(0,r-1&31):2147483647,c=0;for(let e=0;e<i;e++){let n=this.value[a+e],r=this.value[o+e],l=~(n^r)>>>0,u=e+1<i?this.value[a+e+1]>>>0:0,d=~(n^(n>>>1|(u&1)<<31)>>>0)>>>0,f=e+1<i?this.value[o+e+1]>>>0:0,p=~(r^(r>>>1|(f&1)<<31)>>>0)>>>0,m=(l&d&p)>>>0;e===i-1&&(m&=s),c+=za(m)}return c}toString(){let e=String.fromCharCode(Na.newline),n=``;for(let r=0;r<this.height;r++){let i=``;for(let e=0;e<this.width;e++){let n=this.get(e,r);i+=this.isDefined(e,r)?n?`X`:` `:`?`}n+=i+(r+1===this.height?``:e)}return n}toRaw(){let e=Array.from({length:this.height},()=>Array(this.width));for(let n=0;n<this.height;n++){let r=e[n];for(let e=0;e<this.width;e++)r[e]=this.get(e,n)}return e}toASCII(){let{height:e,width:n}=this,r=``;for(let i=0;i<e;i+=2){for(let a=0;a<n;a++){let n=this.get(a,i),o=i+1>=e?!0:this.get(a,i+1);!n&&!o?r+=``:!n&&o?r+=``:n&&!o?r+=``:n&&o&&(r+=` `)}r+=String.fromCharCode(Na.newline)}return r}toTerm(){let e=String.fromCharCode(Na.reset),n=e+`[0m`,r=e+`[1;47m `+n,i=e+`[40m `+n,a=String.fromCharCode(Na.newline),o=``;for(let e=0;e<this.height;e++){for(let n=0;n<this.width;n++){let a=this.get(n,e);o+=a?i:r}o+=a}return o}toSVG(e=!0){let n=`<svg viewBox="0 0 ${this.width} ${this.height}" xmlns="http://www.w3.org/2000/svg">`,r=``,i;return this.rectRead(0,1/0,(a,o)=>{if(!o)return;let{x:s,y:c}=a;if(!e){n+=`<rect x="${s}" y="${c}" width="1" height="1" />`;return}let l=`M${s} ${c}`;if(i){let e=`m${s-i.x} ${c-i.y}`;e.length<=l.length&&(l=e)}let u=s<10?`H${s}`:`h-1`;r+=`${l}h1v1${u}Z`,i=a}),e&&(n+=`<path d="${r}"/>`),n+=`</svg>`,n}toGIF(){let e=e=>[e&255,e>>>8&255],n=[...e(this.width),...e(this.height)],r=[];this.rectRead(0,1/0,(e,n)=>r.push(+(n===!0)));let i=[71,73,70,56,55,97,...n,246,0,0,255,255,255,...Ra(381,0),44,0,0,0,0,...n,0,7],a=Math.floor(r.length/126);for(let e=0;e<a;e++)i.push(127,128,...r.slice(126*e,126*(e+1)).map(e=>+e));return i.push(r.length%126+1,128,...r.slice(a*126).map(e=>+e)),i.push(1,129,0,59),new Uint8Array(i)}toImage(e=!1){let{height:n,width:r}=this.size(),i=new Uint8Array(n*r*(e?3:4)),a=0;for(let o=0;o<n;o++)for(let n=0;n<r;n++){let r=this.get(n,o)?0:255;i[a++]=r,i[a++]=r,i[a++]=r,e||(i[a++]=255)}return{height:n,width:r,data:i}}},qa=Object.freeze([`low`,`medium`,`quartile`,`high`]),Ja=Object.freeze([`numeric`,`alphanumeric`,`byte`,`kanji`,`eci`]),Ya=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],Xa={low:[7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],medium:[10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],quartile:[13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],high:[17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]},Za={low:[1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],medium:[1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],quartile:[1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],high:[1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]},Qa=Object.freeze({size:Object.freeze({encode:e=>21+4*(e-1),decode:e=>(e-17)/4}),sizeType:e=>Math.floor((e+7)/17),alignmentPatterns(e){if(e===1)return[];let n=Qa.size.encode(e)-6-1,r=n-6,i=Math.ceil(r/28),a=Math.floor(r/i);a%2?a+=1:r%i*2>=i&&(a+=2);let o=[6];for(let e=1;e<i;e++)o.push(n-(i-e)*a);return o.push(n),o},ECCode:Object.freeze({low:1,medium:0,quartile:3,high:2}),formatMask:21522,formatBits(e,n){let r=Qa.ECCode[e]<<3|n,i=r;for(let e=0;e<10;e++)i=i<<1^(i>>9)*1335;return(r<<10|i)^Qa.formatMask},versionBits(e){let n=e;for(let e=0;e<12;e++)n=n<<1^(n>>11)*7973;return e<<12|n},alphabet:Object.freeze({numeric:Ha(`0123456789`),alphanumerc:Ha(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`)}),lengthBits(e,n){return{numeric:[10,12,14],alphanumeric:[9,11,13],byte:[8,16,16],kanji:[8,10,12],eci:[0,0,0]}[n][Qa.sizeType(e)]},modeBits:Object.freeze({numeric:`0001`,alphanumeric:`0010`,byte:`0100`,kanji:`1000`,eci:`0111`}),capacity(e,n){let r=Ya[e-1],i=Xa[n][e-1],a=Za[n][e-1],o=Math.floor(r/a)-i,s=a-r%a;return{words:i,numBlocks:a,shortBlocks:s,blockLen:o,capacity:(r-i*a)*8,total:(i+o)*a+a-s}}}),$a=Object.freeze([(e,n)=>(e+n)%2==0,(e,n)=>n%2==0,(e,n)=>e%3==0,(e,n)=>(e+n)%3==0,(e,n)=>(Math.floor(n/2)+Math.floor(e/3))%2==0,(e,n)=>e*n%2+e*n%3==0,(e,n)=>(e*n%2+e*n%3)%2==0,(e,n)=>((e+n)%2+e*n%3)%2==0]),$={tables:(e=>{let n=Ra(256,0),r=Ra(256,0);for(let i=0,a=1;i<256;i++)n[i]=a,r[a]=i,a<<=1,a&256&&(a^=e);return{exp:n,log:r}})(285),exp:e=>$.tables.exp[e],log(e){if(e===0)throw Error(`GF.log: invalid arg=${e}`);return $.tables.log[e]%255},mul(e,n){return e===0||n===0?0:$.tables.exp[($.tables.log[e]+$.tables.log[n])%255]},add:(e,n)=>e^n,pow:(e,n)=>$.tables.exp[$.tables.log[e]*n%255],inv(e){if(e===0)throw Error(`GF.inverse: invalid arg=${e}`);return $.tables.exp[255-$.tables.log[e]]},polynomial(e){if(e.length==0)throw Error(`GF.polymomial: invalid length`);if(e[0]!==0)return e;let n=0;for(;n<e.length-1&&e[n]==0;n++);return e.slice(n)},monomial(e,n){if(e<0)throw Error(`GF.monomial: invalid degree=${e}`);if(n==0)return[0];let r=Ra(e+1,0);return r[0]=n,$.polynomial(r)},degree:e=>e.length-1,coefficient:(e,n)=>e[$.degree(e)-n],mulPoly(e,n){if(e[0]===0||n[0]===0)return[0];let r=Ra(e.length+n.length-1,0);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]=$.add(r[i+a],$.mul(e[i],n[a]));return $.polynomial(r)},mulPolyScalar(e,n){if(n==0)return[0];if(n==1)return e;let r=Ra(e.length,0);for(let i=0;i<e.length;i++)r[i]=$.mul(e[i],n);return $.polynomial(r)},mulPolyMonomial(e,n,r){if(n<0)throw Error(`GF.mulPolyMonomial: invalid degree`);if(r==0)return[0];let i=Ra(e.length+n,0);for(let n=0;n<e.length;n++)i[n]=$.mul(e[n],r);return $.polynomial(i)},addPoly(e,n){if(e[0]===0)return n;if(n[0]===0)return e;let r=e,i=n;r.length>i.length&&([r,i]=[i,r]);let a=Ra(i.length,0),o=i.length-r.length,s=i.slice(0,o);for(let e=0;e<s.length;e++)a[e]=s[e];for(let e=o;e<i.length;e++)a[e]=$.add(r[e-o],i[e]);return $.polynomial(a)},remainderPoly(e,n){let r=Array.from(e);for(let i=0;i<e.length-n.length+1;i++){let e=r[i];if(e!==0)for(let a=1;a<n.length;a++)n[a]!==0&&(r[i+a]=$.add(r[i+a],$.mul(n[a],e)))}return r.slice(e.length-n.length+1,r.length)},divisorPoly(e){let n=[1];for(let r=0;r<e;r++)n=$.mulPoly(n,[1,$.pow(2,r)]);return n},evalPoly(e,n){if(n==0)return $.coefficient(e,0);let r=e[0];for(let i=1;i<e.length;i++)r=$.add($.mul(n,r),e[i]);return r},euclidian(e,n,r){$.degree(e)<$.degree(n)&&([e,n]=[n,e]);let i=e,a=n,o=[0],s=[1];for(;2*$.degree(a)>=r;){let e=i,n=o;if(i=a,o=s,i[0]===0)throw Error(`rLast[0] === 0`);a=e;let r=[0],c=$.inv(i[0]);for(;$.degree(a)>=$.degree(i)&&a[0]!==0;){let e=$.degree(a)-$.degree(i),n=$.mul(a[0],c);r=$.addPoly(r,$.monomial(e,n)),a=$.addPoly(a,$.mulPolyMonomial(i,e,n))}if(r=$.mulPoly(r,o),s=$.addPoly(r,n),$.degree(a)>=$.degree(i))throw Error(`Division failed r: ${a}, rLast: ${i}`)}let c=$.coefficient(s,0);if(c==0)throw Error(`sigmaTilde(0) was zero`);let l=$.inv(c);return[$.mulPolyScalar(s,l),$.mulPolyScalar(a,l)]}};function eo(e){return{encode(n){let r=$.divisorPoly(e),i=Array.from(n);return i.push(...r.slice(0,-1).fill(0)),Uint8Array.from($.remainderPoly(i,r))},decode(n){let r=n.slice(),i=$.polynomial(Array.from(n)),a=Ra(e,0),o=!1;for(let n=0;n<e;n++){let e=$.evalPoly(i,$.exp(n));a[a.length-1-n]=e,e!==0&&(o=!0)}if(!o)return r;a=$.polynomial(a);let s=$.monomial(e,1),[c,l]=$.euclidian(s,a,e),u=Ra($.degree(c),0),d=0;for(let e=1;e<256&&d<u.length;e++)$.evalPoly(c,e)===0&&(u[d++]=$.inv(e));if(d!==u.length)throw Error(`RS.decode: invalid errors number`);for(let e=0;e<u.length;e++){let n=r.length-1-$.log(u[e]);if(n<0)throw Error(`RS.decode: invalid error location`);let i=$.inv(u[e]),a=1;for(let n=0;n<u.length;n++)e!==n&&(a=$.mul(a,$.add(1,$.mul(u[n],i))));r[n]=$.add(r[n],$.mul($.evalPoly(l,i),$.inv(a)))}return r}}}function to(e,n){let{words:r,shortBlocks:i,numBlocks:a,blockLen:o,total:s}=Qa.capacity(e,n),c=eo(r);return{encode(e){let n=[],r=[];for(let s=0;s<a;s++){let a=o+ +!(s<i);n.push(e.subarray(0,a)),r.push(c.encode(e.subarray(0,a))),e=e.subarray(a)}let s=Ba(n),l=Ba(r),u=new Uint8Array(s.length+l.length);return u.set(s),u.set(l,s.length),u},decode(e){if(e.length!==s)throw Error(`interleave.decode: len(data)=${e.length}, total=${s}`);let n=[];for(let e=0;e<a;e++){let a=e<i;n.push(new Uint8Array(r+o+ +!a))}let l=0;for(let r=0;r<o;r++)for(let i=0;i<a;i++)n[i][r]=e[l++];for(let r=i;r<a;r++)n[r][o]=e[l++];for(let s=o;s<o+r;s++)for(let r=0;r<a;r++){let a=r<i;n[r][s+ +!a]=e[l++]}let u=[];for(let e of n)u.push(...Array.from(c.decode(e)).slice(0,-r));return Uint8Array.from(u)}}}function no(e,n,r,i=!1){let a=Qa.size.encode(e),o=new Ka(a+2),s=new Ka(3).rect(0,3,!0).border(1,!1).border(1,!0).border(1,!1);o=o.embed(0,s).embed({x:-s.width,y:0},s).embed({x:0,y:-s.height},s),o=o.rectSlice(1,a);let c=new Ka(1).rect(0,1,!0).border(1,!1).border(1,!0),l=Qa.alignmentPatterns(e);for(let e of l)for(let n of l)o.isDefined(n,e)||o.embed({x:n-2,y:e-2},c);o=o.hLine({x:0,y:6},1/0,({x:e})=>o.isDefined(e,6)?void 0:e%2==0).vLine({x:6,y:0},1/0,({y:e})=>o.isDefined(6,e)?void 0:e%2==0);{let e=Qa.formatBits(n,r),s=n=>!i&&(e>>n&1)==1;for(let e=0;e<6;e++)o.set(8,e,s(e));for(let e=6;e<8;e++)o.set(8,e+1,s(e));for(let e=8;e<15;e++)o.set(8,a-15+e,s(e));for(let e=0;e<8;e++)o.set(a-e-1,8,s(e));for(let e=8;e<9;e++)o.set(15-e-1+1,8,s(e));for(let e=9;e<15;e++)o.set(15-e-1,8,s(e));o.set(8,a-8,!i)}if(e>=7){let n=Qa.versionBits(e);for(let e=0;e<18;e+=1){let r=!i&&(n>>e&1)==1,s=Math.floor(e/3),c=e%3+a-8-3;o.set(c,s,r),o.set(s,c,r)}}return o}function ro(e,n,r){let i=e,a=i.height,o=$a[n],s=-1,c=a-1;for(let e=a-1;e>0;e-=2){for(e==6&&(e=5);;c+=s){for(let n=0;n<2;n+=1){let a=e-n;i.isDefined(a,c)||r(a,c,o(a,c))}if(c+s<0||c+s>=a)break}s=-s}}function io(e){let n=`numeric`;for(let r of e)if(!Qa.alphabet.numeric.has(r)&&(n=`alphanumeric`,!Qa.alphabet.alphanumerc.has(r)))return`byte`;return n}function ao(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function oo(e,n,r,i,a=ao){let o=``,s=r.length;if(i===`numeric`){let e=Qa.alphabet.numeric.decode(r.split(``)),n=e.length;for(let r=0;r<n-2;r+=3)o+=Ia(e[r]*100+e[r+1]*10+e[r+2],10);n%3==1?o+=Ia(e[n-1],4):n%3==2&&(o+=Ia(e[n-2]*10+e[n-1],7))}else if(i===`alphanumeric`){let e=Qa.alphabet.alphanumerc.decode(r.split(``)),n=e.length;for(let r=0;r<n-1;r+=2)o+=Ia(e[r]*45+e[r+1],11);n%2==1&&(o+=Ia(e[n-1],6))}else if(i===`byte`){let e=a(r);s=e.length,o=Array.from(e).map(e=>Ia(e,8)).join(``)}else throw Error(`encode: unsupported type`);let{capacity:c}=Qa.capacity(e,n),l=Ia(s,Qa.lengthBits(e,i)),u=Qa.modeBits[i]+l+o;if(u.length>c)throw Error(`Capacity overflow`);u+=`0`.repeat(Math.min(4,Math.max(0,c-u.length))),u.length%8&&(u+=`0`.repeat(8-u.length%8));for(let e=0;u.length!==c;e++)u+=`1110110000010001`[e%16];let d=Uint8Array.from(u.match(/(.{8})/g).map(e=>Number(`0b${e}`)));return to(e,n).encode(d)}function so(e,n,r,i,a=!1){let o=no(e,n,i,a),s=0,c=8*r.length;if(ro(o,i,(e,n,i)=>{let a=!1;s<c&&(a=(r[s>>>3]>>(7-s&7)&1)!=0,s++),o.set(e,n,a!==i)}),s!==c)throw Error(`QR: bytes left after draw`);return o}var co=e=>{let n=e.map(e=>e?`1`:`0`).join(``);return{len:n.length,n:Number(`0b${n}`)}},lo=[!0,!1,!0,!0,!0,!1,!0],uo=[!1,!1,!1,!1],fo=co([...lo,...uo]),po=co([...uo,...lo]);function mo(e){let n=e,{width:r,height:i}=n,a=n.transpose(),o=0;for(let e=0;e<i;e++)n.getRuns(e,e=>{e>=5&&(o+=3+(e-5))});for(let e=0;e<r;e++)a.getRuns(e,e=>{e>=5&&(o+=3+(e-5))});let s=0;for(let e=0;e<i-1;e++)s+=3*n.countBoxes2x2(e);let c=0;for(let e=0;e<i;e++)c+=40*n.countPatternInRow(e,fo.len,fo.n,po.n);for(let e=0;e<r;e++)c+=40*a.countPatternInRow(e,fo.len,fo.n,po.n);let l=i*r,u=n.popcnt(),d=10*Math.ceil(Math.max(0,Math.abs(u*100-l*50)-l*5)/(l*5));return o+s+c+d}function ho(e,n,r,i){if(i===void 0){let a=Va();for(let i=0;i<$a.length;i++)a.add(mo(so(e,n,r,i,!0)),i);i=a.get()}if(i===void 0)throw Error(`Cannot find mask`);return so(e,n,r,i)}function go(e){if(!qa.includes(e))throw Error(`Invalid error correction mode=${e}. Expected: ${qa}`)}function _o(e){if(!Ja.includes(e))throw Error(`Encoding: invalid mode=${e}. Expected: ${Ja}`);if(e===`kanji`||e===`eci`)throw Error(`Encoding: ${e} is not supported (yet?).`)}function vo(e){if(![0,1,2,3,4,5,6,7].includes(e)||!$a[e])throw Error(`Invalid mask=${e}. Expected number [0..7]`)}function yo(e,n=`raw`,r={}){let i=r,a=i.ecc===void 0?`medium`:i.ecc;go(a);let o=i.encoding===void 0?io(e):i.encoding;_o(o),i.mask!==void 0&&vo(i.mask);let s=i.version,c,l=Error(`Unknown error`);if(s!==void 0)Fa(s),c=oo(s,a,e,o,i.textEncoder);else for(let n=1;n<=40;n++)try{c=oo(n,a,e,o,i.textEncoder),s=n;break}catch(e){l=e}if(!s||!c)throw l;let u=ho(s,a,c,i.mask);u.assertDrawn();let d=i.border===void 0?2:i.border;if(!Number.isSafeInteger(d)||d<=0)throw Error(`invalid border=${d}`);if(u=u.border(d,!1),i.scale!==void 0&&(u=u.scale(i.scale)),n===`raw`)return u.toRaw();if(n===`ascii`)return u.toASCII();if(n===`svg`)return u.toSVG(i.optimize);if(n===`gif`)return u.toGIF();if(n===`term`)return u.toTerm();throw Error(`Unknown output: ${n}`)}var bo=Object.freeze({best:Va,bin:Ia,popcnt:za,drawTemplate:no,fillArr:Ra,info:Qa,interleave:to,validateVersion:Fa,zigzag:ro}),xo=window.OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement(`canvas`),So=xo.getContext(`2d`,{willReadFrequently:!0});So.imageSmoothingEnabled=!1;function Co({text:e,arena:n,backgroundMask:r,arenaCircle:i=!0,caption:o}){let s=a(null),[c,l]=I(0),[u,d]=I(!1),[f,p]=I(!1),h=f?!1:i;if(_(()=>{if(o&&s.current){let e=s.current.offsetHeight;l(e)}},[o]),_(()=>{if(n){let e=new Image;e.crossOrigin=`anonymous`,e.onload=()=>{d(!0);try{let{width:n,height:r}=e;xo.width=n,xo.height=r,So.drawImage(e,0,0);let i=So.getImageData(0,0,n,r).data,a=i.length/4,o=0,s=!1;for(let e=3;e<i.length;e+=4)if(i[e]<=128&&o++,o/a>.1){s=!0;break}p(s)}catch{p(!1)}},e.onerror=e=>{d(!0)},e.src=n}else d(!1)},[n]),!e)return null;let g=m(()=>yo(e,`raw`,{ecc:`high`,border:1,scale:1}).slice(1,-1).map(e=>e.slice(1,-1)),[e]),v=g.length,y=u?Math.ceil(v*.3):0,b=Math.floor((v-y)/2),x=b+y,S=(e,n)=>{if(e<0||e>=v||n<0||n>=v)return!1;if(u&&e>=b&&e<x&&n>=b&&n<x)if(i){let r=(b+x)/2,i=(b+x)/2,a=y/2,o=e+.5-r,s=n+.5-i;if(Math.sqrt(o*o+s*s)<a)return!1}else return!1;return g[n][e]},C=(e,n)=>e<0||e>=v||n<0||n>=v?!1:S(e,n),w=(e,n)=>e<7&&n<7||e>=v-7&&n<7||e<7&&n>=v-7,T=m(()=>{let e=``;for(let n=0;n<v;n++)for(let r=0;r<v;r++){if(!C(r,n)||w(r,n))continue;let i=r+.5,a=n+.5,o=C(r,n-1)&&!w(r,n-1),s=C(r+1,n)&&!w(r+1,n),c=C(r,n+1)&&!w(r,n+1),l=C(r-1,n)&&!w(r-1,n);s&&(e+=`M ${i} ${a} L ${i+1} ${a} `),c&&(e+=`M ${i} ${a} L ${i} ${a+1} `),!o&&!s&&!c&&!l&&(e+=`M ${i} ${a} L ${i} ${a} `)}return e},[v,g,u,b,x,y,h]),E=[{x:0,y:0},{x:v-7,y:0},{x:0,y:v-7}],D=1.1,O=.6,k=y-2,A=b+1,j=b+1,M=v+4,ee=v+4+(o?2+c:0),N=M*.25;return R(`svg`,{class:`qr-code`,viewBox:`-2 -2 ${M} ${ee}`,xmlns:`http://www.w3.org/2000/svg`,"shape-rendering":`geometricPrecision`,children:[R(`defs`,{children:[R(`g`,{id:`position-marker`,children:[R(`rect`,{x:`0.5`,y:`0.5`,width:`6`,height:`6`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,rx:D,ry:D}),R(`rect`,{x:`2`,y:`2`,width:`3`,height:`3`,fill:`currentColor`,rx:O,ry:O})]}),R(`g`,{id:`position-marker-mask`,children:[R(`rect`,{x:`0.5`,y:`0.5`,width:`6`,height:`6`,fill:`none`,stroke:`white`,"stroke-width":`1`,rx:D,ry:D}),R(`rect`,{x:`2`,y:`2`,width:`3`,height:`3`,fill:`white`,rx:O,ry:O})]}),r&&R(`filter`,{id:`blur-mask`,children:[R(`feGaussianBlur`,{in:`SourceGraphic`,stdDeviation:`2`}),R(`feColorMatrix`,{type:`saturate`,values:`2`}),R(`feComponentTransfer`,{children:[R(`feFuncR`,{type:`linear`,slope:`1.2`,intercept:`0.3`}),R(`feFuncG`,{type:`linear`,slope:`1.2`,intercept:`0.3`}),R(`feFuncB`,{type:`linear`,slope:`1.2`,intercept:`0.3`})]})]}),r&&R(`mask`,{id:`qr-pattern-mask`,children:[R(`path`,{fill:`white`,stroke:`white`,"stroke-width":`1`,"stroke-linejoin":`round`,"stroke-linecap":`round`,d:T}),R(`g`,{id:`position-markers-mask`,children:E.map(e=>R(`use`,{href:`#position-marker-mask`,x:e.x,y:e.y},`${e.x}-${e.y}`))}),u&&h&&R(`circle`,{cx:A+k/2,cy:j+k/2,r:k/2,fill:`black`}),u&&!i&&R(`rect`,{x:A,y:j,width:k,height:k,fill:`black`})]}),R(`path`,{id:`qr-pattern`,fill:`currentColor`,stroke:`currentColor`,"stroke-width":`1`,"stroke-linejoin":`round`,"stroke-linecap":`round`,d:T})]}),R(`use`,{href:`#qr-pattern`}),R(`g`,{id:`position-markers`,children:E.map(e=>R(`use`,{href:`#position-marker`,x:e.x,y:e.y},`${e.x}-${e.y}`))}),r&&R(`g`,{mask:`url(#qr-pattern-mask)`,children:R(`image`,{href:r,x:-2-N,y:-2-N,width:M+N*2,height:M+N*2,preserveAspectRatio:`none`,opacity:`0.5`,filter:`url(#blur-mask)`})}),n&&u&&R(`image`,{href:n,x:A,y:j,width:k,height:k,preserveAspectRatio:`xMidYMid slice`,"clip-path":h?`circle(${k/2}px at ${k/2}px ${k/2}px)`:void 0}),o&&R(`foreignObject`,{x:0,y:v+2,width:v,height:c,children:R(`div`,{ref:s,xmlns:`http://www.w3.org/1999/xhtml`,class:`qr-code-caption`,dangerouslySetInnerHTML:{__html:o}})})]})}var wo=!!navigator.mediaDevices?.getUserMedia;function To({text:e,arena:n,backgroundMask:r,caption:i,onClose:a,onScannerClick:o}){let{_:s}=l();return R(`div`,{class:`qr-code-modal-container`,children:[R(`div`,{class:`qr-code-modal-controls`,children:[wo&&typeof o==`function`?R(`button`,{type:`button`,class:`plain4`,onClick:o,children:R(X,{icon:`scan`,alt:s({id:`XDwkfO`})})}):R(`span`,{}),!!a&&R(`button`,{type:`button`,class:`plain4`,onClick:a,children:R(X,{icon:`x`,alt:s({id:`yz7wBu`})})})]}),R(Co,{text:e,arena:n,backgroundMask:r,caption:i}),R(`div`,{class:`qr-code-text`,children:e})]})}var Eo=`BarcodeDetector`in window;Eo||setTimeout(()=>{le(()=>import(`./dom-CrhkFlqe.js`),[],import.meta.url).catch(()=>{})},1e3);var Do=class{constructor(e,n){this.stream=e,this.player=n,this.setStream(e)}setStream(e){this.stream=e;let{player:n}=this;n.setAttribute(`autoplay`,``),n.setAttribute(`muted`,``),n.setAttribute(`playsinline`,``),n.srcObject=e}async listDevices(){if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw Error(`Media Devices not supported`);return(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`).map(e=>({deviceId:e.deviceId,label:e.label||`Camera ${e.deviceId}`}))}async setDevice(e){this.stop();let n=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:e}}});this.setStream(n)}readFrame(e,n=!1){let{player:r}=this;if(n)return e.drawImage(r,r.videoHeight,r.videoWidth);let i=getSize(r);return e.drawImage(r,i.height,i.width)}stop(){for(let e of this.stream.getTracks())e.stop()}},Oo=async e=>{if(navigator.permissions?.query)try{(await navigator.permissions.query({name:`camera`})).addEventListener(`change`,()=>{})}catch{}return new Do(await navigator.mediaDevices.getUserMedia({video:{height:{ideal:720},width:{ideal:1280},facingMode:`environment`}}),e)};function ko({onClose:e,checkValidity:r,actionableText:i}){let{_:o,_:s}=l(),c=a(null),u=a(null),d=a(null),[f,p]=I(``),[m,h]=I(!0),[g,v]=I(`loading`);_(()=>{let e;return screen?.orientation?.type&&c.current&&(e=()=>{let e=/landscape/.test(window.screen.orientation.type)?`landscape`:`portrait`;c.current.classList.toggle(`landscape`,e===`landscape`)},screen.orientation.addEventListener(`change`,e),e()),()=>{e&&screen?.orientation?.removeEventListener&&screen.orientation.removeEventListener(`change`,e)}},[]),_(()=>{let e,n,r,i,a;return m&&(async()=>{try{n=await Oo(u.current),Eo?i=new BarcodeDetector({formats:[`qr_code`]}):(a=await le(()=>import(`./dom-CrhkFlqe.js`),[],import.meta.url),r=new a.QRCanvas({overlay:d.current},{cropToSquare:!1,overlayMainColor:`transparent`,overlayFinderColor:`rgba(255, 0, 255, 0.5)`}));let o=u.current;o&&(o.addEventListener(`loadedmetadata`,()=>{v(`default`)}),o.addEventListener(`play`,()=>{let{videoWidth:s,videoHeight:l}=o;if(s&&l&&(c.current.style.setProperty(`--long-dimension`,Math.max(s,l)),c.current.style.setProperty(`--short-dimension`,Math.min(s,l))),Eo){let n=async()=>{try{let e=await i.detect(u.current);e.length>0&&p(e[0].rawValue)}catch{}},r,a=()=>{n(),r=requestAnimationFrame(a)};a(),e=()=>cancelAnimationFrame(r)}else e=a.frameLoop(()=>{try{let e=n.readFrame(r,!0);e!=null&&p(e)}catch{}})}))}catch{v(`error`),h(!1)}})(),()=>{e&&e(),n&&n.stop(),r&&r.clear()}},[m]);let y=typeof r==`function`?r(f):!!f;return R(`div`,{class:`qr-scanner-modal`,children:[R(`div`,{class:`qr-scanner-header`,children:[R(U,{abrupt:!0,hidden:g!==`loading`}),R(`button`,{type:`button`,class:`plain4`,onClick:e,children:R(X,{icon:`x`,alt:o({id:`yz7wBu`})})})]}),g===`error`?R(`div`,{class:`ui-state`,children:R(`p`,{children:R(j,{id:`08IojR`})})}):R(n,{children:[R(`div`,{ref:c,class:`qr-scanner-video-container`,children:[R(`video`,{ref:u,playsInline:!0,muted:!0,disablepictureinpicture:!0}),!Eo&&R(`canvas`,{ref:d,class:`qr-scanner-canvas`}),R(`svg`,{class:`qr-scanner-corner-hint`,viewBox:`0 0 100 100`,preserveAspectRatio:`xMidYMid meet`,children:[R(`path`,{d:`M 25 10 L 15 10 Q 10 10 10 15 L 10 25`,stroke:`currentColor`,"stroke-width":`2`,fill:`none`,"stroke-linecap":`round`}),R(`path`,{d:`M 75 10 L 85 10 Q 90 10 90 15 L 90 25`,stroke:`currentColor`,"stroke-width":`2`,fill:`none`,"stroke-linecap":`round`}),R(`path`,{d:`M 25 90 L 15 90 Q 10 90 10 85 L 10 75`,stroke:`currentColor`,"stroke-width":`2`,fill:`none`,"stroke-linecap":`round`}),R(`path`,{d:`M 75 90 L 85 90 Q 90 90 90 85 L 90 75`,stroke:`currentColor`,"stroke-width":`2`,fill:`none`,"stroke-linecap":`round`})]})]}),R(`div`,{class:`qr-scanner-result`,children:!!f&&R(n,{children:[R(`p`,{class:`qr-scanner-text`,children:f}),y&&R(`button`,{type:`button`,class:`button plain6`,onClick:()=>{e({text:f})},children:i?s(i):R(X,{icon:`arrow-right`})})]})})]})]})}var Ao=[`spam`,`legal`,`violation`,`other`],jo={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 Mo(e,n){if(!e.translations||!n)return null;let r=Object.keys(e.translations);if(!r?.length)return null;let i=G([n],r,null);if(!i){let e=r.map(e=>e.split(/(?=[A-Z])/).map((e,n)=>n===0?e:e.toLowerCase()).join(`-`));i=G([n],e,null)}if(i&&i.includes(`-`)){let[e,n]=i.split(`-`);i=e+n.charAt(0).toUpperCase()+n.slice(1)}return i}function No(e,n){return e?.length?n?e.map(e=>{let r=Mo(e,n);return{...e,_translatedText:e.translations?.[r]?.text||null}}):e:[]}function Po({account:e,post:r,onClose:i}){let{_:o,_:s,i18n:c}=l(),{masto:d}=u(),[f,p]=I(`default`),[h,g]=e.acct.split(`@`),[_,v]=m(()=>{let{rules:e,domain:n}=se();return[No(e||[],c.locale),n]},[c.locale]),[y,b]=I(null),[x,S]=I(!1),C=a(null),[w,T]=I(!1);return R(`div`,{class:`report-modal-container`,children:[R(`div`,{class:`top-controls`,children:[R(`h1`,{children:s(r?{id:`muLhL3`}:{id:`ACul2G`,values:{username:h}})}),R(`button`,{type:`button`,class:`plain4 small`,disabled:f===`loading`,onClick:()=>i(),children:R(X,{icon:`x`,size:`xl`,alt:s({id:`yz7wBu`})})})]}),R(`main`,{children:[R(`div`,{class:`report-preview`,children:r?R(Mt,{status:r,size:`s`,previewMode:!0}):R(wt,{account:e,avatarSize:`xxl`,useAvatarStatic:!0,showStats:!0,showActivity:!0})}),!!y&&!jo[y].excludeStamp&&R(`span`,{class:`rubber-stamp`,"aria-hidden":`true`,children:[o(jo[y].stampLabel||o(jo[y].label)),R(`small`,{children:R(j,{id:`2WtL62`})})]},y),R(`form`,{onSubmit:n=>{n.preventDefault();let a=new FormData(n.target),o=Object.fromEntries(a.entries()),{category:c,comment:l,forward:u}=o;l||=void 0,u===`on`&&(u=!0);let f=c===`violation`?Object.entries(o).filter(([e])=>e.startsWith(`rule_ids`)).map(([e,n])=>n):void 0;p(`loading`),(async()=>{try{await d.v1.reports.create({accountId:e.id,statusIds:r?.id?[r.id]:void 0,category:c,comment:l,ruleIds:f,forward:u}),p(`success`),Y(s(r?{id:`y3ou-8`}:{id:`R9kjEL`})),i()}catch(e){p(`error`),Y(e?.message||s(r?{id:`-3FjPq`}:{id:`oEQq5w`}))}})()},children:[R(`p`,{children:s(r?{id:`L9fUm-`}:{id:`rSLkfe`})}),R(`section`,{class:`report-categories`,children:Ao.map(e=>e===`violation`&&!_?.length?null:R(n,{children:[R(`label`,{class:`report-category`,children:[R(`input`,{type:`radio`,name:`category`,value:e,required:!0,disabled:f===`loading`,onChange:e=>{b(e.target.value),S(e.target.value===`violation`)}}),R(`span`,{children:[o(jo[e].label),` \xA0`,R(`small`,{class:`ib insignificant`,children:o(jo[e].description)})]})]}),e===`violation`&&!!_?.length&&R(`div`,{class:`shazam-container no-animation`,hidden:!x,children:R(`div`,{class:`shazam-container-inner`,children:R(`div`,{class:`report-rules`,ref:C,children:_.map((e,n)=>R(`label`,{class:`report-rule`,children:[R(`input`,{type:`checkbox`,name:`rule_ids[${n}]`,value:e.id,required:x&&!w,disabled:f===`loading`,onChange:e=>{let{checked:n}=e.target;n?T(!0):C.current.querySelectorAll(`input:checked`).length||T(!1)}}),R(`span`,{children:e._translatedText||e.text})]},e.id))})})})]},e))}),R(`section`,{class:`report-comment`,children:[R(`p`,{children:R(`label`,{for:`report-comment`,children:R(j,{id:`ecVtjm`})})}),R(`textarea`,{maxlength:`1000`,rows:`1`,name:`comment`,id:`report-comment`,disabled:f===`loading`,required:!r})]}),!!g&&g!==v&&R(`section`,{children:R(`p`,{children:R(`label`,{children:[R(`input`,{type:`checkbox`,switch:!0,name:`forward`,disabled:f===`loading`}),` `,R(`span`,{children:R(j,{id:`cyjS8M`,values:{domain:g},components:{0:R(`i`,{})}})})]})})}),R(`footer`,{children:[R(`button`,{type:`submit`,disabled:f===`loading`,children:R(j,{id:`4cijjm`})}),` `,R(`button`,{type:`submit`,class:`plain2`,disabled:f===`loading`,onClick:async()=>{try{await d.v1.accounts.$select(e.id).mute(),Y(s({id:`_BGBeF`,values:{username:h}}))}catch{Y(s({id:`v02K7_`,values:{username:h}}))}},children:R(j,{id:`caeqw_`,components:{0:R(`small`,{class:`ib`})}})}),` `,R(`button`,{type:`submit`,class:`plain2`,disabled:f===`loading`,onClick:async()=>{try{await d.v1.accounts.$select(e.id).block(),Y(s({id:`kjUejn`,values:{username:h}}))}catch{Y(s({id:`pMcdDp`,values:{username:h}}))}},children:R(j,{id:`JybQca`,components:{0:R(`small`,{class:`ib`})}})}),R(U,{hidden:f!==`loading`})]})]})]})]})}var Fo=V(((e,n)=>{var r=(function(){var e=String.fromCharCode,n=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,r=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$`,i={};function a(e,n){if(!i[e]){i[e]={};for(var r=0;r<e.length;r++)i[e][e.charAt(r)]=r}return i[e][n]}var o={compressToBase64:function(e){if(e==null)return``;var r=o._compress(e,6,function(e){return n.charAt(e)});switch(r.length%4){default:case 0:return r;case 1:return r+`===`;case 2:return r+`==`;case 3:return r+`=`}},decompressFromBase64:function(e){return e==null?``:e==``?null:o._decompress(e.length,32,function(r){return a(n,e.charAt(r))})},compressToUTF16:function(n){return n==null?``:o._compress(n,15,function(n){return e(n+32)})+` `},decompressFromUTF16:function(e){return e==null?``:e==``?null:o._decompress(e.length,16384,function(n){return e.charCodeAt(n)-32})},compressToUint8Array:function(e){for(var n=o.compress(e),r=new Uint8Array(n.length*2),i=0,a=n.length;i<a;i++){var s=n.charCodeAt(i);r[i*2]=s>>>8,r[i*2+1]=s%256}return r},decompressFromUint8Array:function(n){if(n==null)return o.decompress(n);for(var r=Array(n.length/2),i=0,a=r.length;i<a;i++)r[i]=n[i*2]*256+n[i*2+1];var s=[];return r.forEach(function(n){s.push(e(n))}),o.decompress(s.join(``))},compressToEncodedURIComponent:function(e){return e==null?``:o._compress(e,6,function(e){return r.charAt(e)})},decompressFromEncodedURIComponent:function(e){return e==null?``:e==``?null:(e=e.replace(/ /g,`+`),o._decompress(e.length,32,function(n){return a(r,e.charAt(n))}))},compress:function(n){return o._compress(n,16,function(n){return e(n)})},_compress:function(e,n,r){if(e==null)return``;var i,a,o={},s={},c=``,l=``,u=``,d=2,f=3,p=2,m=[],h=0,g=0,_;for(_=0;_<e.length;_+=1)if(c=e.charAt(_),Object.prototype.hasOwnProperty.call(o,c)||(o[c]=f++,s[c]=!0),l=u+c,Object.prototype.hasOwnProperty.call(o,l))u=l;else{if(Object.prototype.hasOwnProperty.call(s,u)){if(u.charCodeAt(0)<256){for(i=0;i<p;i++)h<<=1,g==n-1?(g=0,m.push(r(h)),h=0):g++;for(a=u.charCodeAt(0),i=0;i<8;i++)h=h<<1|a&1,g==n-1?(g=0,m.push(r(h)),h=0):g++,a>>=1}else{for(a=1,i=0;i<p;i++)h=h<<1|a,g==n-1?(g=0,m.push(r(h)),h=0):g++,a=0;for(a=u.charCodeAt(0),i=0;i<16;i++)h=h<<1|a&1,g==n-1?(g=0,m.push(r(h)),h=0):g++,a>>=1}d--,d==0&&(d=2**p,p++),delete s[u]}else for(a=o[u],i=0;i<p;i++)h=h<<1|a&1,g==n-1?(g=0,m.push(r(h)),h=0):g++,a>>=1;d--,d==0&&(d=2**p,p++),o[l]=f++,u=String(c)}if(u!==``){if(Object.prototype.hasOwnProperty.call(s,u)){if(u.charCodeAt(0)<256){for(i=0;i<p;i++)h<<=1,g==n-1?(g=0,m.push(r(h)),h=0):g++;for(a=u.charCodeAt(0),i=0;i<8;i++)h=h<<1|a&1,g==n-1?(g=0,m.push(r(h)),h=0):g++,a>>=1}else{for(a=1,i=0;i<p;i++)h=h<<1|a,g==n-1?(g=0,m.push(r(h)),h=0):g++,a=0;for(a=u.charCodeAt(0),i=0;i<16;i++)h=h<<1|a&1,g==n-1?(g=0,m.push(r(h)),h=0):g++,a>>=1}d--,d==0&&(d=2**p,p++),delete s[u]}else for(a=o[u],i=0;i<p;i++)h=h<<1|a&1,g==n-1?(g=0,m.push(r(h)),h=0):g++,a>>=1;d--,d==0&&(d=2**p,p++)}for(a=2,i=0;i<p;i++)h=h<<1|a&1,g==n-1?(g=0,m.push(r(h)),h=0):g++,a>>=1;for(;;)if(h<<=1,g==n-1){m.push(r(h));break}else g++;return m.join(``)},decompress:function(e){return e==null?``:e==``?null:o._decompress(e.length,32768,function(n){return e.charCodeAt(n)})},_decompress:function(n,r,i){var a=[],o=4,s=4,c=3,l=``,u=[],d,f,p,m,h,g,_,v={val:i(0),position:r,index:1};for(d=0;d<3;d+=1)a[d]=d;for(p=0,h=2**2,g=1;g!=h;)m=v.val&v.position,v.position>>=1,v.position==0&&(v.position=r,v.val=i(v.index++)),p|=+(m>0)*g,g<<=1;switch(p){case 0:for(p=0,h=2**8,g=1;g!=h;)m=v.val&v.position,v.position>>=1,v.position==0&&(v.position=r,v.val=i(v.index++)),p|=+(m>0)*g,g<<=1;_=e(p);break;case 1:for(p=0,h=2**16,g=1;g!=h;)m=v.val&v.position,v.position>>=1,v.position==0&&(v.position=r,v.val=i(v.index++)),p|=+(m>0)*g,g<<=1;_=e(p);break;case 2:return``}for(a[3]=_,f=_,u.push(_);;){if(v.index>n)return``;for(p=0,h=2**c,g=1;g!=h;)m=v.val&v.position,v.position>>=1,v.position==0&&(v.position=r,v.val=i(v.index++)),p|=+(m>0)*g,g<<=1;switch(_=p){case 0:for(p=0,h=2**8,g=1;g!=h;)m=v.val&v.position,v.position>>=1,v.position==0&&(v.position=r,v.val=i(v.index++)),p|=+(m>0)*g,g<<=1;a[s++]=e(p),_=s-1,o--;break;case 1:for(p=0,h=2**16,g=1;g!=h;)m=v.val&v.position,v.position>>=1,v.position==0&&(v.position=r,v.val=i(v.index++)),p|=+(m>0)*g,g<<=1;a[s++]=e(p),_=s-1,o--;break;case 2:return u.join(``)}if(o==0&&(o=2**c,c++),a[_])l=a[_];else if(_===s)l=f+f.charAt(0);else return null;u.push(l),a[s++]=f+l.charAt(0),o--,f=l,o==0&&(o=2**c,c++)}}};return o})();typeof define==`function`&&define.amd?define(function(){return r}):n!==void 0&&n!=null?n.exports=r:typeof angular<`u`&&angular!=null&&angular.module(`LZString`,[]).factory(`LZString`,function(){return r})}))(),Io=`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`,Lo=`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`,Ro=`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`,zo=200,Bo=10;async function Vo(){let{masto:e}=u(),n=e.v1.followedTags.list({limit:zo}).values(),r=[],i=0;do{let{value:e,done:a}=await n.next();if(a||e?.length===0)break;r.push(...e),i++}while(i<Bo);return r.sort((e,n)=>e.name.localeCompare(n.name)),r.length&&setTimeout(()=>{F.account.set(`followedTags`,{tags:r,updatedAt:Date.now()})},1),r}var Ho=1440*60*1e3;async function Uo(){try{let{tags:e,updatedAt:n}=F.account.get(`followedTags`)||{};return e?.length?(Date.now()-n>Ho&&Vo(),e):await Vo()}catch{return[]}}var Wo=document.createElement(`div`),Go=e=>{if(!e||e.indexOf(`#`)===-1)return[];Wo.innerHTML=e;let n=Wo.querySelectorAll(`a.hashtag`);return n.length?Array.from(n).map(e=>e.innerText.trim().replace(/^[^#]*#+/,``)):[]};function Ko({children:e}){if(typeof e==`string`)return e;let[n,r]=I(``);return _(()=>{Promise.resolve(e).then(r)},[e]),n}var qo=[`following`,`mentions`,`notifications`,`list`,`public`,`trending`,`search`,`hashtag`,`bookmarks`,`favourites`,`profile`],Jo={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`},profile:{id:`vERlcd`}},Yo={list:[{text:{id:`DUMt1y`},name:`id`,notRequired:!0}],public:[{text:{id:`OgyJSr`},name:`local`,type:`checkbox`},{text:{id:`sGH11W`},name:`instance`,type:`text`,placeholder:{id:`7defFj`},notRequired:!0}],trending:[{text:{id:`sGH11W`},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:`sGH11W`},name:`instance`,type:`text`,placeholder:{id:`7defFj`},notRequired:!0}]},Xo={following:{id:`home`,title:(e,n)=>n===0?K._({id:`i0qMbr`}):K._({id:`following.title`}),path:`/`,icon:`home`},mentions:{id:`mentions`,title:{id:`_bZzdR`},path:`/mentions`,icon:`at`},notifications:{id:`notifications`,title:{id:`iDNBZe`},path:`/notifications`,icon:`notification`},list:{id:({id:e})=>e?`list`:`lists`,title:({id:e})=>e?Si(e):K._({id:`h16FyT`}),path:({id:e})=>e?`/l/${e}`:`/l`,icon:`list`,excludeViewMode:({id:e})=>e?[]:[`multi-column`]},public:{id:`public`,title:({local:e})=>e?K._({id:`d5zxa4`}):K._({id:`4ERYY7`}),subtitle:({instance:e})=>e||u().instance,path:({local:e,instance:n})=>`/${n}/p${e?`/l`:``}`,icon:({local:e})=>e?`building`:`earth`},trending:{id:`trending`,title:{id:`4_iCqx`},subtitle:({instance:e})=>e||u().instance,path:({instance:e})=>`/${e}/trending`,icon:`chart`},search:{id:`search`,title:({query:e})=>e?`${e}`:K._({id:`A1taO8`}),path:({query:e})=>e?`/search?q=${encodeURIComponent(e)}&type=statuses`:`/search`,icon:`search`,excludeViewMode:({query:e})=>e?[]:[`multi-column`]},profile:{id:`profile`,title:{id:`vERlcd`},path:()=>`/a/${T()}?replies=1`,icon:`user`,altIcon:()=>{let e=z();return{url:e?.info?.avatarStatic||e?.info?.avatar,type:`avatar`}}},"account-statuses":{id:`account-statuses`,title:r(async({id:e})=>{let n=await u().masto.v1.accounts.$select(e).fetch();return n.username||n.acct||n.displayName}),path:({id:e})=>`/a/${e}`,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:e})=>e,subtitle:({instance:e})=>e||u().instance,path:({hashtag:e,instance:n,media:r})=>`${n?`/${n}`:``}/t/${e.split(/\s+/).join(`+`)}${r?`?media=1`:``}`,icon:`hashtag`}};function Zo({onClose:e}){let{_:r}=l(),i=W(o),{shortcuts:a}=i,[s,c]=I(!1),[u,d]=I(!1),[f]=ar();return R(`div`,{id:`shortcuts-settings-container`,class:`sheet`,tabindex:`-1`,children:[!!e&&R(`button`,{type:`button`,class:`sheet-close`,onClick:e,children:R(X,{icon:`x`,alt:K._({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:[R(X,{icon:`shortcut`}),` `,R(j,{id:`CTqTgr`}),` `,R(`sup`,{style:{fontSize:12,opacity:.5,textTransform:`uppercase`},children:R(j,{id:`A1As8l`})})]})}),R(`main`,{children:[R(`p`,{children:R(j,{id:`CIHAsy`})}),R(`div`,{class:`shortcuts-view-mode`,children:[{value:`float-button`,label:K._({id:`qwdOim`}),imgURL:Io},{value:`tab-menu-bar`,label:K._({id:`UxBoCm`}),imgURL:Ro},{value:`multi-column`,label:K._({id:`uvDfdW`}),imgURL:Lo}].map(({value:e,label:n,imgURL:r})=>{let a=i.settings.shortcutsViewMode===e||e===`float-button`&&!i.settings.shortcutsViewMode;return R(`label`,{class:a?`checked`:``,children:[R(`input`,{type:`radio`,name:`shortcuts-view-mode`,value:e,checked:a,onChange:e=>{o.settings.shortcutsViewMode=e.target.value}}),` `,R(`img`,{src:r,alt:``,width:`80`,height:`58`}),` `,R(`span`,{children:n})]},e)})}),a.length>0?R(n,{children:[R(`ol`,{class:`shortcuts-list`,ref:f,children:a.filter(Boolean).map((e,s)=>{let l=Object.values(e).join(`-`),{type:u}=e;if(!Xo[u])return null;let{icon:d,title:f,subtitle:p,excludeViewMode:m}=Xo[u];f=typeof f==`function`?f(e,s):r(f),p=typeof p==`function`?p(e,s):r(p),typeof d==`function`&&(d=d(e,s)),typeof m==`function`&&(m=m(e,s));let h=m?.includes(i.settings.shortcutsViewMode);return R(`li`,{children:[R(X,{icon:d}),R(`span`,{class:`shortcut-text`,children:[R(Ko,{children:f}),p&&R(n,{children:[` `,R(`small`,{class:`ib insignificant`,children:p})]}),h&&R(`span`,{class:`tag`,children:R(j,{id:`5KJFnN`})})]}),R(`span`,{class:`shortcut-actions`,children:[R(`button`,{type:`button`,class:`plain small`,disabled:s===0,onClick:()=>{let n=Array.from(o.shortcuts);if(s>0){let r=o.shortcuts[s-1];n[s-1]=e,n[s]=r,o.shortcuts=n}},children:R(X,{icon:`arrow-up`,alt:K._({id:`QyioBP`})})}),R(`button`,{type:`button`,class:`plain small`,disabled:s===a.length-1,onClick:()=>{let n=Array.from(o.shortcuts);if(s<o.shortcuts.length-1){let r=o.shortcuts[s+1];n[s+1]=e,n[s]=r,o.shortcuts=n}},children:R(X,{icon:`arrow-down`,alt:K._({id:`3Ib6FN`})})}),R(`button`,{type:`button`,class:`plain small`,onClick:()=>{c({shortcut:e,shortcutIndex:s})},children:R(X,{icon:`pencil`,alt:K._({id:`ePK91l`})})})]})]},l)})}),a.length===1&&i.settings.shortcutsViewMode!==`float-button`&&R(`div`,{class:`ui-state insignificant`,children:[R(X,{icon:`info`}),` `,R(`small`,{children:R(j,{id:`3Xq4Zi`})})]})]}):R(`div`,{class:`ui-state insignificant`,children:[R(`p`,{children:i.settings.shortcutsViewMode===`multi-column`?K._({id:`3xIN-E`}):K._({id:`vLxvHT`})}),R(`p`,{children:R(j,{id:`Fq4zw3`,components:{0:R(`br`,{}),1:R(`a`,{href:`#`,onClick:e=>{e.preventDefault(),o.shortcuts=[{type:`following`},{type:`notifications`}]}})}})})]}),R(`p`,{class:`insignificant`,children:a.length>=9&&(i.settings.shortcutsViewMode===`multi-column`?K._({id:`RqXfsz`,values:{SHORTCUTS_LIMIT:9}}):K._({id:`EVRO_o`,values:{SHORTCUTS_LIMIT:9}}))}),R(`p`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[R(`button`,{type:`button`,class:`light`,onClick:()=>d(!0),children:R(j,{id:`bgVLbt`})}),R(`button`,{type:`button`,disabled:a.length>=9,onClick:()=>c(!0),children:[R(X,{icon:`plus`}),` `,R(`span`,{children:i.settings.shortcutsViewMode===`multi-column`?K._({id:`Vh3ADI`}):K._({id:`9tmn6W`})})]})]})]}),s&&R(zt,{onClick:e=>{e.target===e.currentTarget&&c(!1)},children:R($o,{shortcut:s.shortcut,shortcutIndex:s.shortcutIndex,onSubmit:({result:e,mode:n})=>{n===`edit`?o.shortcuts[s.shortcutIndex]=e:o.shortcuts.push(e)},onClose:()=>c(!1)})}),u&&R(zt,{onClick:e=>{e.target===e.currentTarget&&d(!1)},children:R(es,{shortcuts:a,onClose:()=>d(!1)})})]})}var Qo={list:{id:`1qL-L-`},search:{id:`dmTmkQ`},hashtag:{id:`E8laYz`}};function $o({onSubmit:e,disabled:n,shortcut:r,shortcutIndex:i,onClose:s}){let{_:c}=l(),u=!!r,[d,f]=I(r?.type||null),[p,m]=I(`default`),[h,g]=I([]),[v,y]=I([]);_(()=>{(async()=>{if(d===`list`)try{m(`loading`),g(await yi()),m(`default`)}catch{m(`error`)}})(),(async()=>{if(d===`hashtag`)try{y(await Vo())}catch{}})()},[d]);let b=a();return _(()=>{if(u&&d&&Yo[d]){let e=b.current;Yo[d].forEach(({name:n,type:i})=>{let a=e.querySelector(`[name="${n}"]`);a&&r[n]&&(i===`checkbox`?a.checked=r[n]===`on`:a.value=r[n])})}},[u,d]),R(`div`,{id:`shortcut-settings-form`,class:`sheet`,children:[!!s&&R(`button`,{type:`button`,class:`sheet-close`,onClick:s,children:R(X,{icon:`x`,alt:K._({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:u?K._({id:`pe1jog`}):K._({id:`Lsxpe5`})})}),R(`main`,{tabindex:`-1`,children:R(`form`,{ref:b,onSubmit:n=>{n.preventDefault();let r=new FormData(n.target),i={};r.forEach((e,n)=>{i[n]=e?.trim(),n===`instance`&&(i[n]=i[n].replace(/^https?:\/\//,``).replace(/\/+$/,``),i[n]=i[n].replace(/^@?[^@]+@/,``))}),i.type&&(e({result:i,mode:u?`edit`:`add`}),n.target.reset(),f(null),s?.())},children:[R(`p`,{children:R(`label`,{children:[R(`span`,{children:R(j,{id:`cklVjM`})}),R(`select`,{required:!0,disabled:n,onChange:e=>{f(e.target.value)},defaultValue:u?r.type:void 0,name:`type`,dir:`auto`,children:[R(`option`,{}),qo.map(e=>R(`option`,{value:e,children:c(Jo[e])}))]})]})}),Yo[d]?.map?.(({text:e,name:i,type:a,placeholder:o,pattern:s,notRequired:l})=>d===`list`?R(`p`,{children:R(`label`,{children:[R(`span`,{children:R(j,{id:`2BBAbc`})}),R(`select`,{name:`id`,required:!l,disabled:n||p===`loading`,defaultValue:u?r.id:void 0,dir:`auto`,children:[R(`option`,{value:``}),h.map(e=>R(`option`,{value:e.id,children:e.title}))]})]})}):R(`p`,{children:R(`label`,{children:[R(`span`,{children:c(e)}),` `,R(`input`,{type:a,switch:a===`checkbox`||void 0,name:i,placeholder:c(o),required:a===`text`&&!l,disabled:n,list:d===`hashtag`?`followed-hashtags-datalist`:null,autocorrect:`off`,autocapitalize:`off`,spellCheck:!1,pattern:s,dir:`auto`}),d===`hashtag`&&v.length>0&&R(`datalist`,{id:`followed-hashtags-datalist`,children:v.map(e=>R(`option`,{value:e.name}))})]})})),!!Qo[d]&&R(`p`,{class:`form-note insignificant`,children:[R(X,{icon:`info`}),c(Qo[d])]}),R(`footer`,{children:[R(`button`,{type:`submit`,class:`block`,disabled:n||p===`loading`,children:u?K._({id:`tfDRzk`}):K._({id:`m16xKo`})}),u&&R(`button`,{type:`button`,class:`light danger`,onClick:()=>{o.shortcuts.splice(i,1),s?.()},children:R(j,{id:`t_YqKh`})})]})]})})]})}function es({shortcuts:e,onClose:r}){let{_:i}=l(),{masto:s}=u(),c=m(()=>!e||!e.filter(Boolean).length?``:(0,Fo.compressToEncodedURIComponent)(JSON.stringify(e.filter(Boolean))),[e]),[d,f]=I(``),[p,h]=I(`default`),g=m(()=>{if(!d)return h(`default`),null;try{let e=JSON.parse((0,Fo.decompressFromEncodedURIComponent)(d));if(!Array.isArray(e))throw Error(`Not an array`);return h(`default`),e}catch{try{let e=JSON.parse(d);if(!Array.isArray(e))throw Error(`Not an array`);return h(`default`),e}catch{return h(`error`),null}}},[d]),_=o.shortcuts.length>0,v=a();return R(`div`,{id:`import-export-container`,class:`sheet`,children:[!!r&&R(`button`,{type:`button`,class:`sheet-close`,onClick:r,children:R(X,{icon:`x`,alt:K._({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`OOa7_5`,components:{0:R(`small`,{class:`ib insignificant`})}})})}),R(`main`,{tabindex:`-1`,children:[R(`section`,{children:[R(`h3`,{children:[R(X,{icon:`arrow-down-circle`,size:`l`,class:`insignificant`}),` `,R(`span`,{children:R(j,{id:`l3s5ri`})})]}),R(`p`,{class:`field-button`,children:[R(`input`,{ref:v,type:`text`,name:`import`,placeholder:K._({id:`tBmklN`}),class:`block`,onInput:e=>{f(e.target.value)},dir:`auto`}),wo&&R(`button`,{type:`button`,class:`plain2 small`,onClick:()=>{o.showQrScannerModal={onClose:({text:e}={})=>{e&&(f(e),v.current.value=e,v.current.dispatchEvent(new Event(`input`)))}}},children:R(X,{icon:`scan`,alt:K._({id:`XDwkfO`})})}),o.settings.shortcutSettingsCloudImportExport&&R(`button`,{type:`button`,class:`plain2 small`,disabled:p===`cloud-downloading`,onClick:async()=>{h(`cloud-downloading`);let e=T();Y(K._({id:`jFdM_T`}));try{let n=(await s.v1.accounts.relationships.fetch({id:[e]}))[0];if(n){let{note:e=``}=n;if(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(e)){let n=e.match(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/)[1],{v:r,dt:i,data:a}=JSON.parse(n);v.current.value=a,v.current.dispatchEvent(new Event(`input`))}}h(`default`)}catch{h(`error`),Y(K._({id:`gCDfX-`}))}},title:K._({id:`5I1YZO`}),children:[R(X,{icon:`cloud`}),R(X,{icon:`arrow-down`,size:`s`})]})]}),!!g&&Array.isArray(g)&&R(n,{children:[R(`p`,{children:[R(`b`,{children:g.length}),` shortcut`,g.length>1?`s`:``,` `,R(`small`,{class:`insignificant`,children:[`(`,d.length,` characters)`]})]}),R(`ol`,{class:`import-settings-list`,children:g.map(r=>R(`li`,{children:[R(`span`,{style:{opacity:+!!e.some(e=>Object.keys(e).every(n=>{if(!(n in r))return!0;let i=r[n];return i===``||i==null?!0:e[n]===i}))},children:`*`}),R(`span`,{children:[i(Jo[r.type]),r.type===`list`&&!!r.id&&` ⚠️`,` `,Yo[r.type]?.map?.(({text:e,name:a,type:o})=>r[a]?R(n,{children:[R(`span`,{class:`tag collapsed insignificant`,children:[i(e),`:`,` `,o===`checkbox`?r[a]===`on`?``:``:r[a]]}),` `]}):null)]})]}))}),R(`p`,{children:[R(`small`,{children:R(j,{id:`o6sElH`})}),R(`br`,{}),R(`small`,{children:[`⚠️`,` `,R(j,{id:`N4z4P_`})]})]})]}),p===`error`&&R(`p`,{class:`error`,children:R(`small`,{children:[`⚠️ `,R(j,{id:`ZhsPEb`})]})}),R(`p`,{children:[_&&R(n,{children:[R(ut,{confirmLabel:K._({id:`6MzUUU`}),menuFooter:R(`div`,{class:`footer`,children:R(j,{id:`nl8sCE`})}),onClick:()=>{let e=g.filter(e=>!o.shortcuts.some(n=>Object.keys(n).every(r=>n[r]===e[r])));if(!e.length){Y(K._({id:`o6L30P`}));return}let n=[...o.shortcuts,...e],i=n.length>9;i&&(n=n.slice(0,9)),o.shortcuts=n,Y(i?K._({id:`SBmqmC`,values:{SHORTCUTS_LIMIT:9}}):K._({id:`QO9uTx`})),r?.()},children:R(`button`,{type:`button`,class:`plain2`,disabled:!g,children:R(j,{id:`c89gCv`})})}),` `]}),R(ut,{confirmLabel:_?K._({id:`6ZjzWP`}):K._({id:`DWumLi`}),menuItemClassName:_?`danger`:void 0,onClick:()=>{o.shortcuts=g,Y(K._({id:`QO9uTx`})),r?.()},children:R(`button`,{type:`button`,class:`plain2`,disabled:!g,children:_?K._({id:`uIp8WL`}):K._({id:`Sjnlwj`})})})]})]}),R(`section`,{children:[R(`h3`,{children:[R(X,{icon:`arrow-up-circle`,size:`l`,class:`insignificant`}),` `,R(`span`,{children:R(j,{id:`GS-Mus`})})]}),R(`p`,{class:`field-button`,children:[R(`input`,{style:{width:`100%`},type:`text`,value:c,readOnly:!0,onClick:e=>{if(e.target.value){e.target.select();try{navigator.clipboard.writeText(e.target.value),Y(K._({id:`cWtH-v`}))}catch{Y(K._({id:`yUWyHa`}))}}},dir:`auto`}),R(`button`,{type:`button`,class:`plain2 small`,disabled:!c,onClick:()=>{o.showQrCodeModal={text:c}},children:R(X,{icon:`qrcode`,alt:K._({id:`gCX4Z9`})})}),o.settings.shortcutSettingsCloudImportExport&&R(`button`,{type:`button`,class:`plain2 small`,disabled:p===`cloud-uploading`,onClick:async()=>{h(`cloud-uploading`);let e=T();try{let n=(await s.v1.accounts.relationships.fetch({id:[e]}))[0];if(n){let{note:r=``}=n,i=``,a=JSON.stringify({v:`1`,dt:Date.now(),data:c});i=/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/.test(r)?r.replace(/<phanpy-shortcuts-settings>(.*)<\/phanpy-shortcuts-settings>/,`<phanpy-shortcuts-settings>${a}</phanpy-shortcuts-settings>`):`${r}\n\n\n<phanpy-shortcuts-settings>${a}</phanpy-shortcuts-settings>`,Y(K._({id:`fVybCv`})),await s.v1.accounts.$select(e).note.create({comment:i}),h(`default`),Y(K._({id:`5w02SH`}))}}catch{h(`error`),Y(K._({id:`aVsTYo`}))}},title:K._({id:`oivBcO`}),children:[R(X,{icon:`cloud`}),R(X,{icon:`arrow-up`,size:`s`})]})]}),R(`p`,{children:[R(`button`,{type:`button`,class:`plain2`,disabled:!c,onClick:()=>{try{navigator.clipboard.writeText(c),Y(K._({id:`-Kq2vY`}))}catch{Y(K._({id:`tFvxZF`}))}},children:[R(X,{icon:`clipboard`}),` `,R(`span`,{children:R(j,{id:`he3ygx`})})]}),` `,navigator?.share&&navigator?.canShare?.({text:c})&&R(`button`,{type:`button`,class:`plain2`,disabled:!c,onClick:()=>{try{navigator.share({text:c})}catch{alert(K._({id:`TtG3Uh`}))}},children:[R(X,{icon:`share`}),` `,R(`span`,{children:R(j,{id:`Z8lGw6`})})]}),` `,c.length>0&&R(`small`,{class:`insignificant ib`,children:R(j,{id:`IPXOXm`,values:{0:c.length}})})]}),!!c&&R(`details`,{children:[R(`summary`,{class:`insignificant`,children:R(`small`,{children:R(j,{id:`e5E-WH`})})}),R(`textarea`,{style:{width:`100%`},rows:10,readOnly:!0,children:JSON.stringify(e.filter(Boolean),null,2)})]})]}),o.settings.shortcutSettingsCloudImportExport&&R(`footer`,{children:R(`p`,{children:[R(X,{icon:`cloud`}),` `,R(j,{id:`Cxr3Kn`})]})})]})]})}ye(o,e=>{for(let[n,r,i,a]of e)/^show/i.test(r)&&!i&&ni()});function ts(){let{_:e}=l(),r=W(o),i=Ne(),a=ie(),s=rn();return _(()=>{setTimeout(de,1e3)},[]),R(n,{children:[s&&!!r.showCompose&&R(zt,{class:`solid ${r.composerState.minimized?`min`:``}`,minimized:!!r.composerState.minimized,children:R(Se,{replyToStatus:typeof r.showCompose==`boolean`?window.__COMPOSE__?.replyToStatus||null:r.showCompose.replyToStatus,replyMode:o.showCompose?.replyMode||window.__COMPOSE__?.replyMode||`all`,editStatus:o.showCompose?.editStatus||window.__COMPOSE__?.editStatus||null,draftStatus:o.showCompose?.draftStatus||window.__COMPOSE__?.draftStatus||null,quoteStatus:o.showCompose?.quoteStatus||window.__COMPOSE__?.quoteStatus||null,sharedData:window.__SHARED_DATA__||null,onClose:n=>{let{newStatus:r,instance:s,type:c,scheduledAt:l}=n||{};o.showCompose=!1,window.__COMPOSE__=null,window.__SHARED_DATA__=null,r&&(o.reloadStatusPage++,l&&o.reloadScheduledPosts++,Y({text:{post:e(l?{id:`IrX0sj`}:{id:`aTyHBW`}),reply:e(l?{id:`-38pse`}:{id:`lZdBKl`}),edit:e({id:`a5BN7l`})}[c||`post`],delay:1e3,duration:1e4,onClick:e=>{e.hideToast(),o.prevLocation=a,i(l?`/sp`:s?`/${s}/s/${r.id}`:`/s/${r.id}`)}}))}})}),s&&!!r.showSettings&&R(zt,{onClose:()=>{o.showSettings=!1},children:R($r,{onClose:()=>{o.showSettings=!1}})}),s&&!!r.showAccounts&&R(zt,{onClose:()=>{o.showAccounts=!1},children:R(Tr,{onClose:()=>{o.showAccounts=!1}})}),!!r.showAccount&&R(zt,{onClose:()=>{o.showAccount=!1},children:R(Ki,{account:r.showAccount?.account||r.showAccount,instance:r.showAccount?.instance,onClose:({destination:e}={})=>{o.showAccount=!1}})}),!!r.showOpenLink&&R(zt,{onClose:()=>{o.showOpenLink=!1},children:R(Ma,{url:r.showOpenLink.url,linkText:r.showOpenLink.linkText,onClose:()=>{o.showOpenLink=!1}})}),s&&!!r.showDrafts&&R(zt,{onClose:()=>{o.showDrafts=!1},children:R(qi,{onClose:()=>o.showDrafts=!1})}),!!r.showMediaModal&&R(zt,{onClick:e=>{(e.target===e.currentTarget||e.target.classList.contains(`media`))&&(o.showMediaModal=!1)},children:R(ja,{mediaAttachments:r.showMediaModal.mediaAttachments,instance:r.showMediaModal.instance,index:r.showMediaModal.mediaIndex,statusID:r.showMediaModal.statusID,onClose:()=>{o.showMediaModal=!1}})}),s&&!!r.showShortcutsSettings&&R(zt,{onClose:()=>{o.showShortcutsSettings=!1},children:R(Zo,{onClose:()=>o.showShortcutsSettings=!1})}),!!r.showGenericAccounts&&R(zt,{onClose:()=>{o.showGenericAccounts=!1},children:R(Xi,{instance:r.showGenericAccounts.instance,excludeRelationshipAttrs:r.showGenericAccounts.excludeRelationshipAttrs,postID:r.showGenericAccounts.postID,onClose:()=>o.showGenericAccounts=!1,blankCopy:r.showGenericAccounts.blankCopy})}),!!r.showMediaAlt&&R(zt,{onClose:e=>{o.showMediaAlt=!1},children:R(ea,{alt:r.showMediaAlt.alt||r.showMediaAlt,lang:r.showMediaAlt?.lang,onClose:()=>{o.showMediaAlt=!1}})}),!!r.showEmbedModal&&R(zt,{class:`solid`,onClose:()=>{o.showEmbedModal=!1},children:R(Yi,{html:r.showEmbedModal.html,url:r.showEmbedModal.url,width:r.showEmbedModal.width,height:r.showEmbedModal.height,onClose:()=>{o.showEmbedModal=!1}})}),s&&!!r.showReportModal&&R(zt,{onClose:()=>{o.showReportModal=!1},children:R(Po,{account:r.showReportModal.account,post:r.showReportModal.post,onClose:()=>{o.showReportModal=!1}})}),!!r.showQrCodeModal&&R(zt,{class:`solid`,onClose:()=>{o.showQrCodeModal=!1},children:R(To,{text:r.showQrCodeModal.text,arena:r.showQrCodeModal.arena,backgroundMask:r.showQrCodeModal.backgroundMask,caption:r.showQrCodeModal.caption,onClose:()=>{o.showQrCodeModal=!1},onScannerClick:r.showQrCodeModal.onScannerClick})}),!!r.showQrScannerModal&&R(zt,{class:`solid`,onClose:()=>{o.showQrScannerModal=!1},children:R(ko,{checkValidity:r.showQrScannerModal.checkValidity,actionableText:r.showQrScannerModal.actionableText,onClose:(...e)=>{r.showQrScannerModal.onClose&&r.showQrScannerModal.onClose(...e),o.showQrScannerModal=!1}})}),s&&!!r.showImportExportAccounts&&R(zt,{onClose:()=>{o.showImportExportAccounts=!1},children:R(Qi,{onClose:()=>{o.showImportExportAccounts=!1},exportDisabled:typeof r.showImportExportAccounts==`object`?r.showImportExportAccounts.exportDisabled:!1})})]})}var ns=(e,n)=>{$e(`g>${e}`,e=>{document.querySelector(`#modal-container > *`)||e.metaKey||e.ctrlKey||e.altKey||n(e)},{useKey:!0})},rs=pe(function(){let e=Ne();return ns(`h`,()=>e(`/`)),ns(`n`,()=>e(`/notifications`)),ns(`s`,()=>{o.showSettings=!0}),ns(`p`,()=>{let n=z();if(n){let{instanceURL:r}=n,{id:i}=n.info;e(`/${r}/a/${i}`)}}),ns(`b`,()=>e(`/b`)),null});function is({accountID:e,onChange:n}){let{_:r}=l(),{masto:i}=u(),[a,o]=I(`default`),[s,c]=I(null),[d,f]=I(null),p=d!==null;return R(`p`,{class:`follow-request-buttons`,children:[R(`button`,{type:`button`,disabled:a===`loading`||p,onClick:()=>{Ut.trigger(`success`),o(`loading`),c(`accept`),(async()=>{try{let r=await i.v1.followRequests.$select(e).authorize();if(!r?.followedBy)throw Error(`Follow request not accepted`);f(r),n()}catch{}o(`default`)})()},children:R(j,{id:`g3UF2V`})}),` `,R(`button`,{type:`button`,disabled:a===`loading`||p,class:`light danger`,onClick:()=>{Ut.trigger(`light`),o(`loading`),c(`reject`),(async()=>{try{let r=await i.v1.followRequests.$select(e).reject();if(r?.followedBy)throw Error(`Follow request not rejected`);f(r),n()}catch{o(`default`)}})()},children:R(j,{id:`1t_NnN`})}),R(`span`,{class:`follow-request-states`,children:p&&s?s===`accept`?R(X,{icon:`check-circle`,alt:r({id:`bzMKg7`}),class:`follow-accepted`}):R(X,{icon:`x-circle`,alt:r({id:`ekCRTP`}),class:`follow-rejected`}):R(U,{hidden:a!==`loading`})})]})}var as={mention:`comment`,status:`notification`,reblog:`rocket`,follow:`follow`,follow_request:`follow-add`,favourite:`heart`,poll:`poll`,update:`pencil`,"admin.sign_up":`account-edit`,"admin.report":`account-warning`,severed_relationships:`heart-break`,moderation_warning:`alert`,emoji_reaction:`emoji2`,reaction:`emoji2`,"pleroma:emoji_reaction":`emoji2`,annual_report:`celebrate`,quote:`quote`,quoted_update:`pencil`};function os({account:e,emoji:n,emojiURL:r}){let i,a;return typeof r==`string`?i=r:(i=r?.url,a=r?.staticUrl),R(j,{id:`i5uN6K`,values:{account:e,emojiObject:i?R(ct,{url:i,staticUrl:a,alt:n}):n}})}var ss={status:({account:e})=>R(j,{id:`idiIxW`,values:{account:e}}),reblog:({count:e,account:n,postsCount:r,postType:i,components:{Subject:a}})=>R(j,{id:`jkt9P5`,values:{0:Ze(e),1:Ze(e),count:e,postsCount:r,postType:i,account:n},components:{0:R(a,{clickable:e>1}),1:R(`span`,{title:e}),2:R(a,{clickable:e>1}),3:R(`span`,{title:e})}}),follow:({account:e,count:n,components:{Subject:r}})=>R(j,{id:`-71G9C`,values:{0:Ze(n),count:n,account:e},components:{0:R(r,{clickable:n>1}),1:R(`span`,{title:n})}}),follow_request:({account:e})=>R(j,{id:`eh6NHW`,values:{account:e}}),favourite:({account:e,count:n,postsCount:r,postType:i,components:{Subject:a}})=>R(j,{id:`RqX1mR`,values:{0:Ze(n),1:Ze(n),count:n,postsCount:r,postType:i,account:e},components:{0:R(a,{clickable:n>1}),1:R(`span`,{title:n}),2:R(a,{clickable:n>1}),3:R(`span`,{title:n})}}),poll:()=>K._({id:`kIlJaS`}),"poll-self":()=>K._({id:`kpjzdN`}),"poll-voted":()=>K._({id:`moT7M8`}),update:({account:e})=>e?R(j,{id:`W-eFn3`,values:{account:e}}):K._({id:`uzt17m`}),"favourite+reblog":({count:e,account:n,postsCount:r,postType:i,components:{Subject:a}})=>R(j,{id:`NunZZQ`,values:{0:Ze(e),1:Ze(e),count:e,postsCount:r,postType:i,account:n},components:{0:R(a,{clickable:e>1}),1:R(`span`,{title:e}),2:R(a,{clickable:e>1}),3:R(`span`,{title:e})}}),quoted_update:({account:e})=>R(j,{id:`pkB7ti`,values:{account:e}}),"admin.sign_up":({account:e,count:n,components:{Subject:r}})=>R(j,{id:`eDkKRi`,values:{0:Ze(n),count:n,account:e},components:{0:R(r,{clickable:n>1}),1:R(`span`,{title:n})}}),"admin.report":({account:e,targetAccount:n})=>R(j,{id:`eNfCmq`,values:{account:e,targetAccount:n}}),severed_relationships:({name:e})=>R(j,{id:`Xl9v6-`,values:{name:e},components:{0:R(`i`,{})}}),moderation_warning:()=>R(`b`,{children:R(j,{id:`YqffEv`})}),emoji_reaction:os,reaction:os,"pleroma:emoji_reaction":os,annual_report:({year:e})=>R(j,{id:`INLTzH`,values:{year:e}})},cs={account_suspension:({from:e,targetName:n})=>R(j,{id:`uRkcgw`,values:{from:e,targetName:n},components:{0:R(`i`,{}),1:R(`i`,{})}}),domain_block:({from:e,targetName:n,followersCount:r,followingCount:i})=>R(j,{id:`Q3yArs`,values:{from:e,targetName:n,followersCount:r,followingCount:i},components:{0:R(`i`,{}),1:R(`i`,{})}}),user_domain_block:({targetName:e,followersCount:n,followingCount:r})=>R(j,{id:`RQKWUa`,values:{targetName:e,followersCount:n,followingCount:r},components:{0:R(`i`,{})}})},ls={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`}},us=30;function ds({notification:e,instance:r,isStatic:i,disableContextMenu:a}){let{_:s}=l(),{masto:c}=u(),{id:d,status:f,account:p,report:m,event:h,moderation_warning:g,annualReport:_,_ids:v,_accounts:y,_statuses:b,_groupKeys:x,sampleAccounts:S,notificationsCount:C,groupKey:w,_notificationsCount:E,_sampleAccountsCount:D}=e,{type:O}=e;if((O===`mention`||O===`quote`)&&!f)return null;let k=f?.reblog||f,A=k?.id,M=T(),ee=M===p?.id,N=f?.poll?.voted,P=!!f?.inReplyToAccountId&&f?.inReplyToAccountId!==M&&f?.account?.id===M,F=0,I=0;if(O===`favourite+reblog`){if(y)for(let e of y)e._types?.includes(`favourite`)&&F++,e._types?.includes(`reblog`)&&I++;!I&&F&&(O=`favourite`),!F&&I&&(O=`reblog`)}let L;L=O===`poll`?ss[ee?`poll-self`:N?`poll-voted`:`poll`]:ss[O]?ss[O]:K._({id:`ODqZt1`,values:{type:O}});let z=({clickable:e,...n})=>e?R(`b`,{tabIndex:`0`,onClick:ie,...n}):R(`b`,{...n}),B=C>0&&C>S?.length,te=B?`remote`:`local`;if(typeof L==`function`){let n=(O===`favourite`||O===`reblog`||O===`admin.sign_up`)&&C?B?C:S?.length:y?.length||S?.length||+!!p,r=b?.length||+!!f;if(O===`admin.report`){let e=m?.targetAccount;e&&(L=L({account:R(qe,{account:p,showAvatar:!0}),targetAccount:R(qe,{account:e,showAvatar:!0})}))}else if(O===`severed_relationships`){let e=h?.targetName;e&&(L=L({name:e}))}else if((O===`emoji_reaction`||O===`pleroma:emoji_reaction`)&&e.emoji){let n=e.emoji_url||f?.emojis?.find?.(n=>n?.shortcode===e.emoji.replace(/^:/,``).replace(/:$/,``));L=L({account:R(qe,{account:p,showAvatar:!0}),emoji:e.emoji,emojiURL:n})}else L=L(O===`annual_report`?{...e.annualReport}:{account:p?R(qe,{account:p,showAvatar:!0}):S?.[0]&&R(qe,{account:S[0],showAvatar:!0}),count:n,postsCount:r,postType:P?`reply`:`post`,components:{Subject:z}})}let V=e.createdAt&&new Date(e.createdAt).toLocaleString(),ne={"favourite+reblog":K._({id:`-XOeb-`}),favourite:K._({id:`LQFF6J`}),reblog:K._({id:`phQpSa`}),follow:K._({id:`Ih01jh`})}[O]||K._({id:`bPwFdf`}),re=(O===`favourite+reblog`||O===`favourite`||O===`reblog`||O===`admin.sign_up`)&&te===`remote`,ie=()=>{re?o.showGenericAccounts={heading:ne,accounts:y,fetchAccounts:async()=>{let e=await Promise.allSettled(x.map(async e=>[e,(await c.v2.notifications.$select(e).accounts.list().values().next()).value])),n=[];for(let r of e){let[e,i]=r.value,a=/^favourite/.test(e)?`favourite`:/^reblog/.test(e)?`reblog`:null;for(let e of i){let r=n.find(n=>n.id===e.id);r&&a?r._types.push(a):(a&&(e._types=[a]),n.push(e))}}return{done:!0,value:n}},showReactions:O===`favourite+reblog`,postID:Ae(A,r)}:o.showGenericAccounts={heading:ne,accounts:y,showReactions:O===`favourite+reblog`,excludeRelationshipAttrs:O===`follow`?[`followedBy`]:[],postID:Ae(A,r)}};if(f?.filtered){let e=f?.account?.id===M,n=pt(f.filtered,`notifications`);if(!ee&&!e&&n?.action===`hide`)return null}return R(`div`,{class:`notification notification-${O}`,"data-notification-id":v||d,"data-group-key":x?.join(` `)||w,tabIndex:`0`,onMouseEnter:e=>{e.shiftKey},children:[R(`div`,{class:`notification-type notification-${O}`,title:V,children:O===`favourite+reblog`?R(n,{children:[R(X,{icon:`rocket`,size:`xl`,alt:O,class:`reblog-icon`}),R(X,{icon:`heart`,size:`xl`,alt:O,class:`favourite-icon`})]}):O===`mention+quote`?R(n,{children:[R(X,{icon:`comment`,size:`xl`,alt:O,class:`mention-icon`}),R(X,{icon:`quote`,size:`xl`,alt:O,class:`quote-icon`})]}):R(X,{icon:as[O]||`notification`,size:`xl`,alt:O})}),R(`div`,{class:`notification-content`,children:[O!==`mention`&&O!==`quote`&&O!==`mention+quote`&&R(n,{children:[R(`p`,{children:L}),O===`follow_request`&&R(is,{accountID:p.id}),O===`severed_relationships`&&R(`div`,{children:[cs[h.type]({from:r,...h}),R(`br`,{}),R(`a`,{href:`https://${r}/severed_relationships`,target:`_blank`,rel:`noopener`,children:R(j,{id:`YL6Y8P`,components:{0:R(X,{icon:`external`,size:`s`})}})}),`.`]}),O===`moderation_warning`&&!!g&&R(`div`,{children:[s(ls[g.action]()),R(`br`,{}),R(`a`,{href:`/disputes/strikes/${g.id}`,target:`_blank`,rel:`noopener`,children:R(j,{id:`YL6Y8P`,components:{0:R(X,{icon:`external`,size:`s`})}})})]}),O===`annual_report`&&R(`div`,{children:R(Z,{to:`/annual_report/${_?.year}`,children:R(j,{id:`5PGPvG`})})})]}),y?.length>1&&R(`p`,{class:`avatars-stack`,children:[y.slice(0,us).map(e=>R(n,{children:[R(`a`,{href:e.url,rel:`noopener`,class:`account-avatar-stack`,onClick:n=>{n.preventDefault(),o.showAccount=e},children:[R(vt,{url:e.avatarStatic,size:y.length<=10?`xxl`:y.length<20?`xl`:`l`,alt:`${e.displayName} @${e.acct}`,squircle:e?.bot},e.id),O===`favourite+reblog`&&R(`div`,{class:`account-sub-icons`,children:e._types.map(e=>R(X,{icon:as[e],size:`s`,class:`${e}-icon`}))})]},e.id),` `]},e.id)),re?R(`button`,{type:`button`,class:`small plain`,"data-group-keys":x?.join(` `),onClick:ie,children:[`+`,(O===`favourite`||O===`reblog`||O===`admin.sign_up`)&&C-y.length,R(X,{icon:`chevron-down`})]}):R(`button`,{type:`button`,class:`small plain`,onClick:ie,children:[y.length>us&&`+${y.length-us}`,R(X,{icon:`chevron-down`})]})]}),!y?.length&&S?.length>1&&R(`p`,{class:`avatars-stack`,children:[S.map(e=>R(n,{children:[R(`a`,{href:e.url,rel:`noopener`,class:`account-avatar-stack`,onClick:n=>{n.preventDefault(),o.showAccount=e},children:R(vt,{url:e.avatarStatic,size:`xxl`,alt:`${e.displayName} @${e.acct}`,squircle:e?.bot},e.id)},e.id),` `]},e.id)),C>S.length&&f?.id&&R(Z,{to:r?`/${r}/s/${f.id}`:`/s/${f.id}`,class:`button small plain centered`,children:[`+`,C-S.length,R(X,{icon:`chevron-right`})]})]}),b?.length>1&&R(`ul`,{class:`notification-group-statuses`,children:b.map(e=>R(`li`,{children:R(fs,{class:`status-link status-type-${O}`,to:r?`/${r}/s/${e.id}`:`/s/${e.id}`,children:R(Mt,{status:e,size:`s`,previewMode:!0,allowContextMenu:!0,allowFilters:!0})})},e.id))}),f&&(!b?.length||b?.length<=1)&&R(fs,{class:`status-link status-type-${O}`,to:r?`/${r}/s/${A}`:`/s/${A}`,onContextMenu:a?void 0:e=>{let n=e.target.querySelector(`.status`);if(n){if(e.metaKey)return;e.preventDefault(),n.dispatchEvent(new MouseEvent(`contextmenu`,{clientX:e.clientX,clientY:e.clientY}))}},children:i?R(Mt,{status:k,size:`s`,readOnly:!0,allowContextMenu:!0,allowFilters:!0}):R(Mt,{statusID:A,size:`s`,readOnly:!0,allowContextMenu:!0,allowFilters:!0})})]})]})}function fs(e){let{_:n}=l(),r=kt();return R(Z,{...e,"data-read-more":n({id:`8fZueG`}),ref:r})}var ps=pe(ds,(e,n)=>e.notification?.id===n.notification?.id);`serviceWorker`in navigator&&navigator.serviceWorker.addEventListener(`message`,e=>{let{type:n,id:r,accessToken:i}=e?.data||{};n===`notification`&&(o.routeNotification={id:r,accessToken:i})});var ms=pe(function(){let{_:e}=l();if(!(`serviceWorker`in navigator))return null;let{routeNotification:n}=W(o),{id:r,accessToken:i}=n||{},[a,s]=I(!1);ee(()=>{if(!r||!i)return;let{instance:e}=u(),{masto:n,instance:a}=u({accessToken:i}),c=e===a,l=i?be(i):z();(async()=>{let i=await n.v1.notifications.$select(r).fetch();if(i&&l){let n=l.instanceURL,{type:a,status:u,account:d}=i,f=!!document.querySelector(`#modal-container > *`),p=a===`follow`&&!!d?.id,m=!!d?.id,h=!!u?.id;p&&c?o.showAccount={account:d,instance:n}:f||!c||m&&h?s({id:r,account:l,notification:i,sameInstance:c}):h?location.hash=`/${e}/s/${u.id}`:p?location.hash=`/${e}/a/${d.id}`:location.hash=`/notifications`}})()},[r,i]),ee(()=>{navigator?.clearAppBadge&&navigator.clearAppBadge()},[]),an(e=>{e&&navigator?.clearAppBadge&&navigator.clearAppBadge()});let c=()=>{s(!1),o.routeNotification=null,/\/notifications\?id=/i.test(location.hash)&&(location.hash=`/notifications`)};if(a){let{id:n,account:r,notification:i,sameInstance:o}=a;return R(zt,{onClick:e=>{e.target===e.currentTarget&&c()},children:R(`div`,{class:`sheet`,tabIndex:`-1`,children:[R(`button`,{type:`button`,class:`sheet-close`,onClick:c,children:R(X,{icon:`x`,alt:e({id:`yz7wBu`})})}),R(`header`,{children:R(`b`,{children:R(j,{id:`5-87Pq`})})}),R(`main`,{children:[!o&&R(`p`,{children:R(j,{id:`k9N0Xk`})}),R(`div`,{class:`notification-peek`,onClick:e=>{let{target:n}=e;(e.target.tagName===`BUTTON`||e.target.tagName===`A`)&&c()},children:R(ps,{instance:r.instanceURL,notification:i,isStatic:!0})}),R(`div`,{style:{textAlign:`end`},children:R(Z,{to:`/notifications`,class:`button light`,onClick:c,children:[R(`span`,{children:R(j,{id:`_WA_tl`})}),` `,R(X,{icon:`arrow-right`})]})})]})]})})}return null}),hs=({limit:e}={})=>{let n=F.account.get(`searchHistory`)||[];return e?n.slice(0,e):n},gs=10,_s=(e,n=null)=>{if(!e?.trim?.())return;let r=hs(),i=r.findIndex(r=>r.query===e&&r.queryType===n);i!==-1&&r.splice(i,1),r.unshift({query:e.trim(),queryType:n,timestamp:Date.now()});let a=r.slice(0,gs);F.account.set(`searchHistory`,a)},vs=(e,n=null)=>{let r=hs().filter(r=>!(r.query===e&&r.queryType===n));F.account.set(`searchHistory`,r)},ys=()=>{F.account.set(`searchHistory`,[])},bs=(e,n,r)=>{let i,a,o;if(n===`statuses`)i=R(j,{id:`o1mMWT`,values:{query:e},components:{0:R(`q`,{})}}),a=`/search?q=${encodeURIComponent(e)}&type=statuses`,o=`document`;else if(n===`accounts`)i=R(j,{id:`cDoNQr`,values:{query:e},components:{0:R(`q`,{})}}),a=`/search?q=${encodeURIComponent(e)}&type=accounts`,o=`group`;else if(n===`hashtags`){let[,n=`#`,s=e]=e.match(/^([#])?(.*)$/);i=R(j,{id:`mFfcu0`,values:{hashtag:`${n}${s}`},components:{0:R(`mark`,{})}}),a=`/${r}/t/${s}`,o=`hashtag`}else i=R(j,{id:`48oDit`,values:{query:e},components:{0:R(`small`,{class:`insignificant`})}}),a=`/search?q=${encodeURIComponent(e)}`,o=`search`;return{label:i,to:a,icon:o}},xs=w((e,n)=>{let{_:r}=l(),{instance:i}=u(),[o,s]=ce(),[c,d]=I(!1),[f,p]=I(o.get(`q`)||``),h=o.get(`type`),g=a(null),_=a(null);P(n,()=>({setValue:e=>{p(e)},focus:()=>{_.current.focus()},select:()=>{_.current.select()},blur:()=>{_.current.blur()}}));let v=m(()=>hs({limit:5}),[e?.hidden]),y=m(()=>{if(!f)return[];let e=v.filter(e=>e.query===f?!1:e.query.toLowerCase().includes(f.toLowerCase())).slice(0,2).map(e=>({...bs(e.query,e.queryType,i),queryType:e.queryType,isRecentSearch:!0,historyItem:e}));return[{...bs(f,null,i),top:!h&&!/\s/.test(f),hidden:!!h},...e,{...bs(f,`statuses`,i),hidden:/^https?:/.test(f),top:/\s/.test(f),queryType:`statuses`},{...bs(f,`hashtags`,i),hidden:/^[@]/.test(f)||/^https?:/.test(f)||/\s/.test(f),top:/^[#]/.test(f),type:`link`,queryType:`hashtags`},{label:R(j,{id:`gEoOUj`,values:{query:f},components:{0:R(`mark`,{})}}),to:`/${f}`,hidden:!/^https?:/.test(f),top:/^https?:/.test(f),type:`link`,icon:`arrow-right`},{...bs(f,`accounts`,i),queryType:`accounts`}].sort((e,n)=>{if(h){if(e.queryType===h)return-1;if(n.queryType===h)return 1}return e.top&&!n.top?-1:!e.top&&n.top?1:0}).filter(({hidden:e})=>!e)},[f,h,i]);return R(`form`,{ref:g,class:`search-popover-container`,onSubmit:n=>{if(n.preventDefault(),/\/search/.test(location.hash))if(f){let e={q:f};h&&(e.type=h),s(e)}else s({});else f?location.hash=`/search?q=${encodeURIComponent(f)}${h?`&type=${h}`:``}`:location.hash=`/search`;_s(f,h),e?.onSubmit?.(n)},children:[R(`input`,{ref:_,value:f,name:`q`,type:`search`,placeholder:r({id:`A1taO8`}),dir:`auto`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellCheck:`false`,enterKeyHint:`search`,onSearch:e=>{e.target.value||s({})},onInput:e=>{p(e.target.value),d(!0)},onFocus:()=>{d(!0);let e=g.current?.querySelector(`.search-popover-item`);e&&e.classList.add(`focus`)},onBlur:()=>{setTimeout(()=>{d(!1)},100),g.current?.querySelector(`.search-popover-item.focus`)?.classList.remove(`focus`)},onKeyDown:n=>{let{key:r}=n;switch(r){case`Escape`:d(!1);break;case`Down`:case`ArrowDown`:if(n.preventDefault(),c){let e=g.current.querySelector(`.search-popover-item.focus`);if(e){let n=e.nextElementSibling;for(;n&&n.hidden;)n=n.nextElementSibling;n&&(n.classList.add(`focus`),Array.from(n.parentElement.children).filter(e=>e!==n).forEach(e=>{e.classList.remove(`focus`)}))}else{let e=g.current.querySelector(`.search-popover-item`);e&&e.classList.add(`focus`)}}break;case`Up`:case`ArrowUp`:if(n.preventDefault(),c){let e=document.querySelector(`.search-popover-item.focus`);if(e){let n=e.previousElementSibling;for(;n&&n.hidden;)n=n.previousElementSibling;n&&(n.classList.add(`focus`),Array.from(n.parentElement.children).filter(e=>e!==n).forEach(e=>{e.classList.remove(`focus`)}))}else{let e=document.querySelectorAll(`.search-popover-item`),n=e[e.length-1];n&&n.classList.add(`focus`)}}break;case`Enter`:if(c){let r=document.querySelector(`.search-popover-item.focus`);r&&(n.preventDefault(),r.click()),d(!1),e?.onSubmit?.(n)}break}}}),R(`div`,{class:`search-popover`,hidden:!c,children:[!f&&v.length>0&&R(`div`,{class:`search-popover-recent-searches`,children:[R(`div`,{class:`search-popover-header`,children:[R(X,{icon:`history`,size:`s`}),R(j,{id:`4R1B1H`})]}),v.map((n,r)=>{let{label:a,to:o,icon:s}=bs(n.query,n.queryType,i);return R(Z,{to:o,class:`search-popover-item ${r===0?`focus`:``}`,onClick:r=>{_s(n.query,n.queryType),e?.onSubmit?.(r)},children:[R(X,{icon:s,class:`more-insignificant`}),R(`span`,{children:a})]},`${n.query}-${n.queryType}-${n.timestamp}`)}),R(Z,{to:`/search`,class:`search-popover-item search-history-see-all`,children:[R(X,{icon:`more2`,class:`more-insignificant`}),R(`span`,{children:R(j,{id:`gukqfD`})})]})]}),y.map(({label:n,to:r,icon:i,queryType:a,isRecentSearch:o,historyItem:s},c)=>R(Z,{to:r,class:`search-popover-item ${o?`search-popover-item-recent`:``} ${c===0?`focus`:``}`,onClick:n=>{o||_s(f,a),e?.onSubmit?.(n)},children:[R(X,{icon:i,class:`more-insignificant`}),R(`span`,{children:n})]},o?`recent-${s.query}-${s.queryType}-${s.timestamp}`:`suggestion-${a||`general`}-${c}`))]})]})}),Ss=pe(function({onClose:e=()=>{}}){let n=W(o),[r,i]=I(!1),s=a(null);_(()=>{if(n.showSearchCommand){let{query:e}=n.showSearchCommand;i(!0),setTimeout(()=>{e&&s.current?.setValue?.(e),s.current?.focus?.()},150),o.showSearchCommand=!1}},[n.showSearchCommand]),$e([`Slash`,`/`],e=>{i(!0),setTimeout(()=>{s.current?.focus?.(),s.current?.select?.()},0)},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>{let n=/\/search/.test(location.hash),r=/\/yip/.test(location.hash),i=!!document.querySelector(`#modal-container > *`);return e.key===`/`?!1:n||r||i||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}});let c=()=>{i(!1),e()};$e(`esc`,e=>{s.current?.blur?.(),c()},{enabled:r,enableOnFormTags:!0,preventDefault:!0,useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey});let l=!r;return R(`div`,{id:`search-command-container`,hidden:l,onClick:e=>{e.target===e.currentTarget&&c()},children:R(xs,{ref:s,hidden:l,onSubmit:()=>{c()}})})});function Cs({lists:e}){return R(n,{children:[R(Nt,{to:`/l`,children:R(`span`,{children:R(j,{id:`BHWx-g`})})}),R(rt,{}),e?.map(e=>R(Nt,{to:`/l/${e.id}`,children:R(`span`,{children:[e.title,e.exclusive&&R(n,{children:[` `,R(Ei,{})]})]})},e.id))]})}function ws(){let{_:e,_:r}=l(),{instance:i}=u(),s=W(o),{shortcuts:c,settings:d}=s;if(!c.length)return null;let f=d.shortcutsViewMode===`multi-column`||!d.shortcutsViewMode&&d.shortcutsColumnsMode,p=a(),m=a(),h=a(!1),g=c.map((e,n)=>{let{type:a,...o}=e;if(!Xo[a])return null;let{id:s,path:c,title:l,subtitle:u,icon:d,altIcon:f}=Xo[a];return typeof s==`function`&&(s=s(o,n)),typeof c==`function`&&(c=c({...o,instance:o.instance||i},n)),typeof l==`function`?l=l(o,n):l?.id&&(l=r(l)),typeof u==`function`?u=u(o,n):u?.id&&(u=r(u)),typeof d==`function`&&(d=d(o,n)),typeof f==`function`&&(f=f(o,n)),s===`lists`&&(h.current=!0),{id:s,path:c,title:l,subtitle:u,icon:d,altIcon:f}}).filter(Boolean);_(()=>{if(s.settings.shortcutsViewMode===`tab-menu-bar`&&m.current){let e=setTimeout(()=>{let e=m.current?.querySelector(`.is-active`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},100);return()=>clearTimeout(e)}},[]);let v=Ne();$e([`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],e=>{let n=parseInt(e.key,10)-1;if(n<g.length){let{path:e}=g[n];e&&(v(e),p.current?.closeMenu?.())}},{enabled:!f,useKey:!0,ignoreEventWhen:e=>{let n=/^[1-9]$/.test(e.key);return e.metaKey||e.ctrlKey||e.altKey||e.shiftKey&&!n}});let[y,b]=I([]),x=a(),S=a(),[C,w]=I(void 0);_(()=>{C===`open`&&yi().then(b)},[C]);let T=Jt(()=>{w(`open`)},{threshold:600,detect:`touch`,cancelOnMovement:!0}),E=Jt(()=>{o.showAccounts=!0},{threshold:600,detect:`touch`,cancelOnMovement:!0});return f?null:R(`div`,{id:`shortcuts`,children:s.settings.shortcutsViewMode===`tab-menu-bar`?R(n,{children:[R(`nav`,{ref:m,class:`tab-bar`,onContextMenu:e=>{e.preventDefault(),o.showShortcutsSettings=!0},children:R(`ul`,{children:g.map(({id:e,path:r,title:i,subtitle:a,icon:s,altIcon:c},l)=>{let u=e===`lists`?{ref:S,onContextMenu(e){e.preventDefault(),e.stopPropagation(),w(`open`)},...T()}:e===`profile`?{onContextMenu(e){e.preventDefault(),e.stopPropagation(),o.showAccounts=!0},...E()}:{};return R(`li`,{children:R(Z,{class:a?`has-subtitle`:``,to:r,onClick:n=>{if(n.target.classList.contains(`is-active`)){n.preventDefault();let r=document.getElementById(`${e}-page`);if(r){r.scrollTop=0;let e=r.querySelector(`.updates-button`);e&&e.click()}}},...u,children:[c?.url?c?.type===`avatar`?R(vt,{staticUrl:c.url,size:`l`}):R(`img`,{src:c.url,alt:``,class:`shortcut-icon`,loading:`lazy`,decoding:`async`,fetchPriority:`low`}):R(X,{icon:s,size:`xl`}),R(`span`,{children:[R(Ko,{children:i}),a&&R(n,{children:[R(`br`,{}),R(`small`,{children:a})]})]})]})},`${l}-${e}-${i}-${a}-${r}`)})})}),R(at,{ref:x,state:C,anchorRef:S,onClose:()=>{w(void 0)},overflow:`auto`,viewScroll:`close`,gap:4,boundingBoxPadding:yt(),portal:{target:document.body},children:R(Cs,{lists:y})})]}):R(tt,{instanceRef:p,overflow:`auto`,viewScroll:`close`,menuClassName:`glass-menu shortcuts-menu`,gap:8,position:`anchor`,onMenuChange:e=>{e.open&&h.current&&yi().then(b)},menuButton:R(`button`,{type:`button`,id:`shortcuts-button`,class:`plain`,onContextMenu:e=>{e.preventDefault(),o.showShortcutsSettings=!0},onTransitionStart:e=>{try{let{target:n}=e;getComputedStyle(n).pointerEvents===`none`&&p.current?.closeMenu?.()}catch{}},children:R(X,{icon:`shortcut`,size:`xl`,alt:e({id:`CTqTgr`})})}),children:g.map(({id:e,path:r,title:i,subtitle:a,icon:o},s)=>e===`lists`?R(Lt,{menuClassName:`glass-menu`,overflow:`auto`,gap:-8,label:R(n,{children:[R(X,{icon:o,size:`l`}),R(`span`,{class:`menu-grow`,children:R(Ko,{children:i})}),R(X,{icon:`chevron-right`})]}),children:R(Cs,{lists:y})}):R(Nt,{to:r,class:`glass-menu-item`,children:[R(X,{icon:o,size:`l`}),` `,R(`span`,{class:`menu-grow`,children:[R(`span`,{children:R(Ko,{children:i})}),a&&R(n,{children:[` `,R(`small`,{class:`more-insignificant`,children:a})]})]}),R(`span`,{class:`menu-shortcut hide-until-focus-visible`,children:s+1})]},`${s}-${e}-${i}-${a}-${r}`))})})}var Ts=pe(ws),Es=80;function Ds({account:e,instance:n}){let{_:r}=l();if(!e)return null;let{followersCount:i,followingCount:s,statusesCount:c,id:d,hideCollections:f}=e,p=n?`/${n}/a/${d}`:`/a/${d}`,{masto:m}=u({instance:n}),h=a();async function g(e){return d?((e||!h.current)&&(h.current=m.v1.accounts.$select(d).followers.list({limit:Es}).values()),await h.current.next()):{value:[],done:!0}}let _=a();async function v(e){return d?((e||!_.current)&&(_.current=m.v1.accounts.$select(d).following.list({limit:Es}).values()),await _.current.next()):{value:[],done:!0}}return R(`div`,{class:`account-container mini`,children:R(`div`,{class:`account-metadata-box`,children:R(`div`,{class:`stats`,children:[R(`div`,{tabIndex:0,onClick:()=>{setTimeout(()=>{o.showGenericAccounts={id:`followers`,heading:r({id:`x5LEuB`}),fetchAccounts:g,instance:n,blankCopy:f?r({id:`BRV_wh`}):void 0}},0)},children:R(j,{id:`TbttfX`,values:{0:Ze(i),1:Ze(i),followersCount:i},components:{0:R(`span`,{title:i}),1:R(`span`,{title:i})}})}),R(`div`,{class:`insignificant`,tabIndex:0,onClick:()=>{setTimeout(()=>{o.showGenericAccounts={heading:r({id:`following.stats`}),fetchAccounts:v,instance:n,blankCopy:f?r({id:`BRV_wh`}):void 0}},0)},children:R(j,{id:`SGcIK-`,values:{0:Ze(s),followingCount:s},components:{0:R(`span`,{title:s})}})}),R(Z,{class:`insignificant`,to:p,children:R(j,{id:`C4x3-X`,values:{0:Ze(c),1:Ze(c),statusesCount:c},components:{0:R(`span`,{title:c}),1:R(`span`,{title:c})}})})]})})})}function Os(e){let n=[],r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a];o.reblog&&!o.account?.group?(r.push(o),i++):(n.push(o),i<3&&(i=0))}if(e.length>10&&(r.length>e.length/4||i>=3)){let i=r.map(e=>e.id);if(r.length>e.length*3/4)n=[...n,{id:i,items:r,type:`boosts`}];else{let e=Math.floor(n.length/2);n=[...n.slice(0,e),{id:i,items:r,type:`boosts`},...n.slice(e)]}return n}else return e}var ks=100;function As(e,n){let r=F.account.get(`boostedStatusIDs`)||{},i=e.filter(e=>{if(!e.reblog)return!0;let i=`${n}-${e.reblog.id}`,a=r[i];return a&&a!==e.id?!1:(r[i]=e.id,!0)}),a=Object.keys(r);return a.length>ks&&a.slice(0,a.length-ks).forEach(e=>{delete r[e]}),F.account.set(`boostedStatusIDs`,r),i}function js(e,n){if(!n)return e;let r=T();return e.filter(e=>{if(!e?.filtered)return!0;let i=e?.account?.id===r,a=pt(e.filtered,n);return!(!i&&a?.action===`hide`)})}function Ms(e,n){let r=[],i=0;e.forEach(n=>{for(let e=0;e<r.length;e++){if(r[e].find(e=>e.id===n.id))return;if(r[e].find(e=>e.id===n.inReplyToId)||r[e].find(e=>e.inReplyToId===n.id)){r[e].push(n);return}}let a=e.find(e=>e.id===n.inReplyToId);a&&(r[i++]=[n,a])});for(let e=0;e<r.length;e++)for(let n=e+1;n<r.length;n++)r[e].find(e=>r[n].includes(e))&&(r[e]=[...r[e],...r[n]],r[e]=r[e].filter((e,n,r)=>r.findIndex(n=>n.id===e.id)===n),r.splice(n,1),n--);r.forEach(e=>{e.sort((e,n)=>!e.inReplyToId&&!n.inReplyToId?Date.parse(e.createdAt)-Date.parse(n.createdAt):e.inReplyToId===n.id?1:n.inReplyToId===e.id||!e.inReplyToId?-1:n.inReplyToId?Date.parse(e.createdAt)-Date.parse(n.createdAt):1)}),r.forEach(e=>{let n=e[0].account.id;e.forEach(e=>{e.account.id!==n&&(e._differentAuthor=!0)})}),r.length;let a=[],s=[],c=[];return e.forEach(e=>{if(e.reblog){a.push(e);return}for(let n=0;n<r.length;n++)if(r[n].find(n=>n.id===e.id)){if(s.includes(n))return;let e=r[n];e.sort((e,n)=>Date.parse(e.createdAt)-Date.parse(n.createdAt));let i=e[0].account.id;a.push({id:e.map(e=>e.id),items:e,type:e.every(e=>e.account.id===i)?`thread`:`conversation`}),s.push(n);return}if(e.inReplyToId&&e.inReplyToAccountId!==e.account.id){let r=Ae(e.id,n);o.statusReply[r]||c.push({sKey:r,inReplyToId:e.inReplyToId})}a.push(e)}),c?.length&&setTimeout(()=>{let{masto:e}=u({instance:n});async function r(){for(let r=0;r<c.length;r++){let{sKey:i,inReplyToId:a}=c[r];try{let r=await Ns(a,e);O(r,n,{skipThreading:!0}),o.statusReply[i]={id:r.id,instance:n},await new Promise(e=>setTimeout(e,1e3))}catch{}}}if(Xe(`@mastodon/fetch-multiple-statuses`)){let i=c.map(({inReplyToId:e})=>e);(async()=>{try{let a=await e.v1.statuses.list({id:i});if(a?.length)for(let e of a){O(e,n,{skipThreading:!0});let r=c.find(({inReplyToId:n})=>n===e.id)?.sKey;r&&(o.statusReply[r]={id:e.id,instance:n})}else r()}catch{r()}})()}else r()},10),a}var Ns=r((e,n)=>n.v1.statuses.$select(e).fetch());async function Ps(e,n){let r=await Uo();if(!r.length)return;let{statusFollowedTags:i}=o,a=[];if(e.forEach(e=>{if(e.reblog)return;let{id:o,content:s,tags:c=[]}=e,l=Ae(o,n);if(i[l]?.length)return;let u=Go(s);if(!u.length&&!c.length)return;let d=r.reduce((e,n)=>((u.some(e=>e.toLowerCase()===n.name.toLowerCase())||c.some(e=>e.name.toLowerCase()===n.name.toLowerCase()))&&e.push(n.name),e),[]);d.length&&a.push({item:e,sKey:l,followedTags:d})}),a.length){let e=await ze(a.map(e=>e.item.account));if(!e)return;a.forEach(n=>{let{item:r,sKey:a,followedTags:o}=n,s=e[r.account.id];s&&!s.following&&(i[a]=o)})}}function Fs(){o.statusFollowedTags={}}function Is({scrollableRef:e,distanceFromStart:n=1,distanceFromEnd:r=1,scrollThresholdStart:i=10,scrollThresholdEnd:a=10,direction:o=`vertical`,distanceFromStartPx:s,distanceFromEndPx:c}={}){let[l,u]=I(null),[d,f]=I(!1),[p,m]=I(!1),[h,g]=I(!1),[_,v]=I(!1),y=o===`vertical`;return ee(()=>{let o=e.current;if(!o)return{};let l=y?o.scrollTop:o.scrollLeft;function d(){let{scrollTop:e,scrollLeft:d,scrollHeight:p,scrollWidth:h,clientHeight:_,clientWidth:b}=o,x=y?e:d,S=y?p:h,C=y?_:b,w=Math.abs(x-l),T=s||Math.min(C*n,S,x),E=c||Math.min(C*r,S,S-x-C);w>=(l<x?a:i)&&(u(l<x?`end`:`start`),l=x),f(x<=0),m(x+C>=S),g(x<=T),v(x+C>=S-E)}return o.addEventListener(`scroll`,d,{passive:!0}),()=>o.removeEventListener(`scroll`,d)},[n,r,i,a]),{scrollDirection:l,reachStart:d,reachEnd:p,nearReachStart:h,nearReachEnd:_,init:()=>{e.current&&e.current.dispatchEvent(new Event(`scroll`))}}}function Ls({scrollableRef:e,distanceFromStart:n=1,distanceFromEnd:r=1,scrollThresholdStart:i=10,scrollThresholdEnd:o=10,direction:s=`vertical`,distanceFromStartPx:c,distanceFromEndPx:l,init:u}={},d){if(!d)return;let f=s===`vertical`,p=a(null),m=a(null),h=Ge(()=>{let a=!1,s=!1,u=!1,h=!1,{scrollTop:g,scrollLeft:_,scrollHeight:v,scrollWidth:y,clientHeight:b,clientWidth:x}=e.current,S=f?g:_,C=f?v:y,w=f?b:x,T=S-p.current,E=T>0,D=E?o:i,O=c||Math.min(w*n,C,S),k=l||Math.min(w*r,C,C-S-w);Math.abs(T)>=D&&(m.current=E?`end`:`start`,p.current=S),a=S<=0,s=S+w>=C,u=S<=O,h=S+w>=C-k,d({scrollDirection:m.current,reachStart:a,reachEnd:s,nearReachStart:u,nearReachEnd:h})},500,{leading:!1});return ee(()=>{let n=e.current;return n&&(p.current=n[f?`scrollTop`:`scrollLeft`],n.addEventListener(`scroll`,h,{passive:!0})),()=>{n&&n.removeEventListener(`scroll`,h)}},[]),_(()=>{u&&e.current&&queueMicrotask(()=>{e.current.dispatchEvent(new Event(`scroll`))})},[u]),{resetScrollDirection:()=>{m.current=null}}}function Rs({class:e,statusID:n,status:r,instance:i,parent:a,onMediaClick:s}){let{_:c}=l(),u=Ae(n,i),d=W(o);if(r||(r=d.statuses[u]||d.statuses[n],u=Ae(r?.id,i)),!r)return null;let{account:{acct:f,avatar:p,avatarStatic:g,id:_,url:v,displayName:y,username:b,emojis:x,bot:S,group:C},id:w,repliesCount:E,reblogged:D,reblogsCount:O,favourited:k,favouritesCount:A,bookmarked:j,poll:M,muted:ee,sensitive:N,spoilerText:P,visibility:F,language:I,editedAt:L,filtered:z,card:B,createdAt:te,inReplyToId:V,inReplyToAccountId:ne,content:re,mentions:ie,mediaAttachments:ae,reblog:oe,uri:H,url:U,emojis:se,_deleted:G,_pinned:ce}=r;if(!ae?.length)return null;let le=e=>{e.shiftKey},ue=m(()=>T(),[]),de=m(()=>ue&&ue===_,[_,ue]),K=xe(Gt),fe=!de&&pt(z,K);if(fe?.action===`hide`)return null;let pe=N,me=(h()[`reading:expand:media`]?.toLowerCase()||`default`)===`show_all`,q=a||`div`;return ae.map((n,a)=>{let o=`${u}-${n.id}`,l=fe?.titlesStr;return R(q,{"data-state-post-id":u,onMouseEnter:le,"data-spoiler-text":P||(N?c({id:`FKojeB`}):void 0),"data-filtered-text":fe?c(l?{id:`7FGvtQ`,values:{filterTitleStr:l}}:{id:`03Qqf9`}):void 0,class:`
media-post
${fe?`filtered`:``}
${pe?`has-spoiler`:``}
${me?`show-media`:``}
`,children:R(Bt,{class:e,media:n,lang:I,to:`/${i}/s/${w}?media-only=${a+1}`,onClick:s?e=>s(e,a,n,r):void 0})},o)})}var zs=pe(Rs);function Bs(e){let{_:r}=l(),i=W(o),{masto:s,instance:c,authenticated:d}=u(),[f,p]=m(()=>{let e=g();return[e.find(e=>e.info.id===T())||e[0],e.length>1]},[]),h=i.settings.shortcutsViewMode===`tab-menu-bar`&&i.shortcuts.some(e=>e.type===`profile`),_=p&&!h,v=(i.settings.shortcutsViewMode===`multi-column`||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&!i.shortcuts.find(e=>e.type===`following`),y=Jt(()=>{o.showAccounts=!0},{threshold:600,detect:`touch`,cancelOnMovement:!0}),b=a(),[x,S]=I(void 0),C=yt([0,0,i.settings.shortcutsViewMode===`tab-menu-bar`?50:0,0]),w=a();async function E(e){return(e||!w.current)&&(w.current=s.v1.mutes.list({limit:80}).values()),await w.current.next()}let D=a();async function O(e){return(e||!D.current)&&(D.current=s.v1.blocks.list({limit:80}).values()),await D.current.next()}let k=a();return R(n,{children:[R(`button`,{ref:b,type:`button`,class:`button plain nav-menu-button ${_?`with-avatar`:``} ${x===`open`?`active`:``}`,style:{position:`relative`},onClick:()=>{k.current=Date.now(),S(e=>e?void 0:`open`)},onContextMenu:e=>{e.preventDefault(),o.showAccounts=!0},...y(),children:[_&&R(vt,{url:f?.info?.avatar||f?.info?.avatarStatic,size:`l`,squircle:f?.info?.bot}),R(X,{icon:`menu`,size:_?`s`:`l`,alt:r({id:`zucql-`})})]}),R(at,{menuClassName:`nav-menu`,state:x,anchorRef:b,onClose:()=>{S(void 0)},containerProps:{style:{zIndex:10},onClick:()=>{Date.now()-k.current}},portal:{target:document.body},...e,overflow:`auto`,viewScroll:`close`,position:`anchor`,align:`center`,boundingBoxPadding:C,unmountOnClose:!0,children:[!!i.appVersion?.commitHash&&i.appVersion.commitHash!==`387a188`&&R(`div`,{class:`top-menu`,children:[R(Q,{onClick:()=>{confirm(r({id:`Djbaby`}))&&(async()=>{try{location.reload()}catch{}})()},children:[R(X,{icon:`sparkles`,class:`sparkle-icon`,size:`l`}),` `,R(`span`,{children:R(j,{id:`95IFnD`})})]}),R(rt,{})]}),R(`section`,{children:[R(Nt,{to:`/`,children:[R(X,{icon:`home`,size:`l`}),` `,R(`span`,{children:R(j,{id:`i0qMbr`})})]}),d?R(n,{children:[v&&R(Nt,{to:`/following`,children:[R(X,{icon:`following`,size:`l`}),` `,R(`span`,{children:R(j,{id:`following.title`})})]}),R(Nt,{to:`/catchup`,children:[R(X,{icon:`history2`,size:`l`}),R(`span`,{children:R(j,{id:`xrl8fj`})})]}),Xe(`@mastodon/mentions`)&&R(Nt,{to:`/mentions`,children:[R(X,{icon:`at`,size:`l`}),` `,R(`span`,{children:R(j,{id:`_bZzdR`})})]}),R(Nt,{to:`/notifications`,children:[R(X,{icon:`notification`,size:`l`}),` `,R(`span`,{children:R(j,{id:`iDNBZe`})}),i.notificationsShowNew&&R(`sup`,{title:r({id:`isRobC`}),style:{opacity:.5},children:[` `,``]})]}),R(rt,{}),f?.info?.id&&R(Nt,{to:`/${c}/a/${f.info.id}`,children:[R(X,{icon:`user`,size:`l`}),` `,R(`span`,{children:R(j,{id:`vERlcd`})})]}),R(Vs,{menuState:x}),R(Nt,{to:`/b`,children:[R(X,{icon:`bookmark`,size:`l`}),` `,R(`span`,{children:R(j,{id:`7Ff7ia`})})]}),R(Lt,{menuClassName:`nav-submenu`,overflow:`auto`,gap:-8,label:R(n,{children:[R(X,{icon:`more`,size:`l`}),R(`span`,{class:`menu-grow`,children:R(j,{id:`24misb`})}),R(X,{icon:`chevron-right`})]}),children:[R(Nt,{to:`/f`,children:[R(X,{icon:`heart`,size:`l`}),` `,R(`span`,{children:R(j,{id:`zZOZj7`})})]}),R(Nt,{to:`/fh`,children:[R(X,{icon:`hashtag`,size:`l`}),` `,R(`span`,{children:R(j,{id:`Xi1_bw`})})]}),R(Nt,{to:`/sp`,children:[R(X,{icon:`schedule`,size:`l`}),` `,R(`span`,{children:R(j,{id:`-GkIdc`})})]}),R(rt,{}),Xe(`@mastodon/filters`)&&R(Nt,{to:`/ft`,children:[R(X,{icon:`filters`,size:`l`}),` `,R(`span`,{children:R(j,{id:`cSev-j`})})]}),R(Q,{onClick:()=>{o.showGenericAccounts={id:`mute`,heading:r({id:`sOKhEA`}),fetchAccounts:E,excludeRelationshipAttrs:[`muting`]}},children:[R(X,{icon:`mute`,size:`l`}),` `,R(`span`,{children:R(j,{id:`n1sANU`})})]}),R(Q,{onClick:()=>{o.showGenericAccounts={id:`block`,heading:r({id:`nL8nlr`}),fetchAccounts:O,excludeRelationshipAttrs:[`blocking`]}},children:[R(X,{icon:`block`,size:`l`}),` `,R(`span`,{children:R(j,{id:`r3RRWo`})})]}),` `]}),R(rt,{}),R(Q,{onClick:()=>{o.showAccounts=!0},children:[R(X,{icon:`group`,size:`l`}),` `,R(`span`,{children:R(j,{id:`7e0O8Z`})})]})]}):R(n,{children:[R(rt,{}),R(Nt,{to:`/login`,children:[R(X,{icon:`user`,size:`l`}),` `,R(`span`,{children:R(j,{id:`sQia9P`})})]})]})]}),R(`section`,{children:[R(rt,{}),R(Nt,{to:`/search`,children:[R(X,{icon:`search`,size:`l`}),` `,R(`span`,{children:R(j,{id:`A1taO8`})})]}),!i.settings.hideTrendingTimeline&&R(Nt,{to:`/${c}/trending`,children:[R(X,{icon:`chart`,size:`l`}),` `,R(`span`,{children:R(j,{id:`4_iCqx`})})]}),!i.settings.hideLocalTimeline&&R(Nt,{to:`/${c}/p/l`,children:[R(X,{icon:`building`,size:`l`}),` `,R(`span`,{children:R(j,{id:`d5zxa4`})})]}),!i.settings.hideFederatedTimeline&&R(Nt,{to:`/${c}/p`,children:[R(X,{icon:`earth`,size:`l`}),` `,R(`span`,{children:R(j,{id:`4ERYY7`})})]}),d?R(n,{children:[R(rt,{className:`divider-grow`}),R(Q,{onClick:()=>{o.showKeyboardShortcutsHelp=!0},children:[R(X,{icon:`keyboard`,size:`l`}),` `,R(`span`,{children:R(j,{id:`77Emn0`})})]}),R(Q,{onClick:()=>{o.showShortcutsSettings=!0},children:[R(X,{icon:`shortcut`,size:`l`}),` `,R(`span`,{children:R(j,{id:`8Kudkr`})})]}),R(Q,{onClick:()=>{o.showSettings=!0},children:[R(X,{icon:`gear`,size:`l`}),` `,R(`span`,{children:R(j,{id:`uVbUP8`})})]})]}):R(n,{children:[R(rt,{}),R(Q,{onClick:()=>{o.showSettings=!0},children:[R(X,{icon:`gear`,size:`l`}),` `,R(`span`,{children:R(j,{id:`uVbUP8`})})]})]})]})]})]})}function Vs({menuState:e}){let r=Xe(`@mastodon/lists`),[i,a]=I([]);return _(()=>{r&&e===`open`&&yi().then(a)},[e,r]),i.length>0?R(Lt,{menuClassName:`nav-submenu`,overflow:`auto`,gap:-8,label:R(n,{children:[R(X,{icon:`list`,size:`l`}),R(`span`,{class:`menu-grow`,children:R(j,{id:`h16FyT`})}),R(X,{icon:`chevron-right`})]}),children:[R(Nt,{to:`/l`,children:R(`span`,{children:R(j,{id:`BHWx-g`})})}),i?.length>0&&R(n,{children:[R(rt,{}),i.map(e=>R(Nt,{to:`/l/${e.id}`,children:R(`span`,{children:[e.title,e.exclusive&&R(n,{children:[` `,R(Ei,{})]})]})},e.id))]})]}):r&&R(Nt,{to:`/l`,children:[R(X,{icon:`list`,size:`l`}),R(`span`,{children:R(j,{id:`h16FyT`})})]})}var Hs=pe(Bs),Us={block:`start`,inline:`center`,behavior:`instant`},Ws=`.timeline-pagination button[data-pagination-trigger="prev"]`,Gs=`.timeline-pagination button[data-pagination-trigger="next"]`,Ks=`.timeline-item, .timeline-item-alt`;function qs(e){return $e(`j, shift+j`,(n,r)=>{if(n.shiftKey!==r.shift)return;let i=document.activeElement.closest(Ks),a=i?.getBoundingClientRect(),o=Array.from(e.current?.querySelectorAll(Ks)||[]).filter(e=>!!e.offsetHeight);if(i&&a.top<e.current.clientHeight&&a.bottom>0){let n=o.indexOf(i),a=o[n+1];if(r.shift&&(a=o.find((e,r)=>r>n&&!e.classList.contains(`timeline-item-alt`))),a)a.focus(),a.scrollIntoView(Us);else{let n=e.current.querySelector(Gs);n&&n.click()}}else{let e=o.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Us))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.key.toLowerCase()!==`j`})}function Js(e){return $e(`k, shift+k`,(n,r)=>{if(n.shiftKey!==r.shift)return;let i=document.activeElement.closest(Ks),a=i?.getBoundingClientRect(),o=Array.from(e.current?.querySelectorAll(Ks)||[]).filter(e=>!!e.offsetHeight);if(i&&a.top<e.current.clientHeight&&a.bottom>0){let n=o.indexOf(i),a=o[n-1];if(r.shift&&(a=o.findLast((e,r)=>r<n&&!e.classList.contains(`timeline-item-alt`))),a)a.focus(),a.scrollIntoView(Us);else{let n=e.current.querySelector(Ws);n&&n.click()}}else{let e=o.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Us))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.key.toLowerCase()!==`k`})}function Ys(){return $e([`enter`,`o`],(e,n)=>{let r=document.activeElement;if(r?.matches(Ks))if(n.keys.join(``)===`o`){let e=r.querySelector(`a.media:not(.status-card a.media)`);if(e){let n=e.getAttribute(`href`);if(/media\-only=/i.test(n)){let e=n.replace(/media\-only=/i,`media=`);setTimeout(()=>{location.hash=e},100)}else e.click()}else r.click()}else r.click()},{useKey:!0,ignoreEventWhen:e=>e.key===`Enter`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`o`})}function Xs({title:e,titleComponent:r,id:i,instance:s,emptyText:c,errorText:u,useItemID:d,boostsCarousel:f,fetchItems:p=()=>{},checkForUpdates:h=()=>{},checkForUpdatesInterval:g=15e3,headerStart:v,headerEnd:b,timelineStart:x,refresh:S,view:C,filterContext:w,showFollowedTags:T,showReplyParent:E,clearWhenRefresh:D}){let{_:O}=l(),k=W(o),A=k.settings.autoHideBars,[M,ee]=I([]),[N,P]=I(`start`),[F,L]=I(!1),[z,B]=I(!1),[te,V]=I(!0),re=a();__BENCHMARK.start(`timeline-${i}-load`);let ie=m(()=>ne(),[]),ae=C!==`media`,oe=a(0),H=Je(e=>{B(!1),P(`loading`),(async()=>{try{let n=oe.current=Date.now(),{done:r,value:a}=await p(e);if(n!==oe.current)return;if(Array.isArray(a)){let[n,i]=a.reduce((e,n)=>(n._pinned?e[0].push(n):e[1].push(n),e),[[],[]]);a=i,a=js(a,w),ae&&(f&&(a=Os(a)),a=Ms(a,s)),n.length&&(a=n.concat(a)),ee(e?a:e=>[...e,...a]),a.length||(r=!0),L(!r)}else throw Error(`Timeline load failed`);P(`default`),__BENCHMARK.end(`timeline-${i}-load`)}catch{P(`error`),e&&!M.length&&u&&Y(u)}finally{H.cancel()}})()},1e3,{leading:!0}),U=qs(re),se=Js(re),G=Ys(),ce=M.length>0&&N!==`loading`&&z,le=y(()=>{ce&&H(!0),re.current?.scrollTo({top:0,behavior:`smooth`})},[H,ce]),ue=$e(`.`,le,{useKey:!0,ignoreEventWhen:e=>e.key===`.`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),de=a(),[K,fe]=I(!1),pe=y(({scrollDirection:e,nearReachStart:n,reachStart:r})=>{if(de.current){let r=A&&e===`end`&&!n;de.current.hidden=r}fe(n),r&&H(!0)},[fe,H,A]),{resetScrollDirection:me}=Ls({scrollableRef:re,distanceFromEnd:2,scrollThresholdStart:44},pe);_(()=>{re.current?.scrollTo({top:0}),H(!0)},[]);let q=a(!0);_(()=>{if(q.current){q.current=!1;return}D&&M?.length&&(H.cancel?.(),ee([])),H(!0)},[D,S]);let he=a(C);_(()=>{he.current!==C&&(he.current=C,ee([]))},[C]);let ge=y(async({disableIdleCheck:e=!1}={})=>{let n=re.current?getComputedStyle(re.current).pointerEvents===`none`:!1;k.settings.autoRefresh&&re.current.scrollTop<16&&(e||window.__IDLE__)&&!ec()&&!n?H(!0):await h()&&B(!0)},[i,H,h,k.settings.autoRefresh]),_e=a();return an(e=>{if(e){let e=Date.now()-_e.current;(!_e.current||e>1e3*3)&&ge({disableIdleCheck:!0})}else _e.current=Date.now();V(e)},[h,ge,k.settings.autoRefresh]),Ue(ge,te&&!z?g*(K?1:2):null),R(Gt.Provider,{value:w,children:R(`div`,{id:`${i}-page`,class:`deck-container ${ie?`deck-container-media-first`:``}`,ref:e=>{re.current=e,U.current=e,se.current=e,G.current=e,ue.current=e},tabIndex:`-1`,onClick:e=>{de.current&&e.target.closest(`.timeline-item, .timeline-item-alt`)&&setTimeout(()=>{de.current.hidden=!1,me()},250)},children:R(`div`,{class:`timeline-deck deck`,children:[R(`header`,{ref:de,onClick:e=>{e.target.closest(`a, button`)||re.current?.scrollTo({top:0,behavior:`smooth`})},onDblClick:e=>{e.target.closest(`a, button`)||H(!0)},class:N===`loading`?`loading`:``,children:[R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),v??R(Z,{to:`/`,class:`button plain home-button`,children:R(X,{icon:`home`,size:`l`,alt:O({id:`i0qMbr`})})})]}),e&&(r||R(`h1`,{children:e})),R(`div`,{class:`header-side`,children:!!b&&b})]}),ce&&R(`button`,{class:`updates-button shiny-pill`,type:`button`,onClick:le,children:[R(X,{icon:`arrow-up`}),` `,R(j,{id:`2yr1_p`})]})]}),!!x&&R(`div`,{class:`timeline-start ${N===`loading`?`loading`:``}`,children:x}),M.length?R(n,{children:[R(`ul`,{class:`timeline ${C?`timeline-${C}`:``}`,children:[M.map(e=>R(Zs,{status:e,instance:s,useItemID:d,filterContext:w,view:C,showFollowedTags:T,showReplyParent:E,mediaFirst:ie},e.id+e?._pinned+C)),F&&N===`loading`&&(C===`media`?null:R(n,{children:[R(`li`,{style:{height:`20vh`},children:R(Mt,{skeleton:!0,mediaFirst:ie})}),R(`li`,{style:{height:`25vh`},children:R(Mt,{skeleton:!0,mediaFirst:ie})})]}))]}),N===`default`&&(F?R(He,{root:re.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:e=>{e&&H()},children:R(`button`,{type:`button`,class:`plain block`,onClick:()=>H(),style:{marginBlockEnd:`6em`},children:R(j,{id:`uXRAkV`})})}):R(`p`,{class:`ui-state insignificant`,children:R(j,{id:`2EYeAZ`})}))]}):N===`loading`?R(`ul`,{class:`timeline`,children:Array.from({length:5}).map((e,n)=>C===`media`?R(`div`,{style:{height:`50vh`}}):R(`li`,{children:R(Mt,{skeleton:!0,mediaFirst:ie})},n))}):N!==`error`&&N!==`start`&&R(`p`,{class:`ui-state`,children:c}),N===`error`&&R(`p`,{class:`ui-state`,children:[u,R(`br`,{}),R(`br`,{}),R(`button`,{type:`button`,onClick:()=>H(!M.length),children:R(j,{id:`KDw4GX`})})]})]})})})}var Zs=pe(({status:e,instance:n,useItemID:r,filterContext:i,view:a,showFollowedTags:o,showReplyParent:s,mediaFirst:c})=>{let{_:u}=l(),{id:d,reblog:f,items:p,type:m,_pinned:h}=e;h&&(r=!1);let g=f?.id||d,_=n?`/${n}/s/${g}`:`/s/${g}`;if(p){let e=qt(p,i),a=``;if(m===`boosts`?a=K._({id:`NuqppG`,values:{0:e.length}}):m===`pinned`&&(a=u({id:`GlfmCu`})),m===`boosts`||m===`pinned`){let o=new Set;if(e.sort((e,n)=>{let r=pt(e.filtered,i),a=pt(n.filtered,i);return r&&r?.action!==`blur`&&o.add(e.id),a&&a?.action!==`blur`&&o.add(n.id),r&&!a?1:!r&&a?-1:0}),o.size>=2){let n=[],r=[];e.forEach(e=>{o.has(e.id)?r.push(e):n.push(e)});let i=[];for(let e=0;e<r.length;e+=5)i.push({_grouped:!0,posts:r.slice(e,e+5)});e=n.concat(i)}return R(`li`,{class:`timeline-item-carousel`,children:R(Qs,{title:a,class:`${m}-carousel`,children:e.map(e=>{let{id:i,reblog:a,_pinned:o,_grouped:s}=e;if(s)return R(`li`,{class:`timeline-item-carousel-group`,children:e.posts.map(e=>{let{id:i,reblog:a,_pinned:o}=e,s=a?.id||i,c=n?`/${n}/s/${s}`:`/s/${s}`;return o&&(r=!1),R(Z,{class:`status-carousel-link timeline-item-alt`,to:c,children:r?R(Mt,{statusID:i,instance:n,size:`s`}):R(Mt,{status:e,instance:n,size:`s`})})})},i);let l=a?.id||i,u=n?`/${n}/s/${l}`:`/s/${l}`;return o&&(r=!1),R(`li`,{children:R(Z,{class:`status-carousel-link timeline-item-alt`,to:u,children:r?R(Mt,{statusID:i,instance:n,size:`s`,contentTextWeight:!0,enableCommentHint:!0,mediaFirst:c}):R(Mt,{status:e,instance:n,size:`s`,contentTextWeight:!0,enableCommentHint:!0,mediaFirst:c})})},i)})})},`timeline-${d}`)}let s=e.length>3;return e.map((a,c)=>{let{id:l,_differentAuthor:u}=a,d=n?`/${n}/s/${l}`:`/s/${l}`,f=c>0&&c<e.length-1,p=a.sensitive&&!!a.spoilerText,h=!u&&p&&c>0||s&&f&&(m===`thread`||m===`conversation`&&!u&&!e[c-1]._differentAuthor&&!e[c+1]._differentAuthor),g=c===0,_=c===e.length-1;return R(`li`,{class:`timeline-item-container timeline-item-container-type-${m} timeline-item-container-${g?`start`:_?`end`:`middle`} ${u?`timeline-item-diff-author`:``}`,children:R(Z,{class:`status-link timeline-item`,to:d,children:h?R($s,{status:a,instance:n,filterContext:i}):r?R(Mt,{statusID:l,instance:n,enableCommentHint:_,showFollowedTags:o}):R(Mt,{status:a,instance:n,enableCommentHint:_,showFollowedTags:o})})},`timeline-${l}`)})}let v=`timeline-${d+h}`;return a===`media`?r?R(zs,{class:`timeline-item`,parent:`li`,statusID:d,instance:n},v):R(zs,{class:`timeline-item`,parent:`li`,status:e,instance:n},v):R(`li`,{children:R(Z,{class:`status-link timeline-item`,to:_,children:r?R(Mt,{statusID:d,instance:n,enableCommentHint:!0,showFollowedTags:o,showReplyParent:s,mediaFirst:c}):R(Mt,{status:e,instance:n,enableCommentHint:!0,showFollowedTags:o,showReplyParent:s,mediaFirst:c})})},v)},(e,n)=>(e.status?.id||``).toString()===(n.status?.id||``).toString()&&e.instance===n.instance&&e.view===n.view);function Qs({title:e,class:n,children:r}){let{_:i}=l(),o=a(),s=a(),c=a(),[u,d]=I(!1);return _(()=>{setTimeout(()=>{d(!0)},1)},[]),R(`div`,{class:`status-carousel ${n}`,children:[R(`header`,{children:[R(`h3`,{children:e}),R(`span`,{children:[R(`button`,{ref:s,type:`button`,class:`small plain2`,onClick:()=>{let e=Math.min(320,o.current?.offsetWidth)*(Re()?1:-1);o.current?.scrollBy({left:e,behavior:`smooth`})},children:R(X,{icon:`chevron-left`,alt:i({id:`DHhJ7s`})})}),` `,R(`button`,{ref:c,type:`button`,class:`small plain2`,onClick:()=>{let e=Math.min(320,o.current?.offsetWidth)*(Re()?-1:1);o.current?.scrollBy({left:e,behavior:`smooth`})},children:R(X,{icon:`chevron-right`,alt:i({id:`hXzOVo`})})})]})]}),R(`ul`,{ref:o,children:[R(He,{class:`status-carousel-beacon`,onChange:e=>{s.current&&(s.current.disabled=e)}}),r[0],u&&r.slice(1),R(He,{class:`status-carousel-beacon`,onChange:e=>{c.current&&(c.current.disabled=e)}})]})]})}function $s({status:e,instance:r,filterContext:i}){let{_:a}=l(),s=W(o),{id:c,visibility:u,language:d}=e,f=Ot(e),p=Ae(c,r),m=pt(e.filtered,i);return R(`article`,{class:`status compact-thread ${u===`direct`?`visibility-direct`:``}`,tabindex:`-1`,children:[R(`div`,{class:`status-thread-badge-container`,children:R(Rt,{index:s.statusThreadNumber[p]})}),R(`div`,{class:`content-compact`,title:f,lang:d,dir:`auto`,children:m&&m?.action!==`blur`?R(`b`,{class:`status-filtered-badge badge-meta horizontal`,title:m?.titlesStr||``,children:m?.titlesStr?R(j,{id:`sr6maL`,values:{0:m.titlesStr},components:{0:R(`span`,{}),1:R(`span`,{})}}):R(`span`,{children:R(j,{id:`03Qqf9`})})}):R(n,{children:[f,e.sensitive&&e.spoilerText&&R(n,{children:[` `,R(`span`,{class:`spoiler-badge`,children:R(X,{icon:`eye-close`,size:`s`,alt:a({id:`gnKo7f`})})})]})]})})]})}function ec(){return!!document.querySelector(`.deck-backdrop, #modal-container > *`)}var tc=20,nc=1983,rc=`${nc}-01`,ic=J(()=>{try{let e=document.createElement(`input`);return e.setAttribute(`type`,`month`),e.type===`month`}catch{return!1}});function ac({columnMode:e,...r}){let{i18n:i,_:s}=l(),c=W(o),{id:d,...p}=e?{id:r.id}:k(),h=a(new URLSearchParams({replies:1})),[,g]=f(e=>e+1,0),v=y(e=>{let n=h.current;typeof e==`function`?e(n):e instanceof URLSearchParams?([...n.keys()].forEach(e=>n.delete(e)),e.forEach((e,r)=>n.set(r,e))):Object.entries(e).forEach(([e,r])=>{r?n.set(e,r):n.delete(e)}),g()},[]),[b,x]=e?[h.current,v]:ce(),S=y((n,r)=>{let i=new URLSearchParams(e?{replies:1}:void 0);r!==void 0&&i.set(n,r),x(i)},[x]),w=y((e,n)=>{let r=new URLSearchParams(b.toString());r.get(e)?r.delete(e):r.set(e,n??`1`),x(r)},[x,b]),E=b.get(`month`),D=!b.get(`replies`),A=!!b.get(`boosts`),M=b.get(`tagged`),ee=!!b.get(`media`),{masto:N,instance:P,authenticated:F}=u({instance:p?.instance}),{masto:L,instance:z}=u(),B=a(),te=[E,D,A,M,ee],[V,re]=I(),ie=a(0);_(()=>{ie.current=0},te);let ae=m(()=>ne(),[]),oe=m(()=>P===z,[P,z]),[H,U]=I(!1);_(()=>{oe&&V?.acct&&(async()=>{U(await hi(P))})()},[P,oe,V?.acct]);async function se(n){let r=/^\d{4}-[01]\d$/.test(E),i=E?.split?.(`-`)?.[0]>=nc;if(r&&i){if(!V)return{value:[],done:!0};let[e,r]=E.split(`-`),i=parseInt(r,10)-1,a=new Date(e,i,0),o=`${a.getFullYear()}-${(a.getMonth()+1).toString().padStart(2,`0`)}-${a.getDate().toString().padStart(2,`0`)}`,s=new Date(e,i+1,1),c=`${s.getFullYear()}-${(s.getMonth()+1).toString().padStart(2,`0`)}-${s.getDate().toString().padStart(2,`0`)}`,l;n?(l=tc+1,ie.current=0):(l=tc+ie.current+1,ie.current+=tc);let u=await N.v2.search.list({q:`from:${V.acct} after:${o} before:${c}`,type:`statuses`,limit:l,offset:ie.current});if(u?.statuses?.length){let e=u.statuses.slice(0,tc);return e.forEach(e=>{O(e,P)}),{value:e,done:u.statuses.length<=tc}}else return{value:[],done:!0}}let a=[];if(n&&!e){let{value:e}=await N.v1.accounts.$select(d).statuses.list({pinned:!0}).values().next();if(e?.length&&!M&&!ee){let n=e.map(e=>(O(e,P),{...e,_pinned:!0}));if(n.length>=3){let e=n.map(e=>e.id);a.push({id:e,items:n,type:`pinned`})}else a.push(...n)}}(n||!B.current)&&(B.current=N.v1.accounts.$select(d).statuses.list({limit:tc,exclude_replies:D,exclude_reblogs:A,only_media:ee||void 0,tagged:M}).values());let{value:o,done:s}=await B.current.next();if(o?.length){if(!Xe(`@mastodon/pinned-posts`)&&a.length){let e=[];e=a[0]?.type===`pinned`?a[0].id:a.filter(e=>e._pinned).map(e=>e.id),e.every(e=>o.some(n=>n.id===e))&&(a=[])}a.push(...o),o.forEach(e=>{O(e,P)})}return{value:a,done:s}}let[G,le]=I([]),ue=s({id:`_cKnpj`});if(V?.acct){let e=(/@/.test(V.acct)?``:`@`)+V.acct,n=V?.displayName?`${V.displayName} (${e})`:e;if(M&&ee)ue=s({id:`lYyloN`,values:{tagged:M,accountDisplay:n}});else if(M)ue=s({id:`8ZPzp0`,values:{tagged:M,accountDisplay:n}});else if(E){let[e,r]=E.split(`-`);ue=s({id:`Did6le`,values:{monthYear:new Date(+e,r-1,1).toLocaleString(i.locale,{month:`long`,year:`numeric`}),accountDisplay:n}})}else ue=ee?s({id:`dFu2-z`,values:{accountDisplay:n}}):n}he(ue,`/:instance?/a/:id`);let de=y(()=>cc(d,N),[d,N]);_(()=>{(async()=>{try{re(await de())}catch{}if(!ae)try{le(await N.v1.accounts.$select(d).featuredTags.list())}catch{}})()},[d,ae]);let{displayName:K,acct:fe,emojis:pe}=V||{},me=m(()=>V?.id===T(),[V?.id]),q=a(),ge=m(()=>{let r=(e?D:!D)||A||M||ee||!!E,a=c.accounts[`${d}@${P}`],l=e=>{let n=new URLSearchParams(b.toString());for(let[r,i]of Object.entries(e))i==null?n.delete(r):n.set(r,i);let r=n.toString();return r?`?${r}`:``};return R(n,{children:[e?R(Ds,{account:V,instance:P}):R(Ui,{instance:P,account:a||d,fetchAccount:de,authenticated:F,standalone:!0,showEndorsements:!0}),!ae&&R(`div`,{class:`filter-bar`,ref:q,style:{position:`relative`},children:[r?R(Z,{to:`/${P}/a/${d}`,class:`insignificant filter-clear`,title:s({id:`I9EnzM`}),onClick:n=>{e&&(n.preventDefault(),S())},children:R(X,{icon:`x`,size:`l`,alt:s({id:`I9EnzM`})})},`clear-filters`):R(X,{icon:`filter`,class:`insignificant`,size:`l`,alt:s({id:`cSev-j`})}),R(`div`,{class:`filter-bar-group`,children:[R(`label`,{children:[R(`input`,{type:`checkbox`,checked:!D,disabled:!!E,onChange:()=>{w(`replies`,`1`),Y(s(D?{id:`t9yqkt`}:{id:`BHjZV6`}))}}),R(j,{id:`N8UzTV`})]}),R(`label`,{children:[R(`input`,{type:`checkbox`,checked:!A,disabled:!!E,onChange:()=>{w(`boosts`,`0`),Y(s(A?{id:`Wk2coq`}:{id:`63FG7O`}))}}),R(j,{id:`puY2t0`})]})]}),R(Z,{to:`/${P}/a/${d}${l({media:ee?null:`1`})}`,onClick:n=>{e&&(n.preventDefault(),w(`media`,`1`)),ee||Y(s({id:`rKpfPY`}))},class:ee?`is-active`:``,children:R(j,{id:`xYilR2`})}),G.length>0&&R(`div`,{class:`filter-bar-group`,children:[...G].sort((e,n)=>e.name===M?-1:+(n.name===M)).map(n=>R(Z,{to:`/${P}/a/${d}${l({tagged:M===n.name?null:n.name})}`,onClick:r=>{if(e){r.preventDefault();let e=new URLSearchParams(b.toString());e.get(`tagged`)===n.name?e.delete(`tagged`):e.set(`tagged`,n.name),x(e)}M!==n.name&&Y(s({id:`L-HFfr`,values:{0:n.name}}))},class:M===n.name?`is-active`:``,children:R(`span`,{children:[R(`span`,{class:`more-insignificant`,children:`#`}),n.name]})},n.id))}),H&&!e&&R(n,{children:[R(`div`,{class:`filter-bar-separator`}),ic()?R(`label`,{class:`filter-field ${E?`is-active`:``}`,children:[R(X,{icon:`month`,size:`l`}),R(`input`,{type:`month`,disabled:!V?.acct,value:E||``,min:rc,max:new Date().toISOString().slice(0,7),onInput:e=>{let{value:n,validity:r}=e.currentTarget;if(!r.valid)return;x(n?{month:n}:{});let[a,o]=n.split(`-`),c=parseInt(o,10)-1;Y(s({id:`0WUFGD`,values:{0:new Date(a,c).toLocaleString(i.locale,{month:`long`,year:`numeric`})}}))}})]}):R(oc,{class:`filter-field ${E?`is-active`:``}`,disabled:!V?.acct,value:E||``,min:rc,max:new Date().toISOString().slice(0,7),onInput:e=>{let{value:n,validity:r}=e;r.valid&&x(n?{month:n}:{})}}),R(`button`,{type:`button`,class:`filter-field`,onClick:()=>{o.showSearchCommand={query:me?`from:me `:`from:${V?.acct} `}},children:R(X,{icon:`search`,size:`l`,alt:s(me?{id:`BmW9JG`}:{id:`h7t_Tx`,values:{0:V?.username}})})})]})]})]})},[d,P,F,G,de,H,...te]);_(()=>{let e=[...q.current?.querySelectorAll(`.is-active`)??[]];if(!e.length)return;let n=q.current.offsetWidth,r=Math.min(...e.map(e=>e.offsetLeft)),i=Math.max(...e.map(e=>e.offsetLeft+e.offsetWidth))-r;q.current.scrollTo({behavior:`smooth`,left:i>=n?r:r-(n-i)/2})},[G,H,...te]);let _e=m(()=>V?.url?URL.parse(V.url)?.hostname:null,[V]),ve=!!V&&P!==_e;return R(n,{children:[R(Xs,{title:`${V?.acct?`@`+V.acct:s({id:`-owNNn`})}`,titleComponent:R(`h1`,{class:`header-double-lines header-account`,children:[R(`b`,{children:R(lt,{text:K,emojis:pe,resolverURL:V?.url})}),R(`div`,{children:R(`span`,{class:`bidi-isolate`,children:[`@`,fe]})})]}),id:`account-statuses`,instance:P,emptyText:s({id:`-k97fV`}),errorText:s({id:`scd9lw`}),fetchItems:se,useItemID:!0,view:ee||ae?`media`:void 0,boostsCarousel:!me&&c.settings.boostsCarousel,timelineStart:ge,refresh:[D,A,M,ee,E+V?.acct].toString(),headerEnd:R(tt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:R(`button`,{type:`button`,class:`plain`,children:R(X,{icon:`more`,size:`l`,alt:s({id:`2FYpfJ`})})}),children:[R(Q,{disabled:!ve,onClick:()=>{(async()=>{try{let{masto:e}=u({instance:_e}),{id:n}=await e.v1.accounts.lookup({acct:V.acct});location.hash=`/${_e}/a/${n}`}catch{alert(s({id:`FgdLx0`}))}})()},children:[R(X,{icon:`transfer`}),` `,R(`small`,{class:`menu-double-lines`,children:R(j,{id:`6GZBJp`,values:{0:_e?R(n,{children:[` `,`(`,R(`b`,{children:C.toUnicode(_e)}),`)`]}):null}})})]}),!oe&&R(Q,{onClick:()=>{(async()=>{try{let{id:e}=await L.v1.accounts.lookup({acct:V.acct+`@`+P});location.hash=`/${z}/a/${e}`}catch{alert(s({id:`FgdLx0`}))}})()},children:[R(X,{icon:`transfer`}),` `,R(`small`,{class:`menu-double-lines`,children:R(j,{id:`SiegcM`,values:{currentInstance:z},components:{0:R(`b`,{})}})})]})]})},d),fe&&!me&&R(`data`,{class:`compose-data`,value:JSON.stringify({draftStatus:{status:`@${fe} `}})})]})}function oc(e){let{i18n:n}=l(),{class:r,disabled:i,value:o,min:s,max:c,onInput:u=()=>{}}=e,[d,f]=o?.split(`-`)||[],p=a(),m=a(),h=(e,n)=>{let[r,i]=s?.split(`-`)||[],[a,o]=c?.split(`-`)||[];return!(n<r||n>a||n===r&&e<i||n===a&&e>o)};return R(`div`,{class:r,children:[R(X,{icon:`month`,size:`l`}),R(`select`,{ref:p,disabled:i,value:f||``,onInput:e=>{let{value:n}=e.currentTarget,r=m.current.value;if(!h(n,r))return{value:``,validity:{valid:!1}};u({value:n?`${r}-${n}`:``,validity:{valid:!0}})},children:[R(`option`,{value:``,children:R(j,{id:`HajiZl`})}),R(`option`,{disabled:!0,children:`-----`}),Array.from({length:12},(e,r)=>R(`option`,{value:(r+1).toString().padStart(2,`0`),children:new Date(0,r).toLocaleString(n.locale,{month:`long`})},r))]}),` `,R(`input`,{ref:m,type:`number`,disabled:i,value:d||new Date().getFullYear(),min:s?.slice(0,4)||nc,max:c?.slice(0,4)||new Date().getFullYear(),onInput:e=>{let{value:n,validity:r}=e.currentTarget,i=p.current.value;if(!r.valid||!h(i,n))return{value:``,validity:{valid:!1}};u({value:n?`${n}-${i}`:``,validity:{valid:!0}})},style:{width:`4.5em`}})]})}function sc(e,n){return n.v1.accounts.$select(e).fetch()}var cc=r(sc,{expires:1800*1e3});function lc(){let{year:e}=k();he(e?`${e} #Wrapstodon`:`#Wrapstodon`,`/annual_report/:year`);let{masto:r,instance:i}=u(),[a,o]=I(null),[s,c]=I(`default`);_(()=>{e&&(async()=>{c(`loading`),o(await r.v1.annualReports.$select(e).fetch()),c(`default`)})()},[e]);let{accounts:l,annualReports:d,statuses:f}=a||{},p=d?.find(n=>n.year==e)?.data,m=new Date;return R(`div`,{id:`annual-report-page`,class:`deck-container`,tabIndex:`-1`,children:[R(`div`,{class:`report ${s===`loading`?`loading-mask`:``}`,children:[R(`h1`,{children:[e,` #Wrapstodon`]}),!!p&&R(`dl`,{children:Object.entries(p).map(([e,r])=>{let a={};return Array.isArray(r)&&r.forEach(e=>{Object.entries(e).forEach(([e,n])=>{typeof n==`number`&&(a[e]=(a[e]||0)+n)})}),R(n,{children:[R(`dt`,{children:e}),R(`dd`,{class:`report-${e}`,children:Array.isArray(r)?R(`table`,{children:[R(`thead`,{children:R(`tr`,{children:Object.entries(r[0]).map(([e,n])=>R(`th`,{class:e!==`month`&&typeof n==`number`?`number`:``,children:e}))})}),R(`tbody`,{children:r.map(n=>R(`tr`,{children:Object.entries(n).map(([n,r])=>R(`td`,{class:n!==`month`&&typeof r==`number`?`number`:``,style:{"--percentage":typeof r==`number`?`${r/a[n]*100}%`:0},children:r&&/(accountId)/i.test(n)&&/^(mostRebloggedAccounts|commonlyInteractedWithAccounts)$/i.test(e)?l?.find(e=>e.id===r)?R(qe,{account:l?.find(e=>e.id===r),showAvatar:!0}):`👻`:n===`month`?m.setMonth(r-1)&&m.toLocaleString(void 0,{month:`long`}):typeof r==`number`?r.toLocaleString():r}))}))})]}):typeof r==`object`?/^(topStatuses)$/i.test(e)?R(`dl`,{children:Object.entries(r).map(([e,r])=>R(n,{children:[R(`dt`,{children:e}),R(`dd`,{children:r&&R(Z,{to:`/${i}/s/${r}`,children:R(Mt,{status:f?.find(e=>e.id===r),size:`s`,readOnly:!0,showCommentCount:!0})})})]}))}):R(`table`,{children:R(`tbody`,{children:Object.entries(r).map(([e,n])=>R(`tr`,{children:[R(`th`,{children:e}),R(`td`,{class:typeof n==`number`?`number`:``,children:n})]}))})}):typeof r==`string`?r:JSON.stringify(r,null,2)})]})})})]}),R(`hr`,{}),R(`p`,{style:{textAlign:`center`},children:R(Z,{to:`/`,children:R(j,{id:`iWpEwy`})})})]})}var uc=20;function dc(){let{_:e}=l();he(e({id:`7Ff7ia`}),`/b`);let{masto:n,instance:r}=u(),i=a();async function o(e){return(e||!i.current)&&(i.current=n.v1.bookmarks.list({limit:uc}).values()),await i.current.next()}return R(Xs,{title:e({id:`7Ff7ia`}),id:`bookmarks`,emptyText:e({id:`8k2w6G`}),errorText:e({id:`UoL-FC`}),instance:r,fetchItems:o})}var fc=``+new URL(`catch-up-O5q5C75Z.png`,import.meta.url).href,pc=`home`,mc=`catchup`,hc=[{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,beyond:!0}],gc={original:{id:`HxF6Fk`},replies:{id:`N8UzTV`},quotes:{id:`eWLklq`},boosts:{id:`puY2t0`},followedTags:{id:`lCLRBe`},groups:{id:`zhrjek`},filtered:{id:`03Qqf9`}},_c=[`createdAt`,`repliesCount`,`favouritesCount`,`reblogsCount`,`density`],vc=[null,`account`],yc=J(e=>new Intl.DateTimeFormat(e||void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`numeric`}));function bc(e){return e?.id||e?.quotedStatus?.id}function xc(){let{i18n:r,_:i,_:s}=l(),d=yc(r.locale);he(`Catch-up`,`/catchup`);let{masto:p,instance:h}=u(),[g,v]=ce(),b=g.get(`id`),[x,S]=I(`start`),[C,w]=I(!1),E=m(()=>T(),[]),D=e=>e===E,O=Xe(`@pixelfed/home-include-reblogs`);async function k({maxCreatedAt:e}){let n=[],r=p.v1.timelines.home.list({limit:40}),i=r.values();mainloop:for(;;)try{O&&r.params&&(typeof r.params==`string`?r.params+=`&include_reblogs=true`:r.params.include_reblogs=!0);let{value:a}=await i.next();if(a?.length){await Ps(a,h);let r=!1;for(let i=0;i<a.length;i++){let s=a[i],c=Date.parse(s.createdAt);if(!e||c>=e){let e=!D(s.reblog?.account?.id||s.account.id)&&pt(s.reblog?.filtered||s.filtered,pc);if(e?.action===`hide`)continue;s._filtered=e;let i=Ae(s.id,h);s._followedTags=o.statusFollowedTags[i]?[...o.statusFollowedTags[i]]:[],n.push(s),r=!0}if(!r)break mainloop}}else break mainloop;await new Promise(e=>setTimeout(e,1e3))}catch{break mainloop}return n.forEach(e=>{if(e?.inReplyToId){let r=n.find(n=>n.id===e.inReplyToId);r&&!r.inReplyToId&&(r._thread=!0)}}),n}let[A,M]=I([]),N=a(),P=a(),L=m(()=>e(),[]),z=y(async({duration:e}={})=>{let n=Date.now(),r=e?n-e:null;S(`loading`);let i=await k({maxCreatedAt:r}),a=`${L}-${ft()}`;try{await Wt.catchup.set(a,{id:a,posts:i,count:i.length,startAt:r,endAt:n}),v({id:a})}catch{}},[]);_(()=>{b?(async()=>{let e=await Wt.catchup.get(b);e&&(e.posts.sort((e,n)=>e.createdAt>n.createdAt?1:-1),M(e.posts),S(`results`))})():x===`results`&&(M([]),S(`start`))},[b]);let[B,te]=f(e=>e+1,0),[V,ne]=I(null),[re,ie]=I([]);_(()=>{let e=new Set(re.map(e=>e.id));for(let n=sessionStorage.length-1;n>=0;n--){let r=sessionStorage.key(n);if(r?.startsWith(`${mc}-`)){let n=r.replace(`${mc}-`,``);e.has(n)||F.session.del(r)}}},[re]),_(()=>{(async()=>{try{let n=await Wt.catchup.keys();if(n.length){let r=e(),i=n.filter(e=>e.startsWith(`${r}-`));if(i.length){let e=await Wt.catchup.getMany(i);e.sort((e,n)=>n.endAt-e.endAt);let n=e.slice(0,3),r=e.slice(3);ie(n.map(e=>{let{id:n,count:r,startAt:i,endAt:a}=e;return{id:n,count:r,startAt:i,endAt:a}})),ne(n[0].endAt),e=null,n=null,queueMicrotask(()=>{r.length&&Wt.catchup.delMany(r.map(e=>e.id)).then(()=>{r=null}).catch(e=>{})});return}}}catch{}ie([])})()},[B]),_(()=>{x===`start`&&te()},[x===`start`]);let[ae,oe]=m(()=>{let e=0,n=0,r=0,i=0,a=0,o=0,s=0,c={};for(let l of A){l._filtered&&l._filtered?.action!==`blur`?(e++,l.__FILTER=`filtered`):l.group?(n++,l.__FILTER=`groups`):l.reblog?(r++,l.__FILTER=`boosts`):Yt()&&bc(l.quote)?(i++,l.__FILTER=`quotes`):l._followedTags?.length?(o++,l.__FILTER=`followedTags`):l.inReplyToId&&l.inReplyToAccountId!==l.account?.id?(a++,l.__FILTER=`replies`):(s++,l.__FILTER=`original`);let u=l.reblog||l;if(l.__FILTER!==`filtered`&&u.card?.url&&u.card?.image&&u.card?.type===`link`){let{card:e,favouritesCount:n,reblogsCount:r}=u,{url:i}=e;if(i=i.replace(/\/$/,``),!c[i])c[i]={postID:u.id,card:e,shared:1,sharers:[l.account],likes:n,boosts:r};else{if(c[i].sharers.find(e=>e.id===l.account.id))continue;c[i].shared++,c[i].sharers.push(l.account),c[i].postID!==u.id&&(c[i].likes+=n,c[i].boosts+=r)}}}let l=[];for(let e in c)l.push({url:e,...c[e]});if(l.sort((e,n)=>e.shared>n.shared?-1:e.shared<n.shared?1:e.boosts>n.boosts?-1:e.boosts<n.boosts?1:e.likes>n.likes?-1:e.likes<n.likes?1:e.quotes>n.quotes?-1:+(e.quotes<n.quotes)),l.length>10)linksLoop:for(let e=10;e<l.length;e++){let{shared:n}=l[e];if(n<=1){l=l.slice(0,e);break linksLoop}}return[{filtered:e,groups:n,boosts:r,quotes:i,replies:a,followedTags:o,original:s},l]},[A]),[H,se]=I(`all`),[W,G]=I(null),[le,ue]=I(1),[de,K]=I(`createdAt`),[fe,pe]=I(`asc`),[me,q]=I(null);_(()=>{if(!b)return;let e=F.session.getJSON(`${mc}-${b}`);e&&(e.selectedFilterCategory!==void 0&&se(e.selectedFilterCategory),e.selectedAuthor!==void 0&&G(e.selectedAuthor),e.sortBy!==void 0&&K(e.sortBy),e.sortOrder!==void 0&&pe(e.sortOrder),e.groupBy!==void 0&&q(e.groupBy),e.showTopLinks!==void 0&&w(e.showTopLinks))},[b]),_(()=>{if(!b||x!==`results`)return;let e={selectedFilterCategory:H,selectedAuthor:W,sortBy:de,sortOrder:fe,groupBy:me,showTopLinks:C};F.session.setJSON(`${mc}-${b}`,e)},[b,x,H,W,de,fe,me,C]);let[ge,_e,ve]=m(()=>{let e={},n=new Map,r=A.filter(r=>{let i=H===`all`||r.__FILTER===H;return i&&(e[r.account.id]=r.account,n.set(r.account.id,(n.get(r.account.id)||0)+1)),i}),i={};return r.forEach(e=>{e.reblog&&(i[e.reblog.id]?(i[e.reblog.id].__BOOSTERS?i[e.reblog.id].__BOOSTERS.add(e.account):i[e.reblog.id].__BOOSTERS=new Set([e.account]),e.__HIDDEN=!0):i[e.reblog.id]=e)}),W&&n.has(W)&&(r=r.filter(e=>e.account.id===W||[...e.__BOOSTERS||[]].find(e=>e.id===W))),[r,e,Object.fromEntries(n)]},[H,W,A]),ye=m(()=>{let e={};return ge.forEach(n=>{e[n.id]=n}),e},[ge]),be=m(()=>Object.keys(ve).sort((e,n)=>ve[n]-ve[e]),[ve]),xe=m(()=>{let e={};return be.forEach((n,r)=>{e[n]=r}),ge.filter(e=>!e.__HIDDEN).sort((n,r)=>{if(me===`account`){let i=n.account.id,a=r.account.id,o=e[i]-e[a];if(o!==0)return o}if(de!==`createdAt`&&(n=n.reblog||n,r=r.reblog||r,de!==`density`&&n[de]===r[de]))return n.createdAt>r.createdAt?1:-1;if(de===`density`){let e=Ec(n),i=Ec(r);return fe===`asc`?e>i?1:-1:i>e?1:-1}return fe===`asc`?n[de]>r[de]?1:-1:r[de]>n[de]?1:-1})},[ge,de,fe,me,be]),Se=a(null),Ce=a(null),we=a(!1);_(()=>{A.length>100||we.current||Ce.current&&(ir(Ce.current,{duration:200}),we.current=!0)},[A,Ce]);let Te=A.length>160?`3d`:`2d`,Ee=m(()=>Te===`2d`?A.map(e=>{let n=ye[e.id];return R(`span`,{class:`post-dot ${n?`post-dot-highlight`:``}`},e.id)}):null,[ye]),De=m(()=>Te!==`3d`||!A?.length?null:Ac(A,`createdAt`,320).map((e,n)=>R(`div`,{class:`posts-bin`,children:e.map(e=>{let n=ye[e.id];return R(`span`,{class:`post-dot ${n?`post-dot-highlight`:``}`},e.id)})},n)),[ye]),Oe=a(null);ee(()=>{if(!b||x!==`results`||!Oe.current||!xe.length)return;let e=F.session.getJSON(`${mc}-${b}`);if(e?.scrollTop!==void 0&&e.scrollTop>0){let n=setTimeout(()=>{Oe.current&&Oe.current.scrollTo({top:e.scrollTop,behavior:`instant`})},100);return()=>clearTimeout(n)}},[b,x,xe.length]),_(()=>{if(!b||x!==`results`||!Oe.current)return;let e=()=>{if(!Oe.current)return;let e=F.session.getJSON(`${mc}-${b}`)||{};e.scrollTop=Oe.current.scrollTop,F.session.setJSON(`${mc}-${b}`,e)},n=Oe.current;return n.addEventListener(`scroll`,e,{passive:!0}),()=>{n.removeEventListener(`scroll`,e)}},[b,x]);let J=m(()=>V?(Date.now()-V)/1e3/60/60:null,[V,le]);_(()=>{if(x!==`results`)return;W&&_e[W]&&_e[W].username;let e=Y({duration:5e3,text:s({id:`XKZRZ_`,values:{selectedFilterCategory:H,sortBy:de,sortOrder:fe,groupBy:me}})});return()=>{e?.hideToast?.()}},[x,H,W,de,fe,me,_e]),_(()=>{if(W&&_e[W]){let e=Ce.current.querySelector(`[data-author="${W}"]`),n=Ce.current?.getBoundingClientRect(),r=e?.getBoundingClientRect();r.left<n.left||r.right>n.right?e.scrollIntoView({block:`nearest`,inline:`center`,behavior:`smooth`}):r.top<0&&e.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})}},[W,_e]);let[ke,je]=I(!1),Me=`.catchup-list > li > a`,Ne=$e(`j`,()=>{let e=document.activeElement.closest(Me),n=e?.getBoundingClientRect(),r=Array.from(Oe.current.querySelectorAll(Me));if(e&&n.top<Oe.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView({block:`center`,inline:`center`,behavior:`instant`}))}else{let e=r.find(e=>e.getBoundingClientRect().top>=0);e&&(e.focus(),e.scrollIntoView({block:`nearest`,inline:`center`,behavior:`instant`}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),Pe=$e(`k`,()=>{let e=document.activeElement.closest(Me),n=e?.getBoundingClientRect(),r=Array.from(Oe.current.querySelectorAll(Me));if(e&&n.top<Oe.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView({block:`center`,inline:`center`,behavior:`instant`}))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView({block:`nearest`,inline:`center`,behavior:`instant`}))}},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),Fe=$e(`h, l`,(e,n)=>{let r=n.keys[0];if(W){let e=be.indexOf(W);r===`h`?e>0&&e<be.length&&(G(be[e-1]),Oe.current?.focus()):r===`l`&&e<be.length-1&&e>=0&&(G(be[e+1]),Oe.current?.focus())}else r===`l`&&(G(be[0]),Oe.current?.focus())},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||![`h`,`l`].includes(e.key.toLowerCase()),enableOnFormTags:[`input`]}),Ie=$e(`esc`,()=>{G(null),Oe.current?.focus()},{preventDefault:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey,enableOnFormTags:[`input`],useKey:!0}),Le=$e(`.`,()=>{Oe.current?.scrollTo({top:0,behavior:`smooth`})},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>e.key===`.`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey,enableOnFormTags:[`input`]}),Re=y(e=>{let n=document.activeElement,r=n?.tagName===`INPUT`&&n.type===`radio`;if((e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`ArrowLeft`||e.key===`ArrowRight`)&&r){n.blur();return}},[]);return R(`div`,{ref:e=>{Oe.current=e,Ne.current=e,Pe.current=e,Fe.current=e,Ie.current=e,Le.current=e},id:`catchup-page`,class:`deck-container`,tabIndex:`-1`,children:[R(`div`,{class:`timeline-deck deck wide`,children:[R(`header`,{class:`${x===`loading`?`loading`:``}`,onClick:e=>{e.target.closest(`a, button`)||Oe.current?.scrollTo({top:0,behavior:`smooth`})},children:R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),x===`results`&&R(Z,{to:`/catchup`,class:`button plain`,children:R(X,{icon:`history2`,size:`l`,alt:s({id:`xrl8fj`})})}),x===`start`&&R(Z,{to:`/`,class:`button plain`,children:R(X,{icon:`home`,size:`l`,alt:s({id:`i0qMbr`})})})]}),R(`h1`,{children:x!==`start`&&R(j,{id:`wyL_3_`,components:{0:R(`sup`,{})}})}),R(`div`,{class:`header-side`,children:x!==`start`&&x!==`loading`&&R(`button`,{type:`button`,class:`plain`,onClick:()=>{je(!0)},children:R(j,{id:`c3XJ18`})})})]})}),R(`main`,{onKeyDown:Re,children:[x===`start`&&R(`div`,{class:`catchup-start`,children:[R(`h1`,{children:R(j,{id:`wyL_3_`,components:{0:R(`sup`,{})}})}),R(`details`,{children:[R(`summary`,{children:R(j,{id:`CxKPv6`})}),R(`p`,{children:R(j,{id:`YMU1CK`})}),R(`img`,{src:``+new URL(`catch-up-O5q5C75Z.png`,import.meta.url).href,width:`1200`,height:`900`,alt:s({id:`CeInO2`})}),R(`p`,{children:R(`button`,{type:`button`,onClick:e=>{e.target.closest(`details`).open=!1},children:R(j,{id:`2jI8hh`})})})]}),R(`p`,{children:R(j,{id:`1RfGk7`})}),R(`p`,{children:R(`b`,{children:R(j,{id:`OOEonE`})})}),R(`div`,{class:`catchup-form`,children:[R(`input`,{ref:N,type:`range`,value:le,min:hc[0].value,max:hc[hc.length-1].value,step:`1`,list:`catchup-ranges`,onChange:e=>ue(+e.target.value)}),` `,R(`span`,{style:{width:`8em`},children:[i(hc[le-1].label),R(`br`,{}),R(`small`,{class:`insignificant`,children:le==hc[hc.length-1].value?s({id:`NMNiaO`}):xt(new Date(Date.now()-le*60*60*1e3))})]}),R(`datalist`,{id:`catchup-ranges`,children:hc.map(({label:e,value:n})=>R(`option`,{value:n,label:i(e)}))}),` `,R(`button`,{type:`button`,onClick:()=>{let e;le<hc.find(e=>e.beyond).value?e=le*60*60*1e3:P.current?.checked&&(e=Date.now()-V),z({duration:e})},children:R(j,{id:`R0yu2l`})})]}),J&&le>J?R(`p`,{class:`catchup-info`,children:[R(X,{icon:`info`}),` `,R(j,{id:`AGyV7s`})]}):le===hc[hc.length-1].value&&V?R(`p`,{class:`catchup-info`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,switch:!0,checked:!0,ref:P}),` `,R(j,{id:`dDJEHI`,values:{0:d.format(new Date(V))}})]})}):null,R(`p`,{class:`insignificant`,children:R(`small`,{children:R(j,{id:`1atgyZ`})})}),!!re?.length&&R(`div`,{class:`catchup-prev`,children:[R(`p`,{children:R(j,{id:`Yfb9A8`})}),R(`ul`,{children:re.map(e=>R(`li`,{children:[R(Z,{to:`/catchup?id=${e.id}`,children:[R(X,{icon:`history2`}),` `,R(`span`,{children:e.startAt?d.formatRange(new Date(e.startAt),new Date(e.endAt)):`… ${d.format(new Date(e.endAt))}`})]}),` `,R(`span`,{children:[R(`small`,{class:`ib insignificant`,children:R(j,{id:`S6XZwv`,values:{0:e.count}})}),` `,R(`button`,{type:`button`,class:`light danger small`,onClick:async()=>{if(confirm(s({id:`D9CmP2`}))){let n=Y(s({id:`xJUo4P`,values:{0:e.id}}));await Wt.catchup.del(e.id),n?.hideToast?.(),Y(s({id:`1dyGG_`,values:{0:e.id}})),te()}},children:R(X,{icon:`x`,alt:s({id:`t_YqKh`})})})]})]},e.id))}),re.length>=3&&R(`p`,{children:R(`small`,{children:R(j,{id:`sXmrl4`})})})]})]}),x===`loading`&&R(`div`,{class:`ui-state catchup-start`,children:[R(U,{abrupt:!0}),R(`p`,{class:`insignificant`,children:R(j,{id:`rbUTzD`})}),R(`p`,{class:`insignificant`,children:R(j,{id:`q9urQO`})})]}),x===`results`&&R(n,{children:[R(`div`,{class:`catchup-header`,children:[A.length>0&&R(`p`,{children:R(`b`,{class:`ib`,children:d.formatRange(new Date(A[0].createdAt),new Date(A[A.length-1].createdAt))})}),R(`aside`,{children:[R(`button`,{hidden:H===`all`&&!W&&de===`createdAt`&&fe===`asc`,type:`button`,class:`plain4 small`,onClick:()=>{se(`all`),G(null),K(`createdAt`),q(null),pe(`asc`)},children:R(j,{id:`I9EnzM`})}),oe?.length>0&&R(`button`,{type:`button`,class:`plain small`,onClick:()=>w(!C),children:[R(j,{id:`EIZREX`}),` `,R(X,{icon:`chevron-down`,style:{transform:C?`rotate(180deg)`:`rotate(0deg)`}})]})]})]}),R(`div`,{class:`shazam-container no-animation`,hidden:!C,children:R(`div`,{class:`shazam-container-inner`,children:R(`div`,{class:`catchup-top-links links-bar`,children:oe.map(e=>{let{card:r,shared:i,sharers:a,likes:o,boosts:s}=e,{blurhash:l,title:u,description:d,url:f,image:p,imageDescription:m,language:h,width:g,height:_,publishedAt:v}=r,y=c(f),b;if(l){let e=ya(gt(l));b=ha([.6,e[1],e[2]])}return R(`a`,{href:f,target:`_blank`,rel:`noopener`,class:`link-block`,style:b?{"--accent-color":`rgb(${b.join(`,`)})`,"--accent-alpha-color":`rgba(${b.join(`,`)}, 0.4)`}:{},children:R(`article`,{children:[R(`figure`,{children:R(`img`,{src:p,alt:m,width:g,height:_,loading:`lazy`})}),R(`div`,{class:`article-body`,children:[R(`header`,{children:[R(`div`,{class:`article-meta`,children:[R(`span`,{class:`domain`,children:y}),` `,!!v&&R(n,{children:`· `}),!!v&&R(n,{children:R(Ct,{datetime:v,format:`micro`})})]}),!!u&&R(`h1`,{class:`title`,lang:h,dir:`auto`,title:u,children:u})]}),!!d&&R(`p`,{class:`description`,lang:h,dir:`auto`,title:d,children:d}),R(`hr`,{}),R(`p`,{style:{whiteSpace:`nowrap`},children:R(j,{id:`bfSr6z`,values:{0:a.map(e=>{let{avatarStatic:n,displayName:r}=e;return R(`button`,{type:`button`,class:`plain`,style:{padding:0},onClick:n=>{n.preventDefault(),n.stopPropagation();let{id:r}=e;G(r),se(`all`)},children:R(vt,{url:n,size:`s`,alt:r})})})}})})]})]})},f)})})})}),A.length>=5&&(Te===`3d`?R(`div`,{class:`catchup-posts-viz-time-bar`,children:De}):R(`div`,{class:`catchup-posts-viz-bar`,children:Ee})),A.length>=2&&R(`div`,{class:`catchup-filters`,children:[R(`label`,{class:`filter-cat`,children:[R(`input`,{type:`radio`,name:`filter-cat`,checked:H.toLowerCase()===`all`,onChange:()=>{se(`all`)}}),R(j,{id:`N40H-G`}),` `,R(`span`,{class:`count`,children:A.length})]}),Object.entries(gc).map(([e,n])=>!!ae[e]&&R(`label`,{class:`filter-cat`,title:(ae[e]/A.length*100).toFixed(2)+`%`,children:[R(`input`,{type:`radio`,name:`filter-cat`,checked:H.toLowerCase()===e.toLowerCase(),onChange:()=>{se(e),e===`boosts`&&(K(`reblogsCount`),pe(`desc`),q(null))}}),i(n),` `,R(`span`,{class:`count`,children:ae[e]})]},i(n)))]}),A.length>=2&&!!ve&&R(`div`,{class:`catchup-filters authors-filters`,ref:Ce,children:[be.map(e=>R(`label`,{class:`filter-author`,"data-author":e,children:[R(`input`,{type:`radio`,name:`filter-author`,checked:W===e,onChange:()=>{G(e)},onClick:()=>{W===e&&G(null)}}),R(vt,{url:_e[e].avatarStatic||_e[e].avatar,size:`xxl`,alt:`${_e[e].displayName} (@${_e[e].acct})`}),` `,R(`span`,{class:`count`,children:ve[e]}),R(`span`,{class:`username`,children:_e[e].username})]},`${e}-${ve[e]}`)),be.length>5&&R(`small`,{style:{whiteSpace:`nowrap`,paddingInline:`1em`,opacity:.33},children:R(j,{id:`HHtYi7`,values:{0:be.length}})},`authors-count`)]}),A.length>=2&&R(`div`,{class:`catchup-filters`,children:[R(`span`,{class:`filter-label`,children:R(j,{id:`f6Hub0`})}),` `,R(`fieldset`,{class:`radio-field-group`,children:_c.map(e=>R(`label`,{class:`filter-sort`,onClick:n=>{de===e&&(n.preventDefault(),n.stopPropagation(),pe(fe===`asc`?`desc`:`asc`))},children:[R(`input`,{type:`radio`,name:`filter-sort-cat`,checked:de===e,onChange:()=>{K(e),pe(/(replies|favourites|reblogs|quotes)/.test(e)?`desc`:`asc`)}}),{createdAt:s({id:`mYGY3B`}),repliesCount:s({id:`N8UzTV`}),favouritesCount:s({id:`zZOZj7`}),reblogsCount:s({id:`puY2t0`}),quotesCount:s({id:`eWLklq`}),density:s({id:`0tQ7AD`})}[e],de===e&&(fe===`asc`?``:``)]},e))}),R(`span`,{class:`filter-label`,children:R(j,{id:`group.filter`})}),` `,R(`fieldset`,{class:`radio-field-group`,children:vc.map(e=>R(`label`,{class:`filter-group`,children:[R(`input`,{type:`radio`,name:`filter-group`,checked:me===e,onChange:()=>{q(e)},disabled:e===`account`&&W}),{account:s({id:`dpqPBg`})}[e]||s({id:`EdQY6l`})]},e||`none`))}),W&&be.length>1?R(`button`,{type:`button`,class:`plain6 small`,onClick:()=>{G(null)},style:{whiteSpace:`nowrap`},children:R(j,{id:`_dlmrZ`})}):null]}),R(`ul`,{class:`catchup-list catchup-filter-${H||``} ${de?`catchup-sort-${de}`:``} ${W&&_e[W]?`catchup-selected-author`:``} ${me?`catchup-group-${me}`:``}`,children:xe.map((e,r)=>{let i=e.reblog?.id||e.id,a=!1;return me===`account`&&(Se.current&&e.account.id!==Se.current&&r>0&&(a=!0),Se.current=e.account.id),R(n,{children:[a&&R(`li`,{class:`separator`}),R(Cc,{to:`/${h}/s/${i}`,post:e,root:Oe.current})]},`${e.id}-${a}`)})}),R(`footer`,{children:ge.length>5&&R(`p`,{children:[s(H===`boosts`?{id:`eVosYr`}:{id:`rhmyFK`}),` `,R(`button`,{type:`button`,class:`textual`,onClick:()=>{Oe.current.scrollTop=0},children:R(j,{id:`0MgdN-`})}),`.`]})})]})]})]}),ke&&R(zt,{onClose:()=>je(!1),children:R(`div`,{class:`sheet`,id:`catchup-help-sheet`,children:[R(`button`,{type:`button`,class:`sheet-close`,onClick:()=>je(!1),children:R(X,{icon:`x`,alt:s({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`c3XJ18`})})}),R(`main`,{children:R(`dl`,{children:[R(`dt`,{children:R(j,{id:`EIZREX`})}),R(`dd`,{children:R(j,{id:`YmGrIy`})}),R(`dt`,{children:R(j,{id:`coaNtr`})}),R(`dd`,{children:R(j,{id:`UUrqX1`})}),R(`dt`,{children:R(j,{id:`ScQBC_`})}),R(`dd`,{children:R(j,{id:`srocAr`})}),R(`dt`,{children:R(j,{id:`77Emn0`})}),R(`dd`,{children:R(`table`,{children:R(`tbody`,{children:[R(`tr`,{children:[R(`td`,{children:R(j,{id:`Gy9P9T`})}),R(`td`,{children:R(`kbd`,{children:`j`})})]}),R(`tr`,{children:[R(`td`,{children:R(j,{id:`6XYpYY`})}),R(`td`,{children:R(`kbd`,{children:`k`})})]}),R(`tr`,{children:[R(`td`,{children:R(j,{id:`f5dduh`})}),R(`td`,{children:R(`kbd`,{children:`l`})})]}),R(`tr`,{children:[R(`td`,{children:R(j,{id:`rj0vxZ`})}),R(`td`,{children:R(`kbd`,{children:`h`})})]}),R(`tr`,{children:[R(`td`,{children:R(j,{id:`jsFF8C`})}),R(`td`,{children:R(`kbd`,{children:`Enter`})})]}),R(`tr`,{children:[R(`td`,{children:R(j,{id:`bUUv3P`})}),R(`td`,{children:R(`kbd`,{children:`.`})})]})]})})})]})})]})})]})}var Sc=pe(function({post:e}){let{id:n,account:r,group:i,reblog:a,quote:o,inReplyToId:s,inReplyToAccountId:c,_followedTags:l,_filtered:u,visibility:d,__BOOSTERS:f}=e,p=s&&c!==r.id,m=!!u&&u?.action!==`blur`;return R(`article`,{class:`post-line ${i?`group`:a?`reblog`:Yt()&&bc(o)?`quote`:l?.length?`followed-tags`:``} ${p?`reply-to`:``} ${m?`filtered`:``} visibility-${d}`,onMouseEnter:e=>{e.shiftKey},children:[R(`span`,{class:`post-author`,children:a?R(`span`,{class:`post-reblog-avatar`,children:[R(vt,{url:r.avatarStatic||r.avatar,squircle:r.bot}),f?.size>0?[...f].map(e=>R(vt,{url:e.avatarStatic||e.avatar,squircle:e.bot})):``,` `,R(X,{icon:`rocket`}),` `,R(qe,{account:a.account,showAvatar:!0})]}):bc(o)?R(`span`,{class:`post-quote-avatar`,children:[R(vt,{url:r.avatarStatic||r.avatar,squircle:r.bot}),` `,R(X,{icon:`quote`}),` `,R(qe,{account:o.quotedStatus?.account||o.account,showAvatar:!0})]}):R(qe,{account:r,showAvatar:!0})}),R(Oc,{post:a||e,filterInfo:u}),R(`span`,{class:`post-meta`,children:[R(kc,{post:a||e}),` `,R(Ct,{datetime:new Date(a?.createdAt||e.createdAt),format:`micro`})]})]})},(e,n)=>e?.post?.id===n?.post?.id),Cc=({root:e,to:n,...r})=>{let i=a(),[o,s]=I(!1);return _(()=>{let n=new IntersectionObserver(e=>{e[0].isIntersecting&&(queueMicrotask(()=>s(!0)),n.unobserve(i.current))},{root:e,rootMargin:`${Math.max(320,screen.height*.75)}px`});return i.current&&n.observe(i.current),()=>{i.current&&n.unobserve(i.current)}},[]),o?R(`li`,{children:R(Z,{to:n,children:R(Sc,{...r})})}):R(`li`,{ref:i,style:{height:`4em`}})},wc=8,Tc=8;function Ec(e){let{spoilerText:n,content:r,poll:i,mediaAttachments:a,card:o}=e,s=i?.options?.length?i.options.reduce((e,n)=>e+n.title,``):``;return(n.length+Ht(r)+s.length)/140+(a?.length?wc*a.length:o?.image?Tc:0)}var Dc=48;function Oc({post:e,filterInfo:r}){let{_:i}=l(),{spoilerText:a,sensitive:o,content:s,emojis:c,poll:u,mediaAttachments:d,card:f,inReplyToId:p,inReplyToAccountId:m,account:g,_thread:_,quote:v}=e,y=p&&m===g.id||!!_,b=Yt()&&bc(v)?v.quotedStatus||v:null;(b?.spoilerText||b?.sensitive)&&(b=null),b?.emojis&&c.push(...b.emojis),!d?.length&&b?.mediaAttachments?.length&&(d=b.mediaAttachments);let x=!!h()[`reading:expand:spoilers`],S=x||!a&&!o&&r?.action!==`blur`,C=s?Ot(e):``,w=!a||x;return R(`div`,{class:`post-peek`,title:a?``:C,children:[R(`span`,{class:`post-peek-content`,children:[y&&!w&&R(n,{children:[R(`span`,{class:`post-peek-tag post-peek-thread`,children:`Thread`}),` `]}),r&&r?.action!==`blur`?R(`span`,{class:`post-peek-filtered`,children:r?.titlesStr?i({id:`suKjh3`,values:{0:r.titlesStr}}):i({id:`03Qqf9`})}):R(n,{children:[!!a&&R(`span`,{class:`post-peek-spoiler`,children:[R(X,{icon:`${x?`eye-open`:`eye-close`}`}),` `,a]}),w&&R(`div`,{class:`post-peek-html`,children:[y&&R(n,{children:[R(`span`,{class:`post-peek-tag post-peek-thread`,children:R(j,{id:`e66y2Z`})}),` `]}),!!s&&R(`div`,{dangerouslySetInnerHTML:{__html:Ye(s,c)+(b?.content?`<blockquote class="post-peek-quote">${b.content}</blockquote>`:``)}}),!!u?.options?.length&&u.options.map(e=>R(`div`,{children:[u.multiple?`▪️`:``,` `,e.title]})),!s&&d?.length===1&&d[0].description&&R(n,{children:[R(`span`,{class:`post-peek-tag post-peek-alt`,children:`ALT`}),` `,R(`div`,{children:d[0].description})]})]})]})]}),(!r||r?.action===`blur`)&&R(`span`,{class:`post-peek-post-content`,children:[!!u&&R(`span`,{class:`post-peek-tag post-peek-poll`,children:[R(X,{icon:`poll`,size:`s`}),R(j,{id:`4WUbF1`})]}),d?.length?d.map(e=>{let n=e.previewUrl||e.url,r=e.previewRemoteUrl||e.remoteUrl,i=e.meta?.original?e.meta.original.width:e.meta?.small?.width||e.meta?.original?.width,a=e.meta?.original?e.meta.original.height:e.meta?.small?.height||e.meta?.original?.height;return R(`span`,{class:`post-peek-media`,children:{image:(n||r)&&S?R(`img`,{src:n,width:Dc,height:Dc,alt:e.description,loading:`lazy`,onError:e=>{let{src:i}=e.target;i===n&&r&&n!==r&&(e.target.src=r)},style:{"--anim-duration":`${Math.min(Math.max(Math.max(i,a)/100,5),120)}s`}}):R(`span`,{class:`post-peek-faux-media`,children:`🖼`}),gifv:(n||r)&&S?R(`img`,{src:n,width:Dc,height:Dc,alt:e.description,loading:`lazy`,onError:e=>{let{src:i}=e.target;i===n&&r&&n!==r&&(e.target.src=r)}}):R(`span`,{class:`post-peek-faux-media`,children:`🎞️`}),video:(n||r)&&S?R(`img`,{src:n,width:Dc,height:Dc,alt:e.description,loading:`lazy`,onError:e=>{let{src:i}=e.target;i===n&&r&&n!==r&&(e.target.src=r)}}):R(`span`,{class:`post-peek-faux-media`,children:`📹`}),audio:R(`span`,{class:`post-peek-faux-media`,children:`🎵`})}[e.type]||null},e.id)}):!!f&&f.image&&S&&R(`span`,{class:`post-peek-media post-peek-card card-${f.type||``}`,children:f.image?R(`img`,{src:f.image,width:Dc,height:Dc,alt:f.title||f.description||f.imageDescription,loading:`lazy`,style:{"--anim-duration":f.width&&f.height&&`${Math.min(Math.max(Math.max(f.width,f.height)/100,5),120)}s`}}):R(`span`,{class:`post-peek-faux-media`,children:`🔗`})})]})]})}function kc({post:e}){let{_:n}=l(),{reblogsCount:r,repliesCount:i,favouritesCount:a,quotesCount:o}=e;return R(`span`,{class:`post-stats`,children:[i>0&&R(`span`,{class:`post-stat-replies`,children:[R(X,{icon:`comment2`,size:`s`,alt:n({id:`N8UzTV`})}),` `,Ze(i)]}),a>0&&R(`span`,{class:`post-stat-likes`,children:[R(X,{icon:`heart`,size:`s`,alt:n({id:`zZOZj7`})}),` `,Ze(a)]}),r>0||o>0?R(`span`,{class:`post-stat-boosts`,children:[R(X,{icon:`rocket`,size:`s`,alt:n({id:`puY2t0`})}),` `,r>0||o>0?`${r>0?Ze(r):``}${r>0&&o>0?`+`:``}${o>0?Ze(o):``}`:Ze(r)]}):null]})}function Ac(e,n,r){let i=e.map(e=>new Date(e[n])),a=i.reduce((e,n)=>n<e?n:e,i[0]),o=i.reduce((e,n)=>n>e?n:e,i[0]),s=Math.min(o.getTime(),Date.now())-a.getTime(),c=Array.from({length:r},()=>[]);return e.forEach(e=>{let i=Date.parse(e[n]);if(i>Date.now())c[c.length-1].push(e);else{let n=(i-a.getTime())/s;c[Math.floor(n*(r-1))].push(e)}}),c}var jc=20;function Mc(){let{_:e}=l();he(e({id:`zZOZj7`}),`/favourites`);let{masto:n,instance:r}=u(),i=a();async function o(e){return(e||!i.current)&&(i.current=n.v1.favourites.list({limit:jc}).values()),await i.current.next()}return R(Xs,{title:e({id:`zZOZj7`}),id:`favourites`,emptyText:e({id:`PHIrMr`}),errorText:e({id:`khVljG`}),instance:r,fetchItems:o})}var Nc=[`home`,`public`,`notifications`,`thread`,`account`],Pc=[`thread`,`account`],Fc={home:{id:`Buy2bt`},notifications:{id:`iDNBZe`},public:{id:`RO10dm`},thread:{id:`EnJuK0`},account:{id:`vrQQgz`}},Ic=[0,1800,3600,360*60,720*60,3600*24,3600*24*7,3600*24*30],Lc={0:{id:`qqeAJM`},1800:Tt(30,`minute`),3600:Tt(1,`hour`),21600:Tt(6,`hour`),43200:Tt(12,`hour`),86400:Tt(24,`hour`),604800:Tt(7,`day`),2592e3:Tt(30,`day`)};function Rc(){let{_:e}=l(),{masto:r}=u();he(e({id:`cSev-j`}),`/ft`);let[i,a]=I(`default`),[o,s]=I(!1),[c,d]=f(e=>e+1,0),[p,m]=I([]);return _(()=>{a(`loading`),(async()=>{try{let e=await r.v2.filters.list();e.sort((e,n)=>e.title.localeCompare(n.title)),e.forEach(e=>{e.keywords?.length&&e.keywords.sort((e,n)=>e.id-n.id)}),m(e),a(`default`)}catch{a(`error`)}})()},[c]),R(`div`,{id:`filters-page`,class:`deck-container`,tabIndex:`-1`,children:[R(`div`,{class:`timeline-deck deck`,children:[R(`header`,{children:R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),R(Z,{to:`/`,class:`button plain`,children:R(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),R(`h1`,{children:R(j,{id:`cSev-j`})}),R(`div`,{class:`header-side`,children:R(`button`,{type:`button`,class:`plain`,onClick:()=>{s(!0)},children:R(X,{icon:`plus`,size:`l`,alt:e({id:`yFfBdX`})})})})]})}),R(`main`,{children:p.length>0?R(n,{children:[R(`ul`,{class:`filters-list`,children:p.map(e=>{let{id:r,title:i,expiresAt:a,keywords:o}=e;return R(`li`,{children:[R(`div`,{children:[R(`h2`,{children:i}),o?.length>0&&R(`div`,{children:o.map(e=>R(n,{children:[R(`span`,{class:`tag collapsed insignificant`,children:e.wholeWord?`${e.keyword}`:e.keyword}),` `]}))}),R(`small`,{class:`insignificant`,children:R(Hc,{expiresAt:a})})]}),R(`button`,{type:`button`,class:`plain`,onClick:()=>{s({filter:e})},children:R(X,{icon:`pencil`,size:`l`,alt:`Edit filter`})})]},r)})}),p.length>1&&R(`footer`,{class:`ui-state`,children:R(`small`,{class:`insignificant`,children:R(j,{id:`5vzJxv`,values:{0:p.length}})})})]}):i===`loading`?R(`p`,{class:`ui-state`,children:R(U,{})}):i===`error`?R(`p`,{class:`ui-state`,children:R(j,{id:`qcAUwp`})}):R(`p`,{class:`ui-state`,children:R(j,{id:`cWIHTt`})})})]}),!!o&&R(zt,{title:e({id:`vCSBPD`}),onClose:()=>{s(!1)},children:R(Vc,{filter:o?.filter,onClose:e=>{e.state===`success`&&d(),s(!1)}})})]})}var zc=1,Bc=()=>zc++;function Vc({filter:e,onClose:n}){let{_:r,_:i}=l(),{masto:o}=u(),[s,c]=I(`default`),f=!!e,{context:p,expiresAt:m,id:h,keywords:g,title:_,filterAction:v}=e||{},y=!!m,b=y&&new Date(m),[x,S]=I(g||[]),C=a(),[w,T]=I([]),[E,D]=I([]),O=x.filter(e=>!w.includes(e.id)&&!E.includes(e._id));return R(`div`,{class:`sheet`,id:`filters-add-edit-modal`,children:[!!n&&R(`button`,{type:`button`,class:`sheet-close`,onClick:n,children:R(X,{icon:`x`,alt:i({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:i(f?{id:`3mOee6`}:{id:`yFfBdX`})})}),R(`main`,{children:R(`form`,{onSubmit:e=>{e.preventDefault();let r=new FormData(e.target),a=r.get(`title`),s=r.getAll(`keyword_attributes[][id]`),l=r.getAll(`keyword_attributes[][keyword]`),u=[...C.current.querySelectorAll(`input[name="keyword_attributes[][whole_word]"]`)].map(e=>e.checked),d=l.map((e,n)=>({id:s[n]||void 0,keyword:e,wholeWord:u[n]}));f&&w?.length&&w.forEach(e=>{d.push({id:e,_destroy:!0})});let p=r.getAll(`context`),m=r.get(`expires_in`),g=r.get(`filter_action`);!a||!p?.length||(c(`loading`),(async()=>{try{let e;f?(m=m===``||m===null?y?Math.floor((b-Date.now())/1e3):null:m===`0`||m===0?null:+m,e=await o.v2.filters.$select(h).update({title:a,context:p,expiresIn:m,keywordsAttributes:d,filterAction:g})):(m=+m||null,e=await o.v2.filters.create({title:a,context:p,expiresIn:m,keywordsAttributes:d,filterAction:g})),c(`default`),n?.({state:`success`,filter:e})}catch{c(`error`),alert(i(f?{id:`H8RP-h`}:{id:`Fr0hAN`}))}})())},children:[R(`div`,{class:`filter-form-row`,children:R(`label`,{children:[R(`b`,{children:R(j,{id:`MHrjPM`})}),R(`input`,{type:`text`,name:`title`,defaultValue:_,disabled:s===`loading`,dir:`auto`,enterKeyHint:`done`,required:!0})]})}),R(`div`,{class:`filter-form-keywords`,ref:C,children:[O.length?R(`ul`,{class:`filter-keywords`,children:O.map(e=>{let{id:n,keyword:r,wholeWord:a,_id:o}=e;return R(`li`,{children:[R(`input`,{type:`hidden`,name:`keyword_attributes[][id]`,value:n}),R(`input`,{name:`keyword_attributes[][keyword]`,type:`text`,defaultValue:r,disabled:s===`loading`,required:!0,dir:`auto`,enterKeyHint:`done`}),R(`div`,{class:`filter-keyword-actions`,children:[R(`label`,{children:[R(`input`,{name:`keyword_attributes[][whole_word]`,type:`checkbox`,value:n,defaultChecked:a,disabled:s===`loading`}),` `,R(j,{id:`_7UQ7y`})]}),R(`button`,{type:`button`,class:`light danger small`,disabled:s===`loading`,onClick:()=>{n?(w.push(n),T([...w])):o&&(E.push(o),D([...E]))},children:R(X,{icon:`x`,alt:i({id:`t_YqKh`})})})]})]},`${n}-${o}`)})}):R(`div`,{class:`filter-keywords`,children:R(`div`,{class:`insignificant`,children:R(j,{id:`SYKm3p`})})}),R(`footer`,{class:`filter-keywords-footer`,children:[R(`button`,{type:`button`,class:`light`,onClick:()=>{S([...x,{_id:Bc(),keyword:``,wholeWord:!0}]),setTimeout(()=>{let e=C.current.querySelectorAll(`input[type="text"]`);e[e.length-1]?.focus?.()},10)},children:R(j,{id:`qn5Dbn`})}),` `,O?.length>1&&R(`small`,{class:`insignificant`,children:R(j,{id:`1JZ175`,values:{0:O.length}})})]})]}),R(`div`,{class:`filter-form-cols`,children:[R(`div`,{class:`filter-form-col`,children:[R(`div`,{children:R(`b`,{children:R(j,{id:`uqf7Yq`})})}),Nc.map(e=>R(`div`,{children:[R(`label`,{class:Pc.includes(e)?`insignificant`:``,children:[R(`input`,{type:`checkbox`,name:`context`,value:e,defaultChecked:p?p.includes(e):!0,disabled:s===`loading`}),` `,r(Fc[e]),Pc.includes(e)?`*`:``]}),` `]})),R(`p`,{children:R(`small`,{class:`insignificant`,children:R(j,{id:`m0G499`})})})]}),R(`div`,{class:`filter-form-col`,children:[f&&R(j,{id:`ucJk3m`,components:{0:R(`b`,{}),1:R(Hc,{expiresAt:m,showNeverExpires:!0})}}),R(`div`,{children:[R(`label`,{for:`filters-expires_in`,children:i(f?{id:`BcNdg-`}:{id:`agO_T_`})}),R(`select`,{id:`filters-expires_in`,name:`expires_in`,disabled:s===`loading`,defaultValue:f?void 0:0,children:[f&&R(`option`,{}),Ic.map(e=>R(`option`,{value:e,children:typeof Lc[e]==`function`?Lc[e]():r(Lc[e])}))]})]}),R(`p`,{children:[R(j,{id:`blQMpa`}),R(`br`,{}),d()?.mastodon>=5&&R(`label`,{class:`ib`,children:[R(`input`,{type:`radio`,name:`filter_action`,value:`blur`,defaultChecked:v===`blur`,disabled:s===`loading`}),` `,R(j,{id:`ggxOw9`})]}),` `,R(`label`,{class:`ib`,children:[R(`input`,{type:`radio`,name:`filter_action`,value:`warn`,defaultChecked:v!==`hide`&&v!==`blur`||!f,disabled:s===`loading`}),` `,R(j,{id:`jbreWy`})]}),` `,R(`label`,{class:`ib`,children:[R(`input`,{type:`radio`,name:`filter_action`,value:`hide`,defaultChecked:v===`hide`,disabled:s===`loading`}),` `,R(j,{id:`zNCBmf`})]})]})]})]}),R(`footer`,{class:`filter-form-footer`,children:[R(`span`,{children:[R(`button`,{type:`submit`,disabled:s===`loading`,children:i(f?{id:`tfDRzk`}:{id:`hYgDIe`})}),` `,R(U,{abrupt:!0,hidden:s!==`loading`})]}),f&&R(ut,{disabled:s===`loading`,align:`end`,menuItemClassName:`danger`,confirmLabel:i({id:`BPjyR2`}),onClick:()=>{c(`loading`),(async()=>{try{await o.v2.filters.$select(h).remove(),c(`default`),n?.({state:`success`})}catch{c(`error`),alert(i({id:`4Dh9J1`}))}})()},children:R(`button`,{type:`button`,class:`light danger`,onClick:()=>{},disabled:s===`loading`,children:R(j,{id:`Jb6_SB`})})})]})]})})]})}function Hc({expiresAt:e,showNeverExpires:n}){let{_:r}=l(),i=!!e,a=i&&new Date(e),o=i&&Date.parse(e)<=Date.now(),[s,c]=f(e=>e+1,0);return Ue(c,o||3e4),o?r({id:`M1RnFv`}):i?R(j,{id:`urGtsw`,components:{0:R(Ct,{datetime:a})}}):n&&r({id:`O1Aswy`})}function Uc(){let{_:e}=l(),{masto:r,instance:i}=u();he(e({id:`Xi1_bw`}),`/fh`);let[a,o]=I(`default`),[s,c]=I([]);return _(()=>{o(`loading`),(async()=>{try{c(await Vo()),o(`default`)}catch{o(`error`)}})()},[]),R(`div`,{id:`followed-hashtags-page`,class:`deck-container`,tabIndex:`-1`,children:R(`div`,{class:`timeline-deck deck`,children:[R(`header`,{children:R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),R(Z,{to:`/`,class:`button plain`,children:R(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),R(`h1`,{children:R(j,{id:`Xi1_bw`})}),R(`div`,{class:`header-side`})]})}),R(`main`,{children:s.length>0?R(n,{children:[R(`ul`,{class:`link-list`,children:s.map(e=>R(`li`,{children:R(Z,{to:i?`/${i}/t/${e.name}`:`/t/${e.name}`,children:[R(X,{icon:`hashtag`,alt:`#`}),` `,R(`span`,{children:e.name})]})}))}),s.length>1&&R(`footer`,{class:`ui-state`,children:R(`small`,{class:`insignificant`,children:R(j,{id:`2S_uvJ`,values:{0:s.length}})})})]}):a===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):a===`error`?R(`p`,{class:`ui-state`,children:R(j,{id:`2AeREO`})}):R(`p`,{class:`ui-state`,children:R(j,{id:`vKsGhk`})})})]})})}var Wc=20;function Gc({title:e,path:n,id:r,...i}){let{_:s}=l();he(e||s({id:`following.title`}),n||`/following`);let{masto:c,streaming:d,instance:f,client:p}=u(),[m,h]=I(d),g=W(o),v=a(),y=a(),b=a();_(()=>{!d&&p?.onStreamingReady&&p.onStreamingReady(e=>{h(e)})},[p]),__BENCHMARK.end(`time-to-following`);let x=Xe(`@pixelfed/home-include-reblogs`);async function S(e){(e||!y.current)&&(__BENCHMARK.start(`fetch-home-first`),v.current=c.v1.timelines.home.list({limit:Wc}),y.current=v.current.values()),x&&v.current?.params&&(typeof v.current.params==`string`?v.current.params+=`&include_reblogs=true`:v.current.params.include_reblogs=!0);let n=await y.current.next(),{value:r}=n;if(r?.length){let n=!1;e&&(r[0].id!==b.current&&(n=!0),b.current=r[0].id),r.forEach(e=>{O(e,f)}),r=As(r,f),e&&n&&Fs(),setTimeout(()=>{Ps(r,f)},100),r.sort((e,n)=>Date.parse(n.createdAt)-Date.parse(e.createdAt))}return __BENCHMARK.end(`fetch-home-first`),{...n,value:r}}async function C(){try{let e={limit:5,since_id:b.current};x&&(e.include_reblogs=!0);let{value:n}=await c.v1.timelines.home.list(e).values().next(),r=n[0]?.id===b.current;return!!(n?.length&&!r&&(b.current=n[0].id,n=As(n,f),n=qt(n,`home`),n.some(e=>!e.reblog)))}catch{return!1}}return _(()=>{let e;return(async()=>{if(m){e=m.user.subscribe();for await(let n of e){if(!e)break;if(n.event===`status.update`){let e=n.payload;O(e,f)}else if(n.event===`delete`){let e=n.payload,r=Pe(e,f);r&&(r._deleted=!0)}}}})(),()=>{e?.unsubscribe?.(),e=null}},[m]),R(Xs,{title:e||s({id:`following.title`}),id:r||`following`,emptyText:s({id:`nJEKbY`}),errorText:s({id:`7QSeK6`}),instance:f,fetchItems:S,checkForUpdates:C,useItemID:!0,boostsCarousel:g.settings.boostsCarousel,...i,filterContext:`home`,showFollowedTags:!0,showReplyParent:!0})}var Kc=20,qc=50,Jc=1e3*60*15;function Yc(e){let n=e[e.length-1];return n.items?n.items[n.items.length-1]:n}function Xc(e){let n=e[0];return n.items?n.items[0]:n}function Zc(e){if(!e)return null;let n=e.getBoundingClientRect(),r=e.querySelectorAll(`[data-state-post-id]`);for(let e of r){let r=e.getBoundingClientRect();if(r.bottom>n.top+10&&r.top<n.bottom-10){let i=e.dataset.statePostId?.split?.(` `);if(i)return{itemId:i,offset:r.top-n.top}}}return null}function Qc({title:e,titleComponent:r,id:i,instance:s,emptyText:c,errorText:d,useItemID:f,fetchItems:p=async()=>{},checkForUpdates:m=async()=>{},checkForUpdatesInterval:h=15e3,headerStart:g,headerEnd:v,timelineStart:b,refresh:x,filterContext:S,showFollowedTags:C,showReplyParent:w,dedupeBoosts:T}){let{_:E}=l(),D=W(o).settings.autoHideBars,{masto:k}=u({instance:s}),A=`timeline2-${i}`,M=a(null);M.current===null&&(M.current=F.account.get(A)||null);let N=!!M.current?.items?.length,P=M.current?.updatedAt,L=P?Date.now()-P:0,z=a(),[B,te]=I(N?`default`:`start`),[V,ne]=I((M.current?.showNewer??!1)||L>Jc),[re,ie]=I(M.current?.showOlder??!0),[ae,oe]=I(!0),H=a(),se=a(!0),[G,ce]=I(()=>{let e=M.current?.items;return e?.length?(e.forEach(e=>{e.items?e.items.forEach(e=>{O(e,s,{sync:!0})}):O(e,s,{sync:!0})}),e):[]}),le=y(()=>{let e=M.current;if(!e?.items?.length||(e.updatedAt?Date.now()-e.updatedAt:1/0)<=Jc)return;let n=[];if(e.items.forEach(e=>{e.items?e.items.forEach(e=>{n.push(e.id)}):n.push(e.id)}),n.length===0)return;let r=[];(async()=>{try{for(let e=0;e<n.length;e+=Kc){let i=n.slice(e,e+Kc);try{let e=await k.v1.statuses.list({id:i}),n=new Set(e?.map(e=>e.id)||[]);i.forEach(e=>{n.has(e)||r.push(e)}),e?.length&&e.forEach(e=>{O(e,s,{sync:!0})})}catch{}}r.forEach(e=>{let n=Ae(e,s);o.statuses[n]&&(o.statuses[n]._deleted=!0)})}catch{}})()},[s,k]);_(()=>{le()},[]),an(e=>{e&&le()},[le]);let ue=a(M.current?.scrollAnchor||null),de=y(({items:e,direction:n})=>{if(!e?.length||!H.current)return;let r=Ae((n===`next`?Yc:Xc)(e)?.id,s),i=H.current.querySelector(`[data-state-post-id~="${r}"]`);if(i){let e=H.current.getBoundingClientRect();ue.current={itemId:r,offset:i.getBoundingClientRect().top-e.top,direction:n}}},[]);__BENCHMARK.start(`timeline-${i}-load`);let K=a(M.current?.minID||null),fe=a(M.current?.maxID||null),pe=Je((e={})=>{let{max_id:n,min_id:r}=e,a=!n&&!r?`start`:n?`next`:r?`prev`:null;z.current=a,te(`loading`),(async()=>{try{let n=await p(e),{max_id:r,min_id:o}=e,{value:c,originalValue:l,done:u}=n;if(c==null)throw Error(`Timeline load failed`);let d=!u,f=l[0]?.id,m=l[l.length-1]?.id;c?.length?(T&&(c=As(c,s)),c=js(c,S),c=Ms(c,s),a===`start`?(K.current=f,fe.current=m,ce(c),ie(d),ne(!1)):a===`next`?(fe.current=m,H.current.classList.add(`scrolling-next`),ce(e=>{de({items:e,direction:`next`});let n=[...e,...c].slice(-qc);return K.current=[n[0].id].flat()[0],n}),ie(d),ne(!0)):a===`prev`&&(K.current=f,H.current.classList.add(`scrolling-prev`),ce(e=>{de({items:e,direction:`prev`});let n=[...c,...e].slice(0,qc);return fe.current=[n.at(-1).id].flat().at(-1),n}),ie(!0),ne(l.length>=Kc))):(r&&ie(!1),o&&ne(!1)),te(`default`),__BENCHMARK.end(`timeline-${i}-load`)}catch{te(`error`)}finally{pe.cancel()}})()},300,{leading:!0}),me=qs(H),q=Js(H),he=Ys(),ge=a();_(()=>{if(!se.current)if(G.length>0){let e=F.account.get(A)||{};F.account.set(A,{...e,items:G,minID:K.current,maxID:fe.current,showNewer:V,showOlder:re,updatedAt:Date.now()})}else F.account.del(A)},[G,A,V,re]);let _e=Ge(()=>{if(!H.current||G.length===0)return;let e=Zc(H.current);if(e){let n=F.account.get(A)||{};F.account.set(A,{...n,scrollAnchor:e})}},500),ve=y(({scrollDirection:e,nearReachStart:n})=>{ge.current&&(ge.current.hidden=D&&e===`end`&&!n),_e()},[_e,D]),{resetScrollDirection:ye}=Ls({scrollableRef:H,distanceFromEnd:2,scrollThresholdStart:44},ve);_(()=>{se.current&&(se.current=!1,M.current?.items?.length?be():pe())},[pe]);let be=y(async()=>{K.current&&ne(await m({minID:K.current}))},[m]),xe=a();return an(e=>{if(!se.current){if(e){let e=Date.now()-xe.current;(!xe.current||e>1e3*3)&&be()}else xe.current=Date.now();oe(e)}},[be]),Ue(be,ae&&!V?h:null),ee(()=>{if(B!==`default`||!H.current||!ue.current)return;let e=ue.current;ue.current=null;let{itemId:n,offset:r,direction:i}=e,a=H.current.querySelector(`[data-state-post-id~="${n}"]`);if(a){let e=H.current.getBoundingClientRect(),n=a.getBoundingClientRect().top-e.top-r;Math.abs(n)>1&&(H.current.scrollTop+=n),setTimeout(()=>{H.current?.classList.remove(`scrolling-${i}`)},300)}},[G,B]),R(Gt.Provider,{value:S,children:R(`div`,{id:`${i}-page`,class:`deck-container timeline-2-container`,ref:e=>{H.current=e,me.current=e,q.current=e,he.current=e},tabIndex:`-1`,onClick:e=>{ge.current&&e.target.closest(`.timeline-item, .timeline-item-alt`)&&setTimeout(()=>{ge.current.hidden=!1,ye()},250)},children:R(`div`,{class:`timeline-deck deck`,children:[R(`header`,{ref:ge,onClick:e=>{e.target.closest(`a, button`)||H.current?.scrollTo({top:0,behavior:`smooth`})},onDblClick:e=>{e.target.closest(`a, button`)||pe()},children:R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),g??R(Z,{to:`/`,class:`button plain home-button`,children:R(X,{icon:`home`,size:`l`,alt:E({id:`i0qMbr`})})})]}),e&&(r||R(`h1`,{children:e})),R(`div`,{class:`header-side`,children:!!v&&v})]})}),!!b&&R(`div`,{class:`timeline-start ${B===`loading`?`loading`:``}`,children:b}),G.length?R(n,{children:[V&&R(`div`,{class:`timeline-pagination timeline-pagination-top ${se.current?``:`transitioning`}`,children:[R(`button`,{type:`button`,"data-pagination-trigger":`latest`,class:`plain4 ${B===`loading`&&z.current===`start`?`block`:``}`,onClick:()=>{pe()},disabled:B===`loading`,children:B===`loading`&&z.current===`start`?R(U,{abrupt:!0}):R(X,{icon:`arrow-up-top`,size:`l`})}),R(`button`,{type:`button`,"data-pagination-trigger":`prev`,class:`plain4 ${B===`loading`&&z.current===`start`?``:`block`}`,onClick:()=>{pe({min_id:K.current})},disabled:B===`loading`,children:B===`loading`&&z.current===`prev`?R(U,{abrupt:!0}):R(X,{icon:`arrow-up`,size:`l`})})]}),R(`ul`,{class:`timeline`,children:G.map(e=>R(Zs,{status:e,instance:s,useItemID:f,filterContext:S,showFollowedTags:C,showReplyParent:w},e.id))}),re?R(`div`,{class:`timeline-pagination timeline-pagination-bottom`,children:R(`button`,{type:`button`,class:`plain4 block`,"data-pagination-trigger":`next`,onClick:()=>{pe({max_id:fe.current})},disabled:B===`loading`,children:B===`loading`?R(U,{abrupt:!0}):R(X,{icon:`arrow-down`,size:`l`})})}):B===`loading`?null:R(`p`,{class:`ui-state insignificant`,children:R(j,{id:`2EYeAZ`})})]}):B===`loading`?R(`ul`,{class:`timeline`,children:Array.from({length:5}).map((e,n)=>R(`li`,{children:R(Mt,{skeleton:!0})},n))}):B!==`error`&&B!==`start`&&R(`p`,{class:`ui-state`,children:c}),B===`error`&&R(`p`,{class:`ui-state`,children:[d,R(`br`,{}),R(`br`,{}),R(`button`,{type:`button`,onClick:()=>pe(),children:R(j,{id:`KDw4GX`})})]})]})})})}var $c=20;function el({title:e,path:n,id:r,...i}){let{_:a}=l();he(e||a({id:`following.title`}),n||`/_following2`);let{masto:o,streaming:s,instance:c,client:d}=u(),[f,p]=I(s);_(()=>{!s&&d?.onStreamingReady&&d.onStreamingReady(e=>{p(e)})},[d]),__BENCHMARK.end(`time-to-following`);let m=Xe(`@pixelfed/home-include-reblogs`);async function h({max_id:e,min_id:n}={}){__BENCHMARK.start(`fetch-home`);let r={limit:$c};e&&(r.max_id=e),n&&(r.min_id=n),m&&(r.include_reblogs=!0);let i=await o.v1.timelines.home.list(r).values().next(),{value:a}=i,s=[...a||[]];return a?.length&&(a.forEach(e=>{O(e,c)}),setTimeout(()=>{Ps(a,c)},100),a.sort((e,n)=>Date.parse(n.createdAt)-Date.parse(e.createdAt))),__BENCHMARK.end(`fetch-home`),{...i,value:a,originalValue:s}}async function g({minID:e}){try{let n={limit:5,since_id:e};m&&(n.include_reblogs=!0);let{value:r}=await o.v1.timelines.home.list(n).values().next();return r?.length?(r=As(r,c),r=qt(r,`home`),r.length>0):!1}catch{return!1}}return _(()=>{let e;return(async()=>{if(f){e=f.user.subscribe();for await(let n of e){if(!e)break;if(n.event===`status.update`){let e=n.payload;O(e,c)}else if(n.event===`delete`){let e=n.payload,r=Pe(e,c);r&&(r._deleted=!0)}}}})(),()=>{e?.unsubscribe?.(),e=null}},[f]),R(Qc,{title:e||a({id:`following.title`}),id:r||`following2`,emptyText:a({id:`nJEKbY`}),errorText:a({id:`7QSeK6`}),instance:c,fetchItems:h,checkForUpdates:g,useItemID:!0,...i,filterContext:`home`,showFollowedTags:!0,showReplyParent:!0})}var tl={"disabled.example.com":`disabled`,"authenticated.example.com":`authenticated`};async function nl(e,n){let r=F.local.getJSON(`instances`)||{},i=r[n?.toLowerCase()];if(!i?.configuration?.timelinesAccess){let a=await e.v2.instance.fetch().catch(()=>null);a&&(i=a,r[n?.toLowerCase()]=a,F.local.setJSON(`instances`,r))}return i}async function rl({feed:e,feedType:n,feeds:r,instance:i}){let{masto:a,instance:o}=u({instance:i}),s=i||o;try{let i=tl[s?.toLowerCase()];if(r){if(i){let e={};return r.forEach(({feed:n,feedType:r})=>{e[`${n}_${r}`]=i}),e}let e=await nl(a,s),n={};return r.forEach(({feed:r,feedType:i})=>{n[`${r}_${i}`]=e?.configuration?.timelinesAccess?.[r]?.[i]||`public`}),n}return i||(await nl(a,s))?.configuration?.timelinesAccess?.[e]?.[n]||`public`}catch{return r?{}:`public`}}var il=20,al=5;function ol({media:e,columnMode:r,...i}){let{_:s}=l(),{hashtag:c,...d}=r?{}:k();i.hashtag&&(c=i.hashtag);let f=c.trim().split(/[\s+]+/);f.sort(),c=f[0];let[p,h]=ce(),g=e||!!p.get(`media`),v=g?`?media=1`:``,{masto:y,instance:b,authenticated:x}=u({instance:i?.instance||d.instance}),{masto:S,instance:C,authenticated:w}=u(),T=f.map(e=>`#${e}`).join(` `),E=s(b?g?{id:`kH0rA0`,values:{hashtagTitle:T,instance:b}}:{id:`IK0zKi`,values:{hashtagTitle:T,instance:b}}:g?{id:`hHSI3w`,values:{hashtagTitle:T}}:{id:`-ZzjRY`,values:{hashtagTitle:T}});he(E,`/:instance?/t/:hashtag`);let D=a(),A=m(()=>ne(),[]),[M,ee]=I(null),N=M===`disabled`,P=M===`authenticated`&&!x,F=a(void 0);async function L(e){let n=await rl({feed:`hashtagFeeds`,feedType:`local`,instance:b});if(ee(n),n===`disabled`||n===`authenticated`&&!x)return{done:!0,value:[]};let r=await y.v1.timelines.tag.$select(c).list({limit:il,any:f.slice(1),maxId:e?void 0:F.current,onlyMedia:g?!0:void 0}).values().next(),{value:i}=r;return i?.length&&(e&&(D.current=i[0].id),i.forEach(e=>{O(e,b,{skipThreading:g||A})}),F.current=i[i.length-1].id),{...r,value:i}}async function z(){try{let{value:e}=await y.v1.timelines.tag.$select(c).list({limit:1,any:f.slice(1),since_id:D.current,onlyMedia:g}).values().next(),n=e[0]?.id===D.current;return e?.length&&!n?(e=qt(e,`public`),!0):!1}catch{return!1}}let[B,te]=I(`default`),[V,re]=I();_(()=>{(async()=>{try{re(await y.v1.tags.$select(c).fetch())}catch{}})()},[c]);let ie=f.length>=al,[ae,oe]=I(`default`),[H,U]=I([]),[se,W]=I(!1);return _(()=>{x&&(async()=>{try{let e=await y.v1.featuredTags.list();U(e),W(e.some(e=>e.name.toLowerCase()===c.toLowerCase()))}catch{}})()},[]),R(n,{children:[R(Xs,{title:E,titleComponent:!!b&&R(`h1`,{class:`header-double-lines`,children:[R(`b`,{dir:`auto`,children:T}),R(`div`,{children:b})]}),id:`hashtag`,instance:b,emptyText:s(N?{id:`qbE_m4`}:P?{id:`aqJggz`}:{id:`CNSLAW`}),errorText:s({id:`yjj6Ll`}),fetchItems:L,checkForUpdates:z,useItemID:!0,view:g||A?`media`:void 0,refresh:g,filterContext:`public`,headerEnd:R(tt,{portal:!0,setDownOverflow:!0,overflow:`auto`,position:`anchor`,menuButton:R(`button`,{type:`button`,class:`plain`,children:R(X,{icon:`more`,size:`l`,alt:s({id:`2FYpfJ`})})}),children:[!!V&&f.length===1&&R(n,{children:[R(ut,{subMenu:!0,confirm:V.following,confirmLabel:s({id:`ctJi7k`,values:{hashtag:c}}),disabled:B===`loading`||!x,onClick:()=>{te(`loading`),V.following?y.v1.tags.$select(c).unfollow().then(()=>{re({...V,following:!1}),Y(s({id:`doK_ij`,values:{hashtag:c}}))}).catch(e=>{alert(e)}).finally(()=>{te(`default`)}):y.v1.tags.$select(c).follow().then(()=>{re({...V,following:!0}),Y(s({id:`R9-aEN`,values:{hashtag:c}}))}).catch(e=>{alert(e)}).finally(()=>{te(`default`)})},children:V.following?R(n,{children:[R(X,{icon:`check-circle`}),` `,R(`span`,{children:R(j,{id:`HOSk7R`})})]}):R(n,{children:[R(X,{icon:`plus`}),` `,R(`span`,{children:R(j,{id:`MKEPCY`})})]})}),R(Q,{type:`checkbox`,checked:se,disabled:ae===`loading`||!x,onClick:()=>{if(oe(`loading`),se){let e=H.find(e=>e.name.toLowerCase()===c.toLowerCase()).id;e?y.v1.featuredTags.$select(e).remove().then(()=>{W(!1),Y(s({id:`VH-Tf9`})),U(H.filter(n=>n.id!==e))}).catch(e=>{}).finally(()=>{oe(`default`)}):Y(s({id:`3OLv47`}))}else y.v1.featuredTags.create({name:c}).then(e=>{W(!0),Y(s({id:`9ra4hn`})),U(H.concat(e))}).catch(e=>{}).finally(()=>{oe(`default`)})},children:se?R(n,{children:[R(X,{icon:`check-circle`}),R(`span`,{children:R(j,{id:`9ra4hn`})})]}):R(n,{children:[R(X,{icon:`check-circle`}),R(`span`,{children:R(j,{id:`UlJ3QN`})})]})}),R(rt,{})]}),!A&&R(n,{children:[R(Kt,{className:`plain`,children:R(j,{id:`cSev-j`})}),R(Q,{type:`checkbox`,checked:!!g,onClick:()=>{g?p.delete(`media`):p.set(`media`,`1`),h(p)},children:[R(X,{icon:`check-circle`,alt:`☑️`}),` `,R(`span`,{class:`menu-grow`,children:R(j,{id:`eK4SL_`})})]}),R(rt,{})]}),R(Ve,{className:`menu-field`,disabled:ie,children:({ref:e})=>R(`form`,{onSubmit:e=>{e.preventDefault();let n=e.target[0].value?.trim?.();n&&!f.some(e=>e.toLowerCase()===n.toLowerCase())&&(f.push(n),f.sort(),location.hash=b?`/${b}/t/${f.join(`+`)}${v}`:`/t/${f.join(`+`)}${v}`)},children:[R(X,{icon:`hashtag`}),R(`input`,{ref:e,type:`text`,placeholder:ie?K._({id:`ouWc_D`,values:{TOTAL_TAGS_LIMIT:al}}):s({id:`cxL5F9`}),required:!0,autocorrect:`off`,autocapitalize:`off`,spellCheck:!1,pattern:`[^#][^\\s#]+[^#]`,disabled:ie,dir:`auto`,enterKeyHint:`go`})]})}),R(mt,{takeOverflow:!0,children:f.map((e,n)=>R(Q,{disabled:f.length===1,onClick:e=>{f.splice(n,1),f.sort(),location.hash=b?`/${b}/t/${f.join(`+`)}${v}`:`/t/${f.join(`+`)}${v}`},children:[R(X,{icon:`x`,alt:s({id:`OISAkj`}),class:`danger-icon`}),R(`span`,{class:`bidi-isolate`,children:[R(`span`,{class:`more-insignificant`,children:`#`}),e]})]},e))}),R(rt,{}),R(Q,{disabled:!w,onClick:()=>{if(o.shortcuts.length>=9){alert(K._({id:`XN1xAY`,values:{SHORTCUTS_LIMIT:9}}));return}let e={type:`hashtag`,hashtag:f.join(` `),instance:b,media:g?`on`:void 0};o.shortcuts.some(n=>n.type===e.type&&n.hashtag.split(/[\s+]+/).sort().join(` `)===e.hashtag.split(/[\s+]+/).sort().join(` `)&&(n.instance?n.instance===e.instance:!0)&&(n.media?!!n.media==!!e.media:!0))?alert(s({id:`kfeQnS`})):(o.shortcuts.push(e),Y(s({id:`MIhb91`})))},children:[R(X,{icon:`shortcut`}),` `,R(`span`,{children:R(j,{id:`i02Lq_`})})]}),R(Q,{onClick:()=>{let e=prompt(s({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(s({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=`/${e}/t/${f.join(`+`)}${v}`)},children:[R(X,{icon:`bus`}),` `,R(`span`,{children:R(j,{id:`kesYbo`})})]}),C!==b&&R(Q,{onClick:()=>{location.hash=`/${C}/t/${f.join(`+`)}${v}`},children:[R(X,{icon:`bus`}),` `,R(`small`,{class:`menu-double-lines`,children:R(j,{id:`_AfxaA`,values:{currentInstance:C},components:{0:R(`b`,{})}})})]})]})},b+T),!r&&!!f?.length&&R(`data`,{class:`compose-data`,value:JSON.stringify({draftStatus:{status:`${f.length>1?`
`:` `}${T}`}})})]})}var sl=20;function cl(e){let{_:r}=l(),i=W(o),{masto:s,instance:c}=u(),d=e?.id||k()?.id,f=a(),p=a();async function m(e){(e||!p.current)&&(p.current=s.v1.timelines.list.$select(d).list({limit:sl}).values());let n=await p.current.next(),{value:r}=n;return r?.length&&(e&&(f.current=r[0].id),r.forEach(e=>{O(e,c)})),{...n,value:r}}async function h(){try{let{value:e}=await s.v1.timelines.list.$select(d).list({limit:1,since_id:f.current}),n=e[0]?.id===f.current;return e?.length&&!n?(e=qt(e,`home`),!0):!1}catch{return!1}}let[g,v]=I([]),[y,b]=I({title:`List`});he(y.title,`/l/:id`),_(()=>{(async()=>{try{b(await xi(d))}catch{}})()},[d]);let[x,S]=I(!1),[C,w]=I(!1);return R(n,{children:[R(Xs,{title:y.title,id:`list`,emptyText:r({id:`KkDhfU`}),errorText:r({id:`7QSeK6`}),instance:c,fetchItems:m,checkForUpdates:h,useItemID:!0,boostsCarousel:i.settings.boostsCarousel,filterContext:`home`,showReplyParent:!0,headerStart:R(tt,{overflow:`auto`,menuButton:R(`button`,{type:`button`,class:`plain`,children:[R(X,{icon:`list`,size:`l`,alt:r({id:`h16FyT`})}),R(X,{icon:`chevron-down`,size:`s`})]}),onMenuChange:e=>{e.open&&yi().then(v)},children:[R(Nt,{to:`/l`,children:R(`span`,{children:R(j,{id:`BHWx-g`})})}),g?.length>0&&R(n,{children:[R(rt,{}),g.map(e=>R(Nt,{to:`/l/${e.id}`,children:R(`span`,{children:[e.title,e.exclusive&&R(n,{children:[` `,R(Ei,{})]})]})},e.id))]})]}),headerEnd:R(tt,{portal:!0,setDownOverflow:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:R(`button`,{type:`button`,class:`plain`,children:R(X,{icon:`more`,size:`l`,alt:r({id:`2FYpfJ`})})}),children:[y?.exclusive&&R(n,{children:[R(Kt,{className:`plain`,children:[R(Ei,{}),` `,R(j,{id:`FNptcJ`})]}),R(rt,{})]}),R(Q,{onClick:()=>S({list:y}),children:[R(X,{icon:`pencil`,size:`l`}),R(`span`,{children:R(j,{id:`ePK91l`})})]}),R(Q,{onClick:()=>w(!0),children:[R(X,{icon:`group`,size:`l`}),R(`span`,{children:R(j,{id:`hB02vO`})})]})]})},d),x&&R(zt,{onClick:e=>{e.target===e.currentTarget&&S(!1)},children:R(Di,{list:x?.list,onClose:e=>{e.state===`success`&&e.list?b(e.list):e.state===`deleted`&&(location.hash=`/l`),S(!1)}})}),C&&R(zt,{onClick:e=>{e.target===e.currentTarget&&w(!1)},children:R(ul,{listID:d,onClose:()=>w(!1)})})]})}var ll=40;function ul({listID:e,onClose:n}){let{_:r}=l(),{masto:i,instance:o}=u(),[s,c]=I([]),[d,f]=I(`default`),[p,m]=I(!1),h=a();async function g(n){m(!1),f(`loading`),(async()=>{try{(n||!h.current)&&(h.current=i.v1.lists.$select(e).accounts.list({limit:ll}).values());let{done:r,value:a}=await h.current.next();a?.length?(c(n?a:s.concat(a)),m(!r)):m(!1),f(`default`)}catch{f(`error`)}})()}return _(()=>{g(!0)},[]),R(`div`,{class:`sheet`,id:`list-manage-members-container`,children:[!!n&&R(`button`,{type:`button`,class:`sheet-close`,onClick:n,children:R(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`hB02vO`})})}),R(`main`,{children:R(`ul`,{children:[s.map(n=>R(`li`,{children:[R(wt,{account:n,instance:o}),R(dl,{account:n,listID:e})]},n.id)),p&&d===`default`&&R(He,{as:`li`,onChange:e=>e&&g(),children:R(`button`,{type:`button`,class:`light block`,onClick:g,children:R(j,{id:`uXRAkV`})})})]})})]})}function dl({account:e,listID:n}){let{_:r}=l(),{masto:i}=u(),[a,o]=I(`default`),[s,c]=I(!1);return R(ut,{confirm:!s,confirmLabel:R(`span`,{children:R(j,{id:`j5n9Ry`,values:{0:e.username},components:{0:R(`span`,{class:`bidi-isolate`})}})}),align:`end`,menuItemClassName:`danger`,onClick:()=>{s?(o(`loading`),(async()=>{try{await i.v1.lists.$select(n).accounts.create({accountIds:[e.id]}),o(`default`),c(!1)}catch{o(`error`)}})()):(o(`loading`),(async()=>{try{await i.v1.lists.$select(n).accounts.remove({accountIds:[e.id]}),o(`default`),c(!0)}catch{o(`error`)}})())},children:R(`button`,{type:`button`,class:`light ${s?``:`danger`}`,disabled:a===`loading`,children:r(s?{id:`m16xKo`}:{id:`MWIaew`})})})}var fl={mention:[`account`,`status`],quote:[`account`,`status`],status:[`account`,`status`],reblog:[`account`,`status`],follow:[`account`],follow_request:[`account`],favourite:[`account`,`status`],poll:[`status`],update:[`status`]},pl=[`favourite`,`reblog`,`follow`,`admin.sign_up`],ml=e=>pl.includes(e);function hl(e){return e.filter(e=>{let{type:n,id:r,createdAt:i}=e;if(!n)return!1;let a=fl[n];return a?.length?a.every(n=>!!e[n]):!0})}function gl(e){if(e?.notificationGroups){let{accounts:n=[],notificationGroups:r=[],statuses:i=[]}=e;return r.map(e=>{let{sampleAccountIds:r,statusId:a}=e,o=r?.map(e=>n.find(n=>n.id===e))||[],s=i?.find(e=>e.id===a)||null;return{...e,sampleAccounts:o,status:s}})}return e}function _l(e){let n=e.map(e=>{let{latestPageNotificationAt:n,mostRecentNotificationId:r,sampleAccounts:i,notificationsCount:a}=e;return{id:``+r,createdAt:n,account:i[0],...e}}),r={},i=[];for(let e=0;e<n.length;e++){let a=n[e],{type:o,status:s,createdAt:c,notificationsCount:l,sampleAccounts:u,groupKey:d}=a,f=c?new Date(c).toLocaleDateString():``,p=o;!(l>0&&u?.length>0&&l>u?.length)&&(o===`favourite`||o===`reblog`)&&(p=`favourite+reblog`);let m=`${s?.id}-${p}-${f}`,h=r[m];if(!ml(o)){if((o===`mention`||o===`quote`)&&s?.id){let e=i.find(e=>(o===`quote`&&e.type===`mention`||o===`mention`&&e.type===`quote`)&&e.status?.id===s.id);if(e){e.type=`mention+quote`;continue}}i.push(a)}else if(h)u.forEach(e=>{let n=h.sampleAccounts.find(n=>n.id===e.id);n?(n._types.push(o),n._types.sort().reverse()):h.sampleAccounts.push({...e,_types:[o]})}),h.notificationsCount=Math.min(h.notificationsCount,l),h._notificationsCount.push(l),h._sampleAccountsCount.push(u?.length),h._accounts=h.sampleAccounts,d&&h._groupKeys.push(d);else{let e=u.map(e=>({...e,_types:[o]}));r[m]={...a,sampleAccounts:e,type:p,_accounts:e,_groupKeys:d?[d]:[],_notificationsCount:[l],_sampleAccountsCount:[u?.length]},i.push(r[m])}}let a={},o=[];for(let e=0;e<i.length;e++){let n=i[e],{type:r,account:s,_accounts:c,sampleAccounts:l,createdAt:u,groupKey:d}=n,f=u?new Date(u).toLocaleDateString():``,p=l?.length===1||c?.length===1;if((r===`favourite`||r===`reblog`||r===`favourite+reblog`)&&p){let e=`${s?.id}-${r}-${f}`,i=a[e];if(i)i._statuses.push(n.status),i._ids+=`-${n.id}`,i._groupKeys.push(d);else{let i=a[e]={...n,type:r,_ids:n.id,_statuses:[n.status],_groupKeys:d?[d]:[]};o.push(i)}}else o.push(n)}return o}function vl(e){e=hl(e);let n={},r=[];for(let i=0,a=0;i<e.length;i++){let o=e[i],{id:s,status:c,account:l,type:u,createdAt:d}=o,f=d?new Date(d).toLocaleDateString():``,p=u;(u===`favourite`||u===`reblog`)&&(p=`favourite+reblog`);let m=`${c?.id}-${p}-${f}`,h=n[m];if(!ml(u))r[a++]=o;else if(h?.account){let e=h._accounts.find(e=>e.id===l.id);e?(e._types.push(u),e._types.sort().reverse(),h._ids+=`-${s}`):(l._types=[u],h._accounts.push(l),h._ids+=`-${s}`)}else{l&&(l._types=[u]);let e=n[m]={...o,type:p,_ids:s,_accounts:l?[l]:[]};r[a++]=e}}let i={},a=[];for(let e=0,n=0;e<r.length;e++){let o=r[e],{id:s,account:c,_accounts:l,type:u,createdAt:d}=o,f=d?new Date(d).toLocaleDateString():``;if(u===`favourite+reblog`&&c&&l.length===1){let e=`${c?.id}-${u}-${f}`,r=i[e];if(r)r._statuses.push(o.status),r._ids+=`-${s}`;else{let r=i[e]={...o,type:u,_ids:s,_statuses:[o.status]};a[n++]=r}}else a[n++]=o}return a}var yl=20,bl=new URLSearchParams;function xl({columnMode:e,...r}){let{_:i}=l(),{masto:o,instance:s}=u(),[c]=e?[bl]:ce(),[d,f]=I(null),p=r?.type||c.get(`type`)||d;he(i(p===`private`?{id:`2BApYc`}:{id:`_bZzdR`}),`/mentions`);let[h,g]=I(!1),_=a({}),v=a(),y=a();function b(e){if(!h||!e?.length)return e;let n=T();return e.filter(e=>{let r=e.account?.id;return!r||r===n?!1:_.current[r]?.following===!0})}async function x(e){(e||!v.current)&&(v.current=o.v1.notifications.list({limit:yl,types:[`mention`]}).values());let n=await v.current.next(),{value:r}=n;if(r?.length){r=hl(r),e&&(y.current=r[0].id),r.forEach(({status:e})=>{O(e,s)});let i=r.map(e=>e.status);if(h&&i?.length){let e=await ze(i.map(e=>e.account),_.current);e&&(_.current={..._.current,...e}),i=b(i)}return{...n,value:i}}return{...n,value:r?.map(e=>e.status)}}let S=a(),C=a();async function w(e){(e||!S.current)&&(S.current=o.v1.conversations.list({limit:yl}).values());let n=await S.current.next(),{value:r}=n;if(r=r?.filter(e=>e.lastStatus),r?.length){e&&(C.current=r[0].lastStatus.id),r.forEach(({lastStatus:e})=>{O(e,s)});let i=r.map(e=>e.lastStatus);if(h&&i?.length){let e=await ze(i.map(e=>e.account),_.current);e&&(_.current={..._.current,...e}),i=b(i)}return{...n,value:i}}return{...n,value:r?.map(e=>e.lastStatus)}}function E(...e){return p===`private`?w(...e):x(...e)}async function D(){if(p===`private`)try{let{value:e}=await o.v1.conversations.list({limit:1,since_id:C.current}).values().next(),n=e[0]?.id===C.current;return e?.length&&!n?(C.current=e[0].lastStatus.id,!0):!1}catch{return!1}else try{let{value:e}=await o.v1.notifications.list({limit:1,types:[`mention`],since_id:y.current}).values().next();return e?.length?(y.current=e[0].id,!0):!1}catch{return!1}}let k=m(()=>R(n,{children:[R(`div`,{id:`followings-option`,children:R(`label`,{children:[R(`input`,{type:`checkbox`,checked:h,onChange:e=>{g(e.target.checked)}}),` `,R(j,{id:`h4JxWH`})]})}),R(`div`,{class:`filter-bar`,children:[R(Z,{to:`/mentions`,class:p?``:`is-active`,onClick:n=>{e&&(n.preventDefault(),f(null))},children:R(j,{id:`N40H-G`})}),R(Z,{to:`/mentions?type=private`,class:p===`private`?`is-active`:``,onClick:n=>{e&&(n.preventDefault(),f(`private`))},children:R(j,{id:`zwBp5t`})})]})]}),[p,h]);return R(Xs,{title:i({id:`_bZzdR`}),id:`mentions`,emptyText:i({id:`03jFGT`}),errorText:i({id:`pqR9KF`}),instance:s,fetchItems:E,checkForUpdates:D,useItemID:!0,timelineStart:k,refresh:`${p}-${h}`,filterContext:`notifications`})}var Sl=80,Cl=20,wl=new URLSearchParams,Tl={block:`start`,inline:`center`,behavior:`instant`},El=J(()=>d()?.mastodon>=2,{expires:1e3*60*5});function Dl(e={}){let{masto:n}=u();return El()?n.v2.notifications.list({limit:Cl,...e}):n.v1.notifications.list({limit:Sl,...e})}function Ol(e={}){return Dl(e).values()}function kl(e){return El()?_l(e):vl(e)}var Al=[`forNotFollowing`,`forNotFollowers`,`forNewAccounts`,`forPrivateMentions`,`forLimitedAccounts`],jl={forNotFollowing:{id:`d-hDoa`},forNotFollowers:{id:`oAwuQj`},forNewAccounts:{id:`Srs8u7`},forPrivateMentions:{id:`IDC5Uw`},forLimitedAccounts:{id:`XMGM2e`}};function Ml({columnMode:e}){let{_:r,_:i}=l();he(i({id:`iDNBZe`}),`/notifications`);let{masto:s,instance:c}=u(),d=W(o),[f,p]=I(`default`),[h]=e?[wl]:ce(),g=h.get(`id`),v=h.get(`access_token`),[b,S]=I(!1),[C,w]=I(!1),[T,E]=I(!1),[D,k]=I(!1),A=a(),{nearReachEnd:M,scrollDirection:ee,reachStart:N,nearReachStart:P}=Is({scrollableRef:A}),L=d.settings.autoHideBars&&ee===`end`&&!P,[z,B]=I([]),[te,V]=I([]),ne=a(),re=a();async function ie(n){if((n||!re.current)&&(ne.current=Dl({excludeTypes:[`follow_request`]}),re.current=ne.current.values()),/max_id=($|&)/i.test(re.current?.nextParams))return{done:!0};let r=await re.current.next(),i=gl(r.value);if(i?.length){i.forEach(e=>{O(e.status,c,{skipThreading:!0})});let r=kl(i);n?(o.notificationsLast=r[0],o.notifications=r,s.v1.markers.create({notifications:{lastReadId:r[0].id}}).catch(()=>{}),e||q(r)):o.notifications.push(...r)}return o.notificationsShowNew=!1,o.notificationsLastFetchTime=Date.now(),r}async function ae(){try{return await s.v1.followRequests.list({limit:80})}catch{return[]}}async function oe(){try{return await s.v1.announcements.list()}catch{return[]}}let H=Xe(`@mastodon/filtered-notifications`),[se,G]=I(!1),[le,ue]=I({});function de(){return s.v2.notifications.policy.fetch().catch(()=>{})}function K(){de().then(e=>{ue(e)}).catch(()=>{})}let[fe,pe]=I(null);function me(){return s.v1.notifications.requests.list()}let q=e=>{if(T)return;let n=e.length;e.reduce((e,n)=>e+(n.notificationsCount||1),0);let r=e.filter(e=>e.type===`mention`).length,i={},a={};e.forEach(e=>{let{createdAt:n,notificationsCount:r,type:o}=e,s=new Date(n).toDateString();a[s]=(a[s]||0)+(r||1),o===`mention`&&(i[s]=(i[s]||0)+1)});let o=(n>0?r/n:0)<.33,s=Object.values(i).some(e=>e>30),c=e.some(e=>e.notificationsCount>30),l={},u=!1;for(let n of e){let{createdAt:e,notificationsCount:r}=n,i=new Date(e).toISOString().slice(0,13);if(l[i]=(l[i]||0)+(r||1),l[i]>30){u=!0;break}}E(o||s||c||u),k(Date.now())},ge=e=>{ve(!1),p(`loading`),(async()=>{try{let n=ie(e);e&&(oe().then(e=>{e.sort((e,n)=>Date.parse(n.updatedAt||n.createdAt)-Date.parse(e.updatedAt||e.createdAt)),V(e)}).catch(()=>{}),ae().then(e=>{B(e)}).catch(()=>{}),H&&K());let{done:r}=await n;S(!r),p(`default`)}catch{p(`error`)}})()};_(()=>{ge(!0)},[]),_(()=>{N&&ge(!0)},[N]);let[_e,ve]=I(!1),ye=y(({disableIdleCheck:e=!1}={})=>{f!==`loading`&&d.settings.autoRefresh&&A.current?.scrollTop<16&&(e||window.__IDLE__)&&!Nl()&&ge(!0)},[d.notificationsShowNew,d.settings.autoRefresh,f]),be=a();an(e=>{if(e){let e=Date.now()-be.current;!be.current||e>1e3*3?ye({disableIdleCheck:!0}):be.current=Date.now()}});let xe=a(!0);_(()=>{let e=x(o,`notificationsShowNew`,e=>{if(xe.current){xe.current=!1;return}f!==`loading`&&(e&&ye(),ve(e))});return()=>e?.()},[]);let Se=new Date,Ce=new Date(Se-1440*60*1e3),we=new Date,Te=!d.notifications.some(e=>new Date(e.createdAt).toDateString()===Se.toDateString()),Ee=a();_(()=>{g&&(o.routeNotification={id:g,accessToken:atob(v)})},[g,v]);let[De,Oe]=I(null);_(async()=>{let e=new Date;if(e.getMonth()!==11)return;let n=e.getFullYear();if(!Xe(`@mastodon/annual-report`))return;let r=F.account.get(`annualReportNotification`);if(r&&r?.annualReport?.year==n){Oe(r);return}let i=Ol({types:[`annual_report`]});try{r=(await i.next())?.value?.notificationGroups?.[0],r?.annualReport?.year==n&&(Oe(r),F.account.set(`annualReportNotification`,r))}catch{}},[]);let J=`.notification`,ke=$e(`j`,()=>{let e=document.activeElement.closest(J),n=e?.getBoundingClientRect(),r=Array.from(A.current.querySelectorAll(J));if(e&&n.top<A.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(Tl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Tl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),Ae=$e(`k`,()=>{let e=document.activeElement.closest(J),n=e?.getBoundingClientRect(),r=Array.from(A.current.querySelectorAll(J));if(e&&n.top<A.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(Tl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Tl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),je=$e([`enter`,`o`],()=>{let e=document.activeElement.closest(J)?.querySelector(`.status-link`);e&&e.click()},{useKey:!0,ignoreEventWhen:e=>e.key===`Enter`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`o`}),Me=$e(`.`,()=>{ge(!0),A.current?.scrollTo({top:0,behavior:`smooth`})},{useKey:!0,ignoreEventWhen:e=>e.key===`.`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),Ne=new Date,Pe=m(()=>xt(Ne,{forceOpts:{weekday:`long`}}),[Ne]);return R(`div`,{id:`notifications-page`,class:`deck-container`,ref:e=>{A.current=e,ke.current=e,Ae.current=e,je.current=e,Me.current=e},tabIndex:`-1`,children:[R(`div`,{class:`timeline-deck deck ${C?`only-mentions`:``}`,children:[R(`header`,{hidden:L,onClick:e=>{e.target.closest(`a, button`)||A.current?.scrollTo({top:0,behavior:`smooth`})},onDblClick:e=>{e.target.closest(`a, button`)||ge(!0)},class:f===`loading`?`loading`:``,children:[R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),R(Z,{to:`/`,class:`button plain`,children:R(X,{icon:`home`,size:`l`,alt:i({id:`i0qMbr`})})})]}),R(`h1`,{children:R(j,{id:`iDNBZe`})}),R(`div`,{class:`header-side`,children:H&&R(`button`,{type:`button`,class:`button plain4`,onClick:()=>{G(!0)},children:R(X,{icon:`settings`,size:`l`,alt:i({id:`a_-arl`})})})})]}),_e&&f!==`loading`&&R(`button`,{class:`updates-button shiny-pill`,type:`button`,onClick:()=>{ge(!0),A.current?.scrollTo({top:0,behavior:`smooth`})},children:[R(X,{icon:`arrow-up`}),` `,R(j,{id:`Jy9RU_`})]})]}),te.length>0&&R(`div`,{class:`shazam-container`,children:R(`div`,{class:`shazam-container-inner`,children:R(`details`,{class:`announcements`,children:[R(`summary`,{children:[R(`span`,{children:[R(X,{icon:`announce`,class:`announcement-icon`,size:`l`}),` `,R(j,{id:`0whvLM`,values:{0:te.length}}),` `,R(`small`,{class:`insignificant`,children:c})]}),te.length>1&&R(`span`,{class:`announcements-nav-buttons`,children:te.map((e,n)=>R(`button`,{type:`button`,class:`plain2 small`,onClick:()=>{Ee.current?.children[n].scrollIntoView({behavior:`smooth`,block:`nearest`})},children:n+1}))})]}),R(`ul`,{class:`announcements-list-${te.length>1?`multiple`:`single`}`,ref:Ee,children:te.map(e=>R(`li`,{children:R(Pl,{announcement:e})}))})]})})}),z.length>0&&R(`div`,{class:`follow-requests`,children:[R(`h2`,{class:`timeline-header`,children:R(j,{id:`6Fs1Ba`})}),z.length>5?R(`details`,{children:[R(`summary`,{children:R(j,{id:`7dHKu4`,values:{0:z.length}})}),R(`ul`,{children:z.map(e=>R(`li`,{children:[R(wt,{account:e}),R(is,{accountID:e.id,onChange:()=>{}})]},e.id))})]}):R(`ul`,{children:z.map(e=>R(`li`,{children:[R(wt,{account:e}),R(is,{accountID:e.id,onChange:()=>{}})]},e.id))})]}),H&&le?.summary?.pendingRequestsCount>0&&R(`div`,{class:`shazam-container`,children:R(`div`,{class:`shazam-container-inner`,children:R(`div`,{class:`filtered-notifications`,children:R(`details`,{onToggle:async e=>{let{open:n}=e.target;n&&pe(await me())},children:[R(`summary`,{children:R(j,{id:`N3Bq0f`,values:{0:le.summary.pendingRequestsCount}})}),fe?fe?.length>0&&R(`ul`,{children:fe.map(e=>R(`li`,{children:[R(`div`,{class:`request-notifcations`,children:[!e.lastStatus?.id&&R(wt,{useAvatarStatic:!0,showStats:!0,account:e.account}),e.lastStatus?.id&&R(`div`,{class:`last-post`,children:R(Z,{class:`status-link`,to:`/${c}/s/${e.lastStatus.id}`,children:R(Mt,{status:e.lastStatus,size:`s`,readOnly:!0})})}),R(Il,{request:e})]}),R(Ll,{request:e,onChange:()=>{ge(!0)}})]},e.id))}):R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})})]})})})}),De&&R(`div`,{class:`shazam-container`,children:R(`div`,{class:`shazam-container-inner`,children:R(ps,{notification:De})})}),!!D&&R(`div`,{id:`mentions-option`,children:T?R(Z,{to:`/mentions`,class:`button plain`,children:[R(X,{icon:`at`}),` `,R(`span`,{children:R(j,{id:`_bZzdR`})}),` `,R(X,{icon:`arrow-right`,class:`more-insignificant`})]}):R(`label`,{children:[R(`input`,{type:`checkbox`,checked:C,onChange:e=>{w(e.target.checked)}}),` `,R(j,{id:`0udtPI`})]})}),R(`h2`,{class:`timeline-header`,children:[R(j,{id:`ecUA8p`}),` `,R(`small`,{class:`insignificant bidi-isolate`,children:Pe})]}),Te&&R(`p`,{class:`ui-state insignificant`,children:f===`default`?i({id:`KS7iJH`}):R(n,{children:``})}),d.notifications.length?R(Gt.Provider,{value:`notifications`,children:d.notifications.filter(e=>e.type!==`follow_request`).map(e=>{if(C&&e.type!==`mention`)return null;let r=new Date(e.createdAt),a=r.toDateString()!==we.toDateString();a&&(we=r);let o=r.toDateString()===Ce.toDateString()?i({id:`y_0uwd`}):xt(we,{hideTime:!0}),s=xt(we,{forceOpts:{weekday:`long`}});return R(n,{children:[a&&R(`h2`,{class:`timeline-header`,children:[R(`span`,{children:o}),` `,R(`small`,{class:`insignificant bidi-isolate`,children:s})]}),R(ps,{instance:c,notification:e},e._ids||e.id)]},e._ids||e.id)})}):R(n,{children:[f===`loading`&&R(n,{children:R(`ul`,{class:`timeline flat`,children:Array.from({length:5}).map((e,n)=>R(`li`,{class:`notification skeleton`,children:[R(`div`,{class:`notification-type`,children:R(X,{icon:`notification`,size:`xl`})}),R(`div`,{class:`notification-content`,children:R(`p`,{children:`███████████ ████`})})]}))})}),f===`error`&&R(`p`,{class:`ui-state`,children:[R(j,{id:`gjzl8E`}),R(`br`,{}),R(`br`,{}),R(`button`,{type:`button`,onClick:()=>ge(!0),children:R(j,{id:`KDw4GX`})})]})]}),b&&R(He,{onChange:e=>{e&&ge()},children:R(`button`,{type:`button`,class:`plain block`,disabled:f===`loading`,onClick:()=>ge(),style:{marginBlockEnd:`6em`},children:f===`loading`?R(U,{abrupt:!0}):R(j,{id:`uXRAkV`})})})]}),H&&se&&R(zt,{onClick:e=>{e.target===e.currentTarget&&G(!1)},children:R(`div`,{class:`sheet`,id:`notifications-settings`,tabIndex:`-1`,children:[R(`button`,{type:`button`,class:`sheet-close`,onClick:()=>G(!1),children:R(X,{icon:`x`,alt:i({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:R(j,{id:`a_-arl`})})}),R(`main`,{children:R(`form`,{onSubmit:e=>{e.preventDefault();let{forNotFollowing:n,forNotFollowers:r,forNewAccounts:a,forPrivateMentions:o,forLimitedAccounts:c}=e.target,l={...le,forNotFollowing:n.value,forNotFollowers:r.value,forNewAccounts:a.value,forPrivateMentions:o.value,forLimitedAccounts:c.value};ue(l),G(!1),(async()=>{try{await s.v2.notifications.policy.update(l),Y(i({id:`4-7X9i`}))}catch{}})()},children:[R(`p`,{children:R(j,{id:`WrkPTf`})}),R(`div`,{class:`notification-policy-fields`,children:Al.map(e=>{let n=le[e];return R(`div`,{children:R(`label`,{children:[r(jl[e]),R(`select`,{name:e,defaultValue:n,class:`small`,children:[R(`option`,{value:`accept`,children:R(j,{id:`g3UF2V`})}),R(`option`,{value:`filter`,children:R(j,{id:`o7J4JM`})}),R(`option`,{value:`drop`,children:R(j,{id:`gbbkE7`})})]})]})},e)})}),R(`p`,{children:R(`button`,{type:`submit`,children:R(j,{id:`tfDRzk`})})})]})})]})})]})}function Nl(){return!!document.querySelector(`.deck-backdrop, #modal-container > *`)}function Pl({announcement:e}){let{instance:r}=u(),{contact:i}=se(),a=i?.account,{id:o,content:s,startsAt:c,endsAt:l,published:d,allDay:f,publishedAt:p,updatedAt:m,read:h,mentions:g,statuses:_,tags:v,emojis:y,reactions:b}=e,x=new Date(p),S=xt(x),C=new Date(m),w=xt(C);return R(`div`,{class:`announcement-block`,children:[R(wt,{account:a}),R(`div`,{class:`announcement-content`,onClick:et({mentions:g,instance:r}),dangerouslySetInnerHTML:{__html:We(s,{emojis:y})}}),R(`p`,{class:`insignificant`,children:[R(`time`,{datetime:x.toISOString(),children:xt(x)}),m&&w!==S&&R(n,{children:[` `,``,` `,R(`span`,{class:`ib`,children:R(j,{id:`TbFrLc`,values:{0:xt(C)},components:{0:R(`time`,{datetime:C.toISOString()})}})})]})]}),R(`div`,{class:`announcement-reactions`,hidden:!0,children:b.map(e=>{let{name:n,count:r,me:i,staticUrl:a,url:o}=e;return R(`button`,{type:`button`,class:`plain4 small ${i?`reacted`:``}`,children:[o||a?R(`img`,{src:o||a,alt:n,width:`16`,height:`16`}):R(`span`,{children:n}),` `,R(`span`,{class:`count`,children:Ze(r)})]})})})]})}function Fl(e){let{masto:n}=u();return n.v1.notifications.list({accountID:e})}function Il({request:e}){let{instance:r}=u(),[i,a]=I(`loading`),{account:o,lastStatus:s}=e,[c,l]=I(!1),[d,f]=I([]);function p(){l(!1)}return _(()=>{e?.account?.id&&c&&(a(`loading`),(async()=>{f(await Fl(e.account.id)||[]),a(`default`)})())},[c,e?.account?.id]),R(n,{children:[R(`button`,{type:`button`,class:`plain4 request-notifications-account`,onClick:()=>{l(!0)},children:[R(X,{icon:`notification`,class:`more-insignificant`}),` `,R(`small`,{children:R(j,{id:`H0wUNM`,values:{0:o.username},components:{0:R(`span`,{class:`bidi-isolate`})}})}),` `,R(X,{icon:`chevron-down`})]}),c&&R(zt,{onClick:e=>{e.target===e.currentTarget&&p()},children:R(`div`,{class:`sheet`,tabIndex:`-1`,children:[R(`button`,{type:`button`,class:`sheet-close`,onClick:p,children:R(X,{icon:`x`,alt:t`Close`})}),R(`header`,{children:R(`b`,{children:R(j,{id:`MXOmPt`,values:{0:o.username},components:{0:R(`span`,{class:`bidi-isolate`})}})})}),R(`main`,{children:i===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):d.map(e=>R(`div`,{class:`notification-peek`,onClick:e=>{let{target:n}=e;(e.target.tagName===`BUTTON`||e.target.tagName===`A`)&&p()},children:R(ps,{instance:r,notification:e,isStatic:!0})}))})]})})]})}function Ll({request:e,onChange:n}){let{_:r}=l(),{masto:i}=u(),[a,o]=I(`default`),[s,c]=I(null),d=s!==null;return R(`p`,{class:`notification-request-buttons`,children:[R(`button`,{type:`button`,disabled:a===`loading`||d,onClick:()=>{Ut.trigger(`success`),o(`loading`),(async()=>{try{await i.v1.notifications.requests.$select(e.id).accept(),c(`accept`),o(`default`),n({request:e,state:`accept`}),Y(r({id:`ZtBMwU`,values:{0:e.account.username}}))}catch{o(`error`),Y(r({id:`S92JKG`}))}})()},children:R(j,{id:`h7peZQ`})}),` `,R(`button`,{type:`button`,disabled:a===`loading`||d,class:`light danger`,onClick:()=>{Ut.trigger(`light`),o(`loading`),(async()=>{try{await i.v1.notifications.requests.$select(e.id).dismiss(),c(`dismiss`),o(`default`),n({request:e,state:`dismiss`}),Y(r({id:`ibBDry`,values:{0:e.account.username}}))}catch{o(`error`),Y(r({id:`S5aemF`}))}})()},children:R(j,{id:`1QfxQT`})}),R(`span`,{class:`notification-request-states`,children:a===`loading`?R(U,{abrupt:!0}):s===`accept`?R(X,{icon:`check-circle`,alt:r({id:`bzMKg7`}),class:`notification-accepted`}):s===`dismiss`&&R(X,{icon:`x-circle`,alt:r({id:`J6hrEy`}),class:`notification-dismissed`})})]})}var Rl=pe(Ml),zl=20;function Bl({local:e,columnMode:r,...i}){let{_:s}=l(),c=W(o),d=!!e,f=r?{}:k(),{masto:p,authenticated:m,instance:h}=u({instance:i?.instance||f.instance}),{instance:g}=u(),_=s(d?{id:`u96B_B`,values:{instance:h}}:{id:`PgVqvd`,values:{instance:h}});he(_,d?`/:instance?/p/l`:`/:instance?/p`);let v=a(),[y,b]=I(null),x=y===`disabled`,S=y===`authenticated`&&!m,C=a();async function w(e){if(e||!C.current){let e=await rl({feed:`liveFeeds`,feedType:d?`local`:`remote`,instance:h});if(b(e),e===`disabled`||e===`authenticated`&&!m)return{done:!0,value:[]};let n={limit:zl,local:d||void 0};!d&&Xe(`@pixelfed/global-feed`)&&(n.remote=!0),C.current=p.v1.timelines.public.list(n).values()}let n=await C.current.next(),{value:r}=n;return r?.length&&(e&&(v.current=r[0].id),r.forEach(e=>{O(e,h)})),{...n,value:r}}async function T(){if(x||S)return!1;try{let{value:e}=await p.v1.timelines.public.list({limit:1,local:d,since_id:v.current}).values().next(),n=e[0]?.id===v.current;return e?.length&&!n?(e=qt(e,`public`),!0):!1}catch{return!1}}return R(Xs,{title:_,titleComponent:R(`h1`,{class:`header-double-lines`,children:[R(`b`,{children:s(d?{id:`pJQgQV`}:{id:`cg0I-x`})}),R(`div`,{children:h})]}),id:`public`,instance:h,emptyText:s(x?{id:`qbE_m4`}:S?{id:`aqJggz`}:{id:`BiZJ6G`}),errorText:s({id:`scd9lw`}),fetchItems:w,checkForUpdates:T,useItemID:!0,headerStart:R(n,{}),boostsCarousel:c.settings.boostsCarousel,filterContext:`public`,headerEnd:R(tt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:R(`button`,{type:`button`,class:`plain`,children:R(X,{icon:`more`,size:`l`,alt:s({id:`2FYpfJ`})})}),children:[R(Q,{href:d?`/#/${h}/p`:`/#/${h}/p/l`,children:d?R(n,{children:[R(X,{icon:`transfer`}),` `,R(`span`,{children:R(j,{id:`dXMiUw`})})]}):R(n,{children:[R(X,{icon:`transfer`}),` `,R(`span`,{children:R(j,{id:`t2B_we`})})]})}),R(rt,{}),R(Q,{onClick:()=>{let e=prompt(s({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(s({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=d?`/${e}/p/l`:`/${e}/p`)},children:[R(X,{icon:`bus`}),` `,R(`span`,{children:R(j,{id:`kesYbo`})})]}),g!==h&&R(Q,{onClick:()=>{location.hash=d?`/${g}/p/l`:`/${g}/p`},children:[R(X,{icon:`bus`}),` `,R(`small`,{class:`menu-double-lines`,children:R(j,{id:`_AfxaA`,values:{currentInstance:g},components:{0:R(`b`,{})}})})]})]})},h+d)}function Vl({onItemClick:e}){let{_:n}=l(),{instance:r}=u(),[,i]=f(e=>e+1,0),a=hs(),o=()=>{ys(),Y({text:n({id:`hgPsUe`}),delay:1e3}),i()},s=(e,n)=>{vs(e,n),i()},[c]=ar();return a.length===0?null:R(`div`,{class:`recent-searches`,children:[R(`div`,{class:`recent-searches-header`,children:[R(X,{icon:`history`}),` `,R(`span`,{children:R(j,{id:`4R1B1H`})}),R(`span`,{class:`spacer`}),R(`button`,{type:`button`,class:`plain4 small`,onClick:o,disabled:a.length<=0,children:R(`span`,{children:R(j,{id:`yYxB17`})})})]}),R(`ul`,{class:`link-list recent-searches-list`,ref:c,children:a.map(i=>{let{label:a,to:o,icon:c}=bs(i.query,i.queryType,r);return R(`li`,{class:`recent-searches-item`,children:[R(Z,{to:o,class:`recent-searches-link`,onClick:n=>{_s(i.query,i.queryType),e?.(n)},children:[R(X,{icon:c,class:`more-insignificant`}),R(`span`,{class:`recent-searches-label`,children:a})]}),R(`button`,{type:`button`,class:`plain4 small`,onClick:()=>s(i.query,i.queryType),children:R(X,{icon:`trash`,alt:n({id:`xCJdfg`})})})]},`${i.query}-${i.queryType}-${i.timestamp}`)})})]})}var Hl=5,Ul=40,Wl=new URLSearchParams,Gl={block:`start`,inline:`center`,behavior:`instant`};function Kl({columnMode:e,...r}){let{_:i}=l(),{masto:o,instance:s,authenticated:c}=u({instance:(e?{}:k()).instance}),[d,f]=I(`default`),[p]=e?[Wl]:ce(),m=a(),h=r?.query||p.get(`q`),g=e?`statuses`:r?.type||p.get(`type`),v=i({id:`A1taO8`});if(h)switch(g){case`statuses`:v=i({id:`6YeoAt`,values:{q:h}});break;case`accounts`:v=i({id:`fpgumQ`,values:{q:h}});break;case`hashtags`:v=i({id:`AuiMZZ`,values:{q:h}});break;default:v=i({id:`wr3GZI`,values:{q:h}})}he(v,`/search`);let[y,b]=I(!1),x=a(0);_(()=>{x.current=0},[h,g]);let S=a();ee(()=>{S.current?.scrollTo?.(0,0)},[h,g]);let[C,w]=I([]),[T,E]=I([]),[D,O]=I([]);_(()=>{w([]),E([]),O([])},[h]);let A={statuses:C,accounts:T,hashtags:D},M={statuses:w,accounts:E,hashtags:O},[N,P]=I({}),F=async e=>{if(!e?.length)return;let n=await ze(e,N);n&&P({...N,...n})};function L(e){e&&(x.current=0),!(!e&&!c)&&(f(`loading`),e&&!g&&(w(C.slice(0,Hl)),E(T.slice(0,Hl)),O(D.slice(0,Hl))),(async()=>{let n={q:h,resolve:c,limit:Hl};g&&(n.limit=Ul,n.type=g,c&&(n.offset=x.current));try{let r=await o.v2.search.list(n);if(g)if(e){M[g](r[g]);let e=r[g]?.length;x.current=Ul,b(!!e)}else if(r[g]?.[0]?.id===A[g]?.[0]?.id)b(!1);else{M[g](e=>[...e,...r[g]]);let e=r[g]?.length;x.current+=Ul,b(!!e)}else w(r.statuses||[]),E(r.accounts||[]),O(r.hashtags||[]),x.current=0,b(!1);F(r.accounts),f(`default`)}catch{f(`error`)}})())}let z=a();an(e=>{let n=S.current?.scrollTop===0;if(e&&n){let e=Date.now()-z.current;!z.current||e>1e3*3?L(!0):z.current=Date.now()}}),_(()=>{let e;return m.current?.setValue?.(h||``),h?L(!0):e=setTimeout(()=>{m.current?.focus?.()},150),()=>clearTimeout(e)},[h,g,s]),$e([`Slash`,`/`],e=>{m.current?.focus?.(),m.current?.select?.()},{useKey:!0,preventDefault:!0,ignoreEventWhen:e=>e.key===`/`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey});let B=`.timeline > li > a, .hashtag-list > li > a`,te=$e(`j`,()=>{let e=document.activeElement.closest(B),n=e?.getBoundingClientRect(),r=Array.from(S.current.querySelectorAll(B));if(e&&n.top<S.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(Gl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Gl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),V=$e(`k`,()=>{let e=document.activeElement.closest(B),n=e?.getBoundingClientRect(),r=Array.from(S.current.querySelectorAll(B));if(e&&n.top<S.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(Gl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Gl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),[ne]=ar();return R(`div`,{id:`search-page`,class:`deck-container`,tabIndex:`-1`,ref:e=>{S.current=e,te.current=e,V.current=e},children:R(`div`,{class:`timeline-deck deck`,children:[R(`header`,{class:d===`loading`?`loading`:``,children:R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:R(Hs,{})}),R(xs,{ref:m}),R(`div`,{class:`header-side`,children:R(`button`,{type:`button`,class:`plain`,onClick:()=>{L(!0)},disabled:d===`loading`,children:R(X,{icon:`search`,size:`l`,alt:i({id:`A1taO8`})})})})]})}),R(`main`,{children:[!!h&&!e&&R(`div`,{ref:ne,class:`filter-bar ${d===`loading`?`loading`:``}`,children:[!!g&&R(Z,{to:`/search${h?`?q=${encodeURIComponent(h)}`:``}`,children:[R(X,{icon:`chevron-left`}),` `,R(j,{id:`N40H-G`})]}),[{label:i({id:`bPwFdf`}),type:`accounts`,to:`/search?q=${encodeURIComponent(h)}&type=accounts`},{label:i({id:`VwUsHI`}),type:`hashtags`,to:`/search?q=${encodeURIComponent(h)}&type=hashtags`},{label:i({id:`-owNNn`}),type:`statuses`,to:`/search?q=${encodeURIComponent(h)}&type=statuses`}].sort((e,n)=>e.type===g?-1:+(n.type===g)).map(e=>R(Z,{to:e.to,children:e.label},e.type))]}),h?R(n,{children:[(!g||g===`accounts`)&&R(n,{children:[g!==`accounts`&&R(`h2`,{class:`timeline-header`,children:[R(j,{id:`bPwFdf`}),` `,R(Z,{to:`/search?q=${encodeURIComponent(h)}&type=accounts`,children:R(X,{icon:`arrow-right`,size:`l`,alt:i({id:`V1fa9u`})})})]}),T.length>0?R(n,{children:[R(`ul`,{class:`timeline flat accounts-list`,children:T.map(e=>R(`li`,{children:R(wt,{account:e,instance:s,showStats:!0,relationship:N[e.id]})},e.id))}),g!==`accounts`&&R(`div`,{class:`ui-state`,children:R(Z,{class:`plain button`,to:`/search?q=${encodeURIComponent(h)}&type=accounts`,children:[R(j,{id:`BMmtZ8`}),` `,R(X,{icon:`arrow-right`})]})})]}):!g&&(d===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):R(`p`,{class:`ui-state`,children:R(j,{id:`YYB61U`})}))]}),(!g||g===`hashtags`)&&R(n,{children:[g!==`hashtags`&&R(`h2`,{class:`timeline-header`,children:[R(j,{id:`VwUsHI`}),` `,R(Z,{to:`/search?q=${encodeURIComponent(h)}&type=hashtags`,children:R(X,{icon:`arrow-right`,size:`l`,alt:i({id:`V1fa9u`})})})]}),D.length>0?R(n,{children:[R(`ul`,{class:`link-list hashtag-list`,children:D.map(e=>{let{name:n,history:r}=e,i=r?.reduce?.((e,n)=>e+ +n.uses,0);return R(`li`,{children:R(Z,{to:s?`/${s}/t/${n}`:`/t/${n}`,children:[R(X,{icon:`hashtag`,alt:`#`}),R(`span`,{children:n}),!!i&&R(`span`,{class:`count`,children:Ze(i)})]})},`${n}-${i}`)})}),g!==`hashtags`&&R(`div`,{class:`ui-state`,children:R(Z,{class:`plain button`,to:`/search?q=${encodeURIComponent(h)}&type=hashtags`,children:[R(j,{id:`Nc_W5J`}),` `,R(X,{icon:`arrow-right`})]})})]}):!g&&(d===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):R(`p`,{class:`ui-state`,children:R(j,{id:`4MFM3P`})}))]}),(!g||g===`statuses`)&&R(n,{children:[g!==`statuses`&&R(`h2`,{class:`timeline-header`,children:[R(j,{id:`-owNNn`}),` `,R(Z,{to:`/search?q=${encodeURIComponent(h)}&type=statuses`,children:R(X,{icon:`arrow-right`,size:`l`,alt:i({id:`V1fa9u`})})})]}),C.length>0?R(n,{children:[R(`ul`,{class:`timeline`,children:C.map(e=>R(`li`,{children:R(Z,{class:`status-link`,to:s?`/${s}/s/${e.id}`:`/s/${e.id}`,children:R(Mt,{status:e})})},e.id))}),g!==`statuses`&&R(`div`,{class:`ui-state`,children:R(Z,{class:`plain button`,to:`/search?q=${encodeURIComponent(h)}&type=statuses`,children:[R(j,{id:`LYCgej`}),` `,R(X,{icon:`arrow-right`})]})})]}):!g&&(d===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):R(`p`,{class:`ui-state`,children:R(j,{id:`Hzi9AA`})}))]}),!!g&&(d===`default`?y?R(He,{onChange:e=>{e&&L()},children:R(`button`,{type:`button`,class:`plain block`,onClick:()=>L(),style:{marginBlockEnd:`6em`},children:R(j,{id:`uXRAkV`})})}):R(`p`,{class:`ui-state insignificant`,children:R(j,{id:`2EYeAZ`})}):d===`loading`&&R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}))]}):d===`loading`?R(`p`,{class:`ui-state`,children:R(U,{abrupt:!0})}):R(n,{children:[R(`p`,{class:`ui-state insignificant`,children:R(j,{id:`fGn1Hk`})}),R(Vl,{})]})]})]})})}var ql=20,Jl=600*1e3,Yl=r(e=>e.v1.trends.links.list().values().next(),{expires:Jl}),Xl=r(e=>e.v1.trends.tags.list().values().next(),{expires:Jl});function Zl(e){return Xe(`@pixelfed/trending`)?e.pixelfed.v2.discover.posts.trending.list({range:`daily`}).values():e.v1.trends.statuses.list({limit:ql}).values()}function Ql(e,n){return e.v1.timelines.link.list(n).values()}function $l({columnMode:e,...r}){let{_:i}=l(),s=W(o),d=e?{}:k(),{masto:f,instance:p,authenticated:h}=u({instance:r?.instance||d.instance}),{masto:g,instance:v}=u(),y=i({id:`cI3UEs`,values:{instance:p}});he(y,`/:instance?/trending`);let b=a(),x=p===v,[S,C]=I([]),[w,T]=I([]),E=a();async function D(e){if(e||!E.current){if(E.current=Zl(f),Xe(`@mastodon/trending-hashtags`))try{let{value:e}=await Xl(f);e?.length&&C(e)}catch{}if(Xe(`@mastodon/trending-links`))try{let{value:e}=await Yl(f,p),n=e?.filter?.(e=>e.type===`link`);n?.length&&T(n)}catch{}}let n=await E.current.next(),{value:r}=n;return r?.length&&(e&&(b.current=r[0].id),r.forEach(e=>{O(e,p)})),{...n,value:r}}let[A,M]=I(!1),ee=a(),[N,P]=I(null),F=!!N,L=a(),z=x&&Xe(`@mastodon/trending-link-posts`);_(()=>{N&&L.current&&L.current.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[N]);let B=a();async function te(e){(e||!ee.current)&&(M(!0),ee.current=Ql(f,{url:N})),B.current=N;let n=await ee.current.next(),{value:r}=n;return r?.length&&(r=qt(r,`public`),r.forEach(e=>{O(e,p)})),B.current===N&&M(!1),{...n,value:r}}async function V(){try{let{value:e}=await f.v1.trends.statuses.list({limit:1}).values().next();return e=qt(e,`public`),e?.length&&e[0].id!==b.current?(b.current=e[0].id,!0):!1}catch{return!1}}let ne=m(()=>R(n,{children:[!!S.length&&R(`div`,{class:`filter-bar expandable`,children:[R(X,{icon:`chart`,class:`insignificant`,size:`l`}),S.map((e,n)=>{let{name:r,history:i}=e,a=i.reduce((e,n)=>e+ +n.uses,0);return R(Z,{to:`/${p}/t/${r}`,children:[R(`span`,{dir:`auto`,children:[R(`span`,{class:`more-insignificant`,children:`#`}),r]}),R(`span`,{class:`filter-count`,children:Ze(a)})]},r)})]}),!!w.length&&R(`div`,{class:`links-bar`,children:[R(`header`,{children:R(`h3`,{children:R(j,{id:`9veeTb`})})}),w.map(e=>{let{authors:r,authorName:i,authorUrl:a,blurhash:o,description:s,height:l,image:u,imageDescription:d,language:f,providerName:p,providerUrl:m,publishedAt:h,title:g,url:_,width:v}=e,y=r?.[0]?.account?.id?r[0].account:null,b=g.length<30,x=!!(i||y),S=c(_),C;if(o){let e=ya(gt(o));C=ha([.6,e[1],e[2]])}return R(`div`,{children:[R(`a`,{ref:N===_?L:null,href:_,target:`_blank`,rel:`noopener`,class:`link-block ${F?N===_?`active`:`inactive`:``}`,style:C?{"--accent-color":`rgb(${C.join(`,`)})`,"--accent-alpha-color":`rgba(${C.join(`,`)}, 0.4)`}:{},children:R(`article`,{children:[R(`figure`,{children:R(`img`,{src:u,alt:d,width:v,height:l,loading:`lazy`})}),R(`div`,{class:`article-body`,children:[R(`header`,{children:[R(`div`,{class:`article-meta`,children:[R(`span`,{class:`domain`,children:S}),` `,!!h&&R(n,{children:`· `}),!!h&&R(n,{children:R(Ct,{datetime:h,format:`micro`})})]}),!!g&&R(`h1`,{class:`title`,lang:f,dir:`auto`,title:g,children:g})]}),!!s&&R(`p`,{class:`description ${x&&!b?``:`more-lines`}`,lang:f,dir:`auto`,title:s,children:s}),x&&R(n,{children:[R(`hr`,{}),R(`p`,{class:`byline`,children:R(`small`,{children:R(j,{id:`aavdrC`,values:{0:y?R(qe,{account:y,showAvatar:!0}):a?R(`a`,{href:a,target:`_blank`,rel:`noopener`,children:i}):i}})})})]})]})]})}),z&&R(`button`,{type:`button`,class:`small plain4 block`,onClick:()=>{P(_)},disabled:_===N,children:[R(X,{icon:`comment2`}),` `,R(`span`,{children:R(j,{id:`_bZzdR`})}),` `,R(X,{icon:`chevron-down`})]})]},_)})]}),z&&!!w.length&&R(`div`,{class:`timeline-header-block ${F?`blended`:``}`,children:F?R(n,{children:[R(`div`,{style:{width:50,flexShrink:0,textAlign:`center`},children:A?R(U,{abrupt:!0}):R(`button`,{type:`button`,class:`light`,onClick:()=>{P(null)},children:R(X,{icon:`x`,alt:i({id:`9Q_4xJ`})})})}),R(`p`,{children:R(j,{id:`BATCqf`,values:{0:N.replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``)},components:{0:R(`span`,{class:`link-text`})}})})]}):R(`p`,{class:`insignificant`,children:R(j,{id:`Vosm4k`})})})]}),[S,w,N,A]);return R(Xs,{title:y,titleComponent:R(`h1`,{class:`header-double-lines`,children:[R(`b`,{children:R(j,{id:`4_iCqx`})}),R(`div`,{children:p})]}),id:`trending`,instance:p,emptyText:i({id:`6HA9-s`}),errorText:i({id:`scd9lw`}),fetchItems:F?te:D,checkForUpdates:F?void 0:V,checkForUpdatesInterval:300*1e3,useItemID:!0,headerStart:R(n,{}),boostsCarousel:s.settings.boostsCarousel,filterContext:`public`,timelineStart:ne,refresh:N,clearWhenRefresh:!0,view:F?`link-mentions`:void 0,headerEnd:R(tt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:R(`button`,{type:`button`,class:`plain`,children:R(X,{icon:`more`,size:`l`,alt:i({id:`2FYpfJ`})})}),children:[R(Q,{onClick:()=>{let e=prompt(i({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(i({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=`/${e}/trending`)},children:[R(X,{icon:`bus`}),` `,R(`span`,{children:R(j,{id:`kesYbo`})})]}),v!==p&&R(Q,{onClick:()=>{location.hash=`/${v}/trending`},children:[R(X,{icon:`bus`}),` `,R(`small`,{class:`menu-double-lines`,children:R(j,{id:`_AfxaA`,values:{currentInstance:v},components:{0:R(`b`,{})}})})]})]})},p)}var eu={block:`nearest`,inline:`nearest`,behavior:`instant`};function tu(){let{_:e}=l();he(e({id:`i0qMbr`}),`/`);let{shortcuts:n}=W(o),r=n.map(e=>{if(!e)return null;let{type:n,...r}=e,i={following:Gc,notifications:Rl,list:cl,public:Bl,bookmarks:dc,favourites:Mc,hashtag:ol,mentions:xl,trending:$l,search:Kl,profile:ac}[n];return!i||n===`search`&&!r.query||n===`list`&&!r.id?null:(n===`profile`&&(r.id=T()),R(i,{...r,columnMode:!0},n+JSON.stringify(r)))});return $e([`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],e=>{try{let n=parseInt(e.key,10)-1,r=document.querySelectorAll(`#columns > *`)[n];r&&(r.focus(),r.scrollIntoView(eu))}catch{}},{useKey:!0,ignoreEventWhen:e=>{let n=/^[1-9]$/.test(e.key);return e.metaKey||e.ctrlKey||e.altKey||e.shiftKey&&!n}}),$e([`[`,`]`],(e,n)=>{let r=n.keys[0],i=document.activeElement.closest(`#columns > *`),a=Re(),o=a?`]`:`[`,s=a?`[`:`]`,c;r===o?c=i?i.previousElementSibling:document.querySelectorAll(`#columns > *`)[0]:r===s&&(c=i?i.nextElementSibling:document.querySelectorAll(`#columns > *`)[1]),c&&(c.focus(),c.scrollIntoView(eu))},{useKey:!0,ignoreEventWhen:e=>[`[`,`]`].includes(e.key)?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),R(`div`,{id:`columns`,onContextMenu:e=>{e.target.closest(`.deck > header`)&&!e.target.closest(`a`)&&!e.target.closest(`button`)&&(e.preventDefault(),o.showShortcutsSettings=!0)},onFocus:()=>{let e=document.activeElement.closest(`#columns > *`);e&&document.querySelectorAll(`#columns > *`).forEach(n=>{n.classList.toggle(`focus`,n===e)})},children:r})}function nu(){let{_:r}=l(),i=W(o);return __BENCHMARK.end(`time-to-home`),_(()=>{(async()=>{let n=await Wt.drafts.keys();if(n.length){let r=e();n.filter(e=>e.startsWith(r)).length&&(o.showDrafts=!0)}})()},[]),R(n,{children:(i.settings.shortcutsViewMode===`multi-column`||!i.settings.shortcutsViewMode&&i.settings.shortcutsColumnsMode)&&i.shortcuts?.length?R(tu,{}):i.settings.paginatedTimeline?R(el,{title:r({id:`i0qMbr`}),path:`/`,id:`home`,headerStart:!1,headerEnd:R(ru,{})}):R(Gc,{title:r({id:`i0qMbr`}),path:`/`,id:`home`,headerStart:!1,headerEnd:R(ru,{})})})}function ru(){let{_:e}=l(),r=W(o),i=a(),[s,c]=I(void 0);return R(n,{children:[R(Z,{ref:i,to:`/notifications`,class:`button plain notifications-button ${r.notificationsShowNew?`has-badge`:``} ${s||``}`,onClick:e=>{e.stopPropagation(),window.matchMedia(`(min-width: calc(40em))`).matches&&(e.preventDefault(),c(e=>e?void 0:`open`))},children:R(X,{icon:`notification`,size:`l`,alt:e({id:`iDNBZe`})})}),R(au,{state:s,anchorRef:i,onClose:()=>c(void 0)})]})}var iu=5;function au({anchorRef:e,state:r,onClose:i}){let{masto:s,instance:c}=u(),l=W(o),[d,f]=I(`default`),p=Ol();async function m(){let e=await p.next(),n=gl(e.value);if(n?.length){n.forEach(e=>{O(e.status,c,{skipThreading:!0})});let e=kl(n);o.notificationsLast=e[0],o.notifications=e,s.v1.markers.create({notifications:{lastReadId:e[0].id}}).catch(()=>{})}return o.notificationsShowNew=!1,o.notificationsLastFetchTime=Date.now(),e}let[h,g]=I(!1);function v(){return s.v1.followRequests.list({limit:1})}function y({skipFollowRequests:e=!1}={}){f(`loading`),(async()=>{try{await m(),e||g(!!(await v())?.length),f(`default`)}catch{f(`error`)}})()}let b=a();return _(()=>{r===`open`&&(l.notificationsShowNew?b.current?.scrollTop<=52&&y({skipFollowRequests:!0}):y())},[r,l.notificationsShowNew]),R(at,{ref:b,menuClassName:`notifications-menu`,state:r,anchorRef:e,onClose:i,portal:{target:document.body},containerProps:{onClick:()=>{b.current?.closeMenu?.()}},overflow:`auto`,viewScroll:`close`,position:`anchor`,align:`center`,boundingBoxPadding:`8 8 8 8`,children:[R(`header`,{children:R(`h2`,{children:R(j,{id:`iDNBZe`})})}),R(Gt.Provider,{value:`notifications`,children:R(`main`,{children:l.notifications.length?R(n,{children:l.notifications.slice(0,iu).map(e=>R(ps,{instance:c,notification:e,disableContextMenu:!0},e._ids||e.id))}):d===`loading`?R(`div`,{class:`ui-state`,children:R(U,{abrupt:!0})}):d===`error`&&R(`div`,{class:`ui-state`,children:[R(`p`,{children:R(j,{id:`5GFQTh`})}),R(`p`,{children:R(`button`,{type:`button`,onClick:y,children:R(j,{id:`KDw4GX`})})})]})})}),R(`footer`,{children:[R(Z,{to:`/mentions`,class:`button plain`,children:[R(X,{icon:`at`}),` `,R(`span`,{children:R(j,{id:`_bZzdR`})})]}),R(Z,{to:`/notifications`,class:`button plain2`,children:[h?R(j,{id:`OdVhdR`,components:{0:R(`span`,{class:`tag collapsed`}),1:R(`span`,{})}}):R(`b`,{children:R(j,{id:`gukqfD`})}),` `,R(X,{icon:`arrow-right`})]})]})]})}var ou=pe(nu),su=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function cu(e){let n=URL.parse(e);if(!n)return{};let{hostname:r,pathname:i}=n;for(let e of su){let[,n]=i.match(e)||[];if(n)return{instance:r,id:n}}return{}}function lu(e){let{instance:n,id:r}=cu(e);return n&&r?`/${n}/s/${r}`:null}function uu(){let e=ie().pathname.replace(/^\//,``),r=cu(e),i=r?.instance?`/${r.instance}/s/${r.id}`:null,[a,o]=I(`loading`);return ee(()=>{o(`loading`),(async()=>{try{let{instance:e,id:n}=r;if(n){let{masto:r}=u({instance:e});if(await r.v1.statuses.$select(n).fetch()){window.location.hash=i+`?view=full`;return}}}catch{}{let{masto:n,instance:r}=u(),a=await n.v2.search.list({q:e,limit:1,resolve:!0});if(a.statuses.length){let e=a.statuses[0];window.location.hash=`/${r}/s/${e.id}?view=full`}else if(a.accounts.length){let e=a.accounts[0];window.location.hash=`/${r}/a/${e.id}`}else i?window.location.hash=i+`?view=full`:o(`error`)}})()},[i]),R(`div`,{class:`ui-state`,tabIndex:`-1`,children:[a===`loading`?R(n,{children:[R(U,{abrupt:!0}),R(`h2`,{children:R(j,{id:`RTAr_z`})}),R(`p`,{children:R(`a`,{href:e,target:`_blank`,rel:`noopener`,children:e})})]}):R(n,{children:[R(`h2`,{children:R(j,{id:`ufzZSJ`})}),R(`p`,{children:R(`a`,{href:e,target:`_blank`,rel:`noopener`,children:e})})]}),R(`hr`,{}),R(`p`,{children:R(Z,{to:`/`,children:R(j,{id:`iWpEwy`})})})]})}function du(){let{_:e}=l();he(e({id:`h16FyT`}),`/l`);let[r,i]=I(`default`),[a,o]=f(e=>e+1,0),[s,c]=I([]);_(()=>{i(`loading`),(async()=>{try{c(await vi()),i(`default`)}catch{i(`error`)}})()},[a]);let[u,d]=I(!1),p=s.some(e=>e.exclusive);return R(`div`,{id:`lists-page`,class:`deck-container`,tabIndex:`-1`,children:[R(`div`,{class:`timeline-deck deck`,children:[R(`header`,{children:R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),R(Z,{to:`/`,class:`button plain`,children:R(X,{icon:`home`,size:`l`})})]}),R(`h1`,{children:R(j,{id:`h16FyT`})}),R(`div`,{class:`header-side`,children:R(`button`,{type:`button`,class:`plain`,onClick:()=>d(!0),children:R(X,{icon:`plus`,size:`l`,alt:e({id:`Sb2gYF`})})})})]})}),R(`main`,{children:s.length>0?R(n,{children:[R(`ul`,{class:`link-list`,children:s.map(e=>R(`li`,{children:R(Z,{to:`/l/${e.id}`,children:[R(X,{icon:`list`}),` `,R(`span`,{children:[e.title,e.exclusive&&R(n,{children:[` `,R(Ei,{insignificant:!0})]})]})]})}))}),s.length>1&&R(`footer`,{class:`ui-state`,children:[p&&R(`p`,{children:R(`small`,{class:`insignificant`,children:[R(Ei,{}),` `,R(j,{id:`FNptcJ`})]})}),R(`p`,{children:R(`small`,{class:`insignificant`,children:R(j,{id:`8prZNK`,values:{0:s.length}})})})]})]}):r===`loading`?R(`p`,{class:`ui-state`,children:R(U,{})}):r===`error`?R(`p`,{class:`ui-state`,children:R(j,{id:`v_l5uA`})}):R(`p`,{class:`ui-state`,children:R(j,{id:`IvPikw`})})})]}),u&&R(zt,{onClick:e=>{e.target===e.currentTarget&&d(!1)},children:R(Di,{list:u?.list,onClose:e=>{e.state===`success`&&o(),d(!1)}})})]})}var fu=``+new URL(`instances-DWjbRJHw.json`,import.meta.url).href;function pu(e){let n=`popup,width=${Math.min(500,Math.floor(window.screen.width*.9))},height=${Math.min(600,Math.floor(window.screen.height*.8))}`;try{let r=window.open(e,`auth-popup`,n);return!r||r.closed||r.closed===void 0?null:r}catch{return null}}function mu(e){if(e&&!e.closed)try{e.close()}catch{}}function hu(e,n,r){let i=!1,a=e=>{e.origin===window.location.origin&&e.data&&e.data.type===`oauth-callback`&&(i=!0,s(),e.data.code?n(e.data.code):r(Error(`No authorization code received`)))};window.addEventListener(`message`,a);let o=setInterval(()=>{(!e||e.closed)&&(clearInterval(o),i||(i=!0,s(),r(Error(`Popup was closed before authentication completed`))))},500),s=()=>{window.removeEventListener(`message`,a),clearInterval(o),mu(e)};return s}var{PHANPY_DEFAULT_INSTANCE:gu}={};function _u(){let{_:e}=l();he(e({id:`sQia9P`}),`/login`);let n=a(),r=F.local.get(`instanceURL`),[i,o]=I(`default`),[s]=ce(),c=s.get(`instance`),u=s.get(`submit`),[d,f]=I(c||r?.toLowerCase()||``),[p,m]=I([]),h=a();_(()=>{(async()=>{try{let e=await(await fetch(fu)).json();m(e),h.current=new St(e)}catch{}})()},[]);let g=n=>{n&&(async()=>{try{let e=await(await fetch(`https://${n}/.well-known/host-meta`)).text(),r=new DOMParser().parseFromString(e,`text/xml`).getElementsByTagName(`Link`)[0].getAttribute(`template`),{host:i}=URL.parse(r);n!==i&&(n=i)}catch{}F.local.set(`instanceURL`,n),o(`loading`);try{let r=L(n);(!r||!r.client_id||!r.client_secret)&&(r=await yr({instanceURL:n}),H(n,r));let{client_id:i,client_secret:a}=r,s=await dr({instanceURL:n}),c=fe(n),l;if(s&&window.isSecureContext)if(i&&a){let[e,r]=await br({instanceURL:n,client_id:i,forceLogin:c});F.sessionCookie.set(`codeVerifier`,r),l=e}else{alert(e({id:`ZP1FIA`})),o(`default`);return}else if(i&&a)l=await xr({instanceURL:n,client_id:i,forceLogin:c});else{alert(e({id:`ZP1FIA`})),o(`default`);return}let u=pu(l);u?hu(u,e=>{let n=`${window.location.origin}${window.location.pathname}?code=${encodeURIComponent(e)}`;window.location.href=n},e=>{o(`error`)}):location.href=l,o(`default`)}catch{o(`error`)}})()},v=d?d.replace(/^https?:\/\//,``).replace(/\/+$/,``).replace(/^@?[^@]+@/,``).trim():null,y=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(v)&&!/[\s\/\\@]/.test(v),b=v?h.current?.search(v,{limit:10})?.map(e=>e.item):[],x=y?v:b?.length?b[0]:d?p.find(e=>e.includes(d)):null;return u&&_(()=>{g(c||x)},[]),R(`main`,{id:`login`,style:{textAlign:`center`},children:R(`form`,{onSubmit:e=>{e.preventDefault(),g(x)},children:[R(`h1`,{children:[R(`img`,{src:Dr,alt:``,width:`80`,height:`80`}),R(`br`,{}),R(j,{id:`sQia9P`})]}),R(`label`,{children:[R(`p`,{children:R(j,{id:`sGH11W`})}),R(`input`,{value:d,required:!0,type:`text`,class:`large`,id:`instanceURL`,ref:n,disabled:i===`loading`,autocorrect:`off`,autocapitalize:`off`,autocomplete:`off`,spellCheck:!1,placeholder:e({id:`0hbkwr`}),enterKeyHint:`go`,onInput:e=>{f(e.target.value)},dir:`auto`}),b?.length>0?R(`ul`,{id:`instances-suggestions`,children:b.map((e,n)=>R(`li`,{children:R(`button`,{type:`button`,class:`plain5`,onClick:()=>{g(e)},children:e})}))}):R(`div`,{id:`instances-eg`,children:R(j,{id:`_OvbEC`})})]}),i===`error`&&R(`p`,{class:`error`,children:R(j,{id:`yCXori`})}),R(`div`,{children:[R(`button`,{disabled:i===`loading`||!d||!x,children:e(x?{id:`2xahsi`,values:{selectedInstanceText:x}}:{id:`xGVfLh`})}),` `]}),R(U,{hidden:i!==`loading`}),R(`hr`,{}),!gu&&R(`p`,{children:R(`a`,{href:`https://joinmastodon.org/servers`,target:`_blank`,children:R(j,{id:`LcOiWS`})})}),R(`p`,{children:R(Z,{to:`/`,children:R(j,{id:`iWpEwy`})})}),R(kr,{})]})})}var vu=40;function yu(){let{_:e}=l(),n=W(o);he(e({id:`-GkIdc`}),`/sp`);let{masto:r}=u(),[i,a]=I([]),[s,c]=I(`default`),[d,p]=f(e=>e+1,0),[m,h]=I(!1);return _(p,[n.reloadScheduledPosts]),_(()=>{c(`loading`),(async()=>{try{let e=r.v1.scheduledStatuses.list({limit:vu}).values(),n=[],i;do i=(await e.next()).value,i?.length&&n.push(...i);while(i?.length);a(n)}catch{c(`error`)}finally{c(`default`)}})()},[d]),R(`div`,{id:`scheduled-posts-page`,class:`deck-container`,tabIndex:`-1`,children:R(`div`,{class:`timeline-deck deck`,children:[R(`header`,{children:R(`div`,{class:`header-grid`,children:[R(`div`,{class:`header-side`,children:[R(Hs,{}),R(Z,{to:`/`,class:`button plain`,children:R(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),R(`h1`,{children:R(j,{id:`-GkIdc`})}),R(`div`,{class:`header-side`,children:R(tt,{portal:!0,setDownOverflow:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:R(`button`,{type:`button`,class:`plain`,children:R(X,{icon:`more`,size:`l`,alt:e({id:`2FYpfJ`})})}),children:R(Q,{onClick:()=>{p()},children:[R(X,{icon:`refresh`,size:`l`}),R(`span`,{children:R(j,{id:`lCF0wC`})})]})})})]})}),R(`main`,{children:[i.length?R(`ul`,{class:`posts-list`,children:i.map(e=>{let{id:n,params:r,scheduledAt:i,mediaAttachments:a}=e,{inReplyToId:o,language:s,poll:c,sensitive:l,spoilerText:u,text:d,visibility:f,quotedStatusId:p,quoteApprovalPolicy:m}=r,g={id:n,inReplyToId:o,language:s,mediaAttachments:a,poll:c?{...c,expiresAt:new Date(Date.now()+c.expiresIn*1e3),options:c.options.map(e=>({title:e,votesCount:0}))}:void 0,sensitive:l,spoilerText:u,text:d,visibility:f,content:`<p>${d}</p>`,quotedStatusId:p,quoteApprovalPolicy:m};return R(`li`,{children:R(bu,{status:g,scheduledAt:i,onClick:()=>{h({post:g,scheduledAt:new Date(i)})}})},n)})}):R(`p`,{class:`ui-state`,children:s===`loading`?R(U,{}):e({id:`mZYb1f`})}),m&&R(zt,{onClick:e=>{e.target===e.currentTarget&&h(!1)},children:R(xu,{post:m.post,scheduledAt:m.scheduledAt,onClose:()=>h(!1)})})]})]})})}function bu({status:e,scheduledAt:n,onClick:r}){let i=m(()=>{let e=(Date.parse(n)-Date.now())/(1e3*60*60);return e<24?`time`:e<720?`day`:`month`},[n]);return R(`button`,{type:`button`,class:`textual block`,onClick:r,children:[R(`div`,{class:`post-schedule-meta post-schedule-${i}`,children:[R(X,{icon:i,class:`insignificant`}),` `,R(`span`,{children:R(j,{id:`aEp6lO`,values:{0:xt(n,{formatOpts:{weekday:`short`,second:`numeric`}})},components:{0:R(`b`,{}),1:R(Ct,{datetime:n}),2:R(`small`,{})}})})]}),R(Mt,{status:e,size:`s`,previewMode:!0,readOnly:!0})]})}function xu({post:e,scheduledAt:n,onClose:r}){let{masto:i,instance:a}=u(),{_:s}=l(),[c,d]=I(`default`),[f,p]=I(),m=f&&f.getTime()!==n.getTime(),h=It(),g=n&&n<=Date.now(),{inReplyToId:_}=e,[v,y]=I(null),{quotedStatusId:b}=e;return R(`div`,{id:`scheduled-post-sheet`,class:`sheet`,children:[R(`button`,{type:`button`,class:`sheet-close`,onClick:r,children:R(X,{icon:`x`,size:`l`,alt:s({id:`yz7wBu`})})}),R(`header`,{children:R(`h2`,{children:[R(j,{id:`orjBLU`,components:{0:R(`b`,{}),1:R(Ct,{datetime:n})}}),R(`br`,{}),R(`small`,{children:xt(n,{formatOpts:{weekday:`short`,second:`numeric`}})})]})}),R(`main`,{tabIndex:`-1`,children:[!!v&&R(`div`,{class:`status-reply`,children:R(Mt,{status:v,size:`s`,previewMode:!0,readOnly:!0})}),R(Mt,{status:e,size:`s`,previewMode:!0,readOnly:!0,onMediaClick:(n,r,i,a)=>{n.preventDefault(),o.showMediaModal={mediaAttachments:e.mediaAttachments,mediaIndex:r}}}),R(`form`,{onSubmit:n=>{n.preventDefault(),d(`loading`),(async()=>{try{await i.v1.scheduledStatuses.$select(e.id).update({scheduledAt:f.toISOString()}),Y(s({id:`40naR1`})),r(),d(`default`),o.reloadScheduledPosts++}catch{d(`error`),Y(s({id:`ZM3jAs`}))}})()},children:R(`footer`,{children:[R(`div`,{class:`row`,children:R(`span`,{children:[R(jt,{scheduledAt:n,setScheduledAt:e=>{p(e)}}),` `,R(`small`,{class:`ib`,children:h})]})}),R(`div`,{class:`row`,children:[R(`button`,{disabled:!m||c===`loading`||g,children:R(j,{id:`QqW27M`})}),R(`span`,{class:`grow`}),R(ut,{align:`end`,menuItemClassName:`danger`,confirmLabel:s({id:`09u3Kk`}),onClick:()=>{d(`loading`),(async()=>{try{await u().masto.v1.scheduledStatuses.$select(e.id).remove(),Y(s({id:`_zL_Mq`})),r(),d(`default`),o.reloadScheduledPosts++}catch{d(`error`),Y(s({id:`aOh6Md`}))}})()},children:R(`button`,{type:`button`,class:`light danger`,disabled:c===`loading`||g,children:R(j,{id:`Jb6_SB`})})})]})]})})]})]})}function Su(){let{_:e}=l(),{prevEditedAt:n,nextEditedAt:r,editedAtIndex:i,editHistoryMode:a,editHistoryRef:o,exitEditHistory:s}=Be();return a?R(`div`,{class:`edit-history-controls`,children:[R(X,{icon:`edit`}),R(`b`,{class:`edit-history-heading`,children:e({id:`HSA2au`})}),R(`span`,{class:`spacer`}),R(`span`,{class:`edit-history-pagination`,children:[R(`button`,{type:`button`,class:`plain4`,onClick:()=>{n()},disabled:!a||i+1>=o.current.length,children:R(X,{icon:`chevron-left`,alt:e({id:`DHhJ7s`})})}),` `,o.current.length-i,` /`,` `,o.current.length,` `,R(`button`,{type:`button`,class:`plain4`,onClick:()=>{r()},disabled:!a||i<=0,children:R(X,{icon:`chevron-right`,alt:e({id:`hXzOVo`})})})]}),R(`button`,{type:`button`,class:`plain3`,onClick:()=>{s()},children:R(X,{icon:`exit`,alt:e({id:`ydzS9x`})})})]}):null}var{PHANPY_DEFAULT_INSTANCE:Cu}={},wu=40,Tu=10,Eu=5,Du={},Ou={},ku={};function Au(e){delete Ou[e],delete ku[e]}var ju={block:`nearest`,inline:`center`,behavior:`instant`},Mu=`.status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)`,Nu=/\/s\//i;function Pu(e){let{_:n}=l(),{id:r}=e,{masto:i,instance:a}=u({instance:e.instance}),c=W(o),[d,f]=ce(),p=d.get(`media`),h=d.get(`media-only`),g=parseInt(p||h,10),v=g>0,b=d.get(`mediaStatusID`),x=Pe(b,a);b&&!x&&(v=!1);let S=v&&!!h,C=Ae(r,a),[w,T]=I(o.statuses[C]);_(()=>{o.statuses[C]&&T(o.statuses[C])},[C]),_(()=>{if(!w||!w.url)return;let e=document.querySelector(`link[rel="canonical"]`),n=null,r;return e?(n=e.href,e.href=w.url):(r=document.createElement(`link`),r.rel=`canonical`,r.href=w.url,document.head.appendChild(r)),()=>{e&&n?e.href=n:r&&document.head.removeChild(r)}},[w?.url]);let E=m(()=>{let{prevLocation:e}=o,n=(e?.pathname||``)+(e?.search||``),r=s(`/:instance/s/:id`,n)||s(`/s/:id`,n);return!n||r?`/`:n},[]);_(()=>{!w&&v&&(async()=>{try{let e=await i.v1.statuses.$select(r).fetch();O(e,a),T(e)}catch{alert(n({id:`H_MI1F`})),location.hash=E}})()},[v]);let D=b?c.statuses[Ae(b,a)]?.mediaAttachments:w?.mediaAttachments,k=()=>window.matchMedia(`(min-width: calc(40em + 350px))`).matches?`large`:`small`,A=y(()=>{k()===`small`&&c.prevLocation?history.back():S?location.hash=E:(d.delete(`media`),d.delete(`mediaStatusID`),f(d))},[S,E,c.prevLocation]),j=y((e,n,r,i)=>{if(k()===`large`&&!S){A();return}if(v&&document.startViewTransition){let{id:e,blurhash:a,url:o}=r[n],s=Dt(e||a||o),c=[...document.querySelectorAll(`.status .media [data-view-transition-name="${s}"]`)]?.filter?.(e=>{let n=e.getBoundingClientRect();return n.top<window.innerHeight&&n.bottom>0&&n.left<window.innerWidth&&n.right>0}),l=c.length===1?c[0]:c.find(e=>!!e.closest(`.status-deck`));l?document.startViewTransition(()=>{l.style.viewTransitionName=s,i?.current&&i.current.querySelectorAll(`.media img, .media video`)?.forEach(e=>{e.style.viewTransitionName=``}),A()}).ready.finally(()=>{l.style.viewTransitionName=``,l.dataset.viewTransitioned=s}):A()}else A()},[v,S]);return _(()=>{let e=setTimeout(()=>{let e=document.querySelector(`.carousel`);e&&e.focus()},100);return()=>clearTimeout(e)},[S]),_(()=>{let e=document.querySelectorAll(`.deck-container`);return e.forEach(e=>{e.setAttribute(`inert`,``)}),()=>{e.forEach(e=>{e.removeAttribute(`inert`)})}},[]),R(`div`,{class:`deck-backdrop`,children:[v?D?.length?R(ja,{mediaAttachments:D,statusID:b||r,instance:a,lang:w?.language,index:g-1,onClose:j}):R(`div`,{class:`media-modal-container loading`,children:R(U,{abrupt:!0})}):R(Z,{to:E}),!S&&R(nt,{statusID:r,children:R(zu,{id:r,instance:e.instance,closeLink:E})})]})}function Fu(e){let{linkable:n,to:r,onClick:i,...a}=e;return n?R(Z,{class:`status-link`,to:r,onClick:i,...a}):R(`div`,{class:`status-focus`,tabIndex:0,...a})}function Iu(e,n){return Date.parse(e.createdAt)-Date.parse(n.createdAt)}var Lu=1e3*60*60*24*30,Ru=typeof Intl?.Segmenter==`function`?new Intl.Segmenter:null;function zu({id:e,closeLink:r=`/`,instance:i}){let{_:s}=l(),[c,d]=ce(),f=c.get(`media`),p=c.get(`mediaStatusID`),h=parseInt(f,10)>0,g=a(!o.prevLocation&&(history.length===1||`navigation`in window&&navigation?.entries?.()?.length===1)),[v,b]=I(c.get(`view`)||g.current?`full`:null),x=!!parseInt(c.get(`translate`)),{masto:S,instance:w}=u({instance:i}),{masto:T,instance:E,authenticated:D}=u(),k=w===E,M=W(o),[N,P]=I([]),[F,L]=I(`default`),B=a(),te=Ae(e,w),V=a(0),ne=a();_(()=>{ne.current?.focus()},[]),_(()=>{let n=Zt(()=>{if(!ne.current)return;let{scrollTop:n}=ne.current;F!==`loading`&&(ku[e]=n)},50);return ne.current?.addEventListener(`scroll`,n,{passive:!0}),n(),()=>{n.cancel(),ne.current?.removeEventListener(`scroll`,n)}},[e,F!==`loading`]);let{editHistoryMode:re,initEditHistory:ie,editedAtIndex:ae,editHistoryRef:oe}=Be(),H=a(),se=a(),[G,le]=I(0),ue=a(null),de=()=>{if(!ue.current)return;let{ancestors:n,descendants:r,heroStatus:i}=ue.current;if(re&&r?.length){let e=oe.current[ae],n=Date.parse(e.createdAt),i=oe.current[ae-1],a=i?Date.parse(i.createdAt):null;r=r.filter(e=>{let r=Date.parse(e.editedAt||e.createdAt);return r>=n&&(!a||r<=a)})}n.sort(Iu),r.sort(Iu),V.current=r?.length||0;let a=new Set;n.forEach(e=>{O(e,w,{skipThreading:!0}),e.inReplyToId&&!n.find(n=>n.id===e.inReplyToId)&&a.add(e.inReplyToId)}),i.inReplyToId&&!n.find(e=>e.id===i.inReplyToId)&&a.add(i.inReplyToId),a.forEach(e=>{let r=n.find(n=>n.inReplyToId===e)||(i.inReplyToId===e?i:null);if(r){let a={id:e,ghost:{inReplyToAccountId:r.inReplyToAccountId}};if(r===i)n.push(a);else{let e=n.indexOf(r);n.splice(e,0,a)}}});let o=new Set,s=n.every(e=>e.ghost||e.account.id===i.account.id),c=[];r.forEach(e=>{if(O(e,w,{}),e.inReplyToId&&!r.find(n=>n.id===e.inReplyToId)&&e.inReplyToId!==i.id&&o.add(e.inReplyToId),e.inReplyToAccountId===e.account.id)c.push(e);else if(e.inReplyToId===i.id)c.push(e);else if(!e.inReplyToAccountId&&c.find(n=>n.id===e.inReplyToId&&n.account.id===i.account.id)&&e.account.id===i.account.id)c.push(e);else{let n=r.find(n=>n.id===e.inReplyToId);n&&(n.__replies||=[],n.__replies.push(e))}}),c.sort((e,n)=>{let r=i.account.id;return e.account.id===r&&n.account.id!==r?-1:+(n.account.id===r&&e.account.id!==r)}),o.size;let l=1;function u(e,n){let r=n+1;return r>l&&(l=n),e?.map(e=>({id:e.id,account:e.account,repliesCount:e.repliesCount,content:e.content,weight:Ku(e),level:r,replies:u(e.__replies,r)}))}let d=c.map(e=>({id:e.id,account:e.account,accountID:e.account.id,descendant:!0,thread:e.account.id===i.account.id,weight:Ku(e),level:1,replies:u(e.__replies,1),createdAt:e.createdAt}));return{allStatuses:[...n.map(e=>({id:e.id,ancestor:!0,ghost:e.ghost,isThread:s&&!e.ghost,accountID:e.account?.id,account:e.account,repliesCount:e.repliesCount,weight:e.ghost?0:Ku(e),createdAt:e.createdAt})),{id:e,accountID:i.account.id,weight:Ku(i),createdAt:i.createdAt},...d],ancestorsIsThread:s,mappedNestedDescendants:d}},fe=({reloadHero:n}={})=>{L(`loading`);let r=Ou[e];return P(r?r.filter(e=>o.statuses[te]):[{id:e}]),(async()=>{let r=()=>Qe(()=>S.v1.statuses.$select(e).fetch(),{retries:4}),i=Qe(()=>S.v1.statuses.$select(e).context.fetch(),{retries:8}),a=!!M.statuses[te],o=M.statuses[te];if(!(a&&!n))try{o=await r(),O(o,w),await new Promise(e=>{setTimeout(e,100)})}catch{L(`error`);return}try{let n=await i,{ancestors:r}=n;ue.current={...n,heroStatus:o};let{allStatuses:a,ancestorsIsThread:s,mappedNestedDescendants:c}=de(),l=r.length&&!s?[]:c.filter(e=>e.thread),u=(s?r.length:0)+l.length;u>0&&u<100&&le(u+1),L(`default`),H.current={offsetTop:B.current?.offsetTop,scrollTop:ne.current?.scrollTop};let d=r.length||0;d>=be&&xe(d+1),P(a),Ou[e]=a,A(o,w)}catch{L(`error`)}})(),se.current=Date.now(),()=>{clearTimeout(void 0)}};_(fe,[e,S]),_(()=>{try{let{allStatuses:e}=de();P(e)}catch{}},[re,ae]);let[pe,me]=I(!1);_(()=>{let e=setInterval(()=>{let e=Date.now();se.current&&e-se.current>=6e4&&me(!0)},6e4);return()=>{clearInterval(e)}},[]),ee(()=>{if(!N.length)return;let n=ku[e];if(n)ne.current.scrollTop=n;else if(H.current){let e={offsetTop:B.current?.offsetTop,scrollTop:ne.current?.scrollTop},n=e.offsetTop-H.current.offsetTop+e.scrollTop;ne.current.scrollTop=n}else N.length===1&&(ne.current.scrollTop=0);H.current=null},[N]),_(()=>{M.reloadStatusPage<=0||(async()=>{try{let{instanceURL:n}=z(),r=`https://${n}/api/v1/statuses/${e}/context`;return await(await caches.open(`api`)).delete(r,{ignoreVary:!0}),fe({reloadHero:!0})}catch{}})()},[M.reloadStatusPage]),_(()=>()=>{ku={},o.reloadStatusPage=0,Ou={},Du={},Gu.clear()},[]);let q=M.statuses[te]||M.statuses[e],ge=m(()=>{if(!q)return``;let{account:e}=q,n=document.createElement(`div`);return n.innerHTML=e.displayName,n.innerText.trim()},[q]),_e=m(()=>{if(!q)return``;let e=Ot(q);return e.length>64&&(e=(Ru?[...Ru.segment(e)].map(e=>e.segment):[...e]).slice(0,64).join(``)+``),e},[q]);he(ge&&_e?`${ge}: "${_e}"`:s({id:`post.title`}),`/:instance?/s/:id`);let ve=m(()=>{if(!q)return;let{url:e}=q;if(e)return URL.parse(e)?.hostname},[q]),ye=m(()=>{if(ve)return ve===w},[ve,w]),[be,xe]=I(wu),Se=m(()=>N.length-be,[N.length,be]),Ce=N.some(e=>e.descendant),we=N.filter(e=>e.ancestor),[Te,Ee]=I(!0),De=m(()=>{if(!B.current||Te)return null;let{top:e}=B.current.getBoundingClientRect();return e>0?`down`:`up`},[Te]);$e(`esc`,()=>{location.hash=r},{enabled:!h,ignoreEventWhen:e=>!!document.querySelector(`#modal-container > *`)||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey,useKey:!0}),$e(`backspace`,()=>{location.hash=r},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),$e(`j`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`),n=e?.getBoundingClientRect(),r=Array.from(ne.current.querySelectorAll(Mu));if(e&&n.top<ne.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(ju))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(ju))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),$e(`k`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`),n=e?.getBoundingClientRect(),r=Array.from(ne.current.querySelectorAll(Mu));if(e&&n.top<ne.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(ju))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(ju))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),$e(`x`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`);if(e){let n=e.nextElementSibling;n&&n.tagName.toLowerCase()===`details`&&(n.open=!n.open)}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`x`}),$e(`o`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`);if(e){let n=e.querySelector(`a.media:not(.status-card a.media)`);n&&n.click()}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`o`});let[Oe,J]=I(!1),ke=a(h?`media+status`:`status`),je=y((e,n,r,i)=>{e.preventDefault(),e.stopPropagation(),d({media:n+1,mediaStatusID:i.id})},[e]),Me=y((e,n)=>{Au(n.id)},[]);_(()=>{let e;return p&&h&&(e=setTimeout(()=>{let e=ne.current?.querySelector(`.status-link[href*="/${p}"]`);e&&e.scrollIntoView(ju)},400)),()=>{clearTimeout(e)}},[p,h]);let Ne=y((r,i)=>{let{id:a,ancestor:c,ghost:l,isThread:u,descendant:d,thread:f,replies:p,repliesCount:m,weight:h,level:g}=r,_=a===e;return R(`li`,{ref:_?B:null,class:`${c?`ancestor`:``} ${d?`descendant`:``} ${f?`thread`:``} ${_?`hero`:``}`,children:[_?R(n,{children:[R(He,{threshold:.1,onChange:e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Ee(e)})})},class:`status-focus`,tabIndex:0,children:R(Mt,{statusID:a,instance:w,withinContext:!0,size:`l`,enableTranslate:!0,forceTranslate:x})}),F!==`loading`&&!D?R(`div`,{class:`post-status-banner`,children:[R(`p`,{children:R(j,{id:`Vyeh4F`})}),R(Z,{to:Cu?`/login?instance=${Cu}&submit=1`:`/login`,class:`button`,children:R(j,{id:`sQia9P`})})]}):!k&&R(`div`,{class:`post-status-banner`,children:[R(`p`,{children:R(j,{id:`BrLbQp`,values:{instance:w},components:{0:R(`b`,{})}})}),R(`button`,{type:`button`,disabled:F===`loading`,onClick:()=>{L(`loading`),(async()=>{try{let e=await T.v2.search.list({q:q.url,type:`statuses`,resolve:!0,limit:1});if(e.statuses.length){let n=e.statuses[0];location.hash=E?`/${E}/s/${n.id}`:`/s/${n.id}`}else throw Error(`No results`)}catch(e){L(`default`),alert(s({id:`DnepCE`,values:{e}}))}})()},children:[R(X,{icon:`transfer`}),` `,R(j,{id:`jtQUzv`})]})]})]}):R(Fu,{linkable:!l&&(u||c),to:w?`/${w}/s/${a}`:`/s/${a}`,onClick:()=>{Au(a)},children:[l?R(Mt,{statusID:a,instance:w,withinContext:!0,size:`m`,ghost:l}):i===0&&c?R(He,{threshold:.5,onChange:e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{J(e)})})},children:R(Mt,{statusID:a,instance:w,withinContext:!0,size:f||c?`m`:`s`,enableTranslate:!0,onMediaClick:je,onStatusLinkClick:Me})}):R(Mt,{statusID:a,instance:w,withinContext:!0,size:f||c?`m`:`s`,enableTranslate:!0,onMediaClick:je,onStatusLinkClick:Me,showActionsBar:!!d}),c&&m>1&&R(`div`,{class:`replies-link`,children:[R(X,{icon:`comment2`,alt:s({id:`N8UzTV`})}),` `,R(`span`,{title:m,children:Ze(m)})]}),` `]}),d&&p?.length>0&&R(Bu,{instance:w,replies:p,hasParentThread:f,level:g,accWeight:h,openAll:V.current<Tu,lazyRenderReplies:V.current>wu,parentLink:{to:w?`/${w}/s/${a}`:`/s/${a}`,onClick:()=>Au(a)}}),F===`loading`&&_&&!!q?.repliesCount&&!Ce&&R(`div`,{class:`status-loading`,children:R(U,{abrupt:q.repliesCount>=3})}),F===`error`&&_&&!!q?.repliesCount&&!Ce&&R(`div`,{class:`status-error`,children:[R(j,{id:`HQJU6W`}),R(`br`,{}),R(`button`,{type:`button`,class:`plain`,onClick:()=>{o.reloadStatusPage++},children:R(j,{id:`KDw4GX`})})]})]},a)},[e,w,F,D,k,x,je,Me,Ce]),Pe=m(()=>{if(`navigation`in window&&navigation?.entries){let e=navigation.entries()[navigation.currentEntry.index-1];if(e?.url)return Nu.test(e.url)}return Nu.test(o.prevLocation?.pathname)},[te]),Fe=m(()=>{let e=[];function n(r){e.push(r.id);let i=r.quote?.quotedStatus?.id||r.quote?.id;i&&e.push(i),r.replies&&r.replies.forEach(n)}return N.forEach(n),e.map(e=>Ae(e,w))},[N,w]);function Ie(e){if(e<12)return K._({id:`DqsEm-`,values:{months:e}});{let n=Math.floor(e/12);return K._({id:`24w-FD`,values:{years:n}})}}let Le=m(()=>{let e=[],n=N.slice(0,be);for(let r=0;r<n.length;r++){let i=n[r];if(r>0){let a=n[r-1],{createdAt:o,descendant:s,thread:c,id:l}=i;if(a?.createdAt&&o){let n=Date.parse(o);if(isFinite(n)&&n>Lu){let r=Date.parse(a.createdAt);if(r&&isFinite(r)){let{ancestor:i,id:o}=a,u=~~((n-r)/Lu);u>0&&e.push(R(`li`,{style:{"--time-gap-range":Math.min(12,u)},class:`time-gap ${i?`ancestor`:``} ${s?`descendant`:``} ${c?`thread`:``}`,children:Ie(u)},`time-gap-${l}-${o}`))}}}}e.push(Ne(i,r))}return e},[N,be,Ne,re,ae]);return _(()=>{let e=setTimeout(()=>{if(!B.current)return;let e=B.current.querySelector(`.spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)`);e&&e.click()},1e3);return()=>clearTimeout(e)},[e]),R(ht.Provider,{value:G,children:R(`div`,{tabIndex:`-1`,ref:ne,class:`status-deck deck contained ${N.length>1?`padded-bottom`:``} ${ke.current===`status`&&!g.current?`slide-in`:``} ${v?`deck-view-${v}`:``} ${re?`edit-history-mode`:``}`,style:re?{"--edit-history-percentage":`${ae/(oe.current.length-1)}`}:void 0,onAnimationEnd:e=>{ke.current===`status`&&(ke.current=null)},children:[R(`header`,{class:`${F===`loading`?`loading`:``}`,onDblClick:e=>{o.reloadStatusPage++},children:R(`div`,{class:`header-grid header-grid-2`,children:[R(`h1`,{children:[Pe&&R(`button`,{type:`button`,class:`plain deck-back`,onClick:()=>{history.back()},children:R(X,{icon:`chevron-left`,size:`xl`,alt:s({id:`iH8pgl`})})}),!Te&&q&&F!==`loading`?R(n,{children:[R(`span`,{class:`hero-heading`,children:[R(qe,{account:q.account,instance:w,showAvatar:!0,short:!0}),` `,R(`span`,{class:`insignificant`,children:[``,` `,R(Ct,{datetime:q.createdAt,format:`micro`})]})]}),` `,R(`button`,{type:`button`,class:`ancestors-indicator light small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),B.current.scrollIntoView({behavior:`smooth`,block:`start`})},title:s({id:`NCy-Nw`}),children:R(X,{icon:De===`down`?`arrow-down`:`arrow-up`})})]}):R(n,{children:[R(j,{id:`post.title`}),` `,R(`button`,{type:`button`,class:`ancestors-indicator light small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),ne.current.scrollTo({top:0,behavior:`smooth`})},hidden:!we.length||Oe,title:s({id:`R8CUl0`,values:{0:we.length}}),children:[R(X,{icon:`arrow-up`}),we.filter(e=>!e.ghost).filter((e,n,r)=>r.findIndex(n=>n.accountID===e.accountID)===n).slice(0,3).map(e=>R(vt,{url:e.account.avatarStatic||e.account.avatar,alt:e.account.displayName,squircle:e.account?.bot},e.account.id)),we.length>3&&R(n,{children:[` `,R(`span`,{class:`insignificant`,children:Ze(we.length)})]})]})]})]}),R(`div`,{class:`header-side`,children:[R(`button`,{type:`button`,class:`plain4 button-switch-view`,style:{display:v===`full`?``:`none`},onClick:()=>{b(null),c.delete(`media`),c.delete(`media-only`),c.delete(`view`),d(c)},title:s({id:`-_xYEI`}),children:R(X,{icon:`layout4`,size:`l`})}),pe&&R(`button`,{type:`button`,class:`plain button-refresh`,onClick:()=>{o.reloadStatusPage++,me(!1)},children:R(X,{icon:`refresh`,size:`l`,alt:s({id:`lCF0wC`})})}),R(tt,{align:`end`,portal:{target:ne.current},menuButton:R(`button`,{type:`button`,class:`button plain4`,children:R(X,{icon:`more`,alt:s({id:`2FYpfJ`}),size:`xl`})}),children:[R(Q,{disabled:F===`loading`,onClick:()=>{o.reloadStatusPage++},children:[R(X,{icon:`refresh`}),R(`span`,{children:R(j,{id:`lCF0wC`})})]}),R(Q,{className:`menu-switch-view`,onClick:()=>{b(v===`full`?null:`full`),c.delete(`media`),c.delete(`media-only`),v===`full`?c.delete(`view`):c.set(`view`,`full`),d(c)},children:[R(X,{icon:{"":`layout5`,full:`layout4`}[v||``]}),R(`span`,{children:s(v===`full`?{id:`-_xYEI`}:{id:`2LiWsE`})})]}),R(Q,{onClick:()=>{Array.from(ne.current.querySelectorAll(`.spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)`)).forEach(e=>{e.click()})},children:[R(X,{icon:`eye-open`}),` `,R(`span`,{children:R(j,{id:`8r8KmB`})})]}),R(rt,{}),R(Kt,{className:`plain`,children:R(j,{id:`Rsjgm0`})}),R(Q,{disabled:!ve||ye,onClick:()=>{let e=lu(q.url);e?location.hash=e:alert(s({id:`9J6biQ`}))},children:[R(X,{icon:`transfer`}),R(`small`,{class:`menu-double-lines`,children:s(ve?{id:`yi60j9`,values:{0:C.toUnicode(ve)}}:{id:`rWTcqf`})})]}),R(Q,{disabled:!k||F===`loading`||!q?.editedAt||!V.current,onClick:ie,children:[R(X,{icon:`edit`}),R(`span`,{children:s({id:`OqaQnE`})})]})]}),R(Z,{class:`button plain deck-close`,to:r,children:R(X,{icon:`x`,size:`xl`,alt:s({id:`yz7wBu`})})})]})]})}),R(Su,{}),N.length&&q?R(`ul`,{class:`timeline flat contextual grow ${F===`loading`?`loading`:``}`,children:[Le,Se>0&&R(`li`,{class:`descendant descendant-more`,children:R(`button`,{type:`button`,class:`plain block show-more`,disabled:F===`loading`,onClick:()=>xe(e=>e+wu),style:{marginBlockEnd:`6em`},children:[R(`div`,{class:`ib avatars-bunch`,children:N.slice(be,be+5).map(e=>R(vt,{url:e.account.avatarStatic},e.id))}),` `,R(`div`,{class:`ib`,children:[R(j,{id:`uXRAkV`}),` `,R(`span`,{class:`tag`,children:Se>wu?`${wu}+`:Se})]})]})})]}):R(n,{children:[F===`loading`&&R(`ul`,{class:`timeline flat contextual grow loading`,children:R(`li`,{children:R(Mt,{skeleton:!0,size:`l`})})}),F===`error`&&R(`p`,{class:`ui-state`,children:[R(j,{id:`JWxodU`}),R(`br`,{}),R(`br`,{}),R(`button`,{type:`button`,onClick:()=>{o.reloadStatusPage++},children:R(j,{id:`KDw4GX`})})]})]}),R(`div`,{"data-state-post-ids":Fe.join(` `),hidden:!0})]})})}function Bu({replies:e,instance:r,hasParentThread:i,level:o,accWeight:s,openAll:c,parentLink:u,lazyRenderReplies:d}){let{_:f}=l(),[p,h]=ce(),g=e=>e.reduce((e,n)=>{let{repliesCount:r,replies:i}=n;return e+(i?.length||r)+g(i||[])},0),v=e.length+g(e),b=e.length===v,x=e.map(e=>e.account).filter((e,n,r)=>r.findIndex(n=>n.id===e.id)===n).slice(0,3),S=m(()=>e?.reduce((e,n)=>e+n?.weight,s),[s,e?.length]),C=!1;(c||S<=Eu||!i&&v===1&&Ku(e[0])<2)&&(C=!0);let w=Du[e[0].id],T=y((e,n,r,i)=>{e.preventDefault(),e.stopPropagation(),h({media:n+1,mediaStatusID:i.id})},[]),E=a();ee(()=>{function e(e){e.target.dataset.scrollLeft=e.target.scrollLeft}return E.current?.addEventListener(`scroll`,e,{passive:!0}),()=>{E.current?.removeEventListener(`scroll`,e)}},[]);let[D,O]=I(w||C),k=d?D:!0,[A,M]=I(k);_(()=>{M(k)},[k]);let N=C?`div`:`details`,P=N===`details`;return R(N,{ref:E,class:`replies`,open:P?w||C:void 0,onToggle:P?n=>{let{open:r}=n.target;O(r),Du[e[0].id]=r}:void 0,style:{"--comments-level":o},"data-comments-level":o,"data-comments-level-overflow":o>4,children:[!C&&R(`summary`,{class:`replies-summary`,hidden:C,children:[R(`span`,{class:`avatars`,children:x.map(e=>R(vt,{url:e.avatarStatic,title:`${e.displayName} @${e.username}`,squircle:e?.bot},e.id))}),R(`span`,{class:`replies-counts`,children:[R(`b`,{children:R(j,{id:`DOQUen`,values:{0:e.length,1:Ze(e.length)},components:{0:R(`span`,{title:e.length})}})}),!b&&v>1&&R(n,{children:[` `,`·`,` `,R(`span`,{children:R(j,{id:`qSQQSe`,values:{0:Ze(v),totalComments:v},components:{0:R(`span`,{title:v})}})})]})]}),R(X,{icon:`chevron-down`,class:`replies-summary-chevron`}),!!u&&R(Z,{class:`replies-parent-link`,to:u.to,onClick:u.onClick,title:f({id:`ZlV82A`}),children:`»`})]}),A&&R(`ul`,{children:e.map(e=>R(`li`,{children:[R(`div`,{class:`status-focus`,tabIndex:0,children:[R(Mt,{statusID:e.id,instance:r,withinContext:!0,size:`s`,enableTranslate:!0,onMediaClick:T,showActionsBar:!0}),!e.replies?.length&&e.repliesCount>0&&R(`div`,{class:`replies-link`,children:[R(X,{icon:`comment2`,alt:f({id:`N8UzTV`})}),` `,R(`span`,{title:e.repliesCount,children:Ze(e.repliesCount)})]})]}),e.replies?.length&&R(Bu,{instance:r,replies:e.replies,level:e.level,accWeight:C?S:e.weight,openAll:c,lazyRenderReplies:d,parentLink:{to:r?`/${r}/s/${e.id}`:`/s/${e.id}`,onClick:()=>{Au(e.id)}}})]},e.id))})]})}var Vu=140,Hu=35,Uu=70,Wu=140,Gu=new Map;function Ku(e){let n=Gu.get(e.id);if(n)return n;let{spoilerText:r,content:i,mediaAttachments:a,poll:o,card:s}=e,c=Ht(r+i),l=a?.length?Vu:0,u=(o?.options?.length||0)*Hu,d=s&&(a?.length||o?.options?.length)?0:Uu,f=(c+l+u+d)/Wu;return Gu.set(e.id,f),f}var qu=pe(Pu);function Ju(){let{id:e,instance:n}=k();return R(qu,{id:e,instance:n})}var Yu=``+new URL(`boosts-carousel-BiOaNdMT.jpg`,import.meta.url).href,Xu=``+new URL(`multi-column-ROck0NVt.jpg`,import.meta.url).href,Zu=``+new URL(`multi-hashtag-timeline-DH5INVHi.jpg`,import.meta.url).href,Qu=``+new URL(`nested-comments-thread-hv59kZLc.jpg`,import.meta.url).href,$u=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2093%2027'%3e%3cpath%20fill='%2382a0ef'%20d='M1.96%2021.31c1.26%200%201.99-.79%201.99-2.14v-4.86h3.79c4.29%200%207-2.45%207-6.58%200-3.96-2.68-6.56-6.84-6.56H2.85c-2.07%200-2.86.81-2.86%202.89v15.12c0%201.35.72%202.14%201.96%202.14Zm1.99-10.08v-6.9h3.46c2.17%200%203.4%201.26%203.4%203.46%200%202.55-1.25%203.44-4.32%203.44zm26.04%207.96v-8.41c0-3.38-1.93-5.41-5.17-5.41-2.21%200-4.12%201.23-4.64%202.99h-.19V2.13c0-1.36-.69-2.14-1.92-2.14-1.25%200-1.93.78-1.93%202.14v17.05c0%201.36.69%202.12%201.92%202.12s1.93-.76%201.93-2.12v-6.67c0-2.39%201.3-3.9%203.28-3.9%201.8%200%202.86%201.16%202.86%203.19v7.37c0%201.36.69%202.12%201.93%202.12%201.23%200%201.93-.78%201.93-2.12Zm10.95%200h.19v.54c.12%201.01.79%201.58%201.82%201.58%201.2%200%201.88-.75%201.88-2.07v-8.5c0-3.44-2.29-5.38-6.36-5.38q-2.53.01-3.98.81c-1.36.69-1.99%201.61-1.99%202.52%200%20.79.53%201.36%201.38%201.36.63%200%201.04-.16%201.48-.51a4%204%200%200%201%202.87-1.22c1.77%200%202.75.82%202.75%202.39v1.27h-3.69c-3.53%200-5.65%201.77-5.65%204.64%200%202.83%202.05%204.73%205.08%204.73%201.9%200%203.44-.79%204.23-2.18Zm-5.48-2.78c0-1.27.94-2.04%202.52-2.04h2.99v1.61c0%201.46-1.3%202.61-2.97%202.61-1.51%200-2.53-.89-2.53-2.18Zm25.55%202.79v-8.45c0-3.41-1.88-5.38-5.19-5.38-2.29%200-4.03%201.14-4.63%202.99H51v-.95c-.04-1.25-.72-1.93-1.88-1.93-1.17%200-1.9.79-1.9%202.07V19.2c0%201.36.7%202.12%201.93%202.12s1.93-.76%201.93-2.12v-6.67c0-2.42%201.26-3.9%203.27-3.9%201.79%200%202.8%201.14%202.8%203.18v7.38c0%201.36.69%202.12%201.93%202.12%201.23%200%201.92-.75%201.92-2.11Zm6.36%205.37V18.8h.19c.69%201.64%202.29%202.58%204.41%202.58%203.65%200%205.84-2.61%205.84-6.93V12.3c0-4.32-2.17-6.91-5.79-6.91-2.18%200-3.9%201.04-4.53%202.71h-.19v-.75c-.09-1.2-.76-1.86-1.9-1.86-1.22%200-1.89.76-1.89%202.14v16.95c0%201.36.69%202.12%201.92%202.12%201.25%200%201.93-.76%201.93-2.12Zm0-10.06v-2.07c0-2.49%201.25-3.97%203.27-3.97%202.07%200%203.24%201.52%203.24%204.2v1.41c0%202.67-1.17%204.2-3.21%204.2-1.98%200-3.3-1.49-3.3-3.78ZM78.73%2025q0%20.62.42%201.04c.45.44%201.25.67%202.26.67%203.12%200%204.92-1.44%206.14-4.92l4.67-13.4c.16-.45.22-.76.22-1.05%200-1.04-.78-1.8-1.83-1.8q-1.5-.01-1.98%201.85l-3.05%2010.59h-.16L82.4%207.39q-.46-1.86-2.01-1.85c-1.1%200-1.9.78-1.9%201.82q-.02.42.19%201.04l4.57%2012.96c0%20.1-.15.75-.19.83-.32%201-1.05%201.64-1.93%201.64-.44%200-.7-.07-1.01-.07-.83%200-1.39.53-1.39%201.25Z'/%3e%3c/svg%3e`,ed=``+new URL(`home-mobile-dark@2x-Dc-J8-SM.png`,import.meta.url).href,td=``+new URL(`home-mobile-light@2x-Bd3fod8m.png`,import.meta.url).href,nd=``+new URL(`home-tablet-dark@2x-BgcNI8le.png`,import.meta.url).href,rd=``+new URL(`home-tablet-light@2x-BW2RV9T6.png`,import.meta.url).href,{PHANPY_DEFAULT_INSTANCE:id,PHANPY_WEBSITE:ad,PHANPY_PRIVACY_POLICY_URL:od,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:sd}={PHANPY_PRIVACY_POLICY_URL:`https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD`},cd=ad?ad.replace(/https?:\/\//g,``).replace(/\/$/,``):null,ld=ad?ad.toLowerCase().includes(location.hostname):!1,ud=`${`2026-05-21`.replace(/-/g,`.`)}.387a188`;function dd(){let{_:e}=l();return he(null,[`/`,`/welcome`]),R(`main`,{id:`welcome`,children:[R(`div`,{class:`hero-container`,children:R(`div`,{class:`hero-content`,children:[R(`h1`,{children:[R(`img`,{src:Dr,alt:``,width:`100`,height:`100`}),R(`img`,{src:$u,alt:`Phanpy`,width:`180`,height:`52`})]}),R(`p`,{class:`desc`,children:R(j,{id:`Ogtv0V`})}),R(`p`,{children:R(Z,{to:id?`/login?instance=${id}&submit=1`:`/login`,class:`button plain6`,children:e(id?{id:`sQia9P`}:{id:`ZLoGls`})})}),id&&sd&&R(`p`,{children:R(`a`,{href:sd,class:`button plain5`,children:R(j,{id:`e-RpCP`})})}),!id&&R(`p`,{class:`insignificant`,children:R(`small`,{children:R(j,{id:`fvAsUK`,components:{0:R(`br`,{})}})})})]})}),R(`div`,{id:`device-showcase`,children:[R(`div`,{class:`device mobile`,children:R(`div`,{class:`device-frame`,children:R(`picture`,{children:[R(`source`,{srcSet:ed,media:`(prefers-color-scheme: dark)`}),R(`img`,{src:td,alt:e({id:`LVd2Ia`}),width:`375`,height:`812`,loading:`lazy`})]})})}),R(`div`,{class:`device tablet`,children:R(`div`,{class:`device-frame`,children:R(`picture`,{children:[R(`source`,{srcSet:nd,media:`(prefers-color-scheme: dark)`}),R(`img`,{src:rd,alt:e({id:`6XjvUL`}),width:`768`,height:`1024`,loading:`lazy`})]})})})]}),R(`div`,{id:`why-container`,children:R(`div`,{class:`sections`,children:[R(`section`,{children:[R(`img`,{src:Yu,alt:e({id:`S5cYrQ`}),width:`400`,height:`303`,loading:`lazy`}),R(`div`,{children:[R(`h4`,{children:R(j,{id:`Tu-sCN`})}),R(`p`,{children:R(j,{id:`e2uVlo`})})]})]}),R(`section`,{children:[R(`img`,{src:fc,alt:e({id:`LUnwPh`}),width:`600`,height:`450`,loading:`lazy`}),R(`div`,{children:[R(`h4`,{children:R(j,{id:`xrl8fj`})}),R(`p`,{children:R(j,{id:`1lGm1k`})})]})]}),R(`section`,{children:[R(`img`,{src:Qu,alt:e({id:`CGQ27z`}),width:`400`,height:`474`,loading:`lazy`}),R(`div`,{children:[R(`h4`,{children:R(j,{id:`cYE45-`})}),R(`p`,{children:R(j,{id:`Pc7QKh`})})]})]}),R(`section`,{children:[R(`img`,{src:Xu,alt:e({id:`VLKtvP`}),width:`400`,height:`209`,loading:`lazy`}),R(`div`,{children:[R(`h4`,{children:R(j,{id:`pEkad9`})}),R(`p`,{children:R(j,{id:`t7Py5R`})})]})]}),R(`section`,{children:[R(`img`,{src:Zu,alt:e({id:`wOax6E`}),width:`400`,height:`196`,loading:`lazy`}),R(`div`,{children:[R(`h4`,{children:R(j,{id:`Wi1Ov0`})}),R(`p`,{children:R(j,{id:`tS2i-h`})})]})]})]})}),R(`footer`,{children:[(cd||ud)&&R(`p`,{class:`app-site-version`,children:R(`small`,{children:[ld?cd:``,` `,ud]})}),R(`p`,{children:R(j,{id:`BskFI2`,components:{0:R(`a`,{href:`https://github.com/cheeaun/phanpy`,target:`_blank`}),1:R(`a`,{href:`https://mastodon.social/@cheeaun`,target:`_blank`,onClick:e=>{e.preventDefault(),o.showAccount=`cheeaun@mastodon.social`}}),2:R(`a`,{href:od,target:`_blank`})}})}),R(`div`,{children:R(kr,{})})]})]})}q(!0);var fd=Le(()=>le(()=>import(`./mock-home-DSCkHwNM.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)),pd=Le(()=>le(()=>import(`./year-in-posts-CCySMT55.js`),__vite__mapDeps([4,1,2,3,5]),import.meta.url));window.__STATES__=o,window.__STATES_STATS__=()=>{let e=[`statuses`,`accounts`,`spoilers`,`unfurledLinks`,`statusQuotes`],n={};e.forEach(e=>{n[e]=Object.keys(o[e]).length});let{statuses:r}=o,i=new Set;document.querySelectorAll(`[data-state-post-id], [data-state-post-ids]`).forEach(e=>{let n=e.dataset.statePostId?.trim?.(),r=e.dataset.statePostIds?.trim?.();n&&i.add(n),r&&r.split(/\s+/).forEach(e=>i.add(e))}),Object.keys(r).filter(e=>!i.has(e))},setInterval(()=>{if(!window.__IDLE__)return;let{statuses:e,unfurledLinks:n,notifications:r}=o,i=0,{instance:a}=u(),s=new Set;document.querySelectorAll(`[data-state-post-id], [data-state-post-ids]`).forEach(e=>{let n=e.dataset.statePostId,r=e.dataset.statePostIds;n&&s.add(n),r&&r.split(/\s+/).forEach(e=>s.add(e))});for(let c in e){if(!window.__IDLE__)break;try{let e=r.some(e=>c===Ae(e.status?.id,a));if(!s.has(c)&&!e){delete o.statuses[c],delete o.statusQuotes[c];for(let e in n){let r=n[e];if(Ae(r.id,r.instance)===c){delete o.unfurledLinks[e];break}}i++}}catch{}}},900*1e3),setTimeout(()=>{for(let e in Xt)setTimeout(()=>{Array.isArray(Xt[e])?Xt[e][0]?.():typeof Xt[e]==`object`?Xt[e].module?.():Xt[e]?.()},1)},5e3),(()=>{window.__IDLE__=!0;let e=[`mousemove`,`mousedown`,`resize`,`keydown`,`touchstart`,`pointerdown`,`pointermove`,`wheel`],n=()=>{window.__IDLE__=!0},r=Zt(n,3e3),i=()=>{window.__IDLE__=!1,r()};e.forEach(e=>{window.addEventListener(e,i,{passive:!0,capture:!0})}),window.addEventListener(`blur`,n,{passive:!0}),document.documentElement.addEventListener(`mouseleave`,e=>{!e.relatedTarget&&!e.toElement&&n()},{passive:!0})})(),/iPad|iPhone|iPod/.test(navigator.userAgent)&&document.addEventListener(`visibilitychange`,()=>{if(document.visibilityState===`visible`){if(document.getElementsByClassName(`media-modal-container`).length>0)return;let e=F.local.get(`theme`),n;if(e){if(n=document.querySelector(`meta[name="theme-color"][data-theme-setting="manual"]`),n){let r=n.content,i=e===`light`?n.dataset.themeLightColorTemp:n.dataset.themeDarkColorTemp;n.content=i||``,setTimeout(()=>{n.content=r},10)}}else{let e=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;if(n=document.querySelector(`meta[name="theme-color"][media*="${e}"]`),n){let e=n.dataset.content,r=n.dataset.contentTemp;n.content=r||``,setTimeout(()=>{n.content=e},10)}}}});{let e=F.local.get(`theme`);if(e){document.documentElement.classList.add(`is-${e}`),document.querySelector(`meta[name="color-scheme"]`).setAttribute(`content`,e||`light dark`);let n=document.querySelector(`meta[data-theme-setting="manual"]`);n&&(n.name=`theme-color`,n.content=e===`light`?n.dataset.themeLightColor:n.dataset.themeDarkColor),document.querySelectorAll(`meta[data-theme-setting="auto"]`).forEach(e=>{e.name=``})}let n=F.local.get(`textSize`);n&&document.documentElement.style.setProperty(`--text-size`,`${n}px`)}ye(o,e=>{for(let[n,r,i,a]of e){if(r.join(`.`)===`settings.shortcutsViewMode`){let e=document.getElementById(`app`);e&&(e.dataset.shortcutsViewMode=o.shortcuts?.length?i:``)}r.join(`.`)===`settings.cloakMode`&&document.body.classList.toggle(`cloak`,i)}}),window.__BENCH_RESULTS=new Map,window.__BENCHMARK={start(e){},end(e){}},document.body.classList.toggle(`exp-tab-bar-v2`,F.local.get(`experiments-tabBarV2`)??!1);var md=window.matchMedia(`(display-mode: standalone)`).matches||window.navigator.standalone===!0,hd=3600*1e3;function gd(){let[e,n]=I(()=>!!z()),[r,s]=I(`loading`);__BENCHMARK.start(`app-init`),__BENCHMARK.start(`time-to-following`),__BENCHMARK.start(`time-to-home`),__BENCHMARK.start(`time-to-isLoggedIn`),l(),_(()=>{let e=F.local.get(`instanceURL`),r=decodeURIComponent((window.location.search.match(/code=([^&]+)/)||[,``])[1]);if(r){if(window.opener&&!window.opener.closed){try{window.opener.postMessage({type:`oauth-callback`,code:r},window.location.origin),setTimeout(()=>{window.close()},100)}catch{window.close()}return}window.history.replaceState({},document.title,window.location.pathname||`/`);let{client_id:a,client_secret:o,vapid_key:c}=L(e)||{},l=Ce(e)||c,u=F.sessionCookie.get(`codeVerifier`);(async()=>{s(`loading`);let{access_token:c}=await Sr({instanceURL:e,client_id:a,client_secret:o,code:r,code_verifier:u||void 0});if(c){let r=i({instance:e,accessToken:c});await Promise.allSettled([p(r),N(r,e),Ie(r,e,c,l)]),Me(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,n(!0),s(`default`);let a=F.session.get(`loginRedirect`);a&&(F.session.del(`loginRedirect`),window.location.hash=a)}else s(`error`);__BENCHMARK.end(`app-init`)})()}else{window.__IGNORE_GET_ACCOUNT_ERROR__=!0;let e=decodeURIComponent((window.location.search.match(/account=([^&]+)/)||[,``])[1]),r;if(e&&(r=v(e),r&&(we(r.info.id),window.history.replaceState({},document.title,window.location.pathname||`/`))),r||=z(),r){we(r.info.id);let{client:e}=u({account:r}),{instance:i}=e;Me(),s(`loading`),(async()=>{try{D()&&b(i)?(p(e),N(e,i)):await Promise.allSettled([p(e),N(e,i)])}catch{}finally{n(!0),s(`default`),__BENCHMARK.end(`app-init`)}})()}else s(`default`),__BENCHMARK.end(`app-init`)}F.sessionCookie.del(`clientID`),F.sessionCookie.del(`clientSecret`),F.sessionCookie.del(`codeVerifier`)},[]);let c=ie();o.currentLocation=c.pathname,_(ni,[c,e]);let d=a(!1),f=`pwaLastPath`;return _(()=>{d.current&&md&&e&&(vd(c.pathname)?F.local.del(f):F.local.setJSON(f,{path:c.pathname+c.search,lastAccessed:Date.now()}))},[c.pathname,c.search,e]),_(()=>{if(!(d.current||!(!c.pathname||c.pathname===`/`))&&md&&e&&r===`default`){let e=F.local.getJSON(f);e&&setTimeout(()=>{e?.path&&Date.now()-(e.lastAccessed||0)<hd&&(window.location.hash=e.path),F.local.del(f)},300),d.current=!0}},[r,e]),_(()=>{`serviceWorker`in navigator&&md&&r===`default`&&navigator.serviceWorker.getRegistration().then(function(e){e&&e.active&&e.active.postMessage({type:`client-ready`})}).catch(function(e){})},[md,r]),/\/https?:/.test(c.pathname)?R(uu,{}):r===`loading`?R(U,{id:`loader-root`}):R(nn,{value:e,children:[R(yd,{}),R(Sd,{}),R(Fe,{children:R(ke,{path:`/:instance?/s/:id`,element:R(Ju,{})})}),e&&R(un,{}),e&&R(Ts,{}),R(ts,{}),e&&R(ms,{}),R(cn,{}),e&&R(rs,{}),R(Ss,{onClose:ni}),R(fn,{})]})}function _d(){let e=rn();return e&&__BENCHMARK.end(`time-to-isLoggedIn`),R(e?ou:dd,{})}function vd(e){return/^\/(login|welcome|_sandbox|_qr-scan|_mock)/i.test(e)}var yd=pe(()=>{let e=ie();return R(Fe,{location:m(()=>{let{pathname:n}=e;return!vd(n)},[e])||e,children:[R(ke,{path:`/`,element:R(_d,{})}),R(ke,{path:`/login`,element:R(_u,{})}),R(ke,{path:`/welcome`,element:R(dd,{})}),R(ke,{path:`/_mock/home`,element:R(S,{children:R(fd,{})})}),void 0]})});function bd({children:e}){let n=rn(),r=ie();if(!n){let e=r.pathname+r.search;return F.session.set(`loginRedirect`,e),R(B,{to:`/login`,replace:!0})}return e}function xd(){return o.prevLocation||null}function Sd(){let e=ie(),n=a(xd()),r=m(()=>s(`/:instance/s/:id`,e.pathname)||s(`/s/:id`,e.pathname),[e.pathname,s]);return _(()=>{r?o.prevLocation&&F.session.setJSON(`prevLocation`,{pathname:o.prevLocation.pathname,search:o.prevLocation.search}):(o.prevLocation&&=null,F.session.del(`prevLocation`))},[r]),r?n.current||=xd():n.current=null,R(Fe,{location:n.current||e,children:[R(ke,{path:`/notifications`,element:R(bd,{children:R(Rl,{})})}),R(ke,{path:`/mentions`,element:R(bd,{children:R(xl,{})})}),R(ke,{path:`/following`,element:R(bd,{children:R(Gc,{})})}),R(ke,{path:`/_following2`,element:R(bd,{children:R(el,{})})}),R(ke,{path:`/b`,element:R(bd,{children:R(dc,{})})}),R(ke,{path:`/f`,element:R(bd,{children:R(Mc,{})})}),R(ke,{path:`/l`,children:[R(ke,{index:!0,element:R(bd,{children:R(du,{})})}),R(ke,{path:`:id`,element:R(bd,{children:R(cl,{})})})]}),R(ke,{path:`/fh`,element:R(bd,{children:R(Uc,{})})}),R(ke,{path:`/sp`,element:R(bd,{children:R(yu,{})})}),R(ke,{path:`/ft`,element:R(bd,{children:R(Rc,{})})}),R(ke,{path:`/catchup`,element:R(bd,{children:R(xc,{})})}),R(ke,{path:`/yip`,element:R(bd,{children:R(S,{fallback:R(`div`,{id:`year-in-posts-page`,class:`deck-container`,tabIndex:`-1`,children:R(U,{})}),children:R(pd,{})})})}),R(ke,{path:`/annual_report/:year`,element:R(bd,{children:R(lc,{})})}),R(ke,{path:`/:instance?/t/:hashtag`,element:R(ol,{})}),R(ke,{path:`/:instance?/a/:id`,element:R(ac,{})}),R(ke,{path:`/:instance?/p`,children:[R(ke,{index:!0,element:R(Bl,{})}),R(ke,{path:`l`,element:R(Bl,{local:!0})})]}),R(ke,{path:`/:instance?/trending`,element:R($l,{})}),R(ke,{path:`/:instance?/search`,element:R(Kl,{})})]})}if(ge(),Te(),E(R(je,{i18n:K,children:R(ue,{children:R(ve,{children:R(gd,{})})})}),document.getElementById(`app`)),setTimeout(()=>{try{localStorage.removeItem(`settings-groupedNotificationsAlpha`)}catch{}},5e3),`serviceWorker`in navigator&&typeof caches<`u`){let e=[`icons`],n=!1,r=1e4;async function i(){if(window.__IDLE__)try{let r=await caches.keys();for(let n of r){if(e.includes(n))continue;let r=await caches.open(n),i=await r.keys();if(i.length>50){let e=i.slice(50);for(let n of e)await r.delete(n)}}n=!0}catch{}setTimeout(i,n?36e5:r)}setTimeout(i,r)}if(`serviceWorker`in navigator){function e(e){if(!e)return null;let n=[];return e.title&&n.push(e.title),e.text&&n.push(e.text),e.url&&n.push(e.url),{initialText:n.join(`
`),files:e.files||[]}}navigator.serviceWorker.addEventListener(`message`,n=>{let{data:r,action:i}=n.data||{};if(i===`compose-with-shared-data`){let n=e(r);n&&(window.__SHARED_DATA__=n,o.showCompose=!0)}})}window.__CLOAK__=()=>{document.body.classList.toggle(`cloak`)};export{hi as a,bo as i,Ts as n,un as o,Ka as r,Hs as t};
//# sourceMappingURL=main-BRo5yFiv.js.map