fedipod-server 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -8
- package/config/server.json +11 -0
- package/dist/claims.js +5 -4
- package/dist/components/context.jsonld +6 -0
- package/dist/directory.d.ts +11 -0
- package/dist/directory.js +19 -0
- package/dist/handler.d.ts +18 -2
- package/dist/handler.js +63 -27
- package/dist/handler.jsonld +27 -0
- package/lib/acctfeed.mjs +257 -0
- package/lib/admin.mjs +176 -6
- package/lib/bskygroup.mjs +1 -1
- package/lib/embed.mjs +6 -1
- package/lib/fediacct.mjs +257 -0
- package/lib/front-core.mjs +74 -4
- package/lib/intake.mjs +21 -2
- package/lib/links.mjs +35 -0
- package/lib/mastoapi.mjs +101 -2
- package/lib/remote.mjs +119 -3
- package/lib/setup.mjs +56 -0
- package/lib/store.mjs +26 -1
- package/lib/wire.mjs +2 -2
- package/package.json +1 -1
- package/phanpy/dist/assets/main-BdqNbG-a.js +1 -1
- package/phanpy/dist/compose/index.html +1 -1
- package/phanpy/dist/index.html +1 -1
- package/phanpy/dist/sw.js +2 -25
- package/phanpy/dist/sw.js.map +1 -0
- package/run-agent.mjs +31 -0
- package/web/admin/admin.js +81 -22
- package/web/admin/index.html +37 -8
- package/web/admin/setup/index.html +20 -4
- package/web/admin/setup/setup.js +50 -10
- package/web/front/admin.html +133 -0
- package/web/front/new-account.html +2 -2
- package/web/front/run.html +20 -16
- package/web/front/solid-oidc-client.js +6 -0
- package/web/front/solid-client-authn.bundle.js +0 -2
|
@@ -20,7 +20,7 @@ import{i as e,t as n}from"./chunk-aKtaBQYM.js";import{$ as r,$t as i,A as a,B as
|
|
|
20
20
|
${he?`show-media`:``}
|
|
21
21
|
`,children:L(bt,{class:e,media:n,lang:I,to:`/${i}/s/${w}?media-only=${a+1}`,onClick:o?e=>o(e,a,n,r):void 0})},c)})}var qs=K(Ks),Js={block:`start`,inline:`center`,behavior:`instant`},Ys=`.timeline-pagination button[data-pagination-trigger="prev"]`,Xs=`.timeline-pagination button[data-pagination-trigger="next"]`,Zs=`.timeline-item, .timeline-item-alt`;function Qs(e){return nt(`j, shift+j`,(n,r)=>{if(n.shiftKey!==r.shift)return;let i=document.activeElement.closest(Zs),a=i?.getBoundingClientRect(),o=Array.from(e.current?.querySelectorAll(Zs)||[]).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(Js);else{let n=e.current.querySelector(Xs);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(Js))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.key.toLowerCase()!==`j`})}function $s(e){return nt(`k, shift+k`,(n,r)=>{if(n.shiftKey!==r.shift)return;let i=document.activeElement.closest(Zs),a=i?.getBoundingClientRect(),o=Array.from(e.current?.querySelectorAll(Zs)||[]).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(Js);else{let n=e.current.querySelector(Ys);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(Js))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.key.toLowerCase()!==`k`})}function ec(){return nt([`enter`,`o`],(e,n)=>{let r=document.activeElement;if(r?.matches(Zs))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 tc({title:e,titleComponent:n,id:r,instance:a,emptyText:o,errorText:c,useItemID:l,boostsCarousel:u,fetchItems:f=()=>{},checkForUpdates:p=()=>{},checkForUpdatesInterval:m=15e3,headerStart:h,headerEnd:_,timelineStart:v,refresh:b,view:S,filterContext:C,showFollowedTags:w,showReplyParent:T,clearWhenRefresh:E}){let{_:ee}=d(),D=W(k),O=D.settings.autoHideBars,[A,M]=I([]),[N,P]=I(`start`),[te,F]=I(!1),[ne,R]=I(!1),[z,B]=I(!0),re=s();__BENCHMARK.start(`timeline-${r}-load`);let ie=g(()=>V(),[]),ae=S!==`media`,H=s(0),U=mt(e=>{R(!1),P(`loading`),(async()=>{try{let n=H.current=Date.now(),{done:i,value:o}=await f(e);if(n!==H.current)return;if(i)F(!1);else if(Array.isArray(o)){let[n,r]=o.reduce((e,n)=>(n._pinned?e[0].push(n):e[1].push(n),e),[[],[]]);o=r,o=zs(o,C),ae&&(u&&(o=Is(o)),o=Bs(o,a)),n.length&&(o=n.concat(o)),M(e?o:e=>[...e,...o]),o.length||(i=!0),F(!i)}else throw Error(`Timeline load failed`);P(`default`),__BENCHMARK.end(`timeline-${r}-load`)}catch{P(`error`),e&&!A.length&&c&&Z(c)}finally{U.cancel()}})()},1e3,{leading:!0}),oe=Qs(re),se=$s(re),ce=ec(),le=A.length>0&&N!==`loading`&&ne,G=x(()=>{le&&U(!0),re.current?.scrollTo({top:0,behavior:`smooth`})},[U,le]),ue=nt(`.`,G,{useKey:!0,ignoreEventWhen:e=>e.key===`.`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),K=s(),[de,fe]=I(!1),pe=x(({scrollDirection:e,nearReachStart:n,reachStart:r})=>{if(K.current){let r=O&&e===`end`&&!n;K.current.hidden=r}fe(n),r&&U(!0)},[fe,U,O]),{resetScrollDirection:me}=Gs({scrollableRef:re,distanceFromEnd:2,scrollThresholdStart:44},pe);y(()=>{re.current?.scrollTo({top:0}),U(!0)},[]);let he=s(!0);y(()=>{if(he.current){he.current=!1;return}E&&A?.length&&(U.cancel?.(),M([])),U(!0)},[E,b]);let ge=s(S);y(()=>{ge.current!==S&&(ge.current=S,M([]))},[S]);let _e=x(async({disableIdleCheck:e=!1}={})=>{let n=re.current?getComputedStyle(re.current).pointerEvents===`none`:!1;D.settings.autoRefresh&&re.current.scrollTop<16&&(e||window.__IDLE__)&&!ac()&&!n?U(!0):await p()&&R(!0)},[r,U,p,D.settings.autoRefresh]),ve=s();return ln(e=>{if(e){let e=Date.now()-ve.current;(!ve.current||e>1e3*3)&&_e({disableIdleCheck:!0})}else ve.current=Date.now();B(e)},[p,_e,D.settings.autoRefresh]),Be(_e,z&&!ne?m*(de?1:2):null),L(He.Provider,{value:C,children:L(`div`,{id:`${r}-page`,class:`deck-container ${ie?`deck-container-media-first`:``}`,ref:e=>{re.current=e,oe.current=e,se.current=e,ce.current=e,ue.current=e},tabIndex:`-1`,onClick:e=>{K.current&&e.target.closest(`.timeline-item, .timeline-item-alt`)&&setTimeout(()=>{K.current.hidden=!1,me()},250)},children:L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{ref:K,onClick:e=>{e.target.closest(`a, button`)||re.current?.scrollTo({top:0,behavior:`smooth`})},onDblClick:e=>{e.target.closest(`a, button`)||U(!0)},class:N===`loading`?`loading`:``,children:[L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),h??L(Q,{to:`/`,class:`button plain home-button`,children:L(X,{icon:`home`,size:`l`,alt:ee({id:`i0qMbr`})})})]}),e&&(n||L(`h1`,{children:e})),L(`div`,{class:`header-side`,children:!!_&&_})]}),le&&L(`button`,{class:`updates-button shiny-pill`,type:`button`,onClick:G,children:[L(X,{icon:`arrow-up`}),` `,L(j,{id:`2yr1_p`})]})]}),!!v&&L(`div`,{class:`timeline-start ${N===`loading`?`loading`:``}`,children:v}),A.length?L(i,{children:[L(`ul`,{class:`timeline ${S?`timeline-${S}`:``}`,children:[A.map(e=>L(nc,{status:e,instance:a,useItemID:l,filterContext:C,view:S,showFollowedTags:w,showReplyParent:T,mediaFirst:ie},e.id+e?._pinned+S)),te&&N===`loading`&&(S===`media`?null:L(i,{children:[L(`li`,{style:{height:`20vh`},children:L(Ut,{skeleton:!0,mediaFirst:ie})}),L(`li`,{style:{height:`25vh`},children:L(Ut,{skeleton:!0,mediaFirst:ie})})]}))]}),N==="default"&&(te?L(at,{root:re.current,rootMargin:`0px 0px ${screen.height*1.5}px 0px`,onChange:e=>{e&&U()},children:L(`button`,{type:`button`,class:`plain block`,onClick:()=>U(),style:{marginBlockEnd:`6em`},children:L(j,{id:`uXRAkV`})})}):L(`p`,{class:`ui-state insignificant`,children:L(j,{id:`2EYeAZ`})}))]}):N===`loading`?L(`ul`,{class:`timeline`,children:Array.from({length:5}).map((e,n)=>S===`media`?L(`div`,{style:{height:`50vh`}}):L(`li`,{children:L(Ut,{skeleton:!0,mediaFirst:ie})},n))}):N!==`error`&&N!==`start`&&L(`p`,{class:`ui-state`,children:o}),N===`error`&&L(`p`,{class:`ui-state`,children:[c,L(`br`,{}),L(`br`,{}),L(`button`,{type:`button`,onClick:()=>U(!A.length),children:L(j,{id:`KDw4GX`})})]})]})})})}var nc=K(({status:e,instance:n,useItemID:r,filterContext:i,view:a,showFollowedTags:o,showReplyParent:s,mediaFirst:c})=>{let{_:l}=d(),{id:u,reblog:f,items:p,type:m,_pinned:h}=e;h&&(r=!1);let g=f?.id||u,_=n?`/${n}/s/${g}`:`/s/${g}`;if(p){let e=Zt(p,i),a=``;if(m===`boosts`?a=G._({id:`NuqppG`,values:{0:e.length}}):m===`pinned`&&(a=l({id:`GlfmCu`})),m===`boosts`||m===`pinned`){let o=new Set;if(e.sort((e,n)=>{let r=lt(e.filtered,i),a=lt(n.filtered,i),s=r&&r.action!==`blur`,c=a&&a.action!==`blur`;return s&&o.add(e.id),c&&o.add(n.id),s&&!c?1:!s&&c?-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 L(`li`,{class:`timeline-item-carousel`,children:L(rc,{title:a,class:`${m}-carousel`,children:e.map(e=>{let{id:i,reblog:a,_pinned:o,_grouped:s}=e;if(s)return L(`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),L(Q,{class:`status-carousel-link timeline-item-alt`,to:c,children:r?L(Ut,{statusID:i,instance:n,size:`s`}):L(Ut,{status:e,instance:n,size:`s`})})})},i);let l=a?.id||i,u=n?`/${n}/s/${l}`:`/s/${l}`;return o&&(r=!1),L(`li`,{children:L(Q,{class:`status-carousel-link timeline-item-alt`,to:u,children:r?L(Ut,{statusID:i,instance:n,size:`s`,contentTextWeight:!0,enableCommentHint:!0,mediaFirst:c}):L(Ut,{status:e,instance:n,size:`s`,contentTextWeight:!0,enableCommentHint:!0,mediaFirst:c})})},i)})})},`timeline-${u}`)}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 L(`li`,{class:`timeline-item-container timeline-item-container-type-${m} timeline-item-container-${g?`start`:_?`end`:`middle`} ${u?`timeline-item-diff-author`:``}`,children:L(Q,{class:`status-link timeline-item`,to:d,children:h?L(ic,{status:a,instance:n,filterContext:i}):r?L(Ut,{statusID:l,instance:n,enableCommentHint:_,showFollowedTags:o}):L(Ut,{status:a,instance:n,enableCommentHint:_,showFollowedTags:o})})},`timeline-${l}`)})}let v=`timeline-${u+h}`;return a===`media`?r?L(qs,{class:`timeline-item`,parent:`li`,statusID:u,instance:n},v):L(qs,{class:`timeline-item`,parent:`li`,status:e,instance:n},v):L(`li`,{children:L(Q,{class:`status-link timeline-item`,to:_,children:r?L(Ut,{statusID:u,instance:n,enableCommentHint:!0,showFollowedTags:o,showReplyParent:s,mediaFirst:c}):L(Ut,{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 rc({title:e,class:n,children:r}){let{_:i}=d(),a=s(),o=s(),c=s(),[l,u]=I(!1);return y(()=>{setTimeout(()=>{u(!0)},1)},[]),L(`div`,{class:`status-carousel ${n}`,children:[L(`header`,{children:[L(`h3`,{children:e}),L(`span`,{children:[L(`button`,{ref:o,type:`button`,class:`small plain2`,onClick:()=>{let e=Math.min(320,a.current?.offsetWidth)*(Ft()?1:-1);a.current?.scrollBy({left:e,behavior:`smooth`})},children:L(X,{icon:`chevron-left`,alt:i({id:`DHhJ7s`})})}),` `,L(`button`,{ref:c,type:`button`,class:`small plain2`,onClick:()=>{let e=Math.min(320,a.current?.offsetWidth)*(Ft()?-1:1);a.current?.scrollBy({left:e,behavior:`smooth`})},children:L(X,{icon:`chevron-right`,alt:i({id:`hXzOVo`})})})]})]}),L(`ul`,{ref:a,children:[L(at,{class:`status-carousel-beacon`,onChange:e=>{o.current&&(o.current.disabled=e)}}),r[0],l&&r.slice(1),L(at,{class:`status-carousel-beacon`,onChange:e=>{c.current&&(c.current.disabled=e)}})]})]})}function ic({status:e,instance:n,filterContext:r}){let{_:a}=d(),o=W(k),{id:s,visibility:l,language:u}=e,f=Ct(e),p=c(s,n),m=lt(e.filtered,r);return L(`article`,{class:`status compact-thread ${l===`direct`?`visibility-direct`:``}`,tabindex:`-1`,children:[L(`div`,{class:`status-thread-badge-container`,children:L(yt,{index:o.statusThreadNumber[p]})}),L(`div`,{class:`content-compact`,title:f,lang:u,dir:`auto`,children:m&&m?.action!==`blur`?L(`b`,{class:`status-filtered-badge badge-meta horizontal`,title:m?.titlesStr||``,children:m?.titlesStr?L(j,{id:`sr6maL`,values:{0:m.titlesStr},components:{0:L(`span`,{}),1:L(`span`,{})}}):L(`span`,{children:L(j,{id:`03Qqf9`})})}):L(i,{children:[f,e.sensitive&&e.spoilerText&&L(i,{children:[` `,L(`span`,{class:`spoiler-badge`,children:L(X,{icon:`eye-close`,size:`s`,alt:a({id:`gnKo7f`})})})]})]})})]})}function ac(){return!!document.querySelector(`.deck-backdrop, #modal-container > *`)}var oc=20,sc=1983,cc=`${sc}-01`,lc=J(()=>{try{let e=document.createElement(`input`);return e.setAttribute(`type`,`month`),e.type===`month`}catch{return!1}});function uc({columnMode:e,...n}){let{i18n:r,_:a}=d(),o=W(k),{id:c,...l}=e?{id:n.id}:A(),u=s(new URLSearchParams({replies:1})),[,p]=m(e=>e+1,0),h=x(e=>{let n=u.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)}),p()},[]),[_,v]=e?[u.current,h]:oe(),b=x((n,r)=>{let i=new URLSearchParams(e?{replies:1}:void 0);r!==void 0&&i.set(n,r),v(i)},[v]),S=x((e,n)=>{let r=new URLSearchParams(_.toString());r.get(e)?r.delete(e):r.set(e,n??`1`),v(r)},[v,_]),C=_.get(`month`),w=!_.get(`replies`),E=!!_.get(`boosts`),D=_.get(`tagged`),O=!!_.get(`media`),{masto:M,instance:N,authenticated:P}=f({instance:l?.instance}),{masto:te,instance:F}=f(),ne=s(),R=[C,w,E,D,O],[z,B]=I(),re=s(0);y(()=>{re.current=0},R);let ie=g(()=>V(),[]),ae=g(()=>N===F,[N,F]),[H,U]=I(!1);y(()=>{ae&&z?.acct&&(async()=>{U(await xi(N))})()},[N,ae,z?.acct]);async function se(n){let r=/^\d{4}-[01]\d$/.test(C),i=C?.split?.(`-`)?.[0]>=sc;if(r&&i){if(!z)return{value:[],done:!0};let[e,r]=C.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=oc+1;n?re.current=0:re.current+=oc;let u=await M.v2.search.list({q:`from:${z.acct} after:${o} before:${c}`,type:`statuses`,limit:l,offset:re.current});if(u?.statuses?.length){let e=u.statuses.slice(0,oc);return e.forEach(e=>{Me(e,N)}),{value:e,done:u.statuses.length<=oc}}else return{value:[],done:!0}}let a=[];if(n&&!e){let{value:e}=await M.v1.accounts.$select(c).statuses.list({pinned:!0}).values().next();if(e?.length&&!D&&!O){let n=e.map(e=>(Me(e,N),{...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||!ne.current)&&(ne.current=M.v1.accounts.$select(c).statuses.list({limit:oc,exclude_replies:w,exclude_reblogs:E,only_media:O||void 0,tagged:D}).values());let{value:o,done:s}=await ne.current.next();if(o?.length){if(!ot(`@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=>{Me(e,N)})}return{value:a,done:s}}let[ce,le]=I([]),G=a({id:`_cKnpj`});if(z?.acct){let e=(/@/.test(z.acct)?``:`@`)+z.acct,n=z?.displayName?`${z.displayName} (${e})`:e;if(D&&O)G=a({id:`lYyloN`,values:{tagged:D,accountDisplay:n}});else if(D)G=a({id:`8ZPzp0`,values:{tagged:D,accountDisplay:n}});else if(C){let[e,i]=C.split(`-`);G=a({id:`Did6le`,values:{monthYear:new Date(+e,i-1,1).toLocaleString(r.locale,{month:`long`,year:`numeric`}),accountDisplay:n}})}else G=O?a({id:`dFu2-z`,values:{accountDisplay:n}}):n}he(G,`/:instance?/a/:id`);let ue=x(()=>pc(c,M),[c,M]);y(()=>{(async()=>{try{B(await ue())}catch{}if(!ie)try{le(await M.v1.accounts.$select(c).featuredTags.list())}catch{}})()},[c,ie]);let{displayName:K,acct:de,emojis:fe}=z||{},pe=g(()=>z?.id===ee(),[z?.id]),me=s(),ge=g(()=>{let n=(e?w:!w)||E||D||O||!!C,s=o.accounts[`${c}@${N}`],l=e=>{let n=new URLSearchParams(_.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 L(i,{children:[e?L(Fs,{account:z,instance:N}):L(qi,{instance:N,account:s||c,fetchAccount:ue,authenticated:P,standalone:!0,showEndorsements:!0}),!ie&&L(`div`,{class:`filter-bar`,ref:me,style:{position:`relative`},children:[n?L(Q,{to:`/${N}/a/${c}`,class:`insignificant filter-clear`,title:a({id:`I9EnzM`}),onClick:n=>{e&&(n.preventDefault(),b())},children:L(X,{icon:`x`,size:`l`,alt:a({id:`I9EnzM`})})},`clear-filters`):L(X,{icon:`filter`,class:`insignificant`,size:`l`,alt:a({id:`cSev-j`})}),L(`div`,{class:`filter-bar-group`,children:[L(`label`,{children:[L(`input`,{type:`checkbox`,checked:!w,disabled:!!C,onChange:()=>{S(`replies`,`1`),Z(a(w?{id:`t9yqkt`}:{id:`BHjZV6`}))}}),L(j,{id:`N8UzTV`})]}),L(`label`,{children:[L(`input`,{type:`checkbox`,checked:!E,disabled:!!C,onChange:()=>{S(`boosts`,`0`),Z(a(E?{id:`Wk2coq`}:{id:`63FG7O`}))}}),L(j,{id:`puY2t0`})]})]}),L(Q,{to:`/${N}/a/${c}${l({media:O?null:`1`})}`,onClick:n=>{e&&(n.preventDefault(),S(`media`,`1`)),O||Z(a({id:`rKpfPY`}))},class:O?`is-active`:``,children:L(j,{id:`xYilR2`})}),ce.length>0&&L(`div`,{class:`filter-bar-group`,children:[...ce].sort((e,n)=>e.name===D?-1:+(n.name===D)).map(n=>L(Q,{to:`/${N}/a/${c}${l({tagged:D===n.name?null:n.name})}`,onClick:r=>{if(e){r.preventDefault();let e=new URLSearchParams(_.toString());e.get(`tagged`)===n.name?e.delete(`tagged`):e.set(`tagged`,n.name),v(e)}D!==n.name&&Z(a({id:`L-HFfr`,values:{0:n.name}}))},class:D===n.name?`is-active`:``,children:L(`span`,{children:[L(`span`,{class:`more-insignificant`,children:`#`}),n.name]})},n.id))}),H&&!e&&L(i,{children:[L(`div`,{class:`filter-bar-separator`}),lc()?L(`label`,{class:`filter-field ${C?`is-active`:``}`,children:[L(X,{icon:`month`,size:`l`}),L(`input`,{type:`month`,disabled:!z?.acct,value:C||``,min:cc,max:new Date().toISOString().slice(0,7),onInput:e=>{let{value:n,validity:i}=e.currentTarget;if(!i.valid)return;v(n?{month:n}:{});let[o,s]=n.split(`-`),c=parseInt(s,10)-1;Z(a({id:`0WUFGD`,values:{0:new Date(o,c).toLocaleString(r.locale,{month:`long`,year:`numeric`})}}))}})]}):L(dc,{class:`filter-field ${C?`is-active`:``}`,disabled:!z?.acct,value:C||``,min:cc,max:new Date().toISOString().slice(0,7),onInput:e=>{let{value:n,validity:r}=e;r.valid&&v(n?{month:n}:{})}}),L(`button`,{type:`button`,class:`filter-field`,onClick:()=>{k.showSearchCommand={query:pe?`from:me `:`from:${z?.acct} `}},children:L(X,{icon:`search`,size:`l`,alt:a(pe?{id:`BmW9JG`}:{id:`h7t_Tx`,values:{0:z?.username}})})})]})]})]})},[c,N,P,ce,ue,H,...R]);y(()=>{let e=[...me.current?.querySelectorAll(`.is-active`)??[]];if(!e.length)return;let n=me.current.offsetWidth,r=Math.min(...e.map(e=>e.offsetLeft)),i=Math.max(...e.map(e=>e.offsetLeft+e.offsetWidth))-r;me.current.scrollTo({behavior:`smooth`,left:i>=n?r:r-(n-i)/2})},[ce,H,...R]);let _e=g(()=>z?.url?URL.parse(z.url)?.hostname:null,[z]),ve=!!z&&N!==_e;return L(i,{children:[L(tc,{title:`${z?.acct?`@`+z.acct:a({id:`-owNNn`})}`,titleComponent:L(`h1`,{class:`header-double-lines header-account`,children:[L(`b`,{children:L(st,{text:K,emojis:fe,resolverURL:z?.url})}),L(`div`,{children:L(`span`,{class:`bidi-isolate`,children:[`@`,de]})})]}),id:`account-statuses`,instance:N,emptyText:a({id:`-k97fV`}),errorText:a({id:`scd9lw`}),fetchItems:se,useItemID:!0,view:O||ie?`media`:void 0,boostsCarousel:!pe&&o.settings.boostsCarousel,timelineStart:ge,refresh:[w,E,D,O,C+z?.acct].toString(),headerEnd:L(Gt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:a({id:`2FYpfJ`})})}),children:[L(Y,{disabled:!ve,onClick:()=>{(async()=>{try{let{masto:e}=f({instance:_e}),{id:n}=await e.v1.accounts.lookup({acct:z.acct});location.hash=`/${_e}/a/${n}`}catch{alert(a({id:`FgdLx0`}))}})()},children:[L(X,{icon:`transfer`}),` `,L(`small`,{class:`menu-double-lines`,children:L(j,{id:`6GZBJp`,values:{0:_e?L(i,{children:[` `,`(`,L(`b`,{children:T.toUnicode(_e)}),`)`]}):null}})})]}),!ae&&L(Y,{onClick:()=>{(async()=>{try{let{id:e}=await te.v1.accounts.lookup({acct:z.acct+`@`+N});location.hash=`/${F}/a/${e}`}catch{alert(a({id:`FgdLx0`}))}})()},children:[L(X,{icon:`transfer`}),` `,L(`small`,{class:`menu-double-lines`,children:L(j,{id:`SiegcM`,values:{currentInstance:F},components:{0:L(`b`,{})}})})]})]})},c),de&&!pe&&L(`data`,{class:`compose-data`,value:JSON.stringify({draftStatus:{status:`@${de} `}})})]})}function dc(e){let{i18n:n}=d(),{class:r,disabled:i,value:a,min:o,max:c,onInput:l=()=>{}}=e,[u,f]=a?.split(`-`)||[],p=s(),m=s(),h=(e,n)=>{let[r,i]=o?.split(`-`)||[],[a,s]=c?.split(`-`)||[];return!(n<r||n>a||n===r&&e<i||n===a&&e>s)};return L(`div`,{class:r,children:[L(X,{icon:`month`,size:`l`}),L(`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}};l({value:n?`${r}-${n}`:``,validity:{valid:!0}})},children:[L(`option`,{value:``,children:L(j,{id:`HajiZl`})}),L(`option`,{disabled:!0,children:`-----`}),Array.from({length:12},(e,r)=>L(`option`,{value:(r+1).toString().padStart(2,`0`),children:new Date(0,r).toLocaleString(n.locale,{month:`long`})},r))]}),` `,L(`input`,{ref:m,type:`number`,disabled:i,value:u||new Date().getFullYear(),min:o?.slice(0,4)||sc,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}};l({value:n?`${n}-${i}`:``,validity:{valid:!0}})},style:{width:`4.5em`}})]})}function fc(e,n){return n.v1.accounts.$select(e).fetch()}var pc=a(fc,{expires:1800*1e3});function mc(){let{_:e}=d(),n=Ne(),{id:r,...a}=A(),[o]=oe(),c=o.get(`ic`)!=null,l=W(k),{instance:u,masto:p}=f({instance:a?.instance}),{instance:m}=f(),[h,g]=I();y(()=>{let e=!1;return g(void 0),(async()=>{try{let n=await pc(r,p);if(e)return;g(n)}catch{if(e)return}})(),()=>{e=!0}},[r,p]);let{acct:_}=h||{},v=r===ee()&&u===m;y(()=>{c&&!v&&n(`/${u}/a/${r}/c`,{replace:!0})},[c,v,n,u,r]);let b=e({id:`DoJzLz`});h?.acct&&(c?b=e({id:`xnkAvy`}):v||(b=e({id:`EzMSOY`,values:{username:(/@/.test(h.acct)?``:`@`)+h.acct}}))),he(b,`/:instance?/a/:id/c`);let[x,S]=I([]),[C,w]=I(`loading`),[T,E]=I(!1),D=s(),O=s(0),M=async e=>{(e||!D.current)&&(D.current=(c?p.v1.accounts.$select(r).inCollections:p.v1.accounts.$select(r).collections).list({limit:80}).values());let n=await D.current.next();return{...n,value:n.value?.collections??[]}},N=async e=>{let n=++O.current;w(`loading`);try{let{done:r,value:i}=await M(e);if(n!==O.current)return;r?(E(!1),e&&S([])):(S(e?i:e=>[...e,...i]),E(i.length>=80)),w(`default`)}catch{if(n!==O.current)return;w(`error`)}};y(()=>{N(!0)},[r,c,p]);let P=`/${u}/a/${r}/c`,[te,F]=I(!1);return L(`div`,{id:`account-collections-page`,class:`deck-container`,tabIndex:`-1`,children:[L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),v&&L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),h&&!v?L(`h1`,{class:`header-double-lines`,children:[L(`b`,{children:L(j,{id:`DoJzLz`})}),L(`div`,{children:L(Q,{class:`insignificant`,to:`/${u}/a/${r}`,onClick:e=>{v||(e.preventDefault(),e.stopPropagation(),k.showAccount={account:h,instance:u})},children:L(`span`,{class:`bidi-isolate`,children:[`@`,_]})})})]}):L(`h1`,{children:L(j,{id:`DoJzLz`})}),L(`div`,{class:`header-side`,children:v&&!c&&L(`button`,{type:`button`,class:`plain`,onClick:()=>F(!0),children:L(X,{icon:`plus`,size:`l`,alt:e({id:`3HCpJW`})})})})]})}),L(`main`,{children:[v&&L(`div`,{class:`filter-bar`,children:[L(X,{icon:`collections`,size:`l`,class:`insignificant`}),` `,L(Q,{to:P,class:c?``:`is-active`,children:L(j,{id:`WZTg05`})}),` `,L(Q,{to:`${P}?ic=1`,class:c?`is-active`:``,children:L(j,{id:`D15TLa`})})]}),x.length>0?L(i,{children:[L(`ul`,{class:`collections-list`,children:x.map(e=>L(`li`,{children:L(Rt,{collection:e,size:`l`,instance:u,creatorAccount:e.accountId?l.accounts[e.accountId]:null,showMeta:!c})},e.id))}),T&&(C===`loading`?L(`div`,{class:`ui-state`,children:L(q,{abrupt:!0})}):L(`div`,{class:`ui-state`,children:L(`button`,{type:`button`,class:`light`,onClick:()=>N(),children:L(j,{id:`uXRAkV`})})})),x.length>1&&L(`footer`,{class:`ui-state insignificant`,children:L(`small`,{children:L(j,{id:`FSeU2b`,values:{0:x.length}})})})]}):C===`loading`?L(`p`,{class:`ui-state`,children:L(q,{})}):C===`error`?L(`p`,{class:`ui-state insignificant`,children:L(j,{id:`xf6TNV`})}):h?L(`p`,{class:`ui-state insignificant`,children:e(c?{id:`pp8krA`}:{id:`-MACwa`})}):L(`p`,{class:`ui-state`,children:L(q,{})})]})]}),te&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&F(!1)},children:L(As,{onClose:e=>{if(e?.state===`success`&&e.collection){let r=e.collection.id;n(`/${u}/c/${r}`)}F(!1)}})})]})}function hc(){let{year:e}=A();he(e?`${e} #Wrapstodon`:`#Wrapstodon`,`/annual_report/:year`);let{masto:n,instance:r}=f(),[a,o]=I(null),[s,c]=I(`default`);y(()=>{e&&(async()=>{c(`loading`),o(await n.v1.annualReports.$select(e).fetch()),c(`default`)})()},[e]);let{accounts:l,annualReports:u,statuses:d}=a||{},p=u?.find(n=>n.year==e)?.data,m=new Date;return L(`div`,{id:`annual-report-page`,class:`deck-container`,tabIndex:`-1`,children:[L(`div`,{class:`report ${s===`loading`?`loading-mask`:``}`,children:[L(`h1`,{children:[e,` #Wrapstodon`]}),!!p&&L(`dl`,{children:Object.entries(p).map(([e,n])=>{let a={};return Array.isArray(n)&&n.forEach(e=>{Object.entries(e).forEach(([e,n])=>{typeof n==`number`&&(a[e]=(a[e]||0)+n)})}),L(i,{children:[L(`dt`,{children:e}),L(`dd`,{class:`report-${e}`,children:Array.isArray(n)?L(`table`,{children:[L(`thead`,{children:L(`tr`,{children:Object.entries(n[0]).map(([e,n])=>L(`th`,{class:e!==`month`&&typeof n==`number`?`number`:``,children:e}))})}),L(`tbody`,{children:n.map(n=>L(`tr`,{children:Object.entries(n).map(([n,r])=>L(`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)?L(ht,{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 n==`object`?/^(topStatuses)$/i.test(e)?L(`dl`,{children:Object.entries(n).map(([e,n])=>L(i,{children:[L(`dt`,{children:e}),L(`dd`,{children:n&&L(Q,{to:`/${r}/s/${n}`,children:L(Ut,{status:d?.find(e=>e.id===n),size:`s`,readOnly:!0,showCommentCount:!0})})})]}))}):L(`table`,{children:L(`tbody`,{children:Object.entries(n).map(([e,n])=>L(`tr`,{children:[L(`th`,{children:e}),L(`td`,{class:typeof n==`number`?`number`:``,children:n})]}))})}):typeof n==`string`?n:JSON.stringify(n,null,2)})]})})})]}),L(`hr`,{}),L(`p`,{style:{textAlign:`center`},children:L(Q,{to:`/`,children:L(j,{id:`iWpEwy`})})})]})}var gc=20;function _c(){let{_:e}=d();he(e({id:`7Ff7ia`}),`/b`);let{masto:n,instance:r}=f(),i=s();async function a(e){return(e||!i.current)&&(i.current=n.v1.bookmarks.list({limit:gc}).values()),await i.current.next()}return L(tc,{title:e({id:`7Ff7ia`}),id:`bookmarks`,emptyText:e({id:`8k2w6G`}),errorText:e({id:`UoL-FC`}),instance:r,fetchItems:a})}var vc=``+new URL(`catch-up-O5q5C75Z.png`,import.meta.url).href,yc=`home`,bc=`catchup`,xc=[{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}],Sc={original:{id:`HxF6Fk`},replies:{id:`N8UzTV`},quotes:{id:`eWLklq`},boosts:{id:`puY2t0`},followedTags:{id:`lCLRBe`},groups:{id:`zhrjek`},filtered:{id:`03Qqf9`}},Cc=[`createdAt`,`repliesCount`,`favouritesCount`,`reblogsCount`,`density`],wc=[null,`account`],Tc=J(e=>new Intl.DateTimeFormat(e||void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`numeric`}));function Ec(e){return e?.id||e?.quotedStatus?.id}function Dc(){let{i18n:e,_:n,_:a}=d(),o=Tc(e.locale);he(`Catch-up`,`/catchup`);let{masto:l,instance:p}=f(),[h,_]=oe(),v=h.get(`id`),[b,S]=I(`start`),[C,w]=I(!1),T=g(()=>ee(),[]),E=e=>e===T,D=ot(`@pixelfed/home-include-reblogs`);async function O({maxCreatedAt:e}){let n=[],r=l.v1.timelines.home.list({limit:40}),i=r.values();mainloop:for(;;)try{D&&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 Hs(a,p);let r=!1;for(let i=0;i<a.length;i++){let o=a[i],s=Date.parse(o.createdAt);if(!e||s>=e){let e=!E(o.reblog?.account?.id||o.account.id)&<(o.reblog?.filtered||o.filtered,yc);if(e?.action===`hide`)continue;o._filtered=e;let i=c(o.id,p);o._followedTags=k.statusFollowedTags[i]?[...k.statusFollowedTags[i]]:[],n.push(o),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([]),P=s(),te=s(),ne=g(()=>r(),[]),R=x(async({duration:e}={})=>{let n=Date.now(),r=e?n-e:null;S(`loading`);let i=await O({maxCreatedAt:r}),a=`${ne}-${_t()}`;try{await Ke.catchup.set(a,{id:a,posts:i,count:i.length,startAt:r,endAt:n}),_({id:a})}catch{}},[]);y(()=>{v?(async()=>{let e=await Ke.catchup.get(v);e&&(e.posts.sort((e,n)=>e.createdAt>n.createdAt?1:-1),M(e.posts),S(`results`))})():b===`results`&&(M([]),S(`start`))},[v]);let[z,B]=m(e=>e+1,0),[V,re]=I(null),[ie,ae]=I([]);y(()=>{let e=new Set(ie.map(e=>e.id));for(let n=sessionStorage.length-1;n>=0;n--){let r=sessionStorage.key(n);if(r?.startsWith(`${bc}-`)){let n=r.replace(`${bc}-`,``);e.has(n)||F.session.del(r)}}},[ie]),y(()=>{(async()=>{try{let e=await Ke.catchup.keys();if(e.length){let n=r(),i=e.filter(e=>e.startsWith(`${n}-`));if(i.length){let e=await Ke.catchup.getMany(i);e.sort((e,n)=>n.endAt-e.endAt);let n=e.slice(0,3),r=e.slice(3);ae(n.map(e=>{let{id:n,count:r,startAt:i,endAt:a}=e;return{id:n,count:r,startAt:i,endAt:a}})),re(n[0].endAt),e=null,n=null,queueMicrotask(()=>{r.length&&Ke.catchup.delMany(r.map(e=>e.id)).then(()=>{r=null}).catch(e=>{})});return}}}catch{}ae([])})()},[z]),y(()=>{b===`start`&&B()},[b===`start`]);let[H,U]=g(()=>{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`):Xe()&&Ec(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]),[W,se]=I(`all`),[ce,le]=I(null),[G,ue]=I(1),[K,de]=I(`createdAt`),[fe,pe]=I(`asc`),[me,ge]=I(null);y(()=>{if(!v)return;let e=F.session.getJSON(`${bc}-${v}`);e&&(e.selectedFilterCategory!==void 0&&se(e.selectedFilterCategory),e.selectedAuthor!==void 0&&le(e.selectedAuthor),e.sortBy!==void 0&&de(e.sortBy),e.sortOrder!==void 0&&pe(e.sortOrder),e.groupBy!==void 0&&ge(e.groupBy),e.showTopLinks!==void 0&&w(e.showTopLinks))},[v]),y(()=>{if(!v||b!==`results`)return;let e={selectedFilterCategory:W,selectedAuthor:ce,sortBy:K,sortOrder:fe,groupBy:me,showTopLinks:C};F.session.setJSON(`${bc}-${v}`,e)},[v,b,W,ce,K,fe,me,C]);let[_e,ve,ye]=g(()=>{let e={},n=new Map,r=A.filter(r=>{let i=W===`all`||r.__FILTER===W;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)}),ce&&n.has(ce)&&(r=r.filter(e=>e.account.id===ce||[...e.__BOOSTERS||[]].find(e=>e.id===ce))),[r,e,Object.fromEntries(n)]},[W,ce,A]),be=g(()=>{let e={};return _e.forEach(n=>{e[n.id]=n}),e},[_e]),xe=g(()=>Object.keys(ye).sort((e,n)=>ye[n]-ye[e]),[ye]),Se=g(()=>{let e={};return xe.forEach((n,r)=>{e[n]=r}),_e.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(K!==`createdAt`&&(n=n.reblog||n,r=r.reblog||r,K!==`density`&&n[K]===r[K]))return n.createdAt>r.createdAt?1:-1;if(K===`density`){let e=Mc(n),i=Mc(r);return fe===`asc`?e>i?1:-1:i>e?1:-1}return fe===`asc`?n[K]>r[K]?1:-1:r[K]>n[K]?1:-1})},[_e,K,fe,me,xe]),Ce=s(null),we=s(null),Te=s(!1);y(()=>{A.length>100||Te.current||we.current&&(cr(we.current,{duration:200}),Te.current=!0)},[A,we]);let Ee=A.length>160?`3d`:`2d`,De=g(()=>Ee===`2d`?A.map(e=>{let n=be[e.id];return L(`span`,{class:`post-dot ${n?`post-dot-highlight`:``}`},e.id)}):null,[be]),J=g(()=>Ee!==`3d`||!A?.length?null:Ic(A,`createdAt`,320).map((e,n)=>L(`div`,{class:`posts-bin`,children:e.map(e=>{let n=be[e.id];return L(`span`,{class:`post-dot ${n?`post-dot-highlight`:``}`},e.id)})},n)),[be]),Oe=s(null);N(()=>{if(!v||b!==`results`||!Oe.current||!Se.length)return;let e=F.session.getJSON(`${bc}-${v}`);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)}},[v,b,Se.length]),y(()=>{if(!v||b!==`results`||!Oe.current)return;let e=()=>{if(!Oe.current)return;let e=F.session.getJSON(`${bc}-${v}`)||{};e.scrollTop=Oe.current.scrollTop,F.session.setJSON(`${bc}-${v}`,e)},n=Oe.current;return n.addEventListener(`scroll`,e,{passive:!0}),()=>{n.removeEventListener(`scroll`,e)}},[v,b]);let ke=g(()=>V?(Date.now()-V)/1e3/60/60:null,[V,G]);y(()=>{if(b!==`results`)return;ce&&ve[ce]&&ve[ce].username;let e=Z({duration:5e3,text:a({id:`XKZRZ_`,values:{selectedFilterCategory:W,sortBy:K,sortOrder:fe,groupBy:me}})});return()=>{e?.hideToast?.()}},[b,W,ce,K,fe,me,ve]),y(()=>{if(ce&&ve[ce]){let e=we.current.querySelector(`[data-author="${ce}"]`),n=we.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`})}},[ce,ve]);let[Ae,je]=I(!1),Me=`.catchup-list > li > a`,Ne=nt(`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=nt(`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=nt(`h, l`,(e,n)=>{let r=n.keys[0];if(ce){let e=xe.indexOf(ce);r===`h`?e>0&&e<xe.length&&(le(xe[e-1]),Oe.current?.focus()):r===`l`&&e<xe.length-1&&e>=0&&(le(xe[e+1]),Oe.current?.focus())}else r===`l`&&(le(xe[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=nt(`esc`,()=>{le(null),Oe.current?.focus()},{preventDefault:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey,enableOnFormTags:[`input`],useKey:!0}),Le=nt(`.`,()=>{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=x(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 L(`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:[L(`div`,{class:`timeline-deck deck wide`,children:[L(`header`,{class:`${b===`loading`?`loading`:``}`,onClick:e=>{e.target.closest(`a, button`)||Oe.current?.scrollTo({top:0,behavior:`smooth`})},children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),b===`results`&&L(Q,{to:`/catchup`,class:`button plain`,children:L(X,{icon:`history2`,size:`l`,alt:a({id:`xrl8fj`})})}),b===`start`&&L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:a({id:`i0qMbr`})})})]}),L(`h1`,{children:b!==`start`&&L(j,{id:`wyL_3_`,components:{0:L(`sup`,{})}})}),L(`div`,{class:`header-side`,children:b!==`start`&&b!==`loading`&&L(`button`,{type:`button`,class:`plain`,onClick:()=>{je(!0)},children:L(j,{id:`c3XJ18`})})})]})}),L(`main`,{onKeyDown:Re,children:[b===`start`&&L(`div`,{class:`catchup-start`,children:[L(`h1`,{children:L(j,{id:`wyL_3_`,components:{0:L(`sup`,{})}})}),L(`details`,{children:[L(`summary`,{children:L(j,{id:`CxKPv6`})}),L(`p`,{children:L(j,{id:`YMU1CK`})}),L(`img`,{src:``+new URL(`catch-up-O5q5C75Z.png`,import.meta.url).href,width:`1200`,height:`900`,alt:a({id:`CeInO2`})}),L(`p`,{children:L(`button`,{type:`button`,onClick:e=>{e.target.closest(`details`).open=!1},children:L(j,{id:`2jI8hh`})})})]}),L(`p`,{children:L(j,{id:`1RfGk7`})}),L(`p`,{children:L(`b`,{children:L(j,{id:`OOEonE`})})}),L(`div`,{class:`catchup-form`,children:[L(`input`,{ref:P,type:`range`,value:G,min:xc[0].value,max:xc[xc.length-1].value,step:`1`,list:`catchup-ranges`,onChange:e=>ue(+e.target.value)}),` `,L(`span`,{style:{width:`8em`},children:[n(xc[G-1].label),L(`br`,{}),L(`small`,{class:`insignificant`,children:G==xc[xc.length-1].value?a({id:`NMNiaO`}):Jt(new Date(Date.now()-G*60*60*1e3))})]}),L(`datalist`,{id:`catchup-ranges`,children:xc.map(({label:e,value:r})=>L(`option`,{value:r,label:n(e)}))}),` `,L(`button`,{type:`button`,onClick:()=>{let e;G<xc.find(e=>e.beyond).value?e=G*60*60*1e3:te.current?.checked&&(e=Date.now()-V),R({duration:e})},children:L(j,{id:`R0yu2l`})})]}),ke&&G>ke?L(`p`,{class:`catchup-info`,children:[L(X,{icon:`info`}),` `,L(j,{id:`AGyV7s`})]}):G===xc[xc.length-1].value&&V?L(`p`,{class:`catchup-info`,children:L(`label`,{children:[L(`input`,{type:`checkbox`,switch:!0,checked:!0,ref:te}),` `,L(j,{id:`dDJEHI`,values:{0:o.format(new Date(V))}})]})}):null,L(`p`,{class:`insignificant`,children:L(`small`,{children:L(j,{id:`1atgyZ`})})}),!!ie?.length&&L(`div`,{class:`catchup-prev`,children:[L(`p`,{children:L(j,{id:`Yfb9A8`})}),L(`ul`,{children:ie.map(e=>L(`li`,{children:[L(Q,{to:`/catchup?id=${e.id}`,children:[L(X,{icon:`history2`}),` `,L(`span`,{children:e.startAt?o.formatRange(new Date(e.startAt),new Date(e.endAt)):`… – ${o.format(new Date(e.endAt))}`})]}),` `,L(`span`,{children:[L(`small`,{class:`ib insignificant`,children:L(j,{id:`S6XZwv`,values:{0:e.count}})}),` `,L(`button`,{type:`button`,class:`light danger small`,onClick:async()=>{if(confirm(a({id:`D9CmP2`}))){let n=Z(a({id:`xJUo4P`,values:{0:e.id}}));await Ke.catchup.del(e.id),n?.hideToast?.(),Z(a({id:`1dyGG_`,values:{0:e.id}})),B()}},children:L(X,{icon:`x`,alt:a({id:`t_YqKh`})})})]})]},e.id))}),ie.length>=3&&L(`p`,{children:L(`small`,{children:L(j,{id:`sXmrl4`})})})]})]}),b===`loading`&&L(`div`,{class:`ui-state catchup-start`,children:[L(q,{abrupt:!0}),L(`p`,{class:`insignificant`,children:L(j,{id:`rbUTzD`})}),L(`p`,{class:`insignificant`,children:L(j,{id:`q9urQO`})})]}),b===`results`&&L(i,{children:[L(`div`,{class:`catchup-header`,children:[A.length>0&&L(`p`,{children:L(`b`,{class:`ib`,children:o.formatRange(new Date(A[0].createdAt),new Date(A[A.length-1].createdAt))})}),L(`aside`,{children:[L(`button`,{hidden:W===`all`&&!ce&&K===`createdAt`&&fe===`asc`,type:`button`,class:`plain4 small`,onClick:()=>{se(`all`),le(null),de(`createdAt`),ge(null),pe(`asc`)},children:L(j,{id:`I9EnzM`})}),U?.length>0&&L(`button`,{type:`button`,class:`plain small`,onClick:()=>w(!C),children:[L(j,{id:`EIZREX`}),` `,L(X,{icon:`chevron-down`,style:{transform:C?`rotate(180deg)`:`rotate(0deg)`}})]})]})]}),L(`div`,{class:`shazam-container no-animation`,hidden:!C,children:L(`div`,{class:`shazam-container-inner`,children:L(`div`,{class:`catchup-top-links links-bar`,children:U.map(e=>{let{card:n,shared:r,sharers:a,likes:o,boosts:s}=e,{blurhash:c,title:l,description:d,url:f,image:p,imageDescription:m,language:h,width:g,height:_,publishedAt:v}=n,y=u(f),b;if(c){let e=Ca(St(c));b=ya([.6,e[1],e[2]])}return L(`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:L(`article`,{children:[L(`figure`,{children:L(`img`,{src:p,alt:m,width:g,height:_,loading:`lazy`})}),L(`div`,{class:`article-body`,children:[L(`header`,{children:[L(`div`,{class:`article-meta`,children:[L(`span`,{class:`domain`,children:y}),` `,!!v&&L(i,{children:`· `}),!!v&&L(i,{children:L(Wt,{datetime:v,format:`micro`})})]}),!!l&&L(`h1`,{class:`title`,lang:h,dir:`auto`,title:l,children:l})]}),!!d&&L(`p`,{class:`description`,lang:h,dir:`auto`,title:d,children:d}),L(`hr`,{}),L(`p`,{style:{whiteSpace:`nowrap`},children:L(j,{id:`bfSr6z`,values:{0:a.map(e=>{let{avatarStatic:n,displayName:r}=e;return L(`button`,{type:`button`,class:`plain`,style:{padding:0},onClick:n=>{n.preventDefault(),n.stopPropagation();let{id:r}=e;le(r),se(`all`)},children:L(Ht,{url:n,size:`s`,alt:r})})})}})})]})]})},f)})})})}),A.length>=5&&(Ee===`3d`?L(`div`,{class:`catchup-posts-viz-time-bar`,children:J}):L(`div`,{class:`catchup-posts-viz-bar`,children:De})),A.length>=2&&L(`div`,{class:`catchup-filters`,children:[L(`label`,{class:`filter-cat`,children:[L(`input`,{type:`radio`,name:`filter-cat`,checked:W.toLowerCase()===`all`,onChange:()=>{se(`all`)}}),L(j,{id:`N40H-G`}),` `,L(`span`,{class:`count`,children:A.length})]}),Object.entries(Sc).map(([e,r])=>!!H[e]&&L(`label`,{class:`filter-cat`,title:(H[e]/A.length*100).toFixed(2)+`%`,children:[L(`input`,{type:`radio`,name:`filter-cat`,checked:W.toLowerCase()===e.toLowerCase(),onChange:()=>{se(e),e===`boosts`&&(de(`reblogsCount`),pe(`desc`),ge(null))}}),n(r),` `,L(`span`,{class:`count`,children:H[e]})]},n(r)))]}),A.length>=2&&!!ye&&L(`div`,{class:`catchup-filters authors-filters`,ref:we,children:[xe.map(e=>L(`label`,{class:`filter-author`,"data-author":e,children:[L(`input`,{type:`radio`,name:`filter-author`,checked:ce===e,onChange:()=>{le(e)},onClick:()=>{ce===e&&le(null)}}),L(Ht,{url:ve[e].avatarStatic||ve[e].avatar,size:`xxl`,alt:`${ve[e].displayName} (@${ve[e].acct})`}),` `,L(`span`,{class:`count`,children:ye[e]}),L(`span`,{class:`username`,children:ve[e].username})]},`${e}-${ye[e]}`)),xe.length>5&&L(`small`,{style:{whiteSpace:`nowrap`,paddingInline:`1em`,opacity:.33},children:L(j,{id:`HHtYi7`,values:{0:xe.length}})},`authors-count`)]}),A.length>=2&&L(`div`,{class:`catchup-filters`,children:[L(`span`,{class:`filter-label`,children:L(j,{id:`f6Hub0`})}),` `,L(`fieldset`,{class:`radio-field-group`,children:Cc.map(e=>L(`label`,{class:`filter-sort`,onClick:n=>{K===e&&(n.preventDefault(),n.stopPropagation(),pe(fe===`asc`?`desc`:`asc`))},children:[L(`input`,{type:`radio`,name:`filter-sort-cat`,checked:K===e,onChange:()=>{de(e),pe(/(replies|favourites|reblogs|quotes)/.test(e)?`desc`:`asc`)}}),{createdAt:a({id:`mYGY3B`}),repliesCount:a({id:`N8UzTV`}),favouritesCount:a({id:`zZOZj7`}),reblogsCount:a({id:`puY2t0`}),quotesCount:a({id:`eWLklq`}),density:a({id:`0tQ7AD`})}[e],K===e&&(fe===`asc`?` ↑`:` ↓`)]},e))}),L(`span`,{class:`filter-label`,children:L(j,{id:`group.filter`})}),` `,L(`fieldset`,{class:`radio-field-group`,children:wc.map(e=>L(`label`,{class:`filter-group`,children:[L(`input`,{type:`radio`,name:`filter-group`,checked:me===e,onChange:()=>{ge(e)},disabled:e===`account`&&ce}),{account:a({id:`dpqPBg`})}[e]||a({id:`EdQY6l`})]},e||`none`))}),ce&&xe.length>1?L(`button`,{type:`button`,class:`plain6 small`,onClick:()=>{le(null)},style:{whiteSpace:`nowrap`},children:L(j,{id:`_dlmrZ`})}):null]}),L(`ul`,{class:`catchup-list catchup-filter-${W||``} ${K?`catchup-sort-${K}`:``} ${ce&&ve[ce]?`catchup-selected-author`:``} ${me?`catchup-group-${me}`:``}`,children:Se.map((e,n)=>{let r=e.reblog?.id||e.id,a=!1;return me===`account`&&(Ce.current&&e.account.id!==Ce.current&&n>0&&(a=!0),Ce.current=e.account.id),L(i,{children:[a&&L(`li`,{class:`separator`}),L(kc,{to:`/${p}/s/${r}`,post:e,root:Oe.current})]},`${e.id}-${a}`)})}),L(`footer`,{children:_e.length>5&&L(`p`,{children:[a(W===`boosts`?{id:`eVosYr`}:{id:`rhmyFK`}),` `,L(`button`,{type:`button`,class:`textual`,onClick:()=>{Oe.current.scrollTop=0},children:L(j,{id:`0MgdN-`})}),`.`]})})]})]})]}),Ae&&L(Ot,{onClose:()=>je(!1),children:L(`div`,{class:`sheet`,id:`catchup-help-sheet`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:()=>je(!1),children:L(X,{icon:`x`,alt:a({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:L(j,{id:`c3XJ18`})})}),L(`main`,{children:L(`dl`,{children:[L(`dt`,{children:L(j,{id:`EIZREX`})}),L(`dd`,{children:L(j,{id:`YmGrIy`})}),L(`dt`,{children:L(j,{id:`coaNtr`})}),L(`dd`,{children:L(j,{id:`UUrqX1`})}),L(`dt`,{children:L(j,{id:`ScQBC_`})}),L(`dd`,{children:L(j,{id:`srocAr`})}),L(`dt`,{children:L(j,{id:`77Emn0`})}),L(`dd`,{children:L(`table`,{children:L(`tbody`,{children:[L(`tr`,{children:[L(`td`,{children:L(j,{id:`Gy9P9T`})}),L(`td`,{children:L(`kbd`,{children:`j`})})]}),L(`tr`,{children:[L(`td`,{children:L(j,{id:`6XYpYY`})}),L(`td`,{children:L(`kbd`,{children:`k`})})]}),L(`tr`,{children:[L(`td`,{children:L(j,{id:`f5dduh`})}),L(`td`,{children:L(`kbd`,{children:`l`})})]}),L(`tr`,{children:[L(`td`,{children:L(j,{id:`rj0vxZ`})}),L(`td`,{children:L(`kbd`,{children:`h`})})]}),L(`tr`,{children:[L(`td`,{children:L(j,{id:`jsFF8C`})}),L(`td`,{children:L(`kbd`,{children:`Enter`})})]}),L(`tr`,{children:[L(`td`,{children:L(j,{id:`bUUv3P`})}),L(`td`,{children:L(`kbd`,{children:`.`})})]})]})})})]})})]})})]})}var Oc=K(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 L(`article`,{class:`post-line ${i?`group`:a?`reblog`:Xe()&&Ec(o)?`quote`:l?.length?`followed-tags`:``} ${p?`reply-to`:``} ${m?`filtered`:``} visibility-${d}`,onMouseEnter:e=>{e.shiftKey},children:[L(`span`,{class:`post-author`,children:a?L(`span`,{class:`post-reblog-avatar`,children:[L(Ht,{url:r.avatarStatic||r.avatar,squircle:r.bot}),f?.size>0?[...f].map(e=>L(Ht,{url:e.avatarStatic||e.avatar,squircle:e.bot})):``,` `,L(X,{icon:`rocket`}),` `,L(ht,{account:a.account,showAvatar:!0})]}):Ec(o)?L(`span`,{class:`post-quote-avatar`,children:[L(Ht,{url:r.avatarStatic||r.avatar,squircle:r.bot}),` `,L(X,{icon:`quote`}),` `,L(ht,{account:o.quotedStatus?.account||o.account,showAvatar:!0})]}):L(ht,{account:r,showAvatar:!0})}),L(Pc,{post:a||e,filterInfo:u}),L(`span`,{class:`post-meta`,children:[L(Fc,{post:a||e}),` `,L(Wt,{datetime:new Date(a?.createdAt||e.createdAt),format:`micro`})]})]})},(e,n)=>e?.post?.id===n?.post?.id),kc=({root:e,to:n,...r})=>{let i=s(),[a,o]=I(!1);return y(()=>{let n=new IntersectionObserver(e=>{e[0].isIntersecting&&(queueMicrotask(()=>o(!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)}},[]),a?L(`li`,{children:L(Q,{to:n,children:L(Oc,{...r})})}):L(`li`,{ref:i,style:{height:`4em`}})},Ac=8,jc=8;function Mc(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+vt(r)+s.length)/140+(a?.length?Ac*a.length:o?.image?jc:0)}var Nc=48;function Pc({post:e,filterInfo:n}){let{_:r}=d(),{spoilerText:a,sensitive:o,content:s,emojis:c,poll:l,mediaAttachments:u,card:f,inReplyToId:p,inReplyToAccountId:m,account:h,_thread:g,quote:v}=e,y=p&&m===h.id||!!g,b=Xe()&&Ec(v)?v.quotedStatus||v:null;(b?.spoilerText||b?.sensitive)&&(b=null),b?.emojis&&c.push(...b.emojis),!u?.length&&b?.mediaAttachments?.length&&(u=b.mediaAttachments);let x=!!_()[`reading:expand:spoilers`],S=x||!a&&!o&&n?.action!==`blur`,C=s?Ct(e):``,w=!a||x;return L(`div`,{class:`post-peek`,title:a?``:C,children:[L(`span`,{class:`post-peek-content`,children:[y&&!w&&L(i,{children:[L(`span`,{class:`post-peek-tag post-peek-thread`,children:`Thread`}),` `]}),n&&n?.action!==`blur`?L(`span`,{class:`post-peek-filtered`,children:n?.titlesStr?r({id:`suKjh3`,values:{0:n.titlesStr}}):r({id:`03Qqf9`})}):L(i,{children:[!!a&&L(`span`,{class:`post-peek-spoiler`,children:[L(X,{icon:`${x?`eye-open`:`eye-close`}`}),` `,a]}),w&&L(`div`,{class:`post-peek-html`,children:[y&&L(i,{children:[L(`span`,{class:`post-peek-tag post-peek-thread`,children:L(j,{id:`e66y2Z`})}),` `]}),!!s&&L(`div`,{dangerouslySetInnerHTML:{__html:Ve(s,c)+(b?.content?`<blockquote class="post-peek-quote">${b.content}</blockquote>`:``)}}),!!l?.options?.length&&l.options.map(e=>L(`div`,{children:[l.multiple?`▪️`:`•`,` `,e.title]})),!s&&u?.length===1&&u[0].description&&L(i,{children:[L(`span`,{class:`post-peek-tag post-peek-alt`,children:`ALT`}),` `,L(`div`,{children:u[0].description})]})]})]})]}),(!n||n?.action===`blur`)&&L(`span`,{class:`post-peek-post-content`,children:[!!l&&L(`span`,{class:`post-peek-tag post-peek-poll`,children:[L(X,{icon:`poll`,size:`s`}),L(j,{id:`4WUbF1`})]}),u?.length?u.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 L(`span`,{class:`post-peek-media`,children:{image:(n||r)&&S?L(`img`,{src:n,width:Nc,height:Nc,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`}}):L(`span`,{class:`post-peek-faux-media`,children:`🖼`}),gifv:(n||r)&&S?L(`img`,{src:n,width:Nc,height:Nc,alt:e.description,loading:`lazy`,onError:e=>{let{src:i}=e.target;i===n&&r&&n!==r&&(e.target.src=r)}}):L(`span`,{class:`post-peek-faux-media`,children:`🎞️`}),video:(n||r)&&S?L(`img`,{src:n,width:Nc,height:Nc,alt:e.description,loading:`lazy`,onError:e=>{let{src:i}=e.target;i===n&&r&&n!==r&&(e.target.src=r)}}):L(`span`,{class:`post-peek-faux-media`,children:`📹`}),audio:L(`span`,{class:`post-peek-faux-media`,children:`🎵`})}[e.type]||null},e.id)}):!!f&&f.image&&S&&L(`span`,{class:`post-peek-media post-peek-card card-${f.type||``}`,children:f.image?L(`img`,{src:f.image,width:Nc,height:Nc,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`}}):L(`span`,{class:`post-peek-faux-media`,children:`🔗`})})]})]})}function Fc({post:e}){let{_:n}=d(),{reblogsCount:r,repliesCount:i,favouritesCount:a,quotesCount:o}=e;return L(`span`,{class:`post-stats`,children:[i>0&&L(`span`,{class:`post-stat-replies`,children:[L(X,{icon:`comment2`,size:`s`,alt:n({id:`N8UzTV`})}),` `,Je(i)]}),a>0&&L(`span`,{class:`post-stat-likes`,children:[L(X,{icon:`heart`,size:`s`,alt:n({id:`zZOZj7`})}),` `,Je(a)]}),r>0||o>0?L(`span`,{class:`post-stat-boosts`,children:[L(X,{icon:`rocket`,size:`s`,alt:n({id:`puY2t0`})}),` `,r>0||o>0?`${r>0?Je(r):``}${r>0&&o>0?`+`:``}${o>0?Je(o):``}`:Je(r)]}):null]})}function Ic(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}function Lc({account:e,relationship:n,instance:r,isSelf:a,isCurator:o,onRelationshipChange:s,onSelfRemove:c}){let{masto:l}=f({instance:r}),[u,d]=I(`default`);return a?o?null:L(`div`,{class:`collection-account-actions`,children:u===`loading`?L(q,{abrupt:!0}):L(xt,{portal:!0,confirmLabel:L(i,{children:[L(X,{icon:`user-x`}),L(`span`,{children:L(j,{id:`4v_hQI`})})]}),className:`danger`,menuItemClassName:`danger`,menuFooter:L(`div`,{class:`footer`,children:[L(X,{icon:`info`}),L(j,{id:`sfZnzc`})]}),onClick:async()=>{d(`loading`);try{c&&await c(),d(`default`)}catch{d(`default`)}},children:L(`button`,{type:`button`,class:`light danger small`,disabled:u===`loading`,children:L(j,{id:`j8_z3-`})})})}):!n||n.following||n.requested?null:L(`div`,{class:`collection-account-actions`,children:u===`loading`?L(q,{abrupt:!0}):L(`button`,{type:`button`,class:`small`,disabled:u===`loading`,onClick:async()=>{d(`loading`);try{let n=await l.v1.accounts.$select(e.id).follow();d(`default`),s&&s(n)}catch{d(`default`)}},children:[L(X,{icon:`follow`}),` `,L(`span`,{children:L(j,{id:`MKEPCY`})})]})})}function Rc(e,n){let r=e.featureApproval;return[`automatic`,`manual`].includes(r?.currentUser)?`available`:(r?.automatic?.includes(`followers`)||r?.manual?.includes(`followers`))&&!n?.following?`mustFollow`:`disabled`}function zc({collectionId:e,instance:n,existingAccountIds:r=new Set,onAdded:i=()=>{},onClose:a=()=>{}}){let{_:o}=d(),{masto:c}=f({instance:n}),[l,u]=I(`default`),[p,m]=I([]),[h,_]=I({}),[v,b]=I(new Set),x=async e=>{if(!e?.length)return;let n=await tt(e,h);n&&_(e=>({...e,...n}))},S=mt(e=>{e&&(u(`loading`),(async()=>{try{let n=await c.v1.accounts.search.list({q:e,limit:30,resolve:!0});m(n),x(n),u(`default`)}catch{u(`error`)}})())},1e3),C=s();y(()=>{C.current&&C.current.focus()},[]);let w=n=>{v.has(n.id)||(b(e=>new Set([...e,n.id])),(async()=>{try{i(n,(await c.v1.collections.$select(e).items.create({accountId:n.id})).collectionItem),Z(o({id:`fx5B7p`,values:{username:n.username}}))}catch{Z(o({id:`CkOaai`}))}finally{b(e=>{let r=new Set(e);return r.delete(n.id),r})}})())},{sortedAccounts:T,footnoteGroups:E}=g(()=>{let e=[],n=[],r=[];for(let i of p){let a=h[i.id],o=Rc(i,a);o===`available`?e.push(i):(n.push(i),r.includes(o)||r.push(o))}return{sortedAccounts:[...e,...n],footnoteGroups:r}},[p,h]);return L(`div`,{id:`collection-add-account-sheet`,class:`sheet`,children:[!!a&&L(`button`,{type:`button`,class:`sheet-close`,onClick:a,children:L(X,{icon:`x`,alt:o({id:`yz7wBu`})})}),L(`header`,{children:L(`form`,{onSubmit:e=>{e.preventDefault(),S.flush?.()},children:L(`input`,{ref:C,required:!0,type:`search`,class:`block`,placeholder:o({id:`eH1bqp`}),onInput:e=>{let{value:n}=e.target;S(n)},autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,spellCheck:`false`,dir:`auto`,enterKeyHint:`search`})})}),L(`main`,{children:p?.length>0?L(`ul`,{class:`accounts-list ${l===`loading`?`loading`:``}`,children:T.map(e=>{let n=h[e.id],i=r.has(e.id),a=v.has(e.id),s=Rc(e,n),c=!i&&s===`available`;return L(`li`,{class:s===`available`?``:`disabled`,children:[L(rt,{avatarSize:`xxl`,account:e,relationship:n,showStats:!0,showActivity:!0}),i?L(`button`,{type:`button`,class:`plain`,disabled:!0,children:L(X,{icon:`check-circle`,size:`xl`,alt:``})}):c?L(`button`,{type:`button`,class:`plain2`,disabled:a,onClick:()=>w(e),children:a?L(q,{abrupt:!0}):L(X,{icon:`plus`,size:`xl`,alt:o({id:`m16xKo`})})}):L(`span`,{class:`dummy-button-wrap`,children:L(`span`,{class:`dummy-button`,children:L(`span`,{class:`dummy-button-circle`,children:E.indexOf(s)+1})})})]},e.id)})}):l===`loading`?L(`div`,{class:`ui-state`,children:L(q,{abrupt:!0})}):l===`error`?L(`div`,{class:`ui-state`,children:L(`p`,{children:L(j,{id:`AThL_k`})})}):null}),E.length>0&&L(`footer`,{class:`footnotes`,children:L(`ol`,{children:E.map(e=>L(`li`,{children:e===`disabled`?L(j,{id:`2tUUhP`}):L(j,{id:`fomSje`})},e))})})]})}var Bc=E(function({collection:e,accounts:n=[],instance:r,onClose:i=()=>{},onDataChange:a=()=>{}},o){let{_:s}=d(),{masto:c}=f({instance:r}),[l,u]=I(e?.items||[]),[p,m]=I(!1);te(o,()=>({openAddAccount:()=>m(!0)}));let[h,_]=I(new Set),[v,b]=I({}),x=g(()=>{let e={};for(let r of n)e[r.id]=r;return e},[n]);y(()=>{if(!n?.length)return;let e=!1;return tt(n,v).then(n=>{e||n&&b(e=>({...e,...n}))}),()=>{e=!0}},[n]);let S=(r,i)=>{h.has(r.id)||(_(e=>new Set([...e,r.id])),(async()=>{try{await c.v1.collections.$select(e.id).items.$select(r.id).remove();let o=l.filter(e=>e.id!==r.id);u(o),a({collectionItems:o,accounts:n}),Z(s({id:`hC_ij1`,values:{username:i.username}}))}catch{Z(s({id:`-H9yli`}))}_(e=>{let n=new Set(e);return n.delete(r.id),n})})())},C=g(()=>new Set(l.map(e=>e.accountId)),[l]);return L(`div`,{id:`collection-manage-accounts-container`,class:`sheet`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:i,children:L(X,{icon:`x`,alt:s({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:L(j,{id:`BvmBs6`})})}),L(`main`,{children:[L(`ul`,{class:`accounts-list`,children:l.map(e=>{let n=x[e.accountId];if(!n)return null;let i=h.has(e.id);return L(`li`,{children:[L(`div`,{class:`account-block-wrap`,children:[L(rt,{account:n,instance:r,relationship:v[n.id]}),e.state===`pending`&&L(`span`,{class:`tag insignificant`,children:L(j,{id:`UbRKMZ`})})]}),L(xt,{confirmLabel:L(`span`,{children:L(j,{id:`Hy80qV`,values:{username:`@${n.username}`},components:{0:L(`span`,{class:`bidi-isolate`})}})}),menuItemClassName:`danger`,align:`end`,onClick:()=>S(e,n),children:L(`button`,{type:`button`,class:`light ${i?``:`danger`}`,disabled:i,children:i?L(q,{abrupt:!0}):s({id:`MWIaew`})})})]},e.id)})}),L(`button`,{type:`button`,class:`light`,onClick:()=>m(!0),children:[L(X,{icon:`plus`}),` `,L(`span`,{children:L(j,{id:`MPPZ54`})})]})]}),p&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&m(!1)},children:L(zc,{collectionId:e.id,instance:r,existingAccountIds:C,onAdded:(e,r)=>{let i=[...l,r],o=[...n,e];u(i),a({collectionItems:i,accounts:o})},onClose:()=>m(!1)})})]})});function Vc({collection:e,domain:n,onClose:r}){let{_:i}=d(),{masto:a}=f(),o=!!n,[s,c]=I(`default`);return L(`div`,{class:`report-collection-container`,children:[L(`div`,{class:`top-controls`,children:[L(`h1`,{children:L(j,{id:`Hhfqft`})}),L(`button`,{type:`button`,class:`plain4 small`,disabled:s===`loading`,onClick:()=>r(),children:L(X,{icon:`x`,size:`xl`,alt:i({id:`yz7wBu`})})})]}),L(`main`,{children:[L(`div`,{class:`report-preview`,children:L(Rt,{collection:e})}),L(`form`,{onSubmit:o=>{o.preventDefault();let s=new FormData(o.target),l=s.get(`comment`)||void 0,u=s.get(`forwardToDomain`)===`on`;c(`loading`),(async()=>{try{await a.v1.reports.create({accountId:e.accountId,collectionIds:[e.id],category:`spam`,comment:l,forwardToDomains:u?[n]:[],forward:u}),Z(i({id:`hoxERX`})),r()}catch(e){c(`error`),Z(e?.message||i({id:`2pjfev`}))}})()},children:[L(`section`,{class:`report-comment`,children:[L(`p`,{children:L(`label`,{for:`report-collection-comment`,children:L(j,{id:`qDLFnT`})})}),L(`textarea`,{maxlength:`1000`,rows:`2`,id:`report-collection-comment`,name:`comment`,disabled:s===`loading`})]}),o&&L(`section`,{class:`report-forward-section`,children:L(`label`,{children:[L(`input`,{type:`checkbox`,switch:!0,name:`forwardToDomain`,disabled:s===`loading`}),` `,L(`span`,{children:L(j,{id:`cyjS8M`,values:{domain:n},components:{0:L(`i`,{})}})})]})}),L(`footer`,{children:[L(`button`,{type:`submit`,disabled:s===`loading`,children:L(j,{id:`4cijjm`})}),L(q,{hidden:s!==`loading`})]})]})]})]})}function Hc(e){if(!e)return;let n=URL.parse(e);if(!n)return;let{host:r,pathname:a}=n,o=a.replace(/\/$/,``);try{return L(i,{children:[T.toUnicode(r),L(`span`,{class:`more-insignificant`,children:o})]})}catch{return e}}var Uc=[{key:`date_added`,label:{id:`Rj3wWq`}},{key:`name`,label:{id:`sort.name`}},{key:`last_active`,label:{id:`mJn6Bl`}},{key:`most_followers`,label:{id:`Hu-C6L`}}];function Wc(){let{_:e,_:n}=d(),{id:r,instance:a}=A(),[o,c]=I(`date_added`),[l,u]=I(!1),[p,m]=I(!1),h=s(null),[_,v]=I(!1),{masto:b,instance:x}=f({instance:a}),{masto:S,instance:C,authenticated:w}=f(),T=x===C,[E,D]=I(),O=E?.collection||{},k=E?.accounts||[],[M,N]=I(!1),[P,te]=I(`loading`),[F,ne]=I(!1),[R,z]=I({});y(()=>{let e=!1;return te(`loading`),(async()=>{try{let n=await b.v1.collections.$select(r).fetch();if(e)return;if(!n){te(`error`);return}D(n),te(`default`)}catch{if(e)return;te(`error`)}})(),()=>{e=!0}},[r,a]),y(()=>{if(!k?.length)return;let{instance:e,authenticated:n}=f();if(!n||x!==e)return;let r=!1;return(async()=>{let e=await tt(k,R);r||e&&z(n=>({...n,...e}))})(),()=>{r=!0}},[k]);let B=g(()=>k.reduce((e,n)=>(n?.id&&(e[n.id]=n),e),{}),[k]),V=B[O.accountId]||null,re=g(()=>{let e=URL.parse(O?.url);if(!e)return{};let n=e.pathname.match(/\/collections\/([^/]+)/i);return n?{hostname:e.hostname,id:n[1]}:{}},[O?.url]),ie=g(()=>{if(!V?.acct)return``;if(V.acct.includes(`@`))return V.acct;let e=URL.parse(V?.url)?.hostname||re?.hostname||x;return e?`${V.acct}@${e}`:V.acct},[V?.acct,V?.url,re?.hostname,x]);he(ie?`${O?.name||n({id:`q-hNag`})} — @${ie}`:O?.name||n({id:`q-hNag`}),`/:instance?/c/:id`);let ae=ee(),H=V?.id===ae,U=g(()=>!O?.items||!ae?null:O.items.find(e=>e.accountId===ae)||null,[O,ae]),W=async()=>{if(U){ne(!0);try{await b.v1.collections.$select(O.id).items.$select(U.id).revoke(),D(e=>{let n=e?.collection||e;return n?{...e,collection:{...n,items:n.items.filter(e=>e.id!==U.id)}}:e}),Z(n({id:`WJQKJn`}))}catch{Z(n({id:`W-NOEj`}))}ne(!1)}},oe=g(()=>{let e=O?.items||[];if(o===`date_added`)return e;let n=[...e];switch(o){case`name`:n.sort((e,n)=>{let r=B[e.accountId]||{},i=B[n.accountId]||{},a=r.displayName||r.username||r.acct||``,o=i.displayName||i.username||i.acct||``;return a.localeCompare(o)});break;case`last_active`:n.sort((e,n)=>{let r=B[e.accountId]||{},i=B[n.accountId]||{},a=r.lastStatusAt?new Date(r.lastStatusAt).getTime():0;return(i.lastStatusAt?new Date(i.lastStatusAt).getTime():0)-a});break;case`most_followers`:n.sort((e,n)=>{let r=B[e.accountId]||{};return((B[n.accountId]||{}).followersCount||0)-(r.followersCount||0)});break}return n},[O?.items,B,o]),se=O?.language;return L(i,{children:[L(`div`,{id:`collection-page`,class:`deck-container`,tabIndex:`-1`,children:[L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),H&&L(Q,{to:x?`/${x}/a/${V.id}/c`:`/a/${V.id}/c`,class:`button plain`,"aria-label":n({id:`DoJzLz`}),children:L(X,{icon:`collections`,size:`l`})})]}),L(`h1`,{class:`header-account`,dir:`auto`,lang:se,children:P===`loading`?`…`:O?.name||n({id:`q-hNag`})}),L(`div`,{class:`header-side`,children:L(Gt,{portal:!0,setDownOverflow:!0,overflow:`auto`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:n({id:`2FYpfJ`})})}),children:[P!==`loading`&&L(Y,{href:O?.url,target:`_blank`,children:[L(X,{icon:`external`}),L(`small`,{class:`menu-double-lines should-cloak`,style:{maxWidth:`16em`},children:Hc(O?.url)})]}),w&&L(Y,{disabled:P===`loading`,onClick:()=>Nt({draftStatus:{status:`\n\n${O?.url||window.location.href}`}}),children:[L(X,{icon:`quill`}),L(`span`,{children:L(j,{id:`0IrTm_`})})]}),L(`div`,{class:`menu-horizontal`,children:[L(Y,{disabled:P===`loading`,onClick:()=>{try{let e=O?.url||window.location.href;navigator.clipboard.writeText(e),Z(n({id:`edWbV6`}))}catch{Z(n({id:`W1ewR0`}))}},children:[L(X,{icon:`link`}),L(`span`,{children:L(j,{id:`he3ygx`})})]}),navigator?.share&&L(Y,{disabled:P===`loading`,onClick:()=>{try{let e=O?.url||window.location.href;navigator.share({url:e})}catch{}},children:[L(X,{icon:`share`}),L(`span`,{children:L(j,{id:`LFKLqp`})})]})]}),L(qe,{}),L(ft,{className:`plain`,children:L(j,{id:`f6Hub0`})}),L(Ue,{value:o,onRadioChange:({value:e})=>c(e),children:Uc.map(n=>L(Y,{type:`radio`,value:n.key,disabled:P===`loading`||(O?.items?.length||0)<=2||O?.sensitive&&!H&&!M,children:[L(X,{icon:o===n.key?`check-circle`:`round-line`,alt:``}),` `,L(`span`,{children:e(n.label)})]},n.key))}),H&&L(i,{children:[L(qe,{}),L(Y,{disabled:P===`loading`,onClick:()=>u(!0),children:[L(X,{icon:`pencil`}),L(`span`,{children:L(j,{id:`ePK91l`})})]}),L(Y,{disabled:P===`loading`,onClick:()=>m(!0),children:[L(X,{icon:`group`}),L(`span`,{children:L(j,{id:`BvmBs6`})})]})]}),!H&&(U||w&&T)&&L(qe,{}),U&&!H&&L(xt,{subMenu:!0,disabled:P===`loading`||F,confirmLabel:L(i,{children:[L(X,{icon:`user-x`}),L(`span`,{children:L(j,{id:`4v_hQI`})})]}),itemProps:{className:`danger`},menuItemClassName:`danger`,menuFooter:L(`div`,{class:`footer`,children:[L(X,{icon:`info`}),L(j,{id:`sfZnzc`})]}),onClick:W,children:[L(X,{icon:`user-x`}),L(`span`,{children:L(j,{id:`j8_z3-`})})]}),!H&&w&&T&&L(Y,{className:`danger`,disabled:P===`loading`,onClick:()=>v(!0),children:[L(X,{icon:`flag`}),L(`span`,{children:L(j,{id:`NwBwmN`})})]}),w&&(!T||re?.hostname!==x)&&L(i,{children:[L(qe,{}),L(ft,{className:`plain`,children:L(j,{id:`Rsjgm0`})}),T?L(Mt,{to:`/${re.hostname}/c/${re.id}`,children:[L(X,{icon:`transfer`}),L(`small`,{class:`menu-double-lines`,children:L(j,{id:`DA_qA3`,values:{serverDomain:re.hostname}})})]}):L(Y,{disabled:P===`loading`||!yi(),onClick:()=>{te(`loading`),(async()=>{try{let e=await S.v2.search.list({q:O.url,resolve:!0,limit:1});if(e?.collections?.length){let n=e.collections[0];location.hash=C?`/${C}/c/${n.id}`:`/c/${n.id}`}else throw Error(`No results`)}catch(e){te(`default`),Z(n({id:`DnepCE`,values:{e}}))}})()},children:[L(X,{icon:`transfer`}),L(`small`,{class:`menu-double-lines`,children:L(j,{id:`SiegcM`,values:{currentInstance:C},components:{0:L(`b`,{})}})})]})]})]})})]})}),L(`main`,{children:P===`loading`?L(`p`,{class:`ui-state`,children:L(q,{})}):P===`error`?L(`p`,{class:`ui-state`,children:L(j,{id:`VC2M2a`})}):L(i,{children:[L(`section`,{class:`collection-meta`,children:[L(`h2`,{lang:se,children:O.name}),O.description&&L(`p`,{lang:se,children:L(st,{text:O.description,emojis:O.emojis,resolverURL:O.url})}),!!V&&L(`p`,{class:`sub-meta insignificant`,children:L(`small`,{children:L(j,{id:`H0Vm3h`,components:{link:L(Q,{to:x?`/${x}/a/${V.id}/c`:`/a/${V.id}/c`}),icon:L(X,{icon:`collections`}),name:L(ht,{account:{...V,acct:ie},instance:x,showAvatar:!0})}})})})]}),O.sensitive&&!H&&!M?L(`div`,{class:`collection-sensitive-container`,children:L(`button`,{type:`button`,class:`light`,onClick:()=>N(!0),children:[L(X,{icon:`eye-close`}),` `,L(`span`,{children:L(j,{id:`lqBX03`})})]})}):L(i,{children:[oe.length>0?L(`ul`,{class:`accounts-list`,children:oe.map(e=>{let n=B[e.accountId];return n?L(`li`,{tabIndex:`-1`,children:[L(rt,{account:n,instance:x,showActivity:!0,showStats:!0,avatarSize:`xxl`,relationship:R[n.id]}),!!ae&&T&&L(Lc,{account:n,relationship:R[n.id],instance:x,isSelf:n.id===ae,isCurator:H,onRelationshipChange:e=>{z(r=>({...r,[n.id]:e}))},onSelfRemove:W})]},e.id):null})}):L(`div`,{class:`ui-state`,children:[L(`p`,{class:`insignificant`,children:L(j,{id:`bHinbm`})}),H&&L(`p`,{children:L(`button`,{type:`button`,class:`light`,onClick:()=>{m(!0),setTimeout(()=>h.current?.openAddAccount(),400)},children:[L(X,{icon:`plus`}),` `,L(j,{id:`MPPZ54`})]})})]}),(oe.length>1||O?.updatedAt||O?.discoverable!==void 0)&&L(`footer`,{class:`ui-state`,children:L(`small`,{class:`insignificant`,children:[oe.length>1&&L(i,{children:[L(j,{id:`A7kMZX`,values:{0:oe.length}}),L(`br`,{})]}),O?.updatedAt&&L(j,{id:`sqjguT`,components:{relativeTime:L(Wt,{datetime:O.updatedAt,format:`micro`})}}),O?.discoverable===!1&&L(i,{children:[O?.updatedAt&&` · `,L(j,{id:`WDcQq9`})]}),O?.discoverable!==!1&&L(i,{children:[O?.updatedAt&&` · `,L(j,{id:`7d1a0d`})]}),O?.sensitive&&L(i,{children:[L(`br`,{}),L(X,{icon:`alert`,size:`s`}),` `,L(j,{id:`up99W1`})]})]})})]})]})})]}),k.length>0&&!(O?.sensitive&&!H&&!M)&&L(`div`,{id:`collection-page-bg`,"aria-hidden":`true`,children:k.filter(Boolean).slice(0,4).map(e=>L(`img`,{src:e.avatarStatic||e.avatar,alt:``,decoding:`async`,loading:`lazy`},e.id))})]}),l&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&u(!1)},children:L(As,{collection:O,onClose:e=>{e?.state===`success`&&e.collection?D(n=>n?.collection||n?{...n,collection:e.collection}:n):e?.state===`deleted`&&(location.hash=x?`/${x}/a/${ae}/c`:`/a/${ae}/c`),u(!1)}})}),p&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&m(!1)},children:L(Bc,{ref:h,collection:O,accounts:k,instance:x,onClose:()=>m(!1),onDataChange:({collectionItems:e,accounts:n})=>{D(r=>({...r,collection:{...r?.collection||r,items:e},accounts:n}))}})}),_&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&v(!1)},children:L(Vc,{collection:O,domain:V?.acct?.split(`@`)[1],onClose:()=>v(!1)})})]})}var Gc=20;function Kc(){let{_:e}=d();he(e({id:`zZOZj7`}),`/favourites`);let{masto:n,instance:r}=f(),i=s();async function a(e){return(e||!i.current)&&(i.current=n.v1.favourites.list({limit:Gc}).values()),await i.current.next()}return L(tc,{title:e({id:`zZOZj7`}),id:`favourites`,emptyText:e({id:`PHIrMr`}),errorText:e({id:`khVljG`}),instance:r,fetchItems:a})}var qc=[`home`,`public`,`notifications`,`thread`,`account`],Jc=[`thread`,`account`],Yc={home:{id:`Buy2bt`},notifications:{id:`iDNBZe`},public:{id:`RO10dm`},thread:{id:`EnJuK0`},account:{id:`vrQQgz`}},Xc=[0,1800,3600,360*60,720*60,3600*24,3600*24*7,3600*24*30],Zc={0:{id:`qqeAJM`},1800:kt(30,`minute`),3600:kt(1,`hour`),21600:kt(6,`hour`),43200:kt(12,`hour`),86400:kt(24,`hour`),604800:kt(7,`day`),2592e3:kt(30,`day`)};function Qc(){let{_:e}=d(),{masto:n}=f();he(e({id:`cSev-j`}),`/ft`);let[r,a]=I(`default`),[o,s]=I(!1),[c,l]=m(e=>e+1,0),[u,p]=I([]);return y(()=>{a(`loading`),(async()=>{try{let e=await n.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)}),p(e),a(`default`)}catch{a(`error`)}})()},[c]),L(`div`,{id:`filters-page`,class:`deck-container`,tabIndex:`-1`,children:[L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),L(`h1`,{children:L(j,{id:`cSev-j`})}),L(`div`,{class:`header-side`,children:L(`button`,{type:`button`,class:`plain`,onClick:()=>{s(!0)},children:L(X,{icon:`plus`,size:`l`,alt:e({id:`yFfBdX`})})})})]})}),L(`main`,{children:u.length>0?L(i,{children:[L(`ul`,{class:`filters-list`,children:u.map(e=>{let{id:n,title:r,expiresAt:a,keywords:o}=e;return L(`li`,{children:[L(`div`,{children:[L(`h2`,{children:r}),o?.length>0&&L(`div`,{children:o.map(e=>L(i,{children:[L(`span`,{class:`tag collapsed insignificant`,children:e.wholeWord?`“${e.keyword}”`:e.keyword}),` `]}))}),L(`small`,{class:`insignificant`,children:L(nl,{expiresAt:a})})]}),L(`button`,{type:`button`,class:`plain`,onClick:()=>{s({filter:e})},children:L(X,{icon:`pencil`,size:`l`,alt:`Edit filter`})})]},n)})}),u.length>1&&L(`footer`,{class:`ui-state`,children:L(`small`,{class:`insignificant`,children:L(j,{id:`5vzJxv`,values:{0:u.length}})})})]}):r===`loading`?L(`p`,{class:`ui-state`,children:L(q,{})}):r===`error`?L(`p`,{class:`ui-state`,children:L(j,{id:`qcAUwp`})}):L(`p`,{class:`ui-state`,children:L(j,{id:`cWIHTt`})})})]}),!!o&&L(Ot,{title:e({id:`vCSBPD`}),onClose:()=>{s(!1)},children:L(tl,{filter:o?.filter,onClose:e=>{e.state===`success`&&l(),s(!1)}})})]})}var $c=1,el=()=>$c++;function tl({filter:e,onClose:n}){let{_:r,_:i}=d(),{masto:a}=f(),[o,c]=I(`default`),l=!!e,{context:u,expiresAt:m,id:h,keywords:g,title:_,filterAction:v}=e||{},y=!!m,b=y&&new Date(m),[x,S]=I(g||[]),C=s(),[w,T]=I([]),[E,ee]=I([]),D=x.filter(e=>!w.includes(e.id)&&!E.includes(e._id));return L(`div`,{class:`sheet`,id:`filters-add-edit-modal`,children:[!!n&&L(`button`,{type:`button`,class:`sheet-close`,onClick:n,children:L(X,{icon:`x`,alt:i({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:i(l?{id:`3mOee6`}:{id:`yFfBdX`})})}),L(`main`,{children:L(`form`,{onSubmit:e=>{e.preventDefault();let r=new FormData(e.target),o=r.get(`title`),s=r.getAll(`keyword_attributes[][id]`),u=r.getAll(`keyword_attributes[][keyword]`),d=[...C.current.querySelectorAll(`input[name="keyword_attributes[][whole_word]"]`)].map(e=>e.checked),f=u.map((e,n)=>({id:s[n]||void 0,keyword:e,wholeWord:d[n]}));l&&w?.length&&w.forEach(e=>{f.push({id:e,_destroy:!0})});let p=r.getAll(`context`),m=r.get(`expires_in`),g=r.get(`filter_action`);!o||!p?.length||(c(`loading`),(async()=>{try{let e;l?(m=m===``||m===null?y?Math.floor((b-Date.now())/1e3):null:m===`0`||m===0?null:+m,e=await a.v2.filters.$select(h).update({title:o,context:p,expiresIn:m,keywordsAttributes:f,filterAction:g})):(m=+m||null,e=await a.v2.filters.create({title:o,context:p,expiresIn:m,keywordsAttributes:f,filterAction:g})),c(`default`),n?.({state:`success`,filter:e})}catch{c(`error`),alert(i(l?{id:`H8RP-h`}:{id:`Fr0hAN`}))}})())},children:[L(`div`,{class:`filter-form-row`,children:L(`label`,{children:[L(`b`,{children:L(j,{id:`MHrjPM`})}),L(`input`,{type:`text`,name:`title`,defaultValue:_,disabled:o===`loading`,dir:`auto`,enterKeyHint:`done`,required:!0})]})}),L(`div`,{class:`filter-form-keywords`,ref:C,children:[D.length?L(`ul`,{class:`filter-keywords`,children:D.map(e=>{let{id:n,keyword:r,wholeWord:a,_id:s}=e;return L(`li`,{children:[L(`input`,{type:`hidden`,name:`keyword_attributes[][id]`,value:n}),L(`input`,{name:`keyword_attributes[][keyword]`,type:`text`,defaultValue:r,disabled:o===`loading`,required:!0,dir:`auto`,enterKeyHint:`done`}),L(`div`,{class:`filter-keyword-actions`,children:[L(`label`,{children:[L(`input`,{name:`keyword_attributes[][whole_word]`,type:`checkbox`,value:n,defaultChecked:a,disabled:o===`loading`}),` `,L(j,{id:`_7UQ7y`})]}),L(`button`,{type:`button`,class:`light danger small`,disabled:o===`loading`,onClick:()=>{n?(w.push(n),T([...w])):s&&(E.push(s),ee([...E]))},children:L(X,{icon:`x`,alt:i({id:`t_YqKh`})})})]})]},`${n}-${s}`)})}):L(`div`,{class:`filter-keywords`,children:L(`div`,{class:`insignificant`,children:L(j,{id:`SYKm3p`})})}),L(`footer`,{class:`filter-keywords-footer`,children:[L(`button`,{type:`button`,class:`light`,onClick:()=>{S([...x,{_id:el(),keyword:``,wholeWord:!0}]),setTimeout(()=>{let e=C.current.querySelectorAll(`input[type="text"]`);e[e.length-1]?.focus?.()},10)},children:L(j,{id:`qn5Dbn`})}),` `,D?.length>1&&L(`small`,{class:`insignificant`,children:L(j,{id:`1JZ175`,values:{0:D.length}})})]})]}),L(`div`,{class:`filter-form-cols`,children:[L(`div`,{class:`filter-form-col`,children:[L(`div`,{children:L(`b`,{children:L(j,{id:`uqf7Yq`})})}),qc.map(e=>L(`div`,{children:[L(`label`,{class:Jc.includes(e)?`insignificant`:``,children:[L(`input`,{type:`checkbox`,name:`context`,value:e,defaultChecked:u?u.includes(e):!0,disabled:o===`loading`}),` `,r(Yc[e]),Jc.includes(e)?`*`:``]}),` `]})),L(`p`,{children:L(`small`,{class:`insignificant`,children:L(j,{id:`m0G499`})})})]}),L(`div`,{class:`filter-form-col`,children:[l&&L(j,{id:`ucJk3m`,components:{0:L(`b`,{}),1:L(nl,{expiresAt:m,showNeverExpires:!0})}}),L(`div`,{children:[L(`label`,{for:`filters-expires_in`,children:i(l?{id:`BcNdg-`}:{id:`agO_T_`})}),L(`select`,{id:`filters-expires_in`,name:`expires_in`,disabled:o===`loading`,defaultValue:l?void 0:0,children:[l&&L(`option`,{}),Xc.map(e=>L(`option`,{value:e,children:typeof Zc[e]==`function`?Zc[e]():r(Zc[e])}))]})]}),L(`p`,{children:[L(j,{id:`blQMpa`}),L(`br`,{}),p()?.mastodon>=5&&L(`label`,{class:`ib`,children:[L(`input`,{type:`radio`,name:`filter_action`,value:`blur`,defaultChecked:v===`blur`,disabled:o===`loading`}),` `,L(j,{id:`ggxOw9`})]}),` `,L(`label`,{class:`ib`,children:[L(`input`,{type:`radio`,name:`filter_action`,value:`warn`,defaultChecked:v!==`hide`&&v!==`blur`||!l,disabled:o===`loading`}),` `,L(j,{id:`jbreWy`})]}),` `,L(`label`,{class:`ib`,children:[L(`input`,{type:`radio`,name:`filter_action`,value:`hide`,defaultChecked:v===`hide`,disabled:o===`loading`}),` `,L(j,{id:`zNCBmf`})]})]})]})]}),L(`footer`,{class:`filter-form-footer`,children:[L(`span`,{children:[L(`button`,{type:`submit`,disabled:o===`loading`,children:i(l?{id:`tfDRzk`}:{id:`hYgDIe`})}),` `,L(q,{abrupt:!0,hidden:o!==`loading`})]}),l&&L(xt,{disabled:o===`loading`,align:`end`,menuItemClassName:`danger`,confirmLabel:i({id:`BPjyR2`}),onClick:()=>{c(`loading`),(async()=>{try{await a.v2.filters.$select(h).remove(),c(`default`),n?.({state:`success`})}catch{c(`error`),alert(i({id:`4Dh9J1`}))}})()},children:L(`button`,{type:`button`,class:`light danger`,onClick:()=>{},disabled:o===`loading`,children:L(j,{id:`Jb6_SB`})})})]})]})})]})}function nl({expiresAt:e,showNeverExpires:n}){let{_:r}=d(),i=!!e,a=i&&new Date(e),o=i&&Date.parse(e)<=Date.now(),[s,c]=m(e=>e+1,0);return Be(c,o||3e4),o?r({id:`M1RnFv`}):i?L(j,{id:`urGtsw`,components:{0:L(Wt,{datetime:a})}}):n&&r({id:`O1Aswy`})}function rl(){let{_:e}=d(),{masto:n,instance:r}=f();he(e({id:`Xi1_bw`}),`/fh`);let[a,o]=I(`default`),[s,c]=I([]);return y(()=>{o(`loading`),(async()=>{try{c(await Go()),o(`default`)}catch{o(`error`)}})()},[]),L(`div`,{id:`followed-hashtags-page`,class:`deck-container`,tabIndex:`-1`,children:L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),L(`h1`,{children:L(j,{id:`Xi1_bw`})}),L(`div`,{class:`header-side`})]})}),L(`main`,{children:s.length>0?L(i,{children:[L(`ul`,{class:`link-list`,children:s.map(e=>L(`li`,{children:L(Q,{to:r?`/${r}/t/${e.name}`:`/t/${e.name}`,children:[L(X,{icon:`hashtag`,alt:`#`}),` `,L(`span`,{children:e.name})]})}))}),s.length>1&&L(`footer`,{class:`ui-state`,children:L(`small`,{class:`insignificant`,children:L(j,{id:`2S_uvJ`,values:{0:s.length}})})})]}):a===`loading`?L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}):a===`error`?L(`p`,{class:`ui-state`,children:L(j,{id:`2AeREO`})}):L(`p`,{class:`ui-state`,children:L(j,{id:`vKsGhk`})})})]})})}var il=20;function al({title:e,path:n,id:r,...i}){let{_:a}=d();he(e||a({id:`following.title`}),n||`/following`);let{masto:o,streaming:c,instance:l,client:u}=f(),[p,m]=I(c),h=W(k),g=s(),_=s(),v=s();y(()=>{!c&&u?.onStreamingReady&&u.onStreamingReady(e=>{m(e)})},[u]),__BENCHMARK.end(`time-to-following`);let b=ot(`@pixelfed/home-include-reblogs`);async function x(e){(e||!_.current)&&(__BENCHMARK.start(`fetch-home-first`),g.current=o.v1.timelines.home.list({limit:il}),_.current=g.current.values()),b&&g.current?.params&&(typeof g.current.params==`string`?g.current.params+=`&include_reblogs=true`:g.current.params.include_reblogs=!0);let n=await _.current.next(),{value:r}=n;if(r?.length){let n=!1;e&&(r[0].id!==v.current&&(n=!0),v.current=r[0].id),r.forEach(e=>{Me(e,l)}),r=Rs(r,l),e&&n&&Us(),setTimeout(()=>{Hs(r,l)},100),r.sort((e,n)=>Date.parse(n.createdAt)-Date.parse(e.createdAt))}return __BENCHMARK.end(`fetch-home-first`),{...n,value:r}}async function S(){try{let e={limit:5,since_id:v.current};b&&(e.include_reblogs=!0);let{value:n}=await o.v1.timelines.home.list(e).values().next(),r=n[0]?.id===v.current;return!!(n?.length&&!r&&(v.current=n[0].id,n=Rs(n,l),n=Zt(n,`home`),n.some(e=>!e.reblog)))}catch{return!1}}return y(()=>{let e;return(async()=>{if(p){e=p.user.subscribe();for await(let n of e){if(!e)break;if(n.event===`status.update`){let e=n.payload;Me(e,l)}else if(n.event===`delete`){let e=n.payload,r=Oe(e,l);r&&(r._deleted=!0)}}}})(),()=>{e?.unsubscribe?.(),e=null}},[p]),L(tc,{title:e||a({id:`following.title`}),id:r||`following`,emptyText:a({id:`nJEKbY`}),errorText:a({id:`7QSeK6`}),instance:l,fetchItems:x,checkForUpdates:S,useItemID:!0,boostsCarousel:h.settings.boostsCarousel,...i,filterContext:`home`,showFollowedTags:!0,showReplyParent:!0})}var ol=20,sl=50,cl=1e3*60*15;function ll(e){let n=e[e.length-1];return n.items?n.items[n.items.length-1]:n}function ul(e){let n=e[0];return n.items?n.items[0]:n}function dl(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 fl({title:e,titleComponent:n,id:r,instance:a,emptyText:o,errorText:l,useItemID:u,fetchItems:p=async()=>{},checkForUpdates:m=async()=>{},checkForUpdatesInterval:h=15e3,headerStart:g,headerEnd:_,timelineStart:v,refresh:b,filterContext:S,showFollowedTags:C,showReplyParent:w,dedupeBoosts:T}){let{_:E}=d(),ee=W(k).settings.autoHideBars,{masto:D}=f({instance:a}),O=`timeline2-${r}`,A=s(null);A.current===null&&(A.current=F.account.get(O)||null);let M=!!A.current?.items?.length,P=A.current?.updatedAt,te=P?Date.now()-P:0,ne=s(),[R,z]=I(M?`default`:`start`),[B,V]=I((A.current?.showNewer??!1)||te>cl),[re,ie]=I(A.current?.showOlder??!0),[ae,H]=I(!0),U=s(),oe=s(!0),[se,ce]=I(()=>{let e=A.current?.items;return e?.length?(e.forEach(e=>{e.items?e.items.forEach(e=>{Me(e,a,{sync:!0})}):Me(e,a,{sync:!0})}),e):[]}),le=x(()=>{let e=A.current;if(!e?.items?.length||(e.updatedAt?Date.now()-e.updatedAt:1/0)<=cl)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+=ol){let i=n.slice(e,e+ol);try{let e=await D.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=>{Me(e,a,{sync:!0})})}catch{}}r.forEach(e=>{let n=c(e,a);k.statuses[n]&&(k.statuses[n]._deleted=!0)})}catch{}})()},[a,D]);y(()=>{le()},[]),ln(e=>{e&&le()},[le]);let G=s(A.current?.scrollAnchor||null),ue=x(({items:e,direction:n})=>{if(!e?.length||!U.current)return;let r=c((n===`next`?ll:ul)(e)?.id,a),i=U.current.querySelector(`[data-state-post-id~="${r}"]`);if(i){let e=U.current.getBoundingClientRect();G.current={itemId:r,offset:i.getBoundingClientRect().top-e.top,direction:n}}},[]);__BENCHMARK.start(`timeline-${r}-load`);let K=s(A.current?.minID||null),de=s(A.current?.maxID||null),fe=mt((e={})=>{let{max_id:n,min_id:i}=e,o=!n&&!i?`start`:n?`next`:i?`prev`:null;ne.current=o,z(`loading`),(async()=>{try{let n=await p(e),{max_id:i,min_id:s}=e,{value:c,originalValue:l,done:u}=n;if(u&&c==null){ie(!1),V(!1),z(`default`),__BENCHMARK.end(`timeline-${r}-load`);return}else 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=Rs(c,a)),c=zs(c,S),c=Bs(c,a),o===`start`?(K.current=f,de.current=m,ce(c),ie(d),V(!1)):o===`next`?(de.current=m,U.current.classList.add(`scrolling-next`),ce(e=>{ue({items:e,direction:`next`});let n=[...e,...c].slice(-sl);return K.current=[n[0].id].flat()[0],n}),ie(d),V(!0)):o===`prev`&&(K.current=f,U.current.classList.add(`scrolling-prev`),ce(e=>{ue({items:e,direction:`prev`});let n=[...c,...e].slice(0,sl);return de.current=[n.at(-1).id].flat().at(-1),n}),ie(!0),V(l.length>=ol))):(i&&ie(!1),s&&V(!1)),z(`default`),__BENCHMARK.end(`timeline-${r}-load`)}catch{z(`error`)}finally{fe.cancel()}})()},300,{leading:!0}),pe=Qs(U),me=$s(U),he=ec(),ge=s();y(()=>{if(!oe.current)if(se.length>0){let e=F.account.get(O)||{};F.account.set(O,{...e,items:se,minID:K.current,maxID:de.current,showNewer:B,showOlder:re,updatedAt:Date.now()})}else F.account.del(O)},[se,O,B,re]);let _e=Qe(()=>{if(!U.current||se.length===0)return;let e=dl(U.current);if(e){let n=F.account.get(O)||{};F.account.set(O,{...n,scrollAnchor:e})}},500),ve=x(({scrollDirection:e,nearReachStart:n})=>{ge.current&&(ge.current.hidden=ee&&e===`end`&&!n),_e()},[_e,ee]),{resetScrollDirection:ye}=Gs({scrollableRef:U,distanceFromEnd:2,scrollThresholdStart:44},ve);y(()=>{oe.current&&(oe.current=!1,A.current?.items?.length?be():fe())},[fe]);let be=x(async()=>{K.current&&V(await m({minID:K.current}))},[m]),xe=s();return ln(e=>{if(!oe.current){if(e){let e=Date.now()-xe.current;(!xe.current||e>1e3*3)&&be()}else xe.current=Date.now();H(e)}},[be]),Be(be,ae&&!B?h:null),N(()=>{if(R!=="default"||!U.current||!G.current)return;let e=G.current;G.current=null;let{itemId:n,offset:r,direction:i}=e,a=U.current.querySelector(`[data-state-post-id~="${n}"]`);if(a){let e=U.current.getBoundingClientRect(),n=a.getBoundingClientRect().top-e.top-r;Math.abs(n)>1&&(U.current.scrollTop+=n),setTimeout(()=>{U.current?.classList.remove(`scrolling-${i}`)},300)}},[se,R]),L(He.Provider,{value:S,children:L(`div`,{id:`${r}-page`,class:`deck-container timeline-2-container`,ref:e=>{U.current=e,pe.current=e,me.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:L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{ref:ge,onClick:e=>{e.target.closest(`a, button`)||U.current?.scrollTo({top:0,behavior:`smooth`})},onDblClick:e=>{e.target.closest(`a, button`)||fe()},children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),g??L(Q,{to:`/`,class:`button plain home-button`,children:L(X,{icon:`home`,size:`l`,alt:E({id:`i0qMbr`})})})]}),e&&(n||L(`h1`,{children:e})),L(`div`,{class:`header-side`,children:!!_&&_})]})}),!!v&&L(`div`,{class:`timeline-start ${R===`loading`?`loading`:``}`,children:v}),se.length?L(i,{children:[B&&L(`div`,{class:`timeline-pagination timeline-pagination-top ${oe.current?``:`transitioning`}`,children:[L(`button`,{type:`button`,"data-pagination-trigger":`latest`,class:`plain4 ${R===`loading`&&ne.current===`start`?`block`:``}`,onClick:()=>{fe()},disabled:R===`loading`,children:R===`loading`&&ne.current===`start`?L(q,{abrupt:!0}):L(X,{icon:`arrow-up-top`,size:`l`})}),L(`button`,{type:`button`,"data-pagination-trigger":`prev`,class:`plain4 ${R===`loading`&&ne.current===`start`?``:`block`}`,onClick:()=>{fe({min_id:K.current})},disabled:R===`loading`,children:R===`loading`&&ne.current===`prev`?L(q,{abrupt:!0}):L(X,{icon:`arrow-up`,size:`l`})})]}),L(`ul`,{class:`timeline`,children:se.map(e=>L(nc,{status:e,instance:a,useItemID:u,filterContext:S,showFollowedTags:C,showReplyParent:w},e.id))}),re?L(`div`,{class:`timeline-pagination timeline-pagination-bottom`,children:L(`button`,{type:`button`,class:`plain4 block`,"data-pagination-trigger":`next`,onClick:()=>{fe({max_id:de.current})},disabled:R===`loading`,children:R===`loading`?L(q,{abrupt:!0}):L(X,{icon:`arrow-down`,size:`l`})})}):R===`loading`?null:L(`p`,{class:`ui-state insignificant`,children:L(j,{id:`2EYeAZ`})})]}):R===`loading`?L(`ul`,{class:`timeline`,children:Array.from({length:5}).map((e,n)=>L(`li`,{children:L(Ut,{skeleton:!0})},n))}):R!==`error`&&R!==`start`&&L(`p`,{class:`ui-state`,children:o}),R===`error`&&L(`p`,{class:`ui-state`,children:[l,L(`br`,{}),L(`br`,{}),L(`button`,{type:`button`,onClick:()=>fe(),children:L(j,{id:`KDw4GX`})})]})]})})})}var pl=20;function ml({title:e,path:n,id:r,...i}){let{_:a}=d();he(e||a({id:`following.title`}),n||`/_following2`);let{masto:o,streaming:s,instance:c,client:l}=f(),[u,p]=I(s);y(()=>{!s&&l?.onStreamingReady&&l.onStreamingReady(e=>{p(e)})},[l]),__BENCHMARK.end(`time-to-following`);let m=ot(`@pixelfed/home-include-reblogs`);async function h({max_id:e,min_id:n}={}){__BENCHMARK.start(`fetch-home`);let r={limit:pl};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=>{Me(e,c)}),setTimeout(()=>{Hs(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=Rs(r,c),r=Zt(r,`home`),r.length>0):!1}catch{return!1}}return y(()=>{let e;return(async()=>{if(u){e=u.user.subscribe();for await(let n of e){if(!e)break;if(n.event===`status.update`){let e=n.payload;Me(e,c)}else if(n.event===`delete`){let e=n.payload,r=Oe(e,c);r&&(r._deleted=!0)}}}})(),()=>{e?.unsubscribe?.(),e=null}},[u]),L(fl,{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 hl={"disabled.example.com":`disabled`,"authenticated.example.com":`authenticated`};async function gl(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 _l({feed:e,feedType:n,feeds:r,instance:i}){let{masto:a,instance:o}=f({instance:i}),s=i||o;try{let i=hl[s?.toLowerCase()];if(r){if(i){let e={};return r.forEach(({feed:n,feedType:r})=>{e[`${n}_${r}`]=i}),e}let e=await gl(a,s),n={};return r.forEach(({feed:r,feedType:i})=>{n[`${r}_${i}`]=e?.configuration?.timelinesAccess?.[r]?.[i]||`public`}),n}return i||(await gl(a,s))?.configuration?.timelinesAccess?.[e]?.[n]||`public`}catch{return r?{}:`public`}}var vl=20,yl=5;function bl({media:e,columnMode:n,...r}){let{_:a}=d(),{hashtag:o,...c}=n?{}:A();r.hashtag&&(o=r.hashtag);let l=o.trim().split(/[\s+]+/);l.sort(),o=l[0];let[u,p]=oe(),m=e||!!u.get(`media`),h=m?`?media=1`:``,{masto:_,instance:v,authenticated:b}=f({instance:r?.instance||c.instance}),{masto:x,instance:S,authenticated:C}=f(),w=l.map(e=>`#${e}`).join(` `),T=a(v?m?{id:`kH0rA0`,values:{hashtagTitle:w,instance:v}}:{id:`IK0zKi`,values:{hashtagTitle:w,instance:v}}:m?{id:`hHSI3w`,values:{hashtagTitle:w}}:{id:`-ZzjRY`,values:{hashtagTitle:w}});he(T,`/:instance?/t/:hashtag`);let E=s(),ee=g(()=>V(),[]),[D,O]=I(null),M=D===`disabled`,N=D===`authenticated`&&!b,P=s(void 0);async function te(e){let n=await _l({feed:`hashtagFeeds`,feedType:`local`,instance:v});if(O(n),n===`disabled`||n===`authenticated`&&!b)return{done:!0,value:[]};let r=await _.v1.timelines.tag.$select(o).list({limit:vl,any:l.slice(1),maxId:e?void 0:P.current,onlyMedia:m?!0:void 0}).values().next(),{value:i}=r;return i?.length&&(e&&(E.current=i[0].id),i.forEach(e=>{Me(e,v,{skipThreading:m||ee})}),P.current=i[i.length-1].id),{...r,value:i}}async function F(){try{let{value:e}=await _.v1.timelines.tag.$select(o).list({limit:1,any:l.slice(1),since_id:E.current,onlyMedia:m}).values().next(),n=e[0]?.id===E.current;return e?.length&&!n?(e=Zt(e,`public`),!0):!1}catch{return!1}}let[ne,R]=I(`default`),[z,B]=I();y(()=>{(async()=>{try{B(await _.v1.tags.$select(o).fetch())}catch{}})()},[o]);let re=l.length>=yl,[ie,ae]=I(`default`),[H,U]=I([]),[W,se]=I(!1);return y(()=>{b&&(async()=>{try{let e=await _.v1.featuredTags.list();U(e),se(e.some(e=>e.name.toLowerCase()===o.toLowerCase()))}catch{}})()},[]),L(i,{children:[L(tc,{title:T,titleComponent:!!v&&L(`h1`,{class:`header-double-lines`,children:[L(`b`,{dir:`auto`,children:w}),L(`div`,{children:v})]}),id:`hashtag`,instance:v,emptyText:a(M?{id:`qbE_m4`}:N?{id:`aqJggz`}:{id:`CNSLAW`}),errorText:a({id:`yjj6Ll`}),fetchItems:te,checkForUpdates:F,useItemID:!0,view:m||ee?`media`:void 0,refresh:m,filterContext:`public`,headerEnd:L(Gt,{portal:!0,setDownOverflow:!0,overflow:`auto`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:a({id:`2FYpfJ`})})}),children:[!!z&&l.length===1&&L(i,{children:[L(xt,{subMenu:!0,confirm:z.following,confirmLabel:a({id:`ctJi7k`,values:{hashtag:o}}),disabled:ne===`loading`||!b,onClick:()=>{R(`loading`),z.following?_.v1.tags.$select(o).unfollow().then(()=>{B({...z,following:!1}),Z(a({id:`doK_ij`,values:{hashtag:o}}))}).catch(e=>{alert(e)}).finally(()=>{R(`default`)}):_.v1.tags.$select(o).follow().then(()=>{B({...z,following:!0}),Z(a({id:`R9-aEN`,values:{hashtag:o}}))}).catch(e=>{alert(e)}).finally(()=>{R(`default`)})},children:z.following?L(i,{children:[L(X,{icon:`check-circle`}),` `,L(`span`,{children:L(j,{id:`HOSk7R`})})]}):L(i,{children:[L(X,{icon:`plus`}),` `,L(`span`,{children:L(j,{id:`MKEPCY`})})]})}),L(Y,{type:`checkbox`,checked:W,disabled:ie===`loading`||!b,onClick:()=>{if(ae(`loading`),W){let e=H.find(e=>e.name.toLowerCase()===o.toLowerCase()).id;e?_.v1.featuredTags.$select(e).remove().then(()=>{se(!1),Z(a({id:`VH-Tf9`})),U(H.filter(n=>n.id!==e))}).catch(e=>{}).finally(()=>{ae(`default`)}):Z(a({id:`3OLv47`}))}else _.v1.featuredTags.create({name:o}).then(e=>{se(!0),Z(a({id:`9ra4hn`})),U(H.concat(e))}).catch(e=>{}).finally(()=>{ae(`default`)})},children:W?L(i,{children:[L(X,{icon:`check-circle`}),L(`span`,{children:L(j,{id:`9ra4hn`})})]}):L(i,{children:[L(X,{icon:`check-circle`}),L(`span`,{children:L(j,{id:`UlJ3QN`})})]})}),L(qe,{})]}),!ee&&L(i,{children:[L(ft,{className:`plain`,children:L(j,{id:`cSev-j`})}),L(Y,{type:`checkbox`,checked:!!m,onClick:()=>{m?u.delete(`media`):u.set(`media`,`1`),p(u)},children:[L(X,{icon:`check-circle`,alt:`☑️`}),` `,L(`span`,{class:`menu-grow`,children:L(j,{id:`eK4SL_`})})]}),L(qe,{})]}),L(Ge,{className:`menu-field`,disabled:re,children:({ref:e})=>L(`form`,{onSubmit:e=>{e.preventDefault();let n=e.target[0].value?.trim?.();n&&!l.some(e=>e.toLowerCase()===n.toLowerCase())&&(l.push(n),l.sort(),location.hash=v?`/${v}/t/${l.join(`+`)}${h}`:`/t/${l.join(`+`)}${h}`)},children:[L(X,{icon:`hashtag`}),L(`input`,{ref:e,type:`text`,placeholder:re?G._({id:`ouWc_D`,values:{TOTAL_TAGS_LIMIT:yl}}):a({id:`cxL5F9`}),required:!0,autocorrect:`off`,autocapitalize:`off`,spellCheck:!1,pattern:`[^##][^\\s##]+[^##]`,disabled:re,dir:`auto`,enterKeyHint:`go`})]})}),L(Xt,{takeOverflow:!0,children:l.map((e,n)=>L(Y,{disabled:l.length===1,onClick:e=>{l.splice(n,1),l.sort(),location.hash=v?`/${v}/t/${l.join(`+`)}${h}`:`/t/${l.join(`+`)}${h}`},children:[L(X,{icon:`x`,alt:a({id:`OISAkj`}),class:`danger-icon`}),L(`span`,{class:`bidi-isolate`,children:[L(`span`,{class:`more-insignificant`,children:`#`}),e]})]},e))}),L(qe,{}),L(Y,{disabled:!C,onClick:()=>{if(k.shortcuts.length>=9){alert(G._({id:`XN1xAY`,values:{SHORTCUTS_LIMIT:9}}));return}let e={type:`hashtag`,hashtag:l.join(` `),instance:v,media:m?`on`:void 0};k.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(a({id:`kfeQnS`})):(k.shortcuts.push(e),Z(a({id:`MIhb91`})))},children:[L(X,{icon:`shortcut`}),` `,L(`span`,{children:L(j,{id:`i02Lq_`})})]}),L(Y,{onClick:()=>{let e=prompt(a({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(a({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=`/${e}/t/${l.join(`+`)}${h}`)},children:[L(X,{icon:`bus`}),` `,L(`span`,{children:L(j,{id:`kesYbo`})})]}),S!==v&&L(Y,{onClick:()=>{location.hash=`/${S}/t/${l.join(`+`)}${h}`},children:[L(X,{icon:`bus`}),` `,L(`small`,{class:`menu-double-lines`,children:L(j,{id:`_AfxaA`,values:{currentInstance:S},components:{0:L(`b`,{})}})})]})]})},v+w),!n&&!!l?.length&&L(`data`,{class:`compose-data`,value:JSON.stringify({draftStatus:{status:`${l.length>1?`
|
|
22
22
|
|
|
23
|
-
`:` `}${w}`}})})]})}var xl=20;function Sl(e){let{_:n}=d(),r=W(k),{masto:a,instance:o}=f(),c=e?.id||A()?.id,l=s(),u=s();async function p(e){(e||!u.current)&&(u.current=a.v1.timelines.list.$select(c).list({limit:xl}).values());let n=await u.current.next(),{value:r}=n;return r?.length&&(e&&(l.current=r[0].id),r.forEach(e=>{Me(e,o)})),{...n,value:r}}async function m(){try{let{value:e}=await a.v1.timelines.list.$select(c).list({limit:1,since_id:l.current}),n=e[0]?.id===l.current;return e?.length&&!n?(e=Zt(e,`home`),!0):!1}catch{return!1}}let[h,g]=I([]),[_,v]=I({title:`List`});he(_.title,`/l/:id`),y(()=>{(async()=>{try{v(await Di(c))}catch{}})()},[c]);let[b,x]=I(!1),[S,C]=I(!1);return L(i,{children:[L(tc,{title:_.title,id:`list`,emptyText:n({id:`KkDhfU`}),errorText:n({id:`7QSeK6`}),instance:o,fetchItems:p,checkForUpdates:m,useItemID:!0,boostsCarousel:r.settings.boostsCarousel,filterContext:`home`,showReplyParent:!0,headerStart:L(Gt,{overflow:`auto`,menuButton:L(`button`,{type:`button`,class:`plain`,children:[L(X,{icon:`list`,size:`l`,alt:n({id:`h16FyT`})}),L(X,{icon:`chevron-down`,size:`s`})]}),onMenuChange:e=>{e.open&&Ti().then(g)},children:[L(Mt,{to:`/l`,children:L(`span`,{children:L(j,{id:`BHWx-g`})})}),h?.length>0&&L(i,{children:[L(qe,{}),h.map(e=>L(Mt,{to:`/l/${e.id}`,children:L(`span`,{children:[e.title,e.exclusive&&L(i,{children:[` `,L(Mi,{})]})]})},e.id))]})]}),headerEnd:L(Gt,{portal:!0,setDownOverflow:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:n({id:`2FYpfJ`})})}),children:[_?.exclusive&&L(i,{children:[L(ft,{className:`plain`,children:[L(Mi,{}),` `,L(j,{id:`FNptcJ`})]}),L(qe,{})]}),L(Y,{onClick:()=>x({list:_}),children:[L(X,{icon:`pencil`,size:`l`}),L(`span`,{children:L(j,{id:`ePK91l`})})]}),L(Y,{onClick:()=>C(!0),children:[L(X,{icon:`group`,size:`l`}),L(`span`,{children:L(j,{id:`hB02vO`})})]})]})},c),b&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&x(!1)},children:L(Ni,{list:b?.list,onClose:e=>{e.state===`success`&&e.list?v(e.list):e.state===`deleted`&&(location.hash=`/l`),x(!1)}})}),S&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&C(!1)},children:L(wl,{listID:c,onClose:()=>C(!1)})})]})}var Cl=40;function wl({listID:e,onClose:n}){let{_:r}=d(),{masto:i,instance:a}=f(),[o,c]=I([]),[l,u]=I(`default`),[p,m]=I(!1),h=s();async function g(n){m(!1),u(`loading`),(async()=>{try{(n||!h.current)&&(h.current=i.v1.lists.$select(e).accounts.list({limit:Cl}).values());let{done:r,value:a}=await h.current.next();a?.length?(c(n?a:o.concat(a)),m(!r)):m(!1),u(`default`)}catch{u(`error`)}})()}return y(()=>{g(!0)},[]),L(`div`,{class:`sheet`,id:`list-manage-members-container`,children:[!!n&&L(`button`,{type:`button`,class:`sheet-close`,onClick:n,children:L(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:L(j,{id:`hB02vO`})})}),L(`main`,{children:L(`ul`,{children:[o.map(n=>L(`li`,{children:[L(rt,{account:n,instance:a}),L(Tl,{account:n,listID:e})]},n.id)),p&&l==="default"&&L(at,{as:`li`,onChange:e=>e&&g(),children:L(`button`,{type:`button`,class:`light block`,onClick:g,children:L(j,{id:`uXRAkV`})})})]})})]})}function Tl({account:e,listID:n}){let{_:r}=d(),{masto:i}=f(),[a,o]=I(`default`),[s,c]=I(!1);return L(xt,{confirm:!s,confirmLabel:L(`span`,{children:L(j,{id:`j5n9Ry`,values:{0:e.username},components:{0:L(`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:L(`button`,{type:`button`,class:`light ${s?``:`danger`}`,disabled:a===`loading`,children:r(s?{id:`m16xKo`}:{id:`MWIaew`})})})}var El={added_to_collection:[`sampleAccounts`,`collection`],collection_update:[`sampleAccounts`,`collection`]},Dl={mention:[`account`,`status`],quote:[`account`,`status`],status:[`account`,`status`],reblog:[`account`,`status`],follow:[`account`],follow_request:[`account`],favourite:[`account`,`status`],poll:[`status`],update:[`status`],added_to_collection:[`account`,`collection`],collection_update:[`account`,`collection`]},Ol=[`favourite`,`reblog`,`follow`,`admin.sign_up`],kl=e=>Ol.includes(e);function Al(e){return e.filter((n,r)=>{let{type:i}=n;if(!i)return!1;let a=El[i];return a?.length?a.every(e=>!!n[e]):i===`quote`&&n.statusId?e.findIndex(e=>e.type===`quote`&&e.statusId===n.statusId)===r:!0})}function jl(e){return e.filter(e=>{let{type:n,id:r,createdAt:i}=e;if(!n)return!1;let a=Dl[n];return a?.length?a.every(n=>!!e[n]):!0})}function Ml(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 Nl(e){e=Al(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(!kl(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 Pl(e){e=jl(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(!kl(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 Fl=20,Il=new URLSearchParams;function Ll({columnMode:e,...n}){let{_:r}=d(),{masto:a,instance:o}=f(),[c]=e?[Il]:oe(),[l,u]=I(null),p=n?.type||c.get(`type`)||l;he(r(p===`private`?{id:`2BApYc`}:{id:`_bZzdR`}),`/mentions`);let[m,h]=I(!1),_=s({}),v=s(),y=s();function b(e){if(!m||!e?.length)return e;let n=ee();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=a.v1.notifications.list({limit:Fl,types:[`mention`]}).values());let n=await v.current.next(),{value:r}=n;if(r?.length){r=jl(r),e&&(y.current=r[0].id),r.forEach(({status:e})=>{Me(e,o)});let i=r.map(e=>e.status);if(m&&i?.length){let e=await tt(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=s(),C=s();async function w(e){(e||!S.current)&&(S.current=a.v1.conversations.list({limit:Fl}).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})=>{Me(e,o)});let i=r.map(e=>e.lastStatus);if(m&&i?.length){let e=await tt(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 T(...e){return p===`private`?w(...e):x(...e)}async function E(){if(p===`private`)try{let{value:e}=await a.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 a.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 D=g(()=>L(i,{children:[L(`div`,{id:`followings-option`,children:L(`label`,{children:[L(`input`,{type:`checkbox`,checked:m,onChange:e=>{h(e.target.checked)}}),` `,L(j,{id:`h4JxWH`})]})}),L(`div`,{class:`filter-bar`,children:[L(Q,{to:`/mentions`,class:p?``:`is-active`,onClick:n=>{e&&(n.preventDefault(),u(null))},children:L(j,{id:`N40H-G`})}),L(Q,{to:`/mentions?type=private`,class:p===`private`?`is-active`:``,onClick:n=>{e&&(n.preventDefault(),u(`private`))},children:L(j,{id:`zwBp5t`})})]})]}),[p,m]);return L(tc,{title:r({id:`_bZzdR`}),id:`mentions`,emptyText:r({id:`03jFGT`}),errorText:r({id:`pqR9KF`}),instance:o,fetchItems:T,checkForUpdates:E,useItemID:!0,timelineStart:D,refresh:`${p}-${m}`,filterContext:`notifications`})}var Rl=80,zl=20,Bl=new URLSearchParams,Vl=[`mention`,`status`,`reblog`,`follow`,`follow_request`,`favourite`,`poll`,`update`,`admin.sign_up`,`admin.report`,`severed_relationships`,`moderation_warning`,`quote`,`quoted_update`,`added_to_collection`,`collection_update`],Hl={block:`start`,inline:`center`,behavior:`instant`},Ul=J(()=>p()?.mastodon>=2,{expires:1e3*60*5}),Wl=J(()=>p()?.mastodon>=10,{expires:1e3*60*5});function Gl(e={}){let{masto:n}=f(),r=Wl()?Vl:void 0;return Ul()?n.v2.notifications.list({limit:zl,supportedTypes:r,...e}):n.v1.notifications.list({limit:Rl,supportedTypes:r,...e})}function Kl(e={}){return Gl(e).values()}function ql(e){return Ul()?Nl(e):Pl(e)}var Jl=[`forNotFollowing`,`forNotFollowers`,`forNewAccounts`,`forPrivateMentions`,`forLimitedAccounts`,`forBots`],Yl={forNotFollowing:{id:`gBOf4F`},forNotFollowers:{id:`ULVw6q`},forNewAccounts:{id:`PdNgnE`},forPrivateMentions:{id:`S2vQN5`},forLimitedAccounts:{id:`3W4MYO`},forBots:{id:`9KK2rC`}};function Xl({columnMode:e}){let{_:n,_:r}=d();he(r({id:`iDNBZe`}),`/notifications`);let{masto:a,instance:o}=f(),c=W(k),[l,u]=I(`default`),[p]=e?[Bl]:oe(),m=p.get(`id`),h=p.get(`access_token`),[_,v]=I(!1),[b,S]=I(!1),[w,T]=I(!1),[E,ee]=I(!1),D=s(),{nearReachEnd:O,scrollDirection:A,reachStart:M,nearReachStart:N}=Ws({scrollableRef:D}),P=c.settings.autoHideBars&&A===`end`&&!N,[te,ne]=I([]),[R,z]=I([]),B=s(),V=s();async function re(n){if((n||!V.current)&&(B.current=Gl({excludeTypes:[`follow_request`]}),V.current=B.current.values()),/max_id=($|&)/i.test(V.current?.nextParams))return{done:!0};let r=await V.current.next(),i=Ml(r.value);if(i?.length){i.forEach(e=>{Me(e.status,o,{skipThreading:!0})});let r=ql(i);n?(k.notificationsLast=r[0],k.notifications=r,a.v1.markers.create({notifications:{lastReadId:r[0].id}}).catch(()=>{}),e||me(r)):k.notifications.push(...r)}return k.notificationsShowNew=!1,k.notificationsLastFetchTime=Date.now(),r}async function ie(){try{return await a.v1.followRequests.list({limit:80})}catch{return[]}}async function ae(){try{return await a.v1.announcements.list()}catch{return[]}}let H=ot(`@mastodon/filtered-notifications`),U=ot(`@mastodon/notification-bot-filter`),[se,ce]=I(!1),[le,G]=I({});function ue(){return a.v2.notifications.policy.fetch().catch(()=>{})}function K(){ue().then(e=>{G(e)}).catch(()=>{})}let[de,fe]=I(null);function pe(){return a.v1.notifications.requests.list()}let me=e=>{if(w)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}}T(o||s||c||u),ee(Date.now())},ge=e=>{ve(!1),u(`loading`),(async()=>{try{let n=re(e);e&&(ae().then(e=>{e.sort((e,n)=>Date.parse(n.updatedAt||n.createdAt)-Date.parse(e.updatedAt||e.createdAt)),z(e)}).catch(()=>{}),ie().then(e=>{ne(e)}).catch(()=>{}),H&&K());let{done:r}=await n;v(!r),u(`default`)}catch{u(`error`)}})()};y(()=>{ge(!0)},[]),y(()=>{M&&ge(!0)},[M]);let[_e,ve]=I(!1),ye=x(({disableIdleCheck:e=!1}={})=>{l!==`loading`&&c.settings.autoRefresh&&D.current?.scrollTop<16&&(e||window.__IDLE__)&&!Zl()&&ge(!0)},[c.notificationsShowNew,c.settings.autoRefresh,l]),be=s();ln(e=>{if(e){let e=Date.now()-be.current;!be.current||e>1e3*3?ye({disableIdleCheck:!0}):be.current=Date.now()}});let xe=s(!0);y(()=>{let e=C(k,`notificationsShowNew`,e=>{if(xe.current){xe.current=!1;return}l!==`loading`&&(e&&ye(),ve(e))});return()=>e?.()},[]);let Se=new Date,Ce=new Date(Se-1440*60*1e3),we=new Date,Te=!c.notifications.some(e=>new Date(e.createdAt).toDateString()===Se.toDateString()),Ee=s();y(()=>{m&&(k.routeNotification={id:m,accessToken:atob(h)})},[m,h]);let[De,J]=I(null);y(async()=>{let e=new Date;if(e.getMonth()!==11)return;let n=e.getFullYear();if(!ot(`@mastodon/annual-report`))return;let r=F.account.get(`annualReportNotification`);if(r&&r?.annualReport?.year==n){J(r);return}let i=Kl({types:[`annual_report`]});try{r=(await i.next())?.value?.notificationGroups?.[0],r?.annualReport?.year==n&&(J(r),F.account.set(`annualReportNotification`,r))}catch{}},[]);let Oe=`.notification`,ke=nt(`j`,()=>{let e=document.activeElement.closest(Oe),n=e?.getBoundingClientRect(),r=Array.from(D.current.querySelectorAll(Oe));if(e&&n.top<D.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(Hl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Hl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),Ae=nt(`k`,()=>{let e=document.activeElement.closest(Oe),n=e?.getBoundingClientRect(),r=Array.from(D.current.querySelectorAll(Oe));if(e&&n.top<D.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(Hl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Hl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),je=nt([`enter`,`o`],()=>{let e=document.activeElement.closest(Oe)?.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`}),Ne=nt(`.`,()=>{ge(!0),D.current?.scrollTo({top:0,behavior:`smooth`})},{useKey:!0,ignoreEventWhen:e=>e.key===`.`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),Pe=new Date,Fe=g(()=>Jt(Pe,{forceOpts:{weekday:`long`}}),[Pe]);return L(`div`,{id:`notifications-page`,class:`deck-container`,ref:e=>{D.current=e,ke.current=e,Ae.current=e,je.current=e,Ne.current=e},tabIndex:`-1`,children:[L(`div`,{class:`timeline-deck deck ${b?`only-mentions`:``}`,children:[L(`header`,{hidden:P,onClick:e=>{e.target.closest(`a, button`)||D.current?.scrollTo({top:0,behavior:`smooth`})},onDblClick:e=>{e.target.closest(`a, button`)||ge(!0)},class:l===`loading`?`loading`:``,children:[L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:r({id:`i0qMbr`})})})]}),L(`h1`,{children:L(j,{id:`iDNBZe`})}),L(`div`,{class:`header-side`,children:H&&L(`button`,{type:`button`,class:`button plain4`,onClick:()=>{ce(!0)},children:L(X,{icon:`settings`,size:`l`,alt:r({id:`a_-arl`})})})})]}),_e&&l!==`loading`&&L(`button`,{class:`updates-button shiny-pill`,type:`button`,onClick:()=>{ge(!0),D.current?.scrollTo({top:0,behavior:`smooth`})},children:[L(X,{icon:`arrow-up`}),` `,L(j,{id:`Jy9RU_`})]})]}),R.length>0&&L(`div`,{class:`shazam-container`,children:L(`div`,{class:`shazam-container-inner`,children:L(`details`,{class:`announcements`,children:[L(`summary`,{children:[L(`span`,{children:[L(X,{icon:`announce`,class:`announcement-icon`,size:`l`}),` `,L(j,{id:`0whvLM`,values:{0:R.length}}),` `,L(`small`,{class:`insignificant`,children:o})]}),R.length>1&&L(`span`,{class:`announcements-nav-buttons`,children:R.map((e,n)=>L(`button`,{type:`button`,class:`plain2 small`,onClick:()=>{Ee.current?.children[n].scrollIntoView({behavior:`smooth`,block:`nearest`})},children:n+1}))})]}),L(`ul`,{class:`announcements-list-${R.length>1?`multiple`:`single`}`,ref:Ee,children:R.map(e=>L(`li`,{children:L(Ql,{announcement:e})}))})]})})}),te.length>0&&L(`div`,{class:`follow-requests`,children:[L(`h2`,{class:`timeline-header`,children:L(j,{id:`6Fs1Ba`})}),te.length>5?L(`details`,{children:[L(`summary`,{children:L(j,{id:`7dHKu4`,values:{0:te.length}})}),L(`ul`,{children:te.map(e=>L(`li`,{children:[L(rt,{account:e}),L(cs,{accountID:e.id,onChange:()=>{}})]},e.id))})]}):L(`ul`,{children:te.map(e=>L(`li`,{children:[L(rt,{account:e}),L(cs,{accountID:e.id,onChange:()=>{}})]},e.id))})]}),H&&le?.summary?.pendingRequestsCount>0&&L(`div`,{class:`shazam-container`,children:L(`div`,{class:`shazam-container-inner`,children:L(`div`,{class:`filtered-notifications`,children:L(`details`,{onToggle:async e=>{let{open:n}=e.target;n&&fe(await pe())},children:[L(`summary`,{children:L(j,{id:`N3Bq0f`,values:{0:le.summary.pendingRequestsCount}})}),de?de?.length>0&&L(`ul`,{children:de.map(e=>L(`li`,{children:[L(`div`,{class:`request-notifcations`,children:[!e.lastStatus?.id&&L(rt,{useAvatarStatic:!0,showStats:!0,account:e.account}),e.lastStatus?.id&&L(`div`,{class:`last-post`,children:L(Q,{class:`status-link`,to:`/${o}/s/${e.lastStatus.id}`,children:L(Ut,{status:e.lastStatus,size:`s`,readOnly:!0})})}),L(eu,{request:e})]}),L(tu,{request:e,onChange:()=>{ge(!0)}})]},e.id))}):L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})})]})})})}),De&&L(`div`,{class:`shazam-container`,children:L(`div`,{class:`shazam-container-inner`,children:L(_s,{notification:De})})}),!!E&&L(`div`,{id:`mentions-option`,children:w?L(Q,{to:`/mentions`,class:`button plain`,children:[L(X,{icon:`at`}),` `,L(`span`,{children:L(j,{id:`_bZzdR`})}),` `,L(X,{icon:`arrow-right`,class:`more-insignificant`})]}):L(`label`,{children:[L(`input`,{type:`checkbox`,checked:b,onChange:e=>{S(e.target.checked)}}),` `,L(j,{id:`0udtPI`})]})}),L(`h2`,{class:`timeline-header`,children:[L(j,{id:`ecUA8p`}),` `,L(`small`,{class:`insignificant bidi-isolate`,children:Fe})]}),Te&&L(`p`,{class:`ui-state insignificant`,children:l==="default"?r({id:`KS7iJH`}):L(i,{children:`…`})}),c.notifications.length?L(He.Provider,{value:`notifications`,children:c.notifications.filter(e=>e.type!==`follow_request`).map(e=>{if(b&&e.type!==`mention`)return null;let n=new Date(e.createdAt),a=n.toDateString()!==we.toDateString();a&&(we=n);let s=n.toDateString()===Ce.toDateString()?r({id:`y_0uwd`}):Jt(we,{hideTime:!0}),c=Jt(we,{forceOpts:{weekday:`long`}});return L(i,{children:[a&&L(`h2`,{class:`timeline-header`,children:[L(`span`,{children:s}),` `,L(`small`,{class:`insignificant bidi-isolate`,children:c})]}),L(_s,{instance:o,notification:e},e._ids||e.id)]},e._ids||e.id)})}):L(i,{children:[l===`loading`&&L(i,{children:L(`ul`,{class:`timeline flat`,children:Array.from({length:5}).map((e,n)=>L(`li`,{class:`notification skeleton`,children:[L(`div`,{class:`notification-type`,children:L(X,{icon:`notification`,size:`xl`})}),L(`div`,{class:`notification-content`,children:L(`p`,{children:`███████████ ████`})})]}))})}),l===`error`&&L(`p`,{class:`ui-state`,children:[L(j,{id:`gjzl8E`}),L(`br`,{}),L(`br`,{}),L(`button`,{type:`button`,onClick:()=>ge(!0),children:L(j,{id:`KDw4GX`})})]})]}),_&&L(at,{onChange:e=>{e&&ge()},children:L(`button`,{type:`button`,class:`plain block`,disabled:l===`loading`,onClick:()=>ge(),style:{marginBlockEnd:`6em`},children:l===`loading`?L(q,{abrupt:!0}):L(j,{id:`uXRAkV`})})})]}),H&&se&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&ce(!1)},children:L(`div`,{class:`sheet`,id:`notifications-settings`,tabIndex:`-1`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:()=>ce(!1),children:L(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:L(j,{id:`a_-arl`})})}),L(`main`,{children:L(`form`,{onSubmit:e=>{e.preventDefault();let{forNotFollowing:n,forNotFollowers:i,forNewAccounts:o,forPrivateMentions:s,forLimitedAccounts:c,forBots:l}=e.target,u={...le,forNotFollowing:n.value,forNotFollowers:i.value,forNewAccounts:o.value,forPrivateMentions:s.value,forLimitedAccounts:c.value};U&&(u.forBots=l?.value),G(u),ce(!1),(async()=>{try{await a.v2.notifications.policy.update(u),Z(r({id:`4-7X9i`}))}catch{}})()},children:[L(`p`,{children:L(j,{id:`J4ONfI`})}),L(`div`,{class:`notification-policy-fields`,children:Jl.filter(e=>e!==`forBots`||U).map(e=>{let r=le[e];return L(`div`,{children:L(`label`,{children:[n(Yl[e]),L(`select`,{name:e,defaultValue:r,class:`small`,children:[L(`option`,{value:`accept`,children:L(j,{id:`g3UF2V`})}),L(`option`,{value:`filter`,children:L(j,{id:`o7J4JM`})}),L(`option`,{value:`drop`,children:L(j,{id:`gbbkE7`})})]})]})},e)})}),L(`p`,{children:L(`button`,{type:`submit`,children:L(j,{id:`tfDRzk`})})})]})})]})})]})}function Zl(){return!!document.querySelector(`.deck-backdrop, #modal-container > *`)}function Ql({announcement:e}){let{instance:n}=f(),{contact:r}=H(),a=r?.account,{id:o,content:s,startsAt:c,endsAt:l,published:u,allDay:d,publishedAt:p,updatedAt:m,read:h,mentions:g,statuses:_,tags:v,emojis:y,reactions:b}=e,x=new Date(p),S=Jt(x),C=new Date(m),w=Jt(C);return L(`div`,{class:`announcement-block`,children:[L(rt,{account:a}),L(`div`,{class:`announcement-content`,onClick:Ze({mentions:g,instance:n}),dangerouslySetInnerHTML:{__html:ct(s,{emojis:y})}}),L(`p`,{class:`insignificant`,children:[L(`time`,{datetime:x.toISOString(),children:Jt(x)}),m&&w!==S&&L(i,{children:[` `,`•`,` `,L(`span`,{class:`ib`,children:L(j,{id:`TbFrLc`,values:{0:Jt(C)},components:{0:L(`time`,{datetime:C.toISOString()})}})})]})]}),L(`div`,{class:`announcement-reactions`,hidden:!0,children:b.map(e=>{let{name:n,count:r,me:i,staticUrl:a,url:o}=e;return L(`button`,{type:`button`,class:`plain4 small ${i?`reacted`:``}`,children:[o||a?L(`img`,{src:o||a,alt:n,width:`16`,height:`16`}):L(`span`,{children:n}),` `,L(`span`,{class:`count`,children:Je(r)})]})})})]})}function $l(e){let{masto:n}=f();return n.v1.notifications.list({accountID:e})}function eu({request:e}){let{instance:n}=f(),[r,a]=I(`loading`),{account:o,lastStatus:s}=e,[c,l]=I(!1),[u,d]=I([]);function p(){l(!1)}return y(()=>{e?.account?.id&&c&&(a(`loading`),(async()=>{d(await $l(e.account.id)||[]),a(`default`)})())},[c,e?.account?.id]),L(i,{children:[L(`button`,{type:`button`,class:`plain4 request-notifications-account`,onClick:()=>{l(!0)},children:[L(X,{icon:`notification`,class:`more-insignificant`}),` `,L(`small`,{children:L(j,{id:`H0wUNM`,values:{0:o.username},components:{0:L(`span`,{class:`bidi-isolate`})}})}),` `,L(X,{icon:`chevron-down`})]}),c&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&p()},children:L(`div`,{class:`sheet`,tabIndex:`-1`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:p,children:L(X,{icon:`x`,alt:t`Close`})}),L(`header`,{children:L(`b`,{children:L(j,{id:`MXOmPt`,values:{0:o.username},components:{0:L(`span`,{class:`bidi-isolate`})}})})}),L(`main`,{children:r===`loading`?L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}):u.map(e=>L(`div`,{class:`notification-peek`,onClick:e=>{let{target:n}=e;(e.target.tagName===`BUTTON`||e.target.tagName===`A`)&&p()},children:L(_s,{instance:n,notification:e,isStatic:!0})}))})]})})]})}function tu({request:e,onChange:n}){let{_:r}=d(),{masto:i}=f(),[a,o]=I(`default`),[s,c]=I(null),l=s!==null;return L(`p`,{class:`notification-request-buttons`,children:[L(`button`,{type:`button`,disabled:a===`loading`||l,onClick:()=>{Qt.trigger(`success`),o(`loading`),(async()=>{try{await i.v1.notifications.requests.$select(e.id).accept(),c(`accept`),o(`default`),n({request:e,state:`accept`}),Z(r({id:`ZtBMwU`,values:{0:e.account.username}}))}catch{o(`error`),Z(r({id:`S92JKG`}))}})()},children:L(j,{id:`h7peZQ`})}),` `,L(`button`,{type:`button`,disabled:a===`loading`||l,class:`light danger`,onClick:()=>{Qt.trigger(`light`),o(`loading`),(async()=>{try{await i.v1.notifications.requests.$select(e.id).dismiss(),c(`dismiss`),o(`default`),n({request:e,state:`dismiss`}),Z(r({id:`ibBDry`,values:{0:e.account.username}}))}catch{o(`error`),Z(r({id:`S5aemF`}))}})()},children:L(j,{id:`1QfxQT`})}),L(`span`,{class:`notification-request-states`,children:a===`loading`?L(q,{abrupt:!0}):s===`accept`?L(X,{icon:`check-circle`,alt:r({id:`bzMKg7`}),class:`notification-accepted`}):s===`dismiss`&&L(X,{icon:`x-circle`,alt:r({id:`J6hrEy`}),class:`notification-dismissed`})})]})}var nu=K(Xl),ru=20;function iu({local:e,columnMode:n,...r}){let{_:a}=d(),o=W(k),c=!!e,l=n?{}:A(),{masto:u,authenticated:p,instance:m}=f({instance:r?.instance||l.instance}),{instance:h}=f(),g=a(c?{id:`u96B_B`,values:{instance:m}}:{id:`PgVqvd`,values:{instance:m}});he(g,c?`/:instance?/p/l`:`/:instance?/p`);let _=s(),[v,y]=I(null),b=v===`disabled`,x=v===`authenticated`&&!p,S=s();async function C(e){if(e||!S.current){let e=await _l({feed:`liveFeeds`,feedType:c?`local`:`remote`,instance:m});if(y(e),e===`disabled`||e===`authenticated`&&!p)return{done:!0,value:[]};let n={limit:ru,local:c||void 0};!c&&ot(`@pixelfed/global-feed`)&&(n.remote=!0),S.current=u.v1.timelines.public.list(n).values()}let n=await S.current.next(),{value:r}=n;return r?.length&&(e&&(_.current=r[0].id),r.forEach(e=>{Me(e,m)})),{...n,value:r}}async function w(){if(b||x)return!1;try{let{value:e}=await u.v1.timelines.public.list({limit:1,local:c,since_id:_.current}).values().next(),n=e[0]?.id===_.current;return e?.length&&!n?(e=Zt(e,`public`),!0):!1}catch{return!1}}return L(tc,{title:g,titleComponent:L(`h1`,{class:`header-double-lines`,children:[L(`b`,{children:a(c?{id:`pJQgQV`}:{id:`cg0I-x`})}),L(`div`,{children:m})]}),id:`public`,instance:m,emptyText:a(b?{id:`qbE_m4`}:x?{id:`aqJggz`}:{id:`BiZJ6G`}),errorText:a({id:`scd9lw`}),fetchItems:C,checkForUpdates:w,useItemID:!0,headerStart:L(i,{}),boostsCarousel:o.settings.boostsCarousel,filterContext:`public`,headerEnd:L(Gt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:a({id:`2FYpfJ`})})}),children:[L(Y,{href:c?`/#/${m}/p`:`/#/${m}/p/l`,children:c?L(i,{children:[L(X,{icon:`transfer`}),` `,L(`span`,{children:L(j,{id:`dXMiUw`})})]}):L(i,{children:[L(X,{icon:`transfer`}),` `,L(`span`,{children:L(j,{id:`t2B_we`})})]})}),L(qe,{}),L(Y,{onClick:()=>{let e=prompt(a({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(a({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=c?`/${e}/p/l`:`/${e}/p`)},children:[L(X,{icon:`bus`}),` `,L(`span`,{children:L(j,{id:`kesYbo`})})]}),h!==m&&L(Y,{onClick:()=>{location.hash=c?`/${h}/p/l`:`/${h}/p`},children:[L(X,{icon:`bus`}),` `,L(`small`,{class:`menu-double-lines`,children:L(j,{id:`_AfxaA`,values:{currentInstance:h},components:{0:L(`b`,{})}})})]})]})},m+c)}function au({onItemClick:e}){let{_:n}=d(),{instance:r}=f(),[,i]=m(e=>e+1,0),a=ys(),o=()=>{Cs(),Z({text:n({id:`hgPsUe`}),delay:1e3}),i()},s=(e,n)=>{Ss(e,n),i()},[c]=lr();return a.length===0?null:L(`div`,{class:`recent-searches`,children:[L(`div`,{class:`recent-searches-header`,children:[L(X,{icon:`history`}),` `,L(`span`,{children:L(j,{id:`4R1B1H`})}),L(`span`,{class:`spacer`}),L(`button`,{type:`button`,class:`plain4 small`,onClick:o,disabled:a.length<=0,children:L(`span`,{children:L(j,{id:`yYxB17`})})})]}),L(`ul`,{class:`link-list recent-searches-list`,ref:c,children:a.map(i=>{let{label:a,to:o,icon:c}=ws(i.query,i.queryType,r);return L(`li`,{class:`recent-searches-item`,children:[L(Q,{to:o,class:`recent-searches-link`,onClick:n=>{xs(i.query,i.queryType),e?.(n)},children:[L(X,{icon:c,class:`more-insignificant`}),L(`span`,{class:`recent-searches-label`,children:a})]}),L(`button`,{type:`button`,class:`plain4 small`,onClick:()=>s(i.query,i.queryType),children:L(X,{icon:`trash`,alt:n({id:`xCJdfg`})})})]},`${i.query}-${i.queryType}-${i.timestamp}`)})})]})}var ou=5,su=40,cu=new URLSearchParams,lu={block:`start`,inline:`center`,behavior:`instant`};function uu({columnMode:e,...n}){let{_:r}=d(),{masto:a,instance:o,authenticated:c}=f({instance:(e?{}:A()).instance}),[l,u]=I(`default`),[p]=e?[cu]:oe(),m=s(),h=n?.query||p.get(`q`),_=e?`statuses`:n?.type||p.get(`type`),v=r({id:`A1taO8`});if(h)switch(_){case`statuses`:v=r({id:`6YeoAt`,values:{q:h}});break;case`accounts`:v=r({id:`fpgumQ`,values:{q:h}});break;case`hashtags`:v=r({id:`AuiMZZ`,values:{q:h}});break;default:v=r({id:`wr3GZI`,values:{q:h}})}he(v,`/search`);let[b,x]=I(!1),S=s(0),C=s(0);y(()=>{S.current=0},[h,_]);let w=s();N(()=>{w.current?.scrollTo?.(0,0)},[h,_]);let[T,E]=I([]),[ee,D]=I([]),[O,k]=I([]),[M,P]=I([]);y(()=>{E([]),D([]),k([]),P([])},[h]);let te={statuses:T,accounts:ee,hashtags:O,collections:M},F={statuses:E,accounts:D,hashtags:k,collections:P},[ne,R]=I({}),z=async e=>{if(!e?.length)return;let n=await tt(e,ne);n&&R(e=>({...e,...n}))},B=g(()=>[{key:`accounts`,label:r({id:`bPwFdf`}),seeMoreLabel:r({id:`BMmtZ8`}),emptyLabel:r({id:`YYB61U`}),listClass:`timeline flat accounts-list`,results:ee,renderItem:e=>L(`li`,{children:L(rt,{account:e,instance:o,showStats:!0,relationship:ne[e.id]})},e.id)},{key:`hashtags`,label:r({id:`VwUsHI`}),seeMoreLabel:r({id:`Nc_W5J`}),emptyLabel:r({id:`4MFM3P`}),listClass:`link-list hashtag-list`,results:O,renderItem:e=>{let{name:n,history:r}=e,i=r?.reduce?.((e,n)=>e+ +n.uses,0);return L(`li`,{children:L(Q,{to:o?`/${o}/t/${n}`:`/t/${n}`,children:[L(X,{icon:`hashtag`,alt:`#`}),L(`span`,{children:n}),!!i&&L(`span`,{class:`count`,children:Je(i)})]})},n)}},{key:`collections`,label:r({id:`DoJzLz`}),emptyLabel:null,listClass:`collections-list`,results:M,renderItem:e=>L(`li`,{children:L(Rt,{collection:e,instance:o,size:`l`})},e.id)},{key:`statuses`,label:r({id:`-owNNn`}),seeMoreLabel:r({id:`LYCgej`}),emptyLabel:r({id:`Hzi9AA`}),listClass:`timeline`,results:T,renderItem:e=>L(`li`,{children:L(Q,{class:`status-link`,to:o?`/${o}/s/${e.id}`:`/s/${e.id}`,children:L(Ut,{status:e})})},e.id)}].filter(e=>!_||e.key===_).filter(e=>e.key!==`collections`||e.results.length>0).sort((e,n)=>_?0:e.results.length>0&&n.results.length===0?-1:+(e.results.length===0&&n.results.length>0)),[_,ee,O,M,T,o,ne]);function V(e){if(e&&(S.current=0),!e&&!c)return;u(`loading`),e&&!_&&(E(T.slice(0,ou)),D(ee.slice(0,ou)),k(O.slice(0,ou)),P(M.slice(0,ou)));let n=++C.current;(async()=>{let r={q:h,resolve:c,limit:ou};_&&(r.limit=su,r.type=_,c&&(r.offset=S.current));try{let i=await a.v2.search.list(r);if(C.current!==n)return;if(_)if(e){F[_](i[_]);let e=i[_]?.length;S.current=su,x(!!e)}else if(i[_]?.[0]?.id===te[_]?.[0]?.id)x(!1);else{F[_](e=>[...e,...i[_]]);let e=i[_]?.length;S.current+=su,x(!!e)}else E(i.statuses||[]),D(i.accounts||[]),k(i.hashtags||[]),P(i.collections||[]),S.current=0,x(!1);z(i.accounts),u(`default`)}catch{if(C.current!==n)return;u(`error`)}})()}let re=s();ln(e=>{let n=w.current?.scrollTop===0;if(e&&n){let e=Date.now()-re.current;!re.current||e>1e3*3?V(!0):re.current=Date.now()}}),y(()=>{let e;return m.current?.setValue?.(h||``),h?V(!0):e=setTimeout(()=>{m.current?.focus?.()},150),()=>clearTimeout(e)},[h,_,o]),nt([`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 ie=`.timeline > li > a, .hashtag-list > li > a, .collections-list > li > a`,ae=nt(`j`,()=>{let e=document.activeElement.closest(ie),n=e?.getBoundingClientRect(),r=Array.from(w.current.querySelectorAll(ie));if(e&&n.top<w.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(lu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(lu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),H=nt(`k`,()=>{let e=document.activeElement.closest(ie),n=e?.getBoundingClientRect(),r=Array.from(w.current.querySelectorAll(ie));if(e&&n.top<w.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(lu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(lu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),[U]=lr();return L(`div`,{id:`search-page`,class:`deck-container`,tabIndex:`-1`,ref:e=>{w.current=e,ae.current=e,H.current=e},children:L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{class:l===`loading`?`loading`:``,children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:L(Ns,{})}),L(Ts,{ref:m}),L(`div`,{class:`header-side`,children:L(`button`,{type:`button`,class:`plain`,onClick:()=>{V(!0)},disabled:l===`loading`,children:L(X,{icon:`search`,size:`l`,alt:r({id:`A1taO8`})})})})]})}),L(`main`,{children:[!!h&&!e&&L(`div`,{ref:U,class:`filter-bar ${l===`loading`?`loading`:``}`,children:[!!_&&L(Q,{to:`/search${h?`?q=${encodeURIComponent(h)}`:``}`,children:[L(X,{icon:`chevron-left`}),` `,L(j,{id:`N40H-G`})]}),[{label:r({id:`bPwFdf`}),type:`accounts`,to:`/search?q=${encodeURIComponent(h)}&type=accounts`},{label:r({id:`VwUsHI`}),type:`hashtags`,to:`/search?q=${encodeURIComponent(h)}&type=hashtags`},{label:r({id:`-owNNn`}),type:`statuses`,to:`/search?q=${encodeURIComponent(h)}&type=statuses`}].sort((e,n)=>e.type===_?-1:+(n.type===_)).map(e=>L(Q,{to:e.to,children:e.label},e.type))]}),h?L(i,{children:[B.map(e=>L(i,{children:[!_&&L(`h2`,{class:`timeline-header`,children:[e.label,` `,e.seeMoreLabel&&L(Q,{to:`/search?q=${encodeURIComponent(h)}&type=${e.key}`,children:L(X,{icon:`arrow-right`,size:`l`,alt:r({id:`V1fa9u`})})})]}),e.results.length>0?L(i,{children:[L(`ul`,{class:e.listClass,children:e.results.map(e.renderItem)}),!_&&e.seeMoreLabel&&L(`div`,{class:`ui-state`,children:L(Q,{class:`plain button`,to:`/search?q=${encodeURIComponent(h)}&type=${e.key}`,children:[e.seeMoreLabel,` `,L(X,{icon:`arrow-right`})]})})]}):!_&&e.emptyLabel&&(l===`loading`?L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}):L(`p`,{class:`ui-state`,children:e.emptyLabel}))]},e.key)),!!_&&(l==="default"?b?L(at,{onChange:e=>{e&&V()},children:L(`button`,{type:`button`,class:`plain block`,onClick:()=>V(),style:{marginBlockEnd:`6em`},children:L(j,{id:`uXRAkV`})})}):L(`p`,{class:`ui-state insignificant`,children:L(j,{id:`2EYeAZ`})}):l===`loading`&&L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}))]}):l===`loading`?L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}):L(i,{children:[L(`p`,{class:`ui-state insignificant`,children:L(j,{id:`fGn1Hk`})}),L(au,{})]})]})]})})}var du=20,fu=600*1e3,pu=a(e=>e.v1.trends.links.list().values().next(),{expires:fu}),mu=a(e=>e.v1.trends.tags.list().values().next(),{expires:fu});function hu(e){return ot(`@pixelfed/trending`)?e.pixelfed.v2.discover.posts.trending.list({range:`daily`}).values():e.v1.trends.statuses.list({limit:du}).values()}function gu(e,n){return e.v1.timelines.link.list(n).values()}function _u({columnMode:e,...n}){let{_:r}=d(),a=W(k),o=e?{}:A(),{masto:c,instance:l,authenticated:p}=f({instance:n?.instance||o.instance}),{masto:m,instance:h}=f(),_=r({id:`cI3UEs`,values:{instance:l}});he(_,`/:instance?/trending`);let v=s(),b=l===h,[x,S]=I([]),[C,w]=I([]),T=s();async function E(e){if(e||!T.current){if(T.current=hu(c),ot(`@mastodon/trending-hashtags`))try{let{value:e}=await mu(c);e?.length&&S(e)}catch{}if(ot(`@mastodon/trending-links`))try{let{value:e}=await pu(c,l),n=e?.filter?.(e=>e.type===`link`);n?.length&&w(n)}catch{}}let n=await T.current.next(),{value:r}=n;return r?.length&&(e&&(v.current=r[0].id),r.forEach(e=>{Me(e,l)})),{...n,value:r}}let[ee,D]=I(!1),O=s(),[M,N]=I(null),P=!!M,te=s(),F=b&&ot(`@mastodon/trending-link-posts`);y(()=>{M&&te.current&&te.current.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[M]);let ne=s();async function R(e){(e||!O.current)&&(D(!0),O.current=gu(c,{url:M})),ne.current=M;let n=await O.current.next(),{value:r}=n;return r?.length&&(r=Zt(r,`public`),r.forEach(e=>{Me(e,l)})),ne.current===M&&D(!1),{...n,value:r}}async function z(){try{let{value:e}=await c.v1.trends.statuses.list({limit:1}).values().next();return e=Zt(e,`public`),e?.length&&e[0].id!==v.current?(v.current=e[0].id,!0):!1}catch{return!1}}let B=g(()=>L(i,{children:[!!x.length&&L(`div`,{class:`filter-bar expandable`,children:[L(X,{icon:`chart`,class:`insignificant`,size:`l`}),x.map((e,n)=>{let{name:r,history:i}=e,a=i.reduce((e,n)=>e+ +n.uses,0);return L(Q,{to:`/${l}/t/${r}`,children:[L(`span`,{dir:`auto`,children:[L(`span`,{class:`more-insignificant`,children:`#`}),r]}),L(`span`,{class:`filter-count`,children:Je(a)})]},r)})]}),!!C.length&&L(`div`,{class:`links-bar`,children:[L(`header`,{children:L(`h3`,{children:L(j,{id:`9veeTb`})})}),C.map(e=>{let{authors:n,authorName:r,authorUrl:a,blurhash:o,description:s,height:c,image:l,imageDescription:d,language:f,providerName:p,providerUrl:m,publishedAt:h,title:g,url:_,width:v}=e,y=n?.[0]?.account?.id?n[0].account:null,b=g.length<30,x=!!(r||y),S=u(_),C;if(o){let e=Ca(St(o));C=ya([.6,e[1],e[2]])}return L(`div`,{children:[L(`a`,{ref:M===_?te:null,href:_,target:`_blank`,rel:`noopener`,class:`link-block ${P?M===_?`active`:`inactive`:``}`,style:C?{"--accent-color":`rgb(${C.join(`,`)})`,"--accent-alpha-color":`rgba(${C.join(`,`)}, 0.4)`}:{},children:L(`article`,{children:[L(`figure`,{children:L(`img`,{src:l,alt:d,width:v,height:c,loading:`lazy`})}),L(`div`,{class:`article-body`,children:[L(`header`,{children:[L(`div`,{class:`article-meta`,children:[L(`span`,{class:`domain`,children:S}),` `,!!h&&L(i,{children:`· `}),!!h&&L(i,{children:L(Wt,{datetime:h,format:`micro`})})]}),!!g&&L(`h1`,{class:`title`,lang:f,dir:`auto`,title:g,children:g})]}),!!s&&L(`p`,{class:`description ${x&&!b?``:`more-lines`}`,lang:f,dir:`auto`,title:s,children:s}),x&&L(i,{children:[L(`hr`,{}),L(`p`,{class:`byline`,children:L(`small`,{children:L(j,{id:`aavdrC`,values:{0:y?L(ht,{account:y,showAvatar:!0}):a?L(`a`,{href:a,target:`_blank`,rel:`noopener`,children:r}):r}})})})]})]})]})}),F&&L(`button`,{type:`button`,class:`small plain4 block`,onClick:()=>{N(_)},disabled:_===M,children:[L(X,{icon:`comment2`}),` `,L(`span`,{children:L(j,{id:`_bZzdR`})}),` `,L(X,{icon:`chevron-down`})]})]},_)})]}),F&&!!C.length&&L(`div`,{class:`timeline-header-block ${P?`blended`:``}`,children:P?L(i,{children:[L(`div`,{style:{width:50,flexShrink:0,textAlign:`center`},children:ee?L(q,{abrupt:!0}):L(`button`,{type:`button`,class:`light`,onClick:()=>{N(null)},children:L(X,{icon:`x`,alt:r({id:`9Q_4xJ`})})})}),L(`p`,{children:L(j,{id:`BATCqf`,values:{0:M.replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``)},components:{0:L(`span`,{class:`link-text`})}})})]}):L(`p`,{class:`insignificant`,children:L(j,{id:`Vosm4k`})})})]}),[x,C,M,ee]);return L(tc,{title:_,titleComponent:L(`h1`,{class:`header-double-lines`,children:[L(`b`,{children:L(j,{id:`4_iCqx`})}),L(`div`,{children:l})]}),id:`trending`,instance:l,emptyText:r({id:`6HA9-s`}),errorText:r({id:`scd9lw`}),fetchItems:P?R:E,checkForUpdates:P?void 0:z,checkForUpdatesInterval:300*1e3,useItemID:!0,headerStart:L(i,{}),boostsCarousel:a.settings.boostsCarousel,filterContext:`public`,timelineStart:B,refresh:M,clearWhenRefresh:!0,view:P?`link-mentions`:void 0,headerEnd:L(Gt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:r({id:`2FYpfJ`})})}),children:[L(Y,{onClick:()=>{let e=prompt(r({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(r({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=`/${e}/trending`)},children:[L(X,{icon:`bus`}),` `,L(`span`,{children:L(j,{id:`kesYbo`})})]}),h!==l&&L(Y,{onClick:()=>{location.hash=`/${h}/trending`},children:[L(X,{icon:`bus`}),` `,L(`small`,{class:`menu-double-lines`,children:L(j,{id:`_AfxaA`,values:{currentInstance:h},components:{0:L(`b`,{})}})})]})]})},l)}var vu={block:`nearest`,inline:`nearest`,behavior:`instant`};function yu(){let{_:e}=d();he(e({id:`i0qMbr`}),`/`);let{shortcuts:n}=W(k),r=n.map(e=>{if(!e)return null;let{type:n,...r}=e,i={following:al,notifications:nu,list:Sl,public:iu,bookmarks:_c,favourites:Kc,hashtag:bl,mentions:Ll,trending:_u,search:uu,profile:uc}[n];return!i||n===`search`&&!r.query||n===`list`&&!r.id?null:(n===`profile`&&(r.id=ee()),L(i,{...r,columnMode:!0},n+JSON.stringify(r)))});return nt([`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(vu))}catch{}},{useKey:!0,ignoreEventWhen:e=>{let n=/^[1-9]$/.test(e.key);return e.metaKey||e.ctrlKey||e.altKey||e.shiftKey&&!n}}),nt([`[`,`]`],(e,n)=>{let r=n.keys[0],i=document.activeElement.closest(`#columns > *`),a=Ft(),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(vu))},{useKey:!0,ignoreEventWhen:e=>[`[`,`]`].includes(e.key)?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),L(`div`,{id:`columns`,onContextMenu:e=>{e.target.closest(`.deck > header`)&&!e.target.closest(`a`)&&!e.target.closest(`button`)&&(e.preventDefault(),k.showShortcutsSettings=!0)},onFocus:()=>{let e=document.activeElement.closest(`#columns > *`);e&&document.querySelectorAll(`#columns > *`).forEach(n=>{n.classList.toggle(`focus`,n===e)})},children:r})}function bu(){let{_:e}=d(),n=W(k);return __BENCHMARK.end(`time-to-home`),y(()=>{(async()=>{let e=await Ke.drafts.keys();if(e.length){let n=r();e.filter(e=>e.startsWith(n)).length&&(k.showDrafts=!0)}})()},[]),L(i,{children:(n.settings.shortcutsViewMode===`multi-column`||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&n.shortcuts?.length?L(yu,{}):n.settings.paginatedTimeline?L(ml,{title:e({id:`i0qMbr`}),path:`/`,id:`home`,headerStart:!1,headerEnd:L(xu,{})}):L(al,{title:e({id:`i0qMbr`}),path:`/`,id:`home`,headerStart:!1,headerEnd:L(xu,{})})})}function xu(){let{_:e}=d(),n=W(k),r=s(),[a,o]=I(void 0);return L(i,{children:[L(Q,{ref:r,to:`/notifications`,class:`button plain notifications-button ${n.notificationsShowNew?`has-badge`:``} ${a||``}`,onClick:e=>{e.stopPropagation(),window.matchMedia(`(min-width: calc(40em))`).matches&&(e.preventDefault(),o(e=>e?void 0:`open`))},children:L(X,{icon:`notification`,size:`l`,alt:e({id:`iDNBZe`})})}),L(Cu,{state:a,anchorRef:r,onClose:()=>o(void 0)})]})}var Su=5;function Cu({anchorRef:e,state:n,onClose:r}){let{masto:a,instance:o}=f(),c=W(k),[l,u]=I(`default`),d=Kl();async function p(){let e=await d.next(),n=Ml(e.value);if(n?.length){n.forEach(e=>{Me(e.status,o,{skipThreading:!0})});let e=ql(n);k.notificationsLast=e[0],k.notifications=e,a.v1.markers.create({notifications:{lastReadId:e[0].id}}).catch(()=>{})}return k.notificationsShowNew=!1,k.notificationsLastFetchTime=Date.now(),e}let[m,h]=I(!1);function g(){return a.v1.followRequests.list({limit:1})}function _({skipFollowRequests:e=!1}={}){u(`loading`),(async()=>{try{await p(),e||h(!!(await g())?.length),u(`default`)}catch{u(`error`)}})()}let v=s();return y(()=>{n===`open`&&(c.notificationsShowNew?v.current?.scrollTop<=52&&_({skipFollowRequests:!0}):_())},[n,c.notificationsShowNew]),L(At,{ref:v,menuClassName:`notifications-menu`,state:n,anchorRef:e,onClose:r,portal:{target:document.body},containerProps:{onClick:()=>{v.current?.closeMenu?.()}},overflow:`auto`,viewScroll:`close`,position:`anchor`,align:`center`,boundingBoxPadding:`8 8 8 8`,children:[L(`header`,{children:L(`h2`,{children:L(j,{id:`iDNBZe`})})}),L(He.Provider,{value:`notifications`,children:L(`main`,{children:c.notifications.length?L(i,{children:c.notifications.slice(0,Su).map(e=>L(_s,{instance:o,notification:e,disableContextMenu:!0},e._ids||e.id))}):l===`loading`?L(`div`,{class:`ui-state`,children:L(q,{abrupt:!0})}):l===`error`&&L(`div`,{class:`ui-state`,children:[L(`p`,{children:L(j,{id:`5GFQTh`})}),L(`p`,{children:L(`button`,{type:`button`,onClick:_,children:L(j,{id:`KDw4GX`})})})]})})}),L(`footer`,{children:[L(Q,{to:`/mentions`,class:`button plain`,children:[L(X,{icon:`at`}),` `,L(`span`,{children:L(j,{id:`_bZzdR`})})]}),L(Q,{to:`/notifications`,class:`button plain2`,children:[m?L(j,{id:`OdVhdR`,components:{0:L(`span`,{class:`tag collapsed`}),1:L(`span`,{})}}):L(`b`,{children:L(j,{id:`gukqfD`})}),` `,L(X,{icon:`arrow-right`})]})]})]})}var wu=K(bu),Tu=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Eu(e){let n=URL.parse(e);if(!n)return{};let{hostname:r,pathname:i}=n;for(let e of Tu){let[,n]=i.match(e)||[];if(n)return{instance:r,id:n}}return{}}function Du(e){let{instance:n,id:r}=Eu(e);return n&&r?`/${n}/s/${r}`:null}function Ou(){let e=ie().pathname.replace(/^\//,``),n=Eu(e),r=n?.instance?`/${n.instance}/s/${n.id}`:null,[a,o]=I(`loading`);return N(()=>{o(`loading`),(async()=>{try{let{instance:e,id:i}=n;if(i){let{masto:n}=f({instance:e});if(await n.v1.statuses.$select(i).fetch()){window.location.hash=r+`?view=full`;return}}}catch{}{let{masto:n,instance:i}=f(),a=await n.v2.search.list({q:e,limit:1,resolve:!0});if(a.statuses?.length){let e=a.statuses[0];window.location.hash=`/${i}/s/${e.id}?view=full`}else if(a.accounts?.length){let e=a.accounts[0];window.location.hash=`/${i}/a/${e.id}`}else if(a.collections?.length){let e=a.collections[0];window.location.hash=`/${i}/c/${e.id}`}else r?window.location.hash=r+`?view=full`:o(`error`)}})()},[r]),L(`div`,{class:`ui-state`,tabIndex:`-1`,children:[a===`loading`?L(i,{children:[L(q,{abrupt:!0}),L(`h2`,{children:L(j,{id:`RTAr_z`})}),L(`p`,{children:L(`a`,{href:e,target:`_blank`,rel:`noopener`,children:e})})]}):L(i,{children:[L(`h2`,{children:L(j,{id:`ufzZSJ`})}),L(`p`,{children:L(`a`,{href:e,target:`_blank`,rel:`noopener`,children:e})})]}),L(`hr`,{}),L(`p`,{children:L(Q,{to:`/`,children:L(j,{id:`iWpEwy`})})})]})}function ku(){let{_:e}=d();he(e({id:`h16FyT`}),`/l`);let[n,r]=I(`default`),[a,o]=m(e=>e+1,0),[s,c]=I([]);y(()=>{r(`loading`),(async()=>{try{c(await wi()),r(`default`)}catch{r(`error`)}})()},[a]);let[l,u]=I(!1),f=s.some(e=>e.exclusive);return L(`div`,{id:`lists-page`,class:`deck-container`,tabIndex:`-1`,children:[L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`})})]}),L(`h1`,{children:L(j,{id:`h16FyT`})}),L(`div`,{class:`header-side`,children:L(`button`,{type:`button`,class:`plain`,onClick:()=>u(!0),children:L(X,{icon:`plus`,size:`l`,alt:e({id:`Sb2gYF`})})})})]})}),L(`main`,{children:s.length>0?L(i,{children:[L(`ul`,{class:`link-list`,children:s.map(e=>L(`li`,{children:L(Q,{to:`/l/${e.id}`,children:[L(X,{icon:`list`}),` `,L(`span`,{children:[e.title,e.exclusive&&L(i,{children:[` `,L(Mi,{insignificant:!0})]})]})]})}))}),s.length>1&&L(`footer`,{class:`ui-state`,children:[f&&L(`p`,{children:L(`small`,{class:`insignificant`,children:[L(Mi,{}),` `,L(j,{id:`FNptcJ`})]})}),L(`p`,{children:L(`small`,{class:`insignificant`,children:L(j,{id:`8prZNK`,values:{0:s.length}})})})]})]}):n===`loading`?L(`p`,{class:`ui-state`,children:L(q,{})}):n===`error`?L(`p`,{class:`ui-state`,children:L(j,{id:`v_l5uA`})}):L(`p`,{class:`ui-state`,children:L(j,{id:`IvPikw`})})})]}),l&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&u(!1)},children:L(Ni,{list:l?.list,onClose:e=>{e.state===`success`&&o(),u(!1)}})})]})}var Au=``+new URL(`instances-BNPptnn-.json`,import.meta.url).href;function ju(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 Nu(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:Pu}={};function Fu(){let{_:e}=d();he(e({id:`sQia9P`}),`/login`);let n=s(),r=F.local.get(`instanceURL`),[i,a]=I(`default`),[o]=oe(),c=o.get(`instance`),l=o.get(`submit`),[u,f]=I(c||r?.toLowerCase()||``),[p,m]=I([]),h=s();y(()=>{(async()=>{try{let e=await(await fetch(Au)).json();m(e),h.current=new Dt(e)}catch{}})()},[]);let g=n=>{n&&(async()=>{try{let e=await(await fetch(`${location.protocol}//${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),a(`loading`);try{let r=ne(n);(!r||!r.client_id||!r.client_secret)&&(r=await Cr({instanceURL:n}),ae(n,r));let{client_id:i,client_secret:o}=r,s=await hr({instanceURL:n}),c=ue(n),l;if(s&&window.isSecureContext)if(i&&o){let[e,r]=await wr({instanceURL:n,client_id:i,forceLogin:c});F.sessionCookie.set(`codeVerifier`,r),l=e}else{alert(e({id:`ZP1FIA`})),a(`default`);return}else if(i&&o)l=await Tr({instanceURL:n,client_id:i,forceLogin:c});else{alert(e({id:`ZP1FIA`})),a(`default`);return}let u=ju(l);u?Nu(u,e=>{let n=`${window.location.origin}${window.location.pathname}?code=${encodeURIComponent(e)}`;window.location.href=n},e=>{a(`error`)}):location.href=l,a(`default`)}catch{a(`error`)}})()},_=u?u.replace(/^https?:\/\//,``).replace(/\/+$/,``).replace(/^@?[^@]+@/,``).trim():null,v=(/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(_)||/^localhost(:\d+)?$/i.test(_))&&!/[\s\/\\@]/.test(_),b=_?h.current?.search(_,{limit:10})?.map(e=>e.item):[],x=v?_:b?.length?b[0]:u?p.find(e=>e.includes(u)):null;return l&&y(()=>{g(c||x)},[]),L(`main`,{id:`login`,style:{textAlign:`center`},children:L(`form`,{onSubmit:e=>{e.preventDefault(),g(x)},children:[L(`h1`,{children:[L(`img`,{src:jr,alt:``,width:`80`,height:`80`}),L(`br`,{}),L(j,{id:`sQia9P`})]}),L(`label`,{children:[L(`p`,{children:L(j,{id:`sGH11W`})}),L(`input`,{value:u,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?L(`ul`,{id:`instances-suggestions`,children:b.map((e,n)=>L(`li`,{children:L(`button`,{type:`button`,class:`plain5`,onClick:()=>{g(e)},children:e})}))}):L(`div`,{id:`instances-eg`,children:L(j,{id:`_OvbEC`})})]}),i===`error`&&L(`p`,{class:`error`,children:L(j,{id:`yCXori`})}),L(`div`,{children:[L(`button`,{disabled:i===`loading`||!u||!x,children:e(x?{id:`2xahsi`,values:{selectedInstanceText:x}}:{id:`xGVfLh`})}),` `]}),L(q,{hidden:i!==`loading`}),L(`hr`,{}),!Pu&&L(`p`,{children:L(`a`,{href:`https://joinmastodon.org/servers`,target:`_blank`,children:L(j,{id:`LcOiWS`})})}),L(`p`,{children:L(Q,{to:`/`,children:L(j,{id:`iWpEwy`})})}),L(Nr,{})]})})}var Iu=40;function Lu(){let{_:e}=d(),n=W(k);he(e({id:`-GkIdc`}),`/sp`);let{masto:r}=f(),[i,a]=I([]),[o,s]=I(`default`),[c,l]=m(e=>e+1,0),[u,p]=I(!1);return y(l,[n.reloadScheduledPosts]),y(()=>{s(`loading`),(async()=>{try{let e=r.v1.scheduledStatuses.list({limit:Iu}).values(),n=[],i;do i=(await e.next()).value,i?.length&&n.push(...i);while(i?.length);a(n)}catch{s(`error`)}finally{s(`default`)}})()},[c]),L(`div`,{id:`scheduled-posts-page`,class:`deck-container`,tabIndex:`-1`,children:L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),L(`h1`,{children:L(j,{id:`-GkIdc`})}),L(`div`,{class:`header-side`,children:L(Gt,{portal:!0,setDownOverflow:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:e({id:`2FYpfJ`})})}),children:L(Y,{onClick:()=>{l()},children:[L(X,{icon:`refresh`,size:`l`}),L(`span`,{children:L(j,{id:`lCF0wC`})})]})})})]})}),L(`main`,{children:[i.length?L(`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:m,quoteApprovalPolicy:h}=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:m,quoteApprovalPolicy:h};return L(`li`,{children:L(Ru,{status:g,scheduledAt:i,onClick:()=>{p({post:g,scheduledAt:new Date(i)})}})},n)})}):L(`p`,{class:`ui-state`,children:o===`loading`?L(q,{}):e({id:`mZYb1f`})}),u&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&p(!1)},children:L(zu,{post:u.post,scheduledAt:u.scheduledAt,onClose:()=>p(!1)})})]})]})})}function Ru({status:e,scheduledAt:n,onClick:r}){let i=g(()=>{let e=(Date.parse(n)-Date.now())/(1e3*60*60);return e<24?`time`:e<720?`day`:`month`},[n]);return L(`button`,{type:`button`,class:`textual block`,onClick:r,children:[L(`div`,{class:`post-schedule-meta post-schedule-${i}`,children:[L(X,{icon:i,class:`insignificant`}),` `,L(`span`,{children:L(j,{id:`aEp6lO`,values:{0:Jt(n,{formatOpts:{weekday:`short`,second:`numeric`}})},components:{0:L(`b`,{}),1:L(Wt,{datetime:n}),2:L(`small`,{})}})})]}),L(Ut,{status:e,size:`s`,previewMode:!0,readOnly:!0})]})}function zu({post:e,scheduledAt:n,onClose:r}){let{masto:i,instance:a}=f(),{_:o}=d(),[s,c]=I(`default`),[l,u]=I(),p=l&&l.getTime()!==n.getTime(),m=Vt(),h=n&&n<=Date.now(),{inReplyToId:g}=e,[_,v]=I(null),{quotedStatusId:y}=e;return L(`div`,{id:`scheduled-post-sheet`,class:`sheet`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:r,children:L(X,{icon:`x`,size:`l`,alt:o({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:[L(j,{id:`orjBLU`,components:{0:L(`b`,{}),1:L(Wt,{datetime:n})}}),L(`br`,{}),L(`small`,{children:Jt(n,{formatOpts:{weekday:`short`,second:`numeric`}})})]})}),L(`main`,{tabIndex:`-1`,children:[!!_&&L(`div`,{class:`status-reply`,children:L(Ut,{status:_,size:`s`,previewMode:!0,readOnly:!0})}),L(Ut,{status:e,size:`s`,previewMode:!0,readOnly:!0,onMediaClick:(n,r,i,a)=>{n.preventDefault(),k.showMediaModal={mediaAttachments:e.mediaAttachments,mediaIndex:r}}}),L(`form`,{onSubmit:n=>{n.preventDefault(),c(`loading`),(async()=>{try{await i.v1.scheduledStatuses.$select(e.id).update({scheduledAt:l.toISOString()}),Z(o({id:`40naR1`})),r(),c(`default`),k.reloadScheduledPosts++}catch{c(`error`),Z(o({id:`ZM3jAs`}))}})()},children:L(`footer`,{children:[L(`div`,{class:`row`,children:L(`span`,{children:[L(Pt,{scheduledAt:n,setScheduledAt:e=>{u(e)}}),` `,L(`small`,{class:`ib`,children:m})]})}),L(`div`,{class:`row`,children:[L(`button`,{disabled:!p||s===`loading`||h,children:L(j,{id:`QqW27M`})}),L(`span`,{class:`grow`}),L(xt,{align:`end`,menuItemClassName:`danger`,confirmLabel:o({id:`09u3Kk`}),onClick:()=>{c(`loading`),(async()=>{try{await f().masto.v1.scheduledStatuses.$select(e.id).remove(),Z(o({id:`_zL_Mq`})),r(),c(`default`),k.reloadScheduledPosts++}catch{c(`error`),Z(o({id:`aOh6Md`}))}})()},children:L(`button`,{type:`button`,class:`light danger`,disabled:s===`loading`||h,children:L(j,{id:`Jb6_SB`})})})]})]})})]})]})}function Bu(){let{_:e}=d(),{prevEditedAt:n,nextEditedAt:r,editedAtIndex:i,editHistoryMode:a,editHistoryRef:o,exitEditHistory:s}=dt();return a?L(`div`,{class:`edit-history-controls`,children:[L(X,{icon:`edit`}),L(`b`,{class:`edit-history-heading`,children:e({id:`HSA2au`})}),L(`span`,{class:`spacer`}),L(`span`,{class:`edit-history-pagination`,children:[L(`button`,{type:`button`,class:`plain4`,onClick:()=>{n()},disabled:!a||i+1>=o.current.length,children:L(X,{icon:`chevron-left`,alt:e({id:`DHhJ7s`})})}),` `,o.current.length-i,` /`,` `,o.current.length,` `,L(`button`,{type:`button`,class:`plain4`,onClick:()=>{r()},disabled:!a||i<=0,children:L(X,{icon:`chevron-right`,alt:e({id:`hXzOVo`})})})]}),L(`button`,{type:`button`,class:`plain3`,onClick:()=>{s()},children:L(X,{icon:`exit`,alt:e({id:`ydzS9x`})})})]}):null}var{PHANPY_DEFAULT_INSTANCE:Vu}={},Hu=40,Uu=10,Wu=5,Gu={},Ku={},qu={};function Ju(e){delete Ku[e],delete qu[e]}var Yu={block:`nearest`,inline:`center`,behavior:`instant`},Xu=`.status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)`,Zu=/\/s\//i;function Qu(e){let{_:n}=d(),{id:r}=e,{masto:i,instance:a}=f({instance:e.instance}),o=W(k),[s,u]=oe(),p=s.get(`media`),m=s.get(`media-only`),h=parseInt(p||m,10),_=h>0,v=s.get(`mediaStatusID`),b=Oe(v,a);v&&!b&&(_=!1);let S=_&&!!m,C=c(r,a),[w,T]=I(k.statuses[C]);y(()=>{k.statuses[C]&&T(k.statuses[C])},[C]),y(()=>{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=g(()=>{let{prevLocation:e}=k,n=(e?.pathname||``)+(e?.search||``),r=l(`/:instance/s/:id`,n)||l(`/s/:id`,n);return!n||r?`/`:n},[]);y(()=>{!w&&_&&(async()=>{try{let e=await i.v1.statuses.$select(r).fetch();Me(e,a),T(e)}catch{alert(n({id:`H_MI1F`})),location.hash=E}})()},[_]);let ee=v?o.statuses[c(v,a)]?.mediaAttachments:w?.mediaAttachments,D=()=>window.matchMedia(`(min-width: calc(40em + 350px))`).matches?`large`:`small`,O=x(()=>{D()===`small`&&o.prevLocation?history.back():S?location.hash=E:(s.delete(`media`),s.delete(`mediaStatusID`),u(s))},[S,E,o.prevLocation]),A=x((e,n,r,i)=>{if(D()===`large`&&!S){O();return}if(_&&document.startViewTransition){let{id:e,blurhash:a,url:o}=r[n],s=Kt(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=``}),O()}).ready.finally(()=>{l.style.viewTransitionName=``,l.dataset.viewTransitioned=s}):O()}else O()},[_,S]);return y(()=>{let e=setTimeout(()=>{let e=document.querySelector(`.carousel`);e&&e.focus()},100);return()=>clearTimeout(e)},[S]),y(()=>{let e=document.querySelectorAll(`.deck-container`);return e.forEach(e=>{e.setAttribute(`inert`,``)}),()=>{e.forEach(e=>{e.removeAttribute(`inert`)})}},[]),L(`div`,{class:`deck-backdrop`,children:[_?ee?.length?L(Fa,{mediaAttachments:ee,statusID:v||r,instance:a,lang:w?.language,index:h-1,onClose:A}):L(`div`,{class:`media-modal-container loading`,children:L(q,{abrupt:!0})}):L(Q,{to:E}),!S&&L(Yt,{statusID:r,children:L(rd,{id:r,instance:e.instance,closeLink:E})})]})}function $u(e){let{linkable:n,to:r,onClick:i,...a}=e;return n?L(Q,{class:`status-link`,to:r,onClick:i,...a}):L(`div`,{class:`status-focus`,tabIndex:0,...a})}function ed(e,n){return Date.parse(e.createdAt)-Date.parse(n.createdAt)}var td=1e3*60*60*24*30,nd=typeof Intl?.Segmenter==`function`?new Intl.Segmenter:null;function rd({id:e,closeLink:n=`/`,instance:r}){let{_:a}=d(),[o,l]=oe(),u=o.get(`media`),p=o.get(`mediaStatusID`),m=parseInt(u,10)>0,h=s(!k.prevLocation&&(history.length===1||`navigation`in window&&navigation?.entries?.()?.length===1)),[_,v]=I(o.get(`view`)||h.current?`full`:null),b=!!parseInt(o.get(`translate`)),{masto:S,instance:C}=f({instance:r}),{masto:w,instance:E,authenticated:ee}=f(),D=C===E,O=W(k),[A,M]=I([]),[P,te]=I(`default`),F=s(),ne=c(e,C),z=s(0),B=s();y(()=>{B.current?.focus()},[]),y(()=>{let n=tn(()=>{if(!B.current)return;let{scrollTop:n}=B.current;P!==`loading`&&(qu[e]=n)},50);return B.current?.addEventListener(`scroll`,n,{passive:!0}),n(),()=>{n.cancel(),B.current?.removeEventListener(`scroll`,n)}},[e,P!==`loading`]);let{editHistoryMode:V,initEditHistory:re,editedAtIndex:ie,editHistoryRef:ae}=dt(),H=s(),U=s(),[se,ce]=I(0),le=s(null),ue=()=>{if(!le.current)return;let{ancestors:n,descendants:r,heroStatus:i}=le.current;if(V&&r?.length){let e=ae.current[ie],n=Date.parse(e.createdAt),i=ae.current[ie-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(ed),r.sort(ed),z.current=r?.length||0;let a=new Set;n.forEach(e=>{Me(e,C,{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(Me(e,C,{}),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:ud(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:ud(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:ud(e),createdAt:e.createdAt})),{id:e,accountID:i.account.id,weight:ud(i),createdAt:i.createdAt},...d],ancestorsIsThread:s,mappedNestedDescendants:d}},K=({reloadHero:n}={})=>{te(`loading`);let r=Ku[e];return M(r?r.filter(e=>k.statuses[ne]):[{id:e}]),(async()=>{let r=()=>ze(()=>S.v1.statuses.$select(e).fetch(),{retries:4}),i=ze(()=>S.v1.statuses.$select(e).context.fetch(),{retries:8}),a=!!O.statuses[ne],o=O.statuses[ne];if(!(a&&!n))try{o=await r(),Me(o,C),await new Promise(e=>{setTimeout(e,100)})}catch{te(`error`);return}try{let n=await i,{ancestors:r}=n;le.current={...n,heroStatus:o};let{allStatuses:a,ancestorsIsThread:s,mappedNestedDescendants:c}=ue(),l=r.length&&!s?[]:c.filter(e=>e.thread),u=(s?r.length:0)+l.length;u>0&&u<100&&ce(u+1),te(`default`),H.current={offsetTop:F.current?.offsetTop,scrollTop:B.current?.scrollTop};let d=r.length||0;d>=ye&&be(d+1),M(a),Ku[e]=a,Ae(o,C)}catch{te(`error`)}})(),U.current=Date.now(),()=>{clearTimeout(void 0)}};y(K,[e,S]),y(()=>{try{let{allStatuses:e}=ue();M(e)}catch{}},[V,ie]);let[de,fe]=I(!1);y(()=>{let e=setInterval(()=>{let e=Date.now();U.current&&e-U.current>=6e4&&fe(!0)},6e4);return()=>{clearInterval(e)}},[]),N(()=>{if(!A.length)return;let n=qu[e];if(n)B.current.scrollTop=n;else if(H.current){let e={offsetTop:F.current?.offsetTop,scrollTop:B.current?.scrollTop},n=e.offsetTop-H.current.offsetTop+e.scrollTop;B.current.scrollTop=n}else A.length===1&&(B.current.scrollTop=0);H.current=null},[A]),y(()=>{O.reloadStatusPage<=0||(async()=>{try{let{instanceURL:n}=R(),r=`${location.protocol}//${n}/api/v1/statuses/${e}/context`;return await(await caches.open(`api`)).delete(r,{ignoreVary:!0}),K({reloadHero:!0})}catch{}})()},[O.reloadStatusPage]),y(()=>()=>{qu={},k.reloadStatusPage=0,Ku={},Gu={},ld.clear()},[]);let pe=O.statuses[ne]||O.statuses[e],me=g(()=>{if(!pe)return``;let{account:e}=pe,n=document.createElement(`div`);return n.innerHTML=e.displayName,n.innerText.trim()},[pe]),ge=g(()=>{if(!pe)return``;let e=Ct(pe);return e.length>64&&(e=(nd?[...nd.segment(e)].map(e=>e.segment):[...e]).slice(0,64).join(``)+`…`),e},[pe]);he(me&&ge?`${me}: "${ge}"`:a({id:`post.title`}),`/:instance?/s/:id`);let _e=g(()=>{if(!pe)return;let{url:e}=pe;if(e)return URL.parse(e)?.hostname},[pe]),ve=g(()=>{if(_e)return _e===C},[_e,C]),[ye,be]=I(Hu),xe=g(()=>A.length-ye,[A.length,ye]),Se=A.some(e=>e.descendant),Ce=A.filter(e=>e.ancestor),[we,Te]=I(!0),Ee=g(()=>{if(!F.current||we)return null;let{top:e}=F.current.getBoundingClientRect();return e>0?`down`:`up`},[we]);nt(`esc`,()=>{location.hash=n},{enabled:!m,ignoreEventWhen:e=>!!document.querySelector(`#modal-container > *`)||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey,useKey:!0}),nt(`backspace`,()=>{location.hash=n},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),nt(`j`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`),n=e?.getBoundingClientRect(),r=Array.from(B.current.querySelectorAll(Xu));if(e&&n.top<B.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(Yu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Yu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),nt(`k`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`),n=e?.getBoundingClientRect(),r=Array.from(B.current.querySelectorAll(Xu));if(e&&n.top<B.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(Yu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Yu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),nt(`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`}),nt(`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[De,J]=I(!1),Oe=s(m?`media+status`:`status`),ke=x((e,n,r,i)=>{e.preventDefault(),e.stopPropagation(),l({media:n+1,mediaStatusID:i.id})},[e]),je=x((e,n)=>{Ju(n.id)},[]);y(()=>{let e;return p&&m&&(e=setTimeout(()=>{let e=B.current?.querySelector(`.status-link[href*="/${p}"]`);e&&e.scrollIntoView(Yu)},400)),()=>{clearTimeout(e)}},[p,m]);let Ne=x((n,r)=>{let{id:o,ancestor:s,ghost:c,isThread:l,descendant:u,thread:d,replies:f,repliesCount:p,weight:m,level:h}=n,g=o===e;return L(`li`,{ref:g?F:null,class:`${s?`ancestor`:``} ${u?`descendant`:``} ${d?`thread`:``} ${g?`hero`:``}`,children:[g?L(i,{children:[L(at,{threshold:.1,onChange:e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Te(e)})})},class:`status-focus`,tabIndex:0,children:L(Ut,{statusID:o,instance:C,withinContext:!0,size:`l`,enableTranslate:!0,forceTranslate:b})}),P!==`loading`&&!ee?L(`div`,{class:`post-status-banner`,children:[L(`p`,{children:L(j,{id:`Vyeh4F`})}),L(Q,{to:Vu?`/login?instance=${Vu}&submit=1`:`/login`,class:`button`,children:L(j,{id:`sQia9P`})})]}):!D&&L(`div`,{class:`post-status-banner`,children:[L(`p`,{children:L(j,{id:`BrLbQp`,values:{instance:C},components:{0:L(`b`,{})}})}),L(`button`,{type:`button`,disabled:P===`loading`,onClick:()=>{te(`loading`),(async()=>{try{let e=await w.v2.search.list({q:pe.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){te(`default`),alert(a({id:`DnepCE`,values:{e}}))}})()},children:[L(X,{icon:`transfer`}),` `,L(j,{id:`jtQUzv`})]})]})]}):L($u,{linkable:!c&&(l||s),to:C?`/${C}/s/${o}`:`/s/${o}`,onClick:()=>{Ju(o)},children:[c?L(Ut,{statusID:o,instance:C,withinContext:!0,size:`m`,ghost:c}):r===0&&s?L(at,{threshold:.5,onChange:e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{J(e)})})},children:L(Ut,{statusID:o,instance:C,withinContext:!0,size:d||s?`m`:`s`,enableTranslate:!0,onMediaClick:ke,onStatusLinkClick:je})}):L(Ut,{statusID:o,instance:C,withinContext:!0,size:d||s?`m`:`s`,enableTranslate:!0,onMediaClick:ke,onStatusLinkClick:je,showActionsBar:!!u}),s&&p>1&&L(`div`,{class:`replies-link`,children:[L(X,{icon:`comment2`,alt:a({id:`N8UzTV`})}),` `,L(`span`,{title:p,children:Je(p)})]}),` `]}),u&&f?.length>0&&L(id,{instance:C,replies:f,hasParentThread:d,level:h,accWeight:m,openAll:z.current<Uu,lazyRenderReplies:z.current>Hu,parentLink:{to:C?`/${C}/s/${o}`:`/s/${o}`,onClick:()=>Ju(o)}}),P===`loading`&&g&&!!pe?.repliesCount&&!Se&&L(`div`,{class:`status-loading`,children:L(q,{abrupt:pe.repliesCount>=3})}),P===`error`&&g&&!!pe?.repliesCount&&!Se&&L(`div`,{class:`status-error`,children:[L(j,{id:`HQJU6W`}),L(`br`,{}),L(`button`,{type:`button`,class:`plain`,onClick:()=>{k.reloadStatusPage++},children:L(j,{id:`KDw4GX`})})]})]},o)},[e,C,P,ee,D,b,ke,je,Se]),Pe=g(()=>{if(`navigation`in window&&navigation?.entries){let e=navigation.entries()[navigation.currentEntry.index-1];if(e?.url)return Zu.test(e.url)}return Zu.test(k.prevLocation?.pathname)},[ne]),Fe=g(()=>{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 A.forEach(n),e.map(e=>c(e,C))},[A,C]);function Ie(e){if(e<12)return G._({id:`DqsEm-`,values:{months:e}});{let n=Math.floor(e/12);return G._({id:`24w-FD`,values:{years:n}})}}let Le=g(()=>{let e=[],n=A.slice(0,ye);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>td){let r=Date.parse(a.createdAt);if(r&&isFinite(r)){let{ancestor:i,id:o}=a,u=~~((n-r)/td);u>0&&e.push(L(`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},[A,ye,Ne,V,ie]);return y(()=>{let e=setTimeout(()=>{if(!F.current)return;let e=F.current.querySelector(`.spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)`);e&&e.click()},1e3);return()=>clearTimeout(e)},[e]),L(jt.Provider,{value:se,children:L(`div`,{tabIndex:`-1`,ref:B,class:`status-deck deck contained ${A.length>1?`padded-bottom`:``} ${Oe.current===`status`&&!h.current?`slide-in`:``} ${_?`deck-view-${_}`:``} ${V?`edit-history-mode`:``}`,style:V?{"--edit-history-percentage":`${ie/(ae.current.length-1)}`}:void 0,onAnimationEnd:e=>{Oe.current===`status`&&(Oe.current=null)},children:[L(`header`,{class:`${P===`loading`?`loading`:``}`,onDblClick:e=>{k.reloadStatusPage++},children:L(`div`,{class:`header-grid header-grid-2`,children:[L(`h1`,{children:[Pe&&L(`button`,{type:`button`,class:`plain deck-back`,onClick:()=>{history.back()},children:L(X,{icon:`chevron-left`,size:`xl`,alt:a({id:`iH8pgl`})})}),!we&&pe&&P!==`loading`?L(i,{children:[L(`span`,{class:`hero-heading`,children:[L(ht,{account:pe.account,instance:C,showAvatar:!0,short:!0}),` `,L(`span`,{class:`insignificant`,children:[`•`,` `,L(Wt,{datetime:pe.createdAt,format:`micro`})]})]}),` `,L(`button`,{type:`button`,class:`ancestors-indicator light small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),F.current.scrollIntoView({behavior:`smooth`,block:`start`})},title:a({id:`NCy-Nw`}),children:L(X,{icon:Ee===`down`?`arrow-down`:`arrow-up`})})]}):L(i,{children:[L(j,{id:`post.title`}),` `,L(`button`,{type:`button`,class:`ancestors-indicator light small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),B.current.scrollTo({top:0,behavior:`smooth`})},hidden:!Ce.length||De,title:a({id:`R8CUl0`,values:{0:Ce.length}}),children:[L(X,{icon:`arrow-up`}),Ce.filter(e=>!e.ghost).filter((e,n,r)=>r.findIndex(n=>n.accountID===e.accountID)===n).slice(0,3).map(e=>L(Ht,{url:e.account.avatarStatic||e.account.avatar,alt:e.account.displayName,squircle:e.account?.bot},e.account.id)),Ce.length>3&&L(i,{children:[` `,L(`span`,{class:`insignificant`,children:Je(Ce.length)})]})]})]})]}),L(`div`,{class:`header-side`,children:[L(`button`,{type:`button`,class:`plain4 button-switch-view`,style:{display:_===`full`?``:`none`},onClick:()=>{v(null),o.delete(`media`),o.delete(`media-only`),o.delete(`view`),l(o)},title:a({id:`-_xYEI`}),children:L(X,{icon:`layout4`,size:`l`})}),de&&L(`button`,{type:`button`,class:`plain button-refresh`,onClick:()=>{k.reloadStatusPage++,fe(!1)},children:L(X,{icon:`refresh`,size:`l`,alt:a({id:`lCF0wC`})})}),L(Gt,{align:`end`,portal:{target:B.current},menuButton:L(`button`,{type:`button`,class:`button plain4`,children:L(X,{icon:`more`,alt:a({id:`2FYpfJ`}),size:`xl`})}),children:[L(Y,{disabled:P===`loading`,onClick:()=>{k.reloadStatusPage++},children:[L(X,{icon:`refresh`}),L(`span`,{children:L(j,{id:`lCF0wC`})})]}),L(Y,{className:`menu-switch-view`,onClick:()=>{v(_===`full`?null:`full`),o.delete(`media`),o.delete(`media-only`),_===`full`?o.delete(`view`):o.set(`view`,`full`),l(o)},children:[L(X,{icon:{"":`layout5`,full:`layout4`}[_||``]}),L(`span`,{children:a(_===`full`?{id:`-_xYEI`}:{id:`2LiWsE`})})]}),L(Y,{onClick:()=>{Array.from(B.current.querySelectorAll(`.spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)`)).forEach(e=>{e.click()})},children:[L(X,{icon:`eye-open`}),` `,L(`span`,{children:L(j,{id:`8r8KmB`})})]}),L(qe,{}),L(ft,{className:`plain`,children:L(j,{id:`Rsjgm0`})}),L(Y,{disabled:!_e||ve,onClick:()=>{let e=Du(pe.url);e?location.hash=e:alert(a({id:`9J6biQ`}))},children:[L(X,{icon:`transfer`}),L(`small`,{class:`menu-double-lines`,children:a(_e?{id:`yi60j9`,values:{0:T.toUnicode(_e)}}:{id:`rWTcqf`})})]}),L(Y,{disabled:!D||P===`loading`||!pe?.editedAt||!z.current,onClick:re,children:[L(X,{icon:`edit`}),L(`span`,{children:a({id:`OqaQnE`})})]})]}),L(Q,{class:`button plain deck-close`,to:n,children:L(X,{icon:`x`,size:`xl`,alt:a({id:`yz7wBu`})})})]})]})}),L(Bu,{}),A.length&&pe?L(`ul`,{class:`timeline flat contextual grow ${P===`loading`?`loading`:``}`,children:[Le,xe>0&&L(`li`,{class:`descendant descendant-more`,children:L(`button`,{type:`button`,class:`plain block show-more`,disabled:P===`loading`,onClick:()=>be(e=>e+Hu),style:{marginBlockEnd:`6em`},children:[L(`div`,{class:`ib avatars-bunch`,children:A.slice(ye,ye+5).map(e=>L(Ht,{url:e.account.avatarStatic},e.id))}),` `,L(`div`,{class:`ib`,children:[L(j,{id:`uXRAkV`}),` `,L(`span`,{class:`tag`,children:xe>Hu?`${Hu}+`:xe})]})]})})]}):L(i,{children:[P===`loading`&&L(`ul`,{class:`timeline flat contextual grow loading`,children:L(`li`,{children:L(Ut,{skeleton:!0,size:`l`})})}),P===`error`&&L(`p`,{class:`ui-state`,children:[L(j,{id:`JWxodU`}),L(`br`,{}),L(`br`,{}),L(`button`,{type:`button`,onClick:()=>{k.reloadStatusPage++},children:L(j,{id:`KDw4GX`})})]})]}),L(`div`,{"data-state-post-ids":Fe.join(` `),hidden:!0})]})})}function id({replies:e,instance:n,hasParentThread:r,level:a,accWeight:o,openAll:c,parentLink:l,lazyRenderReplies:u}){let{_:f}=d(),[p,m]=oe(),h=e=>e.reduce((e,n)=>{let{repliesCount:r,replies:i}=n;return e+(i?.length||r)+h(i||[])},0),_=e.length+h(e),v=e.length===_,b=e.map(e=>e.account).filter((e,n,r)=>r.findIndex(n=>n.id===e.id)===n).slice(0,3),S=g(()=>e?.reduce((e,n)=>e+n?.weight,o),[o,e?.length]),C=!1;(c||S<=Wu||!r&&_===1&&ud(e[0])<2)&&(C=!0);let w=Gu[e[0].id],T=x((e,n,r,i)=>{e.preventDefault(),e.stopPropagation(),m({media:n+1,mediaStatusID:i.id})},[]),E=s();N(()=>{function e(e){e.target.dataset.scrollLeft=e.target.scrollLeft}return E.current?.addEventListener(`scroll`,e,{passive:!0}),()=>{E.current?.removeEventListener(`scroll`,e)}},[]);let[ee,D]=I(w||C),O=u?ee:!0,[k,A]=I(O);y(()=>{A(O)},[O]);let M=C?`div`:`details`,P=M===`details`;return L(M,{ref:E,class:`replies`,open:P?w||C:void 0,onToggle:P?n=>{let{open:r}=n.target;D(r),Gu[e[0].id]=r}:void 0,style:{"--comments-level":a},"data-comments-level":a,"data-comments-level-overflow":a>4,children:[!C&&L(`summary`,{class:`replies-summary`,hidden:C,children:[L(`span`,{class:`avatars`,children:b.map(e=>L(Ht,{url:e.avatarStatic,title:`${e.displayName} @${e.username}`,squircle:e?.bot},e.id))}),L(`span`,{class:`replies-counts`,children:[L(`b`,{children:L(j,{id:`DOQUen`,values:{0:e.length,1:Je(e.length)},components:{0:L(`span`,{title:e.length})}})}),!v&&_>1&&L(i,{children:[` `,`·`,` `,L(`span`,{children:L(j,{id:`qSQQSe`,values:{0:Je(_),totalComments:_},components:{0:L(`span`,{title:_})}})})]})]}),L(X,{icon:`chevron-down`,class:`replies-summary-chevron`}),!!l&&L(Q,{class:`replies-parent-link`,to:l.to,onClick:l.onClick,title:f({id:`ZlV82A`}),children:`»`})]}),k&&L(`ul`,{children:e.map(e=>L(`li`,{children:[L(`div`,{class:`status-focus`,tabIndex:0,children:[L(Ut,{statusID:e.id,instance:n,withinContext:!0,size:`s`,enableTranslate:!0,onMediaClick:T,showActionsBar:!0}),!e.replies?.length&&e.repliesCount>0&&L(`div`,{class:`replies-link`,children:[L(X,{icon:`comment2`,alt:f({id:`N8UzTV`})}),` `,L(`span`,{title:e.repliesCount,children:Je(e.repliesCount)})]})]}),e.replies?.length&&L(id,{instance:n,replies:e.replies,level:e.level,accWeight:C?S:e.weight,openAll:c,lazyRenderReplies:u,parentLink:{to:n?`/${n}/s/${e.id}`:`/s/${e.id}`,onClick:()=>{Ju(e.id)}}})]},e.id))})]})}var ad=140,od=35,sd=70,cd=140,ld=new Map;function ud(e){let n=ld.get(e.id);if(n)return n;let{spoilerText:r,content:i,mediaAttachments:a,poll:o,card:s}=e,c=vt(r+i),l=a?.length?ad:0,u=(o?.options?.length||0)*od,d=s&&(a?.length||o?.options?.length)?0:sd,f=(c+l+u+d)/cd;return ld.set(e.id,f),f}var dd=K(Qu);function fd(){let{id:e,instance:n}=A();return L(dd,{id:e,instance:n})}var pd=``+new URL(`boosts-carousel-BiOaNdMT.jpg`,import.meta.url).href,md=``+new URL(`multi-column-ROck0NVt.jpg`,import.meta.url).href,hd=``+new URL(`multi-hashtag-timeline-DH5INVHi.jpg`,import.meta.url).href,gd=``+new URL(`nested-comments-thread-hv59kZLc.jpg`,import.meta.url).href,_d=`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`,vd=``+new URL(`home-mobile-dark@2x-Dc-J8-SM.png`,import.meta.url).href,yd=``+new URL(`home-mobile-light@2x-Bd3fod8m.png`,import.meta.url).href,bd=``+new URL(`home-tablet-dark@2x-BgcNI8le.png`,import.meta.url).href,xd=``+new URL(`home-tablet-light@2x-BW2RV9T6.png`,import.meta.url).href,{PHANPY_DEFAULT_INSTANCE:Sd,PHANPY_WEBSITE:Cd,PHANPY_PRIVACY_POLICY_URL:wd,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Td}={PHANPY_PRIVACY_POLICY_URL:`https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD`},Ed=Cd?Cd.replace(/https?:\/\//g,``).replace(/\/$/,``):null,Dd=Cd?Cd.toLowerCase().includes(location.hostname):!1,Od=`${`2026-06-23`.replace(/-/g,`.`)}.05dcc55`;function kd(){let{_:e}=d();return he(null,[`/`,`/welcome`]),L(`main`,{id:`welcome`,children:[L(`div`,{class:`hero-container`,children:L(`div`,{class:`hero-content`,children:[L(`h1`,{children:[L(`img`,{src:jr,alt:``,width:`100`,height:`100`}),L(`img`,{src:_d,alt:`Phanpy`,width:`180`,height:`52`})]}),L(`p`,{class:`desc`,children:L(j,{id:`Ogtv0V`})}),L(`p`,{children:L(Q,{to:Sd?`/login?instance=${Sd}&submit=1`:`/login`,class:`button plain6`,children:e(Sd?{id:`sQia9P`}:{id:`ZLoGls`})})}),Sd&&Td&&L(`p`,{children:L(`a`,{href:Td,class:`button plain5`,children:L(j,{id:`e-RpCP`})})}),!Sd&&L(`p`,{class:`insignificant`,children:L(`small`,{children:L(j,{id:`fvAsUK`,components:{0:L(`br`,{})}})})})]})}),L(`div`,{id:`device-showcase`,children:[L(`div`,{class:`device mobile`,children:L(`div`,{class:`device-frame`,children:L(`picture`,{children:[L(`source`,{srcSet:vd,media:`(prefers-color-scheme: dark)`}),L(`img`,{src:yd,alt:e({id:`LVd2Ia`}),width:`375`,height:`812`,loading:`lazy`})]})})}),L(`div`,{class:`device tablet`,children:L(`div`,{class:`device-frame`,children:L(`picture`,{children:[L(`source`,{srcSet:bd,media:`(prefers-color-scheme: dark)`}),L(`img`,{src:xd,alt:e({id:`6XjvUL`}),width:`768`,height:`1024`,loading:`lazy`})]})})})]}),L(`div`,{id:`why-container`,children:L(`div`,{class:`sections`,children:[L(`section`,{children:[L(`img`,{src:pd,alt:e({id:`S5cYrQ`}),width:`400`,height:`303`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`Tu-sCN`})}),L(`p`,{children:L(j,{id:`e2uVlo`})})]})]}),L(`section`,{children:[L(`img`,{src:vc,alt:e({id:`LUnwPh`}),width:`600`,height:`450`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`xrl8fj`})}),L(`p`,{children:L(j,{id:`1lGm1k`})})]})]}),L(`section`,{children:[L(`img`,{src:gd,alt:e({id:`CGQ27z`}),width:`400`,height:`474`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`cYE45-`})}),L(`p`,{children:L(j,{id:`Pc7QKh`})})]})]}),L(`section`,{children:[L(`img`,{src:md,alt:e({id:`VLKtvP`}),width:`400`,height:`209`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`pEkad9`})}),L(`p`,{children:L(j,{id:`t7Py5R`})})]})]}),L(`section`,{children:[L(`img`,{src:hd,alt:e({id:`wOax6E`}),width:`400`,height:`196`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`Wi1Ov0`})}),L(`p`,{children:L(j,{id:`tS2i-h`})})]})]})]})}),L(`footer`,{children:[(Ed||Od)&&L(`p`,{class:`app-site-version`,children:L(`small`,{children:[Dd?Ed:``,` `,Od]})}),L(`p`,{children:L(j,{id:`BskFI2`,components:{0:L(`a`,{href:`https://github.com/cheeaun/phanpy`,target:`_blank`}),1:L(`a`,{href:`https://mastodon.social/@cheeaun`,target:`_blank`,onClick:e=>{e.preventDefault(),k.showAccount=`cheeaun@mastodon.social`}}),2:L(`a`,{href:wd,target:`_blank`})}})}),L(`div`,{children:L(Nr,{})})]})]})}me(!0);var Ad=Le(()=>pe(()=>import(`./mock-home-DGhR__He.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),jd=Le(()=>pe(()=>import(`./year-in-posts-DJv_star.js`),__vite__mapDeps([5,2,1,3,4,6]),import.meta.url));window.__STATES__=k,window.__STATES_STATS__=()=>{let e=[`statuses`,`accounts`,`spoilers`,`unfurledLinks`,`statusQuotes`],n={};e.forEach(e=>{n[e]=Object.keys(k[e]).length});let{statuses:r}=k,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}=k,i=0,{instance:a}=f(),o=new Set;document.querySelectorAll(`[data-state-post-id], [data-state-post-ids]`).forEach(e=>{let n=e.dataset.statePostId,r=e.dataset.statePostIds;n&&o.add(n),r&&r.split(/\s+/).forEach(e=>o.add(e))});for(let s in e){if(!window.__IDLE__)break;try{let e=r.some(e=>s===c(e.status?.id,a));if(!o.has(s)&&!e){delete k.statuses[s],delete k.statusQuotes[s];for(let e in n){let r=n[e];if(c(r.id,r.instance)===s){delete k.unfurledLinks[e];break}}i++}}catch{}}},900*1e3),setTimeout(()=>{for(let e in en)setTimeout(()=>{Array.isArray(en[e])?en[e][0]?.():typeof en[e]==`object`?en[e].module?.():en[e]?.()},1)},5e3),(()=>{window.__IDLE__=!0;let e=[`mousemove`,`mousedown`,`resize`,`keydown`,`touchstart`,`pointerdown`,`pointermove`,`wheel`],n=()=>{window.__IDLE__=!0},r=tn(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`)}ve(k,e=>{for(let[n,r,i,a]of e){if(r.join(`.`)===`settings.shortcutsViewMode`){let e=document.getElementById(`app`);e&&(e.dataset.shortcutsViewMode=k.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,Nd=3600*1e3;function Pd(){let[e,n]=I(()=>!!R()),[r,i]=I(`loading`);__BENCHMARK.start(`app-init`),__BENCHMARK.start(`time-to-following`),__BENCHMARK.start(`time-to-home`),__BENCHMARK.start(`time-to-isLoggedIn`),d(),y(()=>{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:s,vapid_key:c}=ne(e)||{},l=Se(e)||c,u=F.sessionCookie.get(`codeVerifier`);(async()=>{i(`loading`);let{access_token:c}=await Er({instanceURL:e,client_id:a,client_secret:s,code:r,code_verifier:u||void 0});if(c){let r=o({instance:e,accessToken:c});await Promise.allSettled([h(r),P(r,e),Ie(r,e,c,l)]),re(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,n(!0),i(`default`);let a=F.session.get(`loginRedirect`);a&&(F.session.del(`loginRedirect`),window.location.hash=a)}else i(`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=b(e),r&&(we(r.info.id),window.history.replaceState({},document.title,window.location.pathname||`/`))),r||=R(),r){we(r.info.id);let{client:e}=f({account:r}),{instance:a}=e;re(),i(`loading`),(async()=>{try{O()&&S(a)?(h(e),P(e,a)):await Promise.allSettled([h(e),P(e,a)])}catch{}finally{n(!0),i(`default`),__BENCHMARK.end(`app-init`)}})()}else i(`default`),__BENCHMARK.end(`app-init`)}F.sessionCookie.del(`clientID`),F.sessionCookie.del(`clientSecret`),F.sessionCookie.del(`codeVerifier`)},[]);let a=ie();k.currentLocation=a.pathname,y(oi,[a,e]);let c=s(!1),l=`pwaLastPath`;return y(()=>{c.current&&Md&&e&&(Id(a.pathname)?F.local.del(l):F.local.setJSON(l,{path:a.pathname+a.search,lastAccessed:Date.now()}))},[a.pathname,a.search,e]),y(()=>{if(!(c.current||!(!a.pathname||a.pathname===`/`))&&Md&&e&&r==="default"){let e=F.local.getJSON(l);e&&setTimeout(()=>{e?.path&&Date.now()-(e.lastAccessed||0)<Nd&&(window.location.hash=e.path),F.local.del(l)},300),c.current=!0}},[r,e]),y(()=>{`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(a.pathname)?L(Ou,{}):r===`loading`?L(q,{id:`loader-root`}):L(sn,{value:e,children:[L(Ld,{}),L(Bd,{}),L(Fe,{children:L(ke,{path:`/:instance?/s/:id`,element:L(fd,{})})}),e&&L(mn,{}),e&&L(ks,{}),L(as,{}),e&&L(vs,{}),L(fn,{}),e&&L(ss,{}),L(Es,{onClose:oi}),L(gn,{})]})}function Fd(){let e=cn();return e&&__BENCHMARK.end(`time-to-isLoggedIn`),L(e?wu:kd,{})}function Id(e){return/^\/(login|welcome|_sandbox|_qr-scan|_mock)/i.test(e)}var Ld=K(()=>{let e=ie();return L(Fe,{location:g(()=>{let{pathname:n}=e;return!Id(n)},[e])||e,children:[L(ke,{path:`/`,element:L(Fd,{})}),L(ke,{path:`/login`,element:L(Fu,{})}),L(ke,{path:`/welcome`,element:L(kd,{})}),L(ke,{path:`/_mock/home`,element:L(w,{children:L(Ad,{})})}),void 0]})});function Rd({children:e}){let n=cn(),r=ie();if(!n){let e=r.pathname+r.search;return F.session.set(`loginRedirect`,e),L(z,{to:`/login`,replace:!0})}return e}function zd(){return k.prevLocation||null}function Bd(){let e=ie(),n=s(zd()),r=g(()=>l(`/:instance/s/:id`,e.pathname)||l(`/s/:id`,e.pathname),[e.pathname,l]);return y(()=>{r?k.prevLocation&&F.session.setJSON(`prevLocation`,{pathname:k.prevLocation.pathname,search:k.prevLocation.search}):(k.prevLocation&&=null,F.session.del(`prevLocation`))},[r]),r?n.current||=zd():n.current=null,L(Fe,{location:n.current||e,children:[L(ke,{path:`/notifications`,element:L(Rd,{children:L(nu,{})})}),L(ke,{path:`/mentions`,element:L(Rd,{children:L(Ll,{})})}),L(ke,{path:`/following`,element:L(Rd,{children:L(al,{})})}),L(ke,{path:`/_following2`,element:L(Rd,{children:L(ml,{})})}),L(ke,{path:`/b`,element:L(Rd,{children:L(_c,{})})}),L(ke,{path:`/f`,element:L(Rd,{children:L(Kc,{})})}),L(ke,{path:`/l`,children:[L(ke,{index:!0,element:L(Rd,{children:L(ku,{})})}),L(ke,{path:`:id`,element:L(Rd,{children:L(Sl,{})})})]}),L(ke,{path:`/fh`,element:L(Rd,{children:L(rl,{})})}),L(ke,{path:`/sp`,element:L(Rd,{children:L(Lu,{})})}),L(ke,{path:`/ft`,element:L(Rd,{children:L(Qc,{})})}),L(ke,{path:`/catchup`,element:L(Rd,{children:L(Dc,{})})}),L(ke,{path:`/yip`,element:L(Rd,{children:L(w,{fallback:L(`div`,{id:`year-in-posts-page`,class:`deck-container`,tabIndex:`-1`,children:L(q,{})}),children:L(jd,{})})})}),L(ke,{path:`/annual_report/:year`,element:L(Rd,{children:L(hc,{})})}),L(ke,{path:`/:instance?/t/:hashtag`,element:L(bl,{})}),L(ke,{path:`/:instance?/a/:id`,children:[L(ke,{index:!0,element:L(uc,{})}),L(ke,{path:`c`,element:L(mc,{})})]}),L(ke,{path:`/:instance?/c/:id`,element:L(Wc,{})}),L(ke,{path:`/:instance?/p`,children:[L(ke,{index:!0,element:L(iu,{})}),L(ke,{path:`l`,element:L(iu,{local:!0})})]}),L(ke,{path:`/:instance?/trending`,element:L(_u,{})}),L(ke,{path:`/:instance?/search`,element:L(uu,{})})]})}if(ge(),Te(),D(L(je,{i18n:G,children:L(ce,{children:L(U,{children:L(Pd,{})})})}),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(`
|
|
23
|
+
`:` `}${w}`}})})]})}var xl=20;function Sl(e){let{_:n}=d(),r=W(k),{masto:a,instance:o}=f(),c=e?.id||A()?.id,l=s(),u=s();async function p(e){(e||!u.current)&&(u.current=a.v1.timelines.list.$select(c).list({limit:xl}).values());let n=await u.current.next(),{value:r}=n;return r?.length&&(e&&(l.current=r[0].id),r.forEach(e=>{Me(e,o)})),{...n,value:r}}async function m(){try{let{value:e}=await a.v1.timelines.list.$select(c).list({limit:1,since_id:l.current}),n=e[0]?.id===l.current;return e?.length&&!n?(e=Zt(e,`home`),!0):!1}catch{return!1}}let[h,g]=I([]),[_,v]=I({title:`List`});he(_.title,`/l/:id`),y(()=>{(async()=>{try{v(await Di(c))}catch{}})()},[c]);let[b,x]=I(!1),[S,C]=I(!1);return L(i,{children:[L(tc,{title:_.title,id:`list`,emptyText:n({id:`KkDhfU`}),errorText:n({id:`7QSeK6`}),instance:o,fetchItems:p,checkForUpdates:m,useItemID:!0,boostsCarousel:r.settings.boostsCarousel,filterContext:`home`,showReplyParent:!0,headerStart:L(Gt,{overflow:`auto`,menuButton:L(`button`,{type:`button`,class:`plain`,children:[L(X,{icon:`list`,size:`l`,alt:n({id:`h16FyT`})}),L(X,{icon:`chevron-down`,size:`s`})]}),onMenuChange:e=>{e.open&&Ti().then(g)},children:[L(Mt,{to:`/l`,children:L(`span`,{children:L(j,{id:`BHWx-g`})})}),h?.length>0&&L(i,{children:[L(qe,{}),h.map(e=>L(Mt,{to:`/l/${e.id}`,children:L(`span`,{children:[e.title,e.exclusive&&L(i,{children:[` `,L(Mi,{})]})]})},e.id))]})]}),headerEnd:L(Gt,{portal:!0,setDownOverflow:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:n({id:`2FYpfJ`})})}),children:[_?.exclusive&&L(i,{children:[L(ft,{className:`plain`,children:[L(Mi,{}),` `,L(j,{id:`FNptcJ`})]}),L(qe,{})]}),L(Y,{onClick:()=>x({list:_}),children:[L(X,{icon:`pencil`,size:`l`}),L(`span`,{children:L(j,{id:`ePK91l`})})]}),L(Y,{onClick:()=>C(!0),children:[L(X,{icon:`group`,size:`l`}),L(`span`,{children:L(j,{id:`hB02vO`})})]})]})},c),b&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&x(!1)},children:L(Ni,{list:b?.list,onClose:e=>{e.state===`success`&&e.list?v(e.list):e.state===`deleted`&&(location.hash=`/l`),x(!1)}})}),S&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&C(!1)},children:L(wl,{listID:c,onClose:()=>C(!1)})})]})}var Cl=40;function wl({listID:e,onClose:n}){let{_:r}=d(),{masto:i,instance:a}=f(),[o,c]=I([]),[l,u]=I(`default`),[p,m]=I(!1),h=s();async function g(n){m(!1),u(`loading`),(async()=>{try{(n||!h.current)&&(h.current=i.v1.lists.$select(e).accounts.list({limit:Cl}).values());let{done:r,value:a}=await h.current.next();a?.length?(c(n?a:o.concat(a)),m(!r)):m(!1),u(`default`)}catch{u(`error`)}})()}return y(()=>{g(!0)},[]),L(`div`,{class:`sheet`,id:`list-manage-members-container`,children:[!!n&&L(`button`,{type:`button`,class:`sheet-close`,onClick:n,children:L(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:L(j,{id:`hB02vO`})})}),L(`main`,{children:L(`ul`,{children:[o.map(n=>L(`li`,{children:[L(rt,{account:n,instance:a}),L(Tl,{account:n,listID:e})]},n.id)),p&&l==="default"&&L(at,{as:`li`,onChange:e=>e&&g(),children:L(`button`,{type:`button`,class:`light block`,onClick:g,children:L(j,{id:`uXRAkV`})})})]})})]})}function Tl({account:e,listID:n}){let{_:r}=d(),{masto:i}=f(),[a,o]=I(`default`),[s,c]=I(!1);return L(xt,{confirm:!s,confirmLabel:L(`span`,{children:L(j,{id:`j5n9Ry`,values:{0:e.username},components:{0:L(`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:L(`button`,{type:`button`,class:`light ${s?``:`danger`}`,disabled:a===`loading`,children:r(s?{id:`m16xKo`}:{id:`MWIaew`})})})}var El={added_to_collection:[`sampleAccounts`,`collection`],collection_update:[`sampleAccounts`,`collection`]},Dl={mention:[`account`,`status`],quote:[`account`,`status`],status:[`account`,`status`],reblog:[`account`,`status`],follow:[`account`],follow_request:[`account`],favourite:[`account`,`status`],poll:[`status`],update:[`status`],added_to_collection:[`account`,`collection`],collection_update:[`account`,`collection`]},Ol=[`favourite`,`reblog`,`follow`,`admin.sign_up`],kl=e=>Ol.includes(e);function Al(e){return e.filter((n,r)=>{let{type:i}=n;if(!i)return!1;let a=El[i];return a?.length?a.every(e=>!!n[e]):i===`quote`&&n.statusId?e.findIndex(e=>e.type===`quote`&&e.statusId===n.statusId)===r:!0})}function jl(e){return e.filter(e=>{let{type:n,id:r,createdAt:i}=e;if(!n)return!1;let a=Dl[n];return a?.length?a.every(n=>!!e[n]):!0})}function Ml(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 Nl(e){e=Al(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(!kl(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 Pl(e){e=jl(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(!kl(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 Fl=20,Il=new URLSearchParams;function Ll({columnMode:e,...n}){let{_:r}=d(),{masto:a,instance:o}=f(),[c]=e?[Il]:oe(),[l,u]=I(null),p=n?.type||c.get(`type`)||l;he(r(p===`private`?{id:`2BApYc`}:{id:`_bZzdR`}),`/mentions`);let[m,h]=I(!1),_=s({}),v=s(),y=s();function b(e){if(!m||!e?.length)return e;let n=ee();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=a.v1.notifications.list({limit:Fl,types:[`mention`]}).values());let n=await v.current.next(),{value:r}=n;if(r?.length){r=jl(r),e&&(y.current=r[0].id),r.forEach(({status:e})=>{Me(e,o)});let i=r.map(e=>e.status);if(m&&i?.length){let e=await tt(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=s(),C=s();async function w(e){(e||!S.current)&&(S.current=a.v1.conversations.list({limit:Fl}).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})=>{Me(e,o)});let i=r.map(e=>e.lastStatus);if(m&&i?.length){let e=await tt(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 T(...e){return p===`private`?w(...e):x(...e)}async function E(){if(p===`private`)try{let{value:e}=await a.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 a.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 D=g(()=>L(i,{children:[L(`div`,{id:`followings-option`,children:L(`label`,{children:[L(`input`,{type:`checkbox`,checked:m,onChange:e=>{h(e.target.checked)}}),` `,L(j,{id:`h4JxWH`})]})}),L(`div`,{class:`filter-bar`,children:[L(Q,{to:`/mentions`,class:p?``:`is-active`,onClick:n=>{e&&(n.preventDefault(),u(null))},children:L(j,{id:`N40H-G`})}),L(Q,{to:`/mentions?type=private`,class:p===`private`?`is-active`:``,onClick:n=>{e&&(n.preventDefault(),u(`private`))},children:L(j,{id:`zwBp5t`})})]})]}),[p,m]);return L(tc,{title:r({id:`_bZzdR`}),id:`mentions`,emptyText:r({id:`03jFGT`}),errorText:r({id:`pqR9KF`}),instance:o,fetchItems:T,checkForUpdates:E,useItemID:!0,timelineStart:D,refresh:`${p}-${m}`,filterContext:`notifications`})}var Rl=80,zl=20,Bl=new URLSearchParams,Vl=[`mention`,`status`,`reblog`,`follow`,`follow_request`,`favourite`,`poll`,`update`,`admin.sign_up`,`admin.report`,`severed_relationships`,`moderation_warning`,`quote`,`quoted_update`,`added_to_collection`,`collection_update`],Hl={block:`start`,inline:`center`,behavior:`instant`},Ul=J(()=>p()?.mastodon>=2,{expires:1e3*60*5}),Wl=J(()=>p()?.mastodon>=10,{expires:1e3*60*5});function Gl(e={}){let{masto:n}=f(),r=Wl()?Vl:void 0;return Ul()?n.v2.notifications.list({limit:zl,supportedTypes:r,...e}):n.v1.notifications.list({limit:Rl,supportedTypes:r,...e})}function Kl(e={}){return Gl(e).values()}function ql(e){return Ul()?Nl(e):Pl(e)}var Jl=[`forNotFollowing`,`forNotFollowers`,`forNewAccounts`,`forPrivateMentions`,`forLimitedAccounts`,`forBots`],Yl={forNotFollowing:{id:`gBOf4F`},forNotFollowers:{id:`ULVw6q`},forNewAccounts:{id:`PdNgnE`},forPrivateMentions:{id:`S2vQN5`},forLimitedAccounts:{id:`3W4MYO`},forBots:{id:`9KK2rC`}};function Xl({columnMode:e}){let{_:n,_:r}=d();he(r({id:`iDNBZe`}),`/notifications`);let{masto:a,instance:o}=f(),c=W(k),[l,u]=I(`default`),[p]=e?[Bl]:oe(),m=p.get(`id`),h=p.get(`access_token`),[_,v]=I(!1),[b,S]=I(!1),[w,T]=I(!1),[E,ee]=I(!1),D=s(),{nearReachEnd:O,scrollDirection:A,reachStart:M,nearReachStart:N}=Ws({scrollableRef:D}),P=c.settings.autoHideBars&&A===`end`&&!N,[te,ne]=I([]),[R,z]=I([]),B=s(),V=s();async function re(n){if((n||!V.current)&&(B.current=Gl({excludeTypes:[`follow_request`]}),V.current=B.current.values()),/max_id=($|&)/i.test(V.current?.nextParams))return{done:!0};let r=await V.current.next(),i=Ml(r.value);if(i?.length){i.forEach(e=>{Me(e.status,o,{skipThreading:!0})});let r=ql(i);n?(k.notificationsLast=r[0],k.notifications=r,a.v1.markers.create({notifications:{lastReadId:r[0].id}}).catch(()=>{}),e||me(r)):k.notifications.push(...r)}return k.notificationsShowNew=!1,k.notificationsLastFetchTime=Date.now(),r}async function ie(){try{return await a.v1.followRequests.list({limit:80})}catch{return[]}}async function ae(){try{return await a.v1.announcements.list()}catch{return[]}}let H=ot(`@mastodon/filtered-notifications`),U=ot(`@mastodon/notification-bot-filter`),[se,ce]=I(!1),[le,G]=I({});function ue(){return a.v2.notifications.policy.fetch().catch(()=>{})}function K(){ue().then(e=>{G(e)}).catch(()=>{})}let[de,fe]=I(null);function pe(){return a.v1.notifications.requests.list()}let me=e=>{if(w)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}}T(o||s||c||u),ee(Date.now())},ge=e=>{ve(!1),u(`loading`),(async()=>{try{let n=re(e);e&&(ae().then(e=>{e.sort((e,n)=>Date.parse(n.updatedAt||n.createdAt)-Date.parse(e.updatedAt||e.createdAt)),z(e)}).catch(()=>{}),ie().then(e=>{ne(e)}).catch(()=>{}),H&&K());let{done:r}=await n;v(!r),u(`default`)}catch{u(`error`)}})()};y(()=>{ge(!0)},[]),y(()=>{M&&ge(!0)},[M]);let[_e,ve]=I(!1),ye=x(({disableIdleCheck:e=!1}={})=>{l!==`loading`&&c.settings.autoRefresh&&D.current?.scrollTop<16&&(e||window.__IDLE__)&&!Zl()&&ge(!0)},[c.notificationsShowNew,c.settings.autoRefresh,l]),be=s();ln(e=>{if(e){let e=Date.now()-be.current;!be.current||e>1e3*3?ye({disableIdleCheck:!0}):be.current=Date.now()}});let xe=s(!0);y(()=>{let e=C(k,`notificationsShowNew`,e=>{if(xe.current){xe.current=!1;return}l!==`loading`&&(e&&ye(),ve(e))});return()=>e?.()},[]);let Se=new Date,Ce=new Date(Se-1440*60*1e3),we=new Date,Te=!c.notifications.some(e=>new Date(e.createdAt).toDateString()===Se.toDateString()),Ee=s();y(()=>{m&&(k.routeNotification={id:m,accessToken:atob(h)})},[m,h]);let[De,J]=I(null);y(async()=>{let e=new Date;if(e.getMonth()!==11)return;let n=e.getFullYear();if(!ot(`@mastodon/annual-report`))return;let r=F.account.get(`annualReportNotification`);if(r&&r?.annualReport?.year==n){J(r);return}let i=Kl({types:[`annual_report`]});try{r=(await i.next())?.value?.notificationGroups?.[0],r?.annualReport?.year==n&&(J(r),F.account.set(`annualReportNotification`,r))}catch{}},[]);let Oe=`.notification`,ke=nt(`j`,()=>{let e=document.activeElement.closest(Oe),n=e?.getBoundingClientRect(),r=Array.from(D.current.querySelectorAll(Oe));if(e&&n.top<D.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(Hl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Hl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),Ae=nt(`k`,()=>{let e=document.activeElement.closest(Oe),n=e?.getBoundingClientRect(),r=Array.from(D.current.querySelectorAll(Oe));if(e&&n.top<D.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(Hl))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Hl))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),je=nt([`enter`,`o`],()=>{let e=document.activeElement.closest(Oe)?.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`}),Ne=nt(`.`,()=>{ge(!0),D.current?.scrollTo({top:0,behavior:`smooth`})},{useKey:!0,ignoreEventWhen:e=>e.key===`.`?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),Pe=new Date,Fe=g(()=>Jt(Pe,{forceOpts:{weekday:`long`}}),[Pe]);return L(`div`,{id:`notifications-page`,class:`deck-container`,ref:e=>{D.current=e,ke.current=e,Ae.current=e,je.current=e,Ne.current=e},tabIndex:`-1`,children:[L(`div`,{class:`timeline-deck deck ${b?`only-mentions`:``}`,children:[L(`header`,{hidden:P,onClick:e=>{e.target.closest(`a, button`)||D.current?.scrollTo({top:0,behavior:`smooth`})},onDblClick:e=>{e.target.closest(`a, button`)||ge(!0)},class:l===`loading`?`loading`:``,children:[L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:r({id:`i0qMbr`})})})]}),L(`h1`,{children:L(j,{id:`iDNBZe`})}),L(`div`,{class:`header-side`,children:H&&L(`button`,{type:`button`,class:`button plain4`,onClick:()=>{ce(!0)},children:L(X,{icon:`settings`,size:`l`,alt:r({id:`a_-arl`})})})})]}),_e&&l!==`loading`&&L(`button`,{class:`updates-button shiny-pill`,type:`button`,onClick:()=>{ge(!0),D.current?.scrollTo({top:0,behavior:`smooth`})},children:[L(X,{icon:`arrow-up`}),` `,L(j,{id:`Jy9RU_`})]})]}),R.length>0&&L(`div`,{class:`shazam-container`,children:L(`div`,{class:`shazam-container-inner`,children:L(`details`,{class:`announcements`,children:[L(`summary`,{children:[L(`span`,{children:[L(X,{icon:`announce`,class:`announcement-icon`,size:`l`}),` `,L(j,{id:`0whvLM`,values:{0:R.length}}),` `,L(`small`,{class:`insignificant`,children:o})]}),R.length>1&&L(`span`,{class:`announcements-nav-buttons`,children:R.map((e,n)=>L(`button`,{type:`button`,class:`plain2 small`,onClick:()=>{Ee.current?.children[n].scrollIntoView({behavior:`smooth`,block:`nearest`})},children:n+1}))})]}),L(`ul`,{class:`announcements-list-${R.length>1?`multiple`:`single`}`,ref:Ee,children:R.map(e=>L(`li`,{children:L(Ql,{announcement:e})}))})]})})}),te.length>0&&L(`div`,{class:`follow-requests`,children:[L(`h2`,{class:`timeline-header`,children:L(j,{id:`6Fs1Ba`})}),te.length>5?L(`details`,{children:[L(`summary`,{children:L(j,{id:`7dHKu4`,values:{0:te.length}})}),L(`ul`,{children:te.map(e=>L(`li`,{children:[L(rt,{account:e}),L(cs,{accountID:e.id,onChange:()=>{}})]},e.id))})]}):L(`ul`,{children:te.map(e=>L(`li`,{children:[L(rt,{account:e}),L(cs,{accountID:e.id,onChange:()=>{}})]},e.id))})]}),H&&le?.summary?.pendingRequestsCount>0&&L(`div`,{class:`shazam-container`,children:L(`div`,{class:`shazam-container-inner`,children:L(`div`,{class:`filtered-notifications`,children:L(`details`,{onToggle:async e=>{let{open:n}=e.target;n&&fe(await pe())},children:[L(`summary`,{children:L(j,{id:`N3Bq0f`,values:{0:le.summary.pendingRequestsCount}})}),de?de?.length>0&&L(`ul`,{children:de.map(e=>L(`li`,{children:[L(`div`,{class:`request-notifcations`,children:[!e.lastStatus?.id&&L(rt,{useAvatarStatic:!0,showStats:!0,account:e.account}),e.lastStatus?.id&&L(`div`,{class:`last-post`,children:L(Q,{class:`status-link`,to:`/${o}/s/${e.lastStatus.id}`,children:L(Ut,{status:e.lastStatus,size:`s`,readOnly:!0})})}),L(eu,{request:e})]}),L(tu,{request:e,onChange:()=>{ge(!0)}})]},e.id))}):L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})})]})})})}),De&&L(`div`,{class:`shazam-container`,children:L(`div`,{class:`shazam-container-inner`,children:L(_s,{notification:De})})}),!!E&&L(`div`,{id:`mentions-option`,children:w?L(Q,{to:`/mentions`,class:`button plain`,children:[L(X,{icon:`at`}),` `,L(`span`,{children:L(j,{id:`_bZzdR`})}),` `,L(X,{icon:`arrow-right`,class:`more-insignificant`})]}):L(`label`,{children:[L(`input`,{type:`checkbox`,checked:b,onChange:e=>{S(e.target.checked)}}),` `,L(j,{id:`0udtPI`})]})}),L(`h2`,{class:`timeline-header`,children:[L(j,{id:`ecUA8p`}),` `,L(`small`,{class:`insignificant bidi-isolate`,children:Fe})]}),Te&&L(`p`,{class:`ui-state insignificant`,children:l==="default"?r({id:`KS7iJH`}):L(i,{children:`…`})}),c.notifications.length?L(He.Provider,{value:`notifications`,children:c.notifications.filter(e=>e.type!==`follow_request`).map(e=>{if(b&&e.type!==`mention`)return null;let n=new Date(e.createdAt),a=n.toDateString()!==we.toDateString();a&&(we=n);let s=n.toDateString()===Ce.toDateString()?r({id:`y_0uwd`}):Jt(we,{hideTime:!0}),c=Jt(we,{forceOpts:{weekday:`long`}});return L(i,{children:[a&&L(`h2`,{class:`timeline-header`,children:[L(`span`,{children:s}),` `,L(`small`,{class:`insignificant bidi-isolate`,children:c})]}),L(_s,{instance:o,notification:e},e._ids||e.id)]},e._ids||e.id)})}):L(i,{children:[l===`loading`&&L(i,{children:L(`ul`,{class:`timeline flat`,children:Array.from({length:5}).map((e,n)=>L(`li`,{class:`notification skeleton`,children:[L(`div`,{class:`notification-type`,children:L(X,{icon:`notification`,size:`xl`})}),L(`div`,{class:`notification-content`,children:L(`p`,{children:`███████████ ████`})})]}))})}),l===`error`&&L(`p`,{class:`ui-state`,children:[L(j,{id:`gjzl8E`}),L(`br`,{}),L(`br`,{}),L(`button`,{type:`button`,onClick:()=>ge(!0),children:L(j,{id:`KDw4GX`})})]})]}),_&&L(at,{onChange:e=>{e&&ge()},children:L(`button`,{type:`button`,class:`plain block`,disabled:l===`loading`,onClick:()=>ge(),style:{marginBlockEnd:`6em`},children:l===`loading`?L(q,{abrupt:!0}):L(j,{id:`uXRAkV`})})})]}),H&&se&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&ce(!1)},children:L(`div`,{class:`sheet`,id:`notifications-settings`,tabIndex:`-1`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:()=>ce(!1),children:L(X,{icon:`x`,alt:r({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:L(j,{id:`a_-arl`})})}),L(`main`,{children:L(`form`,{onSubmit:e=>{e.preventDefault();let{forNotFollowing:n,forNotFollowers:i,forNewAccounts:o,forPrivateMentions:s,forLimitedAccounts:c,forBots:l}=e.target,u={...le,forNotFollowing:n.value,forNotFollowers:i.value,forNewAccounts:o.value,forPrivateMentions:s.value,forLimitedAccounts:c.value};U&&(u.forBots=l?.value),G(u),ce(!1),(async()=>{try{await a.v2.notifications.policy.update(u),Z(r({id:`4-7X9i`}))}catch{}})()},children:[L(`p`,{children:L(j,{id:`J4ONfI`})}),L(`div`,{class:`notification-policy-fields`,children:Jl.filter(e=>e!==`forBots`||U).map(e=>{let r=le[e];return L(`div`,{children:L(`label`,{children:[n(Yl[e]),L(`select`,{name:e,defaultValue:r,class:`small`,children:[L(`option`,{value:`accept`,children:L(j,{id:`g3UF2V`})}),L(`option`,{value:`filter`,children:L(j,{id:`o7J4JM`})}),L(`option`,{value:`drop`,children:L(j,{id:`gbbkE7`})})]})]})},e)})}),L(`p`,{children:L(`button`,{type:`submit`,children:L(j,{id:`tfDRzk`})})})]})})]})})]})}function Zl(){return!!document.querySelector(`.deck-backdrop, #modal-container > *`)}function Ql({announcement:e}){let{instance:n}=f(),{contact:r}=H(),a=r?.account,{id:o,content:s,startsAt:c,endsAt:l,published:u,allDay:d,publishedAt:p,updatedAt:m,read:h,mentions:g,statuses:_,tags:v,emojis:y,reactions:b}=e,x=new Date(p),S=Jt(x),C=new Date(m),w=Jt(C);return L(`div`,{class:`announcement-block`,children:[L(rt,{account:a}),L(`div`,{class:`announcement-content`,onClick:Ze({mentions:g,instance:n}),dangerouslySetInnerHTML:{__html:ct(s,{emojis:y})}}),L(`p`,{class:`insignificant`,children:[L(`time`,{datetime:x.toISOString(),children:Jt(x)}),m&&w!==S&&L(i,{children:[` `,`•`,` `,L(`span`,{class:`ib`,children:L(j,{id:`TbFrLc`,values:{0:Jt(C)},components:{0:L(`time`,{datetime:C.toISOString()})}})})]})]}),L(`div`,{class:`announcement-reactions`,hidden:!0,children:b.map(e=>{let{name:n,count:r,me:i,staticUrl:a,url:o}=e;return L(`button`,{type:`button`,class:`plain4 small ${i?`reacted`:``}`,children:[o||a?L(`img`,{src:o||a,alt:n,width:`16`,height:`16`}):L(`span`,{children:n}),` `,L(`span`,{class:`count`,children:Je(r)})]})})})]})}function $l(e){let{masto:n}=f();return n.v1.notifications.list({accountID:e})}function eu({request:e}){let{instance:n}=f(),[r,a]=I(`loading`),{account:o,lastStatus:s}=e,[c,l]=I(!1),[u,d]=I([]);function p(){l(!1)}return y(()=>{e?.account?.id&&c&&(a(`loading`),(async()=>{d(await $l(e.account.id)||[]),a(`default`)})())},[c,e?.account?.id]),L(i,{children:[L(`button`,{type:`button`,class:`plain4 request-notifications-account`,onClick:()=>{l(!0)},children:[L(X,{icon:`notification`,class:`more-insignificant`}),` `,L(`small`,{children:L(j,{id:`H0wUNM`,values:{0:o.username},components:{0:L(`span`,{class:`bidi-isolate`})}})}),` `,L(X,{icon:`chevron-down`})]}),c&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&p()},children:L(`div`,{class:`sheet`,tabIndex:`-1`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:p,children:L(X,{icon:`x`,alt:t`Close`})}),L(`header`,{children:L(`b`,{children:L(j,{id:`MXOmPt`,values:{0:o.username},components:{0:L(`span`,{class:`bidi-isolate`})}})})}),L(`main`,{children:r===`loading`?L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}):u.map(e=>L(`div`,{class:`notification-peek`,onClick:e=>{let{target:n}=e;(e.target.tagName===`BUTTON`||e.target.tagName===`A`)&&p()},children:L(_s,{instance:n,notification:e,isStatic:!0})}))})]})})]})}function tu({request:e,onChange:n}){let{_:r}=d(),{masto:i}=f(),[a,o]=I(`default`),[s,c]=I(null),l=s!==null;return L(`p`,{class:`notification-request-buttons`,children:[L(`button`,{type:`button`,disabled:a===`loading`||l,onClick:()=>{Qt.trigger(`success`),o(`loading`),(async()=>{try{await i.v1.notifications.requests.$select(e.id).accept(),c(`accept`),o(`default`),n({request:e,state:`accept`}),Z(r({id:`ZtBMwU`,values:{0:e.account.username}}))}catch{o(`error`),Z(r({id:`S92JKG`}))}})()},children:L(j,{id:`h7peZQ`})}),` `,L(`button`,{type:`button`,disabled:a===`loading`||l,class:`light danger`,onClick:()=>{Qt.trigger(`light`),o(`loading`),(async()=>{try{await i.v1.notifications.requests.$select(e.id).dismiss(),c(`dismiss`),o(`default`),n({request:e,state:`dismiss`}),Z(r({id:`ibBDry`,values:{0:e.account.username}}))}catch{o(`error`),Z(r({id:`S5aemF`}))}})()},children:L(j,{id:`1QfxQT`})}),L(`span`,{class:`notification-request-states`,children:a===`loading`?L(q,{abrupt:!0}):s===`accept`?L(X,{icon:`check-circle`,alt:r({id:`bzMKg7`}),class:`notification-accepted`}):s===`dismiss`&&L(X,{icon:`x-circle`,alt:r({id:`J6hrEy`}),class:`notification-dismissed`})})]})}var nu=K(Xl),ru=20;function iu({local:e,columnMode:n,...r}){let{_:a}=d(),o=W(k),c=!!e,l=n?{}:A(),{masto:u,authenticated:p,instance:m}=f({instance:r?.instance||l.instance}),{instance:h}=f(),g=a(c?{id:`u96B_B`,values:{instance:m}}:{id:`PgVqvd`,values:{instance:m}});he(g,c?`/:instance?/p/l`:`/:instance?/p`);let _=s(),[v,y]=I(null),b=v===`disabled`,x=v===`authenticated`&&!p,S=s();async function C(e){if(e||!S.current){let e=await _l({feed:`liveFeeds`,feedType:c?`local`:`remote`,instance:m});if(y(e),e===`disabled`||e===`authenticated`&&!p)return{done:!0,value:[]};let n={limit:ru,local:c||void 0};!c&&ot(`@pixelfed/global-feed`)&&(n.remote=!0),S.current=u.v1.timelines.public.list(n).values()}let n=await S.current.next(),{value:r}=n;return r?.length&&(e&&(_.current=r[0].id),r.forEach(e=>{Me(e,m)})),{...n,value:r}}async function w(){if(b||x)return!1;try{let{value:e}=await u.v1.timelines.public.list({limit:1,local:c,since_id:_.current}).values().next(),n=e[0]?.id===_.current;return e?.length&&!n?(e=Zt(e,`public`),!0):!1}catch{return!1}}return L(tc,{title:g,titleComponent:L(`h1`,{class:`header-double-lines`,children:[L(`b`,{children:a(c?{id:`pJQgQV`}:{id:`cg0I-x`})}),L(`div`,{children:m})]}),id:`public`,instance:m,emptyText:a(b?{id:`qbE_m4`}:x?{id:`aqJggz`}:{id:`BiZJ6G`}),errorText:a({id:`scd9lw`}),fetchItems:C,checkForUpdates:w,useItemID:!0,headerStart:L(i,{}),boostsCarousel:o.settings.boostsCarousel,filterContext:`public`,headerEnd:L(Gt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:a({id:`2FYpfJ`})})}),children:[L(Y,{href:c?`/#/${m}/p`:`/#/${m}/p/l`,children:c?L(i,{children:[L(X,{icon:`transfer`}),` `,L(`span`,{children:L(j,{id:`dXMiUw`})})]}):L(i,{children:[L(X,{icon:`transfer`}),` `,L(`span`,{children:L(j,{id:`t2B_we`})})]})}),L(qe,{}),L(Y,{onClick:()=>{let e=prompt(a({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(a({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=c?`/${e}/p/l`:`/${e}/p`)},children:[L(X,{icon:`bus`}),` `,L(`span`,{children:L(j,{id:`kesYbo`})})]}),h!==m&&L(Y,{onClick:()=>{location.hash=c?`/${h}/p/l`:`/${h}/p`},children:[L(X,{icon:`bus`}),` `,L(`small`,{class:`menu-double-lines`,children:L(j,{id:`_AfxaA`,values:{currentInstance:h},components:{0:L(`b`,{})}})})]})]})},m+c)}function au({onItemClick:e}){let{_:n}=d(),{instance:r}=f(),[,i]=m(e=>e+1,0),a=ys(),o=()=>{Cs(),Z({text:n({id:`hgPsUe`}),delay:1e3}),i()},s=(e,n)=>{Ss(e,n),i()},[c]=lr();return a.length===0?null:L(`div`,{class:`recent-searches`,children:[L(`div`,{class:`recent-searches-header`,children:[L(X,{icon:`history`}),` `,L(`span`,{children:L(j,{id:`4R1B1H`})}),L(`span`,{class:`spacer`}),L(`button`,{type:`button`,class:`plain4 small`,onClick:o,disabled:a.length<=0,children:L(`span`,{children:L(j,{id:`yYxB17`})})})]}),L(`ul`,{class:`link-list recent-searches-list`,ref:c,children:a.map(i=>{let{label:a,to:o,icon:c}=ws(i.query,i.queryType,r);return L(`li`,{class:`recent-searches-item`,children:[L(Q,{to:o,class:`recent-searches-link`,onClick:n=>{xs(i.query,i.queryType),e?.(n)},children:[L(X,{icon:c,class:`more-insignificant`}),L(`span`,{class:`recent-searches-label`,children:a})]}),L(`button`,{type:`button`,class:`plain4 small`,onClick:()=>s(i.query,i.queryType),children:L(X,{icon:`trash`,alt:n({id:`xCJdfg`})})})]},`${i.query}-${i.queryType}-${i.timestamp}`)})})]})}var ou=5,su=40,cu=new URLSearchParams,lu={block:`start`,inline:`center`,behavior:`instant`};function uu({columnMode:e,...n}){let{_:r}=d(),{masto:a,instance:o,authenticated:c}=f({instance:(e?{}:A()).instance}),[l,u]=I(`default`),[p]=e?[cu]:oe(),m=s(),h=n?.query||p.get(`q`),_=e?`statuses`:n?.type||p.get(`type`),v=r({id:`A1taO8`});if(h)switch(_){case`statuses`:v=r({id:`6YeoAt`,values:{q:h}});break;case`accounts`:v=r({id:`fpgumQ`,values:{q:h}});break;case`hashtags`:v=r({id:`AuiMZZ`,values:{q:h}});break;default:v=r({id:`wr3GZI`,values:{q:h}})}he(v,`/search`);let[b,x]=I(!1),S=s(0),C=s(0);y(()=>{S.current=0},[h,_]);let w=s();N(()=>{w.current?.scrollTo?.(0,0)},[h,_]);let[T,E]=I([]),[ee,D]=I([]),[O,k]=I([]),[M,P]=I([]);y(()=>{E([]),D([]),k([]),P([])},[h]);let te={statuses:T,accounts:ee,hashtags:O,collections:M},F={statuses:E,accounts:D,hashtags:k,collections:P},[ne,R]=I({}),z=async e=>{if(!e?.length)return;let n=await tt(e,ne);n&&R(e=>({...e,...n}))},B=g(()=>[{key:`accounts`,label:r({id:`bPwFdf`}),seeMoreLabel:r({id:`BMmtZ8`}),emptyLabel:r({id:`YYB61U`}),listClass:`timeline flat accounts-list`,results:ee,renderItem:e=>L(`li`,{children:L(rt,{account:e,instance:o,showStats:!0,relationship:ne[e.id]})},e.id)},{key:`hashtags`,label:r({id:`VwUsHI`}),seeMoreLabel:r({id:`Nc_W5J`}),emptyLabel:r({id:`4MFM3P`}),listClass:`link-list hashtag-list`,results:O,renderItem:e=>{let{name:n,history:r}=e,i=r?.reduce?.((e,n)=>e+ +n.uses,0);return L(`li`,{children:L(Q,{to:o?`/${o}/t/${n}`:`/t/${n}`,children:[L(X,{icon:`hashtag`,alt:`#`}),L(`span`,{children:n}),!!i&&L(`span`,{class:`count`,children:Je(i)})]})},n)}},{key:`collections`,label:r({id:`DoJzLz`}),emptyLabel:null,listClass:`collections-list`,results:M,renderItem:e=>L(`li`,{children:L(Rt,{collection:e,instance:o,size:`l`})},e.id)},{key:`statuses`,label:r({id:`-owNNn`}),seeMoreLabel:r({id:`LYCgej`}),emptyLabel:r({id:`Hzi9AA`}),listClass:`timeline`,results:T,renderItem:e=>L(`li`,{children:L(Q,{class:`status-link`,to:o?`/${o}/s/${e.id}`:`/s/${e.id}`,children:L(Ut,{status:e})})},e.id)}].filter(e=>!_||e.key===_).filter(e=>e.key!==`collections`||e.results.length>0).sort((e,n)=>_?0:e.results.length>0&&n.results.length===0?-1:+(e.results.length===0&&n.results.length>0)),[_,ee,O,M,T,o,ne]);function V(e){if(e&&(S.current=0),!e&&!c)return;u(`loading`),e&&!_&&(E(T.slice(0,ou)),D(ee.slice(0,ou)),k(O.slice(0,ou)),P(M.slice(0,ou)));let n=++C.current;(async()=>{let r={q:h,resolve:c,limit:ou};_&&(r.limit=su,r.type=_,c&&(r.offset=S.current));try{let i=await a.v2.search.list(r);if(C.current!==n)return;if(_)if(e){F[_](i[_]);let e=i[_]?.length;S.current=su,x(!!e)}else if(i[_]?.[0]?.id===te[_]?.[0]?.id)x(!1);else{F[_](e=>[...e,...i[_]]);let e=i[_]?.length;S.current+=su,x(!!e)}else E(i.statuses||[]),D(i.accounts||[]),k(i.hashtags||[]),P(i.collections||[]),S.current=0,x(!1);z(i.accounts),u(`default`)}catch{if(C.current!==n)return;u(`error`)}})()}let re=s();ln(e=>{let n=w.current?.scrollTop===0;if(e&&n){let e=Date.now()-re.current;!re.current||e>1e3*3?V(!0):re.current=Date.now()}}),y(()=>{let e;return m.current?.setValue?.(h||``),h?V(!0):e=setTimeout(()=>{m.current?.focus?.()},150),()=>clearTimeout(e)},[h,_,o]),nt([`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 ie=`.timeline > li > a, .hashtag-list > li > a, .collections-list > li > a`,ae=nt(`j`,()=>{let e=document.activeElement.closest(ie),n=e?.getBoundingClientRect(),r=Array.from(w.current.querySelectorAll(ie));if(e&&n.top<w.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(lu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(lu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),H=nt(`k`,()=>{let e=document.activeElement.closest(ie),n=e?.getBoundingClientRect(),r=Array.from(w.current.querySelectorAll(ie));if(e&&n.top<w.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(lu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(lu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),[U]=lr();return L(`div`,{id:`search-page`,class:`deck-container`,tabIndex:`-1`,ref:e=>{w.current=e,ae.current=e,H.current=e},children:L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{class:l===`loading`?`loading`:``,children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:L(Ns,{})}),L(Ts,{ref:m}),L(`div`,{class:`header-side`,children:L(`button`,{type:`button`,class:`plain`,onClick:()=>{V(!0)},disabled:l===`loading`,children:L(X,{icon:`search`,size:`l`,alt:r({id:`A1taO8`})})})})]})}),L(`main`,{children:[!!h&&!e&&L(`div`,{ref:U,class:`filter-bar ${l===`loading`?`loading`:``}`,children:[!!_&&L(Q,{to:`/search${h?`?q=${encodeURIComponent(h)}`:``}`,children:[L(X,{icon:`chevron-left`}),` `,L(j,{id:`N40H-G`})]}),[{label:r({id:`bPwFdf`}),type:`accounts`,to:`/search?q=${encodeURIComponent(h)}&type=accounts`},{label:r({id:`VwUsHI`}),type:`hashtags`,to:`/search?q=${encodeURIComponent(h)}&type=hashtags`},{label:r({id:`-owNNn`}),type:`statuses`,to:`/search?q=${encodeURIComponent(h)}&type=statuses`}].sort((e,n)=>e.type===_?-1:+(n.type===_)).map(e=>L(Q,{to:e.to,children:e.label},e.type))]}),h?L(i,{children:[B.map(e=>L(i,{children:[!_&&L(`h2`,{class:`timeline-header`,children:[e.label,` `,e.seeMoreLabel&&L(Q,{to:`/search?q=${encodeURIComponent(h)}&type=${e.key}`,children:L(X,{icon:`arrow-right`,size:`l`,alt:r({id:`V1fa9u`})})})]}),e.results.length>0?L(i,{children:[L(`ul`,{class:e.listClass,children:e.results.map(e.renderItem)}),!_&&e.seeMoreLabel&&L(`div`,{class:`ui-state`,children:L(Q,{class:`plain button`,to:`/search?q=${encodeURIComponent(h)}&type=${e.key}`,children:[e.seeMoreLabel,` `,L(X,{icon:`arrow-right`})]})})]}):!_&&e.emptyLabel&&(l===`loading`?L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}):L(`p`,{class:`ui-state`,children:e.emptyLabel}))]},e.key)),!!_&&(l==="default"?b?L(at,{onChange:e=>{e&&V()},children:L(`button`,{type:`button`,class:`plain block`,onClick:()=>V(),style:{marginBlockEnd:`6em`},children:L(j,{id:`uXRAkV`})})}):L(`p`,{class:`ui-state insignificant`,children:L(j,{id:`2EYeAZ`})}):l===`loading`&&L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}))]}):l===`loading`?L(`p`,{class:`ui-state`,children:L(q,{abrupt:!0})}):L(i,{children:[L(`p`,{class:`ui-state insignificant`,children:L(j,{id:`fGn1Hk`})}),L(au,{})]})]})]})})}var du=20,fu=600*1e3,pu=a(e=>e.v1.trends.links.list().values().next(),{expires:fu}),mu=a(e=>e.v1.trends.tags.list().values().next(),{expires:fu});function hu(e){return ot(`@pixelfed/trending`)?e.pixelfed.v2.discover.posts.trending.list({range:`daily`}).values():e.v1.trends.statuses.list({limit:du}).values()}function gu(e,n){return e.v1.timelines.link.list(n).values()}function _u({columnMode:e,...n}){let{_:r}=d(),a=W(k),o=e?{}:A(),{masto:c,instance:l,authenticated:p}=f({instance:n?.instance||o.instance}),{masto:m,instance:h}=f(),_=r({id:`cI3UEs`,values:{instance:l}});he(_,`/:instance?/trending`);let v=s(),b=l===h,[x,S]=I([]),[C,w]=I([]),T=s();async function E(e){if(e||!T.current){if(T.current=hu(c),ot(`@mastodon/trending-hashtags`))try{let{value:e}=await mu(c);e?.length&&S(e)}catch{}if(ot(`@mastodon/trending-links`))try{let{value:e}=await pu(c,l),n=e?.filter?.(e=>e.type===`link`);n?.length&&w(n)}catch{}}let n=await T.current.next(),{value:r}=n;return r?.length&&(e&&(v.current=r[0].id),r.forEach(e=>{Me(e,l)})),{...n,value:r}}let[ee,D]=I(!1),O=s(),[M,N]=I(null),P=!!M,te=s(),F=b&&ot(`@mastodon/trending-link-posts`);y(()=>{M&&te.current&&te.current.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[M]);let ne=s();async function R(e){(e||!O.current)&&(D(!0),O.current=gu(c,{url:M})),ne.current=M;let n=await O.current.next(),{value:r}=n;return r?.length&&(r=Zt(r,`public`),r.forEach(e=>{Me(e,l)})),ne.current===M&&D(!1),{...n,value:r}}async function z(){try{let{value:e}=await c.v1.trends.statuses.list({limit:1}).values().next();return e=Zt(e,`public`),e?.length&&e[0].id!==v.current?(v.current=e[0].id,!0):!1}catch{return!1}}let B=g(()=>L(i,{children:[!!x.length&&L(`div`,{class:`filter-bar expandable`,children:[L(X,{icon:`chart`,class:`insignificant`,size:`l`}),x.map((e,n)=>{let{name:r,history:i}=e,a=i.reduce((e,n)=>e+ +n.uses,0);return L(Q,{to:`/${l}/t/${r}`,children:[L(`span`,{dir:`auto`,children:[L(`span`,{class:`more-insignificant`,children:`#`}),r]}),L(`span`,{class:`filter-count`,children:Je(a)})]},r)})]}),!!C.length&&L(`div`,{class:`links-bar`,children:[L(`header`,{children:L(`h3`,{children:L(j,{id:`9veeTb`})})}),C.map(e=>{let{authors:n,authorName:r,authorUrl:a,blurhash:o,description:s,height:c,image:l,imageDescription:d,language:f,providerName:p,providerUrl:m,publishedAt:h,title:g,url:_,width:v}=e,y=n?.[0]?.account?.id?n[0].account:null,b=g.length<30,x=!!(r||y),S=u(_),C;if(o){let e=Ca(St(o));C=ya([.6,e[1],e[2]])}return L(`div`,{children:[L(`a`,{ref:M===_?te:null,href:_,target:`_blank`,rel:`noopener`,class:`link-block ${P?M===_?`active`:`inactive`:``}`,style:C?{"--accent-color":`rgb(${C.join(`,`)})`,"--accent-alpha-color":`rgba(${C.join(`,`)}, 0.4)`}:{},children:L(`article`,{children:[L(`figure`,{children:L(`img`,{src:l,alt:d,width:v,height:c,loading:`lazy`})}),L(`div`,{class:`article-body`,children:[L(`header`,{children:[L(`div`,{class:`article-meta`,children:[L(`span`,{class:`domain`,children:S}),` `,!!h&&L(i,{children:`· `}),!!h&&L(i,{children:L(Wt,{datetime:h,format:`micro`})})]}),!!g&&L(`h1`,{class:`title`,lang:f,dir:`auto`,title:g,children:g})]}),!!s&&L(`p`,{class:`description ${x&&!b?``:`more-lines`}`,lang:f,dir:`auto`,title:s,children:s}),x&&L(i,{children:[L(`hr`,{}),L(`p`,{class:`byline`,children:L(`small`,{children:L(j,{id:`aavdrC`,values:{0:y?L(ht,{account:y,showAvatar:!0}):a?L(`a`,{href:a,target:`_blank`,rel:`noopener`,children:r}):r}})})})]})]})]})}),F&&L(`button`,{type:`button`,class:`small plain4 block`,onClick:()=>{N(_)},disabled:_===M,children:[L(X,{icon:`comment2`}),` `,L(`span`,{children:L(j,{id:`_bZzdR`})}),` `,L(X,{icon:`chevron-down`})]})]},_)})]}),F&&!!C.length&&L(`div`,{class:`timeline-header-block ${P?`blended`:``}`,children:P?L(i,{children:[L(`div`,{style:{width:50,flexShrink:0,textAlign:`center`},children:ee?L(q,{abrupt:!0}):L(`button`,{type:`button`,class:`light`,onClick:()=>{N(null)},children:L(X,{icon:`x`,alt:r({id:`9Q_4xJ`})})})}),L(`p`,{children:L(j,{id:`BATCqf`,values:{0:M.replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``)},components:{0:L(`span`,{class:`link-text`})}})})]}):L(`p`,{class:`insignificant`,children:L(j,{id:`Vosm4k`})})})]}),[x,C,M,ee]);return L(tc,{title:_,titleComponent:L(`h1`,{class:`header-double-lines`,children:[L(`b`,{children:L(j,{id:`4_iCqx`})}),L(`div`,{children:l})]}),id:`trending`,instance:l,emptyText:r({id:`6HA9-s`}),errorText:r({id:`scd9lw`}),fetchItems:P?R:E,checkForUpdates:P?void 0:z,checkForUpdatesInterval:300*1e3,useItemID:!0,headerStart:L(i,{}),boostsCarousel:a.settings.boostsCarousel,filterContext:`public`,timelineStart:B,refresh:M,clearWhenRefresh:!0,view:P?`link-mentions`:void 0,headerEnd:L(Gt,{portal:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:r({id:`2FYpfJ`})})}),children:[L(Y,{onClick:()=>{let e=prompt(r({id:`4CZnNE`}));if(!/\./.test(e)){e&&alert(r({id:`Q5COHO`}));return}e&&(e=e.toLowerCase().trim(),location.hash=`/${e}/trending`)},children:[L(X,{icon:`bus`}),` `,L(`span`,{children:L(j,{id:`kesYbo`})})]}),h!==l&&L(Y,{onClick:()=>{location.hash=`/${h}/trending`},children:[L(X,{icon:`bus`}),` `,L(`small`,{class:`menu-double-lines`,children:L(j,{id:`_AfxaA`,values:{currentInstance:h},components:{0:L(`b`,{})}})})]})]})},l)}var vu={block:`nearest`,inline:`nearest`,behavior:`instant`};function yu(){let{_:e}=d();he(e({id:`i0qMbr`}),`/`);let{shortcuts:n}=W(k),r=n.map(e=>{if(!e)return null;let{type:n,...r}=e,i={following:al,notifications:nu,list:Sl,public:iu,bookmarks:_c,favourites:Kc,hashtag:bl,mentions:Ll,trending:_u,search:uu,profile:uc}[n];return!i||n===`search`&&!r.query||n===`list`&&!r.id?null:(n===`profile`&&(r.id=ee()),L(i,{...r,columnMode:!0},n+JSON.stringify(r)))});return nt([`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(vu))}catch{}},{useKey:!0,ignoreEventWhen:e=>{let n=/^[1-9]$/.test(e.key);return e.metaKey||e.ctrlKey||e.altKey||e.shiftKey&&!n}}),nt([`[`,`]`],(e,n)=>{let r=n.keys[0],i=document.activeElement.closest(`#columns > *`),a=Ft(),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(vu))},{useKey:!0,ignoreEventWhen:e=>[`[`,`]`].includes(e.key)?!1:e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),L(`div`,{id:`columns`,onContextMenu:e=>{e.target.closest(`.deck > header`)&&!e.target.closest(`a`)&&!e.target.closest(`button`)&&(e.preventDefault(),k.showShortcutsSettings=!0)},onFocus:()=>{let e=document.activeElement.closest(`#columns > *`);e&&document.querySelectorAll(`#columns > *`).forEach(n=>{n.classList.toggle(`focus`,n===e)})},children:r})}function bu(){let{_:e}=d(),n=W(k);return __BENCHMARK.end(`time-to-home`),y(()=>{(async()=>{let e=await Ke.drafts.keys();if(e.length){let n=r();e.filter(e=>e.startsWith(n)).length&&(k.showDrafts=!0)}})()},[]),L(i,{children:(n.settings.shortcutsViewMode===`multi-column`||!n.settings.shortcutsViewMode&&n.settings.shortcutsColumnsMode)&&n.shortcuts?.length?L(yu,{}):n.settings.paginatedTimeline?L(ml,{title:e({id:`i0qMbr`}),path:`/`,id:`home`,headerStart:!1,headerEnd:L(xu,{})}):L(al,{title:e({id:`i0qMbr`}),path:`/`,id:`home`,headerStart:!1,headerEnd:L(xu,{})})})}function xu(){let{_:e}=d(),n=W(k),r=s(),[a,o]=I(void 0);return L(i,{children:[L(Q,{ref:r,to:`/notifications`,class:`button plain notifications-button ${n.notificationsShowNew?`has-badge`:``} ${a||``}`,onClick:e=>{e.stopPropagation(),window.matchMedia(`(min-width: calc(40em))`).matches&&(e.preventDefault(),o(e=>e?void 0:`open`))},children:L(X,{icon:`notification`,size:`l`,alt:e({id:`iDNBZe`})})}),L(Cu,{state:a,anchorRef:r,onClose:()=>o(void 0)})]})}var Su=5;function Cu({anchorRef:e,state:n,onClose:r}){let{masto:a,instance:o}=f(),c=W(k),[l,u]=I(`default`),d=Kl();async function p(){let e=await d.next(),n=Ml(e.value);if(n?.length){n.forEach(e=>{Me(e.status,o,{skipThreading:!0})});let e=ql(n);k.notificationsLast=e[0],k.notifications=e,a.v1.markers.create({notifications:{lastReadId:e[0].id}}).catch(()=>{})}return k.notificationsShowNew=!1,k.notificationsLastFetchTime=Date.now(),e}let[m,h]=I(!1);function g(){return a.v1.followRequests.list({limit:1})}function _({skipFollowRequests:e=!1}={}){u(`loading`),(async()=>{try{await p(),e||h(!!(await g())?.length),u(`default`)}catch{u(`error`)}})()}let v=s();return y(()=>{n===`open`&&(c.notificationsShowNew?v.current?.scrollTop<=52&&_({skipFollowRequests:!0}):_())},[n,c.notificationsShowNew]),L(At,{ref:v,menuClassName:`notifications-menu`,state:n,anchorRef:e,onClose:r,portal:{target:document.body},containerProps:{onClick:()=>{v.current?.closeMenu?.()}},overflow:`auto`,viewScroll:`close`,position:`anchor`,align:`center`,boundingBoxPadding:`8 8 8 8`,children:[L(`header`,{children:L(`h2`,{children:L(j,{id:`iDNBZe`})})}),L(He.Provider,{value:`notifications`,children:L(`main`,{children:c.notifications.length?L(i,{children:c.notifications.slice(0,Su).map(e=>L(_s,{instance:o,notification:e,disableContextMenu:!0},e._ids||e.id))}):l===`loading`?L(`div`,{class:`ui-state`,children:L(q,{abrupt:!0})}):l===`error`&&L(`div`,{class:`ui-state`,children:[L(`p`,{children:L(j,{id:`5GFQTh`})}),L(`p`,{children:L(`button`,{type:`button`,onClick:_,children:L(j,{id:`KDw4GX`})})})]})})}),L(`footer`,{children:[L(Q,{to:`/mentions`,class:`button plain`,children:[L(X,{icon:`at`}),` `,L(`span`,{children:L(j,{id:`_bZzdR`})})]}),L(Q,{to:`/notifications`,class:`button plain2`,children:[m?L(j,{id:`OdVhdR`,components:{0:L(`span`,{class:`tag collapsed`}),1:L(`span`,{})}}):L(`b`,{children:L(j,{id:`gukqfD`})}),` `,L(X,{icon:`arrow-right`})]})]})]})}var wu=K(bu),Tu=[/^\/@[^@\/]+\/(?:statuses|posts)\/([^\/]+)/i,/\/notes\/([^\/]+)/i,/^\/(?:notice|objects)\/([a-z0-9-]+)/i,/\/@[^@\/]+\/post\/([^\/]+)/i,/\/@[^@\/]+@?[^\/]+?\/([^\/]+)/i,/^\/p\/[^\/]+\/([^\/]+)/i];function Eu(e){let n=URL.parse(e);if(!n)return{};let{hostname:r,pathname:i}=n;for(let e of Tu){let[,n]=i.match(e)||[];if(n)return{instance:r,id:n}}return{}}function Du(e){let{instance:n,id:r}=Eu(e);return n&&r?`/${n}/s/${r}`:null}function Ou(){let e=ie().pathname.replace(/^\//,``),n=Eu(e),r=n?.instance?`/${n.instance}/s/${n.id}`:null,[a,o]=I(`loading`);return N(()=>{o(`loading`),(async()=>{try{let{instance:e,id:i}=n;if(i){let{masto:n}=f({instance:e});if(await n.v1.statuses.$select(i).fetch()){window.location.hash=r+`?view=full`;return}}}catch{}{let{masto:n,instance:i}=f(),a=await n.v2.search.list({q:e,limit:1,resolve:!0});if(a.statuses?.length){let e=a.statuses[0];window.location.hash=`/${i}/s/${e.id}?view=full`}else if(a.accounts?.length){let e=a.accounts[0];window.location.hash=`/${i}/a/${e.id}`}else if(a.collections?.length){let e=a.collections[0];window.location.hash=`/${i}/c/${e.id}`}else r?window.location.hash=r+`?view=full`:o(`error`)}})()},[r]),L(`div`,{class:`ui-state`,tabIndex:`-1`,children:[a===`loading`?L(i,{children:[L(q,{abrupt:!0}),L(`h2`,{children:L(j,{id:`RTAr_z`})}),L(`p`,{children:L(`a`,{href:e,target:`_blank`,rel:`noopener`,children:e})})]}):L(i,{children:[L(`h2`,{children:L(j,{id:`ufzZSJ`})}),L(`p`,{children:L(`a`,{href:e,target:`_blank`,rel:`noopener`,children:e})})]}),L(`hr`,{}),L(`p`,{children:L(Q,{to:`/`,children:L(j,{id:`iWpEwy`})})})]})}function ku(){let{_:e}=d();he(e({id:`h16FyT`}),`/l`);let[n,r]=I(`default`),[a,o]=m(e=>e+1,0),[s,c]=I([]);y(()=>{r(`loading`),(async()=>{try{c(await wi()),r(`default`)}catch{r(`error`)}})()},[a]);let[l,u]=I(!1),f=s.some(e=>e.exclusive);return L(`div`,{id:`lists-page`,class:`deck-container`,tabIndex:`-1`,children:[L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`})})]}),L(`h1`,{children:L(j,{id:`h16FyT`})}),L(`div`,{class:`header-side`,children:L(`button`,{type:`button`,class:`plain`,onClick:()=>u(!0),children:L(X,{icon:`plus`,size:`l`,alt:e({id:`Sb2gYF`})})})})]})}),L(`main`,{children:s.length>0?L(i,{children:[L(`ul`,{class:`link-list`,children:s.map(e=>L(`li`,{children:L(Q,{to:`/l/${e.id}`,children:[L(X,{icon:`list`}),` `,L(`span`,{children:[e.title,e.exclusive&&L(i,{children:[` `,L(Mi,{insignificant:!0})]})]})]})}))}),s.length>1&&L(`footer`,{class:`ui-state`,children:[f&&L(`p`,{children:L(`small`,{class:`insignificant`,children:[L(Mi,{}),` `,L(j,{id:`FNptcJ`})]})}),L(`p`,{children:L(`small`,{class:`insignificant`,children:L(j,{id:`8prZNK`,values:{0:s.length}})})})]})]}):n===`loading`?L(`p`,{class:`ui-state`,children:L(q,{})}):n===`error`?L(`p`,{class:`ui-state`,children:L(j,{id:`v_l5uA`})}):L(`p`,{class:`ui-state`,children:L(j,{id:`IvPikw`})})})]}),l&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&u(!1)},children:L(Ni,{list:l?.list,onClose:e=>{e.state===`success`&&o(),u(!1)}})})]})}var Au=``+new URL(`instances-BNPptnn-.json`,import.meta.url).href;function ju(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 Nu(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:Pu}={};function Fu(){let{_:e}=d();he(e({id:`sQia9P`}),`/login`);let n=s(),r=F.local.get(`instanceURL`),[i,a]=I(`default`),[o]=oe(),c=o.get(`instance`),l=o.get(`submit`),[u,f]=I(c||r?.toLowerCase()||``),[p,m]=I([]),h=s();y(()=>{(async()=>{try{let e=await(await fetch(Au)).json();m(e),h.current=new Dt(e)}catch{}})()},[]);let g=n=>{n&&(async()=>{try{let e=await(await fetch(`${location.protocol}//${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),a(`loading`);try{let r=ne(n);(!r||!r.client_id||!r.client_secret)&&(r=await Cr({instanceURL:n}),ae(n,r));let{client_id:i,client_secret:o}=r,s=await hr({instanceURL:n}),c=ue(n),l;if(s&&window.isSecureContext)if(i&&o){let[e,r]=await wr({instanceURL:n,client_id:i,forceLogin:c});F.sessionCookie.set(`codeVerifier`,r),l=e}else{alert(e({id:`ZP1FIA`})),a(`default`);return}else if(i&&o)l=await Tr({instanceURL:n,client_id:i,forceLogin:c});else{alert(e({id:`ZP1FIA`})),a(`default`);return}let u=ju(l);u?Nu(u,e=>{let n=`${window.location.origin}${window.location.pathname}?code=${encodeURIComponent(e)}`;window.location.href=n},e=>{a(`error`)}):location.href=l,a(`default`)}catch{a(`error`)}})()},_=u?u.replace(/^https?:\/\//,``).replace(/\/+$/,``).replace(/^@?[^@]+@/,``).trim():null,v=/[^\s\r\n\t\/\\]+\.[^\s\r\n\t\/\\]+/.test(_)&&!/[\s\/\\@]/.test(_),b=_?h.current?.search(_,{limit:10})?.map(e=>e.item):[],x=v?_:b?.length?b[0]:u?p.find(e=>e.includes(u)):null;return l&&y(()=>{g(c||x)},[]),L(`main`,{id:`login`,style:{textAlign:`center`},children:L(`form`,{onSubmit:e=>{e.preventDefault(),g(x)},children:[L(`h1`,{children:[L(`img`,{src:jr,alt:``,width:`80`,height:`80`}),L(`br`,{}),L(j,{id:`sQia9P`})]}),L(`label`,{children:[L(`p`,{children:L(j,{id:`sGH11W`})}),L(`input`,{value:u,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?L(`ul`,{id:`instances-suggestions`,children:b.map((e,n)=>L(`li`,{children:L(`button`,{type:`button`,class:`plain5`,onClick:()=>{g(e)},children:e})}))}):L(`div`,{id:`instances-eg`,children:L(j,{id:`_OvbEC`})})]}),i===`error`&&L(`p`,{class:`error`,children:L(j,{id:`yCXori`})}),L(`div`,{children:[L(`button`,{disabled:i===`loading`||!u||!x,children:e(x?{id:`2xahsi`,values:{selectedInstanceText:x}}:{id:`xGVfLh`})}),` `]}),L(q,{hidden:i!==`loading`}),L(`hr`,{}),!Pu&&L(`p`,{children:L(`a`,{href:`https://joinmastodon.org/servers`,target:`_blank`,children:L(j,{id:`LcOiWS`})})}),L(`p`,{children:L(Q,{to:`/`,children:L(j,{id:`iWpEwy`})})}),L(Nr,{})]})})}var Iu=40;function Lu(){let{_:e}=d(),n=W(k);he(e({id:`-GkIdc`}),`/sp`);let{masto:r}=f(),[i,a]=I([]),[o,s]=I(`default`),[c,l]=m(e=>e+1,0),[u,p]=I(!1);return y(l,[n.reloadScheduledPosts]),y(()=>{s(`loading`),(async()=>{try{let e=r.v1.scheduledStatuses.list({limit:Iu}).values(),n=[],i;do i=(await e.next()).value,i?.length&&n.push(...i);while(i?.length);a(n)}catch{s(`error`)}finally{s(`default`)}})()},[c]),L(`div`,{id:`scheduled-posts-page`,class:`deck-container`,tabIndex:`-1`,children:L(`div`,{class:`timeline-deck deck`,children:[L(`header`,{children:L(`div`,{class:`header-grid`,children:[L(`div`,{class:`header-side`,children:[L(Ns,{}),L(Q,{to:`/`,class:`button plain`,children:L(X,{icon:`home`,size:`l`,alt:e({id:`i0qMbr`})})})]}),L(`h1`,{children:L(j,{id:`-GkIdc`})}),L(`div`,{class:`header-side`,children:L(Gt,{portal:!0,setDownOverflow:!0,overflow:`auto`,viewScroll:`close`,position:`anchor`,menuButton:L(`button`,{type:`button`,class:`plain`,children:L(X,{icon:`more`,size:`l`,alt:e({id:`2FYpfJ`})})}),children:L(Y,{onClick:()=>{l()},children:[L(X,{icon:`refresh`,size:`l`}),L(`span`,{children:L(j,{id:`lCF0wC`})})]})})})]})}),L(`main`,{children:[i.length?L(`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:m,quoteApprovalPolicy:h}=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:m,quoteApprovalPolicy:h};return L(`li`,{children:L(Ru,{status:g,scheduledAt:i,onClick:()=>{p({post:g,scheduledAt:new Date(i)})}})},n)})}):L(`p`,{class:`ui-state`,children:o===`loading`?L(q,{}):e({id:`mZYb1f`})}),u&&L(Ot,{onClick:e=>{e.target===e.currentTarget&&p(!1)},children:L(zu,{post:u.post,scheduledAt:u.scheduledAt,onClose:()=>p(!1)})})]})]})})}function Ru({status:e,scheduledAt:n,onClick:r}){let i=g(()=>{let e=(Date.parse(n)-Date.now())/(1e3*60*60);return e<24?`time`:e<720?`day`:`month`},[n]);return L(`button`,{type:`button`,class:`textual block`,onClick:r,children:[L(`div`,{class:`post-schedule-meta post-schedule-${i}`,children:[L(X,{icon:i,class:`insignificant`}),` `,L(`span`,{children:L(j,{id:`aEp6lO`,values:{0:Jt(n,{formatOpts:{weekday:`short`,second:`numeric`}})},components:{0:L(`b`,{}),1:L(Wt,{datetime:n}),2:L(`small`,{})}})})]}),L(Ut,{status:e,size:`s`,previewMode:!0,readOnly:!0})]})}function zu({post:e,scheduledAt:n,onClose:r}){let{masto:i,instance:a}=f(),{_:o}=d(),[s,c]=I(`default`),[l,u]=I(),p=l&&l.getTime()!==n.getTime(),m=Vt(),h=n&&n<=Date.now(),{inReplyToId:g}=e,[_,v]=I(null),{quotedStatusId:y}=e;return L(`div`,{id:`scheduled-post-sheet`,class:`sheet`,children:[L(`button`,{type:`button`,class:`sheet-close`,onClick:r,children:L(X,{icon:`x`,size:`l`,alt:o({id:`yz7wBu`})})}),L(`header`,{children:L(`h2`,{children:[L(j,{id:`orjBLU`,components:{0:L(`b`,{}),1:L(Wt,{datetime:n})}}),L(`br`,{}),L(`small`,{children:Jt(n,{formatOpts:{weekday:`short`,second:`numeric`}})})]})}),L(`main`,{tabIndex:`-1`,children:[!!_&&L(`div`,{class:`status-reply`,children:L(Ut,{status:_,size:`s`,previewMode:!0,readOnly:!0})}),L(Ut,{status:e,size:`s`,previewMode:!0,readOnly:!0,onMediaClick:(n,r,i,a)=>{n.preventDefault(),k.showMediaModal={mediaAttachments:e.mediaAttachments,mediaIndex:r}}}),L(`form`,{onSubmit:n=>{n.preventDefault(),c(`loading`),(async()=>{try{await i.v1.scheduledStatuses.$select(e.id).update({scheduledAt:l.toISOString()}),Z(o({id:`40naR1`})),r(),c(`default`),k.reloadScheduledPosts++}catch{c(`error`),Z(o({id:`ZM3jAs`}))}})()},children:L(`footer`,{children:[L(`div`,{class:`row`,children:L(`span`,{children:[L(Pt,{scheduledAt:n,setScheduledAt:e=>{u(e)}}),` `,L(`small`,{class:`ib`,children:m})]})}),L(`div`,{class:`row`,children:[L(`button`,{disabled:!p||s===`loading`||h,children:L(j,{id:`QqW27M`})}),L(`span`,{class:`grow`}),L(xt,{align:`end`,menuItemClassName:`danger`,confirmLabel:o({id:`09u3Kk`}),onClick:()=>{c(`loading`),(async()=>{try{await f().masto.v1.scheduledStatuses.$select(e.id).remove(),Z(o({id:`_zL_Mq`})),r(),c(`default`),k.reloadScheduledPosts++}catch{c(`error`),Z(o({id:`aOh6Md`}))}})()},children:L(`button`,{type:`button`,class:`light danger`,disabled:s===`loading`||h,children:L(j,{id:`Jb6_SB`})})})]})]})})]})]})}function Bu(){let{_:e}=d(),{prevEditedAt:n,nextEditedAt:r,editedAtIndex:i,editHistoryMode:a,editHistoryRef:o,exitEditHistory:s}=dt();return a?L(`div`,{class:`edit-history-controls`,children:[L(X,{icon:`edit`}),L(`b`,{class:`edit-history-heading`,children:e({id:`HSA2au`})}),L(`span`,{class:`spacer`}),L(`span`,{class:`edit-history-pagination`,children:[L(`button`,{type:`button`,class:`plain4`,onClick:()=>{n()},disabled:!a||i+1>=o.current.length,children:L(X,{icon:`chevron-left`,alt:e({id:`DHhJ7s`})})}),` `,o.current.length-i,` /`,` `,o.current.length,` `,L(`button`,{type:`button`,class:`plain4`,onClick:()=>{r()},disabled:!a||i<=0,children:L(X,{icon:`chevron-right`,alt:e({id:`hXzOVo`})})})]}),L(`button`,{type:`button`,class:`plain3`,onClick:()=>{s()},children:L(X,{icon:`exit`,alt:e({id:`ydzS9x`})})})]}):null}var{PHANPY_DEFAULT_INSTANCE:Vu}={},Hu=40,Uu=10,Wu=5,Gu={},Ku={},qu={};function Ju(e){delete Ku[e],delete qu[e]}var Yu={block:`nearest`,inline:`center`,behavior:`instant`},Xu=`.status-link:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *), .status-focus:not(details:not([open]) > summary ~ *, details:not([open]) > summary ~ * *)`,Zu=/\/s\//i;function Qu(e){let{_:n}=d(),{id:r}=e,{masto:i,instance:a}=f({instance:e.instance}),o=W(k),[s,u]=oe(),p=s.get(`media`),m=s.get(`media-only`),h=parseInt(p||m,10),_=h>0,v=s.get(`mediaStatusID`),b=Oe(v,a);v&&!b&&(_=!1);let S=_&&!!m,C=c(r,a),[w,T]=I(k.statuses[C]);y(()=>{k.statuses[C]&&T(k.statuses[C])},[C]),y(()=>{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=g(()=>{let{prevLocation:e}=k,n=(e?.pathname||``)+(e?.search||``),r=l(`/:instance/s/:id`,n)||l(`/s/:id`,n);return!n||r?`/`:n},[]);y(()=>{!w&&_&&(async()=>{try{let e=await i.v1.statuses.$select(r).fetch();Me(e,a),T(e)}catch{alert(n({id:`H_MI1F`})),location.hash=E}})()},[_]);let ee=v?o.statuses[c(v,a)]?.mediaAttachments:w?.mediaAttachments,D=()=>window.matchMedia(`(min-width: calc(40em + 350px))`).matches?`large`:`small`,O=x(()=>{D()===`small`&&o.prevLocation?history.back():S?location.hash=E:(s.delete(`media`),s.delete(`mediaStatusID`),u(s))},[S,E,o.prevLocation]),A=x((e,n,r,i)=>{if(D()===`large`&&!S){O();return}if(_&&document.startViewTransition){let{id:e,blurhash:a,url:o}=r[n],s=Kt(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=``}),O()}).ready.finally(()=>{l.style.viewTransitionName=``,l.dataset.viewTransitioned=s}):O()}else O()},[_,S]);return y(()=>{let e=setTimeout(()=>{let e=document.querySelector(`.carousel`);e&&e.focus()},100);return()=>clearTimeout(e)},[S]),y(()=>{let e=document.querySelectorAll(`.deck-container`);return e.forEach(e=>{e.setAttribute(`inert`,``)}),()=>{e.forEach(e=>{e.removeAttribute(`inert`)})}},[]),L(`div`,{class:`deck-backdrop`,children:[_?ee?.length?L(Fa,{mediaAttachments:ee,statusID:v||r,instance:a,lang:w?.language,index:h-1,onClose:A}):L(`div`,{class:`media-modal-container loading`,children:L(q,{abrupt:!0})}):L(Q,{to:E}),!S&&L(Yt,{statusID:r,children:L(rd,{id:r,instance:e.instance,closeLink:E})})]})}function $u(e){let{linkable:n,to:r,onClick:i,...a}=e;return n?L(Q,{class:`status-link`,to:r,onClick:i,...a}):L(`div`,{class:`status-focus`,tabIndex:0,...a})}function ed(e,n){return Date.parse(e.createdAt)-Date.parse(n.createdAt)}var td=1e3*60*60*24*30,nd=typeof Intl?.Segmenter==`function`?new Intl.Segmenter:null;function rd({id:e,closeLink:n=`/`,instance:r}){let{_:a}=d(),[o,l]=oe(),u=o.get(`media`),p=o.get(`mediaStatusID`),m=parseInt(u,10)>0,h=s(!k.prevLocation&&(history.length===1||`navigation`in window&&navigation?.entries?.()?.length===1)),[_,v]=I(o.get(`view`)||h.current?`full`:null),b=!!parseInt(o.get(`translate`)),{masto:S,instance:C}=f({instance:r}),{masto:w,instance:E,authenticated:ee}=f(),D=C===E,O=W(k),[A,M]=I([]),[P,te]=I(`default`),F=s(),ne=c(e,C),z=s(0),B=s();y(()=>{B.current?.focus()},[]),y(()=>{let n=tn(()=>{if(!B.current)return;let{scrollTop:n}=B.current;P!==`loading`&&(qu[e]=n)},50);return B.current?.addEventListener(`scroll`,n,{passive:!0}),n(),()=>{n.cancel(),B.current?.removeEventListener(`scroll`,n)}},[e,P!==`loading`]);let{editHistoryMode:V,initEditHistory:re,editedAtIndex:ie,editHistoryRef:ae}=dt(),H=s(),U=s(),[se,ce]=I(0),le=s(null),ue=()=>{if(!le.current)return;let{ancestors:n,descendants:r,heroStatus:i}=le.current;if(V&&r?.length){let e=ae.current[ie],n=Date.parse(e.createdAt),i=ae.current[ie-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(ed),r.sort(ed),z.current=r?.length||0;let a=new Set;n.forEach(e=>{Me(e,C,{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(Me(e,C,{}),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:ud(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:ud(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:ud(e),createdAt:e.createdAt})),{id:e,accountID:i.account.id,weight:ud(i),createdAt:i.createdAt},...d],ancestorsIsThread:s,mappedNestedDescendants:d}},K=({reloadHero:n}={})=>{te(`loading`);let r=Ku[e];return M(r?r.filter(e=>k.statuses[ne]):[{id:e}]),(async()=>{let r=()=>ze(()=>S.v1.statuses.$select(e).fetch(),{retries:4}),i=ze(()=>S.v1.statuses.$select(e).context.fetch(),{retries:8}),a=!!O.statuses[ne],o=O.statuses[ne];if(!(a&&!n))try{o=await r(),Me(o,C),await new Promise(e=>{setTimeout(e,100)})}catch{te(`error`);return}try{let n=await i,{ancestors:r}=n;le.current={...n,heroStatus:o};let{allStatuses:a,ancestorsIsThread:s,mappedNestedDescendants:c}=ue(),l=r.length&&!s?[]:c.filter(e=>e.thread),u=(s?r.length:0)+l.length;u>0&&u<100&&ce(u+1),te(`default`),H.current={offsetTop:F.current?.offsetTop,scrollTop:B.current?.scrollTop};let d=r.length||0;d>=ye&&be(d+1),M(a),Ku[e]=a,Ae(o,C)}catch{te(`error`)}})(),U.current=Date.now(),()=>{clearTimeout(void 0)}};y(K,[e,S]),y(()=>{try{let{allStatuses:e}=ue();M(e)}catch{}},[V,ie]);let[de,fe]=I(!1);y(()=>{let e=setInterval(()=>{let e=Date.now();U.current&&e-U.current>=6e4&&fe(!0)},6e4);return()=>{clearInterval(e)}},[]),N(()=>{if(!A.length)return;let n=qu[e];if(n)B.current.scrollTop=n;else if(H.current){let e={offsetTop:F.current?.offsetTop,scrollTop:B.current?.scrollTop},n=e.offsetTop-H.current.offsetTop+e.scrollTop;B.current.scrollTop=n}else A.length===1&&(B.current.scrollTop=0);H.current=null},[A]),y(()=>{O.reloadStatusPage<=0||(async()=>{try{let{instanceURL:n}=R(),r=`${location.protocol}//${n}/api/v1/statuses/${e}/context`;return await(await caches.open(`api`)).delete(r,{ignoreVary:!0}),K({reloadHero:!0})}catch{}})()},[O.reloadStatusPage]),y(()=>()=>{qu={},k.reloadStatusPage=0,Ku={},Gu={},ld.clear()},[]);let pe=O.statuses[ne]||O.statuses[e],me=g(()=>{if(!pe)return``;let{account:e}=pe,n=document.createElement(`div`);return n.innerHTML=e.displayName,n.innerText.trim()},[pe]),ge=g(()=>{if(!pe)return``;let e=Ct(pe);return e.length>64&&(e=(nd?[...nd.segment(e)].map(e=>e.segment):[...e]).slice(0,64).join(``)+`…`),e},[pe]);he(me&&ge?`${me}: "${ge}"`:a({id:`post.title`}),`/:instance?/s/:id`);let _e=g(()=>{if(!pe)return;let{url:e}=pe;if(e)return URL.parse(e)?.hostname},[pe]),ve=g(()=>{if(_e)return _e===C},[_e,C]),[ye,be]=I(Hu),xe=g(()=>A.length-ye,[A.length,ye]),Se=A.some(e=>e.descendant),Ce=A.filter(e=>e.ancestor),[we,Te]=I(!0),Ee=g(()=>{if(!F.current||we)return null;let{top:e}=F.current.getBoundingClientRect();return e>0?`down`:`up`},[we]);nt(`esc`,()=>{location.hash=n},{enabled:!m,ignoreEventWhen:e=>!!document.querySelector(`#modal-container > *`)||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey,useKey:!0}),nt(`backspace`,()=>{location.hash=n},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey}),nt(`j`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`),n=e?.getBoundingClientRect(),r=Array.from(B.current.querySelectorAll(Xu));if(e&&n.top<B.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)+1];n&&(n.focus(),n.scrollIntoView(Yu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Yu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`j`}),nt(`k`,()=>{let e=document.activeElement.closest(`.status-link, .status-focus`),n=e?.getBoundingClientRect(),r=Array.from(B.current.querySelectorAll(Xu));if(e&&n.top<B.current.clientHeight&&n.bottom>0){let n=r[r.indexOf(e)-1];n&&(n.focus(),n.scrollIntoView(Yu))}else{let e=r.find(e=>{let n=e.getBoundingClientRect();return n.top>=44&&n.left>=0});e&&(e.focus(),e.scrollIntoView(Yu))}},{useKey:!0,ignoreEventWhen:e=>e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.key.toLowerCase()!==`k`}),nt(`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`}),nt(`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[De,J]=I(!1),Oe=s(m?`media+status`:`status`),ke=x((e,n,r,i)=>{e.preventDefault(),e.stopPropagation(),l({media:n+1,mediaStatusID:i.id})},[e]),je=x((e,n)=>{Ju(n.id)},[]);y(()=>{let e;return p&&m&&(e=setTimeout(()=>{let e=B.current?.querySelector(`.status-link[href*="/${p}"]`);e&&e.scrollIntoView(Yu)},400)),()=>{clearTimeout(e)}},[p,m]);let Ne=x((n,r)=>{let{id:o,ancestor:s,ghost:c,isThread:l,descendant:u,thread:d,replies:f,repliesCount:p,weight:m,level:h}=n,g=o===e;return L(`li`,{ref:g?F:null,class:`${s?`ancestor`:``} ${u?`descendant`:``} ${d?`thread`:``} ${g?`hero`:``}`,children:[g?L(i,{children:[L(at,{threshold:.1,onChange:e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{Te(e)})})},class:`status-focus`,tabIndex:0,children:L(Ut,{statusID:o,instance:C,withinContext:!0,size:`l`,enableTranslate:!0,forceTranslate:b})}),P!==`loading`&&!ee?L(`div`,{class:`post-status-banner`,children:[L(`p`,{children:L(j,{id:`Vyeh4F`})}),L(Q,{to:Vu?`/login?instance=${Vu}&submit=1`:`/login`,class:`button`,children:L(j,{id:`sQia9P`})})]}):!D&&L(`div`,{class:`post-status-banner`,children:[L(`p`,{children:L(j,{id:`BrLbQp`,values:{instance:C},components:{0:L(`b`,{})}})}),L(`button`,{type:`button`,disabled:P===`loading`,onClick:()=>{te(`loading`),(async()=>{try{let e=await w.v2.search.list({q:pe.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){te(`default`),alert(a({id:`DnepCE`,values:{e}}))}})()},children:[L(X,{icon:`transfer`}),` `,L(j,{id:`jtQUzv`})]})]})]}):L($u,{linkable:!c&&(l||s),to:C?`/${C}/s/${o}`:`/s/${o}`,onClick:()=>{Ju(o)},children:[c?L(Ut,{statusID:o,instance:C,withinContext:!0,size:`m`,ghost:c}):r===0&&s?L(at,{threshold:.5,onChange:e=>{queueMicrotask(()=>{requestAnimationFrame(()=>{J(e)})})},children:L(Ut,{statusID:o,instance:C,withinContext:!0,size:d||s?`m`:`s`,enableTranslate:!0,onMediaClick:ke,onStatusLinkClick:je})}):L(Ut,{statusID:o,instance:C,withinContext:!0,size:d||s?`m`:`s`,enableTranslate:!0,onMediaClick:ke,onStatusLinkClick:je,showActionsBar:!!u}),s&&p>1&&L(`div`,{class:`replies-link`,children:[L(X,{icon:`comment2`,alt:a({id:`N8UzTV`})}),` `,L(`span`,{title:p,children:Je(p)})]}),` `]}),u&&f?.length>0&&L(id,{instance:C,replies:f,hasParentThread:d,level:h,accWeight:m,openAll:z.current<Uu,lazyRenderReplies:z.current>Hu,parentLink:{to:C?`/${C}/s/${o}`:`/s/${o}`,onClick:()=>Ju(o)}}),P===`loading`&&g&&!!pe?.repliesCount&&!Se&&L(`div`,{class:`status-loading`,children:L(q,{abrupt:pe.repliesCount>=3})}),P===`error`&&g&&!!pe?.repliesCount&&!Se&&L(`div`,{class:`status-error`,children:[L(j,{id:`HQJU6W`}),L(`br`,{}),L(`button`,{type:`button`,class:`plain`,onClick:()=>{k.reloadStatusPage++},children:L(j,{id:`KDw4GX`})})]})]},o)},[e,C,P,ee,D,b,ke,je,Se]),Pe=g(()=>{if(`navigation`in window&&navigation?.entries){let e=navigation.entries()[navigation.currentEntry.index-1];if(e?.url)return Zu.test(e.url)}return Zu.test(k.prevLocation?.pathname)},[ne]),Fe=g(()=>{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 A.forEach(n),e.map(e=>c(e,C))},[A,C]);function Ie(e){if(e<12)return G._({id:`DqsEm-`,values:{months:e}});{let n=Math.floor(e/12);return G._({id:`24w-FD`,values:{years:n}})}}let Le=g(()=>{let e=[],n=A.slice(0,ye);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>td){let r=Date.parse(a.createdAt);if(r&&isFinite(r)){let{ancestor:i,id:o}=a,u=~~((n-r)/td);u>0&&e.push(L(`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},[A,ye,Ne,V,ie]);return y(()=>{let e=setTimeout(()=>{if(!F.current)return;let e=F.current.querySelector(`.spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)`);e&&e.click()},1e3);return()=>clearTimeout(e)},[e]),L(jt.Provider,{value:se,children:L(`div`,{tabIndex:`-1`,ref:B,class:`status-deck deck contained ${A.length>1?`padded-bottom`:``} ${Oe.current===`status`&&!h.current?`slide-in`:``} ${_?`deck-view-${_}`:``} ${V?`edit-history-mode`:``}`,style:V?{"--edit-history-percentage":`${ie/(ae.current.length-1)}`}:void 0,onAnimationEnd:e=>{Oe.current===`status`&&(Oe.current=null)},children:[L(`header`,{class:`${P===`loading`?`loading`:``}`,onDblClick:e=>{k.reloadStatusPage++},children:L(`div`,{class:`header-grid header-grid-2`,children:[L(`h1`,{children:[Pe&&L(`button`,{type:`button`,class:`plain deck-back`,onClick:()=>{history.back()},children:L(X,{icon:`chevron-left`,size:`xl`,alt:a({id:`iH8pgl`})})}),!we&&pe&&P!==`loading`?L(i,{children:[L(`span`,{class:`hero-heading`,children:[L(ht,{account:pe.account,instance:C,showAvatar:!0,short:!0}),` `,L(`span`,{class:`insignificant`,children:[`•`,` `,L(Wt,{datetime:pe.createdAt,format:`micro`})]})]}),` `,L(`button`,{type:`button`,class:`ancestors-indicator light small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),F.current.scrollIntoView({behavior:`smooth`,block:`start`})},title:a({id:`NCy-Nw`}),children:L(X,{icon:Ee===`down`?`arrow-down`:`arrow-up`})})]}):L(i,{children:[L(j,{id:`post.title`}),` `,L(`button`,{type:`button`,class:`ancestors-indicator light small`,onClick:e=>{e.preventDefault(),e.stopPropagation(),B.current.scrollTo({top:0,behavior:`smooth`})},hidden:!Ce.length||De,title:a({id:`R8CUl0`,values:{0:Ce.length}}),children:[L(X,{icon:`arrow-up`}),Ce.filter(e=>!e.ghost).filter((e,n,r)=>r.findIndex(n=>n.accountID===e.accountID)===n).slice(0,3).map(e=>L(Ht,{url:e.account.avatarStatic||e.account.avatar,alt:e.account.displayName,squircle:e.account?.bot},e.account.id)),Ce.length>3&&L(i,{children:[` `,L(`span`,{class:`insignificant`,children:Je(Ce.length)})]})]})]})]}),L(`div`,{class:`header-side`,children:[L(`button`,{type:`button`,class:`plain4 button-switch-view`,style:{display:_===`full`?``:`none`},onClick:()=>{v(null),o.delete(`media`),o.delete(`media-only`),o.delete(`view`),l(o)},title:a({id:`-_xYEI`}),children:L(X,{icon:`layout4`,size:`l`})}),de&&L(`button`,{type:`button`,class:`plain button-refresh`,onClick:()=>{k.reloadStatusPage++,fe(!1)},children:L(X,{icon:`refresh`,size:`l`,alt:a({id:`lCF0wC`})})}),L(Gt,{align:`end`,portal:{target:B.current},menuButton:L(`button`,{type:`button`,class:`button plain4`,children:L(X,{icon:`more`,alt:a({id:`2FYpfJ`}),size:`xl`})}),children:[L(Y,{disabled:P===`loading`,onClick:()=>{k.reloadStatusPage++},children:[L(X,{icon:`refresh`}),L(`span`,{children:L(j,{id:`lCF0wC`})})]}),L(Y,{className:`menu-switch-view`,onClick:()=>{v(_===`full`?null:`full`),o.delete(`media`),o.delete(`media-only`),_===`full`?o.delete(`view`):o.set(`view`,`full`),l(o)},children:[L(X,{icon:{"":`layout5`,full:`layout4`}[_||``]}),L(`span`,{children:a(_===`full`?{id:`-_xYEI`}:{id:`2LiWsE`})})]}),L(Y,{onClick:()=>{Array.from(B.current.querySelectorAll(`.spoiler-button:not(.spoiling), .spoiler-media-button:not(.spoiling)`)).forEach(e=>{e.click()})},children:[L(X,{icon:`eye-open`}),` `,L(`span`,{children:L(j,{id:`8r8KmB`})})]}),L(qe,{}),L(ft,{className:`plain`,children:L(j,{id:`Rsjgm0`})}),L(Y,{disabled:!_e||ve,onClick:()=>{let e=Du(pe.url);e?location.hash=e:alert(a({id:`9J6biQ`}))},children:[L(X,{icon:`transfer`}),L(`small`,{class:`menu-double-lines`,children:a(_e?{id:`yi60j9`,values:{0:T.toUnicode(_e)}}:{id:`rWTcqf`})})]}),L(Y,{disabled:!D||P===`loading`||!pe?.editedAt||!z.current,onClick:re,children:[L(X,{icon:`edit`}),L(`span`,{children:a({id:`OqaQnE`})})]})]}),L(Q,{class:`button plain deck-close`,to:n,children:L(X,{icon:`x`,size:`xl`,alt:a({id:`yz7wBu`})})})]})]})}),L(Bu,{}),A.length&&pe?L(`ul`,{class:`timeline flat contextual grow ${P===`loading`?`loading`:``}`,children:[Le,xe>0&&L(`li`,{class:`descendant descendant-more`,children:L(`button`,{type:`button`,class:`plain block show-more`,disabled:P===`loading`,onClick:()=>be(e=>e+Hu),style:{marginBlockEnd:`6em`},children:[L(`div`,{class:`ib avatars-bunch`,children:A.slice(ye,ye+5).map(e=>L(Ht,{url:e.account.avatarStatic},e.id))}),` `,L(`div`,{class:`ib`,children:[L(j,{id:`uXRAkV`}),` `,L(`span`,{class:`tag`,children:xe>Hu?`${Hu}+`:xe})]})]})})]}):L(i,{children:[P===`loading`&&L(`ul`,{class:`timeline flat contextual grow loading`,children:L(`li`,{children:L(Ut,{skeleton:!0,size:`l`})})}),P===`error`&&L(`p`,{class:`ui-state`,children:[L(j,{id:`JWxodU`}),L(`br`,{}),L(`br`,{}),L(`button`,{type:`button`,onClick:()=>{k.reloadStatusPage++},children:L(j,{id:`KDw4GX`})})]})]}),L(`div`,{"data-state-post-ids":Fe.join(` `),hidden:!0})]})})}function id({replies:e,instance:n,hasParentThread:r,level:a,accWeight:o,openAll:c,parentLink:l,lazyRenderReplies:u}){let{_:f}=d(),[p,m]=oe(),h=e=>e.reduce((e,n)=>{let{repliesCount:r,replies:i}=n;return e+(i?.length||r)+h(i||[])},0),_=e.length+h(e),v=e.length===_,b=e.map(e=>e.account).filter((e,n,r)=>r.findIndex(n=>n.id===e.id)===n).slice(0,3),S=g(()=>e?.reduce((e,n)=>e+n?.weight,o),[o,e?.length]),C=!1;(c||S<=Wu||!r&&_===1&&ud(e[0])<2)&&(C=!0);let w=Gu[e[0].id],T=x((e,n,r,i)=>{e.preventDefault(),e.stopPropagation(),m({media:n+1,mediaStatusID:i.id})},[]),E=s();N(()=>{function e(e){e.target.dataset.scrollLeft=e.target.scrollLeft}return E.current?.addEventListener(`scroll`,e,{passive:!0}),()=>{E.current?.removeEventListener(`scroll`,e)}},[]);let[ee,D]=I(w||C),O=u?ee:!0,[k,A]=I(O);y(()=>{A(O)},[O]);let M=C?`div`:`details`,P=M===`details`;return L(M,{ref:E,class:`replies`,open:P?w||C:void 0,onToggle:P?n=>{let{open:r}=n.target;D(r),Gu[e[0].id]=r}:void 0,style:{"--comments-level":a},"data-comments-level":a,"data-comments-level-overflow":a>4,children:[!C&&L(`summary`,{class:`replies-summary`,hidden:C,children:[L(`span`,{class:`avatars`,children:b.map(e=>L(Ht,{url:e.avatarStatic,title:`${e.displayName} @${e.username}`,squircle:e?.bot},e.id))}),L(`span`,{class:`replies-counts`,children:[L(`b`,{children:L(j,{id:`DOQUen`,values:{0:e.length,1:Je(e.length)},components:{0:L(`span`,{title:e.length})}})}),!v&&_>1&&L(i,{children:[` `,`·`,` `,L(`span`,{children:L(j,{id:`qSQQSe`,values:{0:Je(_),totalComments:_},components:{0:L(`span`,{title:_})}})})]})]}),L(X,{icon:`chevron-down`,class:`replies-summary-chevron`}),!!l&&L(Q,{class:`replies-parent-link`,to:l.to,onClick:l.onClick,title:f({id:`ZlV82A`}),children:`»`})]}),k&&L(`ul`,{children:e.map(e=>L(`li`,{children:[L(`div`,{class:`status-focus`,tabIndex:0,children:[L(Ut,{statusID:e.id,instance:n,withinContext:!0,size:`s`,enableTranslate:!0,onMediaClick:T,showActionsBar:!0}),!e.replies?.length&&e.repliesCount>0&&L(`div`,{class:`replies-link`,children:[L(X,{icon:`comment2`,alt:f({id:`N8UzTV`})}),` `,L(`span`,{title:e.repliesCount,children:Je(e.repliesCount)})]})]}),e.replies?.length&&L(id,{instance:n,replies:e.replies,level:e.level,accWeight:C?S:e.weight,openAll:c,lazyRenderReplies:u,parentLink:{to:n?`/${n}/s/${e.id}`:`/s/${e.id}`,onClick:()=>{Ju(e.id)}}})]},e.id))})]})}var ad=140,od=35,sd=70,cd=140,ld=new Map;function ud(e){let n=ld.get(e.id);if(n)return n;let{spoilerText:r,content:i,mediaAttachments:a,poll:o,card:s}=e,c=vt(r+i),l=a?.length?ad:0,u=(o?.options?.length||0)*od,d=s&&(a?.length||o?.options?.length)?0:sd,f=(c+l+u+d)/cd;return ld.set(e.id,f),f}var dd=K(Qu);function fd(){let{id:e,instance:n}=A();return L(dd,{id:e,instance:n})}var pd=``+new URL(`boosts-carousel-BiOaNdMT.jpg`,import.meta.url).href,md=``+new URL(`multi-column-ROck0NVt.jpg`,import.meta.url).href,hd=``+new URL(`multi-hashtag-timeline-DH5INVHi.jpg`,import.meta.url).href,gd=``+new URL(`nested-comments-thread-hv59kZLc.jpg`,import.meta.url).href,_d=`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`,vd=``+new URL(`home-mobile-dark@2x-Dc-J8-SM.png`,import.meta.url).href,yd=``+new URL(`home-mobile-light@2x-Bd3fod8m.png`,import.meta.url).href,bd=``+new URL(`home-tablet-dark@2x-BgcNI8le.png`,import.meta.url).href,xd=``+new URL(`home-tablet-light@2x-BW2RV9T6.png`,import.meta.url).href,{PHANPY_DEFAULT_INSTANCE:Sd,PHANPY_WEBSITE:Cd,PHANPY_PRIVACY_POLICY_URL:wd,PHANPY_DEFAULT_INSTANCE_REGISTRATION_URL:Td}={PHANPY_PRIVACY_POLICY_URL:`https://github.com/cheeaun/phanpy/blob/main/PRIVACY.MD`},Ed=Cd?Cd.replace(/https?:\/\//g,``).replace(/\/$/,``):null,Dd=Cd?Cd.toLowerCase().includes(location.hostname):!1,Od=`${`2026-06-23`.replace(/-/g,`.`)}.05dcc55`;function kd(){let{_:e}=d();return he(null,[`/`,`/welcome`]),L(`main`,{id:`welcome`,children:[L(`div`,{class:`hero-container`,children:L(`div`,{class:`hero-content`,children:[L(`h1`,{children:[L(`img`,{src:jr,alt:``,width:`100`,height:`100`}),L(`img`,{src:_d,alt:`Phanpy`,width:`180`,height:`52`})]}),L(`p`,{class:`desc`,children:L(j,{id:`Ogtv0V`})}),L(`p`,{children:L(Q,{to:Sd?`/login?instance=${Sd}&submit=1`:`/login`,class:`button plain6`,children:e(Sd?{id:`sQia9P`}:{id:`ZLoGls`})})}),Sd&&Td&&L(`p`,{children:L(`a`,{href:Td,class:`button plain5`,children:L(j,{id:`e-RpCP`})})}),!Sd&&L(`p`,{class:`insignificant`,children:L(`small`,{children:L(j,{id:`fvAsUK`,components:{0:L(`br`,{})}})})})]})}),L(`div`,{id:`device-showcase`,children:[L(`div`,{class:`device mobile`,children:L(`div`,{class:`device-frame`,children:L(`picture`,{children:[L(`source`,{srcSet:vd,media:`(prefers-color-scheme: dark)`}),L(`img`,{src:yd,alt:e({id:`LVd2Ia`}),width:`375`,height:`812`,loading:`lazy`})]})})}),L(`div`,{class:`device tablet`,children:L(`div`,{class:`device-frame`,children:L(`picture`,{children:[L(`source`,{srcSet:bd,media:`(prefers-color-scheme: dark)`}),L(`img`,{src:xd,alt:e({id:`6XjvUL`}),width:`768`,height:`1024`,loading:`lazy`})]})})})]}),L(`div`,{id:`why-container`,children:L(`div`,{class:`sections`,children:[L(`section`,{children:[L(`img`,{src:pd,alt:e({id:`S5cYrQ`}),width:`400`,height:`303`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`Tu-sCN`})}),L(`p`,{children:L(j,{id:`e2uVlo`})})]})]}),L(`section`,{children:[L(`img`,{src:vc,alt:e({id:`LUnwPh`}),width:`600`,height:`450`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`xrl8fj`})}),L(`p`,{children:L(j,{id:`1lGm1k`})})]})]}),L(`section`,{children:[L(`img`,{src:gd,alt:e({id:`CGQ27z`}),width:`400`,height:`474`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`cYE45-`})}),L(`p`,{children:L(j,{id:`Pc7QKh`})})]})]}),L(`section`,{children:[L(`img`,{src:md,alt:e({id:`VLKtvP`}),width:`400`,height:`209`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`pEkad9`})}),L(`p`,{children:L(j,{id:`t7Py5R`})})]})]}),L(`section`,{children:[L(`img`,{src:hd,alt:e({id:`wOax6E`}),width:`400`,height:`196`,loading:`lazy`}),L(`div`,{children:[L(`h4`,{children:L(j,{id:`Wi1Ov0`})}),L(`p`,{children:L(j,{id:`tS2i-h`})})]})]})]})}),L(`footer`,{children:[(Ed||Od)&&L(`p`,{class:`app-site-version`,children:L(`small`,{children:[Dd?Ed:``,` `,Od]})}),L(`p`,{children:L(j,{id:`BskFI2`,components:{0:L(`a`,{href:`https://github.com/cheeaun/phanpy`,target:`_blank`}),1:L(`a`,{href:`https://mastodon.social/@cheeaun`,target:`_blank`,onClick:e=>{e.preventDefault(),k.showAccount=`cheeaun@mastodon.social`}}),2:L(`a`,{href:wd,target:`_blank`})}})}),L(`div`,{children:L(Nr,{})})]})]})}me(!0);var Ad=Le(()=>pe(()=>import(`./mock-home-DGhR__He.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),jd=Le(()=>pe(()=>import(`./year-in-posts-DJv_star.js`),__vite__mapDeps([5,2,1,3,4,6]),import.meta.url));window.__STATES__=k,window.__STATES_STATS__=()=>{let e=[`statuses`,`accounts`,`spoilers`,`unfurledLinks`,`statusQuotes`],n={};e.forEach(e=>{n[e]=Object.keys(k[e]).length});let{statuses:r}=k,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}=k,i=0,{instance:a}=f(),o=new Set;document.querySelectorAll(`[data-state-post-id], [data-state-post-ids]`).forEach(e=>{let n=e.dataset.statePostId,r=e.dataset.statePostIds;n&&o.add(n),r&&r.split(/\s+/).forEach(e=>o.add(e))});for(let s in e){if(!window.__IDLE__)break;try{let e=r.some(e=>s===c(e.status?.id,a));if(!o.has(s)&&!e){delete k.statuses[s],delete k.statusQuotes[s];for(let e in n){let r=n[e];if(c(r.id,r.instance)===s){delete k.unfurledLinks[e];break}}i++}}catch{}}},900*1e3),setTimeout(()=>{for(let e in en)setTimeout(()=>{Array.isArray(en[e])?en[e][0]?.():typeof en[e]==`object`?en[e].module?.():en[e]?.()},1)},5e3),(()=>{window.__IDLE__=!0;let e=[`mousemove`,`mousedown`,`resize`,`keydown`,`touchstart`,`pointerdown`,`pointermove`,`wheel`],n=()=>{window.__IDLE__=!0},r=tn(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`)}ve(k,e=>{for(let[n,r,i,a]of e){if(r.join(`.`)===`settings.shortcutsViewMode`){let e=document.getElementById(`app`);e&&(e.dataset.shortcutsViewMode=k.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,Nd=3600*1e3;function Pd(){let[e,n]=I(()=>!!R()),[r,i]=I(`loading`);__BENCHMARK.start(`app-init`),__BENCHMARK.start(`time-to-following`),__BENCHMARK.start(`time-to-home`),__BENCHMARK.start(`time-to-isLoggedIn`),d(),y(()=>{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:s,vapid_key:c}=ne(e)||{},l=Se(e)||c,u=F.sessionCookie.get(`codeVerifier`);(async()=>{i(`loading`);let{access_token:c}=await Er({instanceURL:e,client_id:a,client_secret:s,code:r,code_verifier:u||void 0});if(c){let r=o({instance:e,accessToken:c});await Promise.allSettled([h(r),P(r,e),Ie(r,e,c,l)]),re(),window.__IGNORE_GET_ACCOUNT_ERROR__=!0,n(!0),i(`default`);let a=F.session.get(`loginRedirect`);a&&(F.session.del(`loginRedirect`),window.location.hash=a)}else i(`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=b(e),r&&(we(r.info.id),window.history.replaceState({},document.title,window.location.pathname||`/`))),r||=R(),r){we(r.info.id);let{client:e}=f({account:r}),{instance:a}=e;re(),i(`loading`),(async()=>{try{O()&&S(a)?(h(e),P(e,a)):await Promise.allSettled([h(e),P(e,a)])}catch{}finally{n(!0),i(`default`),__BENCHMARK.end(`app-init`)}})()}else i(`default`),__BENCHMARK.end(`app-init`)}F.sessionCookie.del(`clientID`),F.sessionCookie.del(`clientSecret`),F.sessionCookie.del(`codeVerifier`)},[]);let a=ie();k.currentLocation=a.pathname,y(oi,[a,e]);let c=s(!1),l=`pwaLastPath`;return y(()=>{c.current&&Md&&e&&(Id(a.pathname)?F.local.del(l):F.local.setJSON(l,{path:a.pathname+a.search,lastAccessed:Date.now()}))},[a.pathname,a.search,e]),y(()=>{if(!(c.current||!(!a.pathname||a.pathname===`/`))&&Md&&e&&r==="default"){let e=F.local.getJSON(l);e&&setTimeout(()=>{e?.path&&Date.now()-(e.lastAccessed||0)<Nd&&(window.location.hash=e.path),F.local.del(l)},300),c.current=!0}},[r,e]),y(()=>{`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(a.pathname)?L(Ou,{}):r===`loading`?L(q,{id:`loader-root`}):L(sn,{value:e,children:[L(Ld,{}),L(Bd,{}),L(Fe,{children:L(ke,{path:`/:instance?/s/:id`,element:L(fd,{})})}),e&&L(mn,{}),e&&L(ks,{}),L(as,{}),e&&L(vs,{}),L(fn,{}),e&&L(ss,{}),L(Es,{onClose:oi}),L(gn,{})]})}function Fd(){let e=cn();return e&&__BENCHMARK.end(`time-to-isLoggedIn`),L(e?wu:kd,{})}function Id(e){return/^\/(login|welcome|_sandbox|_qr-scan|_mock)/i.test(e)}var Ld=K(()=>{let e=ie();return L(Fe,{location:g(()=>{let{pathname:n}=e;return!Id(n)},[e])||e,children:[L(ke,{path:`/`,element:L(Fd,{})}),L(ke,{path:`/login`,element:L(Fu,{})}),L(ke,{path:`/welcome`,element:L(kd,{})}),L(ke,{path:`/_mock/home`,element:L(w,{children:L(Ad,{})})}),void 0]})});function Rd({children:e}){let n=cn(),r=ie();if(!n){let e=r.pathname+r.search;return F.session.set(`loginRedirect`,e),L(z,{to:`/login`,replace:!0})}return e}function zd(){return k.prevLocation||null}function Bd(){let e=ie(),n=s(zd()),r=g(()=>l(`/:instance/s/:id`,e.pathname)||l(`/s/:id`,e.pathname),[e.pathname,l]);return y(()=>{r?k.prevLocation&&F.session.setJSON(`prevLocation`,{pathname:k.prevLocation.pathname,search:k.prevLocation.search}):(k.prevLocation&&=null,F.session.del(`prevLocation`))},[r]),r?n.current||=zd():n.current=null,L(Fe,{location:n.current||e,children:[L(ke,{path:`/notifications`,element:L(Rd,{children:L(nu,{})})}),L(ke,{path:`/mentions`,element:L(Rd,{children:L(Ll,{})})}),L(ke,{path:`/following`,element:L(Rd,{children:L(al,{})})}),L(ke,{path:`/_following2`,element:L(Rd,{children:L(ml,{})})}),L(ke,{path:`/b`,element:L(Rd,{children:L(_c,{})})}),L(ke,{path:`/f`,element:L(Rd,{children:L(Kc,{})})}),L(ke,{path:`/l`,children:[L(ke,{index:!0,element:L(Rd,{children:L(ku,{})})}),L(ke,{path:`:id`,element:L(Rd,{children:L(Sl,{})})})]}),L(ke,{path:`/fh`,element:L(Rd,{children:L(rl,{})})}),L(ke,{path:`/sp`,element:L(Rd,{children:L(Lu,{})})}),L(ke,{path:`/ft`,element:L(Rd,{children:L(Qc,{})})}),L(ke,{path:`/catchup`,element:L(Rd,{children:L(Dc,{})})}),L(ke,{path:`/yip`,element:L(Rd,{children:L(w,{fallback:L(`div`,{id:`year-in-posts-page`,class:`deck-container`,tabIndex:`-1`,children:L(q,{})}),children:L(jd,{})})})}),L(ke,{path:`/annual_report/:year`,element:L(Rd,{children:L(hc,{})})}),L(ke,{path:`/:instance?/t/:hashtag`,element:L(bl,{})}),L(ke,{path:`/:instance?/a/:id`,children:[L(ke,{index:!0,element:L(uc,{})}),L(ke,{path:`c`,element:L(mc,{})})]}),L(ke,{path:`/:instance?/c/:id`,element:L(Wc,{})}),L(ke,{path:`/:instance?/p`,children:[L(ke,{index:!0,element:L(iu,{})}),L(ke,{path:`l`,element:L(iu,{local:!0})})]}),L(ke,{path:`/:instance?/trending`,element:L(_u,{})}),L(ke,{path:`/:instance?/search`,element:L(uu,{})})]})}if(ge(),Te(),D(L(je,{i18n:G,children:L(ce,{children:L(U,{children:L(Pd,{})})})}),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(`
|
|
24
24
|
|
|
25
25
|
`),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,k.showCompose=!0)}})}window.__CLOAK__=()=>{document.body.classList.toggle(`cloak`)};export{xi as a,wo as i,ks as n,mn as o,Xa as r,Ns as t};
|
|
26
26
|
//# sourceMappingURL=main-BdqNbG-a.js.map
|