phanpy-cz/assets/useTitle-dCp14HlU.js

4 lines
17 KiB
JavaScript
Raw Permalink Normal View History

2024-06-16 18:14:43 +00:00
const __vite__fileDeps=["./polyfill-force-FXjoUqOk.js","./vendor-GrW-f9CX.js","./compose-W5mt71Ut.js","./status-FORkhePO.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
import{S as et,U as nt,V,W as st,X as ot,Y as rt,D as j,s as it,Z as at,b as v,$ as ct,p as ut,_ as lt,G as J,A as ft}from"./vendor-GrW-f9CX.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&o(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function K(t){const e=a.local.getJSON("accounts")||[];return t&&e.find(n=>n.info.id===t)||e[0]}function ht(t){return(a.local.getJSON("accounts")||[]).find(n=>n.accessToken===t)}function dt(t){return(a.local.getJSON("accounts")||[]).find(n=>n.instanceURL===t)}const Y=window.matchMedia("(display-mode: standalone)");function gt(){try{const t=a.session.get("currentAccount");if(t)return t}catch{}if(Y.matches)try{const t=a.local.get("currentAccount");if(t)return t}catch{}return null}function B(t){try{a.session.set("currentAccount",t)}catch{}if(Y.matches)try{a.local.set("currentAccount",t)}catch{}}function U(){window.__IGNORE_GET_ACCOUNT_ERROR__;const t=gt();return K(t)}function O(){const t=U(),{instanceURL:e,info:{id:n}}=t;return`${n}@${e}`}function mt(t){const e=a.local.getJSON("accounts")||[],n=e.find(o=>o.info.id===t.info.id);n?(n.info=t.info,n.instanceURL=t.instanceURL,n.accessToken=t.accessToken,n.vapidKey=t.vapidKey):e.push(t),a.local.setJSON("accounts",e),B(t.info.id)}function Ut(t){const e=a.local.getJSON("accounts")||[],n=e.find(o=>o.info.id===t.id);n&&(n.info.displayName!==t.displayName||n.info.avatar!==t.avatar||n.info.avatar_static!==t.avatar_static)&&(n.info={...n.info,...t},a.local.setJSON("accounts",e))}let M=null;function Q(){if(M)return M;try{const t=U(),e=a.local.getJSON("instances"),n=t.instanceURL.toLowerCase();return M=e[n]}catch{return{}}}function pt(t){const{configuration:e,maxMediaAttachments:n,maxTootChars:o,pleroma:r,pollLimits:s}=t,i=(e==null?void 0:e.statuses)||{};n&&(i.maxMediaAttachments??(i.maxMediaAttachments=n)),o&&(i.maxCharacters??(i.maxCharacters=o));const c=(e==null?void 0:e.polls)||{};return s&&(c.maxCharactersPerOption??(c.maxCharactersPerOption=s.maxOptionChars),c.maxExpiration??(c.maxExpiration=s.maxExpiration),c.maxOptions??(c.maxOptions=s.maxOptions),c.minExpiration??(c.minExpiration=s.minExpiration)),{...e,statuses:i,polls:c}}function Jt(){const t=Q();return pt(t)}function Gt(){const t=Q();return/pixelfed/i.test(t==null?void 0:t.version)}const N={get:t=>{try{return localStorage.getItem(t)}catch{return null}},getJSON:t=>{try{return JSON.parse(N.get(t))}catch{return null}},set:(t,e)=>{try{return localStorage.setItem(t,e)}catch{return null}},setJSON:(t,e)=>{try{return N.set(t,JSON.stringify(e))}catch{return null}},del:t=>{try{return localStorage.removeItem(t)}catch{return null}}},x={get:t=>{try{return sessionStorage.getItem(t)}catch{return null}},getJSON:t=>{try{return JSON.parse(x.get(t))}catch{return null}},set:(t,e)=>{try{return sessionStorage.setItem(t,e)}catch{return null}},setJSON:(t,e)=>{try{return x.set(t,JSON.stringify(e))}catch{return null}},del:t=>{try{return sessionStorage.removeItem(t)}catch{return null}}},wt={get:t=>{try{return N.getJSON(t)[O()]}catch{return null}},set:(t,e)=>{try{const n=N.getJSON(t)||{};return n[O()]=e,N.setJSON(t,n)}catch{return null}},del:t=>{try{const e=N.getJSON(t)||{};return delete e[O()],N.setJSON(t,e)}catch{return null}}},a={local:N,session:x,account:wt},P="mastodon.social",R={},A={};window.__ACCOUNT_APIS__=A;let p;function _({instance:t,accessToken:e}){/^https?:\/\//.test(t)&&(t=t.replace(/^https?:\/\//,"").replace(/\/+$/,"").toLowerCase());const n=t?`https://${t}`:`https://${P}`,r={masto:et({url:n,accessTo
//# sourceMappingURL=useTitle-dCp14HlU.js.map