!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"substack@538433c"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be89cfcd-add8-4502-a31a-d88f28b1de31",e._sentryDebugIdIdentifier="sentry-dbid-be89cfcd-add8-4502-a31a-d88f28b1de31")}catch(e){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["30149"],{24311:function(e,t,n){n.d(t,{A:()=>i});let i={input:"input-y4v6N4",textarea:"textarea-GbEjRX",autogrowing:"autogrowing-_ipn9Y",inputText:"inputText-pV_yWb",inputWithButtonWrapper:"inputWithButtonWrapper-qFTACT",primary:"primary-MUgbK6","secondary-outline":"secondary-outline-JXafwf",secondaryOutline:"secondary-outline-JXafwf",inputWithButtonInput:"inputWithButtonInput-KDznfS",start:"start-p226EZ",end:"end-LEvC6s",segmentedInputContainer:"segmentedInputContainer-BnsX3X",inputWithButtonButton:"inputWithButtonButton-SsgPne",focus:"focus-nqjos7",leading:"leading-hoxUwz",trailing:"trailing-cHz8Pv",error:"error-QSGsmD",disabled:"disabled-bZ2Wej",readOnly:"readOnly-yVYuPy",wrapper:"wrapper-JJvHsG",position_leading:"position_leading-_w7oUS",positionLeading:"position_leading-_w7oUS",size_sm:"size_sm-nn6jzC",sizeSm:"size_sm-nn6jzC",size_md:"size_md-UKpzt4",sizeMd:"size_md-UKpzt4",position_trailing:"position_trailing-kaOmCa",positionTrailing:"position_trailing-kaOmCa",unstyled:"unstyled-IJLUJU"}},84759:function(e,t,n){n.d(t,{A:()=>i});let i={imageContainer:"imageContainer-ZCdWLc",imageContainerFullHeight:"imageContainerFullHeight-hF_KGu",overlay:"overlay-SefqcL",image:"image-MSZo7W",downloadButton:"downloadButton-lyp4Aa",loading:"loading-BBOJtl",link:"link-D8bzcd"}},22857:function(e,t,n){n.d(t,{q:()=>a});var i=n(4006),r=n(10996);let a=e=>{let{children:t,disable:n}=e;return n?(0,i.Y)(i.FK,{children:t}):(0,i.Y)(r.NP,{theme:"light-theme",children:t})}},37110:function(e,t,n){n.d(t,{LY:()=>h,NK:()=>c,Xd:()=>f,j5:()=>p});var i=n(4006),r=n(12215),a=n(17402),o=n(85478),l=n(46271),d=n(68349),s=n(91392),u=n(39318);let c=s.FI.CHATBOT_TERMS_LAST_ACCEPTED_AT,p=3650,m=(0,a.createContext)(void 0);function h(e){let{children:t,enabled:n=!0}=e,[r,s]=(0,a.useState)(!1),[c,p]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),w=(0,l.ur)(),y=(0,o.mJ)(),[b,_]=(0,a.useState)(g(w));return(0,a.useEffect)(()=>{_(g(w))},[w]),(0,a.useEffect)(()=>{if(!n||"undefined"==typeof window)return;let e=()=>{window.duet&&(window.duet.hide(),window.duet.setEventListener(e=>{"DUET_INITIALIZE"===e.eventName?s(!0):"DUET_DEINITIALIZE"===e.eventName&&s(!1)}),p(!0))};if(window.duet)e();else{let t=setInterval(()=>{window.duet&&(e(),clearInterval(t))},100),n=setTimeout(()=>{clearInterval(t)},1e4);return()=>{clearInterval(t),clearTimeout(n)}}},[n]),(0,i.Y)(m.Provider,{value:{isTermsModalOpen:h,setTermsModalOpen:f,hasAcceptedTerms:b,setHasAcceptedTerms:_,handleSupportClick:()=>{y.getConfigFor("enable_decagon_chat")?b?r?window.duet&&c&&(window.duet.close(),s(!1)):window.duet&&c&&(window.duet.open(),s(!0)):f(!0):(0,d.V2)((0,u.RPh)(),{newTab:!0})}},children:t})}function f(){let e=(0,a.useContext)(m);if(void 0===e)throw Error("useDecagon must be used within a DecagonProvider");return e}function g(e){var t;return!!(e.user&&(null==(t=e.userSettings)?void 0:t.chatbotTermsLastAcceptedAt)||r.get(c))}},3117:function(e,t,n){n.d(t,{u:()=>w});var i=n(4006),r=n(12215),a=n(17402),o=n(37110),l=n(84605),d=n(46271),s=n(94729),u=n(35369),c=n(60322),p=n(76977),m=n(28911),h=n(84843),f=n(63136),g=n(39318);function w(){let[e,t]=(0,a.useState)(!1),{isTermsModalOpen:n,setTermsModalOpen:w,setHasAcceptedTerms:y}=(0,o.Xd)(),b=(0,d.ur)(),{iString:_}=(0,l.GO)(),v=()=>{w(!1)},C=async()=>{r.set(o.NK,new Date().toJSON(),{expires:o.j5}),b.user&&await (0,s.x6)("/api/v1/user-setting",{method:"PUT",json:{type:"chatbot_terms_last_accepted_at",value_datetime:new Date().toISOString()}}),y(!0),v()};return(0,i.FD)(m.aF,{isOpen:n,onClose:v,width:480,children:[(0,i.Y)(m.rQ,{icon:(0,i.Y)(h.Ud,{}),onClose:v,title:_("Terms & conditions"),showDivider:!0,alignItems:"center",description:(0,i.Y)(i.FK,{children:(0,i.FD)(f.EY,{translated:!0,children:["In order to use the Substack chatbot, please first review the"," ",(0,i.Y)(f.Yq,{href:"".concat((0,g.Ewe)(),"/chatbot-tos"),decoration:"underline",target:"_blank",children:I18N.p("Terms & Conditions")}),"."]})})}),(0,i.Y)(m.cw,{children:(0,i.FD)(p.ov,{gap:12,children:[(0,i.Y)(c.S,{autoFocus:!0,size:"sm",onChange:()=>t(!e),checked:e}),(0,i.Y)(f.EY.B4,{translated:!0,children:"I have read, understood, and agree to the Terms & Conditions."})]})}),(0,i.Y)(m.jl,{showDivider:!0,direction:"column",primaryButton:(0,i.Y)(u.$n,{priority:"primary",onClick:C,disabled:!e,children:_("Continue")})})]})}},56381:function(e,t,n){n.d(t,{k:()=>f});var i=n(4006),r=n(17402),a=n(37110),o=n(3117),l=n(8337),d=n(97405),s=n(84605),u=n(89490),c=n(35369);function p(e){let{onClick:t,priority:n="secondary"}=e,{iString:r}=(0,s.GO)();return(0,i.Y)(u.az,{className:"background-QydabK",position:"fixed",children:(0,i.Y)(c.$n,{priority:n,onClick:t,leading:(0,i.Y)(d.A,{size:20}),shadow:"md",children:r("primary"===n?"Ask a question":"Help")})})}var m=n(85478);class h extends r.Component{componentDidCatch(e,t){console.error(e)}render(){return this.props.children}}function f(e){let{hideButton:t=!1,priority:n="secondary"}=e,r=(0,m.mJ)();return(0,i.Y)(h,{children:(0,i.Y)(a.LY,{enabled:!!r.getConfigFor("enable_decagon_chat"),children:(0,i.Y)(g,{hideButton:t,priority:n})})})}function g(e){let{hideButton:t,priority:n}=e,{hasAcceptedTerms:r,handleSupportClick:d}=(0,a.Xd)();return(0,i.Y)(h,{children:r?(0,i.FD)(i.FK,{children:[(0,i.Y)(l.E,{}),!t&&(0,i.Y)(p,{onClick:d,priority:n})]}):(0,i.FD)(i.FK,{children:[(0,i.Y)(o.u,{}),!t&&(0,i.Y)(p,{onClick:d,priority:n})]})})}},80520:function(e,t,n){n.d(t,{N:()=>w});var i=n(4006),r=n(46110),a=n(17402),o=n(22857),l=n(84605),d=n(27749),s=n(2675),u=n(75840),c=n(35369),p=n(76977),m=n(28911),h=n(63136),f=n(504),g=n(44307);function w(e){let{item:t,pub:n,post:o}=e,[d,s]=(0,a.useState)(!1),{iString:u}=(0,l.GO)();return(0,i.FD)(i.FK,{children:[(0,i.Y)(c.K0,{priority:"quaternary",size:"sm",className:g.A.moreButton,onClick:()=>s(!0),children:(0,i.Y)(r.A,{size:16})}),(0,i.FD)(m.aF,{isOpen:d,onClose:()=>s(!1),width:440,children:[(0,i.Y)(m.rQ,{icon:(0,i.Y)(r.A,{size:20}),title:u("Auto-generated clip"),onClose:()=>s(!1)}),(0,i.Y)(m.cw,{children:(0,i.Y)(p.I1,{gap:16,children:(0,i.Y)(h.EY.B3,{children:u("Substack automatically selected this clip for you from the full video below.")})})}),(0,i.Y)(m.jl,{primaryButton:(0,i.Y)(y,{item:t,pub:n,post:o,onClose:()=>s(!1)}),secondaryButton:(0,i.Y)(c.$n,{priority:"secondary",onClick:()=>s(!1),children:u("Done")})})]})]})}let y=e=>{let{item:t,pub:n,post:r,onClose:p}=e,{iString:m}=(0,l.GO)(),h=(0,s.vZ)({post:r,publication:n}),g=(0,d.PK)(),w=(0,a.useContext)(u.P);return(0,i.Y)(o.q,{children:(0,i.Y)(c.$n,{priority:"primary",onClick:e=>{(0,f.Qb)(t,g,"watch_full_episode",{tabId:w}),h(e),p()},children:m("View Full Episode")})})}},74049:function(e,t,n){n.d(t,{P:()=>h,k:()=>m});var i=n(4006),r=n(7350),a=n.n(r),o=n(17402),l=n(15734),d=n.n(l),s=n(84605),u=n(86500),c=n(36372),p=n(57324);let m=e=>{let t=(0,c.d)(),{iString:n}=(0,s.GO)(),[r,l]=(0,o.useState)(0),m=a()(e=>{l(e)},100),h=(0,o.useCallback)(async()=>{var t,n;let i,r,a=!e.live_stream_id||(null==(t=e.liveStream)?void 0:t.is_rtmp)?"original":"mp4",o="/api/v1/video/upload/".concat(e.id,"/src.json?type=").concat(a),{body:{src:s}}=await d().get(o),c=await fetch(s),h=null==(n=c.body)?void 0:n.getReader(),f=c.headers.get("Content-Length");if(!h||!f)throw Error("Failed to read the response body or content length is missing.");let g=parseInt(f),w=0,y=[];do{let e=await h.read();i=e.done,(r=e.value)&&(y.push(r),m((w+=r.length)/g*100))}while(!i);let b=new Blob(y),_=window.URL.createObjectURL(b),v=document.createElement("a");v.href=_,v.download="undefined"!==e.name&&e.name?e.name:"original.webm",v.target="_blank",v.rel="noopener noreferrer",v.style.display="none",document.body.appendChild(v),v.click(),document.body.removeChild(v),(0,u.u4)(u.qY.VIDEO_CLIP_DOWNLOAD_BUTTON_CLICKED,{name:"download",post_id:e.post_id,utm_campaign:p._9.substackClips,utm_medium:p.Jn.web,media_upload_id:e.id}),setTimeout(()=>l(0),200)},[e]);return{startDownload:()=>{l(0),h(),t.popToast(()=>(0,i.Y)(c.y,{text:n("Download started, do not close the window until download is completed")}))},downloadPercentage:r}},h=async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"original",i="/api/v1/video/upload/".concat(e.id,"/src.json?type=").concat(n),{body:{src:r},status:a}=await d().get(i);if(a>=400){let e="there was an error generating the pre-signed url of the original source";throw console.warn(e),Error(e)}let o=await fetch(r);if(o.status>=400){let e="there was an error downloading the original source";throw console.warn(e),Error(e)}let l=await o.blob(),s=window.URL.createObjectURL(l),c=document.createElement("a");c.href=s,c.download=t?"".concat(t,".mp4"):"".concat(e.name),c.target="_blank",c.rel="noopener noreferrer",c.style.display="none",document.body.appendChild(c),c.click(),document.body.removeChild(c),(0,u.u4)(u.qY.VIDEO_CLIP_DOWNLOAD_BUTTON_CLICKED,{name:"download",post_id:e.post_id,utm_campaign:p._9.substackClips,utm_medium:p.Jn.web,media_upload_id:e.id})}},95641:function(e,t,n){n.d(t,{E:()=>d});var i=n(69277),r=n(32641),a=n(15734),o=n.n(a),l=n(12501);function d(e){var{auto:t,initialResult:n,deps:a}=e,d=(0,r._)(e,["auto","initialResult","deps"]);return(0,l.qK)(async e=>{var{signal:t}=e,n=(0,r._)(e,["signal"]);let{pathname:a="",query:l,body:s,method:u="get"}=(0,i._)({},d,n),c=o()(u.toUpperCase(),a);l&&c.query(l),s&&c.send(s),t.addEventListener("abort",()=>{c.abort()});let p=await c;if(t.aborted)return;let m=p.error;if(m)throw m;return p.body},a||[],{auto:t,initialResult:n})}},38093:function(e,t,n){n.d(t,{Q:()=>y,Z:()=>w});var i=n(69277),r=n(4006),a=n(32485),o=n.n(a),l=n(42216),d=n(17402),s=n(84605),u=n(94729),c=n(89490),p=n(8149),m=n(76977),h=n(20500),f=n(63136),g=n(24311);function w(e){let{email:t,redirect:n,forPub:a,islandMagicSignin:o,onIsAttemptingLoginChange:s}=e,[c,m]=(0,d.useState)(""),[h,f]=(0,d.useState)(!1),[g,w]=(0,d.useState)(!1),[y,Y]=(0,d.useState)(!1),I=async()=>{f(!0),s&&s(!0);try{let[e]=await Promise.all([(0,u.x6)("/api/v1/email-otp-login/complete",{method:"POST",json:{code:c,email:t,redirect:n,for_pub:a,island_magic_signin:o}}),new Promise(e=>setTimeout(e,250))]);window.location.href=e.redirect}catch(e){e instanceof u.fk&&"login_guard_challenge"===e.body.type&&Y(!0),f(!1),s&&s(!1),w(!0),m("")}};return t?(0,r.FD)(v,{children:[(0,r.Y)(l.wE,{autoFocus:!0,maxLength:6,pattern:l.UO,onChange:e=>{m(e),e.length&&w(!1)},onComplete:I,value:c,render:e=>{let{slots:t}=e;return(0,r.Y)(C,{children:t.map((e,t)=>(0,r.Y)(b,(0,i._)({disabled:h},e),t))})}}),(0,r.Y)(p.N,{open:!!g,children:(0,r.Y)(_,{suspiciousLogin:y})})]}):null}function y(e){let{onComplete:t,error:n,isLoading:a}=e,[o,u]=(0,d.useState)(""),{iString:c}=(0,s.GO)();return(0,r.FD)(v,{children:[(0,r.Y)(l.wE,{autoFocus:!0,maxLength:6,pattern:l.UO,onChange:e=>{u(e)},onComplete:e=>{a||t(e)},value:o,disabled:a,render:e=>{let{slots:t}=e;return(0,r.Y)(C,{children:t.map((e,t)=>(0,r.Y)(b,(0,i._)({disabled:a},e),t))})}}),n&&(0,r.Y)(h.yn,{style:{textAlign:"center"},children:c("You entered an incorrect code. Please try again.")})]})}function b(e){let{char:t,isActive:n,disabled:i}=e;return(0,r.Y)(m.fI,{justifyContent:"center",alignItems:"center",width:36,height:40,className:o()(g.A.input,n&&g.A.focus,i&&g.A.disabled),children:(0,r.Y)(f.EY.B2,{textAlign:"center",children:t||""})})}function _(e){let{suspiciousLogin:t}=e,{iString:n}=(0,s.GO)(),i=n(t?"Please check your email for instructions to complete signing in.":"You entered an incorrect code. Please try again.");return(0,r.Y)(h.yn,{style:{textAlign:"center"},children:i})}let v=(0,c.I4)({display:"flex",direction:"column",alignItems:"center",gap:8}),C=(0,c.I4)({display:"flex",direction:"row",justifyContent:"center",alignItems:"center",gap:8})},87834:function(e,t,n){n.d(t,{c:()=>s});var i=n(69277),r=n(32641),a=n(4006),o=n(32485),l=n.n(o),d=n(76977);function s(e){var{className:t,padding:n=20}=e,o=(0,r._)(e,["className","padding"]);return(0,a.Y)(d.VP,(0,i._)({overflow:"auto",padding:n,className:l()("body-r_n7KA",t),"data-modal-role":"body"},o))}},40659:function(e,t,n){n.d(t,{Fg:()=>g,HM:()=>h,cf:()=>u,l:()=>c,rG:()=>w});var i=n(4006),r=n(17402);n(25006);var a=n(17186),o=n(49807),l=n(82776);n(84985);let d="session_attribution";function s(e){try{(0,a.X3)(d,e)}catch(e){console.error("cannot set attribution data",e)}}function u(){let e;try{var t;e=null!=(t=(0,a.xm)(d))?t:{}}catch(e){return{}}return(0,l.extractAttributionDataFromRecord)(e)}function c(){if("undefined"!=typeof window&&"undefined"!=typeof document){if(null==window.location)return;let e={href:window.location.href,referrer:document.referrer,timestamp:+new Date};window.location.hostname===o.sXh.hostname&&function(e){let t=(0,a.xm)(d);if(null==t)s({sessionStart:e.timestamp,originalReferrer:e.referrer,landingPage:e.href,landingSurface:p(e.href),landingSurfaceId:m(e.href),landingPublicationId:e.publicationId,visits:[e]});else{var n,i;let r,a=+new Date;(null==(n=t.visits)?void 0:n.length)===0&&(r=!0),(null==t||null==(i=t.visits)?void 0:i.length)>0&&a-t.visits[0].timestamp>=9e5&&(r=!0),(null==e.referrer||""==e.referrer)&&(r=!0),e.timestamp-t.sessionStart<700&&null==t.landingPublicationId&&null!=e.publicationId&&(r=!0),s({sessionStart:r?e.timestamp:t.sessionStart,originalReferrer:r?e.referrer:t.originalReferrer,landingPage:r?e.href:t.landingPage,landingSurface:r?p(e.href):t.landingSurface,landingSurfaceId:r?m(e.href):t.landingSurfaceId,landingPublicationId:r?e.publicationId:t.landingPublicationId,visits:[e,...t.visits].slice(0,20)})}}(e)}}let p=e=>{let t=new URL((0,o.Ewe)()).hostname;if(null==e)return"feed";let n=new URL(e);return t!==n.hostname?"publisher":n.pathname.startsWith("/chat/")?"chat":e.includes("/note/c-")?"note":e.includes("/post/p-")||n.pathname.startsWith("/p/")||n.pathname.startsWith("/inbox/post/")?"post":e.includes("/profile")||n.pathname.startsWith("/@")?"profile":void 0},m=e=>{if(null==e)return;let t=e.match(/\/[a-z]-(\w+)$/i);return t?t[1]:void 0},h=(0,r.createContext)({iframeRef:null,getSessionAttribution:()=>({}),isDefaultValue:!0,frameReady:!1,setFrameReady:()=>{},attributionParams:null,setAttributionParams:()=>{}}),f=()=>(0,r.useContext)(h),g=e=>{let t,{children:n}=e,a=f(),[o,l]=(0,r.useState)(!1),d=(0,r.useRef)(null),[s,c]=(0,r.useState)(null);return t=a.isDefaultValue?{iframeRef:d,getSessionAttribution:()=>null!=s?s:u(),isDefaultValue:!1,frameReady:o,setFrameReady:()=>l(!0),attributionParams:s,setAttributionParams:c}:{iframeRef:a.iframeRef,getSessionAttribution:a.getSessionAttribution,isDefaultValue:!1,frameReady:a.frameReady,setFrameReady:a.setFrameReady,attributionParams:a.attributionParams,setAttributionParams:a.setAttributionParams},(0,i.Y)(h.Provider,{value:t,children:n})};function w(){let{attributionParams:e}=f();return null!=e?e:{}}}}]);