!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@d7c8e0e"};var n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e751c504-00f1-4947-bdc6-c4581ed7c66a",e._sentryDebugIdIdentifier="sentry-dbid-e751c504-00f1-4947-bdc6-c4581ed7c66a")}catch(e){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["62311"],{86972:function(e,n,t){t.d(n,{A:()=>i});let i={referralsTierCard:"referralsTierCard-XI8dRc"}},43327:function(e,n,t){t.d(n,{hx:()=>x,vV:()=>F});var i=t(69277),r=t(70408),l=t(4006),a=t(32485),o=t.n(a),d=t(45773),s=t(17402),c=t(12018),u=t(86938),h=t(74019),p=t(33764),m=t(41873),b=t(84605),f=t(85478),y=t(15113),Y=t(6049),g=t(12501),v=t(68349),w=t(89490),_=t(76977),k=t(57820),C=t(45974),A=t(63136),D=t(39318),E=t(20004);function I(e){let{postId:n,fallbackSizeLgProps:t}=e,{iString:a}=(0,b.GO)(),[c,u]=(0,s.useState)(!1),{result:h,isLoading:p}=(0,g.st)({pathname:"/api/v1/posts/by-id/".concat(n),deps:[n],auto:!0});if(p)return(0,l.Y)(_.pT,{alignItems:"center",bg:"tertiary",className:E.A.videoEmbedPlaceholder,justifyContent:"center",radius:"md",children:(0,l.Y)(k.y$,{flex:"grow"})});let f=null==h?void 0:h.post,Y=null==h?void 0:h.publication,I=null==f?void 0:f.videoUpload;if(!f||!Y||!I)return console.warn("VideoPostEmbed: missing data, falling back to legacy render"),(0,l.Y)(F,(0,r._)((0,i._)({},t),{forceLegacyRender:!0}));let x=f.canonical_url,S=e=>{e.stopPropagation(),e.preventDefault(),(0,v.lW)(x),u(!0),setTimeout(()=>u(!1),3e3)};return(0,l.Y)(w.az,{className:E.A.videoEmbed,position:"relative",children:(0,l.Y)(m.A,{mediaUpload:I,post:f,pub:Y,renderOverlay:e=>{var n;let{isPlaying:t,getCurrentTimeInSeconds:i}=e;return(0,l.FD)(_.Ye,{className:o()(E.A.videoOverlay,{[null!=(n=E.A.alwaysVisible)?n:""]:!t}),justifyContent:"space-between",padding:16,pointerEvents:"auto",position:"absolute",top:0,children:[(0,l.FD)(_.Ye,{alignItems:"center",flex:"grow",gap:12,paddingRight:12,children:[(0,l.Y)(C.Nq,{pub:Y,radius:"full",size:32}),(0,l.Y)("a",{className:E.A.titleLink,href:x,rel:"noopener",target:"_blank",onClick:()=>{let e=i(),n=(0,D.oRR)(x,{t:e});(0,v.V2)(n,{newTab:!0})},children:(0,l.Y)(A.EY,{clamp:2,color:"white",decoration:"hover-underline",weight:"medium",children:f.title})})]}),(0,l.FD)(_.I1,{alignItems:"end",gap:0,hover:!0,position:"relative",onClick:S,children:[(0,l.Y)(w.az,{paddingRight:16,children:c?(0,l.Y)(d.A,{stroke:"white"}):(0,l.Y)(y.qY,{stroke:"white"})}),(0,l.Y)(A.EY,{color:"white",size:14,wrap:"nowrap",children:c?a("Copied to clipboard"):a("Copy link")})]})]})},stopPropagation:!0})})}let F=e=>{var n,t,i;let{disableLinks:r,isEditingCaption:a,post:d,caption:s,onEditCaption:m,onSaveCaption:b,onCancelCaption:y,forceLegacyRender:Y}=e,{publishedBylines:g,title:v,canonical_url:k,post_date:C,section_name:D,cover_image:F,cover_image_alt:x}=d,{getConfigFor:S}=(0,f.mJ)();return!Y&&S("use_enhanced_video_embed_player")?(0,l.Y)(I,{fallbackSizeLgProps:e,postId:d.id}):(0,l.FD)(_.I1,{children:[D&&(0,l.Y)("a",{className:o()({[null!=(n=E.A.disableLink)?n:""]:r}),href:k,rel:"noopener",target:"_blank",children:(0,l.Y)(A.EY.Meta,{color:"pub-primary-text",paddingBottom:8,children:D})}),(0,l.Y)("a",{className:o()({[null!=(t=E.A.disableLink)?t:""]:r}),href:k,rel:"noopener",target:"_blank",children:(0,l.Y)(A.EY.H2,{color:"pub-primary-text",children:v})}),(0,l.Y)(h.W,{bylines:g,date:C,disableLinks:r}),F&&(0,l.Y)(w.az,{paddingTop:24,children:(0,l.Y)("a",{className:o()({[null!=(i=E.A.disableLink)?i:""]:r}),href:k,rel:"noopener",target:"_blank",children:(0,l.Y)(p.o,{alt:null!=x?x:v,className:E.A.fullWidth,imageProps:{height:Math.round(650),smartCrop:!0},maxWidth:1300,src:F})})}),(0,l.Y)(_.pT,{flex:"grow",paddingTop:16,children:a&&b&&y?(0,l.Y)(c.y,{initialCaption:s,onCancel:y,onSave:b}):(0,l.Y)("p",{className:E.A.caption,dangerouslySetInnerHTML:{__html:s},onClick:m||void 0})}),(0,l.Y)(u.w,{disableLinks:r,href:k,includeUfi:!1,post:d})]})},x=e=>{let{post:n,children:t}=e,{publishedBylines:i,title:r,canonical_url:a,post_date:o,section_name:d,cover_image:s,cover_image_alt:c}=n;return(0,l.FD)(Y.jJ,{children:[d&&(0,l.Y)("a",{href:a,children:(0,l.Y)(A.EY.Meta,{color:"pub-primary-text",paddingBottom:8,children:d})}),(0,l.Y)("a",{href:a,children:(0,l.Y)(A.EY.H2,{color:"pub-primary-text",children:r})}),(0,l.Y)(h._,{bylines:i,date:o}),s&&(0,l.Y)(w.az,{paddingTop:24,children:(0,l.Y)("a",{href:a,children:(0,l.Y)(p.o,{alt:null!=c?c:r,className:E.A.fullWidth,imageProps:{height:Math.round(650),smartCrop:!0},maxWidth:1300,src:s})})}),(0,l.Y)("a",{href:a,children:(0,l.Y)(w.az,{as:"p",children:t})}),(0,l.Y)(u.s,{href:a})]})}},55376:function(e,n,t){t.d(n,{wI:()=>T});var i=t(79785),r=t(4006),l=t(418),a=t(16079),o=t(17402),d=t(15734),s=t.n(d),c=t(84605),u=t(92538),h=t(5646),p=t(12387),m=t(24078),b=t(89490),f=t(35369),y=t(76977),Y=t(20500),g=t(16993),v=t(84843),w=t(57820),_=t(94996),k=t(81929),C=t(63136),A=t(16291);function D(){let e=(0,i._)(["Ban or suspend ",""]);return D=function(){return e},e}function E(){let e=(0,i._)(["Prevent this person from commenting on your publication in the future."]);return E=function(){return e},e}function I(){let e=(0,i._)(["Ban ",""]);return I=function(){return e},e}function F(){let e=(0,i._)(["Previously banned "," time(s), last on ",""]);return F=function(){return e},e}function x(){let e=(0,i._)([""," is permanently banned."]);return x=function(){return e},e}function S(){let e=(0,i._)([""," is banned until ","."]);return S=function(){return e},e}let T=e=>{var n,t,i,l;let{comment:a,onReply:d,onBan:s,onClose:c}=e,{sub:h,loading:p,bans:m,bansHistory:b,error:f,submitBan:y}=R(a,s),Y=(0,u.n)(),v=null==(n=Y[1])?void 0:n[0],[w,_]=(0,o.useState)(v),[k,C]=(0,o.useState)("visible"),D=!!a||p,E=null!=(l=null==(i=Y.find(e=>{let[n]=e;return n===w}))||null==(t=i[1])?void 0:t.toLowerCase())?l:"",I=m.filter(e=>(0,A.A)(e.expiry).isAfter((0,A.A)()));return(0,r.FD)(g.aF,{isOpen:D,onClose:c,children:[0===I.length&&(0,r.Y)(P,{comment:a,sub:h,bans:m,bansHistory:b,loading:p,error:f,selectedExpiry:w,setSelectedExpiry:_,selectedCommentVisibility:k,setSelectedCommentVisibility:C,expiryText:E,onClose:c,submitBan:y}),I.length>0&&(0,r.Y)(B,{comment:a,bans:m,onClose:c,onReply:()=>{d&&a&&(d(a.id),c())}})]})},P=e=>{var n,t;let{comment:i,sub:l,bans:a,bansHistory:o,loading:d,error:s,selectedExpiry:p,setSelectedExpiry:b,selectedCommentVisibility:v,setSelectedCommentVisibility:A,expiryText:F,onClose:x,submitBan:S}=e,{iString:T,iTemplate:P}=(0,c.GO)(),B=(0,u.n)(),R=(0,h.T)();return(0,r.FD)(r.FK,{children:[(0,r.Y)(g.rQ,{onClose:x,title:P(D(),null!=(n=null==i?void 0:i.name)?n:"user"),showDivider:!0,alignItems:"center",icon:(0,r.Y)(m.eu,{photoUrl:null!=(t=null==i?void 0:i.photo_url)?t:void 0,size:56}),description:(0,r.FD)(y.VP,{alignItems:"center",gap:8,children:[(null==l?void 0:l.is_subscribed)&&(0,r.Y)(k.vw,{priority:"secondary",children:T("Paid subscriber")}),(0,r.Y)(C.EY,{children:P(E())})]})}),(0,r.Y)(g.cw,{children:(0,r.FD)(y.VP,{gap:20,children:[(0,r.Y)(N,{bans:a,bansHistory:o}),s&&(0,r.Y)(Y.yn,{children:T("An error occurred. Please try again.")}),d&&(0,r.Y)(w.y$,{padding:32,alignItems:"center",justifyContent:"center"}),!d&&(0,r.FD)(r.FK,{children:[(0,r.FD)(L,{children:[(0,r.Y)(C.EY.B3,{weight:"semibold",children:T("Ban duration")}),(0,r.FD)(_.I,{name:"expiry",value:p,onChange:e=>{b(e.target.value)},children:[(0,r.Y)(_.K,{children:T("Select a duration")}),B.map(e=>{let[n,t]=e;return(0,r.Y)("option",{value:n,children:null==t?void 0:t.replace(/^For /,"")})})]})]}),(0,r.FD)(L,{children:[(0,r.Y)(C.EY.B3,{weight:"semibold",children:T("Delete comments")}),(0,r.FD)(_.I,{name:"comment_visibility",value:v,onChange:e=>{A(e.target.value)},children:[(0,r.Y)(_.K,{children:T("Select whether to delete comments")}),R.map(e=>{let[n,t]=e;return(0,r.Y)("option",{value:n,children:t})})]})]})]})]})}),(0,r.Y)(g.jl,{direction:"column",showDivider:!0,primaryButton:(0,r.Y)(f.$n,{priority:"destructive",onClick:()=>S(p,v),children:P(I(),F)})})]})},L=(0,b.I4)({display:"flex",justifyContent:"space-between",alignItems:"center"}),N=e=>{let{bans:n,bansHistory:t}=e,{iTemplate:i}=(0,c.GO)();if(!n[0])return null;let a=t.length?t.length:n.filter(e=>e.user_id).length;return(0,r.Y)(p.F,{title:i(F(),a,(0,A.A)(n[0].start).standardDatetimeWithYear()),Icon:l.A})},B=e=>{var n,t;let{comment:i,bans:l,onClose:o,onReply:d}=e,{iString:s,iTemplate:u}=(0,c.GO)(),h=l.find(e=>e.user_id),p=h&&(0,A.A)(h.expiry).isAfter((0,A.A)().add(100,"years"))?u(x(),null!=(n=null==i?void 0:i.name)?n:"This user"):u(S(),null!=(t=null==i?void 0:i.name)?t:"This user",(0,A.A)(null==h?void 0:h.expiry).standardDatetimeWithYear());return h?(0,r.FD)(r.FK,{children:[(0,r.Y)(g.rQ,{title:p,alignItems:"center",icon:(0,r.Y)(v.qx,{icon:(0,r.Y)(a.A,{})}),onClose:o,description:s("We recommend leaving a reply to tell them why they are banned, and to let other readers know what kinds of comments are not acceptable.")}),(0,r.Y)(g.q1,{}),(0,r.Y)(g.jl,{direction:"column",primaryButton:(0,r.Y)(f.$n,{priority:"primary-mono",onClick:d,children:s("Leave a reply")})})]}):null},R=(e,n)=>{let[t,i]=(0,o.useState)(null),[r,l]=(0,o.useState)(!1),[a,d]=(0,o.useState)([]),[c,u]=(0,o.useState)([]),[h,p]=(0,o.useState)(null),m=async(t,i)=>{l(!0);try{var r;if(!e)throw Error("comment undefined, cannot submitBan");let o=await s().post("/api/v1/comment_ban/".concat(e.id)).send({user_id:e.user_id,expiry:t,commentVisibility:i});"visible"!==i&&document.location.reload(),(r=o.body.bans).forEach(e=>{-1==r.findIndex(n=>n.id===e.id)&&r.push(e)}),d(r),l(!1),n&&n(e,a)}catch(e){console.error("Failed to submit ban",e),p(!0)}l(!1)};return(0,o.useEffect)(()=>{(async()=>{if(e){l(!0),d([]),u([]),p(null),i(null);try{var n;let[t,r]=await Promise.all([s().get("/api/v1/user/".concat(e.user_id,"/bans")),s().get("/api/v1/moderation/publications/".concat(e.publication_id,"/users/").concat(e.user_id,"/bans")).query({type:"comment",limit:20})]),l=t.body;d(l.bans),i(l.sub),u(null!=(n=r.body.data)?n:[])}catch(e){console.error("Failed to get bans:",e),p(!0)}l(!1)}})()},[e]),{sub:t,loading:r,bans:a,bansHistory:c,error:h,submitBan:m,setLoading:l,setError:p}}},90554:function(e,n,t){t.d(n,{y:()=>r});var i=t(17402);function r(e){let{name:n,action:t}=e;(0,i.useEffect)(()=>{if("undefined"==typeof window)return;let e=new URL(window.location.href);if(e.searchParams.get("action")===n){t();let n=e.searchParams;n.delete("action"),window.history.replaceState({},"","".concat(e.origin).concat(e.pathname,"?").concat(n))}},[])}}}]);