import{j as r,c as h}from"../client-By3tlFYA.js";import{r as i,e as d}from"../index-TEHZzOO_.js";import{_ as S,$ as x,P as p,Q as y,W as j,X as w,a,u as E,a0 as P,a1 as b}from"../useSelectableClick-C6FBaLSu.js";import{D as I}from"../detailed_status-CdEW3y_z.js";import{I as R}from"../intl_provider-BiuKJeba.js";import{l as v}from"../relative_timestamp-BOUL06oe.js";import{r as H}from"../ready-DpOgoWSg.js";import"../index-DkCxcZFY.js";import"../message-CVkQtbZv.js";import"../short_number-C9zm8Jg6.js";import"../numbers-BLyy7tyF.js";import"../index-DUY7J2K7.js";import"../skeleton-CwYXpOUk.js";import"../api-C8Dh2R2O.js";import"../index-DiPYjm3h.js";import"../load_locale-Fyp848fa.js";import"../status_quoted-DpF5Slbd.js";import"../formatted_date-CyjChcMh.js";import"../inline_account-C3ydI00z.js";import"../media_gallery-FmcOU3PP.js";import"../alt_text_badge-BNcELapu.js";import"../schedule_idle_task-CDh0madc.js";let c=!1,m;const N=t=>{c?t():m=t},_=()=>()=>{c||(c=!0,typeof m<"u"&&window.requestAnimationFrame(()=>{m()}))},k=S(),A=x(),D=({id:t})=>{const e=a(s=>k(s,{id:t})),o=a(s=>A(s,{id:t})),l=a(s=>s.meta.get("domain")),n=E(),u=_();i.useEffect(()=>{n(P(t,{alsoFetchContext:!1}))},[n,t]);const f=i.useCallback(()=>{n(b(t))},[n,t]);e&&u();const g=e==null?void 0:e.get("url");return r.jsxs("div",{className:"embed",children:[r.jsx(I,{status:e,domain:l,pictureInPicture:o,onToggleHidden:f,withLogo:!0}),r.jsx("a",{className:"embed__overlay",href:g,target:"_blank",rel:"noopener","aria-label":""})]})},T=({id:t})=>(i.useEffect(()=>{d&&p.dispatch(y(d))},[]),r.jsx(R,{children:r.jsx(j,{store:p,children:r.jsx(w,{children:r.jsx(D,{id:t})})})}));function B(){const t=document.getElementById("mastodon-status");if(t){const e=t.getAttribute("data-props");if(!e)return;const o=JSON.parse(e);h.createRoot(t).render(r.jsx(T,{...o}))}}function C(){H(B).catch(t=>{console.error(t)})}v().then(C).catch(t=>{console.error(t)});function F(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="setHeight")}window.addEventListener("message",t=>{if(!t.data||!F(t.data)||!window.parent)return;const e=t.data;document.body.style.overflow="hidden",N(()=>{var o;window.parent.postMessage({type:"setHeight",id:e.id,height:(o=document.getElementsByTagName("html")[0])==null?void 0:o.scrollHeight},"*")})});
//# sourceMappingURL=embed-Cu2d7sas.js.map
