social-embeds 0.7.0 → 0.7.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 +1 -1
- package/dist/element.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -491,7 +491,7 @@ URL shapes, each tested against Facebook's plugins on `www.facebook.com`, `faceb
|
|
|
491
491
|
|
|
492
492
|
### Truth Social, Imgur and Strava
|
|
493
493
|
|
|
494
|
-
- These frames report their own height without being asked, so the height follows the post. Until the first report, the frame is
|
|
494
|
+
- These frames report their own height without being asked, so the height follows the post. Until the first report, the frame is 150 px (Truth Social), 500 px (Imgur) or 650 px (Strava) high.
|
|
495
495
|
- Truth Social video posts get 165 px extra, as Truth Social's own script adds. Embed code marks a video post; a URL cannot, so a URL takes the height the frame reports. A vertical video stays cut off, as in Truth Social's own embed.
|
|
496
496
|
- Imgur's gallery posts and albums share ids, and both render as an album. `i.imgur.com` file URLs render the image's post.
|
|
497
497
|
- Strava renders activities and routes. The style option is the prop `embedStyle`, because `style` stays the CSS prop; in embed code it is `data-style`. `strava.app.link` short links are not supported.
|
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 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,S=`v26.0`,ee=/^[a-z]{2,3}_[A-Z]{2}$/;function te(e){return()=>{let t=x().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}}const ne={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 re(){let e=x().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ie(e){let t=te(e);return()=>{let e=x().FB;return!t()&&e!==void 0&&!e.__buffer}}const ae={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:te(`instagram`),prepare:re,skipped:ie(`instagram`)},oe={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:te(`threads`),prepare:re,skipped:ie(`threads`)};function se(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${S}`,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 ce={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 C(e,{locale:t=`en_US`}={}){switch(e){case`x`:return p(ne);case`instagram`:return p(ae);case`threads`:return p(oe);case`pinterest`:return p(ce);case`facebook`:return ee.test(t)?p(se(t)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${t}"`))}}const w=()=>window;function T(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 E(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function le(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const ue={load:()=>C(`x`),render(e,t){let n=w().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=T(e,le,t);return E(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function de(){let e=w().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const fe={load:()=>C(`instagram`),render(e,t){let n=T(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return E(e,`instagram-media`),de(),n}},pe={load:()=>C(`threads`),render(e,t){let n=T(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return E(e,`text-post-media`),de(),n}},me=/* @__PURE__ */ new Map;function he(e){let t=me.get(e);return t||(t={load:()=>C(`facebook`,{locale:e}),render(e,t){let n=w().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:S}),i()}return()=>{}}},me.set(e,t)),t}const ge={load:()=>C(`pinterest`),render(e,t){let n=w().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=T(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}},_e=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),ve=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),ye=/<([a-zA-Z][a-zA-Z0-9-]*)/y,be=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,xe=/\s*(\/?)>/y,Se=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Ce=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function D(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}Se.lastIndex=a;let s=Se.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=Se.lastIndex;continue}let c=we(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:ve.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&&!_e.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function we(e,t){ye.lastIndex=t;let n=ye.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=ye.lastIndex;for(;;){xe.lastIndex=i;let t=xe.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:xe.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,Te(s??c??l??``)),i=be.lastIndex}}function Te(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 Ce.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 O(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function k(e){let t=[];return Ee(e,t),t}function Ee(e,t){for(let n of e)n.type===`element`&&(t.push(n),Ee(n.children,t))}const De=/* @__PURE__ */ new Set([`href`,`cite`]),Oe=/^https?:\/\//i;function A(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)||De.has(e)&&!Oe.test(i)||(n+=` ${e}="${j(i)}"`)}n+=`>`,_e.has(r.tag)||(n+=`${A(r.children,t)}</${r.tag}>`)}}return n}function j(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function ke(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${j(String(r))}"`);return t}function Ae(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return ke(n)}function M(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function N(e){return e!==void 0&&e.trim()!==``}const je={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Me={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},Ne={post:300,video:200};function Pe(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 Fe(e,t){if(e.variant===`iframe`)return Pe(e);let n=M(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(Me)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Pe({...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="${j(e.url)}"${Ae(je,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:he(i),minHeight:Ne[e.kind],label:`Facebook`,hasFallback:N(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}const Ie=[`header`,`footer`,`context`],Le=/\/albums\/\d+$/;function Re(e,t){let n=Le.test(e.url),r=Ie.filter(n=>t[n]??e.options[n]===!0),{width:i,height:a}=e.size??{},o=i!==void 0&&a!==void 0?{width:i,height:a}:void 0;return{kind:`iframe`,src:`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:{width:4,height:3},...o?{size:o,maxWidth:o.width}:{},sizeInSrc:!0,...e.fallbackHtml===void 0?{}:{fallbackHtml:e.fallbackHtml.replace(/<img(?=[\s>])/g,`<img style="display:block;width:100%;height:100%;object-fit:cover"`)},fallbackImage:!0}}function ze(e){return{kind:`iframe`,src:`https://giphy.com/embed/${e.id}`,title:`Giphy GIF`,allow:`fullscreen`,ratio:{width:1,height:1},size:e.size}}const Be={origin:`https://imgur.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.message===`resize_imgur`&&typeof t.height==`number`?t.height:void 0}};function Ve(e,t){let n=[`pub=true`,...t.context??e.options.context!==!1?[]:[`context=false`],...e.options.analytics===!1?[`analytics=false`]:[]];return{kind:`iframe`,src:`https://imgur.com/${e.id}/embed?${n.join(`&`)}`,title:`Imgur post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Be,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function He(e,t){let n=M(e.options,{captioned:t.captioned}),r=`<blockquote${ke({"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:fe,minHeight:680,label:`Instagram`,hasFallback:N(e.fallbackHtml),maxWidth:540}}const Ue=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function We(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])=>Ue.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Ge(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 Ke={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},qe={small:236,medium:345,large:600};function Je(e,t){let n=M(e.options,{width:t.pinWidth}),r=`<a href="${j(e.url)}"${Ae(Ke,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:ge,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:qe[String(n.width)]??236}}const Ye={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},Xe={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 Ze(e,t){let n=[];for(let[e,r]of Object.entries(Ye)){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:Xe,startHeight:e.size?.height??316,maxWidth:640}}function Qe(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 $e={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 et(e,t){let n=[];for(let[e,r]of Object.entries($e)){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}}function tt(e){let t=i(e.options,[]).filter(([e])=>e===`pub`);return{kind:`iframe`,src:`https://rumble.com/embed/${e.id}/${a(t)}`,title:`Rumble video`,allow:`fullscreen`,ratio:{width:16,height:9},size:e.size}}const nt=/* @__PURE__ */ new Set([`track`,`episode`]);function rt(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??(nt.has(n)?152:352)}}const it={origin:`https://strava-embeds.com`,read(e){if(!Array.isArray(e))return;let[,t,n]=e;return t===`BROADCAST_IFRAME_HEIGHT`&&typeof n==`number`?n:void 0}};function at(e){return e===`minimal`?`minimal`:`standard`}function ot(e,t){let n=e.id.startsWith(`route/`),r=at(t.embedStyle??e.options.style),i=n&&(t.fullWidth??e.options.fullWidth===!0),a=t.mapHash??e.options.mapHash,o=`?style=${r}${i?`&fullWidth=true`:``}`,s=`#ns=social-embeds${typeof a==`string`&&a!==``?`&mapHash=${encodeURIComponent(a)}`:``}`;return{kind:`iframe`,src:`https://strava-embeds.com/${e.id}${o}${s}`,title:n?`Strava route`:`Strava activity`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:it,startHeight:650,...i?{}:{maxWidth:554}}}const st=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),ct={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function lt(e,t){let n=Object.entries(e.options).filter(([e])=>st.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,ct))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const ut=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function dt(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 ft={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 pt(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 ut){let n=dt(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:ft,startHeight:300,maxWidth:500}}function mt(e){return{kind:`iframe`,src:`https://tenor.com/embed/${e.id}`,title:`Tenor GIF`,allow:`fullscreen`,ratio:{width:133,height:100},size:e.size}}function ht(e,t){let n=M(e.options,{theme:t.theme}),r=`<blockquote${ke({"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:pe,minHeight:240,label:`Threads`,hasFallback:N(e.fallbackHtml),maxWidth:658}}const gt={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 _t(e,t){let n=o(t,gt);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}}function vt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const yt={origin:`https://truthsocial.com`,read:vt},bt={origin:`https://truthsocial.com`,read(e){let t=vt(e);return t===void 0||t<=0?void 0:t+165}},xt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function St(e){let t=xt.exec(e.url)?.[1];return t===void 0?{kind:`error`,message:`social-embeds: not a Truth Social post URL: ${e.url}`}:{kind:`iframe`,src:`https://truthsocial.com/${t}/${e.id}/embed`,title:`Truth Social post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:e.options.video===!0?bt:yt,startHeight:300,maxWidth:e.size?.width??600}}const Ct={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 wt(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:Ct,startHeight:400,maxWidth:540}}const Tt=[`channel`,`video`,`collection`,`clip`,`parent`];function Et(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 Dt(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]=Et(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Tt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,hostParam:`parent`}}const Ot={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 kt(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Ot),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 At={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function jt(e,t){let n=M(e.options,{...t}),r=e.fallbackHtml??`<a href="${j(e.url)}"></a>`,i=`<blockquote${Ae(At,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:ue,minHeight:250,label:`X`,hasFallback:N(e.fallbackHtml),maxWidth:550}}const Mt={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 Nt(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,Mt);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 Pt(e){switch(e.platform){case`x`:return jt(e,{});case`instagram`:return He(e,{});case`threads`:return ht(e,{});case`facebook`:return Fe(e,{});case`tiktok`:return _t(e,{});case`youtube`:return Nt(e,{});case`telegram`:return pt(e,{});case`snapchat`:return Qe(e);case`linkedin`:return Ge(e,{});case`reddit`:return Ze(e,{});case`pinterest`:return Je(e,{});case`spotify`:return rt(e,{});case`vimeo`:return kt(e,{});case`twitch`:return Dt(e,{});case`dailymotion`:return u(e,{});case`bluesky`:return c(e,{});case`soundcloud`:return et(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return wt(e);case`kick`:return We(e,{});case`giphy`:return ze(e);case`tenor`:return mt(e);case`streamable`:return lt(e,{});case`rumble`:return tt(e);case`truthsocial`:return St(e);case`imgur`:return Ve(e,{});case`strava`:return ot(e,{});case`flickr`:return Re(e,{});default:return e.platform}}const Ft=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function P(e){let t=Ft.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=It(t===-1?e:e.slice(0,t)),r=It(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 It(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function F(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function I(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function L(e,t){return e===t||e.startsWith(`${t}/`)}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=I(e.attrs.get(`width`)),n=I(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 V(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=Lt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Lt(e,t){return t===0?e:Lt(t,e%t)}const Rt=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,zt=/^\d{1,15}$/,Bt=`embed.music.apple.com`;function Vt(e,t){if(e?.host!==t)return null;let[,n,r,i]=Rt.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!zt.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!zt.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const Ht={platform:`applemusic`,parse(e){if(e.tag!==`iframe`)return null;let t=Vt(P(e.attrs.get(`src`)??``),Bt);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=Vt(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:e=>e.host===Bt},Ut=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,Wt=/^\d{1,15}$/,Gt=`embed.podcasts.apple.com`;function Kt(e,t){if(e?.host!==t)return null;let[,n,r]=Ut.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 qt={platform:`applepodcasts`,parse(e){if(e.tag!==`iframe`)return null;let t=Kt(P(e.attrs.get(`src`)??``),Gt);return t&&B({...t,options:{}},z(e))},isOwnScript:()=>!1,match(e){let t=Kt(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:e=>e.host===Gt},Jt=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,Yt=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,Xt=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Zt=RegExp(`^/profile/${Jt}/post/${Yt}/?$`),Qt=RegExp(`^at://${Jt}/app\\.bsky\\.feed\\.post/${Yt}$`),$t=/^[a-z2-7]{20,100}$/,en=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),tn=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,nn=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function rn(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 an(e){if(!e||!Xt.has(e.host))return null;let[,t,n]=Zt.exec(e.path)??[];return t===void 0||n===void 0?null:rn(t,n)}const on={platform:`bluesky`,fallback:nn,parse(e){if(e.tag!==`blockquote`||!O(e,`bluesky-embed`))return null;let[,t,n]=Qt.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=rn(t,n);if(k(e.children).reverse().map(e=>e.tag===`a`?an(P(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&&$t.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&en.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:A(e.children,nn)}},isOwnScript:e=>tn.test(e),match(e){let t=an(e);return t&&{...t,options:{}}}},sn=/^x[a-z0-9]{4,12}$/,cn=/^x[a-z0-9]{3,12}$/,ln=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,un=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),dn=`geo.dailymotion.com`,fn=`dai.ly`;function pn(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function mn(e){if(e.host!==dn||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(!sn.test(r)||n!==void 0&&!cn.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,F(t)]));return n!==void 0&&(i.playerId=n),pn(r,i)}function hn(e){if(e.host===fn){let t=e.path.replace(/^\/|\/$/g,``);return sn.test(t)?pn(t,{}):null}if(!un.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&sn.test(t)?pn(t,{}):null}const gn={platform:`dailymotion`,parse(e){let t=V(e,ln),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=P(n.attrs.get(`src`)??``);if(!r)return null;let i=mn(r)??hn(r);return i&&B(i,t?.size??z(n))},isOwnScript:()=>!1,match(e){return mn(e)??hn(e)},ownsFrame:e=>e.host===dn||e.host===fn||un.has(e.host)&&(L(e.path,`/embed`)||L(e.path,`/video`))},_n=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`m.facebook.com`]),vn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`]),H=`https://www.facebook.com`,yn=`[A-Za-z0-9.\\-]{1,80}`,bn=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,xn=RegExp(`^/(${yn})/posts/(${bn})/?$`),Sn=RegExp(`^/(${yn})/photos/([A-Za-z0-9.]{1,40})/(\\d{1,25})/?$`),Cn=RegExp(`^/(${yn})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),wn=/^\/reel\/(\d{1,25})\/?$/,Tn=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),En=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Dn=RegExp(`^${bn}$`),On=/^\d{1,25}$/,kn=/^(?: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`]],jn=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Mn={name:`class`,value:/^fb-xfbml-parse-ignore$/},Nn=/* @__PURE__ */ new Map([[`div`,[Mn]],[`blockquote`,[`cite`,Mn]],[`a`,[`href`]],[`p`,[]]]);function Pn(e){if(!e||!_n.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=xn.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${H}/${r}/posts/${i}`};if(Tn.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Dn.test(e))return null;let r=n.get(`id`),i=r!==void 0&&On.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${H}${t}?story_fbid=${e}${i}`}}if(En.has(t)){let e=n.get(`fbid`);return e===void 0||!On.test(e)?null:{kind:`post`,id:e,url:`${H}${t}?fbid=${e}`}}let[,a,o,s]=Sn.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${H}/${a}/photos/${o}/${s}/`};let[,c,l]=Cn.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${H}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!On.test(e)?null:{kind:`video`,id:e,url:`${H}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=wn.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${H}/reel/${u}`}}function U(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const Fn={platform:`facebook`,fallback:Nn,parse(e){if(e.tag===`div`){let t=O(e,`fb-post`)?`post`:O(e,`fb-video`)?`video`:null,n=Pn(P(e.attrs.get(`data-href`)??``));return!t||!n?null:{...U(n,t,`sdk`,R(e,An,F)),fallbackHtml:A(e.children,Nn)}}if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||!vn.has(t.host))return null;let n=Pn(P(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=F(r)),i!==void 0&&(e.width=F(i)),U(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=F(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of jn){let i=t.query.get(n);i!==void 0&&(e[r]=F(i))}let r=I(t.query.get(`width`)),i=I(t.query.get(`height`));return B(U(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return B(U(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,F(t)]))),z(e))}return null},isOwnScript:e=>kn.test(e),scriptOptions(e){let[,t]=kn.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=Pn(e);return t&&U(t,t.kind,`sdk`,{})},ownsFrame:e=>vn.has(e.host)&&L(e.path,`/plugins`)},In=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),Ln=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,Rn=`(\\d{1,20})`,zn=RegExp(`^/photos/${Ln}/${Rn}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),Bn=RegExp(`^/photos/${Ln}/(?:albums|sets)/${Rn}/?$`),Vn=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,Hn=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,Un=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,Wn=[`header`,`footer`,`context`],Gn=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,Kn=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:Gn},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function qn(e){if(e===``)return null;let t=0n;for(let n of e){let e=Un.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function Jn(e){let t=BigInt(e),n=``;for(;t>0n;)n=Un.charAt(Number(t%58n))+n,t/=58n;return n}function Yn(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function Xn(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function Zn(e){if(!e||!In.has(e.host))return null;let[,t,n]=Bn.exec(e.path)??[];if(t!==void 0&&n!==void 0)return Xn(t,n);let[,r,i]=zn.exec(e.path)??[];return r===void 0||i===void 0?null:Yn(r,i)}function Qn(e){if(e.host!==`flic.kr`)return null;let[,t]=Vn.exec(e.path)??[],n=t===void 0?null:qn(t);return t===void 0||n===null||Jn(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}function $n(e){let t=null;for(let n of e.children)if(!(n.type===`text`&&/^\s*$/.test(n.raw))){if(n.type!==`element`||n.tag!==`img`||t)return null;t=n}return t}const er={platform:`flickr`,fallback:Kn,parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=Zn(P(e.attrs.get(`href`)??``)),n=$n(e);if(!t||!n)return null;let r={};for(let t of Wn)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=z(n),a=Gn.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return B({...t,options:r,fallbackHtml:A([a],Kn)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>Hn.test(e),match(e){let t=Zn(e)??Qn(e);return t&&{...t,options:{}}}},tr=`([A-Za-z0-9]{6,40})`,W=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),nr=RegExp(`^/gifs/(?:[A-Za-z0-9-]{0,200}-)?${tr}/?$`),rr=RegExp(`^/embed/${tr}/?$`),ir=/^media\d?\.giphy\.com$/,ar=RegExp(`^/media/${tr}/giphy\\.(?:gif|webp|mp4)$`),or=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function sr(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function cr(e){if(e){if(W.has(e.host))return(nr.exec(e.path)??rr.exec(e.path))?.[1];if(ir.test(e.host))return ar.exec(e.path)?.[1]}}function lr(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=rr.exec(t.path)??[];return n===void 0?null:sr(n)}function ur(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=P(n.attrs.get(`href`)??``);if(!i||!W.has(i.host)||nr.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 dr={platform:`giphy`,parse(e){let t=V(e,or),n=t?.iframe??e,r=lr(n);return r?B({...r,options:{}},t?.size??z(n)):null},isOwnScript:()=>!1,isOwnExtra:ur,match(e){let t=cr(e);return t===void 0?null:{...sr(t),options:{}}},ownsFrame:e=>W.has(e.host)&&L(e.path,`/embed`)},fr=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),G=`([A-Za-z0-9]{5,7})`,pr=RegExp(`^(a/)?${G}$`),mr=RegExp(`^/a/${G}/?$`),hr=RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${G}/?$`),gr=RegExp(`^/${G}/?$`),_r=RegExp(`^/${G}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),vr=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/,yr=/* @__PURE__ */ new Set([`about`,`apps`,`blog`,`help`,`jobs`,`login`,`press`,`privacy`,`random`,`search`,`signin`,`signup`,`terms`,`tools`,`upload`,`account`,`contact`,`emerald`,`explore`,`gallery`,`hot`,`new`,`rules`,`user`]),br=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function xr(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function Sr(e){return e===void 0||yr.has(e.toLowerCase())?void 0:e}function Cr(e){if(!e)return;if(e.host===`i.imgur.com`)return Sr(_r.exec(e.path)?.[1]);if(!fr.has(e.host))return;let t=(mr.exec(e.path)??hr.exec(e.path))?.[1];return t===void 0?Sr(gr.exec(e.path)?.[1]):`a/${t}`}function wr(e){return e.map(e=>{if(e.type!==`element`)return e;let t=e.attrs.get(`href`),n=new Map(e.attrs);return e.tag===`a`&&t?.startsWith(`//`)&&n.set(`href`,`https:${t}`),{...e,attrs:n,children:wr(e.children)}})}function Tr(e,t){return e.attrs.get(t)===`false`}const Er={platform:`imgur`,fallback:br,parse(e){if(e.tag!==`blockquote`||!O(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=pr.exec(t)??[];if(r===void 0||n===void 0&&!Sr(r))return null;let i={};return Tr(e,`data-context`)&&(i.context=!1),Tr(e,`data-analytics`)&&(i.analytics=!1),{...xr(t),options:i,fallbackHtml:A(wr(e.children),br)}},isOwnScript:e=>vr.test(e),match(e){let t=Cr(e);return t===void 0?null:{...xr(t),options:{}}}},Dr=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Or=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,kr=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Ar=/* @__PURE__ */ new Set([`p`,`reel`]),jr=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Mr=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Nr(e){if(!e||!Dr.has(e.host))return null;let[,t,n,r]=Or.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(kr.has(t)||!Ar.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const Pr={platform:`instagram`,fallback:Mr,parse(e){if(e.tag!==`blockquote`||!O(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?k(e.children).reverse().map(e=>e.tag===`a`?Nr(P(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Nr(P(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=F(i)),{...n,options:r,fallbackHtml:A(e.children,Mr)}},isOwnScript:e=>jr.test(e),match(e){let t=Nr(e);return t&&{...t,options:{}}}},Fr=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),Ir=/^\/([A-Za-z0-9_-]{1,32})\/?$/,Lr=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),Rr=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function zr(e,t){if(!e||!t.has(e.host))return null;let[,n]=Ir.exec(e.path)??[];if(n===void 0||Lr.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const Br=/* @__PURE__ */ new Set([`player.kick.com`]),Vr={platform:`kick`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``),n=zr(t,Br);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>Rr.has(e)).map(([e,t])=>[e,F(t)]));return B({...n,options:r},z(e))},isOwnScript:()=>!1,match(e){let t=zr(e,Fr)??zr(e,Br);return t&&{...t,options:{}}},ownsFrame:e=>Br.has(e.host)},Hr=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,Ur=`www.linkedin.com`,Wr=`(activity|share|ugcPost):(\\d{19})`,Gr=RegExp(`^(?:/embed)?/feed/update/urn:li:${Wr}/?$`),Kr=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),qr=RegExp(`^/embed/feed/update/urn:li:${Wr}$`);function Jr(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 Yr=e=>e.replace(/%3A/gi,`:`),Xr={platform:`linkedin`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(t?.host!==Ur)return null;let[,n,r]=qr.exec(t.path)??[];return n===void 0||r===void 0?null:B(Jr(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,F(t)]))),z(e))},isOwnScript:()=>!1,match(e){if(!Hr.test(e.host))return null;let t=Yr(e.path),[,n,r]=Gr.exec(t)??Kr.exec(t)??[];return n===void 0||r===void 0?null:Jr(n,r)},ownsFrame:e=>e.host===Ur&&L(e.path,`/embed`)},Zr=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,Qr=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,$r=/^\d{1,25}$/,ei=`assets.pinterest.com`,ti=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,ni=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function ri(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function ii(e){if(!e||!Zr.test(e.host))return null;let[,t]=Qr.exec(e.path)??[];return t===void 0?null:ri(t)}const ai={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=ii(P(e.attrs.get(`href`)??``));return t&&{...t,options:R(e,ni,F)}}if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(t?.host!==ei||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&$r.test(n)?{...ri(n),options:{}}:null},isOwnScript:e=>ti.test(e),match(e){let t=ii(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===ei},oi=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),si=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/,ci=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,li=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function ui(e){if(!e||!oi.has(e.host))return null;let[,t,n,r,i]=si.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 di={platform:`reddit`,parse(e){if(e.tag!==`blockquote`||!O(e,`reddit-embed-bq`))return null;let t=k(e.children).map(e=>e.tag===`a`?ui(P(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=I(e.attrs.get(`data-embed-height`));return B({...t,options:R(e,li,F)},n===void 0?void 0:{height:n})},isOwnScript:e=>ci.test(e),match(e){let t=ui(e);return t&&{...t,options:{}}}},fi=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),pi=`([A-Za-z][A-Za-z0-9._-]{1,29})`,mi=RegExp(`^(?:/@${pi})?/spotlight/([A-Za-z0-9_-]{20,120})$`),hi=RegExp(`^/(?:@|add/)${pi}$`),gi=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,_i=RegExp(`^/@${pi}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),vi=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function yi(e){if(!e||!fi.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=mi.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]=hi.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=gi.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=_i.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const bi={platform:`snapchat`,parse(e){if(e.tag!==`blockquote`||!O(e,`snapchat-embed`))return null;let t=P(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=yi({...t,path:t.path.slice(0,-6)});if(!n||!k(e.children).filter(e=>e.tag===`a`).every(e=>{let t=yi(P(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=I(e.attrs.get(`data-snapchat-embed-width`)),a=I(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=>vi.test(e),match(e){let t=yi(e);return t&&{...t,options:{}}}},xi=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Si=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,Ci=`[a-z0-9_-]{1,64}`,wi=`s-[A-Za-z0-9]{1,32}`,Ti=RegExp(`^/(${Ci})(?:/(sets/${Ci}|${Ci})(?:/(${wi}))?)?/?$`,`i`),Ei=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Di=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Oi=RegExp(`^${wi}$`),ki=`w.soundcloud.com`;function Ai(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function ji(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Si.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Oi.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return Ai(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Mi(e){if(!xi.has(e.host))return null;let[,t,n,r]=Ti.exec(e.path)??[];if(t===void 0||Ei.has(t.toLowerCase())||n!==void 0&&Di.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return Ai(`https://soundcloud.com/${i}`,i)}const Ni=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function Pi(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!Ni.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&xi.has(P(e.attrs.get(`href`)??``)?.host??``)}function Fi(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&&Pi(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&Pi(r)}const Ii={platform:`soundcloud`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(t?.host!==ki||!/^\/player\/?$/.test(t.path))return null;let n=ji(P(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Oi.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,F(t)])),{height:a}=z(e)??{};return B({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:Fi,match(e){let t=ji(e)??Mi(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===ki},Li=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,Ri=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function zi(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function Bi(e,t){return e&&t.has(e.host)?Li.exec(e.path)?.[1]:void 0}const Vi={platform:`rumble`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``),n=Bi(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=F(i)),B({...zi(n),options:r},z(e))},isOwnScript:()=>!1,match(e){let t=Bi(e,Ri);return t===void 0?null:{...zi(t),options:{}}},ownsFrame:e=>e.host===`rumble.com`&&L(e.path,`/embed`)},Hi=/* @__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)?/?$`),Ui=/* @__PURE__ */ new Set([`utm_source`,`si`]),Wi=`open.spotify.com`;function Gi(e){if(e?.host!==Wi)return null;let[,t,n,r]=Hi.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 Ki(e){return Object.fromEntries([...e].filter(([e])=>!Ui.has(e)).map(([e,t])=>[e,F(t)]))}const qi={platform:`spotify`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=Gi(t);if(!n)return null;let{query:r,...i}=n;return B({...i,options:Ki(r)},z(e))},isOwnScript:()=>!1,match(e){let t=Gi(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:e=>e.host===Wi&&L(e.path,`/embed`)},Ji=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),Yi=/^\d{1,20}$/,Xi=/^\/(activities|routes)\/(\d{1,20})\/?$/,Zi=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,Qi=/* @__PURE__ */ new Set([`standard`,`minimal`]),$i=/^[A-Za-z0-9_-]{1,100}$/,ea={activity:`activities`,route:`routes`};function ta(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${ea[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}function na(e){return e===`activity`||e===`route`}const ra={platform:`strava`,parse(e){if(e.tag!==`div`||!O(e,`strava-embed-placeholder`)||!e.children.every(e=>e.type===`comment`||e.type===`text`&&/^\s*$/.test(e.raw)))return null;let t=e.attrs.get(`data-embed-type`),n=e.attrs.get(`data-embed-id`)??``;if(!na(t)||!Yi.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&Qi.has(i)&&(r.style=i),t===`route`&&e.attrs.get(`data-full-width`)===`true`&&(r.fullWidth=!0);let a=e.attrs.get(`data-map-hash`);return a!==void 0&&$i.test(a)&&(r.mapHash=a),{...ta(t,n),options:r}},isOwnScript:e=>Zi.test(e),match(e){if(!Ji.has(e.host))return null;let[,t,n]=Xi.exec(e.path)??[];return t===void 0||n===void 0?null:{...ta(t===`routes`?`route`:`activity`,n),options:{}}}},ia=`([a-z0-9]{4,8})`,aa=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),oa=RegExp(`^/[eo]/${ia}$`),sa=RegExp(`^/${ia}$`),ca=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]),la=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,ua=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),da=/<\/div\s*>$/i;function fa(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function pa(e){return e!==void 0&&!ca.has(e)}function ma(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=oa.exec(t.path)??[];if(!pa(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>ua.has(e)).map(([e,t])=>[e,F(t)]));return{...fa(n),options:r}}function ha(e){if(!e||!aa.has(e.host))return;let t=(oa.exec(e.path)??sa.exec(e.path))?.[1];return pa(t)?t:void 0}const ga={platform:`streamable`,parse(e){let t=V(e,la),n=t?.iframe??e,r=ma(n);return r?B(r,t?.size??z(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=da.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null},match(e){let t=ha(e);return t===void 0?null:{...fa(t),options:{}}},ownsFrame:e=>e.host===`streamable.com`&&(L(e.path,`/e`)||L(e.path,`/o`))},_a=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),va=`[A-Za-z][A-Za-z0-9_]{2,31}`,ya=RegExp(`^(${va})/(\\d{1,10})$`),ba=RegExp(`^/(?:s/)?(${va})/(\\d{1,10})/?$`),xa=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Sa=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Ca=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function wa(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const Ta={platform:`telegram`,parse:()=>null,parseScript(e){if(!xa.test(e.attrs.get(`src`)??``)||Sa.some(t=>e.attrs.has(t)))return null;let[,t,n]=ya.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=R(e,Ca,F);return e.attrs.has(`data-single`)&&(r.single=!0),wa(t,n,r)},isOwnScript:e=>xa.test(e),match(e){if(!_a.has(e.host))return null;let[,t,n]=ba.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)),wa(t,n,r)}},Ea=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),Da=`(\\d{1,20})`,Oa=RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${Da}/?$`),ka=RegExp(`^/embed/${Da}$`),Aa=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,ja=/^\d{1,3}(?:\.\d{1,4})?$/,Ma=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function Na(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function Pa(e){return e&&Ea.has(e.host)?Oa.exec(e.path)?.[1]:void 0}function Fa(e){let t=Math.round(e*1e4);if(!(t>0&&t<=1e6))return;let n=Ia(t,1e4);return{width:t/n,height:1e4/n}}function Ia(e,t){return t===0?e:Ia(t,e%t)}function La(e){if(!O(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!RegExp(`^${Da}$`).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!ja.test(n))return null;let r=Fa(n===void 0?1.33:Number(n));return r?B({...Na(t),options:{},fallbackHtml:A(e.children,Ma)},r):null}function Ra(e){let t=P(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=ka.exec(t.path)??[];return n===void 0?null:B({...Na(n),options:{}},z(e))}const za={platform:`tenor`,fallback:Ma,parse(e){return e.tag===`div`?La(e):e.tag===`iframe`?Ra(e):null},isOwnScript:e=>Aa.test(e),match(e){let t=Pa(e);return t===void 0?null:{...Na(t),options:{}}},ownsFrame:e=>e.host===`tenor.com`&&L(e.path,`/embed`)},Ba=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),Va=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,Ha=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,Ua=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Wa=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function Ga(e){if(!e||!Ba.has(e.host))return null;let[,t]=Va.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const Ka={platform:`threads`,fallback:Wa,parse(e){if(e.tag!==`blockquote`||!O(e,`text-post-media`))return null;let t=Ga(P(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,Ua,F),fallbackHtml:A(e.children,Wa)}},isOwnScript:e=>Ha.test(e),match(e){let t=Ga(e);return t&&{...t,options:{}}}},K=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),qa=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,Ja=/^\/player\/v1\/(\d{1,25})\/?$/,Ya=/^\d{1,25}$/,Xa=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;function Za(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const Qa={platform:`tiktok`,parse(e){if(e.tag===`blockquote`&&O(e,`tiktok-embed`)){let t=P(e.attrs.get(`cite`)??``),[,n,r]=t&&K.has(t.host)?qa.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Ya.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Za(a,n)}if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||!K.has(t.host))return null;let[,n]=Ja.exec(t.path)??[];return n===void 0?null:B(Za(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,F(t)]))),z(e))},isOwnScript:e=>Xa.test(e),match(e){if(!K.has(e.host))return null;let[,t,n]=qa.exec(e.path)??[];return t===void 0||n===void 0?null:Za(n,t)},ownsFrame:e=>K.has(e.host)&&L(e.path,`/player`)},$a=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),eo=`(@[A-Za-z0-9_.-]{1,64})`,to=`(\\d{1,25})`,no=RegExp(`^/${eo}/(?:posts/)?${to}/?$`),ro=RegExp(`^/${eo}/${to}/embed$`),io=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/;function ao(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function oo(e){if(!e||!$a.has(e.host))return null;let[,t,n]=no.exec(e.path)??[];return t===void 0||n===void 0?null:ao(t,n)}const so={platform:`truthsocial`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=ro.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=O(e,`truthsocial-video`)?{video:!0}:{};return B({...ao(n,r),options:i},z(e))},isOwnScript:e=>io.test(e),match(e){let t=oo(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`)},co=`([a-z0-9-]{1,32})`,lo=`(\\d{1,20})`,uo=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),fo=RegExp(`^/${co}/${lo}(?:/[^/]{1,200})?/?$`),po=RegExp(`^${co}\\.tumblr\\.com$`),mo=RegExp(`^/post/${lo}(?:/[^/]{1,200})?/?$`),ho=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${co})/${lo}/v2$`),go=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),_o=/^(?:https?:)?\/\/assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function vo(e){if(!e)return null;let t,n;return uo.has(e.host)?[,t,n]=fo.exec(e.path)??[]:([,t]=po.exec(e.host)??[],[,n]=mo.exec(e.path)??[]),t===void 0||n===void 0||go.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const yo={platform:`tumblr`,parse(e){if(e.tag!==`div`||!O(e,`tumblr-post`))return null;let t=P(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=ho.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=vo(P(i.attrs.get(`href`)??``));return o?.id!==r||n!==void 0&&o.url!==`https://www.tumblr.com/${n}/${r}`?null:{...o,options:{}}},isOwnScript:e=>_o.test(e),match(e){let t=vo(e);return t&&{...t,options:{}}}},bo=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),xo=`player.twitch.tv`,So=`clips.twitch.tv`,Co=/^[A-Za-z0-9_]{3,25}$/,wo=/^v?(\d{1,12})$/,To=/^[A-Za-z0-9_-]{6,30}$/,Eo=/^[A-Za-z0-9_-]{6,100}$/,Do=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,Oo=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),ko=[`autoplay`,`muted`,`time`];function q(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const Ao=e=>q(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),jo=e=>q(`https://www.twitch.tv/videos/${e}`,e),Mo=e=>q(`https://www.twitch.tv/collections/${e}`,e),No=e=>q(`https://clips.twitch.tv/${e}`,e);function Po(e){let t={};for(let n of ko){let r=e.get(n);r!==void 0&&(t[n]=F(r))}return t}function Fo(e){let t=e.query.get(`channel`);if(t!==void 0)return Co.test(t)?Ao(t):null;let[,n]=wo.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return jo(n);let r=e.query.get(`collection`);return r!==void 0&&To.test(r)?Mo(r):null}function Io(e){if(e.host===So){let t=e.path.replace(/^\/|\/$/g,``);return Eo.test(t)?{found:No(t),options:{}}:null}if(!bo.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=wo.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:jo(t),options:n!==void 0&&Do.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?To.test(r??``)?{found:Mo(r??``),options:{}}:null:t.length===3&&r===`clip`?Co.test(n)&&Eo.test(i??``)?{found:No(i??``),options:{}}:null:t.length===1&&Co.test(n)&&!Oo.has(n.toLowerCase())?{found:Ao(n),options:{}}:null}const Lo={platform:`twitch`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===xo&&/^\/?$/.test(t.path)&&(n=Fo(t)),t.host===So&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=Eo.test(e)?No(e):null}return n&&B({...n,options:Po(t.query)},z(e))},isOwnScript:()=>!1,match(e){let t=Io(e);return t&&{...t.found,options:t.options}},ownsFrame:e=>e.host===xo||e.host===So&&L(e.path,`/embed`)},Ro=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),J=`(\\d{1,12})`,zo=`([0-9a-f]{6,20})`,Bo=[RegExp(`^/${J}(?:/${zo})?/?$`),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}/?$`)],Vo=RegExp(`^/video/${J}/?$`),Ho=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Uo=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Wo=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Go=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/,Ko=`player.vimeo.com`;function qo(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Jo(e){let[,t]=Go.exec(e.fragment??``)??[];return t?{t}:{}}function Yo(e){if(e?.host!==Ko)return null;let[,t]=Vo.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${zo}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Wo.has(e)).map(([e,t])=>[e,F(t)]));return{...qo(t,n),options:{...r,...Jo(e)}}}const Xo={platform:`vimeo`,parse(e){let t=V(e,Ho),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Yo(P(n.attrs.get(`src`)??``));return r&&B(r,t?.size??z(n))},isOwnScript:e=>Uo.test(e),match(e){let t=Yo(e);if(t)return t;if(!Ro.has(e.host))return null;for(let t of Bo){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return{...qo(n,r),options:Jo(e)}}return null},ownsFrame:e=>e.host===Ko},Zo=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Qo=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,$o=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,es=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],ts=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function ns(e){if(!e||!Zo.has(e.host))return null;let[,t,n]=Qo.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 rs={platform:`x`,fallback:ts,parse(e){if(e.tag!==`blockquote`||!O(e,`twitter-tweet`))return null;let t=k(e.children).reverse().map(e=>e.tag===`a`?ns(P(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:R(e,es,F),fallbackHtml:A(e.children,ts)}:null},isOwnScript:e=>$o.test(e),match(e){let t=ns(e);return t&&{...t,options:{}}}},Y=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),is=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),as=/^(?!videoseries)[A-Za-z0-9_-]{11}$/,os=/^\/embed\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,ss=/^\/(shorts|embed|live)\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,cs=/^\/([A-Za-z0-9_-]{11})\/?$/,ls=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/;function us(e){if(e===void 0||e===``)return;let t=ls.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function ds(e){return us(e.get(`start`))??us(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 fs(e,t){let n=ds(e.query);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const Z=[rs,Pr,Fn,Ka,Qa,{platform:`youtube`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``),n=t!==null&&is.has(t.host);if(!t||!(n||Y.has(t.host)))return null;let[,r]=os.exec(t.path)??[];if(r===void 0)return null;let i=[...t.query].filter(([e])=>e!==`t`).map(([e,t])=>[e,F(t)]),a=Object.fromEntries(i),o=ds(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]=cs.exec(e.path)??[];return t===void 0?null:{...X(t),options:fs(e,!1)}}let t=is.has(e.host);if(!t&&!Y.has(e.host))return null;if(!t&&/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&as.test(t)?{...X(t),options:fs(e,!1)}:null}let[,n,r]=ss.exec(e.path)??[];return n===void 0||r===void 0||t&&n!==`embed`?null:{...X(r,n===`shorts`),options:fs(e,t)}},ownsFrame:e=>is.has(e.host)||Y.has(e.host)&&L(e.path,`/embed`)},Ta,bi,Xr,di,ai,qi,Xo,Lo,gn,Ii,Ht,qt,Vr,dr,za,ga,Vi,so,Er,ra,er,on,yo],ps=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],ms=/* @__PURE__ */ new Set([`allow-downloads`,`allow-forms`,`allow-modals`,`allow-orientation-lock`,`allow-pointer-lock`,`allow-popups`,`allow-popups-to-escape-sandbox`,`allow-presentation`,`allow-same-origin`,`allow-scripts`,`allow-top-navigation`,`allow-top-navigation-by-user-activation`,`allow-top-navigation-to-custom-protocols`]),hs=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),gs=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,_s=RegExp(`^(?:https:)?//${gs}(?:[/?#]|$)`,`i`),vs=RegExp(`^(?:\\*|'self'|'src'|'none'|https://${gs})$`,`i`),ys=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,bs=/[\t\n\f\r ]+/,xs=/^\s*(width|height)\s*:(.*)$/is,Ss=/^(\d+)px$/i,Cs=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function ws(e){if(typeof e!=`string`)return null;let t=D(e);if(!t)return null;let n=k(t),[r,...i]=n.filter(e=>e.tag===`iframe`);if(!r||i.length>0)return null;let a=n.find(e=>e.children.includes(r)),{attrs:o}=r,s=z(r)??Ns(r);return Es({src:o.get(`src`),title:o.get(`title`),allow:o.get(`allow`),allowFullscreen:o.has(`allowfullscreen`),referrerPolicy:o.get(`referrerpolicy`),sandbox:o.get(`sandbox`),scrolling:o.get(`scrolling`),size:s??{},ratio:s?void 0:a&&V(a,Cs)?.size})}function Ts(e){return Es(e)}function Es(e){if(typeof e!=`object`||!e)return null;let t=e,n=Ds(t.src);if(n===null)return null;let r=typeof t.title==`string`?t.title.trim():``,i=typeof t.referrerPolicy==`string`?t.referrerPolicy.toLowerCase():void 0,a=ps.find(e=>e===i),o=As(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Os(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:ks(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Ms(t.size),...o?{ratio:o}:{}}}function Ds(e){if(typeof e!=`string`)return null;let t=e.trim(),n=_s.test(t)&&!t.includes(`\\`)?P(t):null;if(!n||ys.test(n.path))return null;let r={...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)};return Z.some(e=>e.ownsFrame?.(r))?null:t.startsWith(`//`)?`https:${t}`:t}function Os(e){return e.split(`;`).map(e=>e.split(bs).filter(Boolean)).filter(([e,...t])=>e!==void 0&&hs.has(e)&&t.every(e=>vs.test(e))).map(e=>e.join(` `)).join(`; `)}function ks(e){let t=e.split(bs).map(e=>e.toLowerCase()).filter(e=>ms.has(e));return[...new Set(t)].join(` `)}function As(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return js(t)&&js(n)?{width:t,height:n}:void 0}function js(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Ms(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?I(String(t)):void 0,i=typeof n==`number`?I(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Ns(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=xs.exec(r)??[],a=I(Ss.exec(i.trim())?.[1]);e.toLowerCase()===`width`&&(t=a),e.toLowerCase()===`height`&&(n=a)}return t===void 0&&n===void 0?void 0:{width:t,height:n}}const Ps={width:16,height:9};function Fs(e){let t=Ts(e);return t?{kind:`iframe`,src:t.src,title:t.title??`Embedded content`,allow:t.allow,allowFullscreen:t.allowFullscreen,...t.referrerPolicy?{referrerPolicy:t.referrerPolicy}:{},...t.sandbox===void 0?{}:{sandbox:t.sandbox},...t.scrolling?{scrolling:t.scrolling}:{},...Is(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Is({size:e,ratio:t}){let{width:n,height:r}=e;return n!==void 0&&r!==void 0?{ratio:{width:n,height:r},maxWidth:n}:r===void 0?{ratio:t??Ps,...n===void 0?{}:{maxWidth:n}}:{ratio:Ps,height:r}}function Ls(e){if(typeof e!=`string`)return null;let t=P(e);if(!t)return null;for(let e of Z){let n=e.match(t);if(n)return n}return null}function Rs(e){if(typeof e!=`string`)return null;let t=D(e);return t?Bs(t):zs(e)}function zs(e){for(let t of Z){let n=t.repair?.(e),r=n==null?null:D(n),i=r&&Bs(r);if(i?.platform===t.platform)return i}return null}function Bs(e){let t,n,r=[],i=!1;for(let a of e)if(a.type!==`comment`){if(a.type===`text`){if(/^\s*$/.test(a.raw))continue;return null}if(a.tag===`script`)r.push(a);else if(Vs(a))i=!0;else if(t){if(n)return null;n=a}else t=a}if(!t){let[e]=r;if(i||r.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 a=e.parse(t);if(!a)continue;if(i&&!e.allowsFbRoot||n&&!e.isOwnExtra?.(n,a))return null;let o=r.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{...a,options:Object.assign({},...s,a.options)}}return null}function Vs(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}const Hs=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Us=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Ws=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,Gs=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),Ks=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function qs(e){let t=typeof e==`string`?P(e):null;if(!t)return null;if(Gs.has(t.host))return Ks.test(t.path)?`rumble`:null;if(!Hs.has(t.host))return null;let[,n]=Us.exec(t.path)??[];return n!==void 0&&Ws.test(n)?`bluesky`:null}const Js={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`],truthsocial:[`post iframe`],imgur:[`post iframe`],tenor:[`video iframe`],streamable:[`video iframe`],strava:[`post iframe`],flickr:[`post iframe`],rumble:[`video iframe`]};function Ys(e){let t=Ls(e.url);if(t?.platform!==e.platform||t.id!==e.id||t.url!==e.url||!Js[e.platform].includes(`${e.kind} ${e.variant}`))return null;if(e.fallbackHtml===void 0||Xs(e,e.fallbackHtml))return e;let n={...e};return delete n.fallbackHtml,n}function Xs(e,t){let n=Z.find(t=>t.platform===e.platform)?.fallback,r=D(t);if(!n||!r||A(r,n)!==t)return!1;if(e.platform!==`x`)return!0;let[i]=D(`<blockquote class="twitter-tweet">${t}</blockquote>`)??[];return i?.type===`element`&&rs.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`,truthsocial:`Truth Social`,imgur:`Imgur`,tenor:`Tenor`,streamable:`Streamable`,strava:`Strava`,flickr:`Flickr`,rumble:`Rumble`};function Zs(e){return`social-embeds: a ${Q[e]} URL needs a lookup: use the embed code`}function Qs(e,t,n){let r=t??(e===void 0?null:Ls(e));if(!r&&e!==void 0&&qs(e)===n)return{error:Zs(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=Ys(r);return i?{embed:i}:{error:`social-embeds: the ${Q[n]} embed's url and id do not match`}}function $s(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=qs(e.url);return t?Zs(t):`social-embeds: not a supported post URL: ${e.url}`}function ec(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function tc(e){return e===null?void 0:ec(e.trim().replace(/px$/i,``))}function nc(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function rc(e,t){let n=t??nc(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:ec(i)??(i?.trim()?i:void 0),maxWidth:tc(e.getAttribute(`max-width`)),height:tc(e.getAttribute(`height`)),maxHeight:tc(e.getAttribute(`max-height`))},eager:e.hasAttribute(`eager`)}}function ic(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function ac(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=ic(e),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`}}}function oc(e,t){let n=ic(e),r=Math.round(t*n.height/n.width),i=e.src.indexOf(`?`),a=i===-1?e.src:e.src.slice(0,i),o=i===-1?``:`&${e.src.slice(i+1)}`;return`${a}?width=${String(t)}&height=${String(r)}${o}`}function sc(e,t){let n,r,i=e=>{let i=Math.round(e);i<=0||(clearTimeout(r),i!==n&&(n===void 0?(n=i,t(i)):r=setTimeout(()=>{n=i,t(i)},200)))};if(typeof ResizeObserver>`u`)return i(e.getBoundingClientRect().width),()=>{};let a=new ResizeObserver(e=>{for(let t of e)i(t.contentRect.width)});return a.observe(e),()=>{a.disconnect(),clearTimeout(r)}}const cc=/* @__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`&&cc.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function lc(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 uc(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 dc(e,t){return`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(window.location.hostname)}`}function fc(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function pc(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o,...s}=n,{messageHeight:c}=t,l=document.createElement(`div`);$(l,ac(t,s));let u=fc(document.createElement(`div`)),d=fc(document.createElement(`div`)),f=i.length>0?i:[t.fallbackHtml===void 0?lc():mc(t.fallbackHtml,t.fallbackImage===!0)];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=e=>{let n=document.createElement(`iframe`);n.src=t.hostParam?dc(e,t.hostParam):e,n.title=t.title,n.setAttribute(`allow`,t.allow),t.allowFullscreen!==!1&&n.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.scrolling&&n.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&n.setAttribute(`sandbox`,t.sandbox),$(n,{display:`block`,width:`100%`,height:`100%`,border:0}),n.addEventListener(`load`,()=>{c||_()}),p?p.replaceWith(n):u.prepend(n),p=n,c&&window.addEventListener(`message`,v)},S=()=>{t.sizeInSrc?g.push(sc(u,e=>{x(oc(t,e))})):x(t.src)};return r?(S(),g.push(uc(u,!1,b))):g.push(uc(u,!1,()=>{S(),b()})),()=>{for(let e of g)e();clearTimeout(h),window.removeEventListener(`message`,v),l.remove()}}function mc(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}function hc(e){return e instanceof Error?e:Error(String(e))}function gc(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:[lc(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,hc(t));return}h=setTimeout(()=>{v(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},b=uc(d,a,()=>{r.load().then(()=>{y(1)},e=>{p||c(hc(e))})});return()=>{p=!0,b(),clearTimeout(h),g(),l.remove()}}const _c=typeof HTMLElement>`u`?class{}:HTMLElement;function vc(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}function yc(e){let t=`html`in e?Rs(e.html):Ls(e.url);if(!t){let t=`html`in e?ws(e.html):null;return t?Fs(t):{kind:`error`,message:$s(e)}}let n=Qs(void 0,t,t.platform);return n.error===void 0?Pt(n.embed):{kind:`error`,message:n.error}}const bc=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var xc=class extends _c{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 bc){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??=vc(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=rc(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=yc(n);if(c.kind===`error`){s(Error(c.message));return}let l={...r,eager:i,placeholder:t.map(e=>e.cloneNode(!0)),onLoad:()=>{o(new Event(`load`))},onError:s};this.#i=c.kind===`iframe`?pc(this,c,l):gc(this,c,l)}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,xc);export{xc 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,S=`v26.0`,ee=/^[a-z]{2,3}_[A-Z]{2}$/;function te(e){return()=>{let t=x().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}}const ne={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 re(){let e=x().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ie(e){let t=te(e);return()=>{let e=x().FB;return!t()&&e!==void 0&&!e.__buffer}}const ae={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:te(`instagram`),prepare:re,skipped:ie(`instagram`)},oe={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:te(`threads`),prepare:re,skipped:ie(`threads`)};function se(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${S}`,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 ce={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 C(e,{locale:t=`en_US`}={}){switch(e){case`x`:return p(ne);case`instagram`:return p(ae);case`threads`:return p(oe);case`pinterest`:return p(ce);case`facebook`:return ee.test(t)?p(se(t)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${t}"`))}}const w=()=>window;function T(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 E(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function le(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const ue={load:()=>C(`x`),render(e,t){let n=w().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=T(e,le,t);return E(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function de(){let e=w().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const fe={load:()=>C(`instagram`),render(e,t){let n=T(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return E(e,`instagram-media`),de(),n}},pe={load:()=>C(`threads`),render(e,t){let n=T(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return E(e,`text-post-media`),de(),n}},me=/* @__PURE__ */ new Map;function he(e){let t=me.get(e);return t||(t={load:()=>C(`facebook`,{locale:e}),render(e,t){let n=w().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:S}),i()}return()=>{}}},me.set(e,t)),t}const ge={load:()=>C(`pinterest`),render(e,t){let n=w().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=T(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}},_e=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),ve=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),ye=/<([a-zA-Z][a-zA-Z0-9-]*)/y,be=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,xe=/\s*(\/?)>/y,Se=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Ce=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function D(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}Se.lastIndex=a;let s=Se.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=Se.lastIndex;continue}let c=we(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:ve.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&&!_e.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function we(e,t){ye.lastIndex=t;let n=ye.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=ye.lastIndex;for(;;){xe.lastIndex=i;let t=xe.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:xe.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,Te(s??c??l??``)),i=be.lastIndex}}function Te(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 Ce.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 O(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function k(e){let t=[];return Ee(e,t),t}function Ee(e,t){for(let n of e)n.type===`element`&&(t.push(n),Ee(n.children,t))}const De=/* @__PURE__ */ new Set([`href`,`cite`]),Oe=/^https?:\/\//i;function A(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)||De.has(e)&&!Oe.test(i)||(n+=` ${e}="${j(i)}"`)}n+=`>`,_e.has(r.tag)||(n+=`${A(r.children,t)}</${r.tag}>`)}}return n}function j(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function ke(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${j(String(r))}"`);return t}function Ae(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return ke(n)}function M(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function N(e){return e!==void 0&&e.trim()!==``}const je={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Me={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},Ne={post:300,video:200};function Pe(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 Fe(e,t){if(e.variant===`iframe`)return Pe(e);let n=M(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(Me)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Pe({...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="${j(e.url)}"${Ae(je,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:he(i),minHeight:Ne[e.kind],label:`Facebook`,hasFallback:N(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}const Ie=[`header`,`footer`,`context`],Le=/\/albums\/\d+$/;function Re(e,t){let n=Le.test(e.url),r=Ie.filter(n=>t[n]??e.options[n]===!0),{width:i,height:a}=e.size??{},o=i!==void 0&&a!==void 0?{width:i,height:a}:void 0;return{kind:`iframe`,src:`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:{width:4,height:3},...o?{size:o,maxWidth:o.width}:{},sizeInSrc:!0,...e.fallbackHtml===void 0?{}:{fallbackHtml:e.fallbackHtml.replace(/<img(?=[\s>])/g,`<img style="display:block;width:100%;height:100%;object-fit:cover"`)},fallbackImage:!0}}function ze(e){return{kind:`iframe`,src:`https://giphy.com/embed/${e.id}`,title:`Giphy GIF`,allow:`fullscreen`,ratio:{width:1,height:1},size:e.size}}const Be={origin:`https://imgur.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.message===`resize_imgur`&&typeof t.height==`number`?t.height:void 0}};function Ve(e,t){let n=[`pub=true`,...t.context??e.options.context!==!1?[]:[`context=false`],...e.options.analytics===!1?[`analytics=false`]:[]];return{kind:`iframe`,src:`https://imgur.com/${e.id}/embed?${n.join(`&`)}`,title:`Imgur post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Be,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function He(e,t){let n=M(e.options,{captioned:t.captioned}),r=`<blockquote${ke({"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:fe,minHeight:680,label:`Instagram`,hasFallback:N(e.fallbackHtml),maxWidth:540}}const Ue=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function We(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])=>Ue.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Ge(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 Ke={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},qe={small:236,medium:345,large:600};function Je(e,t){let n=M(e.options,{width:t.pinWidth}),r=`<a href="${j(e.url)}"${Ae(Ke,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:ge,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:qe[String(n.width)]??236}}const Ye={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},Xe={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 Ze(e,t){let n=[];for(let[e,r]of Object.entries(Ye)){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:Xe,startHeight:e.size?.height??316,maxWidth:640}}function Qe(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 $e={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 et(e,t){let n=[];for(let[e,r]of Object.entries($e)){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}}function tt(e){let t=i(e.options,[]).filter(([e])=>e===`pub`);return{kind:`iframe`,src:`https://rumble.com/embed/${e.id}/${a(t)}`,title:`Rumble video`,allow:`fullscreen`,ratio:{width:16,height:9},size:e.size}}const nt=/* @__PURE__ */ new Set([`track`,`episode`]);function rt(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??(nt.has(n)?152:352)}}const it={origin:`https://strava-embeds.com`,read(e){if(!Array.isArray(e))return;let[,t,n]=e;return t===`BROADCAST_IFRAME_HEIGHT`&&typeof n==`number`?n:void 0}};function at(e){return e===`minimal`?`minimal`:`standard`}function ot(e,t){let n=e.id.startsWith(`route/`),r=at(t.embedStyle??e.options.style),i=n&&(t.fullWidth??e.options.fullWidth===!0),a=t.mapHash??e.options.mapHash,o=`?style=${r}${i?`&fullWidth=true`:``}`,s=`#ns=social-embeds${typeof a==`string`&&a!==``?`&mapHash=${encodeURIComponent(a)}`:``}`;return{kind:`iframe`,src:`https://strava-embeds.com/${e.id}${o}${s}`,title:n?`Strava route`:`Strava activity`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:it,startHeight:650,...i?{}:{maxWidth:554}}}const st=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),ct={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function lt(e,t){let n=Object.entries(e.options).filter(([e])=>st.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,ct))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const ut=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function dt(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 ft={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 pt(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 ut){let n=dt(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:ft,startHeight:300,maxWidth:500}}function mt(e){return{kind:`iframe`,src:`https://tenor.com/embed/${e.id}`,title:`Tenor GIF`,allow:`fullscreen`,ratio:{width:133,height:100},size:e.size}}function ht(e,t){let n=M(e.options,{theme:t.theme}),r=`<blockquote${ke({"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:pe,minHeight:240,label:`Threads`,hasFallback:N(e.fallbackHtml),maxWidth:658}}const gt={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 _t(e,t){let n=o(t,gt);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}}function vt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const yt={origin:`https://truthsocial.com`,read:vt},bt={origin:`https://truthsocial.com`,read(e){let t=vt(e);return t===void 0||t<=0?void 0:t+165}},xt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function St(e){let t=xt.exec(e.url)?.[1];return t===void 0?{kind:`error`,message:`social-embeds: not a Truth Social post URL: ${e.url}`}:{kind:`iframe`,src:`https://truthsocial.com/${t}/${e.id}/embed`,title:`Truth Social post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:e.options.video===!0?bt:yt,startHeight:150,maxWidth:e.size?.width??600}}const Ct={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 wt(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:Ct,startHeight:400,maxWidth:540}}const Tt=[`channel`,`video`,`collection`,`clip`,`parent`];function Et(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 Dt(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]=Et(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Tt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,hostParam:`parent`}}const Ot={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 kt(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Ot),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 At={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function jt(e,t){let n=M(e.options,{...t}),r=e.fallbackHtml??`<a href="${j(e.url)}"></a>`,i=`<blockquote${Ae(At,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:ue,minHeight:250,label:`X`,hasFallback:N(e.fallbackHtml),maxWidth:550}}const Mt={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 Nt(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,Mt);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 Pt(e){switch(e.platform){case`x`:return jt(e,{});case`instagram`:return He(e,{});case`threads`:return ht(e,{});case`facebook`:return Fe(e,{});case`tiktok`:return _t(e,{});case`youtube`:return Nt(e,{});case`telegram`:return pt(e,{});case`snapchat`:return Qe(e);case`linkedin`:return Ge(e,{});case`reddit`:return Ze(e,{});case`pinterest`:return Je(e,{});case`spotify`:return rt(e,{});case`vimeo`:return kt(e,{});case`twitch`:return Dt(e,{});case`dailymotion`:return u(e,{});case`bluesky`:return c(e,{});case`soundcloud`:return et(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return wt(e);case`kick`:return We(e,{});case`giphy`:return ze(e);case`tenor`:return mt(e);case`streamable`:return lt(e,{});case`rumble`:return tt(e);case`truthsocial`:return St(e);case`imgur`:return Ve(e,{});case`strava`:return ot(e,{});case`flickr`:return Re(e,{});default:return e.platform}}const Ft=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function P(e){let t=Ft.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=It(t===-1?e:e.slice(0,t)),r=It(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 It(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function F(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function I(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function L(e,t){return e===t||e.startsWith(`${t}/`)}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=I(e.attrs.get(`width`)),n=I(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 V(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=Lt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Lt(e,t){return t===0?e:Lt(t,e%t)}const Rt=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,zt=/^\d{1,15}$/,Bt=`embed.music.apple.com`;function Vt(e,t){if(e?.host!==t)return null;let[,n,r,i]=Rt.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!zt.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!zt.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const Ht={platform:`applemusic`,parse(e){if(e.tag!==`iframe`)return null;let t=Vt(P(e.attrs.get(`src`)??``),Bt);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=Vt(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:e=>e.host===Bt},Ut=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,Wt=/^\d{1,15}$/,Gt=`embed.podcasts.apple.com`;function Kt(e,t){if(e?.host!==t)return null;let[,n,r]=Ut.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 qt={platform:`applepodcasts`,parse(e){if(e.tag!==`iframe`)return null;let t=Kt(P(e.attrs.get(`src`)??``),Gt);return t&&B({...t,options:{}},z(e))},isOwnScript:()=>!1,match(e){let t=Kt(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:e=>e.host===Gt},Jt=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,Yt=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,Xt=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Zt=RegExp(`^/profile/${Jt}/post/${Yt}/?$`),Qt=RegExp(`^at://${Jt}/app\\.bsky\\.feed\\.post/${Yt}$`),$t=/^[a-z2-7]{20,100}$/,en=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),tn=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,nn=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function rn(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 an(e){if(!e||!Xt.has(e.host))return null;let[,t,n]=Zt.exec(e.path)??[];return t===void 0||n===void 0?null:rn(t,n)}const on={platform:`bluesky`,fallback:nn,parse(e){if(e.tag!==`blockquote`||!O(e,`bluesky-embed`))return null;let[,t,n]=Qt.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=rn(t,n);if(k(e.children).reverse().map(e=>e.tag===`a`?an(P(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&&$t.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&en.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:A(e.children,nn)}},isOwnScript:e=>tn.test(e),match(e){let t=an(e);return t&&{...t,options:{}}}},sn=/^x[a-z0-9]{4,12}$/,cn=/^x[a-z0-9]{3,12}$/,ln=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,un=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),dn=`geo.dailymotion.com`,fn=`dai.ly`;function pn(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function mn(e){if(e.host!==dn||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(!sn.test(r)||n!==void 0&&!cn.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,F(t)]));return n!==void 0&&(i.playerId=n),pn(r,i)}function hn(e){if(e.host===fn){let t=e.path.replace(/^\/|\/$/g,``);return sn.test(t)?pn(t,{}):null}if(!un.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&sn.test(t)?pn(t,{}):null}const gn={platform:`dailymotion`,parse(e){let t=V(e,ln),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=P(n.attrs.get(`src`)??``);if(!r)return null;let i=mn(r)??hn(r);return i&&B(i,t?.size??z(n))},isOwnScript:()=>!1,match(e){return mn(e)??hn(e)},ownsFrame:e=>e.host===dn||e.host===fn||un.has(e.host)&&(L(e.path,`/embed`)||L(e.path,`/video`))},_n=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`m.facebook.com`]),vn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`]),H=`https://www.facebook.com`,yn=`[A-Za-z0-9.\\-]{1,80}`,bn=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,xn=RegExp(`^/(${yn})/posts/(${bn})/?$`),Sn=RegExp(`^/(${yn})/photos/([A-Za-z0-9.]{1,40})/(\\d{1,25})/?$`),Cn=RegExp(`^/(${yn})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),wn=/^\/reel\/(\d{1,25})\/?$/,Tn=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),En=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Dn=RegExp(`^${bn}$`),On=/^\d{1,25}$/,kn=/^(?: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`]],jn=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Mn={name:`class`,value:/^fb-xfbml-parse-ignore$/},Nn=/* @__PURE__ */ new Map([[`div`,[Mn]],[`blockquote`,[`cite`,Mn]],[`a`,[`href`]],[`p`,[]]]);function Pn(e){if(!e||!_n.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=xn.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${H}/${r}/posts/${i}`};if(Tn.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Dn.test(e))return null;let r=n.get(`id`),i=r!==void 0&&On.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${H}${t}?story_fbid=${e}${i}`}}if(En.has(t)){let e=n.get(`fbid`);return e===void 0||!On.test(e)?null:{kind:`post`,id:e,url:`${H}${t}?fbid=${e}`}}let[,a,o,s]=Sn.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${H}/${a}/photos/${o}/${s}/`};let[,c,l]=Cn.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${H}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!On.test(e)?null:{kind:`video`,id:e,url:`${H}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=wn.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${H}/reel/${u}`}}function U(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const Fn={platform:`facebook`,fallback:Nn,parse(e){if(e.tag===`div`){let t=O(e,`fb-post`)?`post`:O(e,`fb-video`)?`video`:null,n=Pn(P(e.attrs.get(`data-href`)??``));return!t||!n?null:{...U(n,t,`sdk`,R(e,An,F)),fallbackHtml:A(e.children,Nn)}}if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||!vn.has(t.host))return null;let n=Pn(P(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=F(r)),i!==void 0&&(e.width=F(i)),U(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=F(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of jn){let i=t.query.get(n);i!==void 0&&(e[r]=F(i))}let r=I(t.query.get(`width`)),i=I(t.query.get(`height`));return B(U(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return B(U(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,F(t)]))),z(e))}return null},isOwnScript:e=>kn.test(e),scriptOptions(e){let[,t]=kn.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=Pn(e);return t&&U(t,t.kind,`sdk`,{})},ownsFrame:e=>vn.has(e.host)&&L(e.path,`/plugins`)},In=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),Ln=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,Rn=`(\\d{1,20})`,zn=RegExp(`^/photos/${Ln}/${Rn}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),Bn=RegExp(`^/photos/${Ln}/(?:albums|sets)/${Rn}/?$`),Vn=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,Hn=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,Un=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,Wn=[`header`,`footer`,`context`],Gn=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,Kn=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:Gn},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function qn(e){if(e===``)return null;let t=0n;for(let n of e){let e=Un.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function Jn(e){let t=BigInt(e),n=``;for(;t>0n;)n=Un.charAt(Number(t%58n))+n,t/=58n;return n}function Yn(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function Xn(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function Zn(e){if(!e||!In.has(e.host))return null;let[,t,n]=Bn.exec(e.path)??[];if(t!==void 0&&n!==void 0)return Xn(t,n);let[,r,i]=zn.exec(e.path)??[];return r===void 0||i===void 0?null:Yn(r,i)}function Qn(e){if(e.host!==`flic.kr`)return null;let[,t]=Vn.exec(e.path)??[],n=t===void 0?null:qn(t);return t===void 0||n===null||Jn(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}function $n(e){let t=null;for(let n of e.children)if(!(n.type===`text`&&/^\s*$/.test(n.raw))){if(n.type!==`element`||n.tag!==`img`||t)return null;t=n}return t}const er={platform:`flickr`,fallback:Kn,parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=Zn(P(e.attrs.get(`href`)??``)),n=$n(e);if(!t||!n)return null;let r={};for(let t of Wn)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=z(n),a=Gn.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return B({...t,options:r,fallbackHtml:A([a],Kn)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>Hn.test(e),match(e){let t=Zn(e)??Qn(e);return t&&{...t,options:{}}}},tr=`([A-Za-z0-9]{6,40})`,W=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),nr=RegExp(`^/gifs/(?:[A-Za-z0-9-]{0,200}-)?${tr}/?$`),rr=RegExp(`^/embed/${tr}/?$`),ir=/^media\d?\.giphy\.com$/,ar=RegExp(`^/media/${tr}/giphy\\.(?:gif|webp|mp4)$`),or=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function sr(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function cr(e){if(e){if(W.has(e.host))return(nr.exec(e.path)??rr.exec(e.path))?.[1];if(ir.test(e.host))return ar.exec(e.path)?.[1]}}function lr(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=rr.exec(t.path)??[];return n===void 0?null:sr(n)}function ur(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=P(n.attrs.get(`href`)??``);if(!i||!W.has(i.host)||nr.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 dr={platform:`giphy`,parse(e){let t=V(e,or),n=t?.iframe??e,r=lr(n);return r?B({...r,options:{}},t?.size??z(n)):null},isOwnScript:()=>!1,isOwnExtra:ur,match(e){let t=cr(e);return t===void 0?null:{...sr(t),options:{}}},ownsFrame:e=>W.has(e.host)&&L(e.path,`/embed`)},fr=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),G=`([A-Za-z0-9]{5,7})`,pr=RegExp(`^(a/)?${G}$`),mr=RegExp(`^/a/${G}/?$`),hr=RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${G}/?$`),gr=RegExp(`^/${G}/?$`),_r=RegExp(`^/${G}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),vr=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/,yr=/* @__PURE__ */ new Set([`about`,`apps`,`blog`,`help`,`jobs`,`login`,`press`,`privacy`,`random`,`search`,`signin`,`signup`,`terms`,`tools`,`upload`,`account`,`contact`,`emerald`,`explore`,`gallery`,`hot`,`new`,`rules`,`user`]),br=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function xr(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function Sr(e){return e===void 0||yr.has(e.toLowerCase())?void 0:e}function Cr(e){if(!e)return;if(e.host===`i.imgur.com`)return Sr(_r.exec(e.path)?.[1]);if(!fr.has(e.host))return;let t=(mr.exec(e.path)??hr.exec(e.path))?.[1];return t===void 0?Sr(gr.exec(e.path)?.[1]):`a/${t}`}function wr(e){return e.map(e=>{if(e.type!==`element`)return e;let t=e.attrs.get(`href`),n=new Map(e.attrs);return e.tag===`a`&&t?.startsWith(`//`)&&n.set(`href`,`https:${t}`),{...e,attrs:n,children:wr(e.children)}})}function Tr(e,t){return e.attrs.get(t)===`false`}const Er={platform:`imgur`,fallback:br,parse(e){if(e.tag!==`blockquote`||!O(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=pr.exec(t)??[];if(r===void 0||n===void 0&&!Sr(r))return null;let i={};return Tr(e,`data-context`)&&(i.context=!1),Tr(e,`data-analytics`)&&(i.analytics=!1),{...xr(t),options:i,fallbackHtml:A(wr(e.children),br)}},isOwnScript:e=>vr.test(e),match(e){let t=Cr(e);return t===void 0?null:{...xr(t),options:{}}}},Dr=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Or=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,kr=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Ar=/* @__PURE__ */ new Set([`p`,`reel`]),jr=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Mr=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Nr(e){if(!e||!Dr.has(e.host))return null;let[,t,n,r]=Or.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(kr.has(t)||!Ar.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const Pr={platform:`instagram`,fallback:Mr,parse(e){if(e.tag!==`blockquote`||!O(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?k(e.children).reverse().map(e=>e.tag===`a`?Nr(P(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Nr(P(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=F(i)),{...n,options:r,fallbackHtml:A(e.children,Mr)}},isOwnScript:e=>jr.test(e),match(e){let t=Nr(e);return t&&{...t,options:{}}}},Fr=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),Ir=/^\/([A-Za-z0-9_-]{1,32})\/?$/,Lr=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),Rr=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function zr(e,t){if(!e||!t.has(e.host))return null;let[,n]=Ir.exec(e.path)??[];if(n===void 0||Lr.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const Br=/* @__PURE__ */ new Set([`player.kick.com`]),Vr={platform:`kick`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``),n=zr(t,Br);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>Rr.has(e)).map(([e,t])=>[e,F(t)]));return B({...n,options:r},z(e))},isOwnScript:()=>!1,match(e){let t=zr(e,Fr)??zr(e,Br);return t&&{...t,options:{}}},ownsFrame:e=>Br.has(e.host)},Hr=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,Ur=`www.linkedin.com`,Wr=`(activity|share|ugcPost):(\\d{19})`,Gr=RegExp(`^(?:/embed)?/feed/update/urn:li:${Wr}/?$`),Kr=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),qr=RegExp(`^/embed/feed/update/urn:li:${Wr}$`);function Jr(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 Yr=e=>e.replace(/%3A/gi,`:`),Xr={platform:`linkedin`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(t?.host!==Ur)return null;let[,n,r]=qr.exec(t.path)??[];return n===void 0||r===void 0?null:B(Jr(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,F(t)]))),z(e))},isOwnScript:()=>!1,match(e){if(!Hr.test(e.host))return null;let t=Yr(e.path),[,n,r]=Gr.exec(t)??Kr.exec(t)??[];return n===void 0||r===void 0?null:Jr(n,r)},ownsFrame:e=>e.host===Ur&&L(e.path,`/embed`)},Zr=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,Qr=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,$r=/^\d{1,25}$/,ei=`assets.pinterest.com`,ti=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,ni=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function ri(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function ii(e){if(!e||!Zr.test(e.host))return null;let[,t]=Qr.exec(e.path)??[];return t===void 0?null:ri(t)}const ai={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=ii(P(e.attrs.get(`href`)??``));return t&&{...t,options:R(e,ni,F)}}if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(t?.host!==ei||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&$r.test(n)?{...ri(n),options:{}}:null},isOwnScript:e=>ti.test(e),match(e){let t=ii(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===ei},oi=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),si=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/,ci=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,li=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function ui(e){if(!e||!oi.has(e.host))return null;let[,t,n,r,i]=si.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 di={platform:`reddit`,parse(e){if(e.tag!==`blockquote`||!O(e,`reddit-embed-bq`))return null;let t=k(e.children).map(e=>e.tag===`a`?ui(P(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=I(e.attrs.get(`data-embed-height`));return B({...t,options:R(e,li,F)},n===void 0?void 0:{height:n})},isOwnScript:e=>ci.test(e),match(e){let t=ui(e);return t&&{...t,options:{}}}},fi=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),pi=`([A-Za-z][A-Za-z0-9._-]{1,29})`,mi=RegExp(`^(?:/@${pi})?/spotlight/([A-Za-z0-9_-]{20,120})$`),hi=RegExp(`^/(?:@|add/)${pi}$`),gi=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,_i=RegExp(`^/@${pi}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),vi=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function yi(e){if(!e||!fi.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=mi.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]=hi.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=gi.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=_i.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const bi={platform:`snapchat`,parse(e){if(e.tag!==`blockquote`||!O(e,`snapchat-embed`))return null;let t=P(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=yi({...t,path:t.path.slice(0,-6)});if(!n||!k(e.children).filter(e=>e.tag===`a`).every(e=>{let t=yi(P(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=I(e.attrs.get(`data-snapchat-embed-width`)),a=I(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=>vi.test(e),match(e){let t=yi(e);return t&&{...t,options:{}}}},xi=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Si=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,Ci=`[a-z0-9_-]{1,64}`,wi=`s-[A-Za-z0-9]{1,32}`,Ti=RegExp(`^/(${Ci})(?:/(sets/${Ci}|${Ci})(?:/(${wi}))?)?/?$`,`i`),Ei=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Di=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Oi=RegExp(`^${wi}$`),ki=`w.soundcloud.com`;function Ai(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function ji(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Si.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Oi.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return Ai(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Mi(e){if(!xi.has(e.host))return null;let[,t,n,r]=Ti.exec(e.path)??[];if(t===void 0||Ei.has(t.toLowerCase())||n!==void 0&&Di.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return Ai(`https://soundcloud.com/${i}`,i)}const Ni=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function Pi(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!Ni.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&xi.has(P(e.attrs.get(`href`)??``)?.host??``)}function Fi(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&&Pi(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&Pi(r)}const Ii={platform:`soundcloud`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(t?.host!==ki||!/^\/player\/?$/.test(t.path))return null;let n=ji(P(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Oi.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,F(t)])),{height:a}=z(e)??{};return B({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:Fi,match(e){let t=ji(e)??Mi(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===ki},Li=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,Ri=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function zi(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function Bi(e,t){return e&&t.has(e.host)?Li.exec(e.path)?.[1]:void 0}const Vi={platform:`rumble`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``),n=Bi(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=F(i)),B({...zi(n),options:r},z(e))},isOwnScript:()=>!1,match(e){let t=Bi(e,Ri);return t===void 0?null:{...zi(t),options:{}}},ownsFrame:e=>e.host===`rumble.com`&&L(e.path,`/embed`)},Hi=/* @__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)?/?$`),Ui=/* @__PURE__ */ new Set([`utm_source`,`si`]),Wi=`open.spotify.com`;function Gi(e){if(e?.host!==Wi)return null;let[,t,n,r]=Hi.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 Ki(e){return Object.fromEntries([...e].filter(([e])=>!Ui.has(e)).map(([e,t])=>[e,F(t)]))}const qi={platform:`spotify`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=Gi(t);if(!n)return null;let{query:r,...i}=n;return B({...i,options:Ki(r)},z(e))},isOwnScript:()=>!1,match(e){let t=Gi(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:e=>e.host===Wi&&L(e.path,`/embed`)},Ji=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),Yi=/^\d{1,20}$/,Xi=/^\/(activities|routes)\/(\d{1,20})\/?$/,Zi=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,Qi=/* @__PURE__ */ new Set([`standard`,`minimal`]),$i=/^[A-Za-z0-9_-]{1,100}$/,ea={activity:`activities`,route:`routes`};function ta(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${ea[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}function na(e){return e===`activity`||e===`route`}const ra={platform:`strava`,parse(e){if(e.tag!==`div`||!O(e,`strava-embed-placeholder`)||!e.children.every(e=>e.type===`comment`||e.type===`text`&&/^\s*$/.test(e.raw)))return null;let t=e.attrs.get(`data-embed-type`),n=e.attrs.get(`data-embed-id`)??``;if(!na(t)||!Yi.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&Qi.has(i)&&(r.style=i),t===`route`&&e.attrs.get(`data-full-width`)===`true`&&(r.fullWidth=!0);let a=e.attrs.get(`data-map-hash`);return a!==void 0&&$i.test(a)&&(r.mapHash=a),{...ta(t,n),options:r}},isOwnScript:e=>Zi.test(e),match(e){if(!Ji.has(e.host))return null;let[,t,n]=Xi.exec(e.path)??[];return t===void 0||n===void 0?null:{...ta(t===`routes`?`route`:`activity`,n),options:{}}}},ia=`([a-z0-9]{4,8})`,aa=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),oa=RegExp(`^/[eo]/${ia}$`),sa=RegExp(`^/${ia}$`),ca=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]),la=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,ua=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),da=/<\/div\s*>$/i;function fa(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function pa(e){return e!==void 0&&!ca.has(e)}function ma(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=oa.exec(t.path)??[];if(!pa(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>ua.has(e)).map(([e,t])=>[e,F(t)]));return{...fa(n),options:r}}function ha(e){if(!e||!aa.has(e.host))return;let t=(oa.exec(e.path)??sa.exec(e.path))?.[1];return pa(t)?t:void 0}const ga={platform:`streamable`,parse(e){let t=V(e,la),n=t?.iframe??e,r=ma(n);return r?B(r,t?.size??z(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=da.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null},match(e){let t=ha(e);return t===void 0?null:{...fa(t),options:{}}},ownsFrame:e=>e.host===`streamable.com`&&(L(e.path,`/e`)||L(e.path,`/o`))},_a=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),va=`[A-Za-z][A-Za-z0-9_]{2,31}`,ya=RegExp(`^(${va})/(\\d{1,10})$`),ba=RegExp(`^/(?:s/)?(${va})/(\\d{1,10})/?$`),xa=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Sa=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Ca=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function wa(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const Ta={platform:`telegram`,parse:()=>null,parseScript(e){if(!xa.test(e.attrs.get(`src`)??``)||Sa.some(t=>e.attrs.has(t)))return null;let[,t,n]=ya.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=R(e,Ca,F);return e.attrs.has(`data-single`)&&(r.single=!0),wa(t,n,r)},isOwnScript:e=>xa.test(e),match(e){if(!_a.has(e.host))return null;let[,t,n]=ba.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)),wa(t,n,r)}},Ea=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),Da=`(\\d{1,20})`,Oa=RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${Da}/?$`),ka=RegExp(`^/embed/${Da}$`),Aa=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,ja=/^\d{1,3}(?:\.\d{1,4})?$/,Ma=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function Na(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function Pa(e){return e&&Ea.has(e.host)?Oa.exec(e.path)?.[1]:void 0}function Fa(e){let t=Math.round(e*1e4);if(!(t>0&&t<=1e6))return;let n=Ia(t,1e4);return{width:t/n,height:1e4/n}}function Ia(e,t){return t===0?e:Ia(t,e%t)}function La(e){if(!O(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!RegExp(`^${Da}$`).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!ja.test(n))return null;let r=Fa(n===void 0?1.33:Number(n));return r?B({...Na(t),options:{},fallbackHtml:A(e.children,Ma)},r):null}function Ra(e){let t=P(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=ka.exec(t.path)??[];return n===void 0?null:B({...Na(n),options:{}},z(e))}const za={platform:`tenor`,fallback:Ma,parse(e){return e.tag===`div`?La(e):e.tag===`iframe`?Ra(e):null},isOwnScript:e=>Aa.test(e),match(e){let t=Pa(e);return t===void 0?null:{...Na(t),options:{}}},ownsFrame:e=>e.host===`tenor.com`&&L(e.path,`/embed`)},Ba=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),Va=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,Ha=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,Ua=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Wa=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function Ga(e){if(!e||!Ba.has(e.host))return null;let[,t]=Va.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const Ka={platform:`threads`,fallback:Wa,parse(e){if(e.tag!==`blockquote`||!O(e,`text-post-media`))return null;let t=Ga(P(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,Ua,F),fallbackHtml:A(e.children,Wa)}},isOwnScript:e=>Ha.test(e),match(e){let t=Ga(e);return t&&{...t,options:{}}}},K=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),qa=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,Ja=/^\/player\/v1\/(\d{1,25})\/?$/,Ya=/^\d{1,25}$/,Xa=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;function Za(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const Qa={platform:`tiktok`,parse(e){if(e.tag===`blockquote`&&O(e,`tiktok-embed`)){let t=P(e.attrs.get(`cite`)??``),[,n,r]=t&&K.has(t.host)?qa.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Ya.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Za(a,n)}if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||!K.has(t.host))return null;let[,n]=Ja.exec(t.path)??[];return n===void 0?null:B(Za(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,F(t)]))),z(e))},isOwnScript:e=>Xa.test(e),match(e){if(!K.has(e.host))return null;let[,t,n]=qa.exec(e.path)??[];return t===void 0||n===void 0?null:Za(n,t)},ownsFrame:e=>K.has(e.host)&&L(e.path,`/player`)},$a=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),eo=`(@[A-Za-z0-9_.-]{1,64})`,to=`(\\d{1,25})`,no=RegExp(`^/${eo}/(?:posts/)?${to}/?$`),ro=RegExp(`^/${eo}/${to}/embed$`),io=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/;function ao(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function oo(e){if(!e||!$a.has(e.host))return null;let[,t,n]=no.exec(e.path)??[];return t===void 0||n===void 0?null:ao(t,n)}const so={platform:`truthsocial`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=ro.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=O(e,`truthsocial-video`)?{video:!0}:{};return B({...ao(n,r),options:i},z(e))},isOwnScript:e=>io.test(e),match(e){let t=oo(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`)},co=`([a-z0-9-]{1,32})`,lo=`(\\d{1,20})`,uo=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),fo=RegExp(`^/${co}/${lo}(?:/[^/]{1,200})?/?$`),po=RegExp(`^${co}\\.tumblr\\.com$`),mo=RegExp(`^/post/${lo}(?:/[^/]{1,200})?/?$`),ho=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${co})/${lo}/v2$`),go=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),_o=/^(?:https?:)?\/\/assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function vo(e){if(!e)return null;let t,n;return uo.has(e.host)?[,t,n]=fo.exec(e.path)??[]:([,t]=po.exec(e.host)??[],[,n]=mo.exec(e.path)??[]),t===void 0||n===void 0||go.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const yo={platform:`tumblr`,parse(e){if(e.tag!==`div`||!O(e,`tumblr-post`))return null;let t=P(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=ho.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=vo(P(i.attrs.get(`href`)??``));return o?.id!==r||n!==void 0&&o.url!==`https://www.tumblr.com/${n}/${r}`?null:{...o,options:{}}},isOwnScript:e=>_o.test(e),match(e){let t=vo(e);return t&&{...t,options:{}}}},bo=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),xo=`player.twitch.tv`,So=`clips.twitch.tv`,Co=/^[A-Za-z0-9_]{3,25}$/,wo=/^v?(\d{1,12})$/,To=/^[A-Za-z0-9_-]{6,30}$/,Eo=/^[A-Za-z0-9_-]{6,100}$/,Do=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,Oo=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),ko=[`autoplay`,`muted`,`time`];function q(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const Ao=e=>q(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),jo=e=>q(`https://www.twitch.tv/videos/${e}`,e),Mo=e=>q(`https://www.twitch.tv/collections/${e}`,e),No=e=>q(`https://clips.twitch.tv/${e}`,e);function Po(e){let t={};for(let n of ko){let r=e.get(n);r!==void 0&&(t[n]=F(r))}return t}function Fo(e){let t=e.query.get(`channel`);if(t!==void 0)return Co.test(t)?Ao(t):null;let[,n]=wo.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return jo(n);let r=e.query.get(`collection`);return r!==void 0&&To.test(r)?Mo(r):null}function Io(e){if(e.host===So){let t=e.path.replace(/^\/|\/$/g,``);return Eo.test(t)?{found:No(t),options:{}}:null}if(!bo.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=wo.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:jo(t),options:n!==void 0&&Do.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?To.test(r??``)?{found:Mo(r??``),options:{}}:null:t.length===3&&r===`clip`?Co.test(n)&&Eo.test(i??``)?{found:No(i??``),options:{}}:null:t.length===1&&Co.test(n)&&!Oo.has(n.toLowerCase())?{found:Ao(n),options:{}}:null}const Lo={platform:`twitch`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===xo&&/^\/?$/.test(t.path)&&(n=Fo(t)),t.host===So&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=Eo.test(e)?No(e):null}return n&&B({...n,options:Po(t.query)},z(e))},isOwnScript:()=>!1,match(e){let t=Io(e);return t&&{...t.found,options:t.options}},ownsFrame:e=>e.host===xo||e.host===So&&L(e.path,`/embed`)},Ro=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),J=`(\\d{1,12})`,zo=`([0-9a-f]{6,20})`,Bo=[RegExp(`^/${J}(?:/${zo})?/?$`),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}/?$`)],Vo=RegExp(`^/video/${J}/?$`),Ho=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Uo=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Wo=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Go=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/,Ko=`player.vimeo.com`;function qo(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Jo(e){let[,t]=Go.exec(e.fragment??``)??[];return t?{t}:{}}function Yo(e){if(e?.host!==Ko)return null;let[,t]=Vo.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${zo}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Wo.has(e)).map(([e,t])=>[e,F(t)]));return{...qo(t,n),options:{...r,...Jo(e)}}}const Xo={platform:`vimeo`,parse(e){let t=V(e,Ho),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Yo(P(n.attrs.get(`src`)??``));return r&&B(r,t?.size??z(n))},isOwnScript:e=>Uo.test(e),match(e){let t=Yo(e);if(t)return t;if(!Ro.has(e.host))return null;for(let t of Bo){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return{...qo(n,r),options:Jo(e)}}return null},ownsFrame:e=>e.host===Ko},Zo=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Qo=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,$o=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,es=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],ts=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function ns(e){if(!e||!Zo.has(e.host))return null;let[,t,n]=Qo.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 rs={platform:`x`,fallback:ts,parse(e){if(e.tag!==`blockquote`||!O(e,`twitter-tweet`))return null;let t=k(e.children).reverse().map(e=>e.tag===`a`?ns(P(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:R(e,es,F),fallbackHtml:A(e.children,ts)}:null},isOwnScript:e=>$o.test(e),match(e){let t=ns(e);return t&&{...t,options:{}}}},Y=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),is=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),as=/^(?!videoseries)[A-Za-z0-9_-]{11}$/,os=/^\/embed\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,ss=/^\/(shorts|embed|live)\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,cs=/^\/([A-Za-z0-9_-]{11})\/?$/,ls=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/;function us(e){if(e===void 0||e===``)return;let t=ls.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function ds(e){return us(e.get(`start`))??us(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 fs(e,t){let n=ds(e.query);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const Z=[rs,Pr,Fn,Ka,Qa,{platform:`youtube`,parse(e){if(e.tag!==`iframe`)return null;let t=P(e.attrs.get(`src`)??``),n=t!==null&&is.has(t.host);if(!t||!(n||Y.has(t.host)))return null;let[,r]=os.exec(t.path)??[];if(r===void 0)return null;let i=[...t.query].filter(([e])=>e!==`t`).map(([e,t])=>[e,F(t)]),a=Object.fromEntries(i),o=ds(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]=cs.exec(e.path)??[];return t===void 0?null:{...X(t),options:fs(e,!1)}}let t=is.has(e.host);if(!t&&!Y.has(e.host))return null;if(!t&&/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&as.test(t)?{...X(t),options:fs(e,!1)}:null}let[,n,r]=ss.exec(e.path)??[];return n===void 0||r===void 0||t&&n!==`embed`?null:{...X(r,n===`shorts`),options:fs(e,t)}},ownsFrame:e=>is.has(e.host)||Y.has(e.host)&&L(e.path,`/embed`)},Ta,bi,Xr,di,ai,qi,Xo,Lo,gn,Ii,Ht,qt,Vr,dr,za,ga,Vi,so,Er,ra,er,on,yo],ps=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],ms=/* @__PURE__ */ new Set([`allow-downloads`,`allow-forms`,`allow-modals`,`allow-orientation-lock`,`allow-pointer-lock`,`allow-popups`,`allow-popups-to-escape-sandbox`,`allow-presentation`,`allow-same-origin`,`allow-scripts`,`allow-top-navigation`,`allow-top-navigation-by-user-activation`,`allow-top-navigation-to-custom-protocols`]),hs=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),gs=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,_s=RegExp(`^(?:https:)?//${gs}(?:[/?#]|$)`,`i`),vs=RegExp(`^(?:\\*|'self'|'src'|'none'|https://${gs})$`,`i`),ys=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,bs=/[\t\n\f\r ]+/,xs=/^\s*(width|height)\s*:(.*)$/is,Ss=/^(\d+)px$/i,Cs=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function ws(e){if(typeof e!=`string`)return null;let t=D(e);if(!t)return null;let n=k(t),[r,...i]=n.filter(e=>e.tag===`iframe`);if(!r||i.length>0)return null;let a=n.find(e=>e.children.includes(r)),{attrs:o}=r,s=z(r)??Ns(r);return Es({src:o.get(`src`),title:o.get(`title`),allow:o.get(`allow`),allowFullscreen:o.has(`allowfullscreen`),referrerPolicy:o.get(`referrerpolicy`),sandbox:o.get(`sandbox`),scrolling:o.get(`scrolling`),size:s??{},ratio:s?void 0:a&&V(a,Cs)?.size})}function Ts(e){return Es(e)}function Es(e){if(typeof e!=`object`||!e)return null;let t=e,n=Ds(t.src);if(n===null)return null;let r=typeof t.title==`string`?t.title.trim():``,i=typeof t.referrerPolicy==`string`?t.referrerPolicy.toLowerCase():void 0,a=ps.find(e=>e===i),o=As(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Os(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:ks(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Ms(t.size),...o?{ratio:o}:{}}}function Ds(e){if(typeof e!=`string`)return null;let t=e.trim(),n=_s.test(t)&&!t.includes(`\\`)?P(t):null;if(!n||ys.test(n.path))return null;let r={...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)};return Z.some(e=>e.ownsFrame?.(r))?null:t.startsWith(`//`)?`https:${t}`:t}function Os(e){return e.split(`;`).map(e=>e.split(bs).filter(Boolean)).filter(([e,...t])=>e!==void 0&&hs.has(e)&&t.every(e=>vs.test(e))).map(e=>e.join(` `)).join(`; `)}function ks(e){let t=e.split(bs).map(e=>e.toLowerCase()).filter(e=>ms.has(e));return[...new Set(t)].join(` `)}function As(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return js(t)&&js(n)?{width:t,height:n}:void 0}function js(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Ms(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?I(String(t)):void 0,i=typeof n==`number`?I(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Ns(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=xs.exec(r)??[],a=I(Ss.exec(i.trim())?.[1]);e.toLowerCase()===`width`&&(t=a),e.toLowerCase()===`height`&&(n=a)}return t===void 0&&n===void 0?void 0:{width:t,height:n}}const Ps={width:16,height:9};function Fs(e){let t=Ts(e);return t?{kind:`iframe`,src:t.src,title:t.title??`Embedded content`,allow:t.allow,allowFullscreen:t.allowFullscreen,...t.referrerPolicy?{referrerPolicy:t.referrerPolicy}:{},...t.sandbox===void 0?{}:{sandbox:t.sandbox},...t.scrolling?{scrolling:t.scrolling}:{},...Is(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Is({size:e,ratio:t}){let{width:n,height:r}=e;return n!==void 0&&r!==void 0?{ratio:{width:n,height:r},maxWidth:n}:r===void 0?{ratio:t??Ps,...n===void 0?{}:{maxWidth:n}}:{ratio:Ps,height:r}}function Ls(e){if(typeof e!=`string`)return null;let t=P(e);if(!t)return null;for(let e of Z){let n=e.match(t);if(n)return n}return null}function Rs(e){if(typeof e!=`string`)return null;let t=D(e);return t?Bs(t):zs(e)}function zs(e){for(let t of Z){let n=t.repair?.(e),r=n==null?null:D(n),i=r&&Bs(r);if(i?.platform===t.platform)return i}return null}function Bs(e){let t,n,r=[],i=!1;for(let a of e)if(a.type!==`comment`){if(a.type===`text`){if(/^\s*$/.test(a.raw))continue;return null}if(a.tag===`script`)r.push(a);else if(Vs(a))i=!0;else if(t){if(n)return null;n=a}else t=a}if(!t){let[e]=r;if(i||r.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 a=e.parse(t);if(!a)continue;if(i&&!e.allowsFbRoot||n&&!e.isOwnExtra?.(n,a))return null;let o=r.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{...a,options:Object.assign({},...s,a.options)}}return null}function Vs(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}const Hs=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Us=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Ws=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,Gs=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),Ks=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function qs(e){let t=typeof e==`string`?P(e):null;if(!t)return null;if(Gs.has(t.host))return Ks.test(t.path)?`rumble`:null;if(!Hs.has(t.host))return null;let[,n]=Us.exec(t.path)??[];return n!==void 0&&Ws.test(n)?`bluesky`:null}const Js={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`],truthsocial:[`post iframe`],imgur:[`post iframe`],tenor:[`video iframe`],streamable:[`video iframe`],strava:[`post iframe`],flickr:[`post iframe`],rumble:[`video iframe`]};function Ys(e){let t=Ls(e.url);if(t?.platform!==e.platform||t.id!==e.id||t.url!==e.url||!Js[e.platform].includes(`${e.kind} ${e.variant}`))return null;if(e.fallbackHtml===void 0||Xs(e,e.fallbackHtml))return e;let n={...e};return delete n.fallbackHtml,n}function Xs(e,t){let n=Z.find(t=>t.platform===e.platform)?.fallback,r=D(t);if(!n||!r||A(r,n)!==t)return!1;if(e.platform!==`x`)return!0;let[i]=D(`<blockquote class="twitter-tweet">${t}</blockquote>`)??[];return i?.type===`element`&&rs.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`,truthsocial:`Truth Social`,imgur:`Imgur`,tenor:`Tenor`,streamable:`Streamable`,strava:`Strava`,flickr:`Flickr`,rumble:`Rumble`};function Zs(e){return`social-embeds: a ${Q[e]} URL needs a lookup: use the embed code`}function Qs(e,t,n){let r=t??(e===void 0?null:Ls(e));if(!r&&e!==void 0&&qs(e)===n)return{error:Zs(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=Ys(r);return i?{embed:i}:{error:`social-embeds: the ${Q[n]} embed's url and id do not match`}}function $s(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=qs(e.url);return t?Zs(t):`social-embeds: not a supported post URL: ${e.url}`}function ec(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function tc(e){return e===null?void 0:ec(e.trim().replace(/px$/i,``))}function nc(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function rc(e,t){let n=t??nc(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:ec(i)??(i?.trim()?i:void 0),maxWidth:tc(e.getAttribute(`max-width`)),height:tc(e.getAttribute(`height`)),maxHeight:tc(e.getAttribute(`max-height`))},eager:e.hasAttribute(`eager`)}}function ic(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function ac(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=ic(e),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`}}}function oc(e,t){let n=ic(e),r=Math.round(t*n.height/n.width),i=e.src.indexOf(`?`),a=i===-1?e.src:e.src.slice(0,i),o=i===-1?``:`&${e.src.slice(i+1)}`;return`${a}?width=${String(t)}&height=${String(r)}${o}`}function sc(e,t){let n,r,i=e=>{let i=Math.round(e);i<=0||(clearTimeout(r),i!==n&&(n===void 0?(n=i,t(i)):r=setTimeout(()=>{n=i,t(i)},200)))};if(typeof ResizeObserver>`u`)return i(e.getBoundingClientRect().width),()=>{};let a=new ResizeObserver(e=>{for(let t of e)i(t.contentRect.width)});return a.observe(e),()=>{a.disconnect(),clearTimeout(r)}}const cc=/* @__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`&&cc.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function lc(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 uc(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 dc(e,t){return`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(window.location.hostname)}`}function fc(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function pc(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o,...s}=n,{messageHeight:c}=t,l=document.createElement(`div`);$(l,ac(t,s));let u=fc(document.createElement(`div`)),d=fc(document.createElement(`div`)),f=i.length>0?i:[t.fallbackHtml===void 0?lc():mc(t.fallbackHtml,t.fallbackImage===!0)];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=e=>{let n=document.createElement(`iframe`);n.src=t.hostParam?dc(e,t.hostParam):e,n.title=t.title,n.setAttribute(`allow`,t.allow),t.allowFullscreen!==!1&&n.setAttribute(`allowfullscreen`,``),t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),t.scrolling&&n.setAttribute(`scrolling`,t.scrolling),t.sandbox!==void 0&&n.setAttribute(`sandbox`,t.sandbox),$(n,{display:`block`,width:`100%`,height:`100%`,border:0}),n.addEventListener(`load`,()=>{c||_()}),p?p.replaceWith(n):u.prepend(n),p=n,c&&window.addEventListener(`message`,v)},S=()=>{t.sizeInSrc?g.push(sc(u,e=>{x(oc(t,e))})):x(t.src)};return r?(S(),g.push(uc(u,!1,b))):g.push(uc(u,!1,()=>{S(),b()})),()=>{for(let e of g)e();clearTimeout(h),window.removeEventListener(`message`,v),l.remove()}}function mc(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}function hc(e){return e instanceof Error?e:Error(String(e))}function gc(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:[lc(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,hc(t));return}h=setTimeout(()=>{v(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},b=uc(d,a,()=>{r.load().then(()=>{y(1)},e=>{p||c(hc(e))})});return()=>{p=!0,b(),clearTimeout(h),g(),l.remove()}}const _c=typeof HTMLElement>`u`?class{}:HTMLElement;function vc(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}function yc(e){let t=`html`in e?Rs(e.html):Ls(e.url);if(!t){let t=`html`in e?ws(e.html):null;return t?Fs(t):{kind:`error`,message:$s(e)}}let n=Qs(void 0,t,t.platform);return n.error===void 0?Pt(n.embed):{kind:`error`,message:n.error}}const bc=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var xc=class extends _c{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 bc){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??=vc(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=rc(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=yc(n);if(c.kind===`error`){s(Error(c.message));return}let l={...r,eager:i,placeholder:t.map(e=>e.cloneNode(!0)),onLoad:()=>{o(new Event(`load`))},onError:s};this.#i=c.kind===`iframe`?pc(this,c,l):gc(this,c,l)}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,xc);export{xc as SocialEmbedElement};
|
package/dist/index.js
CHANGED
|
@@ -2070,7 +2070,7 @@ function truthSocialPlan(embed) {
|
|
|
2070
2070
|
height: 1
|
|
2071
2071
|
},
|
|
2072
2072
|
messageHeight: embed.options.video === true ? TRUTH_SOCIAL_VIDEO_HEIGHT : TRUTH_SOCIAL_HEIGHT,
|
|
2073
|
-
startHeight:
|
|
2073
|
+
startHeight: 150,
|
|
2074
2074
|
maxWidth: embed.size?.width ?? 600
|
|
2075
2075
|
};
|
|
2076
2076
|
}
|