social-embeds 0.9.3 → 0.9.5

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.
Files changed (50) hide show
  1. package/README.md +15 -8
  2. package/dist/element.js +1 -1
  3. package/dist/parser/iframe.js +2 -2
  4. package/dist/parser/matchers/bluesky.js +1 -1
  5. package/dist/parser/matchers/facebook.js +4 -4
  6. package/dist/parser/matchers/flickr.js +2 -2
  7. package/dist/parser/matchers/giphy.js +4 -4
  8. package/dist/parser/matchers/imgur.js +4 -4
  9. package/dist/parser/matchers/linkedin.js +2 -2
  10. package/dist/parser/matchers/snapchat.js +3 -3
  11. package/dist/parser/matchers/soundcloud.js +2 -2
  12. package/dist/parser/matchers/spotify.js +1 -1
  13. package/dist/parser/matchers/streamable.js +2 -2
  14. package/dist/parser/matchers/telegram.js +1 -1
  15. package/dist/parser/matchers/tenor.js +1 -1
  16. package/dist/parser/matchers/truthsocial.js +1 -1
  17. package/dist/parser/matchers/tumblr.js +3 -3
  18. package/dist/parser/matchers/vimeo.js +1 -1
  19. package/dist/parser/platform.d.ts +4 -2
  20. package/dist/parser/platform.js +11 -1
  21. package/dist/parser/platforms/applemusic.js +3 -4
  22. package/dist/parser/platforms/applepodcasts.js +3 -4
  23. package/dist/parser/platforms/bluesky.js +4 -4
  24. package/dist/parser/platforms/dailymotion.js +3 -4
  25. package/dist/parser/platforms/facebook.js +3 -4
  26. package/dist/parser/platforms/flickr.js +3 -4
  27. package/dist/parser/platforms/giphy.js +3 -4
  28. package/dist/parser/platforms/imgur.js +4 -4
  29. package/dist/parser/platforms/instagram.js +3 -3
  30. package/dist/parser/platforms/kick.js +3 -4
  31. package/dist/parser/platforms/linkedin.js +4 -5
  32. package/dist/parser/platforms/pinterest.js +3 -4
  33. package/dist/parser/platforms/reddit.js +4 -5
  34. package/dist/parser/platforms/rumble.js +3 -4
  35. package/dist/parser/platforms/snapchat.js +3 -4
  36. package/dist/parser/platforms/soundcloud.js +3 -4
  37. package/dist/parser/platforms/spotify.js +3 -4
  38. package/dist/parser/platforms/strava.js +3 -3
  39. package/dist/parser/platforms/streamable.js +3 -4
  40. package/dist/parser/platforms/telegram.js +4 -5
  41. package/dist/parser/platforms/tenor.js +4 -5
  42. package/dist/parser/platforms/threads.js +3 -4
  43. package/dist/parser/platforms/tiktok.js +3 -4
  44. package/dist/parser/platforms/truthsocial.js +4 -5
  45. package/dist/parser/platforms/tumblr.js +5 -5
  46. package/dist/parser/platforms/twitch.js +3 -4
  47. package/dist/parser/platforms/vimeo.js +3 -4
  48. package/dist/parser/platforms/x.js +3 -4
  49. package/dist/parser/platforms/youtube.js +3 -4
  50. package/package.json +4 -4
package/README.md CHANGED
@@ -105,14 +105,19 @@ export const SocialEmbed = createSocialEmbed([
105
105
  ]);
106
106
  ```
107
107
 
108
- | Platforms | Gzipped |
109
- | ------------------------------------------------- | ------- |
110
- | `youtube` | 6 KB |
111
- | `youtube`, `x` | 9 KB |
112
- | `youtube`, `x`, `instagram`, `facebook`, `tiktok` | 12 KB |
113
- | the same five and `genericIframe` | 14 KB |
114
- | every platform (`<SocialEmbed>`) | 27 KB |
108
+ JavaScript added to a page in a Next.js 16 production build, gzipped:
115
109
 
110
+ | Platforms | Turbopack | webpack |
111
+ | ------------------------------------------------- | --------- | ------- |
112
+ | `youtube` | 6 KB | 7 KB |
113
+ | `youtube`, `x` | 9 KB | 10 KB |
114
+ | `youtube`, `x`, `instagram`, `facebook`, `tiktok` | 12 KB | 13 KB |
115
+ | the same five and `genericIframe` | 14 KB | 15 KB |
116
+ | every platform (`<SocialEmbed>`) | 27 KB | 27 KB |
117
+
118
+ Before 0.9.4, Next.js kept every platform in a `createSocialEmbed` component as well: about 17 KB for `youtube` alone.
119
+
120
+ - **A fixed list:** the list is set when the app is built, not per page, and a platform that is not in it is never recognised. If embed code comes from a CMS where editors can paste any platform, list every platform they use, add `genericIframe` and handle the rest with `fallback`, or use `<SocialEmbed>`.
116
121
  - **Names:** each platform is exported under its id, as in `embed.platform`: `x`, `instagram`, `threads`, `facebook`, `tiktok`, `youtube`, `telegram`, `snapchat`, `linkedin`, `reddit`, `pinterest`, `spotify`, `vimeo`, `twitch`, `dailymotion`, `bluesky`, `soundcloud`, `applemusic`, `applepodcasts`, `tumblr`, `kick`, `giphy`, `truthsocial`, `imgur`, `tenor`, `streamable`, `strava`, `flickr` and `rumble`. `genericIframe` adds [generic iframe embeds](#generic-iframe-embeds). The order of the list does not matter.
117
122
  - **The same component:** it takes the same props and renders exactly what `<SocialEmbed>` renders for the platforms it knows. Embed code of another platform goes to `fallback`, or to `onError` as `social-embeds: unrecognised embed code`; a URL of another platform is reported as `social-embeds: not a supported post URL: …`. A frame that a named platform serves never renders as a generic iframe, even when that platform is not in the list.
118
123
  - **A client module:** call `createSocialEmbed` once, at the top of a module with `'use client'`, and import the component from there. In the Next.js App Router a Server Component cannot call it, because it comes from a client module; it can render the component it returns.
@@ -121,7 +126,7 @@ export const SocialEmbed = createSocialEmbed([
121
126
 
122
127
  Each platform component takes a `url`, or an `embed` already parsed by [`social-embeds/parser`](#parser), plus the shared props and its own option props. Option props override options from the embed code.
123
128
 
124
- A platform component bundles only its own platform's parser: one component adds about 3 to 5 KB gzipped to an app (`FacebookEmbed` about 7 KB), against about 27 KB for `<SocialEmbed>`, which recognises every platform. A URL of another platform is reported as `social-embeds: not a {Platform} post URL: …`, and an `embed` of another platform as `social-embeds: expected a {Platform} embed, got {id}`.
129
+ A platform component bundles only its own platform's parser: in a Next.js 16 production build, under Turbopack or webpack, one component adds about 3 to 5.5 KB gzipped to a page (`FacebookEmbed` about 7 KB), against about 27 KB for `<SocialEmbed>`, which recognises every platform. Before 0.9.4, under Turbopack each component added at least 15 KB. A URL of another platform is reported as `social-embeds: not a {Platform} post URL: …`, and an `embed` of another platform as `social-embeds: expected a {Platform} embed, got {id}`.
125
130
 
126
131
  ```tsx
127
132
  import {
@@ -701,6 +706,8 @@ export function Embed({ html }: { html: string }) {
701
706
 
702
707
  Client navigation needs nothing extra: each platform script loads once per page, and an embed that mounts after navigation renders without loading it again. With `lazy` (the default), a page with five embeds loads no platform script until the first embed comes near the viewport, and each embed then renders only when it comes near.
703
708
 
709
+ In a Next.js 16 production build, with Turbopack (the default) or webpack, a platform component adds about 3 to 5.5 KB gzipped to a page (`FacebookEmbed` about 7 KB), a [`createSocialEmbed`](#only-the-platforms-you-use) component with five platforms about 12 to 13 KB, and `<SocialEmbed>` about 27 KB. Before 0.9.4, any one component added at least 15 KB under Turbopack. When a page's embed code comes from a CMS and can be any platform, `<SocialEmbed>` is the component that recognises all of them.
710
+
704
711
  ## Server-side fallback content
705
712
 
706
713
  - **Embed code with fallback content** (X, Instagram, Threads, Facebook SDK code with a blockquote): the server HTML contains the platform's blockquote with its whitelisted content, such as the post text, author and link. No placeholder is shown. On the client, the platform script turns it into the post.
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}function s(e,t){let{origin:n,read:r}=this,i=i=>{if(i.origin!==n)return;let a=e();if(!a||i.source!==a.contentWindow)return;let o;try{o=r(i.data)}catch{return}typeof o==`number`&&o>0&&o<=5e4&&t(Math.ceil(o))};return window.addEventListener(`message`,i),()=>{window.removeEventListener(`message`,i)}}const c={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0},listen:s};function l(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:c,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const u=/^x[a-z0-9]{3,12}$/;function d(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...l}=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`||!u.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(l,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const f=15e3,p=3e3,m=/* @__PURE__ */ new Map;function h(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=m.get(e.key);return t||(t=g(e).catch(t=>{throw m.delete(e.key),t}),m.set(e.key,t)),t}async function g(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await _(e,t)||await y(e)}await e.whenPresent?.()}function _(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?p:f),i,a=()=>{r=Date.now()+p},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 v=class extends Error{};async function y(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 v)||t>=3)throw e;await S(1e3*2**(t-1))}await(t?x(t,`${e.url} did not report ready`):b(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);let i=document.querySelector(`script[nonce]`)?.nonce;i&&n.setAttribute(`nonce`,i),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new v(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await x(r,`${e.url} did not load`)}finally{t?.()}return n}function b(e){return new Promise((t,n)=>{let r=Date.now()+f,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function x(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},f);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function S(e){return new Promise(t=>setTimeout(t,e))}const C=()=>window,w=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function ne(e){let t=C().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 C().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=C().twttr?.ready;t?t(()=>{e()}):e()})};function ie(){let e=C().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ae(e){let t=C().FB;return!ne(e)&&t!==void 0&&!t.__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=${w}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=C().fbAsyncInit;C().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 C().PinUtils?.build==`function`};function ue(){return h(re)}function de(){return h(oe)}function fe(){return h(se)}function pe(){return h(le)}function me(e){return te.test(e)?h(ce(e)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${e}"`))}const T=()=>window;var he=class extends Error{};function E(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 ge(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function _e(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const ve={load:()=>ue(),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=E(e,_e,t);return ge(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function ye(e,t){if(e.getRootNode()!==document)throw new he(`social-embeds: the ${t} embed cannot render inside a shadow root`)}function be(){let e=T().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const xe={load:()=>de(),render(e,t){ye(e,`Instagram`);let n=E(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return ge(e,`instagram-media`),be(),n}},Se={load:()=>fe(),render(e,t){ye(e,`Threads`);let n=E(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return ge(e,`text-post-media`),be(),n}},Ce=/* @__PURE__ */ new Map;function we(e){let t=Ce.get(e);return t||(t={load:()=>me(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:w}),i()}return()=>{}}},Ce.set(e,t)),t}const Te={load:()=>pe(),render(e,t){let n=T().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=E(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}},Ee=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),De=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Oe=/<([a-zA-Z][a-zA-Z0-9-]*)/y,ke=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,Ae=/\s*(\/?)>/y,je=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Me=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function D(e){let t={type:`element`,tag:``,attrs:/* @__PURE__ */ new Map,children:[]},n=[t],r=0;for(;r<e.length;){let i=n[n.length-1]??t,a=e.indexOf(`<`,r),o=a===-1?e.length:a;if(o>r&&i.children.push({type:`text`,raw:e.slice(r,o)}),a===-1)break;if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4);if(t===-1)return null;i.children.push({type:`comment`}),r=t+3;continue}je.lastIndex=a;let s=je.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=je.lastIndex;continue}let c=Ne(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:De.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&&!Ee.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function Ne(e,t){Oe.lastIndex=t;let n=Oe.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Oe.lastIndex;for(;;){Ae.lastIndex=i;let t=Ae.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:Ae.lastIndex};ke.lastIndex=i;let a=ke.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Pe(s??c??l??``)),i=ke.lastIndex}}function Pe(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 Me.get(t)??e;let n=t[1]===`x`||t[1]===`X`,r=Number.parseInt(t.slice(n?2:1),n?16:10);return r>0&&r<=1114111&&(r<55296||r>57343)?String.fromCodePoint(r):e})}function O(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function k(e){let t=[];return Fe(e,t),t}function Fe(e,t){for(let n of e)n.type===`element`&&(t.push(n),Fe(n.children,t))}const Ie=/* @__PURE__ */ new Set([`href`,`cite`]),Le=/^https?:\/\//i;function A(e,t){let n=``;for(let r of e){if(r.type===`text`){n+=r.raw;continue}if(r.type!==`element`)continue;let e=t.get(r.tag);if(e){n+=`<${r.tag}`;for(let t of e){let e=typeof t==`string`?t:t.name,i=r.attrs.get(e);i===void 0||typeof t!=`string`&&!t.value.test(i)||Ie.has(e)&&!Le.test(i)||(n+=` ${e}="${j(i)}"`)}n+=`>`,Ee.has(r.tag)||(n+=`${A(r.children,t)}</${r.tag}>`)}}return n}function j(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function M(e,t){let n=D(e);return n!==null&&A(n,t)===e}function Re(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${j(String(r))}"`);return t}function ze(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Re(n)}function N(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function P(e){return e!==void 0&&e.trim()!==``}const Be={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ve={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},He={post:300,video:200};function Ue(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 We(e,t){if(e.variant===`iframe`)return Ue(e);let n=N(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Ve)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Ue({...e,options:t})}let i=t.locale??(typeof n.locale==`string`?n.locale:`en_US`),a=`<div class="${e.kind===`video`?`fb-video`:`fb-post`}" data-href="${j(e.url)}"${ze(Be,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:we(i),minHeight:He[e.kind],label:`Facebook`,hasFallback:P(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function Ge(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Ke(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=Ge(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 qe(e,t){let n=Ge(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 Je(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 Ye=[`header`,`footer`,`context`],Xe=/\/albums\/\d+$/;function Ze(e,t){let n=Xe.test(e.url),r=Ye.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,s=`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,c={width:4,height:3};return{kind:`iframe`,src:s,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:c,...o?{size:o,maxWidth:o.width}:{},sizeInSrc:{watch:Je,src:e=>qe({src:s,ratio:c,size:o},e)},...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 Qe(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 $e={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},listen:s};function et(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:$e,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function tt(e,t){let n=N(e.options,{captioned:t.captioned}),r=`<blockquote${Re({"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:xe,minHeight:680,label:`Instagram`,hasFallback:P(e.fallbackHtml),maxWidth:540}}const nt=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function rt(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])=>nt.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function it(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 at={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},ot={small:236,medium:345,large:600};function st(e,t){let n=N(e.options,{width:t.pinWidth}),r=`<a href="${j(e.url)}"${ze(at,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:Te,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:ot[String(n.width)]??236}}const ct={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},lt={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},listen:s};function ut(e,t){let n=[];for(let[e,r]of Object.entries(ct)){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:lt,startHeight:e.size?.height??316,maxWidth:640}}function dt(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 ft={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 pt(e,t){let n=[];for(let[e,r]of Object.entries(ft)){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 mt(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 ht=/* @__PURE__ */ new Set([`track`,`episode`]);function gt(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??(ht.has(n)?152:352)}}const _t={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},listen:s};function vt(e){return e===`minimal`?`minimal`:`standard`}function yt(e,t){let n=e.id.startsWith(`route/`),r=vt(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:_t,startHeight:650,...i?{}:{maxWidth:554}}}const bt=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),xt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function St(e,t){let n=Object.entries(e.options).filter(([e])=>bt.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,xt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const Ct=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function wt(e,t){return typeof t==`boolean`?e===`userpic`?String(t):e===`single`?t?1:void 0:+!!t:typeof t==`string`||typeof t==`number`?t:void 0}const Tt={origin:`https://t.me`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.event===`resize`&&typeof t.height==`number`?t.height:void 0},listen:s};function Et(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 Ct){let n=wt(t,s[e]);n!==void 0&&c.push([t,n])}return{kind:`iframe`,src:`${e.url}${a(c)}`,title:`Telegram post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Tt,startHeight:300,maxWidth:500}}function Dt(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 Ot(e,t){let n=N(e.options,{theme:t.theme}),r=`<blockquote${Re({"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:Se,minHeight:240,label:`Threads`,hasFallback:P(e.fallbackHtml),maxWidth:658}}const kt={controls:`controls`,progressBar:`progress_bar`,playButton:`play_button`,volumeControl:`volume_control`,fullscreenButton:`fullscreen_button`,timestamp:`timestamp`,loop:`loop`,autoplay:`autoplay`,musicInfo:`music_info`,description:`description`,rel:`rel`,nativeContextMenu:`native_context_menu`,closedCaption:`closed_caption`,forceMuted:`force_muted`};function At(e,t){let n=o(t,kt);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 jt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const Mt={origin:`https://truthsocial.com`,read:jt,listen:s},Nt={origin:`https://truthsocial.com`,read(e){let t=jt(e);return t===void 0||t<=0?void 0:t+165},listen:s},Pt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Ft(e){let t=Pt.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?Nt:Mt,startHeight:150,maxWidth:e.size?.width??600}}const It={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},listen:s};function Lt(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:It,startHeight:400,maxWidth:540}}const Rt=[`channel`,`video`,`collection`,`clip`,`parent`];function zt(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 Bt(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]=zt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Rt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,clientSrc:Vt}}function Vt(e){return`${e}${e.includes(`?`)?`&`:`?`}parent=${encodeURIComponent(window.location.hostname)}`}const Ht={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 Ut(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Ht),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 Wt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function Gt(e,t){let n=N(e.options,{...t}),r=e.fallbackHtml??`<a href="${j(e.url)}"></a>`,i=`<blockquote${ze(Wt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:ve,minHeight:250,label:`X`,hasFallback:P(e.fallbackHtml),maxWidth:550}}const Kt={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 qt(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 Jt(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}=qt(e),f=o(r,Kt).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 Yt(e){switch(e.platform){case`x`:return Gt(e,{});case`instagram`:return tt(e,{});case`threads`:return Ot(e,{});case`facebook`:return We(e,{});case`tiktok`:return At(e,{});case`youtube`:return Jt(e,{});case`telegram`:return Et(e,{});case`snapchat`:return dt(e);case`linkedin`:return it(e,{});case`reddit`:return ut(e,{});case`pinterest`:return st(e,{});case`spotify`:return gt(e,{});case`vimeo`:return Ut(e,{});case`twitch`:return Bt(e,{});case`dailymotion`:return d(e,{});case`bluesky`:return l(e,{});case`soundcloud`:return pt(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return Lt(e);case`kick`:return rt(e,{});case`giphy`:return Qe(e);case`tenor`:return Dt(e);case`streamable`:return St(e,{});case`rumble`:return mt(e);case`truthsocial`:return Ft(e);case`imgur`:return et(e,{});case`strava`:return yt(e,{});case`flickr`:return Ze(e,{});default:return e.platform}}const Xt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function F(e){let t=Xt.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.replaceAll(`&amp;`,`&`).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 I(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function L(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function R(e,t){return e===t||e.startsWith(`${t}/`)}function z(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 B(e){let t=L(e.attrs.get(`width`)),n=L(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function V(e,t){return t?{...e,size:t}:e}function H(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=Qt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Qt(e,t){return t===0?e:Qt(t,e%t)}const $t=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),en=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),tn=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),U=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),nn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),W=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),rn=/* @__PURE__ */ new Set([`player.kick.com`]),an=`embed.music.apple.com`,on=`embed.podcasts.apple.com`,sn=e=>en.has(e.host)||$t.has(e.host)&&R(e.path,`/embed`),cn=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||tn.has(e.host)&&(R(e.path,`/embed`)||R(e.path,`/video`)),ln=e=>U.has(e.host)&&R(e.path,`/player`),un=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&R(e.path,`/embed`),dn=e=>e.host===`player.vimeo.com`,fn=e=>nn.has(e.host)&&R(e.path,`/plugins`),pn=e=>W.has(e.host)&&R(e.path,`/embed`),mn=e=>rn.has(e.host),hn=e=>e.host===`www.linkedin.com`&&R(e.path,`/embed`),gn=e=>e.host===`assets.pinterest.com`,_n=e=>e.host===an,vn=e=>e.host===on,yn=e=>e.host===`w.soundcloud.com`,bn=e=>e.host===`open.spotify.com`&&R(e.path,`/embed`),xn=e=>e.host===`rumble.com`&&R(e.path,`/embed`),Sn=e=>e.host===`streamable.com`&&(R(e.path,`/e`)||R(e.path,`/o`)),Cn=e=>e.host===`tenor.com`&&R(e.path,`/embed`),wn=e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`);function Tn(e){return[sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn].some(t=>t(e))}const En=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],Dn=/* @__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`]),On=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),kn=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,An=RegExp(`^(?:https:)?//${kn}(?:[/?#]|$)`,`i`),jn=RegExp(`^(?:\\*|'self'|'src'|'none'|https://${kn})$`,`i`),Mn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Nn=/[\t\n\f\r ]+/,Pn=/^\s*(width|height)\s*:(.*)$/is,Fn=/^(\d+)px$/i,In=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function Ln(e){if(typeof e!=`string`)return null;let t=D(e);if(!t)return null;let n=k(t),[r,...i]=n.filter(e=>e.tag===`iframe`);if(!r||i.length>0)return null;let a=n.find(e=>e.children.includes(r)),{attrs:o}=r,s=B(r)??Kn(r);return zn({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&&H(a,In)?.size})}function Rn(e){return zn(e)}function zn(e){if(typeof e!=`object`||!e)return null;let t=e,n=Bn(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=En.find(e=>e===i),o=Un(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Vn(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Hn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Gn(t.size),...o?{ratio:o}:{}}}function Bn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=An.test(t)&&!t.includes(`\\`)?F(t):null;return!n||Mn.test(n.path)||Tn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function Vn(e){return e.split(`;`).map(e=>e.split(Nn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&On.has(e)&&t.every(e=>jn.test(e))).map(e=>e.join(` `)).join(`; `)}function Hn(e){let t=e.split(Nn).map(e=>e.toLowerCase()).filter(e=>Dn.has(e));return[...new Set(t)].join(` `)}function Un(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Wn(t)&&Wn(n)?{width:t,height:n}:void 0}function Wn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Gn(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?L(String(t)):void 0,i=typeof n==`number`?L(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Kn(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Pn.exec(r)??[],a=L(Fn.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 qn={width:16,height:9};function Jn(e){let t=Rn(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}:{},...Yn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Yn({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??qn,...n===void 0?{}:{maxWidth:n}}:{ratio:qn,height:r}}const Xn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Zn=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Qn=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,$n=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),er=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function tr(e){let t=typeof e==`string`?F(e):null;return t?nr(t)?`rumble`:rr(t)?`bluesky`:null:null}function nr(e){return $n.has(e.host)&&er.test(e.path)}function rr(e){if(!Xn.has(e.host))return!1;let[,t]=Zn.exec(e.path)??[];return t!==void 0&&Qn.test(t)}const ir=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,ar=/^\d{1,15}$/;function or(e,t){if(e?.host!==t)return null;let[,n,r,i]=ir.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!ar.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!ar.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const sr={platform:`applemusic`,name:`Apple Music`,shapes:[`post iframe`],match(e){let t=or(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:_n,parse(e){if(e.tag!==`iframe`)return null;let t=or(F(e.attrs.get(`src`)??``),an);if(!t)return null;let{height:n}=B(e)??{};return V({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1},cr=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,lr=/^\d{1,15}$/;function ur(e,t){if(e?.host!==t)return null;let[,n,r]=cr.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!lr.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 dr={platform:`applepodcasts`,name:`Apple Podcasts`,shapes:[`post iframe`],match(e){let t=ur(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:vn,parse(e){if(e.tag!==`iframe`)return null;let t=ur(F(e.attrs.get(`src`)??``),on);return t&&V({...t,options:{}},B(e))},isOwnScript:()=>!1},fr=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,pr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,mr=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),hr=RegExp(`^/profile/${fr}/post/${pr}/?$`),gr=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function _r(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 vr(e){if(!e||!mr.has(e.host))return null;let[,t,n]=hr.exec(e.path)??[];return t===void 0||n===void 0?null:_r(t,n)}const yr={platform:`bluesky`,name:`Bluesky`,shapes:[`post iframe`],needsLookup:rr,trustsFallback:e=>M(e,gr),match(e){let t=vr(e);return t&&{...t,options:{}}}},br=RegExp(`^at://${fr}/app\\.bsky\\.feed\\.post/${pr}$`),xr=/^[a-z2-7]{20,100}$/,Sr=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),Cr=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,wr={...yr,parse(e){if(e.tag!==`blockquote`||!O(e,`bluesky-embed`))return null;let[,t,n]=br.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=_r(t,n);if(k(e.children).reverse().map(e=>e.tag===`a`?vr(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&xr.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:A(e.children,gr)}},isOwnScript:e=>Cr.test(e)},Tr=/^x[a-z0-9]{4,12}$/,Er=/^x[a-z0-9]{3,12}$/;function Dr(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function Or(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(!Tr.test(r)||n!==void 0&&!Er.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,I(t)]));return n!==void 0&&(i.playerId=n),Dr(r,i)}function kr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return Tr.test(t)?Dr(t,{}):null}if(!tn.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&Tr.test(t)?Dr(t,{}):null}const Ar={platform:`dailymotion`,name:`Dailymotion`,shapes:[`video iframe`],match(e){return Or(e)??kr(e)},ownsFrame:cn},jr=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,Mr={...Ar,parse(e){let t=H(e,jr),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=F(n.attrs.get(`src`)??``);if(!r)return null;let i=Or(r)??kr(r);return i&&V(i,t?.size??B(n))},isOwnScript:()=>!1},Nr=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),G=`https://www.facebook.com`,Pr=`[A-Za-z0-9.\\-]{1,80}`,Fr=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Ir=RegExp(`^/(${Pr})/posts/(${Fr})/?$`),Lr=RegExp(`^/(${Pr})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Rr=RegExp(`^/(${Pr})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),zr=/^\/reel\/(\d{1,25})\/?$/,Br=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),Vr=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Hr=RegExp(`^${Fr}$`),Ur=/^\d{1,25}$/,Wr={name:`class`,value:/^fb-xfbml-parse-ignore$/},Gr=/* @__PURE__ */ new Map([[`div`,[Wr]],[`blockquote`,[`cite`,Wr]],[`a`,[`href`]],[`p`,[]]]);function Kr(e){if(!e||!Nr.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Ir.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${G}/${r}/posts/${i}`};if(Br.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Hr.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Ur.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${G}${t}?story_fbid=${e}${i}`}}if(Vr.has(t)){let e=n.get(`fbid`);return e===void 0||!Ur.test(e)?null:{kind:`post`,id:e,url:`${G}${t}?fbid=${e}`}}let[,a,o,s]=Lr.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${G}/${a}/photos/${o}/${s}/`};let[,c,l]=Rr.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${G}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!Ur.test(e)?null:{kind:`video`,id:e,url:`${G}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=zr.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${G}/reel/${u}`}}function K(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const qr={platform:`facebook`,name:`Facebook`,shapes:[`post sdk`,`video sdk`,`video iframe`],trustsFallback:e=>M(e,Gr),match(e){let t=Kr(e);return t&&K(t,t.kind,`sdk`,{})},ownsFrame:fn},Jr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Yr=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Xr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Zr={...qr,parse(e){if(e.tag===`div`){let t=O(e,`fb-post`)?`post`:O(e,`fb-video`)?`video`:null,n=Kr(F(e.attrs.get(`data-href`)??``));return!t||!n?null:{...K(n,t,`sdk`,z(e,Yr,I)),fallbackHtml:A(e.children,Gr)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!nn.has(t.host))return null;let n=Kr(F(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=I(r)),i!==void 0&&(e.width=I(i)),K(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=I(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of Xr){let i=t.query.get(n);i!==void 0&&(e[r]=I(i))}let r=L(t.query.get(`width`)),i=L(t.query.get(`height`));return V(K(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return V(K(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,I(t)]))),B(e))}return null},isOwnScript:e=>Jr.test(e),scriptOptions(e){let[,t]=Jr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0},Qr=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),$r=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,ei=`(\\d{1,20})`,ti=RegExp(`^/photos/${$r}/${ei}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),ni=RegExp(`^/photos/${$r}/(?:albums|sets)/${ei}/?$`),ri=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,ii=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,ai=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,oi=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:ai},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function si(e){if(e===``)return null;let t=0n;for(let n of e){let e=ii.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function ci(e){let t=BigInt(e),n=``;for(;t>0n;)n=ii.charAt(Number(t%58n))+n,t/=58n;return n}function li(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function ui(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function di(e){if(!e||!Qr.has(e.host))return null;let[,t,n]=ni.exec(e.path)??[];if(t!==void 0&&n!==void 0)return ui(t,n);let[,r,i]=ti.exec(e.path)??[];return r===void 0||i===void 0?null:li(r,i)}function fi(e){if(e.host!==`flic.kr`)return null;let[,t]=ri.exec(e.path)??[],n=t===void 0?null:si(t);return t===void 0||n===null||ci(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}const pi={platform:`flickr`,name:`Flickr`,shapes:[`post iframe`],trustsFallback:e=>M(e,oi),match(e){let t=di(e)??fi(e);return t&&{...t,options:{}}}},mi=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,hi=[`header`,`footer`,`context`];function gi(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 _i={...pi,parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=di(F(e.attrs.get(`href`)??``)),n=gi(e);if(!t||!n)return null;let r={};for(let t of hi)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=B(n),a=ai.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return V({...t,options:r,fallbackHtml:A([a],oi)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>mi.test(e)},q=`([A-Za-z0-9]{6,40})`,vi=RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${q}/?$`),yi=RegExp(`^/embed/${q}/?$`),bi=/^(?:media\d?|i)\.giphy\.com$/,xi=`\\.(?:gif|webp|mp4)`,Si=RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${q}/[A-Za-z0-9_-]{1,40}${xi}$`),Ci=RegExp(`^/${q}${xi}$`);function wi(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function Ti(e){if(e){if(W.has(e.host))return(vi.exec(e.path)??yi.exec(e.path))?.[1];if(bi.test(e.host))return(Si.exec(e.path)??(e.host===`i.giphy.com`?Ci.exec(e.path):null))?.[1]}}const Ei={platform:`giphy`,name:`Giphy`,shapes:[`video iframe`],match(e){let t=Ti(e);return t===void 0?null:{...wi(t),options:{}}},ownsFrame:pn},Di=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function Oi(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=yi.exec(t.path)??[];return n===void 0?null:wi(n)}function ki(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=F(n.attrs.get(`href`)??``);if(!i||!W.has(i.host)||vi.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 Ai={...Ei,parse(e){let t=H(e,Di),n=t?.iframe??e,r=Oi(n);return r?V({...r,options:{}},t?.size??B(n)):null},isOwnScript:()=>!1,isOwnExtra:ki},ji=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),J=`([A-Za-z0-9]{5,7})`,Mi=RegExp(`^/a/${J}/?$`),Ni=RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${J}/?$`),Pi=RegExp(`^/${J}/?$`),Fi=RegExp(`^/${J}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),Ii=/* @__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`]),Li=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Ri(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function zi(e){return e===void 0||Ii.has(e.toLowerCase())?void 0:e}function Bi(e){if(!e)return;if(e.host===`i.imgur.com`)return zi(Fi.exec(e.path)?.[1]);if(!ji.has(e.host))return;let t=(Mi.exec(e.path)??Ni.exec(e.path))?.[1];return t===void 0?zi(Pi.exec(e.path)?.[1]):`a/${t}`}const Vi={platform:`imgur`,name:`Imgur`,shapes:[`post iframe`],trustsFallback:e=>M(e,Li),match(e){let t=Bi(e);return t===void 0?null:{...Ri(t),options:{}}}},Hi=RegExp(`^(a/)?${J}$`),Ui=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/;function Wi(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:Wi(e.children)}})}function Gi(e,t){return e.attrs.get(t)===`false`}const Ki={...Vi,parse(e){if(e.tag!==`blockquote`||!O(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=Hi.exec(t)??[];if(r===void 0||n===void 0&&!zi(r))return null;let i={};return Gi(e,`data-context`)&&(i.context=!1),Gi(e,`data-analytics`)&&(i.analytics=!1),{...Ri(t),options:i,fallbackHtml:A(Wi(e.children),Li)}},isOwnScript:e=>Ui.test(e)},qi=/* @__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})\/?$/,Yi=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Xi=/* @__PURE__ */ new Set([`p`,`reel`]),Zi=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Qi(e){if(!e||!qi.has(e.host))return null;let[,t,n,r]=Ji.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Yi.has(t)||!Xi.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const $i={platform:`instagram`,name:`Instagram`,shapes:[`post sdk`],trustsFallback:e=>M(e,Zi),match(e){let t=Qi(e);return t&&{...t,options:{}}}},ea=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,ta={...$i,parse(e){if(e.tag!==`blockquote`||!O(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?k(e.children).reverse().map(e=>e.tag===`a`?Qi(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Qi(F(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=I(i)),{...n,options:r,fallbackHtml:A(e.children,Zi)}},isOwnScript:e=>ea.test(e)},na=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),ra=/^\/([A-Za-z0-9_-]{1,32})\/?$/,ia=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]);function aa(e,t){if(!e||!t.has(e.host))return null;let[,n]=ra.exec(e.path)??[];if(n===void 0||ia.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const oa={platform:`kick`,name:`Kick`,shapes:[`video iframe`],match(e){let t=aa(e,na)??aa(e,rn);return t&&{...t,options:{}}},ownsFrame:mn},sa=/* @__PURE__ */ new Set([`autoplay`,`muted`]),ca={...oa,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=aa(t,rn);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>sa.has(e)).map(([e,t])=>[e,I(t)]));return V({...n,options:r},B(e))},isOwnScript:()=>!1},la=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,ua=`(activity|share|ugcPost):(\\d{19})`,da=RegExp(`^(?:/embed)?/feed/update/urn:li:${ua}/?$`),fa=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`);function pa(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 ma=e=>e.replace(/%3A/gi,`:`),ha={platform:`linkedin`,name:`LinkedIn`,shapes:[`post iframe`],match(e){if(!la.test(e.host))return null;let t=ma(e.path),[,n,r]=da.exec(t)??fa.exec(t)??[];return n===void 0||r===void 0?null:pa(n,r)},ownsFrame:hn},ga=RegExp(`^/embed/feed/update/urn:li:${ua}$`),_a={...ha,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=ga.exec(t.path)??[];return n===void 0||r===void 0?null:V(pa(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),B(e))},isOwnScript:()=>!1},va=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,ya=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/;function ba(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function xa(e){if(!e||!va.test(e.host))return null;let[,t]=ya.exec(e.path)??[];return t===void 0?null:ba(t)}const Sa={platform:`pinterest`,name:`Pinterest`,shapes:[`post sdk`],match(e){let t=xa(e);return t&&{...t,options:{}}},ownsFrame:gn},Ca=/^\d{1,25}$/,wa=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,Ta=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]],Ea={...Sa,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=xa(F(e.attrs.get(`href`)??``));return t&&{...t,options:z(e,Ta,I)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&Ca.test(n)?{...ba(n),options:{}}:null},isOwnScript:e=>wa.test(e)},Da=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),Oa=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/;function ka(e){if(!e||!Da.has(e.host))return null;let[,t,n,r,i]=Oa.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 Aa={platform:`reddit`,name:`Reddit`,shapes:[`post iframe`],match(e){let t=ka(e);return t&&{...t,options:{}}}},ja=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,Ma=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,Na=[`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]),Pa={...Aa,parse(e){if(e.tag!==`blockquote`||!(O(e,`reddit-embed-bq`)||O(e,`reddit-card`)))return null;let t=k(e.children).map(e=>e.tag===`a`?ka(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=L(e.attrs.get(`data-embed-height`));return V({...t,options:z(e,Na,I)},n===void 0?void 0:{height:n})},isOwnScript:e=>ja.test(e)||Ma.test(e)},Fa=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),Ia=`([A-Za-z][A-Za-z0-9._-]{1,29})`,La=RegExp(`^(?:/@${Ia})?/spotlight/([A-Za-z0-9_-]{20,120})$`),Ra=RegExp(`^/(?:@|add/)${Ia}$`),za=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,Ba=RegExp(`^/@${Ia}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`);function Va(e){if(!e||!Fa.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=La.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]=Ra.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=za.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=Ba.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const Ha={platform:`snapchat`,name:`Snapchat`,shapes:[`post iframe`,`video iframe`],match(e){let t=Va(e);return t&&{...t,options:{}}}},Ua=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/,Wa={...Ha,parse(e){if(e.tag!==`blockquote`||!O(e,`snapchat-embed`))return null;let t=F(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=Va({...t,path:t.path.slice(0,-6)});if(!n||!k(e.children).filter(e=>e.tag===`a`).every(e=>{let t=Va(F(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=L(e.attrs.get(`data-snapchat-embed-width`)),a=L(e.attrs.get(`data-snapchat-embed-height`));return V({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>Ua.test(e)},Ga=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Ka=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,qa=`[a-z0-9_-]{1,64}`,Ja=`s-[A-Za-z0-9]{1,32}`,Ya=RegExp(`^/(${qa})(?:/(sets/${qa}|${qa})(?:/(${Ja}))?)?/?$`,`i`),Xa=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Za=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Qa=RegExp(`^${Ja}$`);function $a(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function eo(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Ka.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Qa.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return $a(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function to(e){if(!Ga.has(e.host))return null;let[,t,n,r]=Ya.exec(e.path)??[];if(t===void 0||Xa.has(t.toLowerCase())||n!==void 0&&Za.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return $a(`https://soundcloud.com/${i}`,i)}const no={platform:`soundcloud`,name:`SoundCloud`,shapes:[`post iframe`],match(e){let t=eo(e)??to(e);return t&&{...t,options:{}}},ownsFrame:yn},ro=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function io(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!ro.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&Ga.has(F(e.attrs.get(`href`)??``)?.host??``)}function ao(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&&io(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&io(r)}const oo={...no,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=eo(F(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Qa.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,I(t)])),{height:a}=B(e)??{};return V({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:ao},so=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,co=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function lo(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function uo(e,t){return e&&t.has(e.host)?so.exec(e.path)?.[1]:void 0}const fo={platform:`rumble`,name:`Rumble`,shapes:[`video iframe`],needsLookup:nr,match(e){let t=uo(e,co);return t===void 0?null:{...lo(t),options:{}}},ownsFrame:xn,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=uo(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=I(i)),V({...lo(n),options:r},B(e))},isOwnScript:()=>!1},po=/* @__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)?/?$`),mo=/* @__PURE__ */ new Set([`utm_source`,`si`]);function ho(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=po.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 go(e){return Object.fromEntries([...e].filter(([e])=>!mo.has(e)).map(([e,t])=>[e,I(t)]))}const _o={platform:`spotify`,name:`Spotify`,shapes:[`post iframe`,`video iframe`],match(e){let t=ho(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:bn,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=ho(t);if(!n)return null;let{query:r,...i}=n;return V({...i,options:go(r)},B(e))},isOwnScript:()=>!1},vo=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),yo=/^\/(activities|routes)\/(\d{1,20})\/?$/,bo={activity:`activities`,route:`routes`};function xo(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${bo[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}const So={platform:`strava`,name:`Strava`,shapes:[`post iframe`],match(e){if(!vo.has(e.host))return null;let[,t,n]=yo.exec(e.path)??[];return t===void 0||n===void 0?null:{...xo(t===`routes`?`route`:`activity`,n),options:{}}}},Co=/^\d{1,20}$/,wo=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,To=/* @__PURE__ */ new Set([`standard`,`minimal`]),Eo=/^[A-Za-z0-9_-]{1,100}$/;function Do(e){return e===`activity`||e===`route`}const Oo={...So,parse(e){if(e.tag!==`div`||!O(e,`strava-embed-placeholder`)||!e.children.every(e=>e.type===`comment`||e.type===`text`&&/^\s*$/.test(e.raw)))return null;let t=e.attrs.get(`data-embed-type`),n=e.attrs.get(`data-embed-id`)??``;if(!Do(t)||!Co.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&To.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&&Eo.test(a)&&(r.mapHash=a),{...xo(t,n),options:r}},isOwnScript:e=>wo.test(e)},ko=`([a-z0-9]{4,8})`,Ao=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),jo=RegExp(`^/[eo]/${ko}$`),Mo=RegExp(`^/${ko}/?$`),No=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]);function Po(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function Fo(e){return e!==void 0&&!No.has(e)}function Io(e){if(!e||!Ao.has(e.host))return;let t=(jo.exec(e.path)??Mo.exec(e.path))?.[1];return Fo(t)?t:void 0}const Lo={platform:`streamable`,name:`Streamable`,shapes:[`video iframe`],match(e){let t=Io(e);return t===void 0?null:{...Po(t),options:{}}},ownsFrame:Sn},Ro=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,zo=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),Bo=/<\/div\s*>$/i;function Vo(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=jo.exec(t.path)??[];if(!Fo(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>zo.has(e)).map(([e,t])=>[e,I(t)]));return{...Po(n),options:r}}const Ho={...Lo,parse(e){let t=H(e,Ro),n=t?.iframe??e,r=Vo(n);return r?V(r,t?.size??B(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=Bo.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null}},Uo=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Wo=`[A-Za-z][A-Za-z0-9_]{2,31}`,Go=RegExp(`^/(?:s/)?(${Wo})/(\\d{1,10})/?$`);function Ko(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const qo={platform:`telegram`,name:`Telegram`,shapes:[`post iframe`],match(e){if(!Uo.has(e.host))return null;let[,t,n]=Go.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)),Ko(t,n,r)}},Jo=RegExp(`^(${Wo})/(\\d{1,10})$`),Yo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Xo=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Zo=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]],Qo={...qo,parse:()=>null,parseScript(e){if(!Yo.test(e.attrs.get(`src`)??``)||Xo.some(t=>e.attrs.has(t)))return null;let[,t,n]=Jo.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=z(e,Zo,I);return e.attrs.has(`data-single`)&&(r.single=!0),Ko(t,n,r)},isOwnScript:e=>Yo.test(e)},$o=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),es=`(\\d{1,20})`,ts=RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${es}/?$`),ns=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function rs(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function is(e){return e&&$o.has(e.host)?ts.exec(e.path)?.[1]:void 0}const as={platform:`tenor`,name:`Tenor`,shapes:[`video iframe`],trustsFallback:e=>M(e,ns),match(e){let t=is(e);return t===void 0?null:{...rs(t),options:{}}},ownsFrame:Cn},os=RegExp(`^/embed/${es}$`),ss=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,cs=/^\d{1,3}(?:\.\d{1,20})?$/;function ls(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=us(t,1e4);return{width:t/n,height:1e4/n}}function us(e,t){return t===0?e:us(t,e%t)}function ds(e){if(!O(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!(/* @__PURE__ */ RegExp(`^(\\d{1,20})$`)).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!cs.test(n))return null;let r=ls(n===void 0?1.33:Number(n));return r?V({...rs(t),options:{},fallbackHtml:A(e.children,ns)},r):null}function fs(e){let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=os.exec(t.path)??[];return n===void 0?null:V({...rs(n),options:{}},B(e))}const ps={...as,parse(e){return e.tag===`div`?ds(e):e.tag===`iframe`?fs(e):null},isOwnScript:e=>ss.test(e)},ms=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),hs=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,gs=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function _s(e){if(!e||!ms.has(e.host))return null;let[,t]=hs.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const vs={platform:`threads`,name:`Threads`,shapes:[`post sdk`],trustsFallback:e=>M(e,gs),match(e){let t=_s(e);return t&&{...t,options:{}}}},ys=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,bs=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],xs={...vs,parse(e){if(e.tag!==`blockquote`||!O(e,`text-post-media`))return null;let t=_s(F(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:z(e,bs,I),fallbackHtml:A(e.children,gs)}},isOwnScript:e=>ys.test(e)},Ss=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/;function Cs(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const ws={platform:`tiktok`,name:`TikTok`,shapes:[`video iframe`],match(e){if(!U.has(e.host))return null;let[,t,n]=Ss.exec(e.path)??[];return t===void 0||n===void 0?null:Cs(n,t)},ownsFrame:ln},Ts=/^\/player\/v1\/(\d{1,25})\/?$/,Es=/^\d{1,25}$/,Ds=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/,Os={...ws,parse(e){if(e.tag===`blockquote`&&O(e,`tiktok-embed`)){let t=F(e.attrs.get(`cite`)??``),[,n,r]=t&&U.has(t.host)?Ss.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Es.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Cs(a,n)}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!U.has(t.host))return null;let[,n]=Ts.exec(t.path)??[];return n===void 0?null:V(Cs(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),B(e))},isOwnScript:e=>Ds.test(e)},ks=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),As=`(@[A-Za-z0-9_.-]{1,64})`,js=`(\\d{1,25})`,Ms=RegExp(`^/${As}/(?:posts/)?${js}/?$`);function Ns(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function Ps(e){if(!e||!ks.has(e.host))return null;let[,t,n]=Ms.exec(e.path)??[];return t===void 0||n===void 0?null:Ns(t,n)}const Fs={platform:`truthsocial`,name:`Truth Social`,shapes:[`post iframe`],match(e){let t=Ps(e);return t&&{...t,options:{}}},ownsFrame:wn},Is=RegExp(`^/${As}/${js}/embed$`),Ls=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/,Rs={...Fs,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=Is.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=O(e,`truthsocial-video`)?{video:!0}:{};return V({...Ns(n,r),options:i},B(e))},isOwnScript:e=>Ls.test(e)},zs=`([a-z0-9-]{1,32})`,Y=`(\\d{1,20})`,Bs=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),Vs=RegExp(`^/${zs}/${Y}(?:/[^/]{1,200})?/?$`),Hs=RegExp(`^${zs}\\.tumblr\\.com$`),Us=RegExp(`^/post/${Y}(?:/[^/]{1,200})?/?$`),Ws=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]);function Gs(e){if(!e)return null;let t,n;return Bs.has(e.host)?[,t,n]=Vs.exec(e.path)??[]:([,t]=Hs.exec(e.host)??[],[,n]=Us.exec(e.path)??[]),t===void 0||n===void 0||Ws.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const Ks={platform:`tumblr`,name:`Tumblr`,shapes:[`post iframe`],match(e){let t=Gs(e);return t&&{...t,options:{}}}},qs=RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${zs})/${Y}/v2$`),Js=RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${Y}$`),Ys=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/,Xs={...Ks,parse(e){if(e.tag!==`div`||!O(e,`tumblr-post`))return null;let t=F(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=qs.exec(t.path)??[],i=r??Js.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=Gs(F(a.attrs.get(`href`)??``));return s?.id!==i||n!==void 0&&s.url!==`https://www.tumblr.com/${n}/${i}`?null:{...s,options:{}}},isOwnScript:e=>Ys.test(e)},Zs=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),Qs=/^[A-Za-z0-9_]{3,25}$/,$s=/^v?(\d{1,12})$/,ec=/^[A-Za-z0-9_-]{6,30}$/,tc=/^[A-Za-z0-9_-]{6,100}$/,nc=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,rc=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]);function X(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const ic=e=>X(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),ac=e=>X(`https://www.twitch.tv/videos/${e}`,e),oc=e=>X(`https://www.twitch.tv/collections/${e}`,e),sc=e=>X(`https://clips.twitch.tv/${e}`,e);function cc(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return tc.test(t)?{found:sc(t),options:{}}:null}if(!Zs.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=$s.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:ac(t),options:n!==void 0&&nc.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?ec.test(r??``)?{found:oc(r??``),options:{}}:null:t.length===3&&r===`clip`?Qs.test(n)&&tc.test(i??``)?{found:sc(i??``),options:{}}:null:t.length===1&&Qs.test(n)&&!rc.has(n.toLowerCase())?{found:ic(n),options:{}}:null}const lc={platform:`twitch`,name:`Twitch`,shapes:[`video iframe`],match(e){let t=cc(e);return t&&{...t.found,options:t.options}},ownsFrame:un},uc=[`autoplay`,`muted`,`time`];function dc(e){let t={};for(let n of uc){let r=e.get(n);r!==void 0&&(t[n]=I(r))}return t}function fc(e){let t=e.query.get(`channel`);if(t!==void 0)return Qs.test(t)?ic(t):null;let[,n]=$s.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return ac(n);let r=e.query.get(`collection`);return r!==void 0&&ec.test(r)?oc(r):null}const pc={...lc,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=fc(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=tc.test(e)?sc(e):null}return n&&V({...n,options:dc(t.query)},B(e))},isOwnScript:()=>!1},mc=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Z=`(\\d{1,12})`,hc=`([0-9a-f]{6,20})`,gc=[RegExp(`^/${Z}(?:/${hc})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${Z}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${Z}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${Z}/?$`)],_c=RegExp(`^/video/${Z}/?$`),vc=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),yc=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function bc(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function xc(e){let[,t]=yc.exec(e.fragment??``)??[];return t?{t}:{}}function Sc(e){if(!e||!mc.has(e.host))return null;for(let t of gc){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return bc(n,r)}return null}function Cc(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=_c.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${hc}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!vc.has(e)).map(([e,t])=>[e,I(t)]));return{...bc(t,n),options:{...r,...xc(e)}}}const wc={platform:`vimeo`,name:`Vimeo`,shapes:[`video iframe`],match(e){let t=Cc(e);if(t)return t;let n=Sc(e);return n&&{...n,options:xc(e)}},ownsFrame:dn},Tc=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Ec=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/;function Dc(e,t){if(e?.type!==`element`||e.tag!==`a`||e.attrs.size!==1)return!1;let n=F(e.attrs.get(`href`)??``);return n!==null&&mc.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function Oc(e,t){return e?.type===`text`&&e.raw.trim()===t}function kc(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&&Dc(n,e=>Sc(e)?.id===t.id)&&Oc(r,`from`)&&Dc(i,()=>!0)&&Oc(a,`on`)&&Dc(o,e=>e.path===``||e.path===`/`)&&Oc(s,`.`)}const Ac={...wc,parse(e){let t=H(e,Tc),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Cc(F(n.attrs.get(`src`)??``));return r&&V(r,t?.size??B(n))},isOwnScript:e=>Ec.test(e),isOwnExtra:kc},jc=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Mc=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Nc=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,Pc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function Fc(e,t=Mc){if(!e||!jc.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`}}function Ic(e){return k(e).reverse().map(e=>e.tag===`a`?Fc(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)??null}function Lc(e,t){return Ic(D(e)??[])?.id===t}const Rc={platform:`x`,name:`X`,shapes:[`post sdk`],trustsFallback:(e,t)=>M(e,Pc)&&Lc(e,t.id),match(e){let t=Fc(e,Nc);return t&&{...t,options:{}}}},zc=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,Bc=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],Vc={...Rc,parse(e){if(e.tag!==`blockquote`||!(O(e,`twitter-tweet`)||O(e,`twitter-video`)))return null;let t=Ic(e.children);return t?{...t,options:z(e,Bc,I),fallbackHtml:A(e.children,Pc)}:null},isOwnScript:e=>zc.test(e)},Hc=`https://www.youtube.com`,Uc=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,Wc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,Gc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,Kc=/^\/([A-Za-z0-9_-]{11})\/?$/,qc=/^[A-Za-z0-9_-]{10,64}$/,Jc=/^UC[A-Za-z0-9_-]{22}$/,Yc=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,Xc=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,Zc=/^t=(.+)$/;function Qc(e){if(e===void 0||e===``)return;let t=Xc.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function $c(e){return Qc(e.get(`start`))??Qc(e.get(`t`))}function el(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function tl(e,t=!1){return el(e,t?`${Hc}/shorts/${e}`:`${Hc}/watch?v=${e}`)}function nl(e){return e!==void 0&&qc.test(e)?el(e,`${Hc}/playlist?list=${e}`):null}function rl(e){return e!==void 0&&Jc.test(e)?el(e,`${Hc}/channel/${e}/live`):null}function il(e){let[,t,n]=Wc.exec(e.path)??[];if(n!==void 0)return{found:tl(n)};if(t===`videoseries`){let t=nl(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=rl(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function al(e,t){let n=$c(e.query)??Qc(Zc.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const ol=[Vc,ta,Zr,xs,Os,{platform:`youtube`,name:`YouTube`,shapes:[`video iframe`],match(e){if(e.host===`youtu.be`){let[,t]=Kc.exec(e.path)??[];return t===void 0?null:{...tl(t),options:al(e,!1)}}let t=en.has(e.host);if(!t&&!$t.has(e.host))return null;let n=al(e,t);if(R(e.path,`/embed`)){let t=il(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&&Uc.test(t)?{...tl(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=nl(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=Yc.exec(e.path)??[],i=rl(r);if(i)return{...i,options:n};let[,a,o]=Gc.exec(e.path)??[];return a===void 0||o===void 0?null:{...tl(o,a===`shorts`),options:n}},ownsFrame:sn,parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=t!==null&&en.has(t.host);if(!t||!(n||$t.has(t.host)))return null;let r=il(t);if(!r)return null;let i=[...t.query].filter(([e])=>e!==`t`&&e!==r.key).map(([e,t])=>[e,I(t)]),a=Object.fromEntries(i),o=$c(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),V({...r.found,options:a},B(e))},isOwnScript:()=>!1},Qo,Wa,_a,Pa,Ea,_o,Ac,pc,Mr,oo,sr,dr,ca,Ai,ps,Ho,fo,Rs,Ki,Oo,_i,wr,Xs];function sl(e){return ol.find(t=>t.platform===e)}function cl(e){return ll(ol,e)}function ll(e,t){let n=dl(t);if(!n)return null;for(let t of e){let e=t.match(n);if(e)return e}return null}function ul(e,t){let n=dl(t);return n&&e.match(n)}function dl(e){return typeof e==`string`?F(e):null}function fl(e,t){if(t.platform!==e.platform)return null;let n=ul(e,t.url);if(n?.platform!==t.platform||n.id!==t.id||n.url!==t.url||!e.shapes.includes(`${t.kind} ${t.variant}`))return null;if(t.fallbackHtml===void 0||e.trustsFallback?.(t.fallbackHtml,t))return t;let r={...t};return delete r.fallbackHtml,r}const pl={bluesky:`Bluesky`,rumble:`Rumble`};function ml(e){return`social-embeds: a ${e} URL needs a lookup: use the embed code`}function hl(e,t,n){let{platform:r,name:i}=n,a=t??(e===void 0?null:ul(n,e));if(!a&&e!==void 0&&_l(n,e))return{error:ml(i)};if(!a)return{error:`social-embeds: not a ${i} post URL: ${String(e)}`};if(a.platform!==r)return{error:`social-embeds: expected a ${i} embed, got ${a.platform}`};let o=fl(n,a);return o?{embed:o}:{error:`social-embeds: the ${i} embed's url and id do not match`}}function gl(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=tr(e.url);return t?ml(pl[t]??t):`social-embeds: not a supported post URL: ${e.url}`}function _l(e,t){let n=typeof t==`string`?F(t):null;return n!==null&&e.needsLookup?.(n)===!0}function vl(e){return yl(ol,e)}function yl(e,t){if(typeof t!=`string`)return null;let n=D(t);return n?xl(e,n):bl(e,t)}function bl(e,t){for(let n of e){let r=n.repair?.(t),i=r==null?null:D(r),a=i&&xl(e,i);if(a?.platform===n.platform)return a}return null}function xl(e,t){let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(Pe(e.raw)))continue;return null}if(e.tag===`script`)i.push(e);else if(Sl(e))a=!0;else if(n){if(r)return null;r=e}else n=e}if(!n){let[t]=i;if(a||i.length!==1||!t||t.children.length!==0)return null;for(let n of e){let e=n.parseScript?.(t);if(e)return e}return null}for(let t of e){let e=t.parse(n);if(!e)continue;if(a&&!t.allowsFbRoot||r&&!t.isOwnExtra?.(r,e))return null;let o=i.map(e=>e.children.length===0?e.attrs.get(`src`):void 0);if(!o.every(e=>e!==void 0&&t.isOwnScript(e)))return null;let s=o.map(e=>e===void 0?{}:t.scriptOptions?.(e)??{});return{...e,options:Object.assign({},...s,e.options)}}return null}function Sl(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function Cl(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function wl(e){return e===null?void 0:Cl(e.trim().replace(/px$/i,``))}function Tl(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function El(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function Dl(e,t){let n=t??e.getAttribute(`html`)??Tl(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:Cl(i)??(i?.trim()?i:void 0),maxWidth:wl(e.getAttribute(`max-width`)),height:wl(e.getAttribute(`height`)),maxHeight:wl(e.getAttribute(`max-height`))},eager:El(e)}}const Ol=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function kl(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`&&Ol.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Al(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 jl(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 Ml(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Nl(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=document.createElement(`div`),l,u=e=>{kl(c,Ke(t,e,l))};u(n);let d=Ml(document.createElement(`div`)),f=Ml(document.createElement(`div`)),p=i.length>0?i:[t.fallbackHtml===void 0?Al():Pl(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=s?`did not report its height`:`did not load`,ee=()=>{g=setTimeout(()=>{h||(f.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${y}`)))},15e3)},b=e=>{let n=document.createElement(`iframe`);n.src=t.clientSrc?t.clientSrc(e):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},x=!1,S=()=>{if(x)return;x=!0,s&&_.push(s.listen(()=>m,e=>{l=e,Q(c,{height:l}),v()}));let{sizeInSrc:e}=t;e?_.push(e.watch(d,t=>{b(e.src(t))})):b(t.src)};return r&&S(),_.push(jl(d,!1,()=>{S(),ee()})),{wrapper:c,cleanup:()=>{for(let e of _)e();clearTimeout(g),c.remove()},update(e,t){u(e),t&&S()}}}function Pl(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const Fl=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function Il(e){let t=e.querySelector(Fl.map(e=>`[${e}]`).join());for(let e of Fl){let n=t?.getAttribute(e);if(n)return n}}function Ll(e){return`View this post on ${e}`}function Rl(e){return e instanceof Error?e:Error(String(e))}function zl(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{kl(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=Il(f),m=t.hasFallback?[]:o.length>0?o:[Al(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=Ll(i),h([e])}c(e)},x=(e,t)=>{g||_||(y(),y=()=>{},e>=3||t instanceof he?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,w=()=>{C||(C=!0,r.load().then(()=>{S(1)},e=>{g||b(Rl(e))}))},te=jl(f,a,w);return{wrapper:l,cleanup:()=>{g=!0,te(),clearTimeout(v),y(),l.remove()},update(e,t){u(e),t&&w()}}}const Bl=typeof HTMLElement>`u`?class{}:HTMLElement,$=`embed`;function Vl(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 Hl(e){let t=``;for(let n of e.children)n.slot!==$&&(t+=n.outerHTML);return t&&(vl(t)??Ln(t))?t:void 0}function Ul(e){let t=`html`in e?vl(e.html):cl(e.url);if(!t){let t=`html`in e?Ln(e.html):null;return t?Jn(t):{kind:`error`,message:gl(e)}}let n=sl(t.platform);if(!n)return{kind:`error`,message:gl(e)};let r=hl(void 0,t,n);return r.error===void 0?Yt(r.embed):{kind:`error`,message:r.error}}const Wl=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var Gl=class extends Bl{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 Wl){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 El(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=Dl(this,this.#e);this.#i=n.source?void 0:t&&this.#i||Hl(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=Ul(t);if(s.kind===`error`){o(Error(s.message));return}let c={...n,eager:r,placeholder:this.#i===void 0?Vl(this):[],onLoad:()=>{a(new Event(`load`))},onError:o};this.#n=s.kind===`iframe`?Nl(this,s,c):zl(this,s,c),this.#n.wrapper.slot=$}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,Gl);export{Gl 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}function s(e,t){let{origin:n,read:r}=this,i=i=>{if(i.origin!==n)return;let a=e();if(!a||i.source!==a.contentWindow)return;let o;try{o=r(i.data)}catch{return}typeof o==`number`&&o>0&&o<=5e4&&t(Math.ceil(o))};return window.addEventListener(`message`,i),()=>{window.removeEventListener(`message`,i)}}const c={origin:`https://embed.bsky.app`,read(e){let t=e?.height;return typeof t==`number`?t:void 0},listen:s};function l(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:c,startHeight:300,maxWidth:600,fallbackHtml:e.fallbackHtml}}const u=/^x[a-z0-9]{3,12}$/;function d(e,t){let{playerId:n,mute:r,startTime:o,loop:s}=t,{playerId:c,...l}=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`||!u.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(l,[`video`,`playlist`]),f)}`,title:`Dailymotion video player`,allow:`autoplay; fullscreen; picture-in-picture; web-share`,ratio:{width:16,height:9},size:e.size}}const f=15e3,p=3e3,m=/* @__PURE__ */ new Map;function h(e){if(typeof document>`u`)return Promise.reject(/* @__PURE__ */ Error(`social-embeds: platform scripts load only in the browser`));let t=m.get(e.key);return t||(t=g(e).catch(t=>{throw m.delete(e.key),t}),m.set(e.key,t)),t}async function g(e){if(!e.isPresent()){let t=[...document.querySelectorAll(`script[src]`)].filter(t=>e.isOwn(t.src));t.length!==0&&await _(e,t)||await y(e)}await e.whenPresent?.()}function _(e,t){return new Promise(n=>{let r=Date.now()+(document.readyState===`complete`?p:f),i,a=()=>{r=Date.now()+p},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 v=class extends Error{};async function y(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 v)||t>=3)throw e;await S(1e3*2**(t-1))}await(t?x(t,`${e.url} did not report ready`):b(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);let i=document.querySelector(`script[nonce]`)?.nonce;i&&n.setAttribute(`nonce`,i),n.addEventListener(`load`,()=>{t()}),n.addEventListener(`error`,()=>{n.remove(),r(new v(`social-embeds: could not load ${e.url}`))}),document.head.appendChild(n)});try{await x(r,`${e.url} did not load`)}finally{t?.()}return n}function b(e){return new Promise((t,n)=>{let r=Date.now()+f,i=()=>{e.isPresent()?t():Date.now()>=r?n(/* @__PURE__ */ Error(`social-embeds: ${e.url} did not initialise`)):setTimeout(i,50)};i()})}function x(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(/* @__PURE__ */ Error(`social-embeds: ${t}`))},f);e.then(()=>{clearTimeout(i),n()},e=>{clearTimeout(i),r(e instanceof Error?e:Error(String(e)))})})}function S(e){return new Promise(t=>setTimeout(t,e))}const C=()=>window,w=`v26.0`,te=/^[a-z]{2,3}_[A-Z]{2}$/;function ne(e){let t=C().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 C().twttr?.widgets?.load==`function`,whenPresent:()=>new Promise(e=>{let t=C().twttr?.ready;t?t(()=>{e()}):e()})};function ie(){let e=C().FB;return!e||e.__buffer?()=>{}:(e.__buffer=!0,()=>{delete e.__buffer})}function ae(e){let t=C().FB;return!ne(e)&&t!==void 0&&!t.__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=${w}`,crossOrigin:`anonymous`,isOwn:e=>/^https?:\/\/connect\.facebook\.net\/[a-z]{2,3}_[A-Z]{2}\/(?:sdk(?:\/debug)?|all)\.js(?:[?#]|$)/.test(e),isPresent:()=>typeof C().FB?.XFBML?.parse==`function`,readyCallback:()=>new Promise(e=>{let t=C().fbAsyncInit;C().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 C().PinUtils?.build==`function`};function ue(){return h(re)}function de(){return h(oe)}function fe(){return h(se)}function pe(){return h(le)}function me(e){return te.test(e)?h(ce(e)):Promise.reject(/* @__PURE__ */ Error(`social-embeds: invalid Facebook locale "${e}"`))}const T=()=>window;var he=class extends Error{};function E(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 ge(e,t){let n=e.querySelector(`blockquote`);n&&!n.hasAttribute(`class`)&&n.classList.add(t)}function _e(e){return[...e.querySelectorAll(`iframe`)].some(e=>Number.parseFloat(e.style.height)>0)}const ve={load:()=>ue(),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=E(e,_e,t);return ge(e,`twitter-tweet`),n?.widgets?.load?.(e),()=>{n?.events?.unbind?.(`rendered`,r),i()}}};function ye(e,t){if(e.getRootNode()!==document)throw new he(`social-embeds: the ${t} embed cannot render inside a shadow root`)}function be(){let e=T().instgrm?.Embeds?.process;if(!e)throw Error(`social-embeds: instgrm.Embeds.process is missing`);e()}const xe={load:()=>de(),render(e,t){ye(e,`Instagram`);let n=E(e,e=>e.querySelector(`iframe.instagram-media-rendered`)!==null,t);return ge(e,`instagram-media`),be(),n}},Se={load:()=>fe(),render(e,t){ye(e,`Threads`);let n=E(e,e=>e.querySelector(`iframe`)!==null&&e.querySelector(`blockquote`)===null,t);return ge(e,`text-post-media`),be(),n}},Ce=/* @__PURE__ */ new Map;function we(e){let t=Ce.get(e);return t||(t={load:()=>me(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:w}),i()}return()=>{}}},Ce.set(e,t)),t}const Te={load:()=>pe(),render(e,t){let n=T().PinUtils?.build;if(!n)throw Error(`social-embeds: PinUtils.build is missing`);let r=E(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}},Ee=/* @__PURE__ */ new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),De=/* @__PURE__ */ new Map([[`script`,/<\/script\s*>/giu],[`style`,/<\/style\s*>/giu]]),Oe=/<([a-zA-Z][a-zA-Z0-9-]*)/y,ke=/\s+([^\s"'>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/y,Ae=/\s*(\/?)>/y,je=/<\/([a-zA-Z][a-zA-Z0-9-]*)\s*>/y,Me=/* @__PURE__ */ new Map([[`amp`,`&`],[`lt`,`<`],[`gt`,`>`],[`quot`,`"`],[`apos`,`'`],[`nbsp`,`\xA0`]]);function D(e){let t={type:`element`,tag:``,attrs:/* @__PURE__ */ new Map,children:[]},n=[t],r=0;for(;r<e.length;){let i=n[n.length-1]??t,a=e.indexOf(`<`,r),o=a===-1?e.length:a;if(o>r&&i.children.push({type:`text`,raw:e.slice(r,o)}),a===-1)break;if(e.startsWith(`<!--`,a)){let t=e.indexOf(`-->`,a+4);if(t===-1)return null;i.children.push({type:`comment`}),r=t+3;continue}je.lastIndex=a;let s=je.exec(e);if(s){if(i===t||i.tag!==s[1]?.toLowerCase())return null;n.pop(),r=je.lastIndex;continue}let c=Ne(e,a);if(!c)return null;let{element:l}=c;i.children.push(l),r=c.end;let u=c.selfClosing?void 0:De.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&&!Ee.has(l.tag)){if(n.length>100)return null;n.push(l)}}return n.length===1?t.children:null}function Ne(e,t){Oe.lastIndex=t;let n=Oe.exec(e)?.[1];if(n===void 0)return null;let r=/* @__PURE__ */ new Map,i=Oe.lastIndex;for(;;){Ae.lastIndex=i;let t=Ae.exec(e);if(t)return{element:{type:`element`,tag:n.toLowerCase(),attrs:r,children:[]},selfClosing:t[1]===`/`,end:Ae.lastIndex};ke.lastIndex=i;let a=ke.exec(e);if(!a)return null;let[,o=``,s,c,l]=a,u=o.toLowerCase();r.has(u)||r.set(u,Pe(s??c??l??``)),i=ke.lastIndex}}function Pe(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 Me.get(t)??e;let n=t[1]===`x`||t[1]===`X`,r=Number.parseInt(t.slice(n?2:1),n?16:10);return r>0&&r<=1114111&&(r<55296||r>57343)?String.fromCodePoint(r):e})}function O(e,t){return(e.attrs.get(`class`)??``).split(/\s+/).includes(t)}function k(e){let t=[];return Fe(e,t),t}function Fe(e,t){for(let n of e)n.type===`element`&&(t.push(n),Fe(n.children,t))}const Ie=/* @__PURE__ */ new Set([`href`,`cite`]),Le=/^https?:\/\//i;function A(e,t){let n=``;for(let r of e){if(r.type===`text`){n+=r.raw;continue}if(r.type!==`element`)continue;let e=t.get(r.tag);if(e){n+=`<${r.tag}`;for(let t of e){let e=typeof t==`string`?t:t.name,i=r.attrs.get(e);i===void 0||typeof t!=`string`&&!t.value.test(i)||Ie.has(e)&&!Le.test(i)||(n+=` ${e}="${j(i)}"`)}n+=`>`,Ee.has(r.tag)||(n+=`${A(r.children,t)}</${r.tag}>`)}}return n}function j(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function M(e,t){let n=D(e);return n!==null&&A(n,t)===e}function Re(e){let t=``;for(let[n,r]of Object.entries(e))r!==void 0&&(t+=r===!0?` ${n}`:` ${n}="${j(String(r))}"`);return t}function ze(e,t){let n={};for(let[r,i]of Object.entries(e)){let e=t[r];e!==void 0&&(n[i]=String(e))}return Re(n)}function N(e,t){let n={...e};for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function P(e){return e!==void 0&&e.trim()!==``}const Be={width:`data-width`,showText:`data-show-text`,lazy:`data-lazy`,allowfullscreen:`data-allowfullscreen`,autoplay:`data-autoplay`,showCaptions:`data-show-captions`},Ve={showText:`show_text`,allowfullscreen:`allowfullscreen`,autoplay:`autoplay`,showCaptions:`show_captions`},He={post:300,video:200};function Ue(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 We(e,t){if(e.variant===`iframe`)return Ue(e);let n=N(e.options,{showText:t.showText,allowfullscreen:t.allowfullscreen,autoplay:t.autoplay,showCaptions:t.showCaptions}),{size:r}=e;if(e.kind===`video`&&n.showText===!1&&r?.width!==void 0&&r.height!==void 0){let t={};for(let[e,r]of Object.entries(Ve)){let i=n[e];i!==void 0&&(t[r]=i)}return t.width=r.width,t.height=r.height,Ue({...e,options:t})}let i=t.locale??(typeof n.locale==`string`?n.locale:`en_US`),a=`<div class="${e.kind===`video`?`fb-video`:`fb-post`}" data-href="${j(e.url)}"${ze(Be,n)}>${e.fallbackHtml??``}</div>`;return{kind:`script`,key:`${i} ${a}`,markup:a,driver:we(i),minHeight:He[e.kind],label:`Facebook`,hasFallback:P(e.fallbackHtml),maxWidth:e.kind===`post`?750:void 0}}function Ge(e){return{width:e.size?.width??e.ratio.width,height:e.size?.height??e.ratio.height}}function Ke(e,t,n){let{width:r=`100%`,maxHeight:i}=t,a=t.height??e.height,o=t.maxWidth??e.maxWidth,{width:s,height:c}=Ge(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 qe(e,t){let n=Ge(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 Je(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 Ye=[`header`,`footer`,`context`],Xe=/\/albums\/\d+$/;function Ze(e,t){let n=Xe.test(e.url),r=Ye.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,s=`https://embedr.flickr.com/${n?`photosets`:`photos`}/${e.id}${r.length>0?`?${r.map(e=>`${e}=true`).join(`&`)}`:``}`,c={width:4,height:3};return{kind:`iframe`,src:s,title:n?`Flickr album`:`Flickr photo`,allow:``,scrolling:`no`,ratio:c,...o?{size:o,maxWidth:o.width}:{},sizeInSrc:{watch:Je,src:e=>qe({src:s,ratio:c,size:o},e)},...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 Qe(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 $e={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},listen:s};function et(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:$e,startHeight:500,maxWidth:540,fallbackHtml:e.fallbackHtml}}function tt(e,t){let n=N(e.options,{captioned:t.captioned}),r=`<blockquote${Re({"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:xe,minHeight:680,label:`Instagram`,hasFallback:P(e.fallbackHtml),maxWidth:540}}const nt=/* @__PURE__ */ new Set([`autoplay`,`muted`]);function rt(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])=>nt.has(e)),n)}`,title:`Kick player`,allow:`autoplay; fullscreen`,scrolling:`no`,ratio:{width:16,height:9},size:e.size}}function it(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 at={width:`data-pin-width`,lang:`data-pin-lang`,terse:`data-pin-terse`},ot={small:236,medium:345,large:600};function st(e,t){let n=N(e.options,{width:t.pinWidth}),r=`<a href="${j(e.url)}"${ze(at,n)}></a>`;return{kind:`script`,key:r,markup:r,driver:Te,minHeight:270,label:`Pinterest`,hasFallback:!1,maxWidth:ot[String(n.width)]??236}}const ct={theme:`theme`,showMedia:`showmedia`,showTitle:`showtitle`,showUsername:`showusername`,locale:`locale`,depth:`depth`},lt={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},listen:s};function ut(e,t){let n=[];for(let[e,r]of Object.entries(ct)){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:lt,startHeight:e.size?.height??316,maxWidth:640}}function dt(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 ft={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 pt(e,t){let n=[];for(let[e,r]of Object.entries(ft)){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 mt(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 ht=/* @__PURE__ */ new Set([`track`,`episode`]);function gt(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??(ht.has(n)?152:352)}}const _t={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},listen:s};function vt(e){return e===`minimal`?`minimal`:`standard`}function yt(e,t){let n=e.id.startsWith(`route/`),r=vt(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:_t,startHeight:650,...i?{}:{maxWidth:554}}}const bt=/* @__PURE__ */ new Set([`autoplay`,`hd`,`loop`,`muted`,`nocontrols`]),xt={autoplay:`autoplay`,hd:`hd`,loop:`loop`,muted:`muted`,nocontrols:`nocontrols`};function St(e,t){let n=Object.entries(e.options).filter(([e])=>bt.has(e));return{kind:`iframe`,src:`https://streamable.com/e/${e.id}${a(n,o(t,xt))}`,title:`Streamable video`,allow:`autoplay; fullscreen`,ratio:{width:16,height:9},size:e.size}}const Ct=[[`comment`,`comment`],[`userpic`,`userpic`],[`mode`,`mode`],[`single`,`single`],[`color`,`color`],[`dark`,`dark`],[`darkColor`,`dark_color`]];function wt(e,t){return typeof t==`boolean`?e===`userpic`?String(t):e===`single`?t?1:void 0:+!!t:typeof t==`string`||typeof t==`number`?t:void 0}const Tt={origin:`https://t.me`,read(e){if(typeof e!=`string`)return;let t=JSON.parse(e);return t.event===`resize`&&typeof t.height==`number`?t.height:void 0},listen:s};function Et(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 Ct){let n=wt(t,s[e]);n!==void 0&&c.push([t,n])}return{kind:`iframe`,src:`${e.url}${a(c)}`,title:`Telegram post`,allow:``,scrolling:`no`,ratio:{width:1,height:1},messageHeight:Tt,startHeight:300,maxWidth:500}}function Dt(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 Ot(e,t){let n=N(e.options,{theme:t.theme}),r=`<blockquote${Re({"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:Se,minHeight:240,label:`Threads`,hasFallback:P(e.fallbackHtml),maxWidth:658}}const kt={controls:`controls`,progressBar:`progress_bar`,playButton:`play_button`,volumeControl:`volume_control`,fullscreenButton:`fullscreen_button`,timestamp:`timestamp`,loop:`loop`,autoplay:`autoplay`,musicInfo:`music_info`,description:`description`,rel:`rel`,nativeContextMenu:`native_context_menu`,closedCaption:`closed_caption`,forceMuted:`force_muted`};function At(e,t){let n=o(t,kt);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 jt(e){let t=e;return t?.type===`setHeight`&&typeof t.height==`number`?t.height:void 0}const Mt={origin:`https://truthsocial.com`,read:jt,listen:s},Nt={origin:`https://truthsocial.com`,read(e){let t=jt(e);return t===void 0||t<=0?void 0:t+165},listen:s},Pt=/^https:\/\/truthsocial\.com\/(@[^/]+)\/posts\/\d+$/;function Ft(e){let t=Pt.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?Nt:Mt,startHeight:150,maxWidth:e.size?.width??600}}const It={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},listen:s};function Lt(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:It,startHeight:400,maxWidth:540}}const Rt=[`channel`,`video`,`collection`,`clip`,`parent`];function zt(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 Bt(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]=zt(e.url,e.id);return{kind:`iframe`,src:`${c}${a([l],i(e.options,Rt),s)}`,title:`Twitch player`,allow:``,ratio:{width:16,height:9},size:e.size,clientSrc:Vt}}function Vt(e){return`${e}${e.includes(`?`)?`&`:`?`}parent=${encodeURIComponent(window.location.hostname)}`}const Ht={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 Ut(e,t){let{t:n,...r}=t,{t:s,...c}=e.options,l=new URL(e.url).pathname.split(`/`)[2],u=o(r,Ht),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 Wt={theme:`data-theme`,conversation:`data-conversation`,cards:`data-cards`,align:`data-align`,lang:`data-lang`,dnt:`data-dnt`,width:`data-width`};function Gt(e,t){let n=N(e.options,{...t}),r=e.fallbackHtml??`<a href="${j(e.url)}"></a>`,i=`<blockquote${ze(Wt,n)}>${r}</blockquote>`;return{kind:`script`,key:i,markup:i,driver:ve,minHeight:250,label:`X`,hasFallback:P(e.fallbackHtml),maxWidth:550}}const Kt={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 qt(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 Jt(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}=qt(e),f=o(r,Kt).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 Yt(e){switch(e.platform){case`x`:return Gt(e,{});case`instagram`:return tt(e,{});case`threads`:return Ot(e,{});case`facebook`:return We(e,{});case`tiktok`:return At(e,{});case`youtube`:return Jt(e,{});case`telegram`:return Et(e,{});case`snapchat`:return dt(e);case`linkedin`:return it(e,{});case`reddit`:return ut(e,{});case`pinterest`:return st(e,{});case`spotify`:return gt(e,{});case`vimeo`:return Ut(e,{});case`twitch`:return Bt(e,{});case`dailymotion`:return d(e,{});case`bluesky`:return l(e,{});case`soundcloud`:return pt(e,{});case`applemusic`:return n(e);case`applepodcasts`:return r(e);case`tumblr`:return Lt(e);case`kick`:return rt(e,{});case`giphy`:return Qe(e);case`tenor`:return Dt(e);case`streamable`:return St(e,{});case`rumble`:return mt(e);case`truthsocial`:return Ft(e);case`imgur`:return et(e,{});case`strava`:return yt(e,{});case`flickr`:return Ze(e,{});default:return e.platform}}const Xt=/^(?:https?:)?\/\/([^/?#\s@]+)((?:\/[^?#\s]*)?)(?:\?([^#\s]*))?(?:#(\S*))?$/i;function F(e){let t=Xt.exec(e.trim());if(!t)return null;let[,n=``,r=``,i=``,a]=t,o=/* @__PURE__ */ new Map;for(let e of i.replaceAll(`&amp;`,`&`).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 I(e){return e===`true`?!0:e===`false`?!1:/^(?:0|[1-9]\d{0,14})$/.test(e)?Number(e):e}function L(e){return e!==void 0&&/^[1-9]\d{0,5}$/.test(e)?Number(e):void 0}function R(e,t){return{...e,...t}}function z(e,t){return e===t||e.startsWith(`${t}/`)}function B(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 V(e){let t=L(e.attrs.get(`width`)),n=L(e.attrs.get(`height`));if(t!==void 0||n!==void 0)return{...t===void 0?{}:{width:t},...n===void 0?{}:{height:n}}}function H(e,t){return t?{...e,size:t}:e}function U(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=Qt(1e4,i);return{iframe:r,size:{width:1e4/a,height:i/a}}}function Qt(e,t){return t===0?e:Qt(t,e%t)}const $t=/* @__PURE__ */ new Set([`youtube.com`,`www.youtube.com`,`m.youtube.com`]),en=/* @__PURE__ */ new Set([`youtube-nocookie.com`,`www.youtube-nocookie.com`]),tn=/* @__PURE__ */ new Set([`dailymotion.com`,`www.dailymotion.com`]),W=/* @__PURE__ */ new Set([`tiktok.com`,`www.tiktok.com`]),nn=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`]),G=/* @__PURE__ */ new Set([`giphy.com`,`www.giphy.com`]),rn=/* @__PURE__ */ new Set([`player.kick.com`]),an=`embed.music.apple.com`,on=`embed.podcasts.apple.com`,sn=e=>en.has(e.host)||$t.has(e.host)&&z(e.path,`/embed`),cn=e=>e.host===`geo.dailymotion.com`||e.host===`dai.ly`||tn.has(e.host)&&(z(e.path,`/embed`)||z(e.path,`/video`)),ln=e=>W.has(e.host)&&z(e.path,`/player`),un=e=>e.host===`player.twitch.tv`||e.host===`clips.twitch.tv`&&z(e.path,`/embed`),dn=e=>e.host===`player.vimeo.com`,fn=e=>nn.has(e.host)&&z(e.path,`/plugins`),pn=e=>G.has(e.host)&&z(e.path,`/embed`),mn=e=>rn.has(e.host),hn=e=>e.host===`www.linkedin.com`&&z(e.path,`/embed`),gn=e=>e.host===`assets.pinterest.com`,_n=e=>e.host===an,vn=e=>e.host===on,yn=e=>e.host===`w.soundcloud.com`,bn=e=>e.host===`open.spotify.com`&&z(e.path,`/embed`),xn=e=>e.host===`rumble.com`&&z(e.path,`/embed`),Sn=e=>e.host===`streamable.com`&&(z(e.path,`/e`)||z(e.path,`/o`)),Cn=e=>e.host===`tenor.com`&&z(e.path,`/embed`),wn=e=>e.host===`truthsocial.com`&&e.path.startsWith(`/@`);function Tn(e){return[sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn].some(t=>t(e))}const En=[`no-referrer`,`origin`,`same-origin`,`strict-origin`,`strict-origin-when-cross-origin`],Dn=/* @__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`]),On=/* @__PURE__ */ new Set([`autoplay`,`fullscreen`,`encrypted-media`,`picture-in-picture`,`clipboard-write`,`web-share`]),kn=`[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?`,An=/* @__PURE__ */ RegExp(`^(?:https:)?//${kn}(?:[/?#]|$)`,`i`),jn=/* @__PURE__ */ RegExp(`^(?:\\*|'self'|'src'|'none'|https://${kn})$`,`i`),Mn=/\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i,Nn=/[\t\n\f\r ]+/,Pn=/^\s*(width|height)\s*:(.*)$/is,Fn=/^(\d+)px$/i,In=/(?:^|;)\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,20})?)%\s*(?:;|$)/i;function Ln(e){if(typeof e!=`string`)return null;let t=D(e);if(!t)return null;let n=k(t),[r,...i]=n.filter(e=>e.tag===`iframe`);if(!r||i.length>0)return null;let a=n.find(e=>e.children.includes(r)),{attrs:o}=r,s=V(r)??Kn(r);return zn({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&&U(a,In)?.size})}function Rn(e){return zn(e)}function zn(e){if(typeof e!=`object`||!e)return null;let t=e,n=Bn(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=En.find(e=>e===i),o=Un(t.ratio);return{src:n,...r?{title:r}:{},allow:typeof t.allow==`string`?Vn(t.allow):``,allowFullscreen:t.allowFullscreen===!0,...a?{referrerPolicy:a}:{},...typeof t.sandbox==`string`?{sandbox:Hn(t.sandbox)}:{},...typeof t.scrolling==`string`&&t.scrolling.toLowerCase()===`no`?{scrolling:`no`}:{},size:Gn(t.size),...o?{ratio:o}:{}}}function Bn(e){if(typeof e!=`string`)return null;let t=e.trim(),n=An.test(t)&&!t.includes(`\\`)?F(t):null;return!n||Mn.test(n.path)||Tn({...n,host:n.host.replace(/:\d+$/,``),path:(n.path.toLowerCase().split(`;`)[0]??``).replaceAll(`%2f`,`/`)})?null:t.startsWith(`//`)?`https:${t}`:t}function Vn(e){return e.split(`;`).map(e=>e.split(Nn).filter(Boolean)).filter(([e,...t])=>e!==void 0&&On.has(e)&&t.every(e=>jn.test(e))).map(e=>e.join(` `)).join(`; `)}function Hn(e){let t=e.split(Nn).map(e=>e.toLowerCase()).filter(e=>Dn.has(e));return[...new Set(t)].join(` `)}function Un(e){if(typeof e!=`object`||!e)return;let{width:t,height:n}=e;return Wn(t)&&Wn(n)?{width:t,height:n}:void 0}function Wn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0}function Gn(e){if(typeof e!=`object`||!e)return{};let{width:t,height:n}=e,r=typeof t==`number`?L(String(t)):void 0,i=typeof n==`number`?L(String(n)):void 0;return{...r===void 0?{}:{width:r},...i===void 0?{}:{height:i}}}function Kn(e){let t,n;for(let r of(e.attrs.get(`style`)??``).split(`;`)){let[,e=``,i=``]=Pn.exec(r)??[],a=L(Fn.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 qn={width:16,height:9};function Jn(e){let t=Rn(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}:{},...Yn(t)}:{kind:`error`,message:`social-embeds: not a generic iframe embed`}}function Yn({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??qn,...n===void 0?{}:{maxWidth:n}}:{ratio:qn,height:r}}const Xn=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),Zn=/^\/profile\/([^/]{1,253})\/post\/[A-Za-z0-9._~:-]{1,512}\/?$/,Qn=/^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,$n=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]),er=/^\/v[a-z0-9]{1,12}-[^/]{1,300}\.html$/;function tr(e){let t=typeof e==`string`?F(e):null;return t?nr(t)?`rumble`:rr(t)?`bluesky`:null:null}function nr(e){return $n.has(e.host)&&er.test(e.path)}function rr(e){if(!Xn.has(e.host))return!1;let[,t]=Zn.exec(e.path)??[];return t!==void 0&&Qn.test(t)}const ir=/^\/([a-z]{2})\/(album|song|playlist)\/(?:[^/]{1,200}\/)?(\d{1,15}|pl\.[A-Za-z0-9-]{1,64})\/?$/,ar=/^\d{1,15}$/;function or(e,t){if(e?.host!==t)return null;let[,n,r,i]=ir.exec(e.path)??[];if(n===void 0||r===void 0||i===void 0||(r===`playlist`?!i.startsWith(`pl.`):!ar.test(i)))return null;let a=r===`album`?e.query.get(`i`):void 0;return a!==void 0&&!ar.test(a)?null:{kind:`post`,url:`https://music.apple.com/${n}/${r}/${i}${a?`?i=${a}`:``}`,id:a??i,variant:`iframe`}}const sr=/* @__PURE__ */ R({platform:`applemusic`,name:`Apple Music`,shapes:[`post iframe`],match(e){let t=or(e,`music.apple.com`);return t&&{platform:`applemusic`,...t,options:{}}},ownsFrame:_n},{parse(e){if(e.tag!==`iframe`)return null;let t=or(F(e.attrs.get(`src`)??``),an);if(!t)return null;let{height:n}=V(e)??{};return H({platform:`applemusic`,...t,options:{}},n===void 0?void 0:{height:n})},isOwnScript:()=>!1}),cr=/^\/([a-z]{2})\/podcast\/(?:[^/]{1,200}\/)?(?:id)?(\d{1,15})\/?$/,lr=/^\d{1,15}$/;function ur(e,t){if(e?.host!==t)return null;let[,n,r]=cr.exec(e.path)??[];if(n===void 0||r===void 0)return null;let i=e.query.get(`i`);return i!==void 0&&!lr.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 dr=/* @__PURE__ */ R({platform:`applepodcasts`,name:`Apple Podcasts`,shapes:[`post iframe`],match(e){let t=ur(e,`podcasts.apple.com`);return t&&{...t,options:{}}},ownsFrame:vn},{parse(e){if(e.tag!==`iframe`)return null;let t=ur(F(e.attrs.get(`src`)??``),on);return t&&H({...t,options:{}},V(e))},isOwnScript:()=>!1}),fr=`(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))`,pr=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})`,mr=/* @__PURE__ */ new Set([`bsky.app`,`www.bsky.app`]),hr=/* @__PURE__ */ RegExp(`^/profile/${fr}/post/${pr}/?$`),gr=/* @__PURE__ */ new Map([[`p`,[`lang`]],[`a`,[`href`]],[`br`,[]]]);function _r(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 vr(e){if(!e||!mr.has(e.host))return null;let[,t,n]=hr.exec(e.path)??[];return t===void 0||n===void 0?null:_r(t,n)}const yr={platform:`bluesky`,name:`Bluesky`,shapes:[`post iframe`],needsLookup:rr,trustsFallback:e=>M(e,gr),match(e){let t=vr(e);return t&&{...t,options:{}}}},br=/* @__PURE__ */ RegExp(`^at://${fr}/app\\.bsky\\.feed\\.post/${pr}$`),xr=/^[a-z2-7]{20,100}$/,Sr=/* @__PURE__ */ new Set([`light`,`dark`,`system`]),Cr=/^(?:https?:)?\/\/embed\.bsky\.app\/static\/embed\.js$/,wr=/* @__PURE__ */ R(yr,{parse(e){if(e.tag!==`blockquote`||!O(e,`bluesky-embed`))return null;let[,t,n]=br.exec(e.attrs.get(`data-bluesky-uri`)??``)??[];if(t===void 0||n===void 0)return null;let r=_r(t,n);if(k(e.children).reverse().map(e=>e.tag===`a`?vr(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)?.id!==r.id)return null;let i={},a=e.attrs.get(`data-bluesky-cid`);a!==void 0&&xr.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:A(e.children,gr)}},isOwnScript:e=>Cr.test(e)}),Tr=/^x[a-z0-9]{4,12}$/,Er=/^x[a-z0-9]{3,12}$/;function Dr(e,t){return{platform:`dailymotion`,kind:`video`,url:`https://www.dailymotion.com/video/${e}`,id:e,variant:`iframe`,options:t}}function Or(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(!Tr.test(r)||n!==void 0&&!Er.test(n))return null;let i=Object.fromEntries([...e.query].filter(([e])=>e!==`video`).map(([e,t])=>[e,I(t)]));return n!==void 0&&(i.playerId=n),Dr(r,i)}function kr(e){if(e.host===`dai.ly`){let t=e.path.replace(/^\/|\/$/g,``);return Tr.test(t)?Dr(t,{}):null}if(!tn.has(e.host))return null;let[,t]=/^(?:\/embed)?\/video\/([a-z0-9]+)\/?$/.exec(e.path)??[];return t!==void 0&&Tr.test(t)?Dr(t,{}):null}const Ar={platform:`dailymotion`,name:`Dailymotion`,shapes:[`video iframe`],match(e){return Or(e)??kr(e)},ownsFrame:cn},jr=/^position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*height:\s*0;\s*overflow:\s*hidden;?$/,Mr=/* @__PURE__ */ R(Ar,{parse(e){let t=U(e,jr),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=F(n.attrs.get(`src`)??``);if(!r)return null;let i=Or(r)??kr(r);return i&&H(i,t?.size??V(n))},isOwnScript:()=>!1}),Nr=/* @__PURE__ */ new Set([`facebook.com`,`www.facebook.com`,`web.facebook.com`,`m.facebook.com`]),K=`https://www.facebook.com`,Pr=`[A-Za-z0-9.\\-]{1,80}`,Fr=`(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})`,Ir=/* @__PURE__ */ RegExp(`^/(${Pr})/posts/(${Fr})/?$`),Lr=/* @__PURE__ */ RegExp(`^/(${Pr})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`),Rr=/* @__PURE__ */ RegExp(`^/(${Pr})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`),zr=/^\/reel\/(\d{1,25})\/?$/,Br=/* @__PURE__ */ new Set([`/permalink.php`,`/story.php`]),Vr=/* @__PURE__ */ new Set([`/photo.php`,`/photo/`,`/photo`]),Hr=/* @__PURE__ */ RegExp(`^${Fr}$`),Ur=/^\d{1,25}$/,Wr={name:`class`,value:/^fb-xfbml-parse-ignore$/},Gr=/* @__PURE__ */ new Map([[`div`,[Wr]],[`blockquote`,[`cite`,Wr]],[`a`,[`href`]],[`p`,[]]]);function Kr(e){if(!e||!Nr.has(e.host))return null;let{path:t,query:n}=e,[,r,i]=Ir.exec(t)??[];if(r!==void 0&&i!==void 0)return{kind:`post`,id:i,url:`${K}/${r}/posts/${i}`};if(Br.has(t)){let e=n.get(`story_fbid`);if(e===void 0||!Hr.test(e))return null;let r=n.get(`id`),i=r!==void 0&&Ur.test(r)?`&id=${r}`:``;return{kind:`post`,id:e,url:`${K}${t}?story_fbid=${e}${i}`}}if(Vr.has(t)){let e=n.get(`fbid`);return e===void 0||!Ur.test(e)?null:{kind:`post`,id:e,url:`${K}${t}?fbid=${e}`}}let[,a,o,s]=Lr.exec(t)??[];if(a!==void 0&&o!==void 0&&s!==void 0)return{kind:`post`,id:s,url:`${K}/${a}/photos/${o}/${s}/`};let[,c,l]=Rr.exec(t)??[];if(c!==void 0&&l!==void 0)return{kind:`video`,id:l,url:`${K}/${c}/videos/${l}/`};if(t===`/watch`||t===`/watch/`||t===`/video.php`){let e=n.get(`v`);return e===void 0||!Ur.test(e)?null:{kind:`video`,id:e,url:`${K}${t===`/video.php`?t:`/watch/`}?v=${e}`}}let[,u]=zr.exec(t)??[];return u===void 0?null:{kind:`video`,id:u,url:`${K}/reel/${u}`}}function q(e,t,n,r){return{platform:`facebook`,kind:t,url:e.url,id:e.id,variant:n,options:r}}const qr={platform:`facebook`,name:`Facebook`,shapes:[`post sdk`,`video sdk`,`video iframe`],trustsFallback:e=>M(e,Gr),match(e){let t=Kr(e);return t&&q(t,t.kind,`sdk`,{})},ownsFrame:fn},Jr=/^(?:https?:)?\/\/connect\.facebook\.net\/([a-z]{2,3}_[A-Z]{2})\/sdk\.js(?:[?#].*)?$/,Yr=[[`data-width`,`width`],[`data-show-text`,`showText`],[`data-lazy`,`lazy`],[`data-allowfullscreen`,`allowfullscreen`],[`data-autoplay`,`autoplay`],[`data-show-captions`,`showCaptions`]],Xr=[[`show_text`,`showText`],[`allowfullscreen`,`allowfullscreen`],[`autoplay`,`autoplay`],[`show_captions`,`showCaptions`]],Zr=/* @__PURE__ */ R(qr,{parse(e){if(e.tag===`div`){let t=O(e,`fb-post`)?`post`:O(e,`fb-video`)?`video`:null,n=Kr(F(e.attrs.get(`data-href`)??``));return!t||!n?null:{...q(n,t,`sdk`,B(e,Yr,I)),fallbackHtml:A(e.children,Gr)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!nn.has(t.host))return null;let n=Kr(F(t.query.get(`href`)??``));if(!n)return null;if(t.path===`/plugins/post.php`){let e={},r=t.query.get(`show_text`),i=t.query.get(`width`);return r!==void 0&&(e.showText=I(r)),i!==void 0&&(e.width=I(i)),q(n,`post`,`sdk`,e)}if(t.path===`/plugins/video.php`){let r=I(t.query.get(`show_text`)??``);if(r===!0||r===1){let e={};for(let[n,r]of Xr){let i=t.query.get(n);i!==void 0&&(e[r]=I(i))}let r=L(t.query.get(`width`)),i=L(t.query.get(`height`));return H(q(n,`video`,`sdk`,{...e,showText:!0}),r===void 0||i===void 0?void 0:{width:r,height:i})}return H(q(n,`video`,`iframe`,Object.fromEntries([...t.query].filter(([e])=>e!==`href`).map(([e,t])=>[e,I(t)]))),V(e))}return null},isOwnScript:e=>Jr.test(e),scriptOptions(e){let[,t]=Jr.exec(e)??[];return t===void 0?{}:{locale:t}},allowsFbRoot:!0}),Qr=/* @__PURE__ */ new Set([`flickr.com`,`www.flickr.com`]),$r=`((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})`,ei=`(\\d{1,20})`,ti=/* @__PURE__ */ RegExp(`^/photos/${$r}/${ei}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`),ni=/* @__PURE__ */ RegExp(`^/photos/${$r}/(?:albums|sets)/${ei}/?$`),ri=/^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/,ii=`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`,ai=/^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//,oi=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?flickr\.com\//}]],[`img`,[{name:`src`,value:ai},{name:`width`,value:/^\d{1,6}$/},{name:`height`,value:/^\d{1,6}$/},`alt`]]]);function si(e){if(e===``)return null;let t=0n;for(let n of e){let e=ii.indexOf(n);if(e===-1)return null;t=t*58n+BigInt(e)}return t.toString()}function ci(e){let t=BigInt(e),n=``;for(;t>0n;)n=ii.charAt(Number(t%58n))+n,t/=58n;return n}function li(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/${t}/`,id:t,variant:`iframe`}}function ui(e,t){return{platform:`flickr`,kind:`post`,url:`https://www.flickr.com/photos/${e}/albums/${t}`,id:t,variant:`iframe`}}function di(e){if(!e||!Qr.has(e.host))return null;let[,t,n]=ni.exec(e.path)??[];if(t!==void 0&&n!==void 0)return ui(t,n);let[,r,i]=ti.exec(e.path)??[];return r===void 0||i===void 0?null:li(r,i)}function fi(e){if(e.host!==`flic.kr`)return null;let[,t]=ri.exec(e.path)??[],n=t===void 0?null:si(t);return t===void 0||n===null||ci(n)!==t?null:{platform:`flickr`,kind:`post`,url:`https://flic.kr/p/${t}`,id:n,variant:`iframe`}}const pi={platform:`flickr`,name:`Flickr`,shapes:[`post iframe`],trustsFallback:e=>M(e,oi),match(e){let t=di(e)??fi(e);return t&&{...t,options:{}}}},mi=/^(?:https?:)?\/\/embedr\.flickr\.com\/assets\/client-code\.js$/,hi=[`header`,`footer`,`context`];function gi(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 _i=/* @__PURE__ */ R(pi,{parse(e){if(e.tag!==`a`||e.attrs.get(`data-flickr-embed`)!==`true`)return null;let t=di(F(e.attrs.get(`href`)??``)),n=gi(e);if(!t||!n)return null;let r={};for(let t of hi)e.attrs.get(`data-${t}`)===`true`&&(r[t]=!0);let i=V(n),a=ai.test(n.attrs.get(`src`)??``)?e:{...e,children:[]};return H({...t,options:r,fallbackHtml:A([a],oi)},i?.width!==void 0&&i.height!==void 0?i:void 0)},isOwnScript:e=>mi.test(e)}),J=`([A-Za-z0-9]{6,40})`,vi=/* @__PURE__ */ RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${J}/?$`),yi=/* @__PURE__ */ RegExp(`^/embed/${J}/?$`),bi=/^(?:media\d?|i)\.giphy\.com$/,xi=`\\.(?:gif|webp|mp4)`,Si=/* @__PURE__ */ RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${J}/[A-Za-z0-9_-]{1,40}${xi}$`),Ci=/* @__PURE__ */ RegExp(`^/${J}${xi}$`);function wi(e){return{platform:`giphy`,kind:`video`,url:`https://giphy.com/gifs/${e}`,id:e,variant:`iframe`}}function Ti(e){if(e){if(G.has(e.host))return(vi.exec(e.path)??yi.exec(e.path))?.[1];if(bi.test(e.host))return(Si.exec(e.path)??(e.host===`i.giphy.com`?Ci.exec(e.path):null))?.[1]}}const Ei={platform:`giphy`,name:`Giphy`,shapes:[`video iframe`],match(e){let t=Ti(e);return t===void 0?null:{...wi(t),options:{}}},ownsFrame:pn},Di=/^width:\s*100%;\s*height:\s*0;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;\s*position:\s*relative;?$/;function Oi(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!G.has(t.host))return null;let[,n]=yi.exec(t.path)??[];return n===void 0?null:wi(n)}function ki(e,t){if(e.tag!==`p`||e.attrs.size!==0)return!1;let[n,...r]=e.children;if(r.length>0||n?.type!==`element`||n.tag!==`a`||n.attrs.size!==1)return!1;let i=F(n.attrs.get(`href`)??``);if(!i||!G.has(i.host)||vi.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 Ai=/* @__PURE__ */ R(Ei,{parse(e){let t=U(e,Di),n=t?.iframe??e,r=Oi(n);return r?H({...r,options:{}},t?.size??V(n)):null},isOwnScript:()=>!1,isOwnExtra:ki}),ji=/* @__PURE__ */ new Set([`imgur.com`,`www.imgur.com`,`m.imgur.com`]),Y=`([A-Za-z0-9]{5,7})`,Mi=/* @__PURE__ */ RegExp(`^/a/${Y}/?$`),Ni=/* @__PURE__ */ RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${Y}/?$`),Pi=/* @__PURE__ */ RegExp(`^/${Y}/?$`),Fi=/* @__PURE__ */ RegExp(`^/${Y}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`),Ii=/* @__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`]),Li=/* @__PURE__ */ new Map([[`a`,[{name:`href`,value:/^https:\/\/(?:www\.)?imgur\.com\//}]]]);function Ri(e){return{platform:`imgur`,kind:`post`,url:`https://imgur.com/${e}`,id:e,variant:`iframe`}}function zi(e){return e===void 0||Ii.has(e.toLowerCase())?void 0:e}function Bi(e){if(!e)return;if(e.host===`i.imgur.com`)return zi(Fi.exec(e.path)?.[1]);if(!ji.has(e.host))return;let t=(Mi.exec(e.path)??Ni.exec(e.path))?.[1];return t===void 0?zi(Pi.exec(e.path)?.[1]):`a/${t}`}const Vi={platform:`imgur`,name:`Imgur`,shapes:[`post iframe`],trustsFallback:e=>M(e,Li),match(e){let t=Bi(e);return t===void 0?null:{...Ri(t),options:{}}}},Hi=/* @__PURE__ */ RegExp(`^(a/)?${Y}$`),Ui=/^(?:https?:)?\/\/s\.imgur\.com\/min\/embed\.js$/;function Wi(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:Wi(e.children)}})}function Gi(e,t){return e.attrs.get(t)===`false`}const Ki=/* @__PURE__ */ R(Vi,{parse(e){if(e.tag!==`blockquote`||!O(e,`imgur-embed-pub`))return null;let t=e.attrs.get(`data-id`)??``,[,n,r]=Hi.exec(t)??[];if(r===void 0||n===void 0&&!zi(r))return null;let i={};return Gi(e,`data-context`)&&(i.context=!1),Gi(e,`data-analytics`)&&(i.analytics=!1),{...Ri(t),options:i,fallbackHtml:A(Wi(e.children),Li)}},isOwnScript:e=>Ui.test(e)}),qi=/* @__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})\/?$/,Yi=/* @__PURE__ */ new Set([`p`,`reel`,`reels`,`tv`]),Xi=/* @__PURE__ */ new Set([`p`,`reel`]),Zi=/* @__PURE__ */ new Map([[`div`,[]],[`a`,[`href`]],[`p`,[]]]);function Qi(e){if(!e||!qi.has(e.host))return null;let[,t,n,r]=Ji.exec(e.path)??[];return n===void 0||r===void 0||t!==void 0&&(Yi.has(t)||!Xi.has(n))?null:{platform:`instagram`,kind:`post`,url:`https://www.instagram.com/${n===`reels`?`reel`:n}/${r}/`,id:r,variant:`sdk`}}const $i={platform:`instagram`,name:`Instagram`,shapes:[`post sdk`],trustsFallback:e=>M(e,Zi),match(e){let t=Qi(e);return t&&{...t,options:{}}}},ea=/^(?:https?:)?\/\/www\.instagram\.com\/embed\.js$/,ta=/* @__PURE__ */ R($i,{parse(e){if(e.tag!==`blockquote`||!O(e,`instagram-media`))return null;let t=e.attrs.get(`data-instgrm-permalink`),n=t===void 0?k(e.children).reverse().map(e=>e.tag===`a`?Qi(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null):Qi(F(t));if(!n)return null;let r={};e.attrs.has(`data-instgrm-captioned`)&&(r.captioned=!0);let i=e.attrs.get(`data-instgrm-version`);return i!==void 0&&(r.version=I(i)),{...n,options:r,fallbackHtml:A(e.children,Zi)}},isOwnScript:e=>ea.test(e)}),na=/* @__PURE__ */ new Set([`kick.com`,`www.kick.com`]),ra=/^\/([A-Za-z0-9_-]{1,32})\/?$/,ia=/* @__PURE__ */ new Set([`browse`,`categories`,`category`,`clips`,`video`,`videos`,`following`,`search`,`settings`,`dashboard`,`subscriptions`,`privacy-policy`,`terms-of-service`,`community-guidelines`,`help`]);function aa(e,t){if(!e||!t.has(e.host))return null;let[,n]=ra.exec(e.path)??[];if(n===void 0||ia.has(n.toLowerCase()))return null;let r=n.toLowerCase();return{platform:`kick`,kind:`video`,url:`https://kick.com/${r}`,id:r,variant:`iframe`}}const oa={platform:`kick`,name:`Kick`,shapes:[`video iframe`],match(e){let t=aa(e,na)??aa(e,rn);return t&&{...t,options:{}}},ownsFrame:mn},sa=/* @__PURE__ */ new Set([`autoplay`,`muted`]),ca=/* @__PURE__ */ R(oa,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=aa(t,rn);if(!n||!t)return null;let r=Object.fromEntries([...t.query].filter(([e])=>sa.has(e)).map(([e,t])=>[e,I(t)]));return H({...n,options:r},V(e))},isOwnScript:()=>!1}),la=/^(?:www\.|[a-z]{2}\.)?linkedin\.com$/,ua=`(activity|share|ugcPost):(\\d{19})`,da=/* @__PURE__ */ RegExp(`^(?:/embed)?/feed/update/urn:li:${ua}/?$`),fa=/* @__PURE__ */ RegExp(`^/posts/[^/]{1,300}-(activity|share|ugcPost)-(\\d{19})-[A-Za-z0-9_-]{1,8}/?$`);function pa(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 ma=e=>e.replace(/%3A/gi,`:`),ha={platform:`linkedin`,name:`LinkedIn`,shapes:[`post iframe`],match(e){if(!la.test(e.host))return null;let t=ma(e.path),[,n,r]=da.exec(t)??fa.exec(t)??[];return n===void 0||r===void 0?null:pa(n,r)},ownsFrame:hn},ga=/* @__PURE__ */ RegExp(`^/embed/feed/update/urn:li:${ua}$`),_a=/* @__PURE__ */ R(ha,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`www.linkedin.com`)return null;let[,n,r]=ga.exec(t.path)??[];return n===void 0||r===void 0?null:H(pa(n,r,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),V(e))},isOwnScript:()=>!1}),va=/^(?:(?:www|[a-z]{2})\.)?pinterest\.(?:[a-z]{2,3}|co\.[a-z]{2}|com\.[a-z]{2})$/,ya=/^\/pin\/(?:[A-Za-z0-9-]{0,200}--)?(\d{1,25})\/?$/;function ba(e){return{platform:`pinterest`,kind:`post`,url:`https://www.pinterest.com/pin/${e}/`,id:e,variant:`sdk`}}function xa(e){if(!e||!va.test(e.host))return null;let[,t]=ya.exec(e.path)??[];return t===void 0?null:ba(t)}const Sa={platform:`pinterest`,name:`Pinterest`,shapes:[`post sdk`],match(e){let t=xa(e);return t&&{...t,options:{}}},ownsFrame:gn},Ca=/^\d{1,25}$/,wa=/^(?:https?:)?\/\/assets\.pinterest\.com\/js\/pinit(?:_main)?\.js$/,Ta=[[`data-pin-width`,`width`],[`data-pin-lang`,`lang`],[`data-pin-terse`,`terse`]],Ea=/* @__PURE__ */ R(Sa,{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=xa(F(e.attrs.get(`href`)??``));return t&&{...t,options:B(e,Ta,I)}}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`assets.pinterest.com`||t.path!==`/ext/embed.html`)return null;let n=t.query.get(`id`);return n!==void 0&&Ca.test(n)?{...ba(n),options:{}}:null},isOwnScript:e=>wa.test(e)}),Da=/* @__PURE__ */ new Set([`reddit.com`,`www.reddit.com`,`old.reddit.com`,`new.reddit.com`]),Oa=/^\/r\/([A-Za-z0-9_]{2,21})\/comments\/([a-z0-9]{1,12})(?:\/([^/]{1,300}))?(?:\/([a-z0-9]{1,16}))?\/?$/;function ka(e){if(!e||!Da.has(e.host))return null;let[,t,n,r,i]=Oa.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 Aa={platform:`reddit`,name:`Reddit`,shapes:[`post iframe`],match(e){let t=ka(e);return t&&{...t,options:{}}}},ja=/^(?:https?:)?\/\/embed\.reddit\.com\/widgets\.js$/,Ma=/^(?:https?:)?\/\/embed\.redditmedia\.com\/widgets\/platform\.js$/,Na=/* @__PURE__ */ [`depth`,`style`,`theme`,`showmedia`,`showtitle`,`showedits`,`created`,`locale`,`showusername`,`snippet`].map(e=>[`data-embed-${e}`,e]),Pa=/* @__PURE__ */ R(Aa,{parse(e){if(e.tag!==`blockquote`||!(O(e,`reddit-embed-bq`)||O(e,`reddit-card`)))return null;let t=k(e.children).map(e=>e.tag===`a`?ka(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null);if(!t)return null;let n=L(e.attrs.get(`data-embed-height`));return H({...t,options:B(e,Na,I)},n===void 0?void 0:{height:n})},isOwnScript:e=>ja.test(e)||Ma.test(e)}),Fa=/* @__PURE__ */ new Set([`snapchat.com`,`www.snapchat.com`]),Ia=`([A-Za-z][A-Za-z0-9._-]{1,29})`,La=/* @__PURE__ */ RegExp(`^(?:/@${Ia})?/spotlight/([A-Za-z0-9_-]{20,120})$`),Ra=/* @__PURE__ */ RegExp(`^/(?:@|add/)${Ia}$`),za=/^\/lens\/([0-9a-f]{32}|\d{1,20})$/,Ba=/* @__PURE__ */ RegExp(`^/@${Ia}/highlight/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$`);function Va(e){if(!e||!Fa.has(e.host))return null;let t=e.path.replace(/\/$/,``),n={platform:`snapchat`,variant:`iframe`},[,r,i]=La.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]=Ra.exec(t)??[];if(a!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/@${a}`,id:a};let[,o]=za.exec(t)??[];if(o!==void 0)return{...n,kind:`post`,url:`https://www.snapchat.com/lens/${o}`,id:o};let[,s,c]=Ba.exec(t)??[];return s!==void 0&&c!==void 0?{...n,kind:`post`,url:`https://www.snapchat.com/@${s}/highlight/${c}`,id:c}:null}const Ha={platform:`snapchat`,name:`Snapchat`,shapes:[`post iframe`,`video iframe`],match(e){let t=Va(e);return t&&{...t,options:{}}}},Ua=/^(?:https?:)?\/\/www\.snapchat\.com\/embed\.js$/,Wa=/* @__PURE__ */ R(Ha,{parse(e){if(e.tag!==`blockquote`||!O(e,`snapchat-embed`))return null;let t=F(e.attrs.get(`data-snapchat-embed-url`)??``);if(!t?.path.endsWith(`/embed`))return null;let n=Va({...t,path:t.path.slice(0,-6)});if(!n||!k(e.children).filter(e=>e.tag===`a`).every(e=>{let t=Va(F(e.attrs.get(`href`)??``));return t?.kind===n.kind&&t.id===n.id}))return null;let r=e.attrs.get(`data-snapchat-embed-title`),i=L(e.attrs.get(`data-snapchat-embed-width`)),a=L(e.attrs.get(`data-snapchat-embed-height`));return H({...n,options:r===void 0?{}:{title:r}},i===void 0||a===void 0?void 0:{width:i,height:a})},isOwnScript:e=>Ua.test(e)}),Ga=/* @__PURE__ */ new Set([`soundcloud.com`,`www.soundcloud.com`,`m.soundcloud.com`]),Ka=/^\/(tracks|playlists|users)\/(?:soundcloud%3A(?:tracks|playlists|users)%3A)?(\d{1,15})\/?$/i,qa=`[a-z0-9_-]{1,64}`,Ja=`s-[A-Za-z0-9]{1,32}`,Ya=/* @__PURE__ */ RegExp(`^/(${qa})(?:/(sets/${qa}|${qa})(?:/(${Ja}))?)?/?$`,`i`),Xa=/* @__PURE__ */ new Set([`discover`,`search`,`stream`,`feed`,`you`,`upload`,`charts`,`pages`,`settings`,`messages`,`notifications`,`people`,`stations`,`library`,`terms-of-use`,`signin`]),Za=/* @__PURE__ */ new Set([`likes`,`tracks`,`sets`,`albums`,`reposts`,`popular-tracks`,`followers`,`following`,`comments`,`spotlight`,`toptracks`]),Qa=/* @__PURE__ */ RegExp(`^${Ja}$`);function $a(e,t){return{platform:`soundcloud`,kind:`post`,url:e,id:t,variant:`iframe`}}function eo(e){if(e?.host!==`api.soundcloud.com`)return null;let[,t,n]=Ka.exec(e.path)??[];if(t===void 0||n===void 0)return null;let r=e.query.get(`secret_token`);if(r!==void 0&&!Qa.test(r))return null;let i=r===void 0?``:`?secret_token=${r}`;return $a(`https://api.soundcloud.com/${t.toLowerCase()}/${n}${i}`,n)}function to(e){if(!Ga.has(e.host))return null;let[,t,n,r]=Ya.exec(e.path)??[];if(t===void 0||Xa.has(t.toLowerCase())||n!==void 0&&Za.has(n.toLowerCase()))return null;let i=[t,n,r].filter(Boolean).join(`/`);return $a(`https://soundcloud.com/${i}`,i)}const no={platform:`soundcloud`,name:`SoundCloud`,shapes:[`post iframe`],match(e){let t=eo(e)??to(e);return t&&{...t,options:{}}},ownsFrame:yn},ro=/* @__PURE__ */ new Set([`href`,`title`,`target`,`style`]);function io(e){if(e?.type!==`element`||e.tag!==`a`||[...e.attrs.keys()].some(e=>!ro.has(e)))return!1;let[t,...n]=e.children;return n.length===0&&t?.type===`text`&&Ga.has(F(e.attrs.get(`href`)??``)?.host??``)}function ao(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&&io(t)&&n?.type===`text`&&/^\s*·\s*$/.test(n.raw)&&io(r)}const oo=/* @__PURE__ */ R(no,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(t?.host!==`w.soundcloud.com`||!/^\/player\/?$/.test(t.path))return null;let n=eo(F(t.query.get(`url`)??``));if(!n)return null;let r=t.query.get(`secret_token`);if(r!==void 0){if(!Qa.test(r))return null;n.url.includes(`?`)||(n={...n,url:`${n.url}?secret_token=${r}`})}let i=Object.fromEntries([...t.query].filter(([e])=>e!==`url`&&e!==`secret_token`).map(([e,t])=>[e,I(t)])),{height:a}=V(e)??{};return H({...n,options:i},a===void 0?void 0:{height:a})},isOwnScript:()=>!1,isOwnExtra:ao}),so=/^\/embed\/(v[a-z0-9]{1,12})\/?$/,co=/* @__PURE__ */ new Set([`rumble.com`,`www.rumble.com`]);function lo(e){return{platform:`rumble`,kind:`video`,url:`https://rumble.com/embed/${e}/`,id:e,variant:`iframe`}}function uo(e,t){return e&&t.has(e.host)?so.exec(e.path)?.[1]:void 0}const fo=/* @__PURE__ */ R({platform:`rumble`,name:`Rumble`,shapes:[`video iframe`],needsLookup:nr,match(e){let t=uo(e,co);return t===void 0?null:{...lo(t),options:{}}},ownsFrame:xn},{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=uo(t,/* @__PURE__ */ new Set([`rumble.com`]));if(n===void 0||!t)return null;let r={},i=t.query.get(`pub`);return i&&(r.pub=I(i)),H({...lo(n),options:r},V(e))},isOwnScript:()=>!1}),po=/* @__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)?/?$`),mo=/* @__PURE__ */ new Set([`utm_source`,`si`]);function ho(e){if(e?.host!==`open.spotify.com`)return null;let[,t,n,r]=po.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 go(e){return Object.fromEntries([...e].filter(([e])=>!mo.has(e)).map(([e,t])=>[e,I(t)]))}const _o=/* @__PURE__ */ R({platform:`spotify`,name:`Spotify`,shapes:[`post iframe`,`video iframe`],match(e){let t=ho(e);return t&&{platform:t.platform,kind:`post`,url:t.url,id:t.id,variant:t.variant,options:{}}},ownsFrame:bn},{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t?.path.startsWith(`/embed/`))return null;let n=ho(t);if(!n)return null;let{query:r,...i}=n;return H({...i,options:go(r)},V(e))},isOwnScript:()=>!1}),vo=/* @__PURE__ */ new Set([`strava.com`,`www.strava.com`]),yo=/^\/(activities|routes)\/(\d{1,20})\/?$/,bo={activity:`activities`,route:`routes`};function xo(e,t){return{platform:`strava`,kind:`post`,url:`https://www.strava.com/${bo[e]}/${t}`,id:`${e}/${t}`,variant:`iframe`}}const So={platform:`strava`,name:`Strava`,shapes:[`post iframe`],match(e){if(!vo.has(e.host))return null;let[,t,n]=yo.exec(e.path)??[];return t===void 0||n===void 0?null:{...xo(t===`routes`?`route`:`activity`,n),options:{}}}},Co=/^\d{1,20}$/,wo=/^(?:https?:)?\/\/strava-embeds\.com\/embed\.js$/,To=/* @__PURE__ */ new Set([`standard`,`minimal`]),Eo=/^[A-Za-z0-9_-]{1,100}$/;function Do(e){return e===`activity`||e===`route`}const Oo=/* @__PURE__ */ R(So,{parse(e){if(e.tag!==`div`||!O(e,`strava-embed-placeholder`)||!e.children.every(e=>e.type===`comment`||e.type===`text`&&/^\s*$/.test(e.raw)))return null;let t=e.attrs.get(`data-embed-type`),n=e.attrs.get(`data-embed-id`)??``;if(!Do(t)||!Co.test(n))return null;let r={},i=e.attrs.get(`data-style`);i!==void 0&&To.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&&Eo.test(a)&&(r.mapHash=a),{...xo(t,n),options:r}},isOwnScript:e=>wo.test(e)}),ko=`([a-z0-9]{4,8})`,Ao=/* @__PURE__ */ new Set([`streamable.com`,`www.streamable.com`]),jo=/* @__PURE__ */ RegExp(`^/[eo]/${ko}$`),Mo=/* @__PURE__ */ RegExp(`^/${ko}/?$`),No=/* @__PURE__ */ new Set([`about`,`login`,`signup`,`terms`,`privacy`,`pricing`,`upload`,`help`,`apps`,`blog`,`jobs`,`press`,`tools`,`embed`,`plans`,`contact`,`support`,`videos`,`account`,`profile`]);function Po(e){return{platform:`streamable`,kind:`video`,url:`https://streamable.com/${e}`,id:e,variant:`iframe`}}function Fo(e){return e!==void 0&&!No.has(e)}function Io(e){if(!e||!Ao.has(e.host))return;let t=(jo.exec(e.path)??Mo.exec(e.path))?.[1];return Fo(t)?t:void 0}const Lo={platform:`streamable`,name:`Streamable`,shapes:[`video iframe`],match(e){let t=Io(e);return t===void 0?null:{...Po(t),options:{}}},ownsFrame:Sn},Ro=/^width:\s*100%;\s*height:\s*0(?:px)?;\s*position:\s*relative;\s*padding-bottom:\s*(\d{1,3}(?:\.\d{1,4})?)%;?$/,zo=/* @__PURE__ */ new Set([`loop`,`autoplay`,`nocontrols`,`hd`,`muted`]),Bo=/<\/div\s*>$/i;function Vo(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`streamable.com`)return null;let[,n]=jo.exec(t.path)??[];if(!Fo(n))return null;let r=Object.fromEntries([...t.query].filter(([e])=>zo.has(e)).map(([e,t])=>[e,I(t)]));return{...Po(n),options:r}}const Ho=/* @__PURE__ */ R(Lo,{parse(e){let t=U(e,Ro),n=t?.iframe??e,r=Vo(n);return r?H(r,t?.size??V(n)):null},isOwnScript:()=>!1,repair(e){let t=e.trimEnd(),n=Bo.exec(t);if(!n)return null;let r=t.slice(0,n.index).trimEnd();return/^\s*<iframe[\s>]/i.test(r)?r:null}}),Uo=/* @__PURE__ */ new Set([`t.me`,`telegram.me`,`www.telegram.me`]),Wo=`[A-Za-z][A-Za-z0-9_]{2,31}`,Go=/* @__PURE__ */ RegExp(`^/(?:s/)?(${Wo})/(\\d{1,10})/?$`);function Ko(e,t,n){return{platform:`telegram`,kind:`post`,url:`https://t.me/${e}/${t}`,id:`${e}/${t}`,variant:`iframe`,options:n}}const qo={platform:`telegram`,name:`Telegram`,shapes:[`post iframe`],match(e){if(!Uo.has(e.host))return null;let[,t,n]=Go.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)),Ko(t,n,r)}},Jo=/* @__PURE__ */ RegExp(`^(${Wo})/(\\d{1,10})$`),Yo=/^(?:https?:)?\/\/telegram\.org\/js\/telegram-widget\.js(?:\?\d{1,3})?$/,Xo=[`data-telegram-login`,`data-telegram-discussion`,`data-telegram-share-url`],Zo=[[`data-width`,`width`],[`data-comment`,`comment`],[`data-userpic`,`userpic`],[`data-mode`,`mode`],[`data-color`,`color`],[`data-dark`,`dark`],[`data-dark-color`,`darkColor`]],Qo=/* @__PURE__ */ R(qo,{parse:()=>null,parseScript(e){if(!Yo.test(e.attrs.get(`src`)??``)||Xo.some(t=>e.attrs.has(t)))return null;let[,t,n]=Jo.exec(e.attrs.get(`data-telegram-post`)??``)??[];if(t===void 0||n===void 0)return null;let r=B(e,Zo,I);return e.attrs.has(`data-single`)&&(r.single=!0),Ko(t,n,r)},isOwnScript:e=>Yo.test(e)}),$o=/* @__PURE__ */ new Set([`tenor.com`,`www.tenor.com`]),es=`(\\d{1,20})`,ts=/* @__PURE__ */ RegExp(`^/(?:[a-z]{2}(?:-[A-Za-z]{2,4})?/)?view/(?:[A-Za-z0-9%_.~-]{1,300}-gif-)?${es}/?$`),ns=/* @__PURE__ */ new Map([[`a`,[`href`]]]);function rs(e){return{platform:`tenor`,kind:`video`,url:`https://tenor.com/view/${e}`,id:e,variant:`iframe`}}function is(e){return e&&$o.has(e.host)?ts.exec(e.path)?.[1]:void 0}const as={platform:`tenor`,name:`Tenor`,shapes:[`video iframe`],trustsFallback:e=>M(e,ns),match(e){let t=is(e);return t===void 0?null:{...rs(t),options:{}}},ownsFrame:Cn},os=/* @__PURE__ */ RegExp(`^/embed/${es}$`),ss=/^(?:https?:)?\/\/tenor\.com\/embed\.js$/,cs=/^\d{1,3}(?:\.\d{1,20})?$/;function ls(e){let t=Math.round(e*1e4);if(!(t>=100&&t<=1e6))return;let n=us(t,1e4);return{width:t/n,height:1e4/n}}function us(e,t){return t===0?e:us(t,e%t)}function ds(e){if(!O(e,`tenor-gif-embed`))return null;let t=e.attrs.get(`data-postid`)??``;if(!(/* @__PURE__ */ RegExp(`^(\\d{1,20})$`)).test(t))return null;let n=e.attrs.get(`data-aspect-ratio`);if(n!==void 0&&!cs.test(n))return null;let r=ls(n===void 0?1.33:Number(n));return r?H({...rs(t),options:{},fallbackHtml:A(e.children,ns)},r):null}function fs(e){let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`tenor.com`)return null;let[,n]=os.exec(t.path)??[];return n===void 0?null:H({...rs(n),options:{}},V(e))}const ps=/* @__PURE__ */ R(as,{parse(e){return e.tag===`div`?ds(e):e.tag===`iframe`?fs(e):null},isOwnScript:e=>ss.test(e)}),ms=/* @__PURE__ */ new Set([`threads.com`,`www.threads.com`,`threads.net`,`www.threads.net`]),hs=/^\/(?:@[A-Za-z0-9._]{1,30}\/post|t)\/([A-Za-z0-9_-]{1,64})\/?$/,gs=/* @__PURE__ */ new Map([[`a`,[`href`]],[`div`,[]]]);function _s(e){if(!e||!ms.has(e.host))return null;let[,t]=hs.exec(e.path)??[];return t===void 0?null:{platform:`threads`,kind:`post`,url:`https://www.threads.com/t/${t}`,id:t,variant:`sdk`}}const vs={platform:`threads`,name:`Threads`,shapes:[`post sdk`],trustsFallback:e=>M(e,gs),match(e){let t=_s(e);return t&&{...t,options:{}}}},ys=/^(?:https?:)?\/\/www\.threads\.(?:com|net)\/embed\.js$/,bs=[[`data-theme`,`theme`],[`data-text-post-version`,`version`]],xs=/* @__PURE__ */ R(vs,{parse(e){if(e.tag!==`blockquote`||!O(e,`text-post-media`))return null;let t=_s(F(e.attrs.get(`data-text-post-permalink`)??``));if(!t)return null;let n=e.attrs.get(`id`);return n!==void 0&&n!==`ig-tp-${t.id}`?null:{...t,options:B(e,bs,I),fallbackHtml:A(e.children,gs)}},isOwnScript:e=>ys.test(e)}),Ss=/^\/@([A-Za-z0-9._]{0,64})\/video\/(\d{1,25})\/?$/;function Cs(e,t=``,n={}){return{platform:`tiktok`,kind:`video`,url:`https://www.tiktok.com/@${t}/video/${e}`,id:e,variant:`iframe`,options:n}}const ws={platform:`tiktok`,name:`TikTok`,shapes:[`video iframe`],match(e){if(!W.has(e.host))return null;let[,t,n]=Ss.exec(e.path)??[];return t===void 0||n===void 0?null:Cs(n,t)},ownsFrame:ln},Ts=/^\/player\/v1\/(\d{1,25})\/?$/,Es=/^\d{1,25}$/,Ds=/^(?:https?:)?\/\/www\.tiktok\.com\/embed\.js$/,Os=/* @__PURE__ */ R(ws,{parse(e){if(e.tag===`blockquote`&&O(e,`tiktok-embed`)){let t=F(e.attrs.get(`cite`)??``),[,n,r]=t&&W.has(t.host)?Ss.exec(t.path)??[]:[],i=e.attrs.get(`data-video-id`);if(i!==void 0&&!Es.test(i)||i!==void 0&&r!==void 0&&i!==r)return null;let a=i??r;return a===void 0?null:Cs(a,n)}if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||!W.has(t.host))return null;let[,n]=Ts.exec(t.path)??[];return n===void 0?null:H(Cs(n,``,Object.fromEntries([...t.query].map(([e,t])=>[e,I(t)]))),V(e))},isOwnScript:e=>Ds.test(e)}),ks=/* @__PURE__ */ new Set([`truthsocial.com`,`www.truthsocial.com`]),As=`(@[A-Za-z0-9_.-]{1,64})`,js=`(\\d{1,25})`,Ms=/* @__PURE__ */ RegExp(`^/${As}/(?:posts/)?${js}/?$`);function Ns(e,t){return{platform:`truthsocial`,kind:`post`,url:`https://truthsocial.com/${e}/posts/${t}`,id:t,variant:`iframe`}}function Ps(e){if(!e||!ks.has(e.host))return null;let[,t,n]=Ms.exec(e.path)??[];return t===void 0||n===void 0?null:Ns(t,n)}const Fs={platform:`truthsocial`,name:`Truth Social`,shapes:[`post iframe`],match(e){let t=Ps(e);return t&&{...t,options:{}}},ownsFrame:wn},Is=/* @__PURE__ */ RegExp(`^/${As}/${js}/embed$`),Ls=/^(?:https?:)?\/\/truthsocial\.com\/embed\.js$/,Rs=/* @__PURE__ */ R(Fs,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t||t.host!==`truthsocial.com`)return null;let[,n,r]=Is.exec(t.path)??[];if(n===void 0||r===void 0)return null;let i=O(e,`truthsocial-video`)?{video:!0}:{};return H({...Ns(n,r),options:i},V(e))},isOwnScript:e=>Ls.test(e)}),zs=`([a-z0-9-]{1,32})`,X=`(\\d{1,20})`,Bs=/* @__PURE__ */ new Set([`www.tumblr.com`,`tumblr.com`]),Vs=/* @__PURE__ */ RegExp(`^/${zs}/${X}(?:/[^/]{1,200})?/?$`),Hs=/* @__PURE__ */ RegExp(`^${zs}\\.tumblr\\.com$`),Us=/* @__PURE__ */ RegExp(`^/post/${X}(?:/[^/]{1,200})?/?$`),Ws=/* @__PURE__ */ new Set([`dashboard`,`explore`,`tagged`,`search`,`settings`,`blog`,`www`,`assets`,`embed`,`api`,`help`]);function Gs(e){if(!e)return null;let t,n;return Bs.has(e.host)?[,t,n]=Vs.exec(e.path)??[]:([,t]=Hs.exec(e.host)??[],[,n]=Us.exec(e.path)??[]),t===void 0||n===void 0||Ws.has(t)?null:{platform:`tumblr`,kind:`post`,url:`https://www.tumblr.com/${t}/${n}`,id:n,variant:`iframe`}}const Ks={platform:`tumblr`,name:`Tumblr`,shapes:[`post iframe`],match(e){let t=Gs(e);return t&&{...t,options:{}}}},qs=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:[A-Za-z0-9_-]{1,64}|${zs})/${X}/v2$`),Js=/* @__PURE__ */ RegExp(`^/embed/post/(?:t:)?[A-Za-z0-9_-]{1,64}/${X}$`),Ys=/^(?:https?:)?\/\/(?:secure\.)?assets\.tumblr\.com\/post\.js(?:\?[^#]*)?$/,Xs=/* @__PURE__ */ R(Ks,{parse(e){if(e.tag!==`div`||!O(e,`tumblr-post`))return null;let t=F(e.attrs.get(`data-href`)??``);if(t?.host!==`embed.tumblr.com`)return null;let[,n,r]=qs.exec(t.path)??[],i=r??Js.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=Gs(F(a.attrs.get(`href`)??``));return s?.id!==i||n!==void 0&&s.url!==`https://www.tumblr.com/${n}/${i}`?null:{...s,options:{}}},isOwnScript:e=>Ys.test(e)}),Zs=/* @__PURE__ */ new Set([`twitch.tv`,`www.twitch.tv`,`m.twitch.tv`]),Qs=/^[A-Za-z0-9_]{3,25}$/,$s=/^v?(\d{1,12})$/,ec=/^[A-Za-z0-9_-]{6,30}$/,tc=/^[A-Za-z0-9_-]{6,100}$/,nc=/^(?:\d+h)?(?:\d+m)?(?:\d+s)?$/,rc=/* @__PURE__ */ new Set([`directory`,`videos`,`collections`,`settings`,`subscriptions`,`inventory`,`wallet`,`drops`,`search`,`downloads`,`jobs`,`turbo`,`p`,`login`,`signup`]);function Z(e,t){return{platform:`twitch`,kind:`video`,url:e,id:t,variant:`iframe`}}const ic=e=>Z(`https://www.twitch.tv/${e.toLowerCase()}`,e.toLowerCase()),ac=e=>Z(`https://www.twitch.tv/videos/${e}`,e),oc=e=>Z(`https://www.twitch.tv/collections/${e}`,e),sc=e=>Z(`https://clips.twitch.tv/${e}`,e);function cc(e){if(e.host===`clips.twitch.tv`){let t=e.path.replace(/^\/|\/$/g,``);return tc.test(t)?{found:sc(t),options:{}}:null}if(!Zs.has(e.host))return null;let t=e.path.replace(/^\/|\/$/g,``).split(`/`),[n=``,r,i]=t;if(t.length===2&&n===`videos`){let[,t]=$s.exec(r??``)??[];if(t===void 0)return null;let n=e.query.get(`t`);return{found:ac(t),options:n!==void 0&&nc.test(n)&&n?{time:n}:{}}}return t.length===2&&n===`collections`?ec.test(r??``)?{found:oc(r??``),options:{}}:null:t.length===3&&r===`clip`?Qs.test(n)&&tc.test(i??``)?{found:sc(i??``),options:{}}:null:t.length===1&&Qs.test(n)&&!rc.has(n.toLowerCase())?{found:ic(n),options:{}}:null}const lc={platform:`twitch`,name:`Twitch`,shapes:[`video iframe`],match(e){let t=cc(e);return t&&{...t.found,options:t.options}},ownsFrame:un},uc=[`autoplay`,`muted`,`time`];function dc(e){let t={};for(let n of uc){let r=e.get(n);r!==void 0&&(t[n]=I(r))}return t}function fc(e){let t=e.query.get(`channel`);if(t!==void 0)return Qs.test(t)?ic(t):null;let[,n]=$s.exec(e.query.get(`video`)??``)??[];if(n!==void 0)return ac(n);let r=e.query.get(`collection`);return r!==void 0&&ec.test(r)?oc(r):null}const pc=/* @__PURE__ */ R(lc,{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``);if(!t)return null;let n=null;if(t.host===`player.twitch.tv`&&/^\/?$/.test(t.path)&&(n=fc(t)),t.host===`clips.twitch.tv`&&t.path===`/embed`){let e=t.query.get(`clip`)??``;n=tc.test(e)?sc(e):null}return n&&H({...n,options:dc(t.query)},V(e))},isOwnScript:()=>!1}),mc=/* @__PURE__ */ new Set([`vimeo.com`,`www.vimeo.com`]),Q=`(\\d{1,12})`,hc=`([0-9a-f]{6,20})`,gc=[RegExp(`^/${Q}(?:/${hc})?/?$`),RegExp(`^/channels/[A-Za-z0-9_-]{1,64}/${Q}/?$`),RegExp(`^/groups/[A-Za-z0-9_-]{1,64}/videos/${Q}/?$`),RegExp(`^/showcase/\\d{1,12}/video/${Q}/?$`)],_c=/* @__PURE__ */ RegExp(`^/video/${Q}/?$`),vc=/* @__PURE__ */ new Set([`h`,`app_id`,`player_id`]),yc=/^t=(\d+(?:\.\d+)?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function bc(e,t){return{platform:`vimeo`,kind:`video`,url:`https://vimeo.com/${e}${t?`/${t}`:``}`,id:e,variant:`iframe`}}function xc(e){let[,t]=yc.exec(e.fragment??``)??[];return t?{t}:{}}function Sc(e){if(!e||!mc.has(e.host))return null;for(let t of gc){let[,n,r]=t.exec(e.path)??[];if(n!==void 0)return bc(n,r)}return null}function Cc(e){if(e?.host!==`player.vimeo.com`)return null;let[,t]=_c.exec(e.path)??[];if(t===void 0)return null;let n=e.query.get(`h`);if(n!==void 0&&!RegExp(`^${hc}$`).test(n))return null;let r=Object.fromEntries([...e.query].filter(([e])=>!vc.has(e)).map(([e,t])=>[e,I(t)]));return{...bc(t,n),options:{...r,...xc(e)}}}const wc={platform:`vimeo`,name:`Vimeo`,shapes:[`video iframe`],match(e){let t=Cc(e);if(t)return t;let n=Sc(e);return n&&{...n,options:xc(e)}},ownsFrame:dn},Tc=/^padding:\s*(\d{1,3}(?:\.\d{1,4})?)% 0 0 0;\s*position:\s*relative;?$/,Ec=/^(?:https?:)?\/\/player\.vimeo\.com\/api\/player\.js$/;function Dc(e,t){if(e?.type!==`element`||e.tag!==`a`||e.attrs.size!==1)return!1;let n=F(e.attrs.get(`href`)??``);return n!==null&&mc.has(n.host)&&t(n)&&e.children.every(e=>e.type===`text`)}function Oc(e,t){return e?.type===`text`&&e.raw.trim()===t}function kc(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&&Dc(n,e=>Sc(e)?.id===t.id)&&Oc(r,`from`)&&Dc(i,()=>!0)&&Oc(a,`on`)&&Dc(o,e=>e.path===``||e.path===`/`)&&Oc(s,`.`)}const Ac=/* @__PURE__ */ R(wc,{parse(e){let t=U(e,Tc),n=t?.iframe??e;if(n.tag!==`iframe`)return null;let r=Cc(F(n.attrs.get(`src`)??``));return r&&H(r,t?.size??V(n))},isOwnScript:e=>Ec.test(e),isOwnExtra:kc}),jc=/* @__PURE__ */ new Set([`x.com`,`www.x.com`,`mobile.x.com`,`twitter.com`,`www.twitter.com`,`mobile.twitter.com`]),Mc=/^\/([A-Za-z0-9_]{1,15})\/status\/(\d{1,20})\/?$/,Nc=/^\/(?:([A-Za-z0-9_]{1,15})|i\/web)\/status\/(\d{1,20})(?:\/(?:photo|video)\/[1-4])?\/?$/,Pc=/* @__PURE__ */ new Map([[`p`,[`lang`,`dir`]],[`a`,[`href`]],[`br`,[]]]);function Fc(e,t=Mc){if(!e||!jc.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`}}function Ic(e){return k(e).reverse().map(e=>e.tag===`a`?Fc(F(e.attrs.get(`href`)??``)):null).find(e=>e!==null)??null}function Lc(e,t){return Ic(D(e)??[])?.id===t}const Rc={platform:`x`,name:`X`,shapes:[`post sdk`],trustsFallback:(e,t)=>M(e,Pc)&&Lc(e,t.id),match(e){let t=Fc(e,Nc);return t&&{...t,options:{}}}},zc=/^(?:https?:)?\/\/platform\.(?:x|twitter)\.com\/widgets\.js$/,Bc=[[`data-theme`,`theme`],[`data-conversation`,`conversation`],[`data-cards`,`cards`],[`data-align`,`align`],[`align`,`align`],[`data-lang`,`lang`],[`data-dnt`,`dnt`],[`data-width`,`width`]],Vc=/* @__PURE__ */ R(Rc,{parse(e){if(e.tag!==`blockquote`||!(O(e,`twitter-tweet`)||O(e,`twitter-video`)))return null;let t=Ic(e.children);return t?{...t,options:B(e,Bc,I),fallbackHtml:A(e.children,Pc)}:null},isOwnScript:e=>zc.test(e)}),Hc=`https://www.youtube.com`,Uc=/^(?!videoseries|live_stream)[A-Za-z0-9_-]{11}$/,Wc=/^\/embed\/(?:(videoseries|live_stream)|([A-Za-z0-9_-]{11}))\/?$/,Gc=/^\/(shorts|live)\/((?!videoseries|live_stream)[A-Za-z0-9_-]{11})\/?$/,Kc=/^\/([A-Za-z0-9_-]{11})\/?$/,qc=/^[A-Za-z0-9_-]{10,64}$/,Jc=/^UC[A-Za-z0-9_-]{22}$/,Yc=/^\/channel\/(UC[A-Za-z0-9_-]{22})\/live\/?$/,Xc=/^(?:(\d{1,5})h)?(?:(\d{1,6})m)?(?:(\d{1,7})s?)?$/,Zc=/^t=(.+)$/;function Qc(e){if(e===void 0||e===``)return;let t=Xc.exec(e);if(!t)return;let[,n=`0`,r=`0`,i=`0`]=t;return Number(n)*3600+Number(r)*60+Number(i)}function $c(e){return Qc(e.get(`start`))??Qc(e.get(`t`))}function el(e,t){return{platform:`youtube`,kind:`video`,url:t,id:e,variant:`iframe`}}function tl(e,t=!1){return el(e,t?`${Hc}/shorts/${e}`:`${Hc}/watch?v=${e}`)}function nl(e){return e!==void 0&&qc.test(e)?el(e,`${Hc}/playlist?list=${e}`):null}function rl(e){return e!==void 0&&Jc.test(e)?el(e,`${Hc}/channel/${e}/live`):null}function il(e){let[,t,n]=Wc.exec(e.path)??[];if(n!==void 0)return{found:tl(n)};if(t===`videoseries`){let t=nl(e.query.get(`list`));return t&&{found:t,key:`list`}}if(t===`live_stream`){let t=rl(e.query.get(`channel`));return t&&{found:t,key:`channel`}}return null}function al(e,t){let n=$c(e.query)??Qc(Zc.exec(e.fragment??``)?.[1]);return{...n===void 0?{}:{start:n},...t?{nocookie:!0}:{}}}const ol=[Vc,ta,Zr,xs,Os,/* @__PURE__ */ R({platform:`youtube`,name:`YouTube`,shapes:[`video iframe`],match(e){if(e.host===`youtu.be`){let[,t]=Kc.exec(e.path)??[];return t===void 0?null:{...tl(t),options:al(e,!1)}}let t=en.has(e.host);if(!t&&!$t.has(e.host))return null;let n=al(e,t);if(z(e.path,`/embed`)){let t=il(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&&Uc.test(t)?{...tl(t),options:n}:null}if(/^\/playlist\/?$/.test(e.path)){let t=nl(e.query.get(`list`));return t&&{...t,options:n}}let[,r]=Yc.exec(e.path)??[],i=rl(r);if(i)return{...i,options:n};let[,a,o]=Gc.exec(e.path)??[];return a===void 0||o===void 0?null:{...tl(o,a===`shorts`),options:n}},ownsFrame:sn},{parse(e){if(e.tag!==`iframe`)return null;let t=F(e.attrs.get(`src`)??``),n=t!==null&&en.has(t.host);if(!t||!(n||$t.has(t.host)))return null;let r=il(t);if(!r)return null;let i=[...t.query].filter(([e])=>e!==`t`&&e!==r.key).map(([e,t])=>[e,I(t)]),a=Object.fromEntries(i),o=$c(t.query);return o!==void 0&&(a.start=o),n&&(a.nocookie=!0),H({...r.found,options:a},V(e))},isOwnScript:()=>!1}),Qo,Wa,_a,Pa,Ea,_o,Ac,pc,Mr,oo,sr,dr,ca,Ai,ps,Ho,fo,Rs,Ki,Oo,_i,wr,Xs];function sl(e){return ol.find(t=>t.platform===e)}function cl(e){return ll(ol,e)}function ll(e,t){let n=dl(t);if(!n)return null;for(let t of e){let e=t.match(n);if(e)return e}return null}function ul(e,t){let n=dl(t);return n&&e.match(n)}function dl(e){return typeof e==`string`?F(e):null}function fl(e,t){if(t.platform!==e.platform)return null;let n=ul(e,t.url);if(n?.platform!==t.platform||n.id!==t.id||n.url!==t.url||!e.shapes.includes(`${t.kind} ${t.variant}`))return null;if(t.fallbackHtml===void 0||e.trustsFallback?.(t.fallbackHtml,t))return t;let r={...t};return delete r.fallbackHtml,r}const pl={bluesky:`Bluesky`,rumble:`Rumble`};function ml(e){return`social-embeds: a ${e} URL needs a lookup: use the embed code`}function hl(e,t,n){let{platform:r,name:i}=n,a=t??(e===void 0?null:ul(n,e));if(!a&&e!==void 0&&_l(n,e))return{error:ml(i)};if(!a)return{error:`social-embeds: not a ${i} post URL: ${String(e)}`};if(a.platform!==r)return{error:`social-embeds: expected a ${i} embed, got ${a.platform}`};let o=fl(n,a);return o?{embed:o}:{error:`social-embeds: the ${i} embed's url and id do not match`}}function gl(e){if(`html`in e)return`social-embeds: unrecognised embed code`;let t=tr(e.url);return t?ml(pl[t]??t):`social-embeds: not a supported post URL: ${e.url}`}function _l(e,t){let n=typeof t==`string`?F(t):null;return n!==null&&e.needsLookup?.(n)===!0}function vl(e){return yl(ol,e)}function yl(e,t){if(typeof t!=`string`)return null;let n=D(t);return n?xl(e,n):bl(e,t)}function bl(e,t){for(let n of e){let r=n.repair?.(t),i=r==null?null:D(r),a=i&&xl(e,i);if(a?.platform===n.platform)return a}return null}function xl(e,t){let n,r,i=[],a=!1;for(let e of t)if(e.type!==`comment`){if(e.type===`text`){if(/^\s*$/.test(Pe(e.raw)))continue;return null}if(e.tag===`script`)i.push(e);else if(Sl(e))a=!0;else if(n){if(r)return null;r=e}else n=e}if(!n){let[t]=i;if(a||i.length!==1||!t||t.children.length!==0)return null;for(let n of e){let e=n.parseScript?.(t);if(e)return e}return null}for(let t of e){let e=t.parse(n);if(!e)continue;if(a&&!t.allowsFbRoot||r&&!t.isOwnExtra?.(r,e))return null;let o=i.map(e=>e.children.length===0?e.attrs.get(`src`):void 0);if(!o.every(e=>e!==void 0&&t.isOwnScript(e)))return null;let s=o.map(e=>e===void 0?{}:t.scriptOptions?.(e)??{});return{...e,options:Object.assign({},...s,e.options)}}return null}function Sl(e){return e.tag===`div`&&e.attrs.get(`id`)===`fb-root`&&e.attrs.size===1&&e.children.length===0}function Cl(e){if(e===null||e.trim()===``)return;let t=Number(e);return Number.isFinite(t)&&t>=0?t:void 0}function wl(e){return e===null?void 0:Cl(e.trim().replace(/px$/i,``))}function Tl(e){for(let t of e.children)if(t instanceof HTMLTemplateElement)return t}function El(e){let t=e.getAttribute(`eager`);return t!==null&&t!==`false`}function Dl(e,t){let n=t??e.getAttribute(`html`)??Tl(e)?.innerHTML,r=e.getAttribute(`url`),i=e.getAttribute(`width`);return{source:n===void 0?r===null?null:{url:r}:{html:n},layout:{width:Cl(i)??(i?.trim()?i:void 0),maxWidth:wl(e.getAttribute(`max-width`)),height:wl(e.getAttribute(`height`)),maxHeight:wl(e.getAttribute(`max-height`))},eager:El(e)}}const Ol=/* @__PURE__ */ new Set([`width`,`maxWidth`,`height`,`maxHeight`,`minHeight`,`borderRadius`]);function kl(e,t){e.removeAttribute(`style`),$(e,t)}function $(e,t){for(let[n,r]of Object.entries(t)){if(r===void 0)continue;let t=typeof r==`number`&&Ol.has(n)?`${String(r)}px`:String(r);e.style.setProperty(n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),t)}}function Al(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 jl(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 Ml(e){return e.style.position=`absolute`,e.style.setProperty(`inset`,`0`),e}function Nl(e,t,n){let{eager:r,placeholder:i,onLoad:a,onError:o}=n,{messageHeight:s}=t,c=document.createElement(`div`),l,u=e=>{kl(c,Ke(t,e,l))};u(n);let d=Ml(document.createElement(`div`)),f=Ml(document.createElement(`div`)),p=i.length>0?i:[t.fallbackHtml===void 0?Al():Pl(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=s?`did not report its height`:`did not load`,ee=()=>{g=setTimeout(()=>{h||(f.remove(),o(/* @__PURE__ */ Error(`social-embeds: ${t.title} ${y}`)))},15e3)},b=e=>{let n=document.createElement(`iframe`);n.src=t.clientSrc?t.clientSrc(e):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`,()=>{s||v()}),m?m.replaceWith(n):d.prepend(n),m=n},x=!1,S=()=>{if(x)return;x=!0,s&&_.push(s.listen(()=>m,e=>{l=e,$(c,{height:l}),v()}));let{sizeInSrc:e}=t;e?_.push(e.watch(d,t=>{b(e.src(t))})):b(t.src)};return r&&S(),_.push(jl(d,!1,()=>{S(),ee()})),{wrapper:c,cleanup:()=>{for(let e of _)e();clearTimeout(g),c.remove()},update(e,t){u(e),t&&S()}}}function Pl(e,t){let n=document.createElement(t?`div`:`blockquote`);return t&&(n.style.height=`100%`),n.innerHTML=e,n}const Fl=[`href`,`data-href`,`data-instgrm-permalink`,`data-text-post-permalink`];function Il(e){let t=e.querySelector(Fl.map(e=>`[${e}]`).join());for(let e of Fl){let n=t?.getAttribute(e);if(n)return n}}function Ll(e){return`View this post on ${e}`}function Rl(e){return e instanceof Error?e:Error(String(e))}function zl(e,t,n){let{driver:r,label:i}=t,{eager:a,placeholder:o,onLoad:s,onError:c}=n,l=document.createElement(`div`),u=e=>{kl(l,{width:e.width??`100%`,maxWidth:e.maxWidth??t.maxWidth})};u(n);let d=document.createElement(`div`);$(d,{width:`100%`});let f=document.createElement(`div`);f.innerHTML=t.markup,d.append(f);let p=Il(f),m=t.hasFallback?[]:o.length>0?o:[Al(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=Ll(i),h([e])}c(e)},x=(e,t)=>{g||_||(y(),y=()=>{},e>=3||t instanceof he?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,w=()=>{C||(C=!0,r.load().then(()=>{S(1)},e=>{g||b(Rl(e))}))},te=jl(f,a,w);return{wrapper:l,cleanup:()=>{g=!0,te(),clearTimeout(v),y(),l.remove()},update(e,t){u(e),t&&w()}}}const Bl=typeof HTMLElement>`u`?class{}:HTMLElement,Vl=`embed`;function Hl(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 Ul(e){let t=``;for(let n of e.children)n.slot!==Vl&&(t+=n.outerHTML);return t&&(vl(t)??Ln(t))?t:void 0}function Wl(e){let t=`html`in e?vl(e.html):cl(e.url);if(!t){let t=`html`in e?Ln(e.html):null;return t?Jn(t):{kind:`error`,message:gl(e)}}let n=sl(t.platform);if(!n)return{kind:`error`,message:gl(e)};let r=hl(void 0,t,n);return r.error===void 0?Yt(r.embed):{kind:`error`,message:r.error}}const Gl=[`html`,`url`,`width`,`maxWidth`,`height`,`maxHeight`,`eager`];var Kl=class extends Bl{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="${Vl}"></slot>`;for(let e of Gl){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 El(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===Vl&&t.remove();let t=!e||e.parentNode===this,n=Dl(this,this.#e);this.#i=n.source?void 0:t&&this.#i||Ul(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=Wl(t);if(s.kind===`error`){o(Error(s.message));return}let c={...n,eager:r,placeholder:this.#i===void 0?Hl(this):[],onLoad:()=>{a(new Event(`load`))},onError:o};this.#n=s.kind===`iframe`?Nl(this,s,c):zl(this,s,c),this.#n.wrapper.slot=Vl}};typeof customElements<`u`&&!customElements.get(`social-embed`)&&customElements.define(`social-embed`,Kl);export{Kl as SocialEmbedElement};
@@ -34,8 +34,8 @@ const FEATURES = /* @__PURE__ */ new Set([
34
34
  "web-share"
35
35
  ]);
36
36
  const HOST = "[a-z0-9-]+(?:\\.[a-z0-9-]+)*(?::\\d{1,5})?";
37
- const SRC = new RegExp(`^(?:https:)?//${HOST}(?:[/?#]|$)`, "i");
38
- const ORIGIN = new RegExp(`^(?:\\*|'self'|'src'|'none'|https://${HOST})$`, "i");
37
+ const SRC = /* @__PURE__ */ new RegExp(`^(?:https:)?//${HOST}(?:[/?#]|$)`, "i");
38
+ const ORIGIN = /* @__PURE__ */ new RegExp(`^(?:\\*|'self'|'src'|'none'|https://${HOST})$`, "i");
39
39
  const REWRITTEN_PATH = /\/\.{1,2}(?:\/|$)|\/\/|%(?:2[de]|3\d|[46][1-9a-f]|[57][\da]|5f|7e)/i;
40
40
  const ASCII_WHITESPACE = /[\t\n\f\r ]+/;
41
41
  const STYLE_SIZE = /^\s*(width|height)\s*:(.*)$/is;
@@ -4,7 +4,7 @@ import { rebuildsAs } from "../html.js";
4
4
  const DID = "(did:(?:plc:[a-z2-7]{24}|web:[a-z0-9.-]{1,253}))";
5
5
  const RKEY = "((?!\\.{1,2}(?:/|$))[A-Za-z0-9._~:-]{1,512})";
6
6
  const HOSTS = /* @__PURE__ */ new Set(["bsky.app", "www.bsky.app"]);
7
- const POST_PATH = new RegExp(`^/profile/${DID}/post/${RKEY}/?$`);
7
+ const POST_PATH = /* @__PURE__ */ new RegExp(`^/profile/${DID}/post/${RKEY}/?$`);
8
8
  const FALLBACK = /* @__PURE__ */ new Map([
9
9
  ["p", ["lang"]],
10
10
  ["a", ["href"]],
@@ -10,9 +10,9 @@ const HOSTS = /* @__PURE__ */ new Set([
10
10
  const BASE = "https://www.facebook.com";
11
11
  const NAME = "[A-Za-z0-9.\\-]{1,80}";
12
12
  const POST_ID = "(?:\\d{1,25}|pfbid[A-Za-z0-9]{10,120})";
13
- const POSTS_PATH = new RegExp(`^/(${NAME})/posts/(${POST_ID})/?$`);
14
- const PHOTOS_PATH = new RegExp(`^/(${NAME})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`);
15
- const VIDEOS_PATH = new RegExp(`^/(${NAME})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`);
13
+ const POSTS_PATH = /* @__PURE__ */ new RegExp(`^/(${NAME})/posts/(${POST_ID})/?$`);
14
+ const PHOTOS_PATH = /* @__PURE__ */ new RegExp(`^/(${NAME})/photos/([A-Za-z0-9.\\-]{1,80})/(\\d{1,25})/?$`);
15
+ const VIDEOS_PATH = /* @__PURE__ */ new RegExp(`^/(${NAME})/videos/(?:[^/]{1,200}/)?(\\d{1,25})/?$`);
16
16
  const REEL_PATH = /^\/reel\/(\d{1,25})\/?$/;
17
17
  const STORY_PATHS = /* @__PURE__ */ new Set(["/permalink.php", "/story.php"]);
18
18
  const PHOTO_PATHS = /* @__PURE__ */ new Set([
@@ -20,7 +20,7 @@ const PHOTO_PATHS = /* @__PURE__ */ new Set([
20
20
  "/photo/",
21
21
  "/photo"
22
22
  ]);
23
- const STORY_ID = new RegExp(`^${POST_ID}$`);
23
+ const STORY_ID = /* @__PURE__ */ new RegExp(`^${POST_ID}$`);
24
24
  const NUMERIC_ID = /^\d{1,25}$/;
25
25
  const PARSE_IGNORE = {
26
26
  name: "class",
@@ -3,8 +3,8 @@ import { rebuildsAs } from "../html.js";
3
3
  const HOSTS = /* @__PURE__ */ new Set(["flickr.com", "www.flickr.com"]);
4
4
  const USER = "((?!\\.{1,2}(?:/|$))[A-Za-z0-9@_.-]{1,64})";
5
5
  const ID = "(\\d{1,20})";
6
- const PHOTO_PATH = new RegExp(`^/photos/${USER}/${ID}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`);
7
- const ALBUM_PATH = new RegExp(`^/photos/${USER}/(?:albums|sets)/${ID}/?$`);
6
+ const PHOTO_PATH = /* @__PURE__ */ new RegExp(`^/photos/${USER}/${ID}(?:/in/[A-Za-z0-9_@./-]{1,200})?/?$`);
7
+ const ALBUM_PATH = /* @__PURE__ */ new RegExp(`^/photos/${USER}/(?:albums|sets)/${ID}/?$`);
8
8
  const SHORT_PATH = /^\/p\/([1-9a-km-zA-HJ-NP-Z]{1,12})$/;
9
9
  const ALPHABET = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ";
10
10
  const IMAGE_SRC = /^https:\/\/(?:live|farm\d{1,3})\.staticflickr\.com\//;
@@ -1,12 +1,12 @@
1
1
  import { GIPHY_PAGE_HOSTS, giphyFrame } from "../frames.js";
2
2
  // src/parser/matchers/giphy.ts
3
3
  const ID = "([A-Za-z0-9]{6,40})";
4
- const PAGE_PATH = new RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${ID}/?$`);
5
- const EMBED_PATH = new RegExp(`^/embed/${ID}/?$`);
4
+ const PAGE_PATH = /* @__PURE__ */ new RegExp(`^/(?:gifs|stickers)/(?:[A-Za-z0-9-]{0,200}-)?${ID}/?$`);
5
+ const EMBED_PATH = /* @__PURE__ */ new RegExp(`^/embed/${ID}/?$`);
6
6
  const MEDIA_HOST = /^(?:media\d?|i)\.giphy\.com$/;
7
7
  const FILE_TYPE = "\\.(?:gif|webp|mp4)";
8
- const MEDIA_PATH = new RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${ID}/[A-Za-z0-9_-]{1,40}${FILE_TYPE}$`);
9
- const SHORT_MEDIA_PATH = new RegExp(`^/${ID}${FILE_TYPE}$`);
8
+ const MEDIA_PATH = /* @__PURE__ */ new RegExp(`^/media/(?:v1\\.[A-Za-z0-9_-]{1,500}/)?${ID}/[A-Za-z0-9_-]{1,40}${FILE_TYPE}$`);
9
+ const SHORT_MEDIA_PATH = /* @__PURE__ */ new RegExp(`^/${ID}${FILE_TYPE}$`);
10
10
  function gif(id) {
11
11
  return {
12
12
  platform: "giphy",
@@ -6,10 +6,10 @@ const HOSTS = /* @__PURE__ */ new Set([
6
6
  "m.imgur.com"
7
7
  ]);
8
8
  const HASH = "([A-Za-z0-9]{5,7})";
9
- const ALBUM_PATH = new RegExp(`^/a/${HASH}/?$`);
10
- const GALLERY_PATH = new RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${HASH}/?$`);
11
- const IMAGE_PATH = new RegExp(`^/${HASH}/?$`);
12
- const FILE_PATH = new RegExp(`^/${HASH}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`);
9
+ const ALBUM_PATH = /* @__PURE__ */ new RegExp(`^/a/${HASH}/?$`);
10
+ const GALLERY_PATH = /* @__PURE__ */ new RegExp(`^/gallery/(?:[A-Za-z0-9-]{1,200}-)?${HASH}/?$`);
11
+ const IMAGE_PATH = /* @__PURE__ */ new RegExp(`^/${HASH}/?$`);
12
+ const FILE_PATH = /* @__PURE__ */ new RegExp(`^/${HASH}\\.(?:jpe?g|png|gif|gifv|mp4|webp)$`);
13
13
  const NOT_IMAGES = /* @__PURE__ */ new Set([
14
14
  "about",
15
15
  "apps",