social-embeds 0.8.0 → 0.8.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 +55 -48
- package/dist/components/hooks.js +3 -1
- package/dist/components/script-embed.js +8 -7
- package/dist/core/drivers.js +8 -1
- package/dist/core/plans/youtube.js +15 -3
- package/dist/element.d.ts +1 -1
- package/dist/element.js +1 -1
- package/dist/loader/load-script.js +2 -0
- package/dist/parser/frames.js +70 -0
- package/dist/parser/iframe.js +2 -2
- package/dist/parser/parse-embed.js +2 -2
- package/dist/parser/platforms/applemusic.js +3 -3
- package/dist/parser/platforms/applepodcasts.js +3 -3
- package/dist/parser/platforms/dailymotion.js +6 -8
- package/dist/parser/platforms/facebook.js +5 -9
- package/dist/parser/platforms/giphy.js +6 -6
- package/dist/parser/platforms/kick.js +4 -4
- package/dist/parser/platforms/linkedin.js +4 -4
- package/dist/parser/platforms/pinterest.js +3 -3
- package/dist/parser/platforms/reddit.js +3 -2
- package/dist/parser/platforms/rumble.js +3 -2
- package/dist/parser/platforms/soundcloud.js +3 -3
- package/dist/parser/platforms/spotify.js +4 -4
- package/dist/parser/platforms/streamable.js +3 -2
- package/dist/parser/platforms/tenor.js +3 -2
- package/dist/parser/platforms/tiktok.js +6 -6
- package/dist/parser/platforms/truthsocial.js +2 -1
- package/dist/parser/platforms/tumblr.js +4 -2
- package/dist/parser/platforms/twitch.js +6 -7
- package/dist/parser/platforms/vimeo.js +31 -12
- package/dist/parser/platforms/x.js +1 -1
- package/dist/parser/platforms/youtube.js +73 -23
- package/dist/parser/url.js +1 -1
- package/package.json +1 -1
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=3e3,p=/* @__PURE__ */ new Map;function m(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=p.get(e.key);return t||(t=h(e).catch(t=>{throw p.delete(e.key),t}),p.set(e.key,t)),t}async function h(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await g(e,t)||await v(e)}await e.whenPresent?.()}function g(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?f:d),i,a=()=>{r=Date.now()+f},o=()=>{clearTimeout(i),window.removeEventListener(`load`,a);for(let e of t)e.removeEventListener(`error`,o);n(e.isPresent())},s=()=>{e.isPresent()||Date.now()>=r?o():i=setTimeout(s,50)};window.addEventListener(`load`,a);for(let e of t)e.addEventListener(`error`,o);s()})}var _=class extends Error{};async function v(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await ee(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof _)||t>=3)throw e;await x(1e3*2**(t-1))}await(t?b(t,`${e.url} did not report ready`):y(e))}async function ee(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 _(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await b(r,`${e.url} did not load`)}finally{t?.()}return n}function y(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 b(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 x(e){return new Promise(t=>setTimeout(t,e))}const S=()=>window,te=`v26.0`,ne=/^[a-z]{2,3}_[A-Z]{2}$/;function re(e){return()=>{let t=S().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}}const ie={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=S().twttr?.ready;t?t(()=>{e()}):e()})};function ae(){let e=S().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function oe(e){let t=re(e);return()=>{let e=S().FB;return!t()&&e!==void 0&&!e.__buffer}}const se={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:re(`instagram`),prepare:ae,skipped:oe(`instagram`)},ce={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:re(`threads`),prepare:ae,skipped:oe(`threads`)};function le(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${te}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=S().fbAsyncInit;S().fbAsyncInit=()=>{t?.(),e()}})}}const ue={key:`pinterest`,url:`https://assets.pinterest.com/js/pinit_main.js`,isOwn:e=>/^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().PinUtils?.build==`function`};function C(e,{locale:t=`en_US`}={}){switch(e){case`x`:return m(ie);case`instagram`:return m(se);case`threads`:return m(ce);case`pinterest`:return m(ue);case`facebook`:return ne.test(t)?m(le(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 de(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function fe(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const pe={load:()=>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,fe,t);return de(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function me(){let e=w().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const he={load:()=>C(`instagram`),render(e,t){let n=T(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return de(e,`instagram-media`),me(),n}},ge={load:()=>C(`threads`),render(e,t){let n=T(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return de(e,`text-post-media`),me(),n}},_e=/* @__PURE__ */ new Map;function ve(e){let t=_e.get(e);return t||(t={load:()=>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:te}),i()}return()=>{}}},_e.set(e,t)),t}const ye={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}},be=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),xe=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Se=/<([a-zA-Z][a-zA-Z0-9-]*)/y,Ce=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,we=/\s*(\/?)>/y,Te=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Ee=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function E(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}Te.lastIndex=a;let s=Te.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=Te.lastIndex;continue}let c=De(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:xe.get(l.tag);if(u){u.lastIndex=r;let t=u.exec(e);if(!t)return null;t.index>r&&l.children.push({type:`text`,raw:e.slice(r,t.index)}),r=u.lastIndex}else if(!c.selfClosing&&!be.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function De(e,t){Se.lastIndex=t;let n=Se.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Se.lastIndex;for(;;){we.lastIndex=i;let t=we.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:we.lastIndex};Ce.lastIndex=i;let a=Ce.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Oe(s??c??l??``)),i=Ce.lastIndex}}function Oe(e){return e.replace(/&(#[0-9]{1,7}|#[xX][0-9a-fA-F]{1,6}|[a-zA-Z]+);/g,(e,t)=>{if(!t.startsWith(`#`))return Ee.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 D(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function O(e){let t=[];return ke(e,t),t}function ke(e,t){for(let n of e)n.type===`element`&&(t.push(n),ke(n.children,t))}const Ae=/* @__PURE__ */ new Set([`href`,`cite`]),je=/^https?:\/\//i;function k(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)||Ae.has(e)&&!je.test(i)||(n+=` ${e}="${A(i)}"`)}n+=`>`,be.has(r.tag)||(n+=`${k(r.children,t)}</${r.tag}>`)}}return n}function A(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function Me(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${A(String(r))}"`);return t}function Ne(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Me(n)}function j(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function M(e){return e!==void 0&&e.trim()!==``}const Pe={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Fe={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},Ie={post:300,video:200};function Le(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 Re(e,t){if(e.variant===`iframe`)return Le(e);let n=j(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(Fe)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Le({...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="${A(e.url)}"${Ne(Pe,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:ve(i),minHeight:Ie[e.kind],label:`Facebook`,hasFallback:M(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}const ze=[`header`,`footer`,`context`],Be=/\/albums\/\d+$/;function Ve(e,t){let n=Be.test(e.url),r=ze.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 He(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 Ue={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 We(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:Ue,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function Ge(e,t){let n=j(e.options,{captioned:t.captioned}),r=`<blockquote${Me({"data-instgrm-permalink":e.url,"data-instgrm-version":n.version,"data-instgrm-captioned":n.captioned===!0||void 0,style:`width:calc(100% - 2px)`})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:he,minHeight:680,label:`Instagram`,hasFallback:M(e.fallbackHtml),maxWidth:540}}const Ke=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function qe(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])=>Ke.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Je(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 Ye={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},Xe={small:236,medium:345,large:600};function Ze(e,t){let n=j(e.options,{width:t.pinWidth}),r=`<a href="${A(e.url)}"${Ne(Ye,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:ye,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:Xe[String(n.width)]??236}}const Qe={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},$e={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 et(e,t){let n=[];for(let[e,r]of Object.entries(Qe)){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:$e,startHeight:e.size?.height??316,maxWidth:640}}function tt(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 nt={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 rt(e,t){let n=[];for(let[e,r]of Object.entries(nt)){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 it(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 at=/* @__PURE__ */ new Set([`track`,`episode`]);function ot(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??(at.has(n)?152:352)}}const st={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 ct(e){return e===`minimal`?`minimal`:`standard`}function lt(e,t){let n=e.id.startsWith(`route/`),r=ct(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:st,startHeight:650,...i?{}:{maxWidth:554}}}const ut=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),dt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function ft(e,t){let n=Object.entries(e.options).filter(([e])=>ut.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,dt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const pt=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function mt(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 ht={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 gt(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 pt){let n=mt(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:ht,startHeight:300,maxWidth:500}}function _t(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 vt(e,t){let n=j(e.options,{theme:t.theme}),r=`<blockquote${Me({"data-text-post-permalink":e.url,"data-text-post-version":n.version??0,id:`ig-tp-${e.id}`,"data-theme":n.theme})}>${e.fallbackHtml??``}</blockquote>`;return{kind:`script`,key:r,markup:r,driver:ge,minHeight:240,label:`Threads`,hasFallback:M(e.fallbackHtml),maxWidth:658}}const yt={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 bt(e,t){let n=o(t,yt);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 xt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const St={origin:`https://truthsocial.com`,read:xt},Ct={origin:`https://truthsocial.com`,read(e){let t=xt(e);return t===void 0||t<=0?void 0:t+165}},wt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Tt(e){let t=wt.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?Ct:St,startHeight:150,maxWidth:e.size?.width??600}}const Et={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 Dt(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:Et,startHeight:400,maxWidth:540}}const Ot=[`channel`,`video`,`collection`,`clip`,`parent`];function kt(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 At(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]=kt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Ot),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,hostParam:`parent`}}const jt={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 Mt(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,jt),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 Nt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function Pt(e,t){let n=j(e.options,{...t}),r=e.fallbackHtml??`<a href="${A(e.url)}"></a>`,i=`<blockquote${Ne(Nt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:pe,minHeight:250,label:`X`,hasFallback:M(e.fallbackHtml),maxWidth:550}}const Ft={autoplay:`autoplay`,ccLangPref:`cc_lang_pref`,ccLoadPolicy:`cc_load_policy`,color:`color`,controls:`controls`,disablekb:`disablekb`,enablejsapi:`enablejsapi`,end:`end`,fs:`fs`,hl:`hl`,ivLoadPolicy:`iv_load_policy`,list:`list`,listType:`listType`,loop:`loop`,origin:`origin`,playlist:`playlist`,playsinline:`playsinline`,rel:`rel`,start:`start`,widgetReferrer:`widget_referrer`};function It(e,t){let{nocookie:n,...r}=t,{nocookie:i,...s}=e.options,c=n??i===!0?`https://www.youtube-nocookie.com`:`https://www.youtube.com`,l=o(r,Ft);return{kind:`iframe`,src:`${c}/embed/${e.id}${a(Object.entries(s),l)}`,title:`YouTube video player`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share`,referrerPolicy:`strict-origin-when-cross-origin`,ratio:e.url.includes(`/shorts/`)?{width:9,height:16}:{width:16,height:9},size:e.size}}function Lt(e){switch(e.platform){case`x`:return Pt(e,{});case`instagram`:return Ge(e,{});case`threads`:return vt(e,{});case`facebook`:return Re(e,{});case`tiktok`:return bt(e,{});case`youtube`:return It(e,{});case`telegram`:return gt(e,{});case`snapchat`:return tt(e);case`linkedin`:return Je(e,{});case`reddit`:return et(e,{});case`pinterest`:return Ze(e,{});case`spotify`:return ot(e,{});case`vimeo`:return Mt(e,{});case`twitch`:return At(e,{});case`dailymotion`:return u(e,{});case`bluesky`:return c(e,{});case`soundcloud`:return rt(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return Dt(e);case`kick`:return qe(e,{});case`giphy`:return He(e);case`tenor`:return _t(e);case`streamable`:return ft(e,{});case`rumble`:return it(e);case`truthsocial`:return Tt(e);case`imgur`:return We(e,{});case`strava`:return lt(e,{});case`flickr`:return Ve(e,{});default:return e.platform}}const Rt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function N(e){let t=Rt.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=zt(t===-1?e:e.slice(0,t)),r=zt(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 zt(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function P(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function F(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function I(e,t){return e===t||e.startsWith(`${t}/`)}function L(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 R(e){let t=F(e.attrs.get(`width`)),n=F(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function z(e,t){return t?{...e,size:t}:e}function B(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=Bt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Bt(e,t){return t===0?e:Bt(t,e%t)}const Vt=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,Ht=/^\d{1,15}$/,Ut=`embed.music.apple.com`;function Wt(e,t){if(e?.host!==t)return null;let[,n,r,i]=Vt.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!Ht.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!Ht.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const Gt={platform:`applemusic`,parse(e){if(e.tag!==`iframe`)return null;let t=Wt(N(e.attrs.get(`src`)??``),Ut);if(!t)return null;let{height:n}=R(e)??{};return z({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1,match(e){let t=Wt(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:e=>e.host===Ut},Kt=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,qt=/^\d{1,15}$/,Jt=`embed.podcasts.apple.com`;function Yt(e,t){if(e?.host!==t)return null;let[,n,r]=Kt.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!qt.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 Xt={platform:`applepodcasts`,parse(e){if(e.tag!==`iframe`)return null;let t=Yt(N(e.attrs.get(`src`)??``),Jt);return t&&z({...t,options:{}},R(e))},isOwnScript:()=>!1,match(e){let t=Yt(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:e=>e.host===Jt},Zt=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,Qt=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,$t=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),en=RegExp(`^/profile/${Zt}/post/${Qt}/?$`),tn=RegExp(`^at://${Zt}/app\\.bsky\\.feed\\.post/${Qt}$`),nn=/^[a-z2-7]{20,100}$/,rn=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),an=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,on=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function sn(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 cn(e){if(!e||!$t.has(e.host))return null;let[,t,n]=en.exec(e.path)??[];return t===void 0||n===void 0?null:sn(t,n)}const ln={platform:`bluesky`,fallback:on,parse(e){if(e.tag!==`blockquote`||!D(e,`bluesky-embed`))return null;let[,t,n]=tn.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=sn(t,n);if(O(e.children).reverse().map(e=>e.tag===`a`?cn(N(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&&nn.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&rn.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:k(e.children,on)}},isOwnScript:e=>an.test(e),match(e){let t=cn(e);return t&&{...t,options:{}}}},un=/^x[a-z0-9]{4,12}$/,dn=/^x[a-z0-9]{3,12}$/,fn=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,pn=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),mn=`geo.dailymotion.com`,hn=`dai.ly`;function gn(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function _n(e){if(e.host!==mn||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(!un.test(r)||n!==void 0&&!dn.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,P(t)]));return n!==void 0&&(i.playerId=n),gn(r,i)}function vn(e){if(e.host===hn){let t=e.path.replace(/^\/|\/$/g,``);return un.test(t)?gn(t,{}):null}if(!pn.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&un.test(t)?gn(t,{}):null}const yn={platform:`dailymotion`,parse(e){let t=B(e,fn),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=N(n.attrs.get(`src`)??``);if(!r)return null;let i=_n(r)??vn(r);return i&&z(i,t?.size??R(n))},isOwnScript:()=>!1,match(e){return _n(e)??vn(e)},ownsFrame:e=>e.host===mn||e.host===hn||pn.has(e.host)&&(I(e.path,`/embed`)||I(e.path,`/video`))},bn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),xn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),V=`https://www.facebook.com`,Sn=`[A-Za-z0-9.\\-]{1,80}`,Cn=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,wn=RegExp(`^/(${Sn})/posts/(${Cn})/?$`),Tn=RegExp(`^/(${Sn})/photos/([A-Za-z0-9.]{1,40})/(\\d{1,25})/?$`),En=RegExp(`^/(${Sn})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),Dn=/^\/reel\/(\d{1,25})\/?$/,On=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),kn=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),An=RegExp(`^${Cn}$`),jn=/^\d{1,25}$/,Mn=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Nn=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Pn=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Fn={name:`class`,value:/^fb-xfbml-parse-ignore$/},In=/* @__PURE__ */ new Map([[`div`,[Fn]],[`blockquote`,[`cite`,Fn]],[`a`,[`href`]],[`p`,[]]]);function Ln(e){if(!e||!bn.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=wn.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${V}/${r}/posts/${i}`};if(On.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!An.test(e))return null;let r=n.get(`id`),i=r!==void 0&&jn.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${V}${t}?story_fbid=${e}${i}`}}if(kn.has(t)){let e=n.get(`fbid`);return e===void 0||!jn.test(e)?null:{kind:`post`,id:e,url:`${V}${t}?fbid=${e}`}}let[,a,o,s]=Tn.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${V}/${a}/photos/${o}/${s}/`};let[,c,l]=En.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${V}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!jn.test(e)?null:{kind:`video`,id:e,url:`${V}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=Dn.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${V}/reel/${u}`}}function H(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const Rn={platform:`facebook`,fallback:In,parse(e){if(e.tag===`div`){let t=D(e,`fb-post`)?`post`:D(e,`fb-video`)?`video`:null,n=Ln(N(e.attrs.get(`data-href`)??``));return!t||!n?null:{...H(n,t,`sdk`,L(e,Nn,P)),fallbackHtml:k(e.children,In)}}if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||!xn.has(t.host))return null;let n=Ln(N(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=P(r)),i!==void 0&&(e.width=P(i)),H(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=P(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of Pn){let i=t.query.get(n);i!==void 0&&(e[r]=P(i))}let r=F(t.query.get(`width`)),i=F(t.query.get(`height`));return z(H(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return z(H(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,P(t)]))),R(e))}return null},isOwnScript:e=>Mn.test(e),scriptOptions(e){let[,t]=Mn.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=Ln(e);return t&&H(t,t.kind,`sdk`,{})},ownsFrame:e=>xn.has(e.host)&&I(e.path,`/plugins`)},zn=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),Bn=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,Vn=`(\\d{1,20})`,Hn=RegExp(`^/photos/${Bn}/${Vn}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),Un=RegExp(`^/photos/${Bn}/(?:albums|sets)/${Vn}/?$`),Wn=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,Gn=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,Kn=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,qn=[`header`,`footer`,`context`],Jn=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,Yn=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:Jn},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function Xn(e){if(e===``)return null;let t=0n;for(let n of e){let e=Kn.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function Zn(e){let t=BigInt(e),n=``;for(;t>0n;)n=Kn.charAt(Number(t%58n))+n,t/=58n;return n}function Qn(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function $n(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function er(e){if(!e||!zn.has(e.host))return null;let[,t,n]=Un.exec(e.path)??[];if(t!==void 0&&n!==void 0)return $n(t,n);let[,r,i]=Hn.exec(e.path)??[];return r===void 0||i===void 0?null:Qn(r,i)}function tr(e){if(e.host!==`flic.kr`)return null;let[,t]=Wn.exec(e.path)??[],n=t===void 0?null:Xn(t);return t===void 0||n===null||Zn(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}function nr(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 rr={platform:`flickr`,fallback:Yn,parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=er(N(e.attrs.get(`href`)??``)),n=nr(e);if(!t||!n)return null;let r={};for(let t of qn)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=R(n),a=Jn.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return z({...t,options:r,fallbackHtml:k([a],Yn)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>Gn.test(e),match(e){let t=er(e)??tr(e);return t&&{...t,options:{}}}},U=`([A-Za-z0-9]{6,40})`,W=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),ir=RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${U}/?$`),ar=RegExp(`^/embed/${U}/?$`),or=/^(?:media\d?|i)\.giphy\.com$/,sr=`\\.(?:gif|webp|mp4)`,cr=RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${U}/[A-Za-z0-9_-]{1,40}${sr}$`),lr=RegExp(`^/${U}${sr}$`),ur=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function dr(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function fr(e){if(e){if(W.has(e.host))return(ir.exec(e.path)??ar.exec(e.path))?.[1];if(or.test(e.host))return(cr.exec(e.path)??(e.host===`i.giphy.com`?lr.exec(e.path):null))?.[1]}}function pr(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=ar.exec(t.path)??[];return n===void 0?null:dr(n)}function mr(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=N(n.attrs.get(`href`)??``);if(!i||!W.has(i.host)||ir.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 hr={platform:`giphy`,parse(e){let t=B(e,ur),n=t?.iframe??e,r=pr(n);return r?z({...r,options:{}},t?.size??R(n)):null},isOwnScript:()=>!1,isOwnExtra:mr,match(e){let t=fr(e);return t===void 0?null:{...dr(t),options:{}}},ownsFrame:e=>W.has(e.host)&&I(e.path,`/embed`)},gr=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),G=`([A-Za-z0-9]{5,7})`,_r=RegExp(`^(a/)?${G}$`),vr=RegExp(`^/a/${G}/?$`),yr=RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${G}/?$`),br=RegExp(`^/${G}/?$`),xr=RegExp(`^/${G}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),Sr=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/,Cr=/* @__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`]),wr=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Tr(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function Er(e){return e===void 0||Cr.has(e.toLowerCase())?void 0:e}function Dr(e){if(!e)return;if(e.host===`i.imgur.com`)return Er(xr.exec(e.path)?.[1]);if(!gr.has(e.host))return;let t=(vr.exec(e.path)??yr.exec(e.path))?.[1];return t===void 0?Er(br.exec(e.path)?.[1]):`a/${t}`}function Or(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:Or(e.children)}})}function kr(e,t){return e.attrs.get(t)===`false`}const Ar={platform:`imgur`,fallback:wr,parse(e){if(e.tag!==`blockquote`||!D(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=_r.exec(t)??[];if(r===void 0||n===void 0&&!Er(r))return null;let i={};return kr(e,`data-context`)&&(i.context=!1),kr(e,`data-analytics`)&&(i.analytics=!1),{...Tr(t),options:i,fallbackHtml:k(Or(e.children),wr)}},isOwnScript:e=>Sr.test(e),match(e){let t=Dr(e);return t===void 0?null:{...Tr(t),options:{}}}},jr=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),Mr=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Nr=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Pr=/* @__PURE__ */ new Set([`p`,`reel`]),Fr=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Ir=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Lr(e){if(!e||!jr.has(e.host))return null;let[,t,n,r]=Mr.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Nr.has(t)||!Pr.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const Rr={platform:`instagram`,fallback:Ir,parse(e){if(e.tag!==`blockquote`||!D(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?O(e.children).reverse().map(e=>e.tag===`a`?Lr(N(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Lr(N(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=P(i)),{...n,options:r,fallbackHtml:k(e.children,Ir)}},isOwnScript:e=>Fr.test(e),match(e){let t=Lr(e);return t&&{...t,options:{}}}},zr=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),Br=/^\/([A-Za-z0-9_-]{1,32})\/?$/,Vr=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),Hr=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Ur(e,t){if(!e||!t.has(e.host))return null;let[,n]=Br.exec(e.path)??[];if(n===void 0||Vr.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const Wr=/* @__PURE__ */ new Set([`player.kick.com`]),Gr={platform:`kick`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``),n=Ur(t,Wr);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>Hr.has(e)).map(([e,t])=>[e,P(t)]));return z({...n,options:r},R(e))},isOwnScript:()=>!1,match(e){let t=Ur(e,zr)??Ur(e,Wr);return t&&{...t,options:{}}},ownsFrame:e=>Wr.has(e.host)},Kr=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,qr=`www.linkedin.com`,Jr=`(activity|share|ugcPost):(\\d{19})`,Yr=RegExp(`^(?:/embed)?/feed/update/urn:li:${Jr}/?$`),Xr=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),Zr=RegExp(`^/embed/feed/update/urn:li:${Jr}$`);function Qr(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 $r=e=>e.replace(/%3A/gi,`:`),ei={platform:`linkedin`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(t?.host!==qr)return null;let[,n,r]=Zr.exec(t.path)??[];return n===void 0||r===void 0?null:z(Qr(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,P(t)]))),R(e))},isOwnScript:()=>!1,match(e){if(!Kr.test(e.host))return null;let t=$r(e.path),[,n,r]=Yr.exec(t)??Xr.exec(t)??[];return n===void 0||r===void 0?null:Qr(n,r)},ownsFrame:e=>e.host===qr&&I(e.path,`/embed`)},ti=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,ni=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,ri=/^\d{1,25}$/,ii=`assets.pinterest.com`,ai=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,oi=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function si(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function ci(e){if(!e||!ti.test(e.host))return null;let[,t]=ni.exec(e.path)??[];return t===void 0?null:si(t)}const li={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=ci(N(e.attrs.get(`href`)??``));return t&&{...t,options:L(e,oi,P)}}if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(t?.host!==ii||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&ri.test(n)?{...si(n),options:{}}:null},isOwnScript:e=>ai.test(e),match(e){let t=ci(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===ii},ui=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),di=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/,fi=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,pi=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function mi(e){if(!e||!ui.has(e.host))return null;let[,t,n,r,i]=di.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 hi={platform:`reddit`,parse(e){if(e.tag!==`blockquote`||!D(e,`reddit-embed-bq`))return null;let t=O(e.children).map(e=>e.tag===`a`?mi(N(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=F(e.attrs.get(`data-embed-height`));return z({...t,options:L(e,pi,P)},n===void 0?void 0:{height:n})},isOwnScript:e=>fi.test(e),match(e){let t=mi(e);return t&&{...t,options:{}}}},gi=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),_i=`([A-Za-z][A-Za-z0-9._-]{1,29})`,vi=RegExp(`^(?:/@${_i})?/spotlight/([A-Za-z0-9_-]{20,120})$`),yi=RegExp(`^/(?:@|add/)${_i}$`),bi=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,xi=RegExp(`^/@${_i}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),Si=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function Ci(e){if(!e||!gi.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=vi.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]=yi.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=bi.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=xi.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const wi={platform:`snapchat`,parse(e){if(e.tag!==`blockquote`||!D(e,`snapchat-embed`))return null;let t=N(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=Ci({...t,path:t.path.slice(0,-6)});if(!n||!O(e.children).filter(e=>e.tag===`a`).every(e=>{let t=Ci(N(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=F(e.attrs.get(`data-snapchat-embed-width`)),a=F(e.attrs.get(`data-snapchat-embed-height`));return z({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>Si.test(e),match(e){let t=Ci(e);return t&&{...t,options:{}}}},Ti=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Ei=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,Di=`[a-z0-9_-]{1,64}`,Oi=`s-[A-Za-z0-9]{1,32}`,ki=RegExp(`^/(${Di})(?:/(sets/${Di}|${Di})(?:/(${Oi}))?)?/?$`,`i`),Ai=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),ji=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Mi=RegExp(`^${Oi}$`),Ni=`w.soundcloud.com`;function Pi(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function Fi(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Ei.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Mi.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return Pi(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Ii(e){if(!Ti.has(e.host))return null;let[,t,n,r]=ki.exec(e.path)??[];if(t===void 0||Ai.has(t.toLowerCase())||n!==void 0&&ji.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return Pi(`https://soundcloud.com/${i}`,i)}const Li=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function Ri(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!Li.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&Ti.has(N(e.attrs.get(`href`)??``)?.host??``)}function zi(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&&Ri(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&Ri(r)}const Bi={platform:`soundcloud`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(t?.host!==Ni||!/^\/player\/?$/.test(t.path))return null;let n=Fi(N(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Mi.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,P(t)])),{height:a}=R(e)??{};return z({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:zi,match(e){let t=Fi(e)??Ii(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===Ni},Vi=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,Hi=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function Ui(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function Wi(e,t){return e&&t.has(e.host)?Vi.exec(e.path)?.[1]:void 0}const Gi={platform:`rumble`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``),n=Wi(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=P(i)),z({...Ui(n),options:r},R(e))},isOwnScript:()=>!1,match(e){let t=Wi(e,Hi);return t===void 0?null:{...Ui(t),options:{}}},ownsFrame:e=>e.host===`rumble.com`&&I(e.path,`/embed`)},Ki=/* @__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)?/?$`),qi=/* @__PURE__ */ new Set([`utm_source`,`si`]),Ji=`open.spotify.com`;function Yi(e){if(e?.host!==Ji)return null;let[,t,n,r]=Ki.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 Xi(e){return Object.fromEntries([...e].filter(([e])=>!qi.has(e)).map(([e,t])=>[e,P(t)]))}const Zi={platform:`spotify`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=Yi(t);if(!n)return null;let{query:r,...i}=n;return z({...i,options:Xi(r)},R(e))},isOwnScript:()=>!1,match(e){let t=Yi(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:e=>e.host===Ji&&I(e.path,`/embed`)},Qi=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),$i=/^\d{1,20}$/,ea=/^\/(activities|routes)\/(\d{1,20})\/?$/,ta=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,na=/* @__PURE__ */ new Set([`standard`,`minimal`]),ra=/^[A-Za-z0-9_-]{1,100}$/,ia={activity:`activities`,route:`routes`};function aa(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${ia[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}function oa(e){return e===`activity`||e===`route`}const sa={platform:`strava`,parse(e){if(e.tag!==`div`||!D(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(!oa(t)||!$i.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&na.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&&ra.test(a)&&(r.mapHash=a),{...aa(t,n),options:r}},isOwnScript:e=>ta.test(e),match(e){if(!Qi.has(e.host))return null;let[,t,n]=ea.exec(e.path)??[];return t===void 0||n===void 0?null:{...aa(t===`routes`?`route`:`activity`,n),options:{}}}},ca=`([a-z0-9]{4,8})`,la=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),ua=RegExp(`^/[eo]/${ca}$`),da=RegExp(`^/${ca}/?$`),fa=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]),pa=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,ma=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),ha=/<\/div\s*>$/i;function ga(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function _a(e){return e!==void 0&&!fa.has(e)}function va(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=ua.exec(t.path)??[];if(!_a(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>ma.has(e)).map(([e,t])=>[e,P(t)]));return{...ga(n),options:r}}function ya(e){if(!e||!la.has(e.host))return;let t=(ua.exec(e.path)??da.exec(e.path))?.[1];return _a(t)?t:void 0}const ba={platform:`streamable`,parse(e){let t=B(e,pa),n=t?.iframe??e,r=va(n);return r?z(r,t?.size??R(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=ha.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=ya(e);return t===void 0?null:{...ga(t),options:{}}},ownsFrame:e=>e.host===`streamable.com`&&(I(e.path,`/e`)||I(e.path,`/o`))},xa=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Sa=`[A-Za-z][A-Za-z0-9_]{2,31}`,Ca=RegExp(`^(${Sa})/(\\d{1,10})$`),wa=RegExp(`^/(?:s/)?(${Sa})/(\\d{1,10})/?$`),Ta=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Ea=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Da=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function Oa(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const ka={platform:`telegram`,parse:()=>null,parseScript(e){if(!Ta.test(e.attrs.get(`src`)??``)||Ea.some(t=>e.attrs.has(t)))return null;let[,t,n]=Ca.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=L(e,Da,P);return e.attrs.has(`data-single`)&&(r.single=!0),Oa(t,n,r)},isOwnScript:e=>Ta.test(e),match(e){if(!xa.has(e.host))return null;let[,t,n]=wa.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)),Oa(t,n,r)}},Aa=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),ja=`(\\d{1,20})`,Ma=RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${ja}/?$`),Na=RegExp(`^/embed/${ja}$`),Pa=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,Fa=/^\d{1,3}(?:\.\d{1,20})?$/,Ia=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function La(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function Ra(e){return e&&Aa.has(e.host)?Ma.exec(e.path)?.[1]:void 0}function za(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=Ba(t,1e4);return{width:t/n,height:1e4/n}}function Ba(e,t){return t===0?e:Ba(t,e%t)}function Va(e){if(!D(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!RegExp(`^${ja}$`).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!Fa.test(n))return null;let r=za(n===void 0?1.33:Number(n));return r?z({...La(t),options:{},fallbackHtml:k(e.children,Ia)},r):null}function Ha(e){let t=N(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=Na.exec(t.path)??[];return n===void 0?null:z({...La(n),options:{}},R(e))}const Ua={platform:`tenor`,fallback:Ia,parse(e){return e.tag===`div`?Va(e):e.tag===`iframe`?Ha(e):null},isOwnScript:e=>Pa.test(e),match(e){let t=Ra(e);return t===void 0?null:{...La(t),options:{}}},ownsFrame:e=>e.host===`tenor.com`&&I(e.path,`/embed`)},Wa=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),Ga=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,Ka=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,qa=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Ja=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function Ya(e){if(!e||!Wa.has(e.host))return null;let[,t]=Ga.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const Xa={platform:`threads`,fallback:Ja,parse(e){if(e.tag!==`blockquote`||!D(e,`text-post-media`))return null;let t=Ya(N(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:L(e,qa,P),fallbackHtml:k(e.children,Ja)}},isOwnScript:e=>Ka.test(e),match(e){let t=Ya(e);return t&&{...t,options:{}}}},K=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),Za=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,Qa=/^\/player\/v1\/(\d{1,25})\/?$/,$a=/^\d{1,25}$/,eo=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;function to(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const no={platform:`tiktok`,parse(e){if(e.tag===`blockquote`&&D(e,`tiktok-embed`)){let t=N(e.attrs.get(`cite`)??``),[,n,r]=t&&K.has(t.host)?Za.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!$a.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:to(a,n)}if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||!K.has(t.host))return null;let[,n]=Qa.exec(t.path)??[];return n===void 0?null:z(to(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,P(t)]))),R(e))},isOwnScript:e=>eo.test(e),match(e){if(!K.has(e.host))return null;let[,t,n]=Za.exec(e.path)??[];return t===void 0||n===void 0?null:to(n,t)},ownsFrame:e=>K.has(e.host)&&I(e.path,`/player`)},ro=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),io=`(@[A-Za-z0-9_.-]{1,64})`,ao=`(\\d{1,25})`,oo=RegExp(`^/${io}/(?:posts/)?${ao}/?$`),so=RegExp(`^/${io}/${ao}/embed$`),co=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/;function lo(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function uo(e){if(!e||!ro.has(e.host))return null;let[,t,n]=oo.exec(e.path)??[];return t===void 0||n===void 0?null:lo(t,n)}const fo={platform:`truthsocial`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=so.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=D(e,`truthsocial-video`)?{video:!0}:{};return z({...lo(n,r),options:i},R(e))},isOwnScript:e=>co.test(e),match(e){let t=uo(e);return t&&{...t,options:{}}},ownsFrame:e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`)},po=`([a-z0-9-]{1,32})`,mo=`(\\d{1,20})`,ho=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),go=RegExp(`^/${po}/${mo}(?:/[^/]{1,200})?/?$`),_o=RegExp(`^${po}\\.tumblr\\.com$`),vo=RegExp(`^/post/${mo}(?:/[^/]{1,200})?/?$`),yo=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${po})/${mo}/v2$`),bo=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),xo=/^(?:https?:)?\/\/assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function So(e){if(!e)return null;let t,n;return ho.has(e.host)?[,t,n]=go.exec(e.path)??[]:([,t]=_o.exec(e.host)??[],[,n]=vo.exec(e.path)??[]),t===void 0||n===void 0||bo.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const Co={platform:`tumblr`,parse(e){if(e.tag!==`div`||!D(e,`tumblr-post`))return null;let t=N(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=yo.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=So(N(i.attrs.get(`href`)??``));return o?.id!==r||n!==void 0&&o.url!==`https://www.tumblr.com/${n}/${r}`?null:{...o,options:{}}},isOwnScript:e=>xo.test(e),match(e){let t=So(e);return t&&{...t,options:{}}}},wo=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),To=`player.twitch.tv`,Eo=`clips.twitch.tv`,Do=/^[A-Za-z0-9_]{3,25}$/,Oo=/^v?(\d{1,12})$/,ko=/^[A-Za-z0-9_-]{6,30}$/,Ao=/^[A-Za-z0-9_-]{6,100}$/,jo=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,Mo=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),No=[`autoplay`,`muted`,`time`];function q(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const Po=e=>q(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),Fo=e=>q(`https://www.twitch.tv/videos/${e}`,e),Io=e=>q(`https://www.twitch.tv/collections/${e}`,e),Lo=e=>q(`https://clips.twitch.tv/${e}`,e);function Ro(e){let t={};for(let n of No){let r=e.get(n);r!==void 0&&(t[n]=P(r))}return t}function zo(e){let t=e.query.get(`channel`);if(t!==void 0)return Do.test(t)?Po(t):null;let[,n]=Oo.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return Fo(n);let r=e.query.get(`collection`);return r!==void 0&&ko.test(r)?Io(r):null}function Bo(e){if(e.host===Eo){let t=e.path.replace(/^\/|\/$/g,``);return Ao.test(t)?{found:Lo(t),options:{}}:null}if(!wo.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=Oo.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:Fo(t),options:n!==void 0&&jo.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?ko.test(r??``)?{found:Io(r??``),options:{}}:null:t.length===3&&r===`clip`?Do.test(n)&&Ao.test(i??``)?{found:Lo(i??``),options:{}}:null:t.length===1&&Do.test(n)&&!Mo.has(n.toLowerCase())?{found:Po(n),options:{}}:null}const Vo={platform:`twitch`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===To&&/^\/?$/.test(t.path)&&(n=zo(t)),t.host===Eo&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=Ao.test(e)?Lo(e):null}return n&&z({...n,options:Ro(t.query)},R(e))},isOwnScript:()=>!1,match(e){let t=Bo(e);return t&&{...t.found,options:t.options}},ownsFrame:e=>e.host===To||e.host===Eo&&I(e.path,`/embed`)},Ho=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),J=`(\\d{1,12})`,Uo=`([0-9a-f]{6,20})`,Wo=[RegExp(`^/${J}(?:/${Uo})?/?$`),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}/?$`)],Go=RegExp(`^/video/${J}/?$`),Ko=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,qo=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Jo=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Yo=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/,Xo=`player.vimeo.com`;function Zo(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Qo(e){let[,t]=Yo.exec(e.fragment??``)??[];return t?{t}:{}}function $o(e){if(e?.host!==Xo)return null;let[,t]=Go.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${Uo}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Jo.has(e)).map(([e,t])=>[e,P(t)]));return{...Zo(t,n),options:{...r,...Qo(e)}}}const es={platform:`vimeo`,parse(e){let t=B(e,Ko),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=$o(N(n.attrs.get(`src`)??``));return r&&z(r,t?.size??R(n))},isOwnScript:e=>qo.test(e),match(e){let t=$o(e);if(t)return t;if(!Ho.has(e.host))return null;for(let t of Wo){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return{...Zo(n,r),options:Qo(e)}}return null},ownsFrame:e=>e.host===Xo},ts=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),ns=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,rs=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,is=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,as=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],os=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function ss(e,t=ns){if(!e||!ts.has(e.host))return null;let[,n=`i`,r]=t.exec(e.path)??[];return r===void 0?null:{platform:`x`,kind:`post`,url:`https://x.com/${n}/status/${r}`,id:r,variant:`sdk`}}const cs={platform:`x`,fallback:os,parse(e){if(e.tag!==`blockquote`||!D(e,`twitter-tweet`))return null;let t=O(e.children).reverse().map(e=>e.tag===`a`?ss(N(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:L(e,as,P),fallbackHtml:k(e.children,os)}:null},isOwnScript:e=>is.test(e),match(e){let t=ss(e,rs);return t&&{...t,options:{}}}},ls=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),us=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),ds=/^(?!videoseries)[A-Za-z0-9_-]{11}$/,fs=/^\/embed\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,ps=/^\/(shorts|embed|live)\/((?!videoseries)[A-Za-z0-9_-]{11})\/?$/,ms=/^\/([A-Za-z0-9_-]{11})\/?$/,hs=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/;function gs(e){if(e===void 0||e===``)return;let t=hs.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function _s(e){return gs(e.get(`start`))??gs(e.get(`t`))}function Y(e,t=!1){return{platform:`youtube`,kind:`video`,url:t?`https://www.youtube.com/shorts/${e}`:`https://www.youtube.com/watch?v=${e}`,id:e,variant:`iframe`}}function vs(e,t){let n=_s(e.query);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const X=[cs,Rr,Rn,Xa,no,{platform:`youtube`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``),n=t!==null&&us.has(t.host);if(!t||!(n||ls.has(t.host)))return null;let[,r]=fs.exec(t.path)??[];if(r===void 0)return null;let i=[...t.query].filter(([e])=>e!==`t`).map(([e,t])=>[e,P(t)]),a=Object.fromEntries(i),o=_s(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),z({...Y(r),options:a},R(e))},isOwnScript:()=>!1,match(e){if(e.host===`youtu.be`){let[,t]=ms.exec(e.path)??[];return t===void 0?null:{...Y(t),options:vs(e,!1)}}let t=us.has(e.host);if(!t&&!ls.has(e.host))return null;if(!t&&/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&ds.test(t)?{...Y(t),options:vs(e,!1)}:null}let[,n,r]=ps.exec(e.path)??[];return n===void 0||r===void 0||t&&n!==`embed`?null:{...Y(r,n===`shorts`),options:vs(e,t)}},ownsFrame:e=>us.has(e.host)||ls.has(e.host)&&I(e.path,`/embed`)},ka,wi,ei,hi,li,Zi,es,Vo,yn,Bi,Gt,Xt,Gr,hr,Ua,ba,Gi,fo,Ar,sa,rr,ln,Co];function ys(e){return X.find(t=>t.platform===e)}const bs=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],xs=/* @__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`]),Ss=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),Cs=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,ws=RegExp(`^(?:https:)?//${Cs}(?:[/?#]|$)`,`i`),Ts=RegExp(`^(?:\\*|'self'|'src'|'none'|https://${Cs})$`,`i`),Es=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Ds=/[\t\n\f\r ]+/,Os=/^\s*(width|height)\s*:(.*)$/is,ks=/^(\d+)px$/i,As=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function js(e){if(typeof e!=`string`)return null;let t=E(e);if(!t)return null;let n=O(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=R(r)??Bs(r);return Ns({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&&B(a,As)?.size})}function Ms(e){return Ns(e)}function Ns(e){if(typeof e!=`object`||!e)return null;let t=e,n=Ps(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=bs.find(e=>e===i),o=Ls(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Fs(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Is(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:zs(t.size),...o?{ratio:o}:{}}}function Ps(e){if(typeof e!=`string`)return null;let t=e.trim(),n=ws.test(t)&&!t.includes(`\\`)?N(t):null;if(!n||Es.test(n.path))return null;let r={...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)};return X.some(e=>e.ownsFrame?.(r))?null:t.startsWith(`//`)?`https:${t}`:t}function Fs(e){return e.split(`;`).map(e=>e.split(Ds).filter(Boolean)).filter(([e,...t])=>e!==void 0&&Ss.has(e)&&t.every(e=>Ts.test(e))).map(e=>e.join(` `)).join(`; `)}function Is(e){let t=e.split(Ds).map(e=>e.toLowerCase()).filter(e=>xs.has(e));return[...new Set(t)].join(` `)}function Ls(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Rs(t)&&Rs(n)?{width:t,height:n}:void 0}function Rs(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function zs(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?F(String(t)):void 0,i=typeof n==`number`?F(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Bs(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Os.exec(r)??[],a=F(ks.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 Vs={width:16,height:9};function Hs(e){let t=Ms(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}:{},...Us(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Us({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??Vs,...n===void 0?{}:{maxWidth:n}}:{ratio:Vs,height:r}}const Ws=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Gs=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Ks=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,qs=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),Js=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function Ys(e){let t=typeof e==`string`?N(e):null;if(!t)return null;if(qs.has(t.host))return Js.test(t.path)?`rumble`:null;if(!Ws.has(t.host))return null;let[,n]=Gs.exec(t.path)??[];return n!==void 0&&Ks.test(n)?`bluesky`:null}function Xs(e){let t=Qs(e);if(!t)return null;for(let e of X){let n=e.match(t);if(n)return n}return null}function Zs(e,t){let n=Qs(t);return n&&e.match(n)}function Qs(e){return typeof e==`string`?N(e):null}const $s={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 ec(e,t){if(t.platform!==e.platform)return null;let n=Zs(e,t.url);if(n?.platform!==t.platform||n.id!==t.id||n.url!==t.url||!$s[t.platform].includes(`${t.kind} ${t.variant}`))return null;if(t.fallbackHtml===void 0||tc(e,t,t.fallbackHtml))return t;let r={...t};return delete r.fallbackHtml,r}function tc(e,t,n){let r=e.fallback,i=E(n);if(!r||!i||k(i,r)!==n)return!1;if(t.platform!==`x`)return!0;let[a]=E(`<blockquote class="twitter-tweet">${n}</blockquote>`)??[];return a?.type===`element`&&e.parse(a)?.id===t.id}const Z={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 nc(e){return`social-embeds: a ${Z[e]} URL needs a lookup: use the embed code`}function rc(e,t,n){let{platform:r}=n,i=t??(e===void 0?null:Zs(n,e));if(!i&&e!==void 0&&Ys(e)===r)return{error:nc(r)};if(!i)return{error:`social-embeds: not a ${Z[r]} post URL: ${String(e)}`};if(i.platform!==r)return{error:`social-embeds: expected a ${Z[r]} embed, got ${Z[i.platform]}`};let a=ec(n,i);return a?{embed:a}:{error:`social-embeds: the ${Z[r]} embed's url and id do not match`}}function ic(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=Ys(e.url);return t?nc(t):`social-embeds: not a supported post URL: ${e.url}`}function ac(e){if(typeof e!=`string`)return null;let t=E(e);return t?sc(t):oc(e)}function oc(e){for(let t of X){let n=t.repair?.(e),r=n==null?null:E(n),i=r&&sc(r);if(i?.platform===t.platform)return i}return null}function sc(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(cc(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 X){let n=t.parseScript?.(e);if(n)return n}return null}for(let e of X){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 cc(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function lc(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function Q(e){return e===null?void 0:lc(e.trim().replace(/px$/i,``))}function uc(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function dc(e,t){let n=t??e.getAttribute(`html`)??uc(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:lc(i)??(i?.trim()?i:void 0),maxWidth:Q(e.getAttribute(`max-width`)),height:Q(e.getAttribute(`height`)),maxHeight:Q(e.getAttribute(`max-height`))},eager:e.hasAttribute(`eager`)}}function fc(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function pc(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=fc(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 mc(e,t){let n=fc(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 hc(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 gc=/* @__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`&&gc.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function _c(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 vc(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 yc(e,t){return`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(window.location.hostname)}`}function bc(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function xc(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o,...s}=n,{messageHeight:c}=t,l=document.createElement(`div`);$(l,pc(t,s));let u=bc(document.createElement(`div`)),d=bc(document.createElement(`div`)),f=i.length>0?i:[t.fallbackHtml===void 0?_c():Sc(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)}),_())},ee=c?`did not report its height`:`did not load`,y=()=>{h=setTimeout(()=>{m||(d.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${ee}`)))},15e3)},b=e=>{let n=document.createElement(`iframe`);n.src=t.hostParam?yc(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)},x=()=>{t.sizeInSrc?g.push(hc(u,e=>{b(mc(t,e))})):b(t.src)};return r?(x(),g.push(vc(u,!1,y))):g.push(vc(u,!1,()=>{x(),y()})),{wrapper:l,cleanup:()=>{for(let e of g)e();clearTimeout(h),window.removeEventListener(`message`,v),l.remove()}}}function Sc(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const Cc=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function wc(e){let t=e.querySelector(Cc.map(e=>`[${e}]`).join());for(let e of Cc){let n=t?.getAttribute(e);if(n)return n}}function Tc(e){return`View this post on ${e}`}function Ec(e){return e instanceof Error?e:Error(String(e))}function Dc(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=wc(d),p=t.hasFallback?[]:o.length>0?o:[_c(t.minHeight)];u.append(...p),l.append(u),e.append(l);let m=e=>{for(let e of p)e.parentNode?.removeChild(e);p=e,u.append(...e)},h=!1,g=!1,_,v=()=>{},ee=()=>{h||g||(g=!0,clearTimeout(_),v(),m([]),s())},y=e=>{if(t.hasFallback||f===void 0)m([]);else{let e=document.createElement(`a`);e.setAttribute(`href`,f),e.textContent=Tc(i),m([e])}c(e)},b=(e,t)=>{h||g||(v(),v=()=>{},e>=3?y(t):_=setTimeout(()=>{x(e+1)},1e3*2**(e-1)))},x=e=>{if(!(h||g)){try{v=r.render(d,ee)}catch(t){b(e,Ec(t));return}_=setTimeout(()=>{b(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},S=vc(d,a,()=>{r.load().then(()=>{x(1)},e=>{h||y(Ec(e))})});return{wrapper:l,cleanup:()=>{h=!0,S(),clearTimeout(_),v(),l.remove()}}}const Oc=typeof HTMLElement>`u`?class{}:HTMLElement,kc=`embed`;function Ac(e){let t=[];for(let n of e.childNodes)(n.nodeType===Node.ELEMENT_NODE&&!(n instanceof HTMLTemplateElement)||n.nodeType===Node.TEXT_NODE&&n.textContent?.trim())&&t.push(n.cloneNode(!0));return t}function jc(e){let t=`html`in e?ac(e.html):Xs(e.url);if(!t){let t=`html`in e?js(e.html):null;return t?Hs(t):{kind:`error`,message:ic(e)}}let n=ys(t.platform);if(!n)return{kind:`error`,message:ic(e)};let r=rc(void 0,t,n);return r.error===void 0?Lt(r.embed):{kind:`error`,message:r.error}}const Mc=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var Nc=class extends Oc{static observedAttributes=[`html`,`url`,`width`,`max-width`,`height`,`max-height`,`eager`];#e=null;#t;#n;#r;#i=()=>{};#a=0;#o=!1;constructor(){super(),this.attachShadow({mode:`open`}).innerHTML=`<slot name="${kc}"></slot>`;for(let e of Mc){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&&document.readyState===`loading`?this.#o||(this.#o=!0,document.addEventListener(`DOMContentLoaded`,()=>{this.#o=!1,this.isConnected&&this.connectedCallback()},{once:!0})):(this.#t??=new MutationObserver(()=>{this.#s(),this.#l()}),this.#s(),this.#l())}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#t?.disconnect(),this.#u(),this.#r=void 0)})}attributeChangedCallback(){this.#l()}#s(){let e=this.#t;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)return;for(let e of[...this.children])e!==this.#n&&e.slot===kc&&e.remove();let e=dc(this,this.#e),t=JSON.stringify(e);(t!==this.#r||this.#n&&this.#n.parentNode!==this)&&(this.#u(),this.#r=t,this.#d(e))}#u(){this.#a+=1,this.#n=void 0;let e=this.#i;this.#i=()=>{},e()}#d(e){let{source:t,layout:n,eager:r}=e;if(!t)return;let i=this.#a,a=e=>{queueMicrotask(()=>{i===this.#a&&this.isConnected&&this.dispatchEvent(e)})},o=e=>{a(new ErrorEvent(`error`,{error:e,message:e.message}))},s=jc(t);if(s.kind===`error`){o(Error(s.message));return}let c={...n,eager:r,placeholder:Ac(this),onLoad:()=>{a(new Event(`load`))},onError:o},{wrapper:l,cleanup:u}=s.kind===`iframe`?xc(this,s,c):Dc(this,s,c);l.slot=kc,this.#n=l,this.#i=u}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,Nc);export{Nc 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=3e3,p=/* @__PURE__ */ new Map;function m(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=p.get(e.key);return t||(t=h(e).catch(t=>{throw p.delete(e.key),t}),p.set(e.key,t)),t}async function h(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await g(e,t)||await v(e)}await e.whenPresent?.()}function g(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?f:d),i,a=()=>{r=Date.now()+f},o=()=>{clearTimeout(i),window.removeEventListener(`load`,a);for(let e of t)e.removeEventListener(`error`,o);n(e.isPresent())},s=()=>{e.isPresent()||Date.now()>=r?o():i=setTimeout(s,50)};window.addEventListener(`load`,a);for(let e of t)e.addEventListener(`error`,o);s()})}var _=class extends Error{};async function v(e){let t=e.readyCallback?.();for(let t=1;;t++)try{let n=await y(e);if(t>=3||!e.skipped?.())break;n.remove()}catch(e){if(!(e instanceof _)||t>=3)throw e;await x(1e3*2**(t-1))}await(t?b(t,`${e.url} did not report ready`):ee(e))}async function y(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);let i=document.querySelector(`script[nonce]`)?.nonce;i&&n.setAttribute(`nonce`,i),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new _(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await b(r,`${e.url} did not load`)}finally{t?.()}return n}function ee(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 b(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 x(e){return new Promise(t=>setTimeout(t,e))}const S=()=>window,C=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function ne(e){return()=>{let t=S().instgrm?.Embeds;return t?.registeredEmbedSDKs?.[e]===!0&&typeof t.process==`function`}}const re={key:`x`,url:`https://platform.twitter.com/widgets.js`,isOwn:e=>/^https?:\/\/platform\.(?:twitter|x)\.com\/widgets\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=S().twttr?.ready;t?t(()=>{e()}):e()})};function ie(){let e=S().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ae(e){let t=ne(e);return()=>{let e=S().FB;return!t()&&e!==void 0&&!e.__buffer}}const oe={key:`instagram`,url:`https://www.instagram.com/embed.js`,isOwn:e=>/^https?:\/\/www\.instagram\.com\/embed\.js(?:[?#]|$)/.test(e),isPresent:ne(`instagram`),prepare:ie,skipped:ae(`instagram`)},se={key:`threads`,url:`https://www.threads.com/embed.js`,isOwn:e=>/^https?:\/\/www\.threads\.(?:com|net)\/embed\.js(?:[?#]|$)/.test(e),isPresent:ne(`threads`),prepare:ie,skipped:ae(`threads`)};function ce(e){return{key:`facebook`,url:`https://connect.facebook.net/${e}/sdk.js#xfbml=0&version=${C}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=S().fbAsyncInit;S().fbAsyncInit=()=>{t?.(),e()}})}}const le={key:`pinterest`,url:`https://assets.pinterest.com/js/pinit_main.js`,isOwn:e=>/^https?:\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof S().PinUtils?.build==`function`};function w(e,{locale:t=`en_US`}={}){switch(e){case`x`:return m(re);case`instagram`:return m(oe);case`threads`:return m(se);case`pinterest`:return m(le);case`facebook`:return te.test(t)?m(ce(t)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${t}"`))}}const T=()=>window;var ue=class extends Error{};function de(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 fe(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function pe(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const me={load:()=>w(`x`),render(e,t){let n=T().twttr,r=n=>{n.target instanceof Node&&e.contains(n.target)&&t()};n?.events?.bind?.(`rendered`,r);let i=de(e,pe,t);return fe(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function he(e,t){if(e.getRootNode()!==document)throw new ue(`social-embeds: the ${t} embed cannot render inside a shadow root`)}function ge(){let e=T().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const _e={load:()=>w(`instagram`),render(e,t){he(e,`Instagram`);let n=de(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return fe(e,`instagram-media`),ge(),n}},ve={load:()=>w(`threads`),render(e,t){he(e,`Threads`);let n=de(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return fe(e,`text-post-media`),ge(),n}},ye=/* @__PURE__ */ new Map;function be(e){let t=ye.get(e);return t||(t={load:()=>w(`facebook`,{locale:e}),render(e,t){let n=T().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:C}),i()}return()=>{}}},ye.set(e,t)),t}const xe={load:()=>w(`pinterest`),render(e,t){let n=T().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=de(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}},Se=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),Ce=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),we=/<([a-zA-Z][a-zA-Z0-9-]*)/y,Te=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,Ee=/\s*(\/?)>/y,De=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Oe=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function E(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}De.lastIndex=a;let s=De.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=De.lastIndex;continue}let c=ke(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:Ce.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&&!Se.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function ke(e,t){we.lastIndex=t;let n=we.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=we.lastIndex;for(;;){Ee.lastIndex=i;let t=Ee.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:Ee.lastIndex};Te.lastIndex=i;let a=Te.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Ae(s??c??l??``)),i=Te.lastIndex}}function Ae(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 Oe.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 D(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function O(e){let t=[];return je(e,t),t}function je(e,t){for(let n of e)n.type===`element`&&(t.push(n),je(n.children,t))}const Me=/* @__PURE__ */ new Set([`href`,`cite`]),Ne=/^https?:\/\//i;function k(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)||Me.has(e)&&!Ne.test(i)||(n+=` ${e}="${A(i)}"`)}n+=`>`,Se.has(r.tag)||(n+=`${k(r.children,t)}</${r.tag}>`)}}return n}function A(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function Pe(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${A(String(r))}"`);return t}function Fe(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Pe(n)}function j(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function M(e){return e!==void 0&&e.trim()!==``}const Ie={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Le={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},Re={post:300,video:200};function ze(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 Be(e,t){if(e.variant===`iframe`)return ze(e);let n=j(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(Le)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,ze({...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="${A(e.url)}"${Fe(Ie,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:be(i),minHeight:Re[e.kind],label:`Facebook`,hasFallback:M(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}const Ve=[`header`,`footer`,`context`],He=/\/albums\/\d+$/;function Ue(e,t){let n=He.test(e.url),r=Ve.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 We(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 Ge={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 Ke(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:Ge,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function qe(e,t){let n=j(e.options,{captioned:t.captioned}),r=`<blockquote${Pe({"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:_e,minHeight:680,label:`Instagram`,hasFallback:M(e.fallbackHtml),maxWidth:540}}const Je=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Ye(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])=>Je.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function Xe(e,t){let n=new Map(Object.entries(e.options));return t.collapsed===!0&&n.set(`collapsed`,1),t.collapsed===!1&&n.delete(`collapsed`),{kind:`iframe`,src:`https://www.linkedin.com/embed/feed/update/${e.id}${a(n)}`,title:`LinkedIn post`,allow:``,ratio:{width:504,height:670},height:e.size?.height??670,maxWidth:e.size?.width??504}}const Ze={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},Qe={small:236,medium:345,large:600};function $e(e,t){let n=j(e.options,{width:t.pinWidth}),r=`<a href="${A(e.url)}"${Fe(Ze,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:xe,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:Qe[String(n.width)]??236}}const et={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},tt={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 nt(e,t){let n=[];for(let[e,r]of Object.entries(et)){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:tt,startHeight:e.size?.height??316,maxWidth:640}}function rt(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 it={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 at(e,t){let n=[];for(let[e,r]of Object.entries(it)){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 ot(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 st=/* @__PURE__ */ new Set([`track`,`episode`]);function ct(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??(st.has(n)?152:352)}}const lt={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 ut(e){return e===`minimal`?`minimal`:`standard`}function dt(e,t){let n=e.id.startsWith(`route/`),r=ut(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:lt,startHeight:650,...i?{}:{maxWidth:554}}}const ft=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),pt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function mt(e,t){let n=Object.entries(e.options).filter(([e])=>ft.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,pt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const ht=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function gt(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 _t={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 vt(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 ht){let n=gt(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:_t,startHeight:300,maxWidth:500}}function yt(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 bt(e,t){let n=j(e.options,{theme:t.theme}),r=`<blockquote${Pe({"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:ve,minHeight:240,label:`Threads`,hasFallback:M(e.fallbackHtml),maxWidth:658}}const xt={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 St(e,t){let n=o(t,xt);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 Ct(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const wt={origin:`https://truthsocial.com`,read:Ct},Tt={origin:`https://truthsocial.com`,read(e){let t=Ct(e);return t===void 0||t<=0?void 0:t+165}},Et=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Dt(e){let t=Et.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?Tt:wt,startHeight:150,maxWidth:e.size?.width??600}}const Ot={origin:`https://embed.tumblr.com`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e),[n]=Array.isArray(t.args)?t.args:[];return t.method===`tumblr-post:sizeChange`&&typeof n==`number`?n:void 0}};function kt(e){return{kind:`iframe`,src:`https://embed.tumblr.com/embed/post/${e.url.slice(23).split(`/`)[0]??``}/${e.id}/v2`,title:`Tumblr post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Ot,startHeight:400,maxWidth:540}}const At=[`channel`,`video`,`collection`,`clip`,`parent`];function jt(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 Mt(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]=jt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,At),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,hostParam:`parent`}}const Nt={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 Pt(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Nt),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 Ft={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function It(e,t){let n=j(e.options,{...t}),r=e.fallbackHtml??`<a href="${A(e.url)}"></a>`,i=`<blockquote${Fe(Ft,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:me,minHeight:250,label:`X`,hasFallback:M(e.fallbackHtml),maxWidth:550}}const Lt={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 Rt(e){return e.url.startsWith(`https://www.youtube.com/playlist?`)?{path:`videoseries`,key:`list`}:e.url.startsWith(`https://www.youtube.com/channel/`)?{path:`live_stream`,key:`channel`}:{path:e.id}}function zt(e,t){let{nocookie:n,...r}=t,{nocookie:s,...c}=e.options,l=n??s===!0?`https://www.youtube-nocookie.com`:`https://www.youtube.com`,{path:u,key:d}=Rt(e),f=o(r,Lt).filter(([e])=>e!==d);return{kind:`iframe`,src:`${l}/embed/${u}${a(d===void 0?void 0:[[d,e.id]],i(c,d===void 0?[]:[d]),f)}`,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 Bt(e){switch(e.platform){case`x`:return It(e,{});case`instagram`:return qe(e,{});case`threads`:return bt(e,{});case`facebook`:return Be(e,{});case`tiktok`:return St(e,{});case`youtube`:return zt(e,{});case`telegram`:return vt(e,{});case`snapchat`:return rt(e);case`linkedin`:return Xe(e,{});case`reddit`:return nt(e,{});case`pinterest`:return $e(e,{});case`spotify`:return ct(e,{});case`vimeo`:return Pt(e,{});case`twitch`:return Mt(e,{});case`dailymotion`:return u(e,{});case`bluesky`:return c(e,{});case`soundcloud`:return at(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return kt(e);case`kick`:return Ye(e,{});case`giphy`:return We(e);case`tenor`:return yt(e);case`streamable`:return mt(e,{});case`rumble`:return ot(e);case`truthsocial`:return Dt(e);case`imgur`:return Ke(e,{});case`strava`:return dt(e,{});case`flickr`:return Ue(e,{});default:return e.platform}}const Vt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function N(e){let t=Vt.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.replaceAll(`&`,`&`).split(`&`)){if(e===``)continue;let t=e.indexOf(`=`),n=Ht(t===-1?e:e.slice(0,t)),r=Ht(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 Ht(e){try{return decodeURIComponent(e.replace(/\+/g,` `))}catch{return null}}function P(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function F(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function I(e,t){return e===t||e.startsWith(`${t}/`)}function L(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 R(e){let t=F(e.attrs.get(`width`)),n=F(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function z(e,t){return t?{...e,size:t}:e}function B(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=Ut(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Ut(e,t){return t===0?e:Ut(t,e%t)}const Wt=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),Gt=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),Kt=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),V=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),qt=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),H=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),Jt=/* @__PURE__ */ new Set([`player.kick.com`]),Yt=`embed.music.apple.com`,Xt=`embed.podcasts.apple.com`,Zt=e=>Gt.has(e.host)||Wt.has(e.host)&&I(e.path,`/embed`),Qt=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||Kt.has(e.host)&&(I(e.path,`/embed`)||I(e.path,`/video`)),$t=e=>V.has(e.host)&&I(e.path,`/player`),en=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&I(e.path,`/embed`),tn=e=>e.host===`player.vimeo.com`,nn=e=>qt.has(e.host)&&I(e.path,`/plugins`),rn=e=>H.has(e.host)&&I(e.path,`/embed`),an=e=>Jt.has(e.host),on=e=>e.host===`www.linkedin.com`&&I(e.path,`/embed`),sn=e=>e.host===`assets.pinterest.com`,cn=e=>e.host===Yt,ln=e=>e.host===Xt,un=e=>e.host===`w.soundcloud.com`,dn=e=>e.host===`open.spotify.com`&&I(e.path,`/embed`),fn=e=>e.host===`rumble.com`&&I(e.path,`/embed`),pn=e=>e.host===`streamable.com`&&(I(e.path,`/e`)||I(e.path,`/o`)),mn=e=>e.host===`tenor.com`&&I(e.path,`/embed`),hn=e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`);function gn(e){return[Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn].some(t=>t(e))}const _n=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],vn=/* @__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`]),yn=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),bn=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,xn=RegExp(`^(?:https:)?//${bn}(?:[/?#]|$)`,`i`),Sn=RegExp(`^(?:\\*|'self'|'src'|'none'|https://${bn})$`,`i`),Cn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,wn=/[\t\n\f\r ]+/,Tn=/^\s*(width|height)\s*:(.*)$/is,En=/^(\d+)px$/i,Dn=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function On(e){if(typeof e!=`string`)return null;let t=E(e);if(!t)return null;let n=O(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=R(r)??Ln(r);return An({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&&B(a,Dn)?.size})}function kn(e){return An(e)}function An(e){if(typeof e!=`object`||!e)return null;let t=e,n=jn(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=_n.find(e=>e===i),o=Pn(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Mn(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Nn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:In(t.size),...o?{ratio:o}:{}}}function jn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=xn.test(t)&&!t.includes(`\\`)?N(t):null;return!n||Cn.test(n.path)||gn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function Mn(e){return e.split(`;`).map(e=>e.split(wn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&yn.has(e)&&t.every(e=>Sn.test(e))).map(e=>e.join(` `)).join(`; `)}function Nn(e){let t=e.split(wn).map(e=>e.toLowerCase()).filter(e=>vn.has(e));return[...new Set(t)].join(` `)}function Pn(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Fn(t)&&Fn(n)?{width:t,height:n}:void 0}function Fn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function In(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?F(String(t)):void 0,i=typeof n==`number`?F(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Ln(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Tn.exec(r)??[],a=F(En.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 Rn={width:16,height:9};function zn(e){let t=kn(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}:{},...Bn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Bn({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??Rn,...n===void 0?{}:{maxWidth:n}}:{ratio:Rn,height:r}}const Vn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Hn=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Un=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,Wn=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),Gn=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function Kn(e){let t=typeof e==`string`?N(e):null;if(!t)return null;if(Wn.has(t.host))return Gn.test(t.path)?`rumble`:null;if(!Vn.has(t.host))return null;let[,n]=Hn.exec(t.path)??[];return n!==void 0&&Un.test(n)?`bluesky`:null}const qn=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,Jn=/^\d{1,15}$/;function Yn(e,t){if(e?.host!==t)return null;let[,n,r,i]=qn.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!Jn.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!Jn.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const Xn={platform:`applemusic`,parse(e){if(e.tag!==`iframe`)return null;let t=Yn(N(e.attrs.get(`src`)??``),Yt);if(!t)return null;let{height:n}=R(e)??{};return z({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1,match(e){let t=Yn(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:cn},Zn=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,Qn=/^\d{1,15}$/;function $n(e,t){if(e?.host!==t)return null;let[,n,r]=Zn.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!Qn.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 er={platform:`applepodcasts`,parse(e){if(e.tag!==`iframe`)return null;let t=$n(N(e.attrs.get(`src`)??``),Xt);return t&&z({...t,options:{}},R(e))},isOwnScript:()=>!1,match(e){let t=$n(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:ln},tr=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,nr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,rr=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),ir=RegExp(`^/profile/${tr}/post/${nr}/?$`),ar=RegExp(`^at://${tr}/app\\.bsky\\.feed\\.post/${nr}$`),or=/^[a-z2-7]{20,100}$/,sr=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),cr=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,lr=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function ur(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 dr(e){if(!e||!rr.has(e.host))return null;let[,t,n]=ir.exec(e.path)??[];return t===void 0||n===void 0?null:ur(t,n)}const fr={platform:`bluesky`,fallback:lr,parse(e){if(e.tag!==`blockquote`||!D(e,`bluesky-embed`))return null;let[,t,n]=ar.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=ur(t,n);if(O(e.children).reverse().map(e=>e.tag===`a`?dr(N(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&&or.test(a)&&(i.cid=a);let o=e.attrs.get(`data-bluesky-embed-color-mode`);return o!==void 0&&sr.has(o)&&(i.colorMode=o),{...r,options:i,fallbackHtml:k(e.children,lr)}},isOwnScript:e=>cr.test(e),match(e){let t=dr(e);return t&&{...t,options:{}}}},pr=/^x[a-z0-9]{4,12}$/,mr=/^x[a-z0-9]{3,12}$/,hr=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/;function gr(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function _r(e){if(e.host!==`geo.dailymotion.com`||e.query.has(`playlist`))return null;let t=/^\/player(?:\/([a-z0-9]+))?\.html$/.exec(e.path);if(!t)return null;let[,n]=t,r=e.query.get(`video`)??``;if(!pr.test(r)||n!==void 0&&!mr.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,P(t)]));return n!==void 0&&(i.playerId=n),gr(r,i)}function vr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return pr.test(t)?gr(t,{}):null}if(!Kt.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&pr.test(t)?gr(t,{}):null}const yr={platform:`dailymotion`,parse(e){let t=B(e,hr),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=N(n.attrs.get(`src`)??``);if(!r)return null;let i=_r(r)??vr(r);return i&&z(i,t?.size??R(n))},isOwnScript:()=>!1,match(e){return _r(e)??vr(e)},ownsFrame:Qt},br=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),U=`https://www.facebook.com`,xr=`[A-Za-z0-9.\\-]{1,80}`,Sr=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Cr=RegExp(`^/(${xr})/posts/(${Sr})/?$`),wr=RegExp(`^/(${xr})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Tr=RegExp(`^/(${xr})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),Er=/^\/reel\/(\d{1,25})\/?$/,Dr=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),Or=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),kr=RegExp(`^${Sr}$`),Ar=/^\d{1,25}$/,jr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Mr=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Nr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Pr={name:`class`,value:/^fb-xfbml-parse-ignore$/},Fr=/* @__PURE__ */ new Map([[`div`,[Pr]],[`blockquote`,[`cite`,Pr]],[`a`,[`href`]],[`p`,[]]]);function Ir(e){if(!e||!br.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Cr.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${U}/${r}/posts/${i}`};if(Dr.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!kr.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Ar.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${U}${t}?story_fbid=${e}${i}`}}if(Or.has(t)){let e=n.get(`fbid`);return e===void 0||!Ar.test(e)?null:{kind:`post`,id:e,url:`${U}${t}?fbid=${e}`}}let[,a,o,s]=wr.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${U}/${a}/photos/${o}/${s}/`};let[,c,l]=Tr.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${U}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!Ar.test(e)?null:{kind:`video`,id:e,url:`${U}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=Er.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${U}/reel/${u}`}}function W(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const Lr={platform:`facebook`,fallback:Fr,parse(e){if(e.tag===`div`){let t=D(e,`fb-post`)?`post`:D(e,`fb-video`)?`video`:null,n=Ir(N(e.attrs.get(`data-href`)??``));return!t||!n?null:{...W(n,t,`sdk`,L(e,Mr,P)),fallbackHtml:k(e.children,Fr)}}if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||!qt.has(t.host))return null;let n=Ir(N(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=P(r)),i!==void 0&&(e.width=P(i)),W(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=P(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of Nr){let i=t.query.get(n);i!==void 0&&(e[r]=P(i))}let r=F(t.query.get(`width`)),i=F(t.query.get(`height`));return z(W(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return z(W(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,P(t)]))),R(e))}return null},isOwnScript:e=>jr.test(e),scriptOptions(e){let[,t]=jr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0,match(e){let t=Ir(e);return t&&W(t,t.kind,`sdk`,{})},ownsFrame:nn},Rr=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),zr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,Br=`(\\d{1,20})`,Vr=RegExp(`^/photos/${zr}/${Br}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),Hr=RegExp(`^/photos/${zr}/(?:albums|sets)/${Br}/?$`),Ur=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,Wr=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,Gr=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,Kr=[`header`,`footer`,`context`],qr=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,Jr=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:qr},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function Yr(e){if(e===``)return null;let t=0n;for(let n of e){let e=Gr.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function Xr(e){let t=BigInt(e),n=``;for(;t>0n;)n=Gr.charAt(Number(t%58n))+n,t/=58n;return n}function Zr(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function Qr(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function $r(e){if(!e||!Rr.has(e.host))return null;let[,t,n]=Hr.exec(e.path)??[];if(t!==void 0&&n!==void 0)return Qr(t,n);let[,r,i]=Vr.exec(e.path)??[];return r===void 0||i===void 0?null:Zr(r,i)}function ei(e){if(e.host!==`flic.kr`)return null;let[,t]=Ur.exec(e.path)??[],n=t===void 0?null:Yr(t);return t===void 0||n===null||Xr(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}function ti(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 ni={platform:`flickr`,fallback:Jr,parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=$r(N(e.attrs.get(`href`)??``)),n=ti(e);if(!t||!n)return null;let r={};for(let t of Kr)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=R(n),a=qr.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return z({...t,options:r,fallbackHtml:k([a],Jr)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>Wr.test(e),match(e){let t=$r(e)??ei(e);return t&&{...t,options:{}}}},G=`([A-Za-z0-9]{6,40})`,ri=RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${G}/?$`),ii=RegExp(`^/embed/${G}/?$`),ai=/^(?:media\d?|i)\.giphy\.com$/,oi=`\\.(?:gif|webp|mp4)`,si=RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${G}/[A-Za-z0-9_-]{1,40}${oi}$`),ci=RegExp(`^/${G}${oi}$`),li=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function ui(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function di(e){if(e){if(H.has(e.host))return(ri.exec(e.path)??ii.exec(e.path))?.[1];if(ai.test(e.host))return(si.exec(e.path)??(e.host===`i.giphy.com`?ci.exec(e.path):null))?.[1]}}function fi(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||!H.has(t.host))return null;let[,n]=ii.exec(t.path)??[];return n===void 0?null:ui(n)}function pi(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=N(n.attrs.get(`href`)??``);if(!i||!H.has(i.host)||ri.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 mi={platform:`giphy`,parse(e){let t=B(e,li),n=t?.iframe??e,r=fi(n);return r?z({...r,options:{}},t?.size??R(n)):null},isOwnScript:()=>!1,isOwnExtra:pi,match(e){let t=di(e);return t===void 0?null:{...ui(t),options:{}}},ownsFrame:rn},hi=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),K=`([A-Za-z0-9]{5,7})`,gi=RegExp(`^(a/)?${K}$`),_i=RegExp(`^/a/${K}/?$`),vi=RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${K}/?$`),yi=RegExp(`^/${K}/?$`),bi=RegExp(`^/${K}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),xi=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/,Si=/* @__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`]),Ci=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function wi(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function Ti(e){return e===void 0||Si.has(e.toLowerCase())?void 0:e}function Ei(e){if(!e)return;if(e.host===`i.imgur.com`)return Ti(bi.exec(e.path)?.[1]);if(!hi.has(e.host))return;let t=(_i.exec(e.path)??vi.exec(e.path))?.[1];return t===void 0?Ti(yi.exec(e.path)?.[1]):`a/${t}`}function Di(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:Di(e.children)}})}function Oi(e,t){return e.attrs.get(t)===`false`}const ki={platform:`imgur`,fallback:Ci,parse(e){if(e.tag!==`blockquote`||!D(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=gi.exec(t)??[];if(r===void 0||n===void 0&&!Ti(r))return null;let i={};return Oi(e,`data-context`)&&(i.context=!1),Oi(e,`data-analytics`)&&(i.analytics=!1),{...wi(t),options:i,fallbackHtml:k(Di(e.children),Ci)}},isOwnScript:e=>xi.test(e),match(e){let t=Ei(e);return t===void 0?null:{...wi(t),options:{}}}},Ai=/* @__PURE__ */ new Set([`instagram.com`,`www.instagram.com`]),ji=/^\/(?:([A-Za-z0-9._]{1,30})\/)?(p|reel|reels|tv)\/([A-Za-z0-9_-]{1,64})\/?$/,Mi=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Ni=/* @__PURE__ */ new Set([`p`,`reel`]),Pi=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,Fi=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Ii(e){if(!e||!Ai.has(e.host))return null;let[,t,n,r]=ji.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Mi.has(t)||!Ni.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const Li={platform:`instagram`,fallback:Fi,parse(e){if(e.tag!==`blockquote`||!D(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?O(e.children).reverse().map(e=>e.tag===`a`?Ii(N(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Ii(N(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=P(i)),{...n,options:r,fallbackHtml:k(e.children,Fi)}},isOwnScript:e=>Pi.test(e),match(e){let t=Ii(e);return t&&{...t,options:{}}}},Ri=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),zi=/^\/([A-Za-z0-9_-]{1,32})\/?$/,Bi=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]),Vi=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function Hi(e,t){if(!e||!t.has(e.host))return null;let[,n]=zi.exec(e.path)??[];if(n===void 0||Bi.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const Ui={platform:`kick`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``),n=Hi(t,Jt);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>Vi.has(e)).map(([e,t])=>[e,P(t)]));return z({...n,options:r},R(e))},isOwnScript:()=>!1,match(e){let t=Hi(e,Ri)??Hi(e,Jt);return t&&{...t,options:{}}},ownsFrame:an},Wi=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,Gi=`(activity|share|ugcPost):(\\d{19})`,Ki=RegExp(`^(?:/embed)?/feed/update/urn:li:${Gi}/?$`),qi=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`),Ji=RegExp(`^/embed/feed/update/urn:li:${Gi}$`);function Yi(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 Xi=e=>e.replace(/%3A/gi,`:`),Zi={platform:`linkedin`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=Ji.exec(t.path)??[];return n===void 0||r===void 0?null:z(Yi(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,P(t)]))),R(e))},isOwnScript:()=>!1,match(e){if(!Wi.test(e.host))return null;let t=Xi(e.path),[,n,r]=Ki.exec(t)??qi.exec(t)??[];return n===void 0||r===void 0?null:Yi(n,r)},ownsFrame:on},Qi=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,$i=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/,ea=/^\d{1,25}$/,ta=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,na=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]];function ra(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function ia(e){if(!e||!Qi.test(e.host))return null;let[,t]=$i.exec(e.path)??[];return t===void 0?null:ra(t)}const aa={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=ia(N(e.attrs.get(`href`)??``));return t&&{...t,options:L(e,na,P)}}if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&ea.test(n)?{...ra(n),options:{}}:null},isOwnScript:e=>ta.test(e),match(e){let t=ia(e);return t&&{...t,options:{}}},ownsFrame:sn},oa=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),sa=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/,ca=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,la=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,ua=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]);function da(e){if(!e||!oa.has(e.host))return null;let[,t,n,r,i]=sa.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 fa={platform:`reddit`,parse(e){if(e.tag!==`blockquote`||!(D(e,`reddit-embed-bq`)||D(e,`reddit-card`)))return null;let t=O(e.children).map(e=>e.tag===`a`?da(N(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=F(e.attrs.get(`data-embed-height`));return z({...t,options:L(e,ua,P)},n===void 0?void 0:{height:n})},isOwnScript:e=>ca.test(e)||la.test(e),match(e){let t=da(e);return t&&{...t,options:{}}}},pa=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),ma=`([A-Za-z][A-Za-z0-9._-]{1,29})`,ha=RegExp(`^(?:/@${ma})?/spotlight/([A-Za-z0-9_-]{20,120})$`),ga=RegExp(`^/(?:@|add/)${ma}$`),_a=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,va=RegExp(`^/@${ma}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`),ya=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/;function ba(e){if(!e||!pa.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=ha.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]=ga.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=_a.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=va.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const xa={platform:`snapchat`,parse(e){if(e.tag!==`blockquote`||!D(e,`snapchat-embed`))return null;let t=N(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=ba({...t,path:t.path.slice(0,-6)});if(!n||!O(e.children).filter(e=>e.tag===`a`).every(e=>{let t=ba(N(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=F(e.attrs.get(`data-snapchat-embed-width`)),a=F(e.attrs.get(`data-snapchat-embed-height`));return z({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>ya.test(e),match(e){let t=ba(e);return t&&{...t,options:{}}}},Sa=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Ca=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,wa=`[a-z0-9_-]{1,64}`,Ta=`s-[A-Za-z0-9]{1,32}`,Ea=RegExp(`^/(${wa})(?:/(sets/${wa}|${wa})(?:/(${Ta}))?)?/?$`,`i`),Da=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Oa=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),ka=RegExp(`^${Ta}$`);function Aa(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function ja(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Ca.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!ka.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return Aa(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function Ma(e){if(!Sa.has(e.host))return null;let[,t,n,r]=Ea.exec(e.path)??[];if(t===void 0||Da.has(t.toLowerCase())||n!==void 0&&Oa.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return Aa(`https://soundcloud.com/${i}`,i)}const Na=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function Pa(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!Na.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&Sa.has(N(e.attrs.get(`href`)??``)?.host??``)}function Fa(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&&Pa(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&Pa(r)}const Ia={platform:`soundcloud`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=ja(N(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!ka.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,P(t)])),{height:a}=R(e)??{};return z({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:Fa,match(e){let t=ja(e)??Ma(e);return t&&{...t,options:{}}},ownsFrame:un},La=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,Ra=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function za(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function Ba(e,t){return e&&t.has(e.host)?La.exec(e.path)?.[1]:void 0}const Va={platform:`rumble`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``),n=Ba(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=P(i)),z({...za(n),options:r},R(e))},isOwnScript:()=>!1,match(e){let t=Ba(e,Ra);return t===void 0?null:{...za(t),options:{}}},ownsFrame:fn},Ha=/* @__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)?/?$`),Ua=/* @__PURE__ */ new Set([`utm_source`,`si`]);function Wa(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=Ha.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 Ga(e){return Object.fromEntries([...e].filter(([e])=>!Ua.has(e)).map(([e,t])=>[e,P(t)]))}const Ka={platform:`spotify`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=Wa(t);if(!n)return null;let{query:r,...i}=n;return z({...i,options:Ga(r)},R(e))},isOwnScript:()=>!1,match(e){let t=Wa(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:dn},qa=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),Ja=/^\d{1,20}$/,Ya=/^\/(activities|routes)\/(\d{1,20})\/?$/,Xa=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,Za=/* @__PURE__ */ new Set([`standard`,`minimal`]),Qa=/^[A-Za-z0-9_-]{1,100}$/,$a={activity:`activities`,route:`routes`};function eo(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${$a[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}function to(e){return e===`activity`||e===`route`}const no={platform:`strava`,parse(e){if(e.tag!==`div`||!D(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(!to(t)||!Ja.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&Za.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&&Qa.test(a)&&(r.mapHash=a),{...eo(t,n),options:r}},isOwnScript:e=>Xa.test(e),match(e){if(!qa.has(e.host))return null;let[,t,n]=Ya.exec(e.path)??[];return t===void 0||n===void 0?null:{...eo(t===`routes`?`route`:`activity`,n),options:{}}}},ro=`([a-z0-9]{4,8})`,io=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),ao=RegExp(`^/[eo]/${ro}$`),oo=RegExp(`^/${ro}/?$`),so=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]),co=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,lo=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),uo=/<\/div\s*>$/i;function fo(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function po(e){return e!==void 0&&!so.has(e)}function mo(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=ao.exec(t.path)??[];if(!po(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>lo.has(e)).map(([e,t])=>[e,P(t)]));return{...fo(n),options:r}}function ho(e){if(!e||!io.has(e.host))return;let t=(ao.exec(e.path)??oo.exec(e.path))?.[1];return po(t)?t:void 0}const go={platform:`streamable`,parse(e){let t=B(e,co),n=t?.iframe??e,r=mo(n);return r?z(r,t?.size??R(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=uo.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=ho(e);return t===void 0?null:{...fo(t),options:{}}},ownsFrame:pn},_o=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),vo=`[A-Za-z][A-Za-z0-9_]{2,31}`,yo=RegExp(`^(${vo})/(\\d{1,10})$`),bo=RegExp(`^/(?:s/)?(${vo})/(\\d{1,10})/?$`),xo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,So=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Co=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]];function wo(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const To={platform:`telegram`,parse:()=>null,parseScript(e){if(!xo.test(e.attrs.get(`src`)??``)||So.some(t=>e.attrs.has(t)))return null;let[,t,n]=yo.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=L(e,Co,P);return e.attrs.has(`data-single`)&&(r.single=!0),wo(t,n,r)},isOwnScript:e=>xo.test(e),match(e){if(!_o.has(e.host))return null;let[,t,n]=bo.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)),wo(t,n,r)}},Eo=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),Do=`(\\d{1,20})`,Oo=RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${Do}/?$`),ko=RegExp(`^/embed/${Do}$`),Ao=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,jo=/^\d{1,3}(?:\.\d{1,20})?$/,Mo=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function No(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function Po(e){return e&&Eo.has(e.host)?Oo.exec(e.path)?.[1]:void 0}function Fo(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=Io(t,1e4);return{width:t/n,height:1e4/n}}function Io(e,t){return t===0?e:Io(t,e%t)}function Lo(e){if(!D(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!RegExp(`^${Do}$`).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!jo.test(n))return null;let r=Fo(n===void 0?1.33:Number(n));return r?z({...No(t),options:{},fallbackHtml:k(e.children,Mo)},r):null}function Ro(e){let t=N(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=ko.exec(t.path)??[];return n===void 0?null:z({...No(n),options:{}},R(e))}const zo={platform:`tenor`,fallback:Mo,parse(e){return e.tag===`div`?Lo(e):e.tag===`iframe`?Ro(e):null},isOwnScript:e=>Ao.test(e),match(e){let t=Po(e);return t===void 0?null:{...No(t),options:{}}},ownsFrame:mn},Bo=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),Vo=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,Ho=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,Uo=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],Wo=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function Go(e){if(!e||!Bo.has(e.host))return null;let[,t]=Vo.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const Ko={platform:`threads`,fallback:Wo,parse(e){if(e.tag!==`blockquote`||!D(e,`text-post-media`))return null;let t=Go(N(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:L(e,Uo,P),fallbackHtml:k(e.children,Wo)}},isOwnScript:e=>Ho.test(e),match(e){let t=Go(e);return t&&{...t,options:{}}}},qo=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/,Jo=/^\/player\/v1\/(\d{1,25})\/?$/,Yo=/^\d{1,25}$/,Xo=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/;function Zo(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const Qo={platform:`tiktok`,parse(e){if(e.tag===`blockquote`&&D(e,`tiktok-embed`)){let t=N(e.attrs.get(`cite`)??``),[,n,r]=t&&V.has(t.host)?qo.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Yo.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Zo(a,n)}if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||!V.has(t.host))return null;let[,n]=Jo.exec(t.path)??[];return n===void 0?null:z(Zo(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,P(t)]))),R(e))},isOwnScript:e=>Xo.test(e),match(e){if(!V.has(e.host))return null;let[,t,n]=qo.exec(e.path)??[];return t===void 0||n===void 0?null:Zo(n,t)},ownsFrame:$t},$o=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),es=`(@[A-Za-z0-9_.-]{1,64})`,ts=`(\\d{1,25})`,ns=RegExp(`^/${es}/(?:posts/)?${ts}/?$`),rs=RegExp(`^/${es}/${ts}/embed$`),is=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/;function as(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function os(e){if(!e||!$o.has(e.host))return null;let[,t,n]=ns.exec(e.path)??[];return t===void 0||n===void 0?null:as(t,n)}const ss={platform:`truthsocial`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=rs.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=D(e,`truthsocial-video`)?{video:!0}:{};return z({...as(n,r),options:i},R(e))},isOwnScript:e=>is.test(e),match(e){let t=os(e);return t&&{...t,options:{}}},ownsFrame:hn},cs=`([a-z0-9-]{1,32})`,q=`(\\d{1,20})`,ls=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),us=RegExp(`^/${cs}/${q}(?:/[^/]{1,200})?/?$`),ds=RegExp(`^${cs}\\.tumblr\\.com$`),fs=RegExp(`^/post/${q}(?:/[^/]{1,200})?/?$`),ps=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${cs})/${q}/v2$`),ms=RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${q}$`),hs=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]),gs=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/;function _s(e){if(!e)return null;let t,n;return ls.has(e.host)?[,t,n]=us.exec(e.path)??[]:([,t]=ds.exec(e.host)??[],[,n]=fs.exec(e.path)??[]),t===void 0||n===void 0||hs.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const vs={platform:`tumblr`,parse(e){if(e.tag!==`div`||!D(e,`tumblr-post`))return null;let t=N(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=ps.exec(t.path)??[],i=r??ms.exec(t.path)?.[1];if(i===void 0)return null;let[a,...o]=e.children.filter(e=>e.type!==`text`||e.raw.trim()!==``);if(o.length>0||a?.type!==`element`||a.tag!==`a`)return null;let s=_s(N(a.attrs.get(`href`)??``));return s?.id!==i||n!==void 0&&s.url!==`https://www.tumblr.com/${n}/${i}`?null:{...s,options:{}}},isOwnScript:e=>gs.test(e),match(e){let t=_s(e);return t&&{...t,options:{}}}},ys=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),bs=/^[A-Za-z0-9_]{3,25}$/,xs=/^v?(\d{1,12})$/,Ss=/^[A-Za-z0-9_-]{6,30}$/,Cs=/^[A-Za-z0-9_-]{6,100}$/,ws=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,Ts=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]),Es=[`autoplay`,`muted`,`time`];function J(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const Ds=e=>J(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),Os=e=>J(`https://www.twitch.tv/videos/${e}`,e),ks=e=>J(`https://www.twitch.tv/collections/${e}`,e),As=e=>J(`https://clips.twitch.tv/${e}`,e);function js(e){let t={};for(let n of Es){let r=e.get(n);r!==void 0&&(t[n]=P(r))}return t}function Ms(e){let t=e.query.get(`channel`);if(t!==void 0)return bs.test(t)?Ds(t):null;let[,n]=xs.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return Os(n);let r=e.query.get(`collection`);return r!==void 0&&Ss.test(r)?ks(r):null}function Ns(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return Cs.test(t)?{found:As(t),options:{}}:null}if(!ys.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=xs.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:Os(t),options:n!==void 0&&ws.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?Ss.test(r??``)?{found:ks(r??``),options:{}}:null:t.length===3&&r===`clip`?bs.test(n)&&Cs.test(i??``)?{found:As(i??``),options:{}}:null:t.length===1&&bs.test(n)&&!Ts.has(n.toLowerCase())?{found:Ds(n),options:{}}:null}const Ps={platform:`twitch`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=Ms(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=Cs.test(e)?As(e):null}return n&&z({...n,options:js(t.query)},R(e))},isOwnScript:()=>!1,match(e){let t=Ns(e);return t&&{...t.found,options:t.options}},ownsFrame:en},Fs=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Y=`(\\d{1,12})`,Is=`([0-9a-f]{6,20})`,Ls=[RegExp(`^/${Y}(?:/${Is})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${Y}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${Y}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${Y}/?$`)],Rs=RegExp(`^/video/${Y}/?$`),zs=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Bs=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/,Vs=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),Hs=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function Us(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function Ws(e){let[,t]=Hs.exec(e.fragment??``)??[];return t?{t}:{}}function Gs(e){if(!e||!Fs.has(e.host))return null;for(let t of Ls){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return Us(n,r)}return null}function Ks(e,t){if(e?.type!==`element`||e.tag!==`a`||e.attrs.size!==1)return!1;let n=N(e.attrs.get(`href`)??``);return n!==null&&Fs.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function qs(e,t){return e?.type===`text`&&e.raw.trim()===t}function Js(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,r,i,a,o,s,...c]=e.children;return c.length===0&&Ks(n,e=>Gs(e)?.id===t.id)&&qs(r,`from`)&&Ks(i,()=>!0)&&qs(a,`on`)&&Ks(o,e=>e.path===``||e.path===`/`)&&qs(s,`.`)}function Ys(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=Rs.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${Is}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!Vs.has(e)).map(([e,t])=>[e,P(t)]));return{...Us(t,n),options:{...r,...Ws(e)}}}const Xs={platform:`vimeo`,parse(e){let t=B(e,zs),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Ys(N(n.attrs.get(`src`)??``));return r&&z(r,t?.size??R(n))},isOwnScript:e=>Bs.test(e),isOwnExtra:Js,match(e){let t=Ys(e);if(t)return t;let n=Gs(e);return n&&{...n,options:Ws(e)}},ownsFrame:tn},Zs=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Qs=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,$s=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,ec=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,tc=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],nc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function rc(e,t=Qs){if(!e||!Zs.has(e.host))return null;let[,n=`i`,r]=t.exec(e.path)??[];return r===void 0?null:{platform:`x`,kind:`post`,url:`https://x.com/${n}/status/${r}`,id:r,variant:`sdk`}}const ic={platform:`x`,fallback:nc,parse(e){if(e.tag!==`blockquote`||!(D(e,`twitter-tweet`)||D(e,`twitter-video`)))return null;let t=O(e.children).reverse().map(e=>e.tag===`a`?rc(N(e.attrs.get(`href`)??``)):null).find(e=>e!==null);return t?{...t,options:L(e,tc,P),fallbackHtml:k(e.children,nc)}:null},isOwnScript:e=>ec.test(e),match(e){let t=rc(e,$s);return t&&{...t,options:{}}}},ac=`https://www.youtube.com`,oc=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,sc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,cc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,lc=/^\/([A-Za-z0-9_-]{11})\/?$/,uc=/^[A-Za-z0-9_-]{10,64}$/,dc=/^UC[A-Za-z0-9_-]{22}$/,fc=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,pc=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,mc=/^t=(.+)$/;function hc(e){if(e===void 0||e===``)return;let t=pc.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function gc(e){return hc(e.get(`start`))??hc(e.get(`t`))}function _c(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function vc(e,t=!1){return _c(e,t?`${ac}/shorts/${e}`:`${ac}/watch?v=${e}`)}function yc(e){return e!==void 0&&uc.test(e)?_c(e,`${ac}/playlist?list=${e}`):null}function bc(e){return e!==void 0&&dc.test(e)?_c(e,`${ac}/channel/${e}/live`):null}function xc(e){let[,t,n]=sc.exec(e.path)??[];if(n!==void 0)return{found:vc(n)};if(t===`videoseries`){let t=yc(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=bc(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function Sc(e,t){let n=gc(e.query)??hc(mc.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const X=[ic,Li,Lr,Ko,Qo,{platform:`youtube`,parse(e){if(e.tag!==`iframe`)return null;let t=N(e.attrs.get(`src`)??``),n=t!==null&&Gt.has(t.host);if(!t||!(n||Wt.has(t.host)))return null;let r=xc(t);if(!r)return null;let i=[...t.query].filter(([e])=>e!==`t`&&e!==r.key).map(([e,t])=>[e,P(t)]),a=Object.fromEntries(i),o=gc(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),z({...r.found,options:a},R(e))},isOwnScript:()=>!1,match(e){if(e.host===`youtu.be`){let[,t]=lc.exec(e.path)??[];return t===void 0?null:{...vc(t),options:Sc(e,!1)}}let t=Gt.has(e.host);if(!t&&!Wt.has(e.host))return null;let n=Sc(e,t);if(I(e.path,`/embed`)){let t=xc(e);return t&&{...t.found,options:n}}if(t)return null;if(/^\/watch\/?$/.test(e.path)){let t=e.query.get(`v`);return t!==void 0&&oc.test(t)?{...vc(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=yc(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=fc.exec(e.path)??[],i=bc(r);if(i)return{...i,options:n};let[,a,o]=cc.exec(e.path)??[];return a===void 0||o===void 0?null:{...vc(o,a===`shorts`),options:n}},ownsFrame:Zt},To,xa,Zi,fa,aa,Ka,Xs,Ps,yr,Ia,Xn,er,Ui,mi,zo,go,Va,ss,ki,no,ni,fr,vs];function Cc(e){return X.find(t=>t.platform===e)}function wc(e){let t=Ec(e);if(!t)return null;for(let e of X){let n=e.match(t);if(n)return n}return null}function Tc(e,t){let n=Ec(t);return n&&e.match(n)}function Ec(e){return typeof e==`string`?N(e):null}const Dc={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 Oc(e,t){if(t.platform!==e.platform)return null;let n=Tc(e,t.url);if(n?.platform!==t.platform||n.id!==t.id||n.url!==t.url||!Dc[t.platform].includes(`${t.kind} ${t.variant}`))return null;if(t.fallbackHtml===void 0||kc(e,t,t.fallbackHtml))return t;let r={...t};return delete r.fallbackHtml,r}function kc(e,t,n){let r=e.fallback,i=E(n);if(!r||!i||k(i,r)!==n)return!1;if(t.platform!==`x`)return!0;let[a]=E(`<blockquote class="twitter-tweet">${n}</blockquote>`)??[];return a?.type===`element`&&e.parse(a)?.id===t.id}const Z={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 Ac(e){return`social-embeds: a ${Z[e]} URL needs a lookup: use the embed code`}function jc(e,t,n){let{platform:r}=n,i=t??(e===void 0?null:Tc(n,e));if(!i&&e!==void 0&&Kn(e)===r)return{error:Ac(r)};if(!i)return{error:`social-embeds: not a ${Z[r]} post URL: ${String(e)}`};if(i.platform!==r)return{error:`social-embeds: expected a ${Z[r]} embed, got ${Z[i.platform]}`};let a=Oc(n,i);return a?{embed:a}:{error:`social-embeds: the ${Z[r]} embed's url and id do not match`}}function Mc(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=Kn(e.url);return t?Ac(t):`social-embeds: not a supported post URL: ${e.url}`}function Nc(e){if(typeof e!=`string`)return null;let t=E(e);return t?Fc(t):Pc(e)}function Pc(e){for(let t of X){let n=t.repair?.(e),r=n==null?null:E(n),i=r&&Fc(r);if(i?.platform===t.platform)return i}return null}function Fc(e){let t,n,r=[],i=!1;for(let a of e)if(a.type!==`comment`){if(a.type===`text`){if(/^\s*$/.test(Ae(a.raw)))continue;return null}if(a.tag===`script`)r.push(a);else if(Ic(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 X){let n=t.parseScript?.(e);if(n)return n}return null}for(let e of X){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 Ic(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function Lc(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function Rc(e){return e===null?void 0:Lc(e.trim().replace(/px$/i,``))}function zc(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function Bc(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function Vc(e,t){let n=t??e.getAttribute(`html`)??zc(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:Lc(i)??(i?.trim()?i:void 0),maxWidth:Rc(e.getAttribute(`max-width`)),height:Rc(e.getAttribute(`height`)),maxHeight:Rc(e.getAttribute(`max-height`))},eager:Bc(e)}}function Hc(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Uc(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=Hc(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 Wc(e,t){let n=Hc(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 Gc(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 Kc=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function qc(e,t){e.removeAttribute(`style`),Q(e,t)}function Q(e,t){for(let[n,r]of Object.entries(t)){if(r===void 0)continue;let t=typeof r==`number`&&Kc.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Jc(e){let t=document.createElement(`div`);return t.setAttribute(`aria-hidden`,`true`),Q(t,{width:`100%`,height:`100%`,minHeight:e,background:`rgba(128, 128, 128, 0.12)`}),t}function Yc(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 Xc(e,t){return`${e}${e.includes(`?`)?`&`:`?`}${encodeURIComponent(t)}=${encodeURIComponent(window.location.hostname)}`}function Zc(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Qc(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=document.createElement(`div`),l,u=e=>{qc(c,Uc(t,e,l))};u(n);let d=Zc(document.createElement(`div`)),f=Zc(document.createElement(`div`)),p=i.length>0?i:[t.fallbackHtml===void 0?Jc():$c(t.fallbackHtml,t.fallbackImage===!0)];f.append(...p),d.append(f),c.append(d),e.append(c);let m,h=!1,g,_=[],v=()=>{f.remove(),h||(h=!0,a())},y=e=>{if(!s||e.origin!==s.origin||!m||e.source!==m.contentWindow)return;let t;try{t=s.read(e.data)}catch{return}typeof t==`number`&&t>0&&t<=5e4&&(l=Math.ceil(t),Q(c,{height:l}),v())},ee=s?`did not report its height`:`did not load`,b=()=>{g=setTimeout(()=>{h||(f.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${ee}`)))},15e3)},x=e=>{let n=document.createElement(`iframe`);n.src=t.hostParam?Xc(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),Q(n,{display:`block`,width:`100%`,height:`100%`,border:0}),n.addEventListener(`load`,()=>{s||v()}),m?m.replaceWith(n):d.prepend(n),m=n,s&&window.addEventListener(`message`,y)},S=!1,C=()=>{S||(S=!0,t.sizeInSrc?_.push(Gc(d,e=>{x(Wc(t,e))})):x(t.src))};return r&&C(),_.push(Yc(d,!1,()=>{C(),b()})),{wrapper:c,cleanup:()=>{for(let e of _)e();clearTimeout(g),window.removeEventListener(`message`,y),c.remove()},update(e,t){u(e),t&&C()}}}function $c(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const el=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function tl(e){let t=e.querySelector(el.map(e=>`[${e}]`).join());for(let e of el){let n=t?.getAttribute(e);if(n)return n}}function nl(e){return`View this post on ${e}`}function rl(e){return e instanceof Error?e:Error(String(e))}function il(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{qc(l,{width:e.width??`100%`,maxWidth:e.maxWidth??t.maxWidth})};u(n);let d=document.createElement(`div`);Q(d,{width:`100%`});let f=document.createElement(`div`);f.innerHTML=t.markup,d.append(f);let p=tl(f),m=t.hasFallback?[]:o.length>0?o:[Jc(t.minHeight)];d.append(...m),l.append(d),e.append(l);let h=e=>{for(let e of m)e.parentNode?.removeChild(e);m=e,d.append(...e)},g=!1,_=!1,v,y=()=>{},ee=()=>{g||_||(_=!0,clearTimeout(v),y(),h([]),s())},b=e=>{if(t.hasFallback||p===void 0)h([]);else{let e=document.createElement(`a`);e.setAttribute(`href`,p),e.textContent=nl(i),h([e])}c(e)},x=(e,t)=>{g||_||(y(),y=()=>{},e>=3||t instanceof ue?b(t):v=setTimeout(()=>{S(e+1)},1e3*2**(e-1)))},S=e=>{if(!(g||_)){try{y=r.render(f,ee)}catch(t){x(e,rl(t));return}v=setTimeout(()=>{x(e,/* @__PURE__ */ Error(`social-embeds: the ${i} embed did not render`))},15e3)}},C=!1,te=()=>{C||(C=!0,r.load().then(()=>{S(1)},e=>{g||b(rl(e))}))},ne=Yc(f,a,te);return{wrapper:l,cleanup:()=>{g=!0,ne(),clearTimeout(v),y(),l.remove()},update(e,t){u(e),t&&te()}}}const al=typeof HTMLElement>`u`?class{}:HTMLElement,$=`embed`;function ol(e){let t=[];for(let n of e.childNodes)if(n.nodeType===Node.ELEMENT_NODE&&!(n instanceof HTMLTemplateElement)||n.nodeType===Node.TEXT_NODE&&n.textContent?.trim()){let e=n.cloneNode(!0);if(e instanceof Element)for(let t of[e,...e.querySelectorAll(`[id]`)])t.removeAttribute(`id`);t.push(e)}return t}function sl(e){let t=``;for(let n of e.children)n.slot!==$&&(t+=n.outerHTML);return t&&(Nc(t)??On(t))?t:void 0}function cl(e){let t=`html`in e?Nc(e.html):wc(e.url);if(!t){let t=`html`in e?On(e.html):null;return t?zn(t):{kind:`error`,message:Mc(e)}}let n=Cc(t.platform);if(!n)return{kind:`error`,message:Mc(e)};let r=jc(void 0,t,n);return r.error===void 0?Bt(r.embed):{kind:`error`,message:r.error}}const ll=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var ul=class extends al{static observedAttributes=[`html`,`url`,`width`,`max-width`,`height`,`max-height`,`eager`];#e=null;#t;#n;#r;#i;#a=0;#o=!1;constructor(){super(),this.attachShadow({mode:`open`}).innerHTML=`<slot name="${$}"></slot>`;for(let e of ll){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 Bc(this)}set eager(e){this.#c(`eager`,e===``||e&&e!==`false`?``:null)}connectedCallback(){!this.#t&&document.readyState===`loading`?this.#o||(this.#o=!0,document.addEventListener(`DOMContentLoaded`,()=>{this.#o=!1,this.isConnected&&this.connectedCallback()},{once:!0})):(this.#t??=new MutationObserver(()=>{this.#s(),this.#l()}),this.#s(),this.#l())}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this.#t?.disconnect(),this.#u(),this.#r=void 0,this.#i=void 0)})}attributeChangedCallback(){this.#l()}#s(){let e=this.#t;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)return;let e=this.#n?.wrapper;for(let t of[...this.children])t!==e&&t.slot===$&&t.remove();let t=!e||e.parentNode===this,n=Vc(this,this.#e);this.#i=n.source?void 0:t&&this.#i||sl(this),n.source??=this.#i===void 0?null:{html:this.#i};let r=JSON.stringify(n.source);r===this.#r&&t?this.#n?.update(n.layout,n.eager):(this.#u(),this.#r=r,this.#d(n))}#u(){this.#a+=1;let e=this.#n;this.#n=void 0,e?.cleanup()}#d(e){let{source:t,layout:n,eager:r}=e;if(!t)return;let i=this.#a,a=e=>{queueMicrotask(()=>{i===this.#a&&this.isConnected&&this.dispatchEvent(e)})},o=e=>{a(new ErrorEvent(`error`,{error:e,message:e.message}))},s=cl(t);if(s.kind===`error`){o(Error(s.message));return}let c={...n,eager:r,placeholder:this.#i===void 0?ol(this):[],onLoad:()=>{a(new Event(`load`))},onError:o};this.#n=s.kind===`iframe`?Qc(this,s,c):il(this,s,c),this.#n.wrapper.slot=$}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,ul);export{ul as SocialEmbedElement};
|
|
@@ -67,6 +67,8 @@ async function insert(script) {
|
|
|
67
67
|
element.src = script.url;
|
|
68
68
|
element.async = true;
|
|
69
69
|
if (script.crossOrigin) element.crossOrigin = script.crossOrigin;
|
|
70
|
+
const nonce = document.querySelector("script[nonce]")?.nonce;
|
|
71
|
+
if (nonce) element.setAttribute("nonce", nonce);
|
|
70
72
|
element.addEventListener("load", () => {
|
|
71
73
|
resolve();
|
|
72
74
|
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { underPath } from "./platform.js";
|
|
2
|
+
// src/parser/frames.ts
|
|
3
|
+
const YOUTUBE_HOSTS = /* @__PURE__ */ new Set([
|
|
4
|
+
"youtube.com",
|
|
5
|
+
"www.youtube.com",
|
|
6
|
+
"m.youtube.com"
|
|
7
|
+
]);
|
|
8
|
+
const YOUTUBE_NOCOOKIE_HOSTS = /* @__PURE__ */ new Set(["youtube-nocookie.com", "www.youtube-nocookie.com"]);
|
|
9
|
+
const DAILYMOTION_HOSTS = /* @__PURE__ */ new Set(["dailymotion.com", "www.dailymotion.com"]);
|
|
10
|
+
const DAILYMOTION_PLAYER_HOST = "geo.dailymotion.com";
|
|
11
|
+
const DAILYMOTION_SHORT_HOST = "dai.ly";
|
|
12
|
+
const TIKTOK_HOSTS = /* @__PURE__ */ new Set(["tiktok.com", "www.tiktok.com"]);
|
|
13
|
+
const TWITCH_PLAYER_HOST = "player.twitch.tv";
|
|
14
|
+
const TWITCH_CLIPS_HOST = "clips.twitch.tv";
|
|
15
|
+
const VIMEO_PLAYER_HOST = "player.vimeo.com";
|
|
16
|
+
const FACEBOOK_PLUGIN_HOSTS = /* @__PURE__ */ new Set([
|
|
17
|
+
"facebook.com",
|
|
18
|
+
"www.facebook.com",
|
|
19
|
+
"web.facebook.com"
|
|
20
|
+
]);
|
|
21
|
+
const GIPHY_PAGE_HOSTS = /* @__PURE__ */ new Set(["giphy.com", "www.giphy.com"]);
|
|
22
|
+
const KICK_PLAYER_HOSTS = /* @__PURE__ */ new Set(["player.kick.com"]);
|
|
23
|
+
const LINKEDIN_FRAME_HOST = "www.linkedin.com";
|
|
24
|
+
const PINTEREST_FRAME_HOST = "assets.pinterest.com";
|
|
25
|
+
const APPLE_MUSIC_FRAME_HOST = "embed.music.apple.com";
|
|
26
|
+
const APPLE_PODCASTS_FRAME_HOST = "embed.podcasts.apple.com";
|
|
27
|
+
const SOUNDCLOUD_WIDGET_HOST = "w.soundcloud.com";
|
|
28
|
+
const SPOTIFY_HOST = "open.spotify.com";
|
|
29
|
+
const youtubeFrame = (src) => YOUTUBE_NOCOOKIE_HOSTS.has(src.host) || YOUTUBE_HOSTS.has(src.host) && underPath(src.path, "/embed");
|
|
30
|
+
const dailymotionFrame = (src) => src.host === "geo.dailymotion.com" || src.host === "dai.ly" || DAILYMOTION_HOSTS.has(src.host) && (underPath(src.path, "/embed") || underPath(src.path, "/video"));
|
|
31
|
+
const tiktokFrame = (src) => TIKTOK_HOSTS.has(src.host) && underPath(src.path, "/player");
|
|
32
|
+
const twitchFrame = (src) => src.host === "player.twitch.tv" || src.host === "clips.twitch.tv" && underPath(src.path, "/embed");
|
|
33
|
+
const vimeoFrame = (src) => src.host === VIMEO_PLAYER_HOST;
|
|
34
|
+
const facebookFrame = (src) => FACEBOOK_PLUGIN_HOSTS.has(src.host) && underPath(src.path, "/plugins");
|
|
35
|
+
const giphyFrame = (src) => GIPHY_PAGE_HOSTS.has(src.host) && underPath(src.path, "/embed");
|
|
36
|
+
const kickFrame = (src) => KICK_PLAYER_HOSTS.has(src.host);
|
|
37
|
+
const linkedinFrame = (src) => src.host === "www.linkedin.com" && underPath(src.path, "/embed");
|
|
38
|
+
const pinterestFrame = (src) => src.host === PINTEREST_FRAME_HOST;
|
|
39
|
+
const appleMusicFrame = (src) => src.host === APPLE_MUSIC_FRAME_HOST;
|
|
40
|
+
const applePodcastsFrame = (src) => src.host === APPLE_PODCASTS_FRAME_HOST;
|
|
41
|
+
const soundcloudFrame = (src) => src.host === SOUNDCLOUD_WIDGET_HOST;
|
|
42
|
+
const spotifyFrame = (src) => src.host === "open.spotify.com" && underPath(src.path, "/embed");
|
|
43
|
+
const rumbleFrame = (src) => src.host === "rumble.com" && underPath(src.path, "/embed");
|
|
44
|
+
const streamableFrame = (src) => src.host === "streamable.com" && (underPath(src.path, "/e") || underPath(src.path, "/o"));
|
|
45
|
+
const tenorFrame = (src) => src.host === "tenor.com" && underPath(src.path, "/embed");
|
|
46
|
+
const truthsocialFrame = (src) => src.host === "truthsocial.com" && src.path.startsWith("/@");
|
|
47
|
+
/** True for a frame a named platform serves, which the generic iframe path must refuse. */
|
|
48
|
+
function ownedFrame(src) {
|
|
49
|
+
return [
|
|
50
|
+
youtubeFrame,
|
|
51
|
+
dailymotionFrame,
|
|
52
|
+
tiktokFrame,
|
|
53
|
+
twitchFrame,
|
|
54
|
+
vimeoFrame,
|
|
55
|
+
facebookFrame,
|
|
56
|
+
giphyFrame,
|
|
57
|
+
kickFrame,
|
|
58
|
+
linkedinFrame,
|
|
59
|
+
pinterestFrame,
|
|
60
|
+
appleMusicFrame,
|
|
61
|
+
applePodcastsFrame,
|
|
62
|
+
soundcloudFrame,
|
|
63
|
+
spotifyFrame,
|
|
64
|
+
rumbleFrame,
|
|
65
|
+
streamableFrame,
|
|
66
|
+
tenorFrame,
|
|
67
|
+
truthsocialFrame
|
|
68
|
+
].some((owns) => owns(src));
|
|
69
|
+
}
|
|
70
|
+
export { APPLE_MUSIC_FRAME_HOST, APPLE_PODCASTS_FRAME_HOST, DAILYMOTION_HOSTS, DAILYMOTION_PLAYER_HOST, DAILYMOTION_SHORT_HOST, FACEBOOK_PLUGIN_HOSTS, GIPHY_PAGE_HOSTS, KICK_PLAYER_HOSTS, LINKEDIN_FRAME_HOST, PINTEREST_FRAME_HOST, SOUNDCLOUD_WIDGET_HOST, SPOTIFY_HOST, TIKTOK_HOSTS, TWITCH_CLIPS_HOST, TWITCH_PLAYER_HOST, VIMEO_PLAYER_HOST, YOUTUBE_HOSTS, YOUTUBE_NOCOOKIE_HOSTS, appleMusicFrame, applePodcastsFrame, dailymotionFrame, facebookFrame, giphyFrame, kickFrame, linkedinFrame, ownedFrame, pinterestFrame, rumbleFrame, soundcloudFrame, spotifyFrame, streamableFrame, tenorFrame, tiktokFrame, truthsocialFrame, twitchFrame, vimeoFrame, youtubeFrame };
|
package/dist/parser/iframe.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { descendants, parseHtml } from "./html.js";
|
|
2
2
|
import { sizeOf, unwrapRatio } from "./platform.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ownedFrame } from "./frames.js";
|
|
4
4
|
import { parseUrl, pixels } from "./url.js";
|
|
5
5
|
// src/parser/iframe.ts
|
|
6
6
|
const REFERRER_POLICIES = [
|
|
@@ -102,7 +102,7 @@ function checkSrc(value) {
|
|
|
102
102
|
host: url.host.replace(/:\d+$/, ""),
|
|
103
103
|
path: (url.path.toLowerCase().split(";")[0] ?? "").replaceAll("%2f", "/")
|
|
104
104
|
};
|
|
105
|
-
if (
|
|
105
|
+
if (ownedFrame(frame)) return null;
|
|
106
106
|
return src.startsWith("//") ? `https:${src}` : src;
|
|
107
107
|
}
|
|
108
108
|
/** A feature keeps its origin list as written, or is dropped whole when one origin is not safe. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseHtml } from "./html.js";
|
|
1
|
+
import { decodeEntities, parseHtml } from "./html.js";
|
|
2
2
|
import { platforms } from "./platforms/index.js";
|
|
3
3
|
// src/parser/parse-embed.ts
|
|
4
4
|
/**
|
|
@@ -28,7 +28,7 @@ function parseNodes(nodes) {
|
|
|
28
28
|
for (const node of nodes) {
|
|
29
29
|
if (node.type === "comment") continue;
|
|
30
30
|
if (node.type === "text") {
|
|
31
|
-
if (/^\s*$/.test(node.raw)) continue;
|
|
31
|
+
if (/^\s*$/.test(decodeEntities(node.raw))) continue;
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
34
|
if (node.tag === "script") scripts.push(node);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { sizeOf, withSize } from "../platform.js";
|
|
2
2
|
import { parseUrl } from "../url.js";
|
|
3
|
+
import { APPLE_MUSIC_FRAME_HOST, appleMusicFrame } from "../frames.js";
|
|
3
4
|
// src/parser/platforms/applemusic.ts
|
|
4
5
|
const PATH = /^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/;
|
|
5
6
|
const SONG = /^\d{1,15}$/;
|
|
6
|
-
const FRAME_HOST = "embed.music.apple.com";
|
|
7
7
|
function appleContent(url, host) {
|
|
8
8
|
if (url?.host !== host) return null;
|
|
9
9
|
const [, country, type, id] = PATH.exec(url.path) ?? [];
|
|
@@ -22,7 +22,7 @@ const applemusic = {
|
|
|
22
22
|
platform: "applemusic",
|
|
23
23
|
parse(root) {
|
|
24
24
|
if (root.tag !== "iframe") return null;
|
|
25
|
-
const found = appleContent(parseUrl(root.attrs.get("src") ?? ""),
|
|
25
|
+
const found = appleContent(parseUrl(root.attrs.get("src") ?? ""), APPLE_MUSIC_FRAME_HOST);
|
|
26
26
|
if (!found) return null;
|
|
27
27
|
const { height } = sizeOf(root) ?? {};
|
|
28
28
|
return withSize({
|
|
@@ -40,6 +40,6 @@ const applemusic = {
|
|
|
40
40
|
options: {}
|
|
41
41
|
};
|
|
42
42
|
},
|
|
43
|
-
ownsFrame:
|
|
43
|
+
ownsFrame: appleMusicFrame
|
|
44
44
|
};
|
|
45
45
|
export { applemusic };
|