import{d as e,n as t,t as n}from"../objectSpread2-DtFdQpqy.js";import{a as r,n as i,r as a}from"../preload-helper-EQ20WQt-.js";import{t as o}from"../ready-CjDkUfev.js";import{k as s}from"../prop-types-DdDwMzX7.js";import{t as c}from"../locales-DVVnY6uc.js";import{h as l,p as u}from"../poll-DJul990I.js";import{Do as d,Eo as f,Gr as p,Ko as m,Oo as h,Xn as g,eo as _,nr as v,x as y}from"../time-BE5vfriQ.js";import{t as b}from"../detailed_status-CKdn2wJ8.js";var x=a(),S=!1,C,w=e=>{S?e():C=e},T=()=>()=>{S||(S=!0,C!==void 0&&window.requestAnimationFrame(()=>{C()}))},E=e(r()),D=i(),O=l(),k=u(),A=({id:e})=>{let t=d(t=>O(t,{id:e})),n=d(t=>k(t,{id:e})),r=d(e=>e.meta.get(`domain`)),i=f(),a=T();(0,E.useEffect)(()=>{i(g(e,{alsoFetchContext:!1}))},[i,e]);let o=(0,E.useCallback)(()=>{i(v(e))},[i,e]);t&&a();let s=t==null?void 0:t.get(`url`);return(0,D.jsxs)(`div`,{className:`embed`,children:[(0,D.jsx)(b,{status:t,domain:r,pictureInPicture:n,onToggleHidden:o,withLogo:!0}),(0,D.jsx)(`a`,{className:`embed__overlay`,href:s,target:`_blank`,rel:`noopener`,"aria-label":``})]})},j=({id:e})=>((0,E.useEffect)(()=>{s&&y.dispatch(p(s))},[]),(0,D.jsx)(c,{children:(0,D.jsx)(h,{store:y,children:(0,D.jsx)(m,{children:(0,D.jsx)(A,{id:e})})})}));t();function M(){let e=document.getElementById(`mastodon-status`);if(e){let t=e.getAttribute(`data-props`);if(!t)return;let r=JSON.parse(t);(0,x.createRoot)(e).render((0,D.jsx)(j,n({},r)))}}function N(){o(M).catch(e=>{console.error(e)})}_().then(N).catch(e=>{console.error(e)});function P(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`setHeight`)}window.addEventListener(`message`,e=>{if(!e.data||!P(e.data)||!window.parent)return;let t=e.data;document.body.style.overflow=`hidden`,w(()=>{var e;window.parent.postMessage({type:`setHeight`,id:t.id,height:(e=document.getElementsByTagName(`html`)[0])==null?void 0:e.scrollHeight},`*`)})});
//# sourceMappingURL=embed-DsXYLEi9.js.map