phanpy/assets/useTitle-qcvAjFcD.js

64 lines
135 KiB
JavaScript
Raw Permalink Normal View History

import{L as Ya,O as Ja,E as Za,P as pn,Q as ca,U as Xa,V as Qa,x as la,i as eo,_ as Q,p as fe,a as e,h as Z,u as Ve,W as to,e as no,N as ua,X as ao,Y as oo,M as Te,Z as io,S as ro,g as W,w as fn,$ as so,a0 as gt,a1 as co,a2 as lo,a3 as uo,a4 as mo,D as ho,a5 as po,a6 as fo,a7 as go,a8 as vo,a9 as bo,aa as yo,ab as _o,ac as ko,ad as wo,m as da,ae as Eo,f as ma,af as xo,T as ha,F as $e,y as mn,ag as Nn,t as To,b as yt,q as Lo,r as Ao,d as Xt,J as pa,C as Co,ah as Fo,ai as Bn,aj as So,ak as Vn,al as $o,n as Io,z as jn}from"./vendor-jabuMAqb.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const c of r.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function a(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(o){if(o.ep)return;o.ep=!0;const r=a(o);fetch(o.href,r)}})();function fa(t){const n=O.local.getJSON("accounts")||[];return n.find(a=>a.info.id===t)||n[0]}function Po(t){return(O.local.getJSON("accounts")||[]).find(a=>a.accessToken===t)}function Ro(t){return(O.local.getJSON("accounts")||[]).find(a=>a.instanceURL===t)}function Ot(){window.__IGNORE_GET_ACCOUNT_ERROR__;const t=O.session.get("currentAccount");return fa(t)}function $t(){const t=Ot(),{instanceURL:n,info:{id:a}}=t;return`${a}@${n}`}function Do(t){const n=O.local.getJSON("accounts")||[],a=n.find(s=>s.info.id===t.info.id);a?(a.info=t.info,a.instanceURL=t.instanceURL,a.accessToken=t.accessToken,a.vapidKey=t.vapidKey):n.push(t),O.local.setJSON("accounts",n),O.session.set("currentAccount",t.info.id)}function Er(t){const n=O.local.getJSON("accounts")||[],a=n.find(s=>s.info.id===t.id);a&&(a.info.displayName!==t.displayName||a.info.avatar!==t.avatar||a.info.avatar_static!==t.avatar_static)&&(a.info={...a.info,...t},O.local.setJSON("accounts",n))}let Qt=null;function ga(){if(Qt)return Qt;try{const t=Ot(),n=O.local.getJSON("instances"),a=t.instanceURL.toLowerCase();return Qt=n[a]}catch(t){return alert(`Failed to load instance configuration. Please try again.
${t}`),O.local.del("instances"),location.reload(),{}}}function Mo(t){const{configuration:n,maxMediaAttachments:a,maxTootChars:s,pleroma:o,pollLimits:r}=t,c=(n==null?void 0:n.statuses)||{};a&&(c.maxMediaAttachments??(c.maxMediaAttachments=a)),s&&(c.maxCharacters??(c.maxCharacters=s));const u=(n==null?void 0:n.polls)||{};return r&&(u.maxCharactersPerOption??(u.maxCharactersPerOption=r.maxOptionChars),u.maxExpiration??(u.maxExpiration=r.maxExpiration),u.maxOptions??(u.maxOptions=r.maxOptions),u.minExpiration??(u.minExpiration=r.minExpiration)),{...n,statuses:c,polls:u}}function Oo(){const t=ga();return Mo(t)}const je={get:t=>{try{return localStorage.getItem(t)}catch{return null}},getJSON:t=>{try{return JSON.parse(je.get(t))}catch{return null}},set:(t,n)=>{try{return localStorage.setItem(t,n)}catch{return null}},setJSON:(t,n)=>{try{return je.set(t,JSON.stringify(n))}catch{return null}},del:t=>{try{return localStorage.removeItem(t)}catch{return null}}},hn={get:t=>{try{return sessionStorage.getItem(t)}catch{return null}},getJSON:t=>{try{return JSON.parse(hn.get(t))}catch{return null}},set:(t,n)=>{try{return sessionStorage.setItem(t,n)}catch{return null}},setJSON:(t,n)=>{try{return hn.set(t,JSON.stringify(n))}catch{return null}},del:t=>{try{return sessionStorage.removeItem(t)}catch{return null}}},zo={get:t=>{try{return je.getJSON(t)[$t()]}catch{return null}},set:(t,n)=>{try{const a=je.getJSON(t)||{};return a[$t()]=n,je.setJSON(t,a)}catch{return null}},del:t=>{try{const n=je.getJSON(t)||{};return delete n[$t()],je.setJSON(t,n)}catch{return null}}},O={local:je,session:hn,account:zo},It="mastodon.social",Rt={},Ie={};window.__ACCOUNT_APIS__=Ie;let ge;function Ne({instance:t,accessToken:n}){/^https?:\/\//.test(t)&&(t=t.replace(/^https?:\/\//,"").replace(/\/+$/,"").toLowerCase());const a=t?`https://${t}`:`https://${It}`,o={masto:Ya({url:a,accessToken:n,timeout:3e4}),instance:t,accessToken:n};return Rt[t]=o,Ie[t]||(Ie[t]={}),n&&(Ie[t][n]=o),o}async function xr(t,n){const{masto:a,accessToken:s}=t;let o;try{o=await a.v2.instance.fetch()}catch{}if(!o)try{o=await a.v1.instance.fetch()}catch{}if(!o)return;const{uri:r,urls:{streamingApi:c}={},domain:u,configuration:{urls:{streaming:d}={}}={}}=o,f=O.local.getJSON("instances")||{};if((r||u)&&(f[(u||r).replace(/^https?:\/\//,"").replace(/\/+$/,"").toLowerCase()]=o),n&&(f[n.toLowerCase()]=o),O.local.setJSON("instances",f),"WebSocket"in window&&(c||d)){const p=Ja({streamingApiUrl:d||c,accessToken:s,implementation:WebSocket});t.streaming=p}}async function Tr(t,n,a,s){const{masto:o}=t,r=await o.v1.accounts.verifyCredentials();O.session.set("currentAccount",r.id),Do({info:r,instanceURL:n.toLowerCase(),accessToken:a,vapidKey:s})}async function Lr(t){try{const{masto:n}=t,a=await n.v1.preferences.fetch();O.account.set("preferences",a)}catch{}}function Ke({instance:t,accessToken:n,accountID:a,account:s}={}){var d,f,h,p,m;if(t&&(t=t.toLowerCase().trim()),t&&n){const g=((d=Ie[t])==null?void 0:d[n])||Ne({instance:t,accessToken:n}),{masto:_,streaming:b}=g;return{masto:_,streaming:b,client:g,authenticated:!0,instance:t}}if(n)for(const g in Ie)if(Ie[g][n]){const _=Ie[g][n],{masto:b,streaming:y}=_;return{masto:b,streaming:y,client:_,authenticated:!0,instance:g}}else{const _=Po(n);if(_){const b=_.accessToken,y=_.instanceURL.toLowerCase().trim(),v=Ne({instance:y,accessToken:b}),{masto:E,streaming:L}=v;return{masto:E,streaming:L,client:v,authenticated:!0,instance:y}}else throw new Error("Access token not found")}if(s||a)if(s=s||fa(a),s){const g=s.accessToken,_=s.instanceURL.toLowerCase().trim(),b=((f=Ie[_])==null?void 0:f[g])||Ne({instance:_,accessToken:g}),{masto:y,streaming:v}=b;return{masto:y,streaming:v,client:b,authenticated:!0,instance:_}}else throw new Error(`Account ${a} not found`);const o=Ot();if(t){if((ge==null?void 0:ge.instance)===t)return{masto:ge.masto,streaming:ge.streaming,client:ge,authenticated:!0,instance:t};if((o==null?void 0:o.instanceURL)===t){const{accessToken:E}=o;return ge=((h=Ie[t])==null?void 0:h[E])||Ne({instance:t,accessToken:E}),{masto:ge.masto,streaming:ge.streaming,client:ge,aut
`)),p.innerHTML=`<code>${h.innerHTML.trim()}</code>`,h.replaceWith(p)}),u&&[...r.querySelectorAll("p")].filter(p=>/^```/g.test(p.innerText)).forEach(p=>{const m=[p];let g=!1,_=p;for(;_.nextElementSibling;){const b=_.nextElementSibling;if(b&&b.tagName==="P")if(/```$/g.test(b.innerText)){m.push(b),g=!0;break}else m.push(b);else break;_=b}if(g){const b=document.createElement("pre");m.forEach(v=>{v.querySelectorAll("br").forEach(E=>E.replaceWith(`
`))});const y=m.map(v=>v.innerHTML).join(`
`);b.innerHTML=`<code tabindex="0">${y}</code>`,p.replaceWith(b),m.forEach(v=>v.remove())}}),o.includes("`")&&(d=an(r),d.forEach(f=>{let h=f.nodeValue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");/`[^`]+`/g.test(h)&&(h=h.replaceAll(/(`[^]+?`)/g,"<code>$1</code>")),tt.innerHTML=h,f.replaceWith(...tt.childNodes)})),/twitter\.com/i.test(o)&&(d=an(r,{rejectFilter:["A"]}),d.forEach(f=>{let h=f.nodeValue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");/@[a-zA-Z0-9_]+@twitter\.com/g.test(h)&&(h=h.replaceAll(/(@([a-zA-Z0-9_]+)@twitter\.com)/g,'<a href="https://twitter.com/$2" rel="nofollow noopener noreferrer" target="_blank">$1</a>')),tt.innerHTML=h,f.replaceWith(...tt.childNodes)})),o.includes("#")){let f=null;const h=[...r.querySelectorAll("p")].filter((p,m)=>{let g=0;for(let _=0;_<p.childNodes.length;_++){const b=p.childNodes[_];if(b.nodeType===Node.TEXT_NODE){if(b.textContent.trim()!=="")return!1}else if(b.tagName!=="BR")if(b.tagName==="A"){const y=b.textContent.trim();if(!y||!y.startsWith("#"))return!1;g++}else return!1}if(g>3||g>1&&f&&m===f+1)return f=m,!0});h!=null&&h.length&&h.forEach(p=>{p.classList.add("hashtag-stuffing"),p.title=p.innerText})}return s&&queueMicrotask(()=>s(r)),o=r.innerHTML,o}const Aa=qe(di),mi=["STYLE","IMG","VIDEO","AUDIO","AREA","MAP","TRACK","EMBED","IFRAME","OBJECT","PICTURE","PORTAL","SOURCE","SVG","MATH","CANVAS","NOSCRIPT","SCRIPT","INPUT","OPTION","TEXTAREA","SLOT","TEMPLATE"],hi=Object.fromEntries(mi.map(t=>[t,!0]));function an(t,n={}){var c;const a=[],s=Object.assign({},hi,(c=n.rejectFilter)==null?void 0:c.reduce((u,d)=>(u[d]=!0,u),{})),o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(u){return s[u.parentNode.nodeName]?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},!1);let r;for(;r=o.nextNode();)a.push(r);return a}const on=document.createElement("div");function pi(t){return t?(on.innerHTML=t.replace(/<\/p>/g,`</p>
`).replace(/<\/li>/g,`</li>
`),on.querySelectorAll("br").forEach(n=>{n.replaceWith(`
`)}),on.innerText.replace(/[\r\n]{3,}/g,`
`).trim()):""}const bn=qe(pi);function fi(t){const{mentions:n=[],instance:a,previewMode:s,statusURL:o}=t||{};return r=>{var h,p;let{target:c}=r;if(c=c.closest("a"),!c||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.which===2)return;const u=(h=c.previousSibling)==null?void 0:h.textContent,d=u==null?void 0:u.endsWith("@"),f=c.innerText.startsWith("@");if(c.classList.contains("u-url")&&f||d&&!f){const m=(c.querySelector("span")||c).innerText.trim(),g=m.replace(/^@/,""),_=c.getAttribute("href"),b=n.find(y=>y.username===g||y.acct===g||y.url===_);if(b)r.preventDefault(),r.stopPropagation(),M.showAccount={account:b.acct,instance:a};else if(!/^http/i.test(m)){r.preventDefault(),r.stopPropagation();const y=c.getAttribute("href");M.showAccount={account:y,instance:a}}}else if(!s){const m=u==null?void 0:u.endsWith("#");if(c.classList.contains("hashtag")||m){r.preventDefault(),r.stopPropagation();const g=c.innerText.replace(/^#/,"").trim(),_=a?`#/${a}/t/${g}`:`#/t/${g}`;location.hash=_}else(p=M.unfurledLinks[c.href])!=null&&p.url&&o!==c.href&&(r.preventDefault(),r.stopPropagation(),M.prevLocation={pathname:location.hash.replace(/^#/,"")},location.hash=`#${M.unfurledLinks[c.href].url}`)}}}const{locale:gi}=new Intl.DateTimeFormat().resolvedOptions(),vi=t=>{const{dateYear:n,hideTime:a,formatOpts:s}=t||{},o=new Date().getFullYear();return Intl.DateTimeFormat(gi,{year:n===o?void 0:"numeric",month:"short",day:"numeric",hour:a?void 0:"numeric",minute:a?void 0:"numeric",...s})},bi=qe(vi);function Mt(t,n){return t instanceof Date||(t=new Date(t)),bi({dateYear:t.getFullYear(),...n}).format(t)}const{locale:yi}=Intl.NumberFormat().resolvedOptions(),He=Intl.NumberFormat(yi,{notation:"compact"}).format;function _i({skeleton:t,account:n,avatarSize:a="xl",useAvatarStatic:s=!1,instance:o,external:r,internal:c,onClick:u,showActivity:d=!1,showStats:f=!1,accountInstance:h,hideDisplayName:p=!1,relationship:m={},excludeRelationshipAttrs:g=[]}){if(t)return e("div",{class:"account-block skeleton",children:[e(Qe,{size:a}),e("span",{children:[e("b",{children:"████████"}),e("br",{}),e("span",{class:"account-block-acct",children:"@██████"})]})]});if(!n)return null;const{id:_,acct:b,avatar:y,avatarStatic:v,displayName:E,username:L,emojis:S,url:w,statusesCount:I,lastStatusAt:C,bot:N,fields:Y,note:B,group:R,followersCount:V}=n;let[U,be,le]=b.match(/([^@]+)(@.+)/i)||[,b];h&&(le=`@${h}`);const ve=Y==null?void 0:Y.find(j=>!!j.verifiedAt&&!!j.value),A={};for(const j in m)g.includes(j)||(A[j]=m[j]);const oe=A.following||A.followedBy||A.requested;return e("a",{class:"account-block",href:w,target:r?"_blank":null,title:`@${b}`,onClick:j=>{if(!r){if(j.preventDefault(),u)return u(j);c?location.hash=`/${o}/a/${_}`:M.showAccount={account:n,instance:o}}},children:[e(Qe,{url:s?v:y||v,size:a,squircle:N}),e("span",{class:"account-block-content",children:[!p&&e(W,{children:E?e("b",{children:e(vt,{text:E,emojis:S})}):e("b",{children:L})})," ",e("span",{class:"account-block-acct",children:["@",be,e("wbr",{}),le]}),d&&e(W,{children:[e("br",{}),e("small",{class:"last-status-at insignificant",children:["Posts: ",I,!!C&&e(W,{children:[" ","· Last posted:"," ",Mt(C,{hideTime:!0})]})]})]}),f&&e("div",{class:"account-block-stats",children:[N&&e(W,{children:e("span",{class:"tag collapsed",children:[e(T,{icon:"bot"})," Automated"]})}),!!R&&e(W,{children:e("span",{class:"tag collapsed",children:[e(T,{icon:"group"})," Group"]})}),oe&&e("div",{class:"shazam-container-horizontal",children:e("div",{class:"shazam-container-inner",children:A.following&&A.followedBy?e("span",{class:"tag minimal",children:"Mutual"}):A.requested?e("span",{class:"tag minimal",children:"Requested"}):A.following?e("span",{class:"tag minimal",children:"Following"}):A.followedBy?e("span",{class:"tag minimal",children:"Follows you"}):null})},m.id),!!V&&e("span",{class:"ib",children:[He(V)," ",V===1?"follower":"followers"]}),!!ve&&e("span",{class:"verified-field",children:[e(T,{icon:"check-circle",size:"s"})," ",e("span",{dangerouslySetInnerHTML:{__html:Aa(ve.value,{emojis:S})}})]})]})]})]})}cons
<video
src="${b}"
poster="${g}"
width="${S}"
height="${w}"
data-orientation="${N}"
preload="auto"
autoplay
muted="${ie}"
${ie?"":"controls"}
playsinline
loop="${ee}"
${ie?'ondblclick="this.paused ? this.play() : this.pause()"':""}
${ie&&ke?"ontimeupdate=\"this.closest('.media-gif') && this.closest('.media-gif').style.setProperty('--progress', `${~~((this.currentTime / this.duration) * 100)}%`)\"":""}
></video>
`;return e(ce,{children:e(A,{class:`media ${t} media-${ie?"gif":"video"} ${xe?"media-contain":""} ${he?"media-hover-animate":""}`,"data-orientation":N,"data-formatted-duration":o?void 0:Ce,"data-label":ie&&!o&&!xe?"GIF":"","data-has-alt":!te,style:!o&&Ee,onClick:ne=>{if(he)try{B.current.pause()}catch{}d(ne)},onMouseEnter:()=>{if(he)try{B.current.play()}catch{}},onMouseLeave:()=>{if(he)try{B.current.pause()}catch{}},onFocus:()=>{if(he)try{B.current.play()}catch{}},onBlur:()=>{if(he)try{B.current.pause()}catch{}},children:[o||xe?ie&&o?e(Nn,{...ve,enabled:!0,children:e("div",{ref:V,dangerouslySetInnerHTML:{__html:Fe}})}):e("div",{class:"video-container",dangerouslySetInnerHTML:{__html:Fe}}):ie?e("video",{ref:B,src:b,poster:g,width:S,height:w,"data-orientation":N,preload:"auto",playsinline:!0,loop:!0,muted:!0,onTimeUpdate:ke?ne=>{const{target:we}=ne,ot=we==null?void 0:we.closest(".media-gif");if(ot){const Re=we.currentTime/we.duration*100;ot.style.setProperty("--progress",`${Re}%`)}}:void 0}):e(W,{children:[e("img",{src:g,alt:te?"":h,width:S,height:w,"data-orientation":N,loading:"lazy"}),e("div",{class:"media-play",children:e(T,{icon:"play",size:"xl"})})]}),!o&&!te&&e(un,{alt:h,lang:s,index:u})]})})}else if(y==="audio"){const G=ea(v.duration);return e(ce,{children:e(A,{class:`media media-audio ${t}`,"data-formatted-duration":o?void 0:G,"data-has-alt":!te,onClick:d,style:!o&&Ee,children:[o?e("audio",{src:_||b,preload:"none",controls:!0,autoplay:!0}):g?e("img",{src:g,alt:te?"":h,width:S,height:w,"data-orientation":N,loading:"lazy"}):null,!o&&e(W,{children:[e("div",{class:"media-play",children:e(T,{icon:"play",size:"xl"})}),!te&&e(un,{alt:h,lang:s,index:u})]})]})})}}function Xn(t){return e(To,{children:({ref:n,closeMenu:a})=>e(at,{...t,ref:n,onClick:({detail:s})=>a(s===0?"Enter":void 0)})})}const Vi=280,ji=140;function Ui(t,n){return n.v1.accounts.$select(t).fetch()}const Hi=zt(Ui),pt={public:"Public",unlisted:"Unlisted",private:"Followers only",direct:"Private mention"},Ki=window.ontouchstart!==void 0&&/iPad|iPhone|iPod/.test(navigator.userAgent),Qn=80;function qi(t){var n;return(n=t==null?void 0:t.options)!=null&&n.length?`📊:
${t.options.map(a=>`- ${a.title}${a.votesCount>=0?` (${a.votesCount})`:""}`).join(`
`)}`:""}function dn(t){const{spoilerText:n,content:a,poll:s}=t;return(n?`${n}
`:"")+bn(a)+qi(s)}function Xe({statusID:t,status:n,instance:a,size:s="m",contentTextWeight:o,readOnly:r,enableCommentHint:c,withinContext:u,skeleton:d,enableTranslate:f,forceTranslate:h,previewMode:p,onMediaClick:m,quoted:g,onStatusLinkClick:_=()=>{},showFollowedTags:b}){var Rn,Dn,Mn;if(d)return e("div",{class:"status skeleton",children:[e(Qe,{size:"xxl"}),e("div",{class:"container",children:[e("div",{class:"meta",children:"███ ████████"}),e("div",{class:"content-container",children:e("div",{class:"content",children:e("p",{children:"████ ████████"})})})]})]});const{masto:y,instance:v,authenticated:E}=Ke({instance:a}),{instance:L}=Ke(),S=v===L;let w=Me(t||(n==null?void 0:n.id),v);const I=yt(M);if(n||(n=I.statuses[w]||I.statuses[t],w=Me(n==null?void 0:n.id,v)),!n)return null;const{account:{acct:C,avatar:N,avatarStatic:Y,id:B,url:R,displayName:V,username:U,emojis:be,bot:le,group:ve},id:A,repliesCount:oe,reblogged:j,reblogsCount:K,favourited:de,favouritesCount:me,bookmarked:ye,poll:se,muted:Pe,sensitive:Ee,spoilerText:_e,visibility:te,language:ce,editedAt:G,filtered:ie,card:ee,createdAt:Ce,inReplyToId:he,inReplyToAccountId:xe,content:ke,mentions:Fe,mediaAttachments:ne,reblog:we,uri:ot,url:Re,emojis:et,tags:x,_deleted:F,_pinned:D}=n,$=$e(()=>O.session.get("currentAccount"),[]),J=$e(()=>$&&$===B,[B,$]),q=Lo(Pi),z=!J&&!r&&!p&&$a(ie,q);if((z==null?void 0:z.action)==="hide")return null;const H=l=>{l.shiftKey};if(s!=="l"&&z)return e(Zi,{status:n,filterInfo:z,instance:v,containerProps:{onMouseEnter:H},showFollowedTags:!0});const re=new Date(Ce),Le=new Date(G);let Oe=Fe==null?void 0:Fe.find(l=>l.id===xe);!Oe&&xe===A&&(Oe={url:R,username:U,displayName:V});const[Se,We]=Z(Oe);if(!u&&!Se&&xe){const l=M.accounts[xe];l?We(l):Hi(xe,y).then(P=>{We(P),M.accounts[P.id]=P}).catch(P=>{})}const _t=xe===$||(Fe==null?void 0:Fe.find(l=>l.id===$)),Ge=$e(()=>!!(O.account.get("preferences")||{})["reading:expand:spoilers"],[]),kt=$e(()=>(O.account.get("preferences")||{})["reading:expand:media"]||"default",[]),ze=p||Ge||!!I.spoilers[A],it=p||kt==="show_all"||!!I.spoilersMedia[A];if(we)return ve?e("div",{"data-state-post-id":w,class:"status-group",onMouseEnter:H,children:[e("div",{class:"status-pre-meta",children:[e(T,{icon:"group",size:"l",alt:"Group"})," ",e(mt,{account:n.account,instance:v,showAvatar:!0})]}),e(Xe,{status:t?null:we,statusID:t?we.id:null,instance:v,size:s,contentTextWeight:o,readOnly:r})]}):e("div",{"data-state-post-id":w,class:"status-reblog",onMouseEnter:H,children:[e("div",{class:"status-pre-meta",children:[e(T,{icon:"rocket",size:"l"})," ",e(mt,{account:n.account,instance:v,showAvatar:!0})," ",e("span",{children:"boosted"})]}),e(Xe,{status:t?null:we,statusID:t?we.id:null,instance:v,size:s,contentTextWeight:o,readOnly:r,enableCommentHint:!0})]});if(b&&((Rn=I.statusFollowedTags[w])!=null&&Rn.length))return e("div",{"data-state-post-id":w,class:"status-followed-tags",onMouseEnter:H,children:[e("div",{class:"status-pre-meta",children:[e(T,{icon:"hashtag",size:"l"})," ",I.statusFollowedTags[w].slice(0,3).map(l=>e(at,{to:v?`/${v}/t/${l}`:`/t/${l}`,class:"status-followed-tag-item",children:l},l))]}),e(Xe,{status:t?null:n,statusID:t?n.id:null,instance:v,size:s,contentTextWeight:o,readOnly:r,enableCommentHint:!0})]});const ue=s==="l",[Vt,Da]=Z(h),_n=La(!0),Ma=I.settings.contentTranslationHideLanguages||[],{contentTranslation:jt,contentTranslationAutoInline:kn}=I.settings;jt||(f=!1);const wn=$e(()=>{if(!jt||!kn||r||u&&!ue||p||_e||Ee||se||ee||ne!=null&&ne.length)return!1;const l=ln(ke);return l>0&&l<=ji},[jt,kn,r,u,ue,p,_e,Ee,se,ee,ne,ke]),[Ut,wt]=Z(!1),Oa=Pt(),za=Pt(),Na=Pt(),En="Read more →",Ht=Q(null),rt="Sorry, your current logged-in instance can't interact with this post from another instance.",xn=ha(()=>Math.max(Math.round((_e.length+ln(ke))/140)||1,1),[_e,ke]),Tn=Mt(re),Ln=G&&Mt(Le);let st=E&&te!=="direct"&&te!=="private";te==="private"&&J&&(st=!0);const Kt=l=>{var P;if(!S||!E)return alert(rt);(l!=null&&l.shiftKey||(P=l==null?void 0:l.syntheticEvent)!=null&&P.shiftKey)&&_a({replyToStatus:
Some media have no descriptions.`),!confirm(l))return!1}if(M.statuses[w]={...n,reblogged:!j,reblogsCount:K+(j?-1:1)},j){const l=await y.v1.statuses.$select(A).unreblog();return De(l,v),!0}else{const l=await y.v1.statuses.$select(A).reblog();return De(l,v),!0}}catch{return M.statuses[w]=n,!1}},Wt=async()=>{if(!S||!E)return alert(rt),!1;try{if(M.statuses[w]={...n,reblogged:!j,reblogsCount:K+(j?-1:1)},j){const l=await y.v1.statuses.$select(A).unreblog();return De(l,v),!0}else{const l=await y.v1.statuses.$select(A).reblog();return De(l,v),!0}}catch{return M.statuses[w]=n,!1}},Gt=async()=>{if(!S||!E)return alert(rt);try{if(M.statuses[w]={...n,favourited:!de,favouritesCount:me+(de?-1:1)},de){const l=await y.v1.statuses.$select(A).unfavourite();De(l,v)}else{const l=await y.v1.statuses.$select(A).favourite();De(l,v)}}catch{M.statuses[w]=n}},Yt=async()=>{if(!S||!E)return alert(rt);try{if(M.statuses[w]={...n,bookmarked:!ye},ye){const l=await y.v1.statuses.$select(A).unbookmark();De(l,v)}else{const l=await y.v1.statuses.$select(A).bookmark();De(l,v)}}catch{M.statuses[w]=n}},An=!!ce&&ce!==_n&&!Dt([ce],[_n])&&!Ma.find(l=>ce===l||Dt([ce],[l])),Cn=Q(),Fn=Q();async function Ba(l){var pe,Ye,On,zn;l&&(Cn.current=y.v1.statuses.$select(t).rebloggedBy.list({limit:Qn}),Fn.current=y.v1.statuses.$select(t).favouritedBy.list({limit:Qn}));const[{value:P},{value:X}]=await Promise.allSettled([Cn.current.next(),Fn.current.next()]);if((pe=P.value)!=null&&pe.length||(Ye=X.value)!=null&&Ye.length){const Zt=[];return(On=P.value)!=null&&On.length&&Zt.push(...P.value.map(lt=>(lt._types=["reblog"],lt))),(zn=X.value)!=null&&zn.length&&Zt.push(...X.value.map(lt=>(lt._types=["favourite"],lt))),{value:Zt,done:P.done&&X.done}}return{value:[],done:!0}}const kr=Q(),Sn=e(W,{children:[!ue&&e(W,{children:[e(Ao,{children:[e("span",{class:"ib",children:[e(T,{icon:nt[te],size:"s"})," ",e("span",{children:pt[te]})]})," ",e("span",{class:"ib",children:[oe>0&&e("span",{children:[e(T,{icon:"comment2",alt:"Replies",size:"s"})," ",e("span",{children:He(oe)})]})," ",K>0&&e("span",{children:[e(T,{icon:"rocket",alt:"Boosts",size:"s"})," ",e("span",{children:He(K)})]})," ",me>0&&e("span",{children:[e(T,{icon:"heart",alt:"Likes",size:"s"})," ",e("span",{children:He(me)})]})]}),e("br",{}),Tn]}),e(Xn,{to:v?`/${v}/s/${A}`:`/s/${A}`,onClick:l=>{_(l,n)},children:[e(T,{icon:"arrow-right"}),e("span",{children:["View post by @",U||C]})]})]}),!!G&&e(Te,{onClick:()=>{wt(A)},children:[e(T,{icon:"history"}),e("span",{children:["Show Edit History",e("br",{}),e("small",{class:"more-insignificant",children:["Edited: ",Ln]})]})]}),(!ue||!!G)&&e(Xt,{}),ue&&e(Te,{onClick:()=>{M.showGenericAccounts={heading:"Boosted/Liked by…",fetchAccounts:Ba,instance:v,showReactions:!0}},children:[e(T,{icon:"react"}),e("span",{children:["Boosted/Liked by",e("span",{class:"more-insignificant",children:"…"})]})]}),!ue&&S&&e(W,{children:[e("div",{class:"menu-horizontal",children:[e(tn,{subMenu:!0,confirmLabel:e(W,{children:[e(T,{icon:"rocket"}),e("span",{children:j?"Unboost?":"Boost to everyone?"})]}),menuFooter:qt&&!j&&e("div",{class:"footer",children:[e(T,{icon:"alert"}),"Some media have no descriptions."]}),disabled:!st,onClick:async()=>{try{const l=await Wt();!ue&&l&&Ae(j?`Unboosted @${U||C}'s post`:`Boosted @${U||C}'s post`)}catch{}},children:[e(T,{icon:"rocket",style:{color:j&&"var(--reblog-color)"}}),e("span",{children:j?"Unboost":"Boost…"})]}),e(Te,{onClick:()=>{try{Gt(),ue||Ae(de?`Unliked @${U||C}'s post`:`Liked @${U||C}'s post`)}catch{}},children:[e(T,{icon:"heart",style:{color:de&&"var(--favourite-color)"}}),e("span",{children:de?"Unlike":"Like"})]})]}),e("div",{class:"menu-horizontal",children:[e(Te,{onClick:Kt,children:[e(T,{icon:"reply"}),e("span",{children:"Reply"})]}),e(Te,{onClick:()=>{try{Yt(),ue||Ae(ye?`Unbookmarked @${U||C}'s post`:`Bookmarked @${U||C}'s post`)}catch{}},children:[e(T,{icon:"bookmark",style:{color:ye&&"var(--link-color)"}}),e("span",{children:ye?"Unbookmark":"Bookmark"})]})]})]}),f?e("div",{class:ht?"menu-horizontal":"",children:[e(Te,{disabled:Vt,onClick:()=>{Da(!0)
<li role="option" data-value="${Be(B)}">
<img src="${Be(R)}" width="16" height="16" alt="" loading="lazy" />
:${Be(B)}:
</li>`}),Ue.innerHTML=N,S(Promise.resolve({matched:C.length>0,fragment:Ue}));return}const I={"@":"accounts","#":"hashtags"}[L];S(new Promise(C=>{c({type:I,q:w,limit:5}).then(Y=>{if(w!==h.current)return;const B=Y[I]||Y;let R="";B.forEach(V=>{var de;const{name:U,avatarStatic:be,displayName:le,username:ve,acct:A,emojis:oe,history:j}=V,K=vn(le,oe);if(A)R+=`
<li role="option" data-value="${Be(A)}">
<span class="avatar">
<img src="${Be(be)}" width="16" height="16" alt="" loading="lazy" />
</span>
<span>
<b>${K||ve}</b>
<br>@${Be(A)}
</span>
</li>
`;else{const me=(de=j==null?void 0:j.reduce)==null?void 0:de.call(j,(ye,se)=>ye+ +se.uses,0);R+=`
<li role="option" data-value="${Be(U)}">
<span class="grow">#<b>${Be(U)}</b></span>
${me?`<span class="count">${He(me)}</span>`:""}
</li>
`}Ue.innerHTML=R}),C({matched:B.length>0,fragment:Ue})})}))},f.current.addEventListener("text-expander-change",b),y=E=>{const{key:L,item:S}=E.detail;L===":"?E.detail.value=`:${S.dataset.value}:`:E.detail.value=`${L}${S.dataset.value}`},f.current.addEventListener("text-expander-value",y),v=E=>{const{input:L}=E.detail;if(o(L.value),n.current){const S=new Event("input",{bubbles:!0});n.current.dispatchEvent(S)}},f.current.addEventListener("text-expander-committed",v)),()=>{f.current&&(f.current.removeEventListener("text-expander-change",b),f.current.removeEventListener("text-expander-value",y),f.current.removeEventListener("text-expander-committed",v))}},[]),fe(()=>{const b=n.current;if(!b)return;new ResizeObserver(()=>{if(f.current){const{height:v}=b.getBoundingClientRect();f.current.style.height=v+"px"}}).observe(b)},[]);const p=Q(0),m=Q(),g=da(b=>{var E;if(!m.current)return;if(p.current>3){m.current.innerHTML="",m.current=null,(E=g==null?void 0:g.cancel)==null||E.call(g);return}let y,v;p.current<=3&&(y=Date.now()),m.current.innerHTML=mr(b,{maxCharacters:r})+`
`,p.current<=3&&(v=Date.now()),y&&v&&v-y>50&&p.current++},500);return e("text-expander",{ref:f,keys:"@ # :",class:"compose-field-container",children:[e("textarea",{class:"compose-field",autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",rows:"6",cols:"50",...u,ref:n,name:"status",value:s,onKeyDown:b=>{const{key:y,target:v}=b;if(y==="Enter")try{const{value:E,selectionStart:L}=v,w=E.slice(0,L).split(`
`).slice(-1)[0];if(w&&/^\s*(-|\d+\.)\s/.test(w)){const[I,C,N,Y,B]=w.match(/^(\s*)(-|\d+\.)(\s+)(.+)?/)||[];if(B){b.preventDefault();const[R]=N.match(/\d+/)||[],V=R?`${+R+1}.`:"-",U=`
${C}${V}${Y}`;v.setRangeText(U,L,L);const be=L+U.length;v.setSelectionRange(be,be)}else{const R=L-w.length;v.setRangeText("",R,L)}ia(v),v.dispatchEvent(new Event("input"))}}catch{}m.current&&(m.current.scrollTop=v.scrollTop)},onInput:b=>{var E;const{target:y}=b,v=y.value;o(v),ia(y),(E=t.onInput)==null||E.call(t,b),g(v)},style:{width:"100%",height:"4em"},onScroll:b=>{if(m.current){const{scrollTop:y}=b.target;m.current.scrollTop=y}}}),e("div",{ref:m,class:"compose-highlight","aria-hidden":"true"})]})});function pr({maxCharacters:t=500,hidden:n}){const s=yt(M).composerCharacterCount,o=t-s;return n?e("meter",{class:"donut",hidden:!0}):e("meter",{class:`donut ${o<=-10?"explode":o<=0?"danger":o<=20?"warning":""}`,value:s,max:t,"data-left":o,title:`${o}/${t}`,style:{"--percentage":s/t*100}})}function fr({attachment:t,disabled:n,lang:a,onDescriptionChange:s=()=>{},onRemove:o=()=>{}}){const[r,c]=Z("default"),u=Ca("@mastodon/edit-media-attributes"),{type:d,id:f,file:h}=t,p=$e(()=>h?URL.createObjectURL(h):t.url,[h,t.url]),[m,g]=Z(t.description),[_,b]=d.split("/"),y=Io(s,250),[v,E]=Z(!1),L=Q(null);fe(()=>{let I;return v&&L.current&&(I=setTimeout(()=>{L.current.focus()},100)),()=>{clearTimeout(I)}},[v]);const S=e(W,{children:f&&!u?e("div",{class:"media-desc",children:[e("span",{class:"tag",children:"Uploaded"}),e("p",{title:m,children:t.description||e("i",{children:"No description"})})]}):e("textarea",{ref:L,value:m||"",lang:a,placeholder:{image:"Image description",video:"Video description",audio:"Audio description"}[_],autoCapitalize:"sentences",autoComplete:"on",autoCorrect:"on",spellCheck:"true",dir:"auto",disabled:n||r==="loading",class:r==="loading"?"loading":"",maxlength:"1500",onInput:I=>{const{value:C}=I.target;g(C),y(C)}})}),w=Q(null);return fe(()=>()=>{var I,C;(C=(I=w.current)==null?void 0:I.hideToast)==null||C.call(I)},[]),e(W,{children:[e("div",{class:"media-attachment",children:[e("div",{class:"media-preview",tabIndex:"0",onClick:()=>{E(!0)},children:_==="image"?e("img",{src:p,alt:""}):_==="video"||_==="gifv"?e("video",{src:p,playsinline:!0,muted:!0}):_==="audio"?e("audio",{src:p,controls:!0}):null}),S,e("div",{class:"media-aside",children:e("button",{type:"button",class:"plain close-button",disabled:n,onClick:o,children:e(T,{icon:"x"})})})]}),v&&e(Nt,{class:"light",onClick:I=>{I.target===I.currentTarget&&E(!1)},children:e("div",{id:"media-sheet",class:"sheet sheet-max",children:[e("button",{type:"button",class:"sheet-close",onClick:()=>{E(!1)},children:e(T,{icon:"x"})}),e("header",{children:e("h2",{children:{image:"Edit image description",video:"Edit video description",audio:"Edit audio description"}[_]})}),e("main",{tabIndex:"-1",children:[e("div",{class:"media-preview",children:_==="image"?e("img",{src:p,alt:""}):_==="video"||_==="gifv"?e("video",{src:p,playsinline:!0,controls:!0}):_==="audio"?e("audio",{src:p,controls:!0}):null}),e("div",{class:"media-form",children:[S,e("footer",{children:[_==="image"&&/^(png|jpe?g|gif|webp)$/i.test(b)&&!!M.settings.mediaAltGenerator&&!!na&&e(gn,{portal:{target:document.body},containerProps:{style:{zIndex:1001}},align:"center",position:"anchor",overflow:"auto",menuButton:e("button",{type:"button",title:"More",class:"plain",children:e(T,{icon:"more",size:"l",alt:"More"})}),children:e(Te,{disabled:r==="loading",onClick:()=>{c("loading"),w.current=Ae({text:"Generating description. Please wait...",duration:-1}),async function(){var I,C;try{const N=new FormData;N.append("image",h);const Y=await fetch(na,{method:"POST",body:N}).then(B=>B.json());g(Y.description)}catch{Ae("Failed to generate description")}finally{c("default"),(C=(I=w.current)==null?void 0:I.hideToast)==null||C.call(I)}}()},children:[e(T,{icon:"sparkles2"}),e("span",{children:"Generate description…"})]})}),e("button",{type:"button",class:"light block",onClick:()=>{E(!1)},disabled:r==="loading",children:"Done"})]})]})]})]})})]})}function gr({lang:t,poll:n,disabled:a,onInput:s=()=>{},maxOptions:o,maxExpiration:r,minExpiration:c,maxCharactersPerOption:u}){const{options:d,expiresIn:f,multiple:h}=n;return e("div",{class:`poll
//# sourceMappingURL=useTitle-qcvAjFcD.js.map
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}