social-embeds 0.6.0 → 0.6.1

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 CHANGED
@@ -273,7 +273,7 @@ A component checks an `embed` before using it: its `url` must be the exact URL `
273
273
  | `onError` | `(error: Error) => void` | | Called on invalid input, a script that fails to load, or a post that does not render. Components never throw. |
274
274
  | `...rest` | `ComponentProps<'div'>` | | Passed to the wrapper `div` (`className`, `style`, `data-*`, …). |
275
275
 
276
- Script-based embeds try to render three times, waiting 15 s each time, 1 s and then 2 s apart, before `onError` reports the failure. Telegram, Reddit, Bluesky and Tumblr frames that report no height within 15 s show at their starting height, and `onError` reports it. Frames report their height only once painted, so the 15 s start when the embed comes near the viewport, also with `lazy={false}`.
276
+ Script-based embeds try to render three times, waiting 15 s each time, 1 s and then 2 s apart, before `onError` reports the failure. Iframe embeds get 15 s, counted from when the embed comes near the viewport, also with `lazy={false}`. Telegram, Reddit, Bluesky and Tumblr frames that report no height by then show at their starting height; other frames that have not loaded by then show as they are, such as a frame the browser blocked. `onError` reports both, and a frame that loads or reports its height later still calls `onLoad`.
277
277
 
278
278
  ## Platforms
279
279
 
package/dist/element.js CHANGED
@@ -1 +1 @@
1
- const e=`autoplay *; encrypted-media *; fullscreen *; clipboard-write`,t=`allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation`;function n(n){let r=n.url.slice(23),i=r.includes(`/song/`)||r.includes(`?i=`);return{kind:`iframe`,src:`https://embed.music.apple.com${r}`,title:`Apple Music player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(i?175:450),maxWidth:660,borderRadius:10}}function r(n){let r=n.url.slice(26);return{kind:`iframe`,src:`https://embed.podcasts.apple.com${r}`,title:`Apple Podcasts player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(r.includes(`?i=`)?160:450),maxWidth:640,borderRadius:12}}function i(e,t){return Object.entries(e).filter(([e])=>!t.includes(e.toLowerCase()))}function a(...e){let t=/* @__PURE__ */ new Map;for(let n of e)for(let[e,r]of n??[])t.set(e,String(r));let n=[...t].map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`);return n.length>0?`?${n.join(`&`)}`:``}function o(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=e[r];typeof t==`boolean`?n.push([i,+!!t]):(typeof t==`string`||typeof t==`number`)&&n.push([i,t])}return n}const s={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0}};function c(e,t){let n=t.colorMode??e.options.colorMode;return{kind:`iframe`,src:`https://embed.bsky.app/embed/${e.id}${a(typeof n==`string`?[[`colorMode`,n]]:void 0)}`,title:`Bluesky post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:s,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const l=/^x[a-z0-9]{3,12}$/;function u(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...u}=e.options,d=n??c;if(d===void 0)return{kind:`error`,message:`social-embeds: a Dailymotion embed needs a Player ID: pass playerId to DailymotionEmbed`};if(typeof d!=`string`||!l.test(d))return{kind:`error`,message:`social-embeds: not a Dailymotion Player ID: ${String(d)}`};let f=[];return r!==void 0&&f.push([`mute`,String(r)]),o!==void 0&&f.push([`startTime`,o]),s!==void 0&&f.push([`loop`,String(s)]),{kind:`iframe`,src:`https://geo.dailymotion.com/player/${d}.html${a([[`video`,e.id]],i(u,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const d=15e3,f=/* @__PURE__ */ new Map;function p(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=f.get(e.key);return t||(t=m(e).catch(t=>{throw f.delete(e.key),t}),f.set(e.key,t)),t}async function m(e){e.isPresent()||await([...document.querySelectorAll(`script[src]`)].some(t=>e.isOwn(t.src))?v(e):g(e)),await e.whenPresent?.()}var h=class extends Error{};async function g(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await _(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof h)||t>=3)throw e;await ee(1e3*2**(t-1))}await(t?y(t,`${e.url} did not report ready`):v(e))}async function _(e){let t=e.prepare?.(),n=document.createElement(`script`),r=new Promise((t,r)=>{n.src=e.url,n.async=!0,e.crossOrigin&&(n.crossOrigin=e.crossOrigin),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new h(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await y(r,`${e.url} did not load`)}finally{t?.()}return n}function v(e){return new Promise((t,n)=>{let r=Date.now()+d,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function y(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},d);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function ee(e){return new Promise(t=>setTimeout(t,e))}const b=()=>window,te=`v26.0`,ne=/^[a-z]{2,3}_[A-Z]{2}$/;function re(e){return()=>{let t=b().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}}const ie={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof b().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=b().twttr?.ready;t?t(()=>{e()}):e()})};function ae(){let e=b().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function oe(e){let t=re(e);return()=>{let e=b().FB;return!t()&&e!==void 0&&!e.__buffer}}const se={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:re(`instagram`),prepare:ae,skipped:oe(`instagram`)},ce={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:re(`threads`),prepare:ae,skipped:oe(`threads`)};function le(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${te}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof b().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=b().fbAsyncInit;b().fbAsyncInit=()=>{t?.(),e()}})}}const ue={key:`pinterest`,url:`https://assets.pinterest.com/js/pinit_main.js`,isOwn:e=>/^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof b().PinUtils?.build==`function`};function x(e,{locale:t=`en_US`}={}){switch(e){case`x`:return p(ie);case`instagram`:return p(se);case`threads`:return p(ce);case`pinterest`:return p(ue);case`facebook`:return ne.test(t)?p(le(t)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${t}"`))}}const S=()=>window;function C(e,t,n){if(t(e))return n(),()=>{};let r=new MutationObserver(()=>{t(e)&&(r.disconnect(),n())});return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`class`,`style`,`height`]}),()=>{r.disconnect()}}function de(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function fe(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const pe={load:()=>x(`x`),render(e,t){let n=S().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=C(e,fe,t);return de(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function me(){let e=S().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const he={load:()=>x(`instagram`),render(e,t){let n=C(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return de(e,`instagram-media`),me(),n}},ge={load:()=>x(`threads`),render(e,t){let n=C(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return de(e,`text-post-media`),me(),n}},_e=/* @__PURE__ */ new Map;function ve(e){let t=_e.get(e);return t||(t={load:()=>x(`facebook`,{locale:e}),render(e,t){let n=S().FB,r=n?.XFBML?.parse;if(!n||!r)throw Error(`social-embeds: FB.XFBML.parse is missing`);let i=()=>{r(e,t)};try{i()}catch(e){if(!(e instanceof Error)||!/init not called/.test(e.message))throw e;n.init?.({xfbml:!1,version:te}),i()}return()=>{}}},_e.set(e,t)),t}const ye={load:()=>x(`pinterest`),render(e,t){let n=S().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=C(e,e=>e.querySelector(`span[data-pin-id]`)!==null,t),i=e.querySelector(`a`);return i&&!i.hasAttribute(`data-pin-do`)&&i.setAttribute(`data-pin-do`,`embedPin`),n(e),r}},be=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),xe=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Se=/<([a-zA-Z][a-zA-Z0-9-]*)/y,Ce=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,we=/\s*(\/?)>/y,w=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Te=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function Ee(e){let t={type:`element`,tag:``,attrs:/* @__PURE__ */ new Map,children:[]},n=[t],r=0;for(;r<e.length;){let i=n[n.length-1]??t,a=e.indexOf(`<`,r),o=a===-1?e.length:a;if(o>r&&i.children.push({type:`text`,raw:e.slice(r,o)}),a===-1)break;if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4);if(t===-1)return null;i.children.push({type:`comment`}),r=t+3;continue}w.lastIndex=a;let s=w.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=w.lastIndex;continue}let c=De(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:xe.get(l.tag);if(u){u.lastIndex=r;let t=u.exec(e);if(!t)return null;t.index>r&&l.children.push({type:`text`,raw:e.slice(r,t.index)}),r=u.lastIndex}else if(!c.selfClosing&&!be.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function De(e,t){Se.lastIndex=t;let n=Se.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Se.lastIndex;for(;;){we.lastIndex=i;let t=we.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:we.lastIndex};Ce.lastIndex=i;let a=Ce.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Oe(s??c??l??``)),i=Ce.lastIndex}}function Oe(e){return e.replace(/&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z]+);/g,(e,t)=>{if(!t.startsWith(`#`))return Te.get(t)??e;let n=t[1]===`x`||t[1]===`X`,r=Number.parseInt(t.slice(n?2:1),n?16:10);return r>0&&r<=1114111&&(r<55296||r>57343)?String.fromCodePoint(r):e})}function T(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function E(e){let t=[];for(let n of e)n.type===`element`&&t.push(n,...E(n.children));return t}const ke=/* @__PURE__ */ new Set([`href`,`cite`]),Ae=/^https?:\/\//i;function D(e,t){let n=``;for(let r of e){if(r.type===`text`){n+=r.raw;continue}if(r.type!==`element`)continue;let e=t.get(r.tag);if(e){n+=`<${r.tag}`;for(let t of e){let e=typeof t==`string`?t:t.name,i=r.attrs.get(e);i===void 0||typeof t!=`string`&&!t.value.test(i)||ke.has(e)&&!Ae.test(i)||(n+=` ${e}="${O(i)}"`)}n+=`>`,be.has(r.tag)||(n+=`${D(r.children,t)}</${r.tag}>`)}}return n}function O(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function je(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${O(String(r))}"`);return t}function k(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return je(n)}function A(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function j(e){return e!==void 0&&e.trim()!==``}const Me={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ne={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},Pe={post:300,video:200};function Fe(e){let t=Object.entries(e.options).filter(([e])=>e!==`href`);return{kind:`iframe`,src:`https://www.facebook.com/plugins/video.php${a([[`href`,e.url]],t)}`,title:`Facebook video player`,allow:`autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Ie(e,t){if(e.variant===`iframe`)return Fe(e);let n=A(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Ne)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Fe({...e,options:t})}let i=t.locale??(typeof n.locale==`string`?n.locale:`en_US`),a=`<div class="${e.kind===`video`?`fb-video`:`fb-post`}" data-href="${O(e.url)}"${k(Me,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:ve(i),minHeight:Pe[e.kind],label:`Facebook`,hasFallback:j(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function Le(e){return{kind:`iframe`,src:`https://giphy.com/embed/${e.id}`,title:`Giphy GIF`,allow:`fullscreen`,ratio:{width:1,height:1},size:e.size}}function Re(e,t){let n=A(e.options,{captioned:t.captioned}),r=`<blockquote${je({"data-instgrm-permalink":e.url,"data-instgrm-version":n.version,"data-instgrm-captioned":n.captioned===!0||void 0,style:`width:calc(100% - 2px)`})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:he,minHeight:680,label:`Instagram`,hasFallback:j(e.fallbackHtml),maxWidth:540}}const ze=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Be(e,t){let n=[];return t.autoplay!==void 0&&n.push([`autoplay`,t.autoplay]),t.muted!==void 0&&n.push([`muted`,t.muted]),{kind:`iframe`,src:`https://player.kick.com/${e.id}${a(Object.entries(e.options).filter(([e])=>ze.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Ve(e,t){let n=new Map(Object.entries(e.options));return t.collapsed===!0&&n.set(`collapsed`,1),t.collapsed===!1&&n.delete(`collapsed`),{kind:`iframe`,src:`https://www.linkedin.com/embed/feed/update/${e.id}${a(n)}`,title:`LinkedIn post`,allow:``,ratio:{width:504,height:670},height:e.size?.height??670,maxWidth:e.size?.width??504}}const He={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},Ue={small:236,medium:345,large:600};function We(e,t){let n=A(e.options,{width:t.pinWidth}),r=`<a href="${O(e.url)}"${k(He,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:ye,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:Ue[String(n.width)]??236}}const Ge={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},Ke={origin:`https://embed.reddit.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.type===`resize.embed`&&typeof t.data==`number`?t.data:void 0}};function qe(e,t){let n=[];for(let[e,r]of Object.entries(Ge)){let i=t[e];i!==void 0&&n.push([r,i])}return{kind:`iframe`,src:`https://embed.reddit.com${e.url.slice(22)}${a([[`embed`,!0]],Object.entries(e.options),n)}`,title:`Reddit post`,allow:`clipboard-read; clipboard-write`,sandbox:`allow-scripts allow-same-origin allow-popups`,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Ke,startHeight:e.size?.height??316,maxWidth:640}}function Je(e){let t=e.options.title;return{kind:`iframe`,src:`${e.url}/embed`,title:typeof t==`string`&&t!==``?t:`Snapchat`,allow:`autoplay; camera; microphone; clipboard-write;`,scrolling:`no`,ratio:{width:416,height:692},size:e.size,maxWidth:416}}const Ye={visual:`visual`,color:`color`,autoPlay:`auto_play`,hideRelated:`hide_related`,showComments:`show_comments`,showUser:`show_user`,showReposts:`show_reposts`,showTeaser:`show_teaser`,showArtwork:`show_artwork`};function Xe(e,t){let n=[];for(let[e,r]of Object.entries(Ye)){let i=t[e];i!==void 0&&n.push([r,i])}let r=e.size===void 0;return{kind:`iframe`,src:`https://w.soundcloud.com/player/${a([[`url`,e.url]],r?[[`visual`,!0]]:void 0,i(e.options,[`url`,`secret_token`]),n)}`,title:`SoundCloud player`,allow:`autoplay; encrypted-media`,scrolling:`no`,ratio:{width:16,height:9},height:e.size?.height??400}}const Ze=/* @__PURE__ */ new Set([`track`,`episode`]);function Qe(e,t){let n=new URL(e.url).pathname.split(`/`)[1]??``,r=e.kind===`video`,i=a(Object.entries(e.options),t.theme===void 0?void 0:[[`theme`,t.theme]]);return{kind:`iframe`,src:`https://open.spotify.com/embed/${n}/${e.id}${r?`/video`:``}${i}`,title:`Spotify Embed`,allow:`autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture`,ratio:{width:16,height:9},size:r?e.size:void 0,borderRadius:12,height:r?void 0:e.size?.height??(Ze.has(n)?152:352)}}const $e=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function et(e,t){return typeof t==`boolean`?e===`userpic`?String(t):e===`single`?t?1:void 0:+!!t:typeof t==`string`||typeof t==`number`?t:void 0}const tt={origin:`https://t.me`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.event===`resize`&&typeof t.height==`number`?t.height:void 0}};function nt(e,t){let{userpic:n,color:r,dark:i,darkColor:o}=t,s={...e.options,...n===void 0?{}:{userpic:n},...r===void 0?{}:{color:r},...i===void 0?{}:{dark:i},...o===void 0?{}:{darkColor:o}},c=[[`embed`,1]];for(let[e,t]of $e){let n=et(t,s[e]);n!==void 0&&c.push([t,n])}return{kind:`iframe`,src:`${e.url}${a(c)}`,title:`Telegram post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:tt,startHeight:300,maxWidth:500}}function rt(e,t){let n=A(e.options,{theme:t.theme}),r=`<blockquote${je({"data-text-post-permalink":e.url,"data-text-post-version":n.version??0,id:`ig-tp-${e.id}`,"data-theme":n.theme})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:ge,minHeight:240,label:`Threads`,hasFallback:j(e.fallbackHtml),maxWidth:658}}const it={controls:`controls`,progressBar:`progress_bar`,playButton:`play_button`,volumeControl:`volume_control`,fullscreenButton:`fullscreen_button`,timestamp:`timestamp`,loop:`loop`,autoplay:`autoplay`,musicInfo:`music_info`,description:`description`,rel:`rel`,nativeContextMenu:`native_context_menu`,closedCaption:`closed_caption`,forceMuted:`force_muted`};function at(e,t){let n=o(t,it);return{kind:`iframe`,src:`https://www.tiktok.com/player/v1/${e.id}${a(Object.entries(e.options),n)}`,title:`TikTok video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share`,ratio:{width:9,height:16},size:e.size,maxWidth:325}}const ot={origin:`https://embed.tumblr.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e),[n]=Array.isArray(t.args)?t.args:[];return t.method===`tumblr-post:sizeChange`&&typeof n==`number`?n:void 0}};function st(e){return{kind:`iframe`,src:`https://embed.tumblr.com/embed/post/${e.url.slice(23).split(`/`)[0]??``}/${e.id}/v2`,title:`Tumblr post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:ot,startHeight:400,maxWidth:540}}const ct=[`channel`,`video`,`collection`,`clip`,`parent`];function lt(e,t){let{hostname:n,pathname:r}=new URL(e);if(n===`clips.twitch.tv`)return[`https://clips.twitch.tv/embed`,[`clip`,t]];let i=r.split(`/`)[1];return[`https://player.twitch.tv/`,i===`videos`?[`video`,`v${t}`]:i===`collections`?[`collection`,t]:[`channel`,t]]}function ut(e,t){let{autoplay:n,muted:r,time:o}=t,s=[];n!==void 0&&s.push([`autoplay`,String(n)]),r!==void 0&&s.push([`muted`,String(r)]),o!==void 0&&s.push([`time`,o]);let[c,l]=lt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,ct),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,hostParam:`parent`}}const dt={autopause:`autopause`,autoplay:`autoplay`,background:`background`,byline:`byline`,color:`color`,controls:`controls`,dnt:`dnt`,keyboard:`keyboard`,loop:`loop`,muted:`muted`,pip:`pip`,playsinline:`playsinline`,portrait:`portrait`,quality:`quality`,speed:`speed`,title:`title`,transparent:`transparent`};function ft(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,dt),d=n??s;return{kind:`iframe`,src:`https://player.vimeo.com/video/${e.id}${a(l?[[`h`,l]]:void 0,i(c,[`h`]),u)}${d===void 0?``:`#t=${encodeURIComponent(String(d))}`}`,title:`Vimeo video player`,allow:`autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:{width:16,height:9},size:e.size}}const pt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function mt(e,t){let n=A(e.options,{...t}),r=e.fallbackHtml??`<a href="${O(e.url)}"></a>`,i=`<blockquote${k(pt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:pe,minHeight:250,label:`X`,hasFallback:j(e.fallbackHtml),maxWidth:550}}const ht={autoplay:`autoplay`,ccLangPref:`cc_lang_pref`,ccLoadPolicy:`cc_load_policy`,color:`color`,controls:`controls`,disablekb:`disablekb`,enablejsapi:`enablejsapi`,end:`end`,fs:`fs`,hl:`hl`,ivLoadPolicy:`iv_load_policy`,list:`list`,listType:`listType`,loop:`loop`,origin:`origin`,playlist:`playlist`,playsinline:`playsinline`,rel:`rel`,start:`start`,widgetReferrer:`widget_referrer`};function gt(e,t){let{nocookie:n,...r}=t,{nocookie:i,...s}=e.options,c=n??i===!0?`https://www.youtube-nocookie.com`:`https://www.youtube.com`,l=o(r,ht);return{kind:`iframe`,src:`${c}/embed/${e.id}${a(Object.entries(s),l)}`,title:`YouTube video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:e.url.includes(`/shorts/`)?{width:9,height:16}:{width:16,height:9},size:e.size}}function _t(e){switch(e.platform){case`x`:return mt(e,{});case`instagram`:return Re(e,{});case`threads`:return rt(e,{});case`facebook`:return Ie(e,{});case`tiktok`:return at(e,{});case`youtube`:return gt(e,{});case`telegram`:return nt(e,{});case`snapchat`:return Je(e);case`linkedin`:return Ve(e,{});case`reddit`:return qe(e,{});case`pinterest`:return We(e,{});case`spotify`:return Qe(e,{});case`vimeo`:return ft(e,{});case`twitch`:return ut(e,{});case`dailymotion`:return u(e,{});case`bluesky`:return c(e,{});case`soundcloud`:return Xe(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return st(e);case`kick`:return Be(e,{});case`giphy`:return Le(e);default:return e.platform}}const vt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function M(e){let t=vt.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.split(`&`)){if(e===``)continue;let t=e.indexOf(`=`),n=yt(t===-1?e:e.slice(0,t)),r=yt(t===-1?``:e.slice(t+1));if(n===null||r===null)return null;o.has(n)||o.set(n,r)}return{host:n.toLowerCase(),path:r,query:o,...a?{fragment:a}:{}}}function yt(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function N(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function P(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function F(e,t,n){let r={};for(let[i,a]of t){let t=e.attrs.get(i);t!==void 0&&!(a in r)&&(r[a]=n(t))}return r}function I(e){let t=P(e.attrs.get(`width`)),n=P(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function L(e,t){return t?{...e,size:t}:e}function bt(e,t){if(e.tag!==`div`||e.attrs.size!==1)return null;let[,n]=t.exec(e.attrs.get(`style`)??``)??[];if(n===void 0)return null;let r;for(let t of e.children)if(!(t.type===`text`&&/^\s*$/.test(t.raw))){if(t.type!==`element`||t.tag!==`iframe`||r)return null;r=t}let i=Math.round(Number(n)*100);if(!r||!(i>0&&i<=1e5))return null;let a=xt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function xt(e,t){return t===0?e:xt(t,e%t)}const St=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,Ct=/^\d{1,15}$/;function wt(e,t){if(e?.host!==t)return null;let[,n,r,i]=St.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!Ct.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!Ct.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const Tt={platform:`applemusic`,parse(e){if(e.tag!==`iframe`)return null;let t=wt(M(e.attrs.get(`src`)??``),`embed.music.apple.com`);if(!t)return null;let{height:n}=I(e)??{};return L({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1,match(e){let t=wt(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}}},Et=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,Dt=/^\d{1,15}$/;function Ot(e,t){if(e?.host!==t)return null;let[,n,r]=Et.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!Dt.test(i)?null:{platform:`applepodcasts`,kind:`post`,url:`https://podcasts.apple.com/${n}/podcast/id${r}${i?`?i=${i}`:``}`,id:i??r,variant:`iframe`}}const kt={platform:`applepodcasts`,parse(e){if(e.tag!==`iframe`)return null;let t=Ot(M(e.attrs.get(`src`)??``),`embed.podcasts.apple.com`);return t&&L({...t,options:{}},I(e))},isOwnScript:()=>!1,match(e){let t=Ot(e,`podcasts.apple.com`);return t&&{...t,options:{}}}},At=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,jt=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,Mt=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Nt=RegExp(`^/profile/${At}/post/${jt}/?$`),Pt=RegExp(`^at://${At}/app\\.bsky\\.feed\\.post/${jt}$`),Ft=/^[a-z2-7]{20,100}$/,It=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),Lt=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,Rt=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function zt(e,t){return{platform:`bluesky`,kind:`post`,url:`https://bsky.app/profile/${e}/post/${t}`,id:`${e}/app.bsky.feed.post/${t}`,variant:`iframe`}}function Bt(e){if(!e||!Mt.has(e.host))return null;let[,t,n]=Nt.exec(e.path)??[];return t===void 0||n===void 0?null:zt(t,n)}const Vt={platform:`bluesky`,fallback:Rt,parse(e){if(e.tag!==`blockquote`||!T(e,`bluesky-embed`))return null;let[,t,n]=Pt.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=zt(t,n);if(E(e.children).reverse().map(e=>e.tag===`a`?Bt(M(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&Ft.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&It.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:D(e.children,Rt)}},isOwnScript:e=>Lt.test(e),match(e){let t=Bt(e);return t&&{...t,options:{}}}},Ht=/^x[a-z0-9]{4,12}$/,Ut=/^x[a-z0-9]{3,12}$/,Wt=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,Gt=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]);function R(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function Kt(e){if(e.host!==`geo.dailymotion.com`||e.query.has(`playlist`))return null;let t=/^\/player(?:\/([a-z0-9]+))?\.html$/.exec(e.path);if(!t)return null;let[,n]=t,r=e.query.get(`video`)??``;if(!Ht.test(r)||n!==void 0&&!Ut.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,N(t)]));return n!==void 0&&(i.playerId=n),R(r,i)}function qt(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return Ht.test(t)?R(t,{}):null}if(!Gt.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&Ht.test(t)?R(t,{}):null}const Jt={platform:`dailymotion`,parse(e){let t=bt(e,Wt),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=M(n.attrs.get(`src`)??``);if(!r)return null;let i=Kt(r)??qt(r);return i&&L(i,t?.size??I(n))},isOwnScript:()=>!1,match(e){return Kt(e)??qt(e)}},Yt=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`m.facebook.com`]),Xt=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`]),z=`https://www.facebook.com`,B=`[A-Za-z0-9.\\-]{1,80}`,Zt=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Qt=RegExp(`^/(${B})/posts/(${Zt})/?$`),$t=RegExp(`^/(${B})/photos/([A-Za-z0-9.]{1,40})/(\\d{1,25})/?$`),en=RegExp(`^/(${B})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),tn=/^\/reel\/(\d{1,25})\/?$/,nn=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),rn=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),an=RegExp(`^${Zt}$`),V=/^\d{1,25}$/,on=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,sn=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],cn=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],ln={name:`class`,value:/^fb-xfbml-parse-ignore$/},un=/* @__PURE__ */ new Map([[`div`,[ln]],[`blockquote`,[`cite`,ln]],[`a`,[`href`]],[`p`,[]]]);function H(e){if(!e||!Yt.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Qt.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${z}/${r}/posts/${i}`};if(nn.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!an.test(e))return null;let r=n.get(`id`),i=r!==void 0&&V.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${z}${t}?story_fbid=${e}${i}`}}if(rn.has(t)){let e=n.get(`fbid`);return e===void 0||!V.test(e)?null:{kind:`post`,id:e,url:`${z}${t}?fbid=${e}`}}let[,a,o,s]=$t.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${z}/${a}/photos/${o}/${s}/`};let[,c,l]=en.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${z}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!V.test(e)?null:{kind:`video`,id:e,url:`${z}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=tn.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${z}/reel/${u}`}}function U(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const dn={platform:`facebook`,fallback:un,parse(e){if(e.tag===`div`){let t=T(e,`fb-post`)?`post`:T(e,`fb-video`)?`video`:null,n=H(M(e.attrs.get(`data-href`)??``));return!t||!n?null:{...U(n,t,`sdk`,F(e,sn,N)),fallbackHtml:D(e.children,un)}}if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(!t||!Xt.has(t.host))return null;let n=H(M(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=N(r)),i!==void 0&&(e.width=N(i)),U(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=N(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of cn){let i=t.query.get(n);i!==void 0&&(e[r]=N(i))}let r=P(t.query.get(`width`)),i=P(t.query.get(`height`));return L(U(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return L(U(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,N(t)]))),I(e))}return null},isOwnScript:e=>on.test(e),scriptOptions(e){let[,t]=on.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=H(e);return t&&U(t,t.kind,`sdk`,{})}},W=`([A-Za-z0-9]{6,40})`,G=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),fn=RegExp(`^/gifs/(?:[A-Za-z0-9-]{0,200}-)?${W}/?$`),pn=RegExp(`^/embed/${W}/?$`),mn=/^media\d?\.giphy\.com$/,hn=RegExp(`^/media/${W}/giphy\\.(?:gif|webp|mp4)$`),gn=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function _n(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function vn(e){if(e){if(G.has(e.host))return(fn.exec(e.path)??pn.exec(e.path))?.[1];if(mn.test(e.host))return hn.exec(e.path)?.[1]}}function yn(e){if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(!t||!G.has(t.host))return null;let[,n]=pn.exec(t.path)??[];return n===void 0?null:_n(n)}function bn(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=M(n.attrs.get(`href`)??``);if(!i||!G.has(i.host)||fn.exec(i.path)?.[1]!==t.id)return!1;let[a,...o]=n.children;return o.length===0&&a?.type===`text`&&a.raw.trim()===`via GIPHY`}const xn={platform:`giphy`,parse(e){let t=bt(e,gn),n=t?.iframe??e,r=yn(n);return r?L({...r,options:{}},t?.size??I(n)):null},isOwnScript:()=>!1,isOwnExtra:bn,match(e){let t=vn(e);return t===void 0?null:{..._n(t),options:{}}}},Sn=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Cn=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,wn=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Tn=/* @__PURE__ */ new Set([`p`,`reel`]),En=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Dn=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function K(e){if(!e||!Sn.has(e.host))return null;let[,t,n,r]=Cn.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(wn.has(t)||!Tn.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const On={platform:`instagram`,fallback:Dn,parse(e){if(e.tag!==`blockquote`||!T(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?E(e.children).reverse().map(e=>e.tag===`a`?K(M(e.attrs.get(`href`)??``)):null).find(e=>e!==null):K(M(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=N(i)),{...n,options:r,fallbackHtml:D(e.children,Dn)}},isOwnScript:e=>En.test(e),match(e){let t=K(e);return t&&{...t,options:{}}}},kn=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),An=/^\/([A-Za-z0-9_-]{1,32})\/?$/,jn=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),Mn=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Nn(e,t){if(!e||!t.has(e.host))return null;let[,n]=An.exec(e.path)??[];if(n===void 0||jn.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const Pn=/* @__PURE__ */ new Set([`player.kick.com`]),Fn={platform:`kick`,parse(e){if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``),n=Nn(t,Pn);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>Mn.has(e)).map(([e,t])=>[e,N(t)]));return L({...n,options:r},I(e))},isOwnScript:()=>!1,match(e){let t=Nn(e,kn)??Nn(e,Pn);return t&&{...t,options:{}}}},In=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,Ln=`(activity|share|ugcPost):(\\d{19})`,Rn=RegExp(`^(?:/embed)?/feed/update/urn:li:${Ln}/?$`),zn=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),Bn=RegExp(`^/embed/feed/update/urn:li:${Ln}$`);function Vn(e,t,n={}){let r=`urn:li:${e}:${t}`;return{platform:`linkedin`,kind:`post`,url:`https://www.linkedin.com/feed/update/${r}/`,id:r,variant:`iframe`,options:n}}const Hn=e=>e.replace(/%3A/gi,`:`),Un={platform:`linkedin`,parse(e){if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=Bn.exec(t.path)??[];return n===void 0||r===void 0?null:L(Vn(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,N(t)]))),I(e))},isOwnScript:()=>!1,match(e){if(!In.test(e.host))return null;let t=Hn(e.path),[,n,r]=Rn.exec(t)??zn.exec(t)??[];return n===void 0||r===void 0?null:Vn(n,r)}},Wn=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,Gn=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,Kn=/^\d{1,25}$/,qn=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,Jn=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function Yn(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function Xn(e){if(!e||!Wn.test(e.host))return null;let[,t]=Gn.exec(e.path)??[];return t===void 0?null:Yn(t)}const Zn={platform:`pinterest`,parse(e){if(e.tag===`a`){if(e.attrs.get(`data-pin-do`)!==`embedPin`||e.children.some(e=>e.type===`element`))return null;let t=Xn(M(e.attrs.get(`href`)??``));return t&&{...t,options:F(e,Jn,N)}}if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&Kn.test(n)?{...Yn(n),options:{}}:null},isOwnScript:e=>qn.test(e),match(e){let t=Xn(e);return t&&{...t,options:{}}}},Qn=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),$n=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/,er=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,tr=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function nr(e){if(!e||!Qn.has(e.host))return null;let[,t,n,r,i]=$n.exec(e.path)??[];if(t===void 0||n===void 0)return null;let a={platform:`reddit`,kind:`post`,variant:`iframe`},o=`https://www.reddit.com/r/${t}/comments/${n}/`;return i===void 0?{...a,url:o,id:n}:r===void 0?null:{...a,url:`${o}comment/${i}/`,id:i}}const rr={platform:`reddit`,parse(e){if(e.tag!==`blockquote`||!T(e,`reddit-embed-bq`))return null;let t=E(e.children).map(e=>e.tag===`a`?nr(M(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=P(e.attrs.get(`data-embed-height`));return L({...t,options:F(e,tr,N)},n===void 0?void 0:{height:n})},isOwnScript:e=>er.test(e),match(e){let t=nr(e);return t&&{...t,options:{}}}},ir=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),ar=`([A-Za-z][A-Za-z0-9._-]{1,29})`,or=RegExp(`^(?:/@${ar})?/spotlight/([A-Za-z0-9_-]{20,120})$`),sr=RegExp(`^/(?:@|add/)${ar}$`),cr=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,lr=RegExp(`^/@${ar}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),ur=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function dr(e){if(!e||!ir.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=or.exec(t)??[];if(i!==void 0){let e=r===void 0?``:`/@${r}`;return{...n,kind:`video`,url:`https://www.snapchat.com${e}/spotlight/${i}`,id:i}}let[,a]=sr.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=cr.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=lr.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const fr={platform:`snapchat`,parse(e){if(e.tag!==`blockquote`||!T(e,`snapchat-embed`))return null;let t=M(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=dr({...t,path:t.path.slice(0,-6)});if(!n||!E(e.children).filter(e=>e.tag===`a`).every(e=>{let t=dr(M(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=P(e.attrs.get(`data-snapchat-embed-width`)),a=P(e.attrs.get(`data-snapchat-embed-height`));return L({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>ur.test(e),match(e){let t=dr(e);return t&&{...t,options:{}}}},pr=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),mr=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,hr=`[a-z0-9_-]{1,64}`,gr=`s-[A-Za-z0-9]{1,32}`,_r=RegExp(`^/(${hr})(?:/(sets/${hr}|${hr})(?:/(${gr}))?)?/?$`,`i`),vr=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),yr=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),br=RegExp(`^${gr}$`);function xr(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function Sr(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=mr.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!br.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return xr(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Cr(e){if(!pr.has(e.host))return null;let[,t,n,r]=_r.exec(e.path)??[];if(t===void 0||vr.has(t.toLowerCase())||n!==void 0&&yr.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return xr(`https://soundcloud.com/${i}`,i)}const wr=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function Tr(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!wr.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&pr.has(M(e.attrs.get(`href`)??``)?.host??``)}function Er(e){if(e.tag!==`div`||e.attrs.size!==1||!e.attrs.has(`style`))return!1;let[t,n,r,...i]=e.children;return i.length===0&&Tr(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&Tr(r)}const Dr={platform:`soundcloud`,parse(e){if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=Sr(M(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!br.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,N(t)])),{height:a}=I(e)??{};return L({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:Er,match(e){let t=Sr(e)??Cr(e);return t&&{...t,options:{}}}},Or=/* @__PURE__ */ RegExp(`^(?:/intl-[a-z]{2}(?:-[A-Za-z]{2})?)?(?:/embed)?/(track|album|playlist|artist|episode|show|audiobook|chapter)/([A-Za-z0-9]{22})(/video)?/?$`),kr=/* @__PURE__ */ new Set([`utm_source`,`si`]);function Ar(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=Or.exec(e.path)??[];return t===void 0||n===void 0?null:{platform:`spotify`,kind:r?`video`:`post`,url:`https://open.spotify.com/${t}/${n}`,id:n,variant:`iframe`,query:e.query}}function jr(e){return Object.fromEntries([...e].filter(([e])=>!kr.has(e)).map(([e,t])=>[e,N(t)]))}const Mr={platform:`spotify`,parse(e){if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=Ar(t);if(!n)return null;let{query:r,...i}=n;return L({...i,options:jr(r)},I(e))},isOwnScript:()=>!1,match(e){let t=Ar(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}}},Nr=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Pr=`[A-Za-z][A-Za-z0-9_]{2,31}`,Fr=RegExp(`^(${Pr})/(\\d{1,10})$`),Ir=RegExp(`^/(?:s/)?(${Pr})/(\\d{1,10})/?$`),Lr=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Rr=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],zr=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function Br(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const Vr={platform:`telegram`,parse:()=>null,parseScript(e){if(!Lr.test(e.attrs.get(`src`)??``)||Rr.some(t=>e.attrs.has(t)))return null;let[,t,n]=Fr.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=F(e,zr,N);return e.attrs.has(`data-single`)&&(r.single=!0),Br(t,n,r)},isOwnScript:e=>Lr.test(e),match(e){if(!Nr.has(e.host))return null;let[,t,n]=Ir.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r={};e.query.has(`single`)&&(r.single=!0);let i=e.query.get(`comment`);return i!==void 0&&/^\d{1,10}$/.test(i)&&(r.comment=Number(i)),Br(t,n,r)}},Hr=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),Ur=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,Wr=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,Gr=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Kr=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function qr(e){if(!e||!Hr.has(e.host))return null;let[,t]=Ur.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const Jr={platform:`threads`,fallback:Kr,parse(e){if(e.tag!==`blockquote`||!T(e,`text-post-media`))return null;let t=qr(M(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:F(e,Gr,N),fallbackHtml:D(e.children,Kr)}},isOwnScript:e=>Wr.test(e),match(e){let t=qr(e);return t&&{...t,options:{}}}},Yr=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),Xr=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,Zr=/^\/player\/v1\/(\d{1,25})\/?$/,Qr=/^\d{1,25}$/,$r=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;function ei(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const ti={platform:`tiktok`,parse(e){if(e.tag===`blockquote`&&T(e,`tiktok-embed`)){let t=M(e.attrs.get(`cite`)??``),[,n,r]=t&&Yr.has(t.host)?Xr.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Qr.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:ei(a,n)}if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(!t||!Yr.has(t.host))return null;let[,n]=Zr.exec(t.path)??[];return n===void 0?null:L(ei(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,N(t)]))),I(e))},isOwnScript:e=>$r.test(e),match(e){if(!Yr.has(e.host))return null;let[,t,n]=Xr.exec(e.path)??[];return t===void 0||n===void 0?null:ei(n,t)}},ni=`([a-z0-9-]{1,32})`,ri=`(\\d{1,20})`,ii=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),ai=RegExp(`^/${ni}/${ri}(?:/[^/]{1,200})?/?$`),oi=RegExp(`^${ni}\\.tumblr\\.com$`),si=RegExp(`^/post/${ri}(?:/[^/]{1,200})?/?$`),ci=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${ni})/${ri}/v2$`),li=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),ui=/^(?:https?:)?\/\/assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function di(e){if(!e)return null;let t,n;return ii.has(e.host)?[,t,n]=ai.exec(e.path)??[]:([,t]=oi.exec(e.host)??[],[,n]=si.exec(e.path)??[]),t===void 0||n===void 0||li.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const fi={platform:`tumblr`,parse(e){if(e.tag!==`div`||!T(e,`tumblr-post`))return null;let t=M(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=ci.exec(t.path)??[];if(r===void 0)return null;let[i,...a]=e.children.filter(e=>e.type!==`text`||e.raw.trim()!==``);if(a.length>0||i?.type!==`element`||i.tag!==`a`)return null;let o=di(M(i.attrs.get(`href`)??``));return o?.id!==r||n!==void 0&&o.url!==`https://www.tumblr.com/${n}/${r}`?null:{...o,options:{}}},isOwnScript:e=>ui.test(e),match(e){let t=di(e);return t&&{...t,options:{}}}},pi=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),mi=/^[A-Za-z0-9_]{3,25}$/,hi=/^v?(\d{1,12})$/,gi=/^[A-Za-z0-9_-]{6,30}$/,_i=/^[A-Za-z0-9_-]{6,100}$/,vi=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,yi=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),bi=[`autoplay`,`muted`,`time`];function q(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const xi=e=>q(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),Si=e=>q(`https://www.twitch.tv/videos/${e}`,e),Ci=e=>q(`https://www.twitch.tv/collections/${e}`,e),wi=e=>q(`https://clips.twitch.tv/${e}`,e);function Ti(e){let t={};for(let n of bi){let r=e.get(n);r!==void 0&&(t[n]=N(r))}return t}function Ei(e){let t=e.query.get(`channel`);if(t!==void 0)return mi.test(t)?xi(t):null;let[,n]=hi.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return Si(n);let r=e.query.get(`collection`);return r!==void 0&&gi.test(r)?Ci(r):null}function Di(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return _i.test(t)?{found:wi(t),options:{}}:null}if(!pi.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=hi.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:Si(t),options:n!==void 0&&vi.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?gi.test(r??``)?{found:Ci(r??``),options:{}}:null:t.length===3&&r===`clip`?mi.test(n)&&_i.test(i??``)?{found:wi(i??``),options:{}}:null:t.length===1&&mi.test(n)&&!yi.has(n.toLowerCase())?{found:xi(n),options:{}}:null}const Oi={platform:`twitch`,parse(e){if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=Ei(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=_i.test(e)?wi(e):null}return n&&L({...n,options:Ti(t.query)},I(e))},isOwnScript:()=>!1,match(e){let t=Di(e);return t&&{...t.found,options:t.options}}},ki=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),J=`(\\d{1,12})`,Ai=`([0-9a-f]{6,20})`,ji=[RegExp(`^/${J}(?:/${Ai})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${J}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${J}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${J}/?$`)],Mi=RegExp(`^/video/${J}/?$`),Ni=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Pi=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Fi=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Ii=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function Li(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Ri(e){let[,t]=Ii.exec(e.fragment??``)??[];return t?{t}:{}}function zi(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=Mi.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${Ai}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Fi.has(e)).map(([e,t])=>[e,N(t)]));return{...Li(t,n),options:{...r,...Ri(e)}}}const Bi={platform:`vimeo`,parse(e){let t=bt(e,Ni),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=zi(M(n.attrs.get(`src`)??``));return r&&L(r,t?.size??I(n))},isOwnScript:e=>Pi.test(e),match(e){let t=zi(e);if(t)return t;if(!ki.has(e.host))return null;for(let t of ji){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return{...Li(n,r),options:Ri(e)}}return null}},Vi=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Hi=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Ui=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,Wi=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],Gi=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function Ki(e){if(!e||!Vi.has(e.host))return null;let[,t,n]=Hi.exec(e.path)??[];return t===void 0||n===void 0?null:{platform:`x`,kind:`post`,url:`https://x.com/${t}/status/${n}`,id:n,variant:`sdk`}}const qi={platform:`x`,fallback:Gi,parse(e){if(e.tag!==`blockquote`||!T(e,`twitter-tweet`))return null;let t=E(e.children).reverse().map(e=>e.tag===`a`?Ki(M(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:F(e,Wi,N),fallbackHtml:D(e.children,Gi)}:null},isOwnScript:e=>Ui.test(e),match(e){let t=Ki(e);return t&&{...t,options:{}}}},Ji=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),Yi=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),Xi=/^(?!videoseries)[A-Za-z0-9_-]{11}$/,Zi=/^\/embed\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,Qi=/^\/(shorts|embed|live)\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,$i=/^\/([A-Za-z0-9_-]{11})\/?$/,ea=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/;function ta(e){if(e===void 0||e===``)return;let t=ea.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function na(e){return ta(e.get(`start`))??ta(e.get(`t`))}function Y(e,t=!1){return{platform:`youtube`,kind:`video`,url:t?`https://www.youtube.com/shorts/${e}`:`https://www.youtube.com/watch?v=${e}`,id:e,variant:`iframe`}}function ra(e,t){let n=na(e.query);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const X=[qi,On,dn,Jr,ti,{platform:`youtube`,parse(e){if(e.tag!==`iframe`)return null;let t=M(e.attrs.get(`src`)??``),n=t!==null&&Yi.has(t.host);if(!t||!(n||Ji.has(t.host)))return null;let[,r]=Zi.exec(t.path)??[];if(r===void 0)return null;let i=[...t.query].filter(([e])=>e!==`t`).map(([e,t])=>[e,N(t)]),a=Object.fromEntries(i),o=na(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),L({...Y(r),options:a},I(e))},isOwnScript:()=>!1,match(e){if(e.host===`youtu.be`){let[,t]=$i.exec(e.path)??[];return t===void 0?null:{...Y(t),options:ra(e,!1)}}let t=Yi.has(e.host);if(!t&&!Ji.has(e.host))return null;if(!t&&/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&Xi.test(t)?{...Y(t),options:ra(e,!1)}:null}let[,n,r]=Qi.exec(e.path)??[];return n===void 0||r===void 0||t&&n!==`embed`?null:{...Y(r,n===`shorts`),options:ra(e,t)}}},Vr,fr,Un,rr,Zn,Mr,Bi,Oi,Jt,Dr,Tt,kt,Fn,xn,Vt,fi];function Z(e){if(typeof e!=`string`)return null;let t=M(e);if(!t)return null;for(let e of X){let n=e.match(t);if(n)return n}return null}function ia(e){if(typeof e!=`string`)return null;let t=Ee(e);if(!t)return null;let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(e.raw))continue;return null}if(e.tag===`script`)i.push(e);else if(aa(e))a=!0;else if(n){if(r)return null;r=e}else n=e}if(!n){let[e]=i;if(a||i.length!==1||!e||e.children.length!==0)return null;for(let t of X){let n=t.parseScript?.(e);if(n)return n}return null}for(let e of X){let t=e.parse(n);if(!t)continue;if(a&&!e.allowsFbRoot||r&&!e.isOwnExtra?.(r,t))return null;let o=i.map(e=>e.children.length===0?e.attrs.get(`src`):void 0);if(!o.every(t=>t!==void 0&&e.isOwnScript(t)))return null;let s=o.map(t=>t===void 0?{}:e.scriptOptions?.(t)??{});return{...t,options:Object.assign({},...s,t.options)}}return null}function aa(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}const oa=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),sa=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,ca=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function la(e){let t=typeof e==`string`?M(e):null;if(!t||!oa.has(t.host))return null;let[,n]=sa.exec(t.path)??[];return n!==void 0&&ca.test(n)?`bluesky`:null}const ua={x:[`post sdk`],instagram:[`post sdk`],threads:[`post sdk`],facebook:[`post sdk`,`video sdk`,`video iframe`],tiktok:[`video iframe`],youtube:[`video iframe`],telegram:[`post iframe`],snapchat:[`post iframe`,`video iframe`],linkedin:[`post iframe`],reddit:[`post iframe`],pinterest:[`post sdk`],spotify:[`post iframe`,`video iframe`],vimeo:[`video iframe`],twitch:[`video iframe`],dailymotion:[`video iframe`],bluesky:[`post iframe`],soundcloud:[`post iframe`],applemusic:[`post iframe`],applepodcasts:[`post iframe`],tumblr:[`post iframe`],kick:[`video iframe`],giphy:[`video iframe`]};function da(e){let t=Z(e.url);if(t?.platform!==e.platform||t.id!==e.id||t.url!==e.url||!ua[e.platform].includes(`${e.kind} ${e.variant}`))return null;if(e.fallbackHtml===void 0||fa(e,e.fallbackHtml))return e;let n={...e};return delete n.fallbackHtml,n}function fa(e,t){let n=X.find(t=>t.platform===e.platform)?.fallback,r=Ee(t);if(!n||!r||D(r,n)!==t)return!1;if(e.platform!==`x`)return!0;let[i]=Ee(`<blockquote class="twitter-tweet">${t}</blockquote>`)??[];return i?.type===`element`&&qi.parse(i)?.id===e.id}const Q={x:`X`,instagram:`Instagram`,facebook:`Facebook`,threads:`Threads`,tiktok:`TikTok`,youtube:`YouTube`,telegram:`Telegram`,snapchat:`Snapchat`,linkedin:`LinkedIn`,reddit:`Reddit`,pinterest:`Pinterest`,spotify:`Spotify`,vimeo:`Vimeo`,twitch:`Twitch`,dailymotion:`Dailymotion`,bluesky:`Bluesky`,soundcloud:`SoundCloud`,applemusic:`Apple Music`,applepodcasts:`Apple Podcasts`,tumblr:`Tumblr`,kick:`Kick`,giphy:`Giphy`};function pa(e){return`social-embeds: a ${Q[e]} URL needs a lookup: use the embed code`}function ma(e,t,n){let r=t??(e===void 0?null:Z(e));if(!r&&e!==void 0&&la(e)===n)return{error:pa(n)};if(!r)return{error:`social-embeds: not a ${Q[n]} post URL: ${String(e)}`};if(r.platform!==n)return{error:`social-embeds: expected a ${Q[n]} embed, got ${Q[r.platform]}`};let i=da(r);return i?{embed:i}:{error:`social-embeds: the ${Q[n]} embed's url and id do not match`}}function ha(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=la(e.url);return t?pa(t):`social-embeds: not a supported post URL: ${e.url}`}function ga(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function _a(e){return e===null?void 0:ga(e.trim().replace(/px$/i,``))}function va(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function ya(e,t){let n=t??va(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:ga(i)??(i?.trim()?i:void 0),maxWidth:_a(e.getAttribute(`max-width`)),height:_a(e.getAttribute(`height`)),maxHeight:_a(e.getAttribute(`max-height`))},eager:e.hasAttribute(`eager`)}}function ba(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,s=e.size?.width??e.ratio.width,c=e.size?.height??e.ratio.height,l=i===void 0||a!==void 0?void 0:Math.floor(i*s/c);return{position:`relative`,width:r,maxWidth:l===void 0||o!==void 0&&o<l?o:l,...e.messageHeight?{height:n??e.startHeight}:a===void 0?{aspectRatio:`${String(s)} / ${String(c)}`}:{height:a,maxHeight:i},...e.borderRadius===void 0?{}:{borderRadius:e.borderRadius,overflow:`hidden`}}}const xa=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function $(e,t){for(let[n,r]of Object.entries(t)){if(r===void 0)continue;let t=typeof r==`number`&&xa.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Sa(e){let t=document.createElement(`div`);return t.setAttribute(`aria-hidden`,`true`),$(t,{width:`100%`,height:`100%`,minHeight:e,background:`rgba(128, 128, 128, 0.12)`}),t}function Ca(e,t,n){if(t||typeof IntersectionObserver>`u`)return n(),()=>{};let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(r.disconnect(),n())},{rootMargin:`200px 0px`});return r.observe(e),()=>{r.disconnect()}}function wa(e,t){return`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(window.location.hostname)}`}function Ta(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Ea(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o,...s}=n,{messageHeight:c}=t,l=document.createElement(`div`);$(l,ba(t,s));let u=Ta(document.createElement(`div`)),d=Ta(document.createElement(`div`)),f=i.length>0?i:[t.fallbackHtml===void 0?Sa():Da(t.fallbackHtml)];d.append(...f),u.append(d),l.append(u),e.append(l);let p,m=!1,h=!1,g,_=[],v=()=>{d.remove(),h||(h=!0,a())},y=e=>{if(!c||e.origin!==c.origin||!p||e.source!==p.contentWindow)return;let t;try{t=c.read(e.data)}catch{return}typeof t==`number`&&t>0&&t<=5e4&&(m=!0,$(l,{height:Math.ceil(t)}),v())},ee=()=>{g=setTimeout(()=>{m||(d.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} did not report its height`)))},15e3)},b=()=>{let e=document.createElement(`iframe`);e.src=t.hostParam?wa(t.src,t.hostParam):t.src,e.title=t.title,e.setAttribute(`allow`,t.allow),e.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),t.scrolling&&e.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&e.setAttribute(`sandbox`,t.sandbox),$(e,{display:`block`,width:`100%`,height:`100%`,border:0}),e.addEventListener(`load`,()=>{c||v()}),p=e,u.insertBefore(e,d),c&&window.addEventListener(`message`,y)};return r?(b(),c&&_.push(Ca(u,!1,ee))):_.push(Ca(u,!1,()=>{b(),c&&ee()})),()=>{for(let e of _)e();clearTimeout(g),window.removeEventListener(`message`,y),l.remove()}}function Da(e){let t=document.createElement(`blockquote`);return t.innerHTML=e,t}function Oa(e){return e instanceof Error?e:Error(String(e))}function ka(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`);$(l,{width:n.width??`100%`,maxWidth:n.maxWidth??t.maxWidth});let u=document.createElement(`div`);u.innerHTML=t.markup,l.append(u);let d=o.length>0?o:[Sa(t.minHeight)];t.hasFallback||l.append(...d),e.append(l);let f=!1,p=!1,m,h=()=>{},g=()=>{if(!(f||p)){p=!0,clearTimeout(m),h();for(let e of d)e.parentNode?.removeChild(e);s()}},_=(e,t)=>{f||p||(h(),h=()=>{},e>=3?c(t):m=setTimeout(()=>{v(e+1)},1e3*2**(e-1)))},v=e=>{if(!(f||p)){try{h=r.render(u,g)}catch(t){_(e,Oa(t));return}m=setTimeout(()=>{_(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},y=Ca(u,a,()=>{r.load().then(()=>{v(1)},e=>{f||c(Oa(e))})});return()=>{f=!0,y(),clearTimeout(m),h(),l.remove()}}const Aa=typeof HTMLElement>`u`?class{}:HTMLElement;function ja(e){let t=[];for(let n of[...e.childNodes])n instanceof HTMLTemplateElement||(e.removeChild(n),(n.nodeType===Node.ELEMENT_NODE||n.nodeType===Node.TEXT_NODE&&n.textContent?.trim())&&t.push(n));return t}const Ma=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var Na=class extends Aa{static observedAttributes=[`url`,`width`,`max-width`,`height`,`max-height`,`eager`];#e=null;#t;#n;#r;#i=()=>{};#a=0;#o=!1;constructor(){super();for(let e of Ma){if(!Object.hasOwn(this,e))continue;let t=this[e];Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}}get html(){return this.#e}set html(e){this.#e=typeof e==`string`?e:null,this.#l()}get url(){return this.getAttribute(`url`)}set url(e){this.#c(`url`,e)}get width(){return this.getAttribute(`width`)}set width(e){this.#c(`width`,e)}get maxWidth(){return this.getAttribute(`max-width`)}set maxWidth(e){this.#c(`max-width`,e)}get height(){return this.getAttribute(`height`)}set height(e){this.#c(`height`,e)}get maxHeight(){return this.getAttribute(`max-height`)}set maxHeight(e){this.#c(`max-height`,e)}get eager(){return this.hasAttribute(`eager`)}set eager(e){this.toggleAttribute(`eager`,!!e)}connectedCallback(){this.#t===void 0&&document.readyState===`loading`?this.#o||(this.#o=!0,document.addEventListener(`DOMContentLoaded`,()=>{this.#o=!1,this.isConnected&&this.connectedCallback()},{once:!0})):(this.#t??=ja(this),this.#n??=new MutationObserver(()=>{this.#s(),this.#l()}),this.#s(),this.#l())}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#n?.disconnect(),this.#u(),this.#r=void 0)})}attributeChangedCallback(){this.#l()}#s(){let e=this.#n;if(e){e.disconnect(),e.observe(this,{childList:!0});for(let t of this.children)t instanceof HTMLTemplateElement&&e.observe(t.content,{childList:!0,subtree:!0,characterData:!0})}}#c(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}#l(){if(!this.isConnected||this.#t===void 0)return;let e=ya(this,this.#e),t=JSON.stringify(e);t!==this.#r&&(this.#u(),this.#r=t,this.#d(e,this.#t))}#u(){this.#a+=1;let e=this.#i;this.#i=()=>{},e()}#d(e,t){let{source:n,layout:r,eager:i}=e;if(!n)return;let a=this.#a,o=e=>{queueMicrotask(()=>{a===this.#a&&this.isConnected&&this.dispatchEvent(e)})},s=e=>{o(new ErrorEvent(`error`,{error:e,message:e.message}))},c=`html`in n?ia(n.html):Z(n.url);if(!c){s(Error(ha(n)));return}let l=ma(void 0,c,c.platform);if(l.error!==void 0){s(Error(l.error));return}let u=_t(l.embed);if(u.kind===`error`){s(Error(u.message));return}let d={...r,eager:i,placeholder:t.map(e=>e.cloneNode(!0)),onLoad:()=>{o(new Event(`load`))},onError:s};this.#i=u.kind===`iframe`?Ea(this,u,d):ka(this,u,d)}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,Na);export{Na as SocialEmbedElement};
1
+ const e=`autoplay *; encrypted-media *; fullscreen *; clipboard-write`,t=`allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation`;function n(n){let r=n.url.slice(23),i=r.includes(`/song/`)||r.includes(`?i=`);return{kind:`iframe`,src:`https://embed.music.apple.com${r}`,title:`Apple Music player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(i?175:450),maxWidth:660,borderRadius:10}}function r(n){let r=n.url.slice(26);return{kind:`iframe`,src:`https://embed.podcasts.apple.com${r}`,title:`Apple Podcasts player`,allow:e,sandbox:t,ratio:{width:16,height:9},height:n.size?.height??(r.includes(`?i=`)?160:450),maxWidth:640,borderRadius:12}}function i(e,t){return Object.entries(e).filter(([e])=>!t.includes(e.toLowerCase()))}function a(...e){let t=/* @__PURE__ */ new Map;for(let n of e)for(let[e,r]of n??[])t.set(e,String(r));let n=[...t].map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`);return n.length>0?`?${n.join(`&`)}`:``}function o(e,t){let n=[];for(let[r,i]of Object.entries(t)){let t=e[r];typeof t==`boolean`?n.push([i,+!!t]):(typeof t==`string`||typeof t==`number`)&&n.push([i,t])}return n}const s={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0}};function c(e,t){let n=t.colorMode??e.options.colorMode;return{kind:`iframe`,src:`https://embed.bsky.app/embed/${e.id}${a(typeof n==`string`?[[`colorMode`,n]]:void 0)}`,title:`Bluesky post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:s,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const l=/^x[a-z0-9]{3,12}$/;function u(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...u}=e.options,d=n??c;if(d===void 0)return{kind:`error`,message:`social-embeds: a Dailymotion embed needs a Player ID: pass playerId to DailymotionEmbed`};if(typeof d!=`string`||!l.test(d))return{kind:`error`,message:`social-embeds: not a Dailymotion Player ID: ${String(d)}`};let f=[];return r!==void 0&&f.push([`mute`,String(r)]),o!==void 0&&f.push([`startTime`,o]),s!==void 0&&f.push([`loop`,String(s)]),{kind:`iframe`,src:`https://geo.dailymotion.com/player/${d}.html${a([[`video`,e.id]],i(u,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const d=15e3,f=/* @__PURE__ */ new Map;function p(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=f.get(e.key);return t||(t=m(e).catch(t=>{throw f.delete(e.key),t}),f.set(e.key,t)),t}async function m(e){e.isPresent()||await([...document.querySelectorAll(`script[src]`)].some(t=>e.isOwn(t.src))?v(e):g(e)),await e.whenPresent?.()}var h=class extends Error{};async function g(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await _(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof h)||t>=3)throw e;await b(1e3*2**(t-1))}await(t?y(t,`${e.url} did not report ready`):v(e))}async function _(e){let t=e.prepare?.(),n=document.createElement(`script`),r=new Promise((t,r)=>{n.src=e.url,n.async=!0,e.crossOrigin&&(n.crossOrigin=e.crossOrigin),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new h(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await y(r,`${e.url} did not load`)}finally{t?.()}return n}function v(e){return new Promise((t,n)=>{let r=Date.now()+d,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function y(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},d);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function b(e){return new Promise(t=>setTimeout(t,e))}const x=()=>window,ee=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function ne(e){return()=>{let t=x().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}}const re={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof x().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=x().twttr?.ready;t?t(()=>{e()}):e()})};function ie(){let e=x().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ae(e){let t=ne(e);return()=>{let e=x().FB;return!t()&&e!==void 0&&!e.__buffer}}const oe={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:ne(`instagram`),prepare:ie,skipped:ae(`instagram`)},se={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:ne(`threads`),prepare:ie,skipped:ae(`threads`)};function ce(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${ee}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof x().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=x().fbAsyncInit;x().fbAsyncInit=()=>{t?.(),e()}})}}const le={key:`pinterest`,url:`https://assets.pinterest.com/js/pinit_main.js`,isOwn:e=>/^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof x().PinUtils?.build==`function`};function S(e,{locale:t=`en_US`}={}){switch(e){case`x`:return p(re);case`instagram`:return p(oe);case`threads`:return p(se);case`pinterest`:return p(le);case`facebook`:return te.test(t)?p(ce(t)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${t}"`))}}const C=()=>window;function w(e,t,n){if(t(e))return n(),()=>{};let r=new MutationObserver(()=>{t(e)&&(r.disconnect(),n())});return r.observe(e,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`class`,`style`,`height`]}),()=>{r.disconnect()}}function T(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function ue(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const de={load:()=>S(`x`),render(e,t){let n=C().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=w(e,ue,t);return T(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function fe(){let e=C().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const pe={load:()=>S(`instagram`),render(e,t){let n=w(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return T(e,`instagram-media`),fe(),n}},me={load:()=>S(`threads`),render(e,t){let n=w(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return T(e,`text-post-media`),fe(),n}},he=/* @__PURE__ */ new Map;function ge(e){let t=he.get(e);return t||(t={load:()=>S(`facebook`,{locale:e}),render(e,t){let n=C().FB,r=n?.XFBML?.parse;if(!n||!r)throw Error(`social-embeds: FB.XFBML.parse is missing`);let i=()=>{r(e,t)};try{i()}catch(e){if(!(e instanceof Error)||!/init not called/.test(e.message))throw e;n.init?.({xfbml:!1,version:ee}),i()}return()=>{}}},he.set(e,t)),t}const _e={load:()=>S(`pinterest`),render(e,t){let n=C().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=w(e,e=>e.querySelector(`span[data-pin-id]`)!==null,t),i=e.querySelector(`a`);return i&&!i.hasAttribute(`data-pin-do`)&&i.setAttribute(`data-pin-do`,`embedPin`),n(e),r}},ve=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),ye=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),E=/<([a-zA-Z][a-zA-Z0-9-]*)/y,be=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,D=/\s*(\/?)>/y,O=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,xe=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function Se(e){let t={type:`element`,tag:``,attrs:/* @__PURE__ */ new Map,children:[]},n=[t],r=0;for(;r<e.length;){let i=n[n.length-1]??t,a=e.indexOf(`<`,r),o=a===-1?e.length:a;if(o>r&&i.children.push({type:`text`,raw:e.slice(r,o)}),a===-1)break;if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4);if(t===-1)return null;i.children.push({type:`comment`}),r=t+3;continue}O.lastIndex=a;let s=O.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=O.lastIndex;continue}let c=Ce(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:ye.get(l.tag);if(u){u.lastIndex=r;let t=u.exec(e);if(!t)return null;t.index>r&&l.children.push({type:`text`,raw:e.slice(r,t.index)}),r=u.lastIndex}else if(!c.selfClosing&&!ve.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function Ce(e,t){E.lastIndex=t;let n=E.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=E.lastIndex;for(;;){D.lastIndex=i;let t=D.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:D.lastIndex};be.lastIndex=i;let a=be.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,we(s??c??l??``)),i=be.lastIndex}}function we(e){return e.replace(/&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z]+);/g,(e,t)=>{if(!t.startsWith(`#`))return xe.get(t)??e;let n=t[1]===`x`||t[1]===`X`,r=Number.parseInt(t.slice(n?2:1),n?16:10);return r>0&&r<=1114111&&(r<55296||r>57343)?String.fromCodePoint(r):e})}function k(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function A(e){let t=[];for(let n of e)n.type===`element`&&t.push(n,...A(n.children));return t}const Te=/* @__PURE__ */ new Set([`href`,`cite`]),Ee=/^https?:\/\//i;function j(e,t){let n=``;for(let r of e){if(r.type===`text`){n+=r.raw;continue}if(r.type!==`element`)continue;let e=t.get(r.tag);if(e){n+=`<${r.tag}`;for(let t of e){let e=typeof t==`string`?t:t.name,i=r.attrs.get(e);i===void 0||typeof t!=`string`&&!t.value.test(i)||Te.has(e)&&!Ee.test(i)||(n+=` ${e}="${M(i)}"`)}n+=`>`,ve.has(r.tag)||(n+=`${j(r.children,t)}</${r.tag}>`)}}return n}function M(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function De(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${M(String(r))}"`);return t}function Oe(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return De(n)}function N(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function P(e){return e!==void 0&&e.trim()!==``}const ke={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ae={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},je={post:300,video:200};function Me(e){let t=Object.entries(e.options).filter(([e])=>e!==`href`);return{kind:`iframe`,src:`https://www.facebook.com/plugins/video.php${a([[`href`,e.url]],t)}`,title:`Facebook video player`,allow:`autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Ne(e,t){if(e.variant===`iframe`)return Me(e);let n=N(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Ae)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Me({...e,options:t})}let i=t.locale??(typeof n.locale==`string`?n.locale:`en_US`),a=`<div class="${e.kind===`video`?`fb-video`:`fb-post`}" data-href="${M(e.url)}"${Oe(ke,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:ge(i),minHeight:je[e.kind],label:`Facebook`,hasFallback:P(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function Pe(e){return{kind:`iframe`,src:`https://giphy.com/embed/${e.id}`,title:`Giphy GIF`,allow:`fullscreen`,ratio:{width:1,height:1},size:e.size}}function Fe(e,t){let n=N(e.options,{captioned:t.captioned}),r=`<blockquote${De({"data-instgrm-permalink":e.url,"data-instgrm-version":n.version,"data-instgrm-captioned":n.captioned===!0||void 0,style:`width:calc(100% - 2px)`})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:pe,minHeight:680,label:`Instagram`,hasFallback:P(e.fallbackHtml),maxWidth:540}}const Ie=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Le(e,t){let n=[];return t.autoplay!==void 0&&n.push([`autoplay`,t.autoplay]),t.muted!==void 0&&n.push([`muted`,t.muted]),{kind:`iframe`,src:`https://player.kick.com/${e.id}${a(Object.entries(e.options).filter(([e])=>Ie.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Re(e,t){let n=new Map(Object.entries(e.options));return t.collapsed===!0&&n.set(`collapsed`,1),t.collapsed===!1&&n.delete(`collapsed`),{kind:`iframe`,src:`https://www.linkedin.com/embed/feed/update/${e.id}${a(n)}`,title:`LinkedIn post`,allow:``,ratio:{width:504,height:670},height:e.size?.height??670,maxWidth:e.size?.width??504}}const ze={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},Be={small:236,medium:345,large:600};function Ve(e,t){let n=N(e.options,{width:t.pinWidth}),r=`<a href="${M(e.url)}"${Oe(ze,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:_e,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:Be[String(n.width)]??236}}const He={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},Ue={origin:`https://embed.reddit.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.type===`resize.embed`&&typeof t.data==`number`?t.data:void 0}};function We(e,t){let n=[];for(let[e,r]of Object.entries(He)){let i=t[e];i!==void 0&&n.push([r,i])}return{kind:`iframe`,src:`https://embed.reddit.com${e.url.slice(22)}${a([[`embed`,!0]],Object.entries(e.options),n)}`,title:`Reddit post`,allow:`clipboard-read; clipboard-write`,sandbox:`allow-scripts allow-same-origin allow-popups`,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Ue,startHeight:e.size?.height??316,maxWidth:640}}function Ge(e){let t=e.options.title;return{kind:`iframe`,src:`${e.url}/embed`,title:typeof t==`string`&&t!==``?t:`Snapchat`,allow:`autoplay; camera; microphone; clipboard-write;`,scrolling:`no`,ratio:{width:416,height:692},size:e.size,maxWidth:416}}const Ke={visual:`visual`,color:`color`,autoPlay:`auto_play`,hideRelated:`hide_related`,showComments:`show_comments`,showUser:`show_user`,showReposts:`show_reposts`,showTeaser:`show_teaser`,showArtwork:`show_artwork`};function qe(e,t){let n=[];for(let[e,r]of Object.entries(Ke)){let i=t[e];i!==void 0&&n.push([r,i])}let r=e.size===void 0;return{kind:`iframe`,src:`https://w.soundcloud.com/player/${a([[`url`,e.url]],r?[[`visual`,!0]]:void 0,i(e.options,[`url`,`secret_token`]),n)}`,title:`SoundCloud player`,allow:`autoplay; encrypted-media`,scrolling:`no`,ratio:{width:16,height:9},height:e.size?.height??400}}const Je=/* @__PURE__ */ new Set([`track`,`episode`]);function Ye(e,t){let n=new URL(e.url).pathname.split(`/`)[1]??``,r=e.kind===`video`,i=a(Object.entries(e.options),t.theme===void 0?void 0:[[`theme`,t.theme]]);return{kind:`iframe`,src:`https://open.spotify.com/embed/${n}/${e.id}${r?`/video`:``}${i}`,title:`Spotify Embed`,allow:`autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture`,ratio:{width:16,height:9},size:r?e.size:void 0,borderRadius:12,height:r?void 0:e.size?.height??(Je.has(n)?152:352)}}const Xe=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function Ze(e,t){return typeof t==`boolean`?e===`userpic`?String(t):e===`single`?t?1:void 0:+!!t:typeof t==`string`||typeof t==`number`?t:void 0}const Qe={origin:`https://t.me`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.event===`resize`&&typeof t.height==`number`?t.height:void 0}};function $e(e,t){let{userpic:n,color:r,dark:i,darkColor:o}=t,s={...e.options,...n===void 0?{}:{userpic:n},...r===void 0?{}:{color:r},...i===void 0?{}:{dark:i},...o===void 0?{}:{darkColor:o}},c=[[`embed`,1]];for(let[e,t]of Xe){let n=Ze(t,s[e]);n!==void 0&&c.push([t,n])}return{kind:`iframe`,src:`${e.url}${a(c)}`,title:`Telegram post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Qe,startHeight:300,maxWidth:500}}function et(e,t){let n=N(e.options,{theme:t.theme}),r=`<blockquote${De({"data-text-post-permalink":e.url,"data-text-post-version":n.version??0,id:`ig-tp-${e.id}`,"data-theme":n.theme})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:me,minHeight:240,label:`Threads`,hasFallback:P(e.fallbackHtml),maxWidth:658}}const tt={controls:`controls`,progressBar:`progress_bar`,playButton:`play_button`,volumeControl:`volume_control`,fullscreenButton:`fullscreen_button`,timestamp:`timestamp`,loop:`loop`,autoplay:`autoplay`,musicInfo:`music_info`,description:`description`,rel:`rel`,nativeContextMenu:`native_context_menu`,closedCaption:`closed_caption`,forceMuted:`force_muted`};function nt(e,t){let n=o(t,tt);return{kind:`iframe`,src:`https://www.tiktok.com/player/v1/${e.id}${a(Object.entries(e.options),n)}`,title:`TikTok video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture; web-share`,ratio:{width:9,height:16},size:e.size,maxWidth:325}}const rt={origin:`https://embed.tumblr.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e),[n]=Array.isArray(t.args)?t.args:[];return t.method===`tumblr-post:sizeChange`&&typeof n==`number`?n:void 0}};function it(e){return{kind:`iframe`,src:`https://embed.tumblr.com/embed/post/${e.url.slice(23).split(`/`)[0]??``}/${e.id}/v2`,title:`Tumblr post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:rt,startHeight:400,maxWidth:540}}const at=[`channel`,`video`,`collection`,`clip`,`parent`];function ot(e,t){let{hostname:n,pathname:r}=new URL(e);if(n===`clips.twitch.tv`)return[`https://clips.twitch.tv/embed`,[`clip`,t]];let i=r.split(`/`)[1];return[`https://player.twitch.tv/`,i===`videos`?[`video`,`v${t}`]:i===`collections`?[`collection`,t]:[`channel`,t]]}function st(e,t){let{autoplay:n,muted:r,time:o}=t,s=[];n!==void 0&&s.push([`autoplay`,String(n)]),r!==void 0&&s.push([`muted`,String(r)]),o!==void 0&&s.push([`time`,o]);let[c,l]=ot(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,at),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,hostParam:`parent`}}const ct={autopause:`autopause`,autoplay:`autoplay`,background:`background`,byline:`byline`,color:`color`,controls:`controls`,dnt:`dnt`,keyboard:`keyboard`,loop:`loop`,muted:`muted`,pip:`pip`,playsinline:`playsinline`,portrait:`portrait`,quality:`quality`,speed:`speed`,title:`title`,transparent:`transparent`};function lt(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,ct),d=n??s;return{kind:`iframe`,src:`https://player.vimeo.com/video/${e.id}${a(l?[[`h`,l]]:void 0,i(c,[`h`]),u)}${d===void 0?``:`#t=${encodeURIComponent(String(d))}`}`,title:`Vimeo video player`,allow:`autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:{width:16,height:9},size:e.size}}const ut={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function dt(e,t){let n=N(e.options,{...t}),r=e.fallbackHtml??`<a href="${M(e.url)}"></a>`,i=`<blockquote${Oe(ut,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:de,minHeight:250,label:`X`,hasFallback:P(e.fallbackHtml),maxWidth:550}}const ft={autoplay:`autoplay`,ccLangPref:`cc_lang_pref`,ccLoadPolicy:`cc_load_policy`,color:`color`,controls:`controls`,disablekb:`disablekb`,enablejsapi:`enablejsapi`,end:`end`,fs:`fs`,hl:`hl`,ivLoadPolicy:`iv_load_policy`,list:`list`,listType:`listType`,loop:`loop`,origin:`origin`,playlist:`playlist`,playsinline:`playsinline`,rel:`rel`,start:`start`,widgetReferrer:`widget_referrer`};function pt(e,t){let{nocookie:n,...r}=t,{nocookie:i,...s}=e.options,c=n??i===!0?`https://www.youtube-nocookie.com`:`https://www.youtube.com`,l=o(r,ft);return{kind:`iframe`,src:`${c}/embed/${e.id}${a(Object.entries(s),l)}`,title:`YouTube video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:e.url.includes(`/shorts/`)?{width:9,height:16}:{width:16,height:9},size:e.size}}function mt(e){switch(e.platform){case`x`:return dt(e,{});case`instagram`:return Fe(e,{});case`threads`:return et(e,{});case`facebook`:return Ne(e,{});case`tiktok`:return nt(e,{});case`youtube`:return pt(e,{});case`telegram`:return $e(e,{});case`snapchat`:return Ge(e);case`linkedin`:return Re(e,{});case`reddit`:return We(e,{});case`pinterest`:return Ve(e,{});case`spotify`:return Ye(e,{});case`vimeo`:return lt(e,{});case`twitch`:return st(e,{});case`dailymotion`:return u(e,{});case`bluesky`:return c(e,{});case`soundcloud`:return qe(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return it(e);case`kick`:return Le(e,{});case`giphy`:return Pe(e);default:return e.platform}}const ht=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function F(e){let t=ht.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.split(`&`)){if(e===``)continue;let t=e.indexOf(`=`),n=gt(t===-1?e:e.slice(0,t)),r=gt(t===-1?``:e.slice(t+1));if(n===null||r===null)return null;o.has(n)||o.set(n,r)}return{host:n.toLowerCase(),path:r,query:o,...a?{fragment:a}:{}}}function gt(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function I(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function L(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function R(e,t,n){let r={};for(let[i,a]of t){let t=e.attrs.get(i);t!==void 0&&!(a in r)&&(r[a]=n(t))}return r}function z(e){let t=L(e.attrs.get(`width`)),n=L(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function B(e,t){return t?{...e,size:t}:e}function _t(e,t){if(e.tag!==`div`||e.attrs.size!==1)return null;let[,n]=t.exec(e.attrs.get(`style`)??``)??[];if(n===void 0)return null;let r;for(let t of e.children)if(!(t.type===`text`&&/^\s*$/.test(t.raw))){if(t.type!==`element`||t.tag!==`iframe`||r)return null;r=t}let i=Math.round(Number(n)*100);if(!r||!(i>0&&i<=1e5))return null;let a=vt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function vt(e,t){return t===0?e:vt(t,e%t)}const yt=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,bt=/^\d{1,15}$/;function xt(e,t){if(e?.host!==t)return null;let[,n,r,i]=yt.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!bt.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!bt.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const St={platform:`applemusic`,parse(e){if(e.tag!==`iframe`)return null;let t=xt(F(e.attrs.get(`src`)??``),`embed.music.apple.com`);if(!t)return null;let{height:n}=z(e)??{};return B({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1,match(e){let t=xt(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}}},Ct=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,wt=/^\d{1,15}$/;function Tt(e,t){if(e?.host!==t)return null;let[,n,r]=Ct.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!wt.test(i)?null:{platform:`applepodcasts`,kind:`post`,url:`https://podcasts.apple.com/${n}/podcast/id${r}${i?`?i=${i}`:``}`,id:i??r,variant:`iframe`}}const Et={platform:`applepodcasts`,parse(e){if(e.tag!==`iframe`)return null;let t=Tt(F(e.attrs.get(`src`)??``),`embed.podcasts.apple.com`);return t&&B({...t,options:{}},z(e))},isOwnScript:()=>!1,match(e){let t=Tt(e,`podcasts.apple.com`);return t&&{...t,options:{}}}},Dt=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,Ot=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,kt=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),At=RegExp(`^/profile/${Dt}/post/${Ot}/?$`),jt=RegExp(`^at://${Dt}/app\\.bsky\\.feed\\.post/${Ot}$`),Mt=/^[a-z2-7]{20,100}$/,Nt=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),Pt=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,Ft=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function It(e,t){return{platform:`bluesky`,kind:`post`,url:`https://bsky.app/profile/${e}/post/${t}`,id:`${e}/app.bsky.feed.post/${t}`,variant:`iframe`}}function Lt(e){if(!e||!kt.has(e.host))return null;let[,t,n]=At.exec(e.path)??[];return t===void 0||n===void 0?null:It(t,n)}const Rt={platform:`bluesky`,fallback:Ft,parse(e){if(e.tag!==`blockquote`||!k(e,`bluesky-embed`))return null;let[,t,n]=jt.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=It(t,n);if(A(e.children).reverse().map(e=>e.tag===`a`?Lt(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&Mt.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&Nt.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:j(e.children,Ft)}},isOwnScript:e=>Pt.test(e),match(e){let t=Lt(e);return t&&{...t,options:{}}}},zt=/^x[a-z0-9]{4,12}$/,Bt=/^x[a-z0-9]{3,12}$/,Vt=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,Ht=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]);function Ut(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function Wt(e){if(e.host!==`geo.dailymotion.com`||e.query.has(`playlist`))return null;let t=/^\/player(?:\/([a-z0-9]+))?\.html$/.exec(e.path);if(!t)return null;let[,n]=t,r=e.query.get(`video`)??``;if(!zt.test(r)||n!==void 0&&!Bt.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,I(t)]));return n!==void 0&&(i.playerId=n),Ut(r,i)}function Gt(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return zt.test(t)?Ut(t,{}):null}if(!Ht.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&zt.test(t)?Ut(t,{}):null}const Kt={platform:`dailymotion`,parse(e){let t=_t(e,Vt),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=F(n.attrs.get(`src`)??``);if(!r)return null;let i=Wt(r)??Gt(r);return i&&B(i,t?.size??z(n))},isOwnScript:()=>!1,match(e){return Wt(e)??Gt(e)}},qt=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`m.facebook.com`]),Jt=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`]),V=`https://www.facebook.com`,H=`[A-Za-z0-9.\\-]{1,80}`,Yt=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Xt=RegExp(`^/(${H})/posts/(${Yt})/?$`),Zt=RegExp(`^/(${H})/photos/([A-Za-z0-9.]{1,40})/(\\d{1,25})/?$`),Qt=RegExp(`^/(${H})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),$t=/^\/reel\/(\d{1,25})\/?$/,en=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),tn=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),nn=RegExp(`^${Yt}$`),U=/^\d{1,25}$/,rn=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,an=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],on=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],sn={name:`class`,value:/^fb-xfbml-parse-ignore$/},cn=/* @__PURE__ */ new Map([[`div`,[sn]],[`blockquote`,[`cite`,sn]],[`a`,[`href`]],[`p`,[]]]);function W(e){if(!e||!qt.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Xt.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${V}/${r}/posts/${i}`};if(en.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!nn.test(e))return null;let r=n.get(`id`),i=r!==void 0&&U.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${V}${t}?story_fbid=${e}${i}`}}if(tn.has(t)){let e=n.get(`fbid`);return e===void 0||!U.test(e)?null:{kind:`post`,id:e,url:`${V}${t}?fbid=${e}`}}let[,a,o,s]=Zt.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${V}/${a}/photos/${o}/${s}/`};let[,c,l]=Qt.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${V}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!U.test(e)?null:{kind:`video`,id:e,url:`${V}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=$t.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${V}/reel/${u}`}}function G(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const ln={platform:`facebook`,fallback:cn,parse(e){if(e.tag===`div`){let t=k(e,`fb-post`)?`post`:k(e,`fb-video`)?`video`:null,n=W(F(e.attrs.get(`data-href`)??``));return!t||!n?null:{...G(n,t,`sdk`,R(e,an,I)),fallbackHtml:j(e.children,cn)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!Jt.has(t.host))return null;let n=W(F(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=I(r)),i!==void 0&&(e.width=I(i)),G(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=I(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of on){let i=t.query.get(n);i!==void 0&&(e[r]=I(i))}let r=L(t.query.get(`width`)),i=L(t.query.get(`height`));return B(G(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return B(G(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,I(t)]))),z(e))}return null},isOwnScript:e=>rn.test(e),scriptOptions(e){let[,t]=rn.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=W(e);return t&&G(t,t.kind,`sdk`,{})}},K=`([A-Za-z0-9]{6,40})`,q=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),un=RegExp(`^/gifs/(?:[A-Za-z0-9-]{0,200}-)?${K}/?$`),dn=RegExp(`^/embed/${K}/?$`),fn=/^media\d?\.giphy\.com$/,pn=RegExp(`^/media/${K}/giphy\\.(?:gif|webp|mp4)$`),mn=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function hn(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function gn(e){if(e){if(q.has(e.host))return(un.exec(e.path)??dn.exec(e.path))?.[1];if(fn.test(e.host))return pn.exec(e.path)?.[1]}}function _n(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!q.has(t.host))return null;let[,n]=dn.exec(t.path)??[];return n===void 0?null:hn(n)}function vn(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=F(n.attrs.get(`href`)??``);if(!i||!q.has(i.host)||un.exec(i.path)?.[1]!==t.id)return!1;let[a,...o]=n.children;return o.length===0&&a?.type===`text`&&a.raw.trim()===`via GIPHY`}const yn={platform:`giphy`,parse(e){let t=_t(e,mn),n=t?.iframe??e,r=_n(n);return r?B({...r,options:{}},t?.size??z(n)):null},isOwnScript:()=>!1,isOwnExtra:vn,match(e){let t=gn(e);return t===void 0?null:{...hn(t),options:{}}}},bn=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),xn=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Sn=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Cn=/* @__PURE__ */ new Set([`p`,`reel`]),wn=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Tn=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function En(e){if(!e||!bn.has(e.host))return null;let[,t,n,r]=xn.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Sn.has(t)||!Cn.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const Dn={platform:`instagram`,fallback:Tn,parse(e){if(e.tag!==`blockquote`||!k(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?A(e.children).reverse().map(e=>e.tag===`a`?En(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null):En(F(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=I(i)),{...n,options:r,fallbackHtml:j(e.children,Tn)}},isOwnScript:e=>wn.test(e),match(e){let t=En(e);return t&&{...t,options:{}}}},On=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),kn=/^\/([A-Za-z0-9_-]{1,32})\/?$/,An=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),jn=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Mn(e,t){if(!e||!t.has(e.host))return null;let[,n]=kn.exec(e.path)??[];if(n===void 0||An.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const Nn=/* @__PURE__ */ new Set([`player.kick.com`]),Pn={platform:`kick`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=Mn(t,Nn);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>jn.has(e)).map(([e,t])=>[e,I(t)]));return B({...n,options:r},z(e))},isOwnScript:()=>!1,match(e){let t=Mn(e,On)??Mn(e,Nn);return t&&{...t,options:{}}}},Fn=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,In=`(activity|share|ugcPost):(\\d{19})`,Ln=RegExp(`^(?:/embed)?/feed/update/urn:li:${In}/?$`),Rn=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),zn=RegExp(`^/embed/feed/update/urn:li:${In}$`);function Bn(e,t,n={}){let r=`urn:li:${e}:${t}`;return{platform:`linkedin`,kind:`post`,url:`https://www.linkedin.com/feed/update/${r}/`,id:r,variant:`iframe`,options:n}}const Vn=e=>e.replace(/%3A/gi,`:`),Hn={platform:`linkedin`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=zn.exec(t.path)??[];return n===void 0||r===void 0?null:B(Bn(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),z(e))},isOwnScript:()=>!1,match(e){if(!Fn.test(e.host))return null;let t=Vn(e.path),[,n,r]=Ln.exec(t)??Rn.exec(t)??[];return n===void 0||r===void 0?null:Bn(n,r)}},Un=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,Wn=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,Gn=/^\d{1,25}$/,Kn=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,qn=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function Jn(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function Yn(e){if(!e||!Un.test(e.host))return null;let[,t]=Wn.exec(e.path)??[];return t===void 0?null:Jn(t)}const Xn={platform:`pinterest`,parse(e){if(e.tag===`a`){if(e.attrs.get(`data-pin-do`)!==`embedPin`||e.children.some(e=>e.type===`element`))return null;let t=Yn(F(e.attrs.get(`href`)??``));return t&&{...t,options:R(e,qn,I)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&Gn.test(n)?{...Jn(n),options:{}}:null},isOwnScript:e=>Kn.test(e),match(e){let t=Yn(e);return t&&{...t,options:{}}}},Zn=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),Qn=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/,$n=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,er=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function tr(e){if(!e||!Zn.has(e.host))return null;let[,t,n,r,i]=Qn.exec(e.path)??[];if(t===void 0||n===void 0)return null;let a={platform:`reddit`,kind:`post`,variant:`iframe`},o=`https://www.reddit.com/r/${t}/comments/${n}/`;return i===void 0?{...a,url:o,id:n}:r===void 0?null:{...a,url:`${o}comment/${i}/`,id:i}}const nr={platform:`reddit`,parse(e){if(e.tag!==`blockquote`||!k(e,`reddit-embed-bq`))return null;let t=A(e.children).map(e=>e.tag===`a`?tr(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=L(e.attrs.get(`data-embed-height`));return B({...t,options:R(e,er,I)},n===void 0?void 0:{height:n})},isOwnScript:e=>$n.test(e),match(e){let t=tr(e);return t&&{...t,options:{}}}},rr=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),ir=`([A-Za-z][A-Za-z0-9._-]{1,29})`,ar=RegExp(`^(?:/@${ir})?/spotlight/([A-Za-z0-9_-]{20,120})$`),or=RegExp(`^/(?:@|add/)${ir}$`),sr=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,cr=RegExp(`^/@${ir}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),lr=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function ur(e){if(!e||!rr.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=ar.exec(t)??[];if(i!==void 0){let e=r===void 0?``:`/@${r}`;return{...n,kind:`video`,url:`https://www.snapchat.com${e}/spotlight/${i}`,id:i}}let[,a]=or.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=sr.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=cr.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const dr={platform:`snapchat`,parse(e){if(e.tag!==`blockquote`||!k(e,`snapchat-embed`))return null;let t=F(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=ur({...t,path:t.path.slice(0,-6)});if(!n||!A(e.children).filter(e=>e.tag===`a`).every(e=>{let t=ur(F(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=L(e.attrs.get(`data-snapchat-embed-width`)),a=L(e.attrs.get(`data-snapchat-embed-height`));return B({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>lr.test(e),match(e){let t=ur(e);return t&&{...t,options:{}}}},fr=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),pr=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,mr=`[a-z0-9_-]{1,64}`,hr=`s-[A-Za-z0-9]{1,32}`,gr=RegExp(`^/(${mr})(?:/(sets/${mr}|${mr})(?:/(${hr}))?)?/?$`,`i`),_r=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),vr=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),yr=RegExp(`^${hr}$`);function br(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function xr(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=pr.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!yr.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return br(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Sr(e){if(!fr.has(e.host))return null;let[,t,n,r]=gr.exec(e.path)??[];if(t===void 0||_r.has(t.toLowerCase())||n!==void 0&&vr.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return br(`https://soundcloud.com/${i}`,i)}const Cr=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function wr(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!Cr.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&fr.has(F(e.attrs.get(`href`)??``)?.host??``)}function Tr(e){if(e.tag!==`div`||e.attrs.size!==1||!e.attrs.has(`style`))return!1;let[t,n,r,...i]=e.children;return i.length===0&&wr(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&wr(r)}const Er={platform:`soundcloud`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=xr(F(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!yr.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,I(t)])),{height:a}=z(e)??{};return B({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:Tr,match(e){let t=xr(e)??Sr(e);return t&&{...t,options:{}}}},Dr=/* @__PURE__ */ RegExp(`^(?:/intl-[a-z]{2}(?:-[A-Za-z]{2})?)?(?:/embed)?/(track|album|playlist|artist|episode|show|audiobook|chapter)/([A-Za-z0-9]{22})(/video)?/?$`),Or=/* @__PURE__ */ new Set([`utm_source`,`si`]);function kr(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=Dr.exec(e.path)??[];return t===void 0||n===void 0?null:{platform:`spotify`,kind:r?`video`:`post`,url:`https://open.spotify.com/${t}/${n}`,id:n,variant:`iframe`,query:e.query}}function Ar(e){return Object.fromEntries([...e].filter(([e])=>!Or.has(e)).map(([e,t])=>[e,I(t)]))}const jr={platform:`spotify`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=kr(t);if(!n)return null;let{query:r,...i}=n;return B({...i,options:Ar(r)},z(e))},isOwnScript:()=>!1,match(e){let t=kr(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}}},Mr=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Nr=`[A-Za-z][A-Za-z0-9_]{2,31}`,Pr=RegExp(`^(${Nr})/(\\d{1,10})$`),Fr=RegExp(`^/(?:s/)?(${Nr})/(\\d{1,10})/?$`),Ir=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Lr=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Rr=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function zr(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const Br={platform:`telegram`,parse:()=>null,parseScript(e){if(!Ir.test(e.attrs.get(`src`)??``)||Lr.some(t=>e.attrs.has(t)))return null;let[,t,n]=Pr.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=R(e,Rr,I);return e.attrs.has(`data-single`)&&(r.single=!0),zr(t,n,r)},isOwnScript:e=>Ir.test(e),match(e){if(!Mr.has(e.host))return null;let[,t,n]=Fr.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r={};e.query.has(`single`)&&(r.single=!0);let i=e.query.get(`comment`);return i!==void 0&&/^\d{1,10}$/.test(i)&&(r.comment=Number(i)),zr(t,n,r)}},Vr=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),Hr=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,Ur=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,Wr=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Gr=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function Kr(e){if(!e||!Vr.has(e.host))return null;let[,t]=Hr.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const qr={platform:`threads`,fallback:Gr,parse(e){if(e.tag!==`blockquote`||!k(e,`text-post-media`))return null;let t=Kr(F(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:R(e,Wr,I),fallbackHtml:j(e.children,Gr)}},isOwnScript:e=>Ur.test(e),match(e){let t=Kr(e);return t&&{...t,options:{}}}},Jr=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),Yr=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,Xr=/^\/player\/v1\/(\d{1,25})\/?$/,Zr=/^\d{1,25}$/,Qr=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;function $r(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const ei={platform:`tiktok`,parse(e){if(e.tag===`blockquote`&&k(e,`tiktok-embed`)){let t=F(e.attrs.get(`cite`)??``),[,n,r]=t&&Jr.has(t.host)?Yr.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Zr.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:$r(a,n)}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!Jr.has(t.host))return null;let[,n]=Xr.exec(t.path)??[];return n===void 0?null:B($r(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),z(e))},isOwnScript:e=>Qr.test(e),match(e){if(!Jr.has(e.host))return null;let[,t,n]=Yr.exec(e.path)??[];return t===void 0||n===void 0?null:$r(n,t)}},ti=`([a-z0-9-]{1,32})`,ni=`(\\d{1,20})`,ri=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),ii=RegExp(`^/${ti}/${ni}(?:/[^/]{1,200})?/?$`),ai=RegExp(`^${ti}\\.tumblr\\.com$`),oi=RegExp(`^/post/${ni}(?:/[^/]{1,200})?/?$`),si=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${ti})/${ni}/v2$`),ci=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),li=/^(?:https?:)?\/\/assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function ui(e){if(!e)return null;let t,n;return ri.has(e.host)?[,t,n]=ii.exec(e.path)??[]:([,t]=ai.exec(e.host)??[],[,n]=oi.exec(e.path)??[]),t===void 0||n===void 0||ci.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const di={platform:`tumblr`,parse(e){if(e.tag!==`div`||!k(e,`tumblr-post`))return null;let t=F(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=si.exec(t.path)??[];if(r===void 0)return null;let[i,...a]=e.children.filter(e=>e.type!==`text`||e.raw.trim()!==``);if(a.length>0||i?.type!==`element`||i.tag!==`a`)return null;let o=ui(F(i.attrs.get(`href`)??``));return o?.id!==r||n!==void 0&&o.url!==`https://www.tumblr.com/${n}/${r}`?null:{...o,options:{}}},isOwnScript:e=>li.test(e),match(e){let t=ui(e);return t&&{...t,options:{}}}},fi=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),pi=/^[A-Za-z0-9_]{3,25}$/,mi=/^v?(\d{1,12})$/,hi=/^[A-Za-z0-9_-]{6,30}$/,gi=/^[A-Za-z0-9_-]{6,100}$/,_i=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,vi=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),yi=[`autoplay`,`muted`,`time`];function J(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const bi=e=>J(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),xi=e=>J(`https://www.twitch.tv/videos/${e}`,e),Si=e=>J(`https://www.twitch.tv/collections/${e}`,e),Ci=e=>J(`https://clips.twitch.tv/${e}`,e);function wi(e){let t={};for(let n of yi){let r=e.get(n);r!==void 0&&(t[n]=I(r))}return t}function Ti(e){let t=e.query.get(`channel`);if(t!==void 0)return pi.test(t)?bi(t):null;let[,n]=mi.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return xi(n);let r=e.query.get(`collection`);return r!==void 0&&hi.test(r)?Si(r):null}function Ei(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return gi.test(t)?{found:Ci(t),options:{}}:null}if(!fi.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=mi.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:xi(t),options:n!==void 0&&_i.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?hi.test(r??``)?{found:Si(r??``),options:{}}:null:t.length===3&&r===`clip`?pi.test(n)&&gi.test(i??``)?{found:Ci(i??``),options:{}}:null:t.length===1&&pi.test(n)&&!vi.has(n.toLowerCase())?{found:bi(n),options:{}}:null}const Di={platform:`twitch`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=Ti(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=gi.test(e)?Ci(e):null}return n&&B({...n,options:wi(t.query)},z(e))},isOwnScript:()=>!1,match(e){let t=Ei(e);return t&&{...t.found,options:t.options}}},Oi=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Y=`(\\d{1,12})`,ki=`([0-9a-f]{6,20})`,Ai=[RegExp(`^/${Y}(?:/${ki})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${Y}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${Y}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${Y}/?$`)],ji=RegExp(`^/video/${Y}/?$`),Mi=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Ni=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Pi=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Fi=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function Ii(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Li(e){let[,t]=Fi.exec(e.fragment??``)??[];return t?{t}:{}}function Ri(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=ji.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${ki}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Pi.has(e)).map(([e,t])=>[e,I(t)]));return{...Ii(t,n),options:{...r,...Li(e)}}}const zi={platform:`vimeo`,parse(e){let t=_t(e,Mi),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Ri(F(n.attrs.get(`src`)??``));return r&&B(r,t?.size??z(n))},isOwnScript:e=>Ni.test(e),match(e){let t=Ri(e);if(t)return t;if(!Oi.has(e.host))return null;for(let t of Ai){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return{...Ii(n,r),options:Li(e)}}return null}},Bi=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Vi=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Hi=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,Ui=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],Wi=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function Gi(e){if(!e||!Bi.has(e.host))return null;let[,t,n]=Vi.exec(e.path)??[];return t===void 0||n===void 0?null:{platform:`x`,kind:`post`,url:`https://x.com/${t}/status/${n}`,id:n,variant:`sdk`}}const Ki={platform:`x`,fallback:Wi,parse(e){if(e.tag!==`blockquote`||!k(e,`twitter-tweet`))return null;let t=A(e.children).reverse().map(e=>e.tag===`a`?Gi(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:R(e,Ui,I),fallbackHtml:j(e.children,Wi)}:null},isOwnScript:e=>Hi.test(e),match(e){let t=Gi(e);return t&&{...t,options:{}}}},qi=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),Ji=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),Yi=/^(?!videoseries)[A-Za-z0-9_-]{11}$/,Xi=/^\/embed\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,Zi=/^\/(shorts|embed|live)\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,Qi=/^\/([A-Za-z0-9_-]{11})\/?$/,$i=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/;function ea(e){if(e===void 0||e===``)return;let t=$i.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function ta(e){return ea(e.get(`start`))??ea(e.get(`t`))}function X(e,t=!1){return{platform:`youtube`,kind:`video`,url:t?`https://www.youtube.com/shorts/${e}`:`https://www.youtube.com/watch?v=${e}`,id:e,variant:`iframe`}}function na(e,t){let n=ta(e.query);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const Z=[Ki,Dn,ln,qr,ei,{platform:`youtube`,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=t!==null&&Ji.has(t.host);if(!t||!(n||qi.has(t.host)))return null;let[,r]=Xi.exec(t.path)??[];if(r===void 0)return null;let i=[...t.query].filter(([e])=>e!==`t`).map(([e,t])=>[e,I(t)]),a=Object.fromEntries(i),o=ta(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),B({...X(r),options:a},z(e))},isOwnScript:()=>!1,match(e){if(e.host===`youtu.be`){let[,t]=Qi.exec(e.path)??[];return t===void 0?null:{...X(t),options:na(e,!1)}}let t=Ji.has(e.host);if(!t&&!qi.has(e.host))return null;if(!t&&/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&Yi.test(t)?{...X(t),options:na(e,!1)}:null}let[,n,r]=Zi.exec(e.path)??[];return n===void 0||r===void 0||t&&n!==`embed`?null:{...X(r,n===`shorts`),options:na(e,t)}}},Br,dr,Hn,nr,Xn,jr,zi,Di,Kt,Er,St,Et,Pn,yn,Rt,di];function ra(e){if(typeof e!=`string`)return null;let t=F(e);if(!t)return null;for(let e of Z){let n=e.match(t);if(n)return n}return null}function ia(e){if(typeof e!=`string`)return null;let t=Se(e);if(!t)return null;let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(e.raw))continue;return null}if(e.tag===`script`)i.push(e);else if(aa(e))a=!0;else if(n){if(r)return null;r=e}else n=e}if(!n){let[e]=i;if(a||i.length!==1||!e||e.children.length!==0)return null;for(let t of Z){let n=t.parseScript?.(e);if(n)return n}return null}for(let e of Z){let t=e.parse(n);if(!t)continue;if(a&&!e.allowsFbRoot||r&&!e.isOwnExtra?.(r,t))return null;let o=i.map(e=>e.children.length===0?e.attrs.get(`src`):void 0);if(!o.every(t=>t!==void 0&&e.isOwnScript(t)))return null;let s=o.map(t=>t===void 0?{}:e.scriptOptions?.(t)??{});return{...t,options:Object.assign({},...s,t.options)}}return null}function aa(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}const oa=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),sa=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,ca=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function la(e){let t=typeof e==`string`?F(e):null;if(!t||!oa.has(t.host))return null;let[,n]=sa.exec(t.path)??[];return n!==void 0&&ca.test(n)?`bluesky`:null}const ua={x:[`post sdk`],instagram:[`post sdk`],threads:[`post sdk`],facebook:[`post sdk`,`video sdk`,`video iframe`],tiktok:[`video iframe`],youtube:[`video iframe`],telegram:[`post iframe`],snapchat:[`post iframe`,`video iframe`],linkedin:[`post iframe`],reddit:[`post iframe`],pinterest:[`post sdk`],spotify:[`post iframe`,`video iframe`],vimeo:[`video iframe`],twitch:[`video iframe`],dailymotion:[`video iframe`],bluesky:[`post iframe`],soundcloud:[`post iframe`],applemusic:[`post iframe`],applepodcasts:[`post iframe`],tumblr:[`post iframe`],kick:[`video iframe`],giphy:[`video iframe`]};function da(e){let t=ra(e.url);if(t?.platform!==e.platform||t.id!==e.id||t.url!==e.url||!ua[e.platform].includes(`${e.kind} ${e.variant}`))return null;if(e.fallbackHtml===void 0||fa(e,e.fallbackHtml))return e;let n={...e};return delete n.fallbackHtml,n}function fa(e,t){let n=Z.find(t=>t.platform===e.platform)?.fallback,r=Se(t);if(!n||!r||j(r,n)!==t)return!1;if(e.platform!==`x`)return!0;let[i]=Se(`<blockquote class="twitter-tweet">${t}</blockquote>`)??[];return i?.type===`element`&&Ki.parse(i)?.id===e.id}const Q={x:`X`,instagram:`Instagram`,facebook:`Facebook`,threads:`Threads`,tiktok:`TikTok`,youtube:`YouTube`,telegram:`Telegram`,snapchat:`Snapchat`,linkedin:`LinkedIn`,reddit:`Reddit`,pinterest:`Pinterest`,spotify:`Spotify`,vimeo:`Vimeo`,twitch:`Twitch`,dailymotion:`Dailymotion`,bluesky:`Bluesky`,soundcloud:`SoundCloud`,applemusic:`Apple Music`,applepodcasts:`Apple Podcasts`,tumblr:`Tumblr`,kick:`Kick`,giphy:`Giphy`};function pa(e){return`social-embeds: a ${Q[e]} URL needs a lookup: use the embed code`}function ma(e,t,n){let r=t??(e===void 0?null:ra(e));if(!r&&e!==void 0&&la(e)===n)return{error:pa(n)};if(!r)return{error:`social-embeds: not a ${Q[n]} post URL: ${String(e)}`};if(r.platform!==n)return{error:`social-embeds: expected a ${Q[n]} embed, got ${Q[r.platform]}`};let i=da(r);return i?{embed:i}:{error:`social-embeds: the ${Q[n]} embed's url and id do not match`}}function ha(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=la(e.url);return t?pa(t):`social-embeds: not a supported post URL: ${e.url}`}function ga(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function _a(e){return e===null?void 0:ga(e.trim().replace(/px$/i,``))}function va(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function ya(e,t){let n=t??va(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:ga(i)??(i?.trim()?i:void 0),maxWidth:_a(e.getAttribute(`max-width`)),height:_a(e.getAttribute(`height`)),maxHeight:_a(e.getAttribute(`max-height`))},eager:e.hasAttribute(`eager`)}}function ba(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,s=e.size?.width??e.ratio.width,c=e.size?.height??e.ratio.height,l=i===void 0||a!==void 0?void 0:Math.floor(i*s/c);return{position:`relative`,width:r,maxWidth:l===void 0||o!==void 0&&o<l?o:l,...e.messageHeight?{height:n??e.startHeight}:a===void 0?{aspectRatio:`${String(s)} / ${String(c)}`}:{height:a,maxHeight:i},...e.borderRadius===void 0?{}:{borderRadius:e.borderRadius,overflow:`hidden`}}}const xa=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function $(e,t){for(let[n,r]of Object.entries(t)){if(r===void 0)continue;let t=typeof r==`number`&&xa.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Sa(e){let t=document.createElement(`div`);return t.setAttribute(`aria-hidden`,`true`),$(t,{width:`100%`,height:`100%`,minHeight:e,background:`rgba(128, 128, 128, 0.12)`}),t}function Ca(e,t,n){if(t||typeof IntersectionObserver>`u`)return n(),()=>{};let r=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(r.disconnect(),n())},{rootMargin:`200px 0px`});return r.observe(e),()=>{r.disconnect()}}function wa(e,t){return`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(window.location.hostname)}`}function Ta(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Ea(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o,...s}=n,{messageHeight:c}=t,l=document.createElement(`div`);$(l,ba(t,s));let u=Ta(document.createElement(`div`)),d=Ta(document.createElement(`div`)),f=i.length>0?i:[t.fallbackHtml===void 0?Sa():Da(t.fallbackHtml)];d.append(...f),u.append(d),l.append(u),e.append(l);let p,m=!1,h,g=[],_=()=>{d.remove(),m||(m=!0,a())},v=e=>{if(!c||e.origin!==c.origin||!p||e.source!==p.contentWindow)return;let t;try{t=c.read(e.data)}catch{return}typeof t==`number`&&t>0&&t<=5e4&&($(l,{height:Math.ceil(t)}),_())},y=c?`did not report its height`:`did not load`,b=()=>{h=setTimeout(()=>{m||(d.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${y}`)))},15e3)},x=()=>{let e=document.createElement(`iframe`);e.src=t.hostParam?wa(t.src,t.hostParam):t.src,e.title=t.title,e.setAttribute(`allow`,t.allow),e.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(e.referrerPolicy=t.referrerPolicy),t.scrolling&&e.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&e.setAttribute(`sandbox`,t.sandbox),$(e,{display:`block`,width:`100%`,height:`100%`,border:0}),e.addEventListener(`load`,()=>{c||_()}),p=e,u.insertBefore(e,d),c&&window.addEventListener(`message`,v)};return r?(x(),g.push(Ca(u,!1,b))):g.push(Ca(u,!1,()=>{x(),b()})),()=>{for(let e of g)e();clearTimeout(h),window.removeEventListener(`message`,v),l.remove()}}function Da(e){let t=document.createElement(`blockquote`);return t.innerHTML=e,t}function Oa(e){return e instanceof Error?e:Error(String(e))}function ka(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`);$(l,{width:n.width??`100%`,maxWidth:n.maxWidth??t.maxWidth});let u=document.createElement(`div`);$(u,{width:`100%`});let d=document.createElement(`div`);d.innerHTML=t.markup,u.append(d);let f=o.length>0?o:[Sa(t.minHeight)];t.hasFallback||u.append(...f),l.append(u),e.append(l);let p=!1,m=!1,h,g=()=>{},_=()=>{if(!(p||m)){m=!0,clearTimeout(h),g();for(let e of f)e.parentNode?.removeChild(e);s()}},v=(e,t)=>{p||m||(g(),g=()=>{},e>=3?c(t):h=setTimeout(()=>{y(e+1)},1e3*2**(e-1)))},y=e=>{if(!(p||m)){try{g=r.render(d,_)}catch(t){v(e,Oa(t));return}h=setTimeout(()=>{v(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},b=Ca(d,a,()=>{r.load().then(()=>{y(1)},e=>{p||c(Oa(e))})});return()=>{p=!0,b(),clearTimeout(h),g(),l.remove()}}const Aa=typeof HTMLElement>`u`?class{}:HTMLElement;function ja(e){let t=[];for(let n of[...e.childNodes])n instanceof HTMLTemplateElement||(e.removeChild(n),(n.nodeType===Node.ELEMENT_NODE||n.nodeType===Node.TEXT_NODE&&n.textContent?.trim())&&t.push(n));return t}const Ma=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var Na=class extends Aa{static observedAttributes=[`url`,`width`,`max-width`,`height`,`max-height`,`eager`];#e=null;#t;#n;#r;#i=()=>{};#a=0;#o=!1;constructor(){super();for(let e of Ma){if(!Object.hasOwn(this,e))continue;let t=this[e];Reflect.deleteProperty(this,e),Reflect.set(this,e,t)}}get html(){return this.#e}set html(e){this.#e=typeof e==`string`?e:null,this.#l()}get url(){return this.getAttribute(`url`)}set url(e){this.#c(`url`,e)}get width(){return this.getAttribute(`width`)}set width(e){this.#c(`width`,e)}get maxWidth(){return this.getAttribute(`max-width`)}set maxWidth(e){this.#c(`max-width`,e)}get height(){return this.getAttribute(`height`)}set height(e){this.#c(`height`,e)}get maxHeight(){return this.getAttribute(`max-height`)}set maxHeight(e){this.#c(`max-height`,e)}get eager(){return this.hasAttribute(`eager`)}set eager(e){this.toggleAttribute(`eager`,!!e)}connectedCallback(){this.#t===void 0&&document.readyState===`loading`?this.#o||(this.#o=!0,document.addEventListener(`DOMContentLoaded`,()=>{this.#o=!1,this.isConnected&&this.connectedCallback()},{once:!0})):(this.#t??=ja(this),this.#n??=new MutationObserver(()=>{this.#s(),this.#l()}),this.#s(),this.#l())}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#n?.disconnect(),this.#u(),this.#r=void 0)})}attributeChangedCallback(){this.#l()}#s(){let e=this.#n;if(e){e.disconnect(),e.observe(this,{childList:!0});for(let t of this.children)t instanceof HTMLTemplateElement&&e.observe(t.content,{childList:!0,subtree:!0,characterData:!0})}}#c(e,t){t==null?this.removeAttribute(e):this.setAttribute(e,t)}#l(){if(!this.isConnected||this.#t===void 0)return;let e=ya(this,this.#e),t=JSON.stringify(e);t!==this.#r&&(this.#u(),this.#r=t,this.#d(e,this.#t))}#u(){this.#a+=1;let e=this.#i;this.#i=()=>{},e()}#d(e,t){let{source:n,layout:r,eager:i}=e;if(!n)return;let a=this.#a,o=e=>{queueMicrotask(()=>{a===this.#a&&this.isConnected&&this.dispatchEvent(e)})},s=e=>{o(new ErrorEvent(`error`,{error:e,message:e.message}))},c=`html`in n?ia(n.html):ra(n.url);if(!c){s(Error(ha(n)));return}let l=ma(void 0,c,c.platform);if(l.error!==void 0){s(Error(l.error));return}let u=mt(l.embed);if(u.kind===`error`){s(Error(u.message));return}let d={...r,eager:i,placeholder:t.map(e=>e.cloneNode(!0)),onLoad:()=>{o(new Event(`load`))},onError:s};this.#i=u.kind===`iframe`?Ea(this,u,d):ka(this,u,d)}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,Na);export{Na as SocialEmbedElement};
package/dist/index.d.ts CHANGED
@@ -258,7 +258,7 @@ type SocialEmbedProps = SocialEmbedSource & Omit<FrameProps, PlatformOption> & {
258
258
  fallback?: (html: string) => ReactNode;
259
259
  };
260
260
  /** `height` and `maxHeight` reach only the iframe-based embeds: the others size themselves. */
261
- export declare function SocialEmbed(props: SocialEmbedProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
261
+ export declare function SocialEmbed(props: SocialEmbedProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
262
262
  type SnapchatEmbedProps = EmbedSource & FrameProps;
263
263
  /** At most 416px wide by default, the size of Snapchat's own embed code (docs/decisions.md D50). */
264
264
  export declare function SnapchatEmbed(props: SnapchatEmbedProps): import("react").JSX.Element | null;
package/dist/index.js CHANGED
@@ -157,7 +157,7 @@ function applePodcastsPlan(embed) {
157
157
  }
158
158
  // src/core/timing.ts
159
159
  const ROOT_MARGIN = "200px 0px";
160
- const HEIGHT_TIMEOUT_MS = 15e3;
160
+ const FRAME_TIMEOUT_MS = 15e3;
161
161
  const RENDER_TIMEOUT_MS = 15e3;
162
162
  const RETRY_DELAY_MS$1 = 1e3;
163
163
  // src/components/hooks.ts
@@ -230,8 +230,7 @@ function IframeEmbed({ src, title, allow, referrerPolicy, scrolling, sandbox, ra
230
230
  const frame = useRef(null);
231
231
  const iframe = useRef(null);
232
232
  const near = useNearViewport(frame, lazy);
233
- const inView = useNearViewport(frame, !lazy && messageHeight !== void 0);
234
- const heard = useRef(false);
233
+ const inView = useNearViewport(frame, !lazy);
235
234
  const [loaded, setLoaded] = useState(false);
236
235
  const [reportedHeight, setReportedHeight] = useState();
237
236
  const reported = useRef(false);
@@ -254,7 +253,6 @@ function IframeEmbed({ src, title, allow, referrerPolicy, scrolling, sandbox, ra
254
253
  useEffect(() => {
255
254
  if (!near || !messageHeight) return;
256
255
  const { origin, read } = messageHeight;
257
- heard.current = false;
258
256
  const listen = (event) => {
259
257
  if (event.origin !== origin) return;
260
258
  if (!iframe.current || event.source !== iframe.current.contentWindow) return;
@@ -265,7 +263,6 @@ function IframeEmbed({ src, title, allow, referrerPolicy, scrolling, sandbox, ra
265
263
  return;
266
264
  }
267
265
  if (typeof value !== "number" || !(value > 0 && value <= 5e4)) return;
268
- heard.current = true;
269
266
  setReportedHeight(Math.ceil(value));
270
267
  report();
271
268
  };
@@ -279,12 +276,13 @@ function IframeEmbed({ src, title, allow, referrerPolicy, scrolling, sandbox, ra
279
276
  report
280
277
  ]);
281
278
  useEffect(() => {
282
- if (!near || !inView || !messageHeight) return;
279
+ if (!near || !inView) return;
280
+ const failure = messageHeight ? "did not report its height" : "did not load";
283
281
  const timer = setTimeout(() => {
284
- if (heard.current) return;
282
+ if (reported.current) return;
285
283
  setLoaded(true);
286
- callbacks.current.onError?.(/* @__PURE__ */ new Error(`social-embeds: ${title} did not report its height`));
287
- }, HEIGHT_TIMEOUT_MS);
284
+ callbacks.current.onError?.(/* @__PURE__ */ new Error(`social-embeds: ${title} ${failure}`));
285
+ }, FRAME_TIMEOUT_MS);
288
286
  return () => {
289
287
  clearTimeout(timer);
290
288
  };
@@ -917,6 +915,7 @@ function facebookPlan(embed, options) {
917
915
  };
918
916
  }
919
917
  // src/components/script-embed.tsx
918
+ const LAYER = { width: "100%" };
920
919
  function toError(error) {
921
920
  return error instanceof Error ? error : new Error(String(error));
922
921
  }
@@ -993,14 +992,17 @@ function ScriptEmbed({ driver, markup, hasFallback, minHeight, label, width = "1
993
992
  maxWidth,
994
993
  ...style
995
994
  };
996
- return /* @__PURE__ */ jsxs("div", {
995
+ return /* @__PURE__ */ jsx("div", {
997
996
  ...rest,
998
997
  style: wrapper,
999
- children: [/* @__PURE__ */ jsx("div", {
1000
- ref: container,
1001
- suppressHydrationWarning: true,
1002
- dangerouslySetInnerHTML: { __html: markup }
1003
- }), !hasFallback && !rendered && (placeholder ?? /* @__PURE__ */ jsx(Skeleton, { minHeight }))]
998
+ children: /* @__PURE__ */ jsxs("div", {
999
+ style: LAYER,
1000
+ children: [/* @__PURE__ */ jsx("div", {
1001
+ ref: container,
1002
+ suppressHydrationWarning: true,
1003
+ dangerouslySetInnerHTML: { __html: markup }
1004
+ }), !hasFallback && !rendered && (placeholder ?? /* @__PURE__ */ jsx(Skeleton, { minHeight }))]
1005
+ })
1004
1006
  });
1005
1007
  }
1006
1008
  // src/components/facebook-embed.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "social-embeds",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Turn social media embed code or post URLs into working React components.",
5
5
  "keywords": [
6
6
  "react",