!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@c1df24e"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="685f7733-dc18-4a82-94c3-a1d99d4271fd",e._sentryDebugIdIdentifier="sentry-dbid-685f7733-dc18-4a82-94c3-a1d99d4271fd")}catch(e){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["36725"],{55376:function(e,t,n){n.d(t,{wI:()=>P});var r=n(79785),l=n(4006),i=n(418),o=n(16079),a=n(17402),c=n(15734),u=n.n(c),s=n(84605),d=n(92538),m=n(5646),f=n(12387),h=n(24078),p=n(89490),y=n(35369),b=n(76977),v=n(20500),w=n(16993),g=n(84843),Y=n(57820),_=n(94996),k=n(81929),x=n(63136),D=n(16291);function E(){let e=(0,r._)(["Ban or suspend ",""]);return E=function(){return e},e}function F(){let e=(0,r._)(["Prevent this person from commenting on your publication in the future."]);return F=function(){return e},e}function C(){let e=(0,r._)(["Ban ",""]);return C=function(){return e},e}function I(){let e=(0,r._)(["Previously banned "," time(s), last on ",""]);return I=function(){return e},e}function S(){let e=(0,r._)([""," is permanently banned."]);return S=function(){return e},e}function A(){let e=(0,r._)([""," is banned until ","."]);return A=function(){return e},e}let P=e=>{var t,n,r,i;let{comment:o,onReply:c,onBan:u,onClose:s}=e,{sub:m,loading:f,bans:h,bansHistory:p,error:y,submitBan:b}=R(o,u),v=(0,d.n)(),g=null==(t=v[1])?void 0:t[0],[Y,_]=(0,a.useState)(g),[k,x]=(0,a.useState)("visible"),E=!!o||f,F=null!=(i=null==(r=v.find(e=>{let[t]=e;return t===Y}))||null==(n=r[1])?void 0:n.toLowerCase())?i:"",C=h.filter(e=>(0,D.A)(e.expiry).isAfter((0,D.A)()));return(0,l.FD)(w.aF,{isOpen:E,onClose:s,children:[0===C.length&&(0,l.Y)(B,{comment:o,sub:m,bans:h,bansHistory:p,loading:f,error:y,selectedExpiry:Y,setSelectedExpiry:_,selectedCommentVisibility:k,setSelectedCommentVisibility:x,expiryText:F,onClose:s,submitBan:b}),C.length>0&&(0,l.Y)(U,{comment:o,bans:h,onClose:s,onReply:()=>{c&&o&&(c(o.id),s())}})]})},B=e=>{var t,n;let{comment:r,sub:i,bans:o,bansHistory:a,loading:c,error:u,selectedExpiry:f,setSelectedExpiry:p,selectedCommentVisibility:g,setSelectedCommentVisibility:D,expiryText:I,onClose:S,submitBan:A}=e,{iString:P,iTemplate:B}=(0,s.GO)(),U=(0,d.n)(),R=(0,m.T)();return(0,l.FD)(l.FK,{children:[(0,l.Y)(w.rQ,{onClose:S,title:B(E(),null!=(t=null==r?void 0:r.name)?t:"user"),showDivider:!0,alignItems:"center",icon:(0,l.Y)(h.eu,{photoUrl:null!=(n=null==r?void 0:r.photo_url)?n:void 0,size:56}),description:(0,l.FD)(b.VP,{alignItems:"center",gap:8,children:[(null==i?void 0:i.is_subscribed)&&(0,l.Y)(k.vw,{priority:"secondary",children:P("Paid subscriber")}),(0,l.Y)(x.EY,{children:B(F())})]})}),(0,l.Y)(w.cw,{children:(0,l.FD)(b.VP,{gap:20,children:[(0,l.Y)($,{bans:o,bansHistory:a}),u&&(0,l.Y)(v.yn,{children:P("An error occurred. Please try again.")}),c&&(0,l.Y)(Y.y$,{padding:32,alignItems:"center",justifyContent:"center"}),!c&&(0,l.FD)(l.FK,{children:[(0,l.FD)(T,{children:[(0,l.Y)(x.EY.B3,{weight:"semibold",children:P("Ban duration")}),(0,l.FD)(_.I,{name:"expiry",value:f,onChange:e=>{p(e.target.value)},children:[(0,l.Y)(_.K,{children:P("Select a duration")}),U.map(e=>{let[t,n]=e;return(0,l.Y)("option",{value:t,children:null==n?void 0:n.replace(/^For /,"")})})]})]}),(0,l.FD)(T,{children:[(0,l.Y)(x.EY.B3,{weight:"semibold",children:P("Delete comments")}),(0,l.FD)(_.I,{name:"comment_visibility",value:g,onChange:e=>{D(e.target.value)},children:[(0,l.Y)(_.K,{children:P("Select whether to delete comments")}),R.map(e=>{let[t,n]=e;return(0,l.Y)("option",{value:t,children:n})})]})]})]})]})}),(0,l.Y)(w.jl,{direction:"column",showDivider:!0,primaryButton:(0,l.Y)(y.$n,{priority:"destructive",onClick:()=>A(f,g),children:B(C(),I)})})]})},T=(0,p.I4)({display:"flex",justifyContent:"space-between",alignItems:"center"}),$=e=>{let{bans:t,bansHistory:n}=e,{iTemplate:r}=(0,s.GO)();if(!t[0])return null;let o=n.length?n.length:t.filter(e=>e.user_id).length;return(0,l.Y)(f.F,{title:r(I(),o,(0,D.A)(t[0].start).standardDatetimeWithYear()),Icon:i.A})},U=e=>{var t,n;let{comment:r,bans:i,onClose:a,onReply:c}=e,{iString:u,iTemplate:d}=(0,s.GO)(),m=i.find(e=>e.user_id),f=m&&(0,D.A)(m.expiry).isAfter((0,D.A)().add(100,"years"))?d(S(),null!=(t=null==r?void 0:r.name)?t:"This user"):d(A(),null!=(n=null==r?void 0:r.name)?n:"This user",(0,D.A)(null==m?void 0:m.expiry).standardDatetimeWithYear());return m?(0,l.FD)(l.FK,{children:[(0,l.Y)(w.rQ,{title:f,alignItems:"center",icon:(0,l.Y)(g.qx,{icon:(0,l.Y)(o.A,{})}),onClose:a,description:u("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,l.Y)(w.q1,{}),(0,l.Y)(w.jl,{direction:"column",primaryButton:(0,l.Y)(y.$n,{priority:"primary-mono",onClick:c,children:u("Leave a reply")})})]}):null},R=(e,t)=>{let[n,r]=(0,a.useState)(null),[l,i]=(0,a.useState)(!1),[o,c]=(0,a.useState)([]),[s,d]=(0,a.useState)([]),[m,f]=(0,a.useState)(null),h=async(n,r)=>{i(!0);try{var l;if(!e)throw Error("comment undefined, cannot submitBan");let a=await u().post("/api/v1/comment_ban/".concat(e.id)).send({user_id:e.user_id,expiry:n,commentVisibility:r});"visible"!==r&&document.location.reload(),(l=a.body.bans).forEach(e=>{-1==l.findIndex(t=>t.id===e.id)&&l.push(e)}),c(l),i(!1),t&&t(e,o)}catch(e){console.error("Failed to submit ban",e),f(!0)}i(!1)};return(0,a.useEffect)(()=>{(async()=>{if(e){i(!0),c([]),d([]),f(null),r(null);try{var t;let[n,l]=await Promise.all([u().get("/api/v1/user/".concat(e.user_id,"/bans")),u().get("/api/v1/moderation/publications/".concat(e.publication_id,"/users/").concat(e.user_id,"/bans")).query({type:"comment",limit:20})]),i=n.body;c(i.bans),r(i.sub),d(null!=(t=l.body.data)?t:[])}catch(e){console.error("Failed to get bans:",e),f(!0)}i(!1)}})()},[e]),{sub:n,loading:l,bans:o,bansHistory:s,error:m,submitBan:h,setLoading:i,setError:f}}},90554:function(e,t,n){n.d(t,{y:()=>l});var r=n(17402);function l(e){let{name:t,action:n}=e;(0,r.useEffect)(()=>{if("undefined"==typeof window)return;let e=new URL(window.location.href);if(e.searchParams.get("action")===t){n();let t=e.searchParams;t.delete("action"),window.history.replaceState({},"","".concat(e.origin).concat(e.pathname,"?").concat(t))}},[])}},46754:function(e,t,n){n.d(t,{QE:()=>c,RP:()=>s,m:()=>u});var r=n(39318);let l=/^.*(https?:\/\/(?:www\.)?polymarket\.com\/event\/([^/\s?]+)(?:\/([^/\s?]+))?).*$/,i=/^.*(https?:\/\/(?:www\.)?polymarket\.com\/market\/([^/\s?]+)).*$/,o=/^.*(https?:\/\/(?:www\.)?polymarket\.com\/sports\/(?:[^/\s?]+\/)*([^/\s?]+)).*$/,a=/^.*(https?:\/\/(?:www\.)?polymarket\.com\/@([^/\s?]+)).*$/,c=e=>{var t,n,r,c;let u=l.exec(e);if(u)return null!=(t=u[1])?t:null;let s=i.exec(e);if(s)return null!=(n=s[1])?n:null;let d=o.exec(e);if(d)return null!=(r=d[1])?r:null;let m=a.exec(e);return m&&null!=(c=m[1])?c:null},u=e=>null!==c(e),s=e=>{if(!e)return null;let t="true"===new URL(e,"https://polymarket.com").searchParams.get("graphMode"),n=l.exec(e);if(n&&n[2]){let e=n[2],r=n[3]||void 0;return{eventSlug:e,marketSlug:r,isGraphMode:t,fullEmbedUrl:d(e,r,t)}}let r=i.exec(e);if(r&&r[2]){let e=r[2];return{eventSlug:e,marketSlug:void 0,isGraphMode:t,fullEmbedUrl:d(e,void 0,t)}}let c=o.exec(e);if(c&&c[2]){let e=c[2];return{eventSlug:e,marketSlug:void 0,isGraphMode:t,fullEmbedUrl:d(e,void 0,t)}}let u=a.exec(e);if(u&&u[2]){let e=u[2];return{profileName:e,isGraphMode:!1,fullEmbedUrl:m(e)}}return null},d=(e,t,n)=>{let l="".concat((0,r.$_T)(),"/embed/polymarket/").concat(e).concat(t?"/".concat(t):"");return n?"".concat(l,"?graphMode=true"):l},m=e=>"".concat((0,r.$_T)(),"/embed/polymarket/profile/").concat(e)}}]);