"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["5053"],{33451:function(e,t,r){r.d(t,{A7:()=>N,Gt:()=>R,Ii:()=>A,KV:()=>x,P9:()=>I,aE:()=>X,bO:()=>z,pc:()=>k,xj:()=>B,xk:()=>W});var i=r(7409),a=r(99282),n=r(98848),o=r(16584),l=r(94184),c=r.n(l),s=r(48403),d=r.n(s);r(39693);var u=r(56687),m=r(99869);r(93974);var h=r(39535);r(3880),r(79094);var g=r(20888);r(19548),r(95441),r(77906),r(48980),r(94874);var f=r(80026);r(44424);var Z=r(10510),p=r(63474);r(91021),r(70379),r(1669);var b=r(55533);r(16913),r(69304),r(93502),r(32223),r(97842),r(11308);var v=r(36889);r(76820),r(98012),r(60308);var w=r(63651),y=r(77859);function x(e){var t;let{user:r}=e;return(0,o.tZ)(f.xu,{paddingX:12,children:(0,o.tZ)(f.xv.B4,{as:"a",color:"secondary",decoration:"hover-underline",href:(0,w.NNq)(r,{noBase:!0}),target:"_blank",children:null!==(t=r.name)&&void 0!==t?t:"Substack user"})})}let k=(0,f.zo)({className:y.Z.messageBubbleGroup,position:"relative",gap:2},p.sg);function X(e){let{direction:t,isLink:r,backgroundColor:i,isAuthorContributor:a}=e,n="incoming"===t&&a,l="".concat(i,"1A");return(0,o.BX)("svg",{viewBox:"0 0 16 13",className:c()(y.Z.bubbs,y.Z[t],r&&y.Z.isLink,a&&y.Z.author),style:n?{fill:l}:{},children:[(0,o.tZ)("circle",{cx:"5",cy:"5",r:"5",className:y.Z.bubb}),(0,o.tZ)("circle",{cx:"13.5",cy:"10.5",r:"2.5",className:y.Z.bubb}),n&&(0,o.BX)(o.HY,{children:[(0,o.tZ)("circle",{cx:"5",cy:"5",r:"5",fill:l}),(0,o.tZ)("circle",{cx:"13.5",cy:"10.5",r:"2.5",fill:l})]})]})}function B(e){var{messageDirection:t,isFirst:r=!1,isLast:l=!1,forceTheme:s,pubThemeAccentColor:u,isAuthorContributor:m,className:h}=e,g=(0,n._)(e,["messageDirection","isFirst","isLast","forceTheme","pubThemeAccentColor","isAuthorContributor","className"]);let Z="incoming"===t&&m,p=Z&&u;return(0,o.tZ)(f.X2,(0,a._)((0,i._)({},g),{className:c()(y.Z.bubble,y.Z[t],r&&y.Z.isFirst,l&&y.Z.isLast,s&&y.Z["force".concat(d()(s),"Theme")],Z&&y.Z.author,h),style:{"--color-chat-author-bg-overlay":p?"".concat(u,"1A"):"rgba(var(--color-bg-accent-themed-rgb), 0.1)"}}))}function W(e){let{metadata:t,publication:r,direction:i,isFirst:a,isLast:n}=e,l=I(t.url);return l?(0,o.tZ)(B,{messageDirection:i,isFirst:a,isLast:n,maxWidth:400,forceTheme:"incoming",outline:"detail",children:(0,o.tZ)(L,{videoId:l})}):(0,o.tZ)(B,{as:"a",href:t.url,target:"_blank",rel:"nofollow noopener ugc",messageDirection:i,isFirst:a,isLast:n,maxWidth:400,forceTheme:"incoming",outline:"detail",children:!function(e){let{metadata:t}=e;if(!t.image)return!1;let r=(0,w.zJH)(t.image);return!!r&&(r.width<401||r.height<401)}({metadata:t})?(0,o.tZ)(C,{publication:r,metadata:t}):(0,o.tZ)(z,{metadata:t})})}function I(e){try{let t=new URL(e);if("youtube.com"===t.hostname||"www.youtube.com"===t.hostname){let e=t.searchParams.get("v");if("/watch"===t.pathname&&e)return e}else if("youtu.be"===t.hostname){let e=t.pathname.slice(1);if(e)return e}}catch(e){console.error("Error parsing URL:",e)}return null}function N(e){try{var t,r;let i=new URL(e);if(i.pathname.startsWith("/player/v1/"))return null!==(t=i.pathname.split("/").pop())&&void 0!==t?t:null;if(i.pathname.includes("/video/")){let e=i.pathname.split("/"),t=e.indexOf("video")+1;if(t