!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]="1f22e923-9226-48e0-9f56-750909ab0c23",e._sentryDebugIdIdentifier="sentry-dbid-1f22e923-9226-48e0-9f56-750909ab0c23")}catch(e){}}();"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["61325"],{62716:function(e,t,n){n.r(t),n.d(t,{LegacyLatexComponent:()=>D,TipTapEditLatexModal:()=>A});var r=n(4006),l=n(99595),o=n(31386),i=n(32485),a=n.n(i),s=n(38221),c=n.n(s),d=n(81922),u=n(98188),p=n(17402),f=n(84605),m=n(56909),h=n(86500),g=n(68349),v=n(35369),y=n(97515),b=n(76977),w=n(28911),k=n(63136),_=n(11587),x=n(90292),E=n(33398);let A=e=>{let{isOpen:t,onClose:n,persistentExpression:l,node:i}=e,[a,s]=(0,p.useState)(l),{iString:u}=(0,f.GO)(),[g]=(0,p.useState)(()=>c()(s,1e3));return(0,p.useEffect)(()=>{s(l)},[l]),(0,r.Y)(x.q,{children:(0,r.FD)(w.aF,{isOpen:t,onClose:n,"data-test-id":"latex-modal",children:[(0,r.Y)(w.rQ,{onClose:n,title:u("Add LaTeX")}),(0,r.Y)(w.cw,{children:(0,r.FD)(b.VP,{gap:20,children:[(0,r.Y)(_.T,{"data-test-id":"latex-input",rows:6,maxLength:1e3,value:a,name:"expression",onChange:e=>{g(e.currentTarget.value)}}),a?(0,r.Y)(b.ov,{height:160,border:"detail",shadow:"xs",radius:"sm",children:(0,r.Y)(o.A,{typesettingOptions:{fn:"tex2chtml",options:void 0},text:"".concat(a),renderMode:"pre",inline:!1,dynamic:!0})}):(0,r.Y)(b.ov,{height:160,border:"detail",radius:"sm",borderStyle:"dashed",children:(0,r.Y)(y.p,{flex:"grow",icon:(0,r.Y)(d.A,{}),title:u("Add LaTeX equations above to see preview"),description:(0,r.Y)(k.Yq,{href:"https://www.latex-project.org/help/documentation/",target:"_blank",children:u("Learn more")})})})]})}),(0,r.Y)(w.jl,{showDivider:!1,direction:"row",primaryButton:(0,r.Y)(v.$n,{"data-test-id":"latex-save",priority:"primary",onClick:()=>{(0,h.u4)(h.qY.LATEX_BLOCK_ADDED,{expression:a}),(0,m.o)().dispatchEvent(new CustomEvent("close",{detail:{persistentExpression:a,node:i}})),n()},children:u("Save")}),secondaryButton:(0,r.Y)(v.$n,{"data-test-id":"latex-cancel",priority:"secondary",onClick:()=>{(0,m.o)().dispatchEvent(new CustomEvent("close",{detail:{persistentExpression:l,node:i}})),a!==l&&s(l),n()},children:u("Cancel")})})]})})},D=e=>{let{node:t,id:n}=e,{iString:i}=(0,f.GO)(),[s,c]=(0,p.useState)(t.attrs.persistentExpression);return(0,p.useEffect)(()=>{c(t.attrs.persistentExpression)},[t]),(0,p.useEffect)(()=>{let e=e=>{let{detail:n}=e;n.node.attrs.id===t.attrs.id&&c(n.persistentExpression)};return(0,m.o)().addEventListener("close",e),()=>{(0,m.o)().removeEventListener("close",e)}},[t]),(0,r.Y)(l.VR,{"data-drag-handle":"",children:(0,r.Y)(x.q,{children:(0,r.Y)("div",{className:"latex-block",id:n,children:(0,r.Y)(b.I1,{className:a()(E.A.latexWrapper,t.attrs.persistentExpression||(0,g.rr)()?E.A.emptyStateWrapper:null),radius:"md","data-attrs":JSON.stringify({persistentExpression:s,id:t.attrs.id}),onClick:()=>{s!==t.attrs.persistentExpression&&c(t.attrs.persistentExpression),(0,m.o)().dispatchEvent(new CustomEvent("open",{detail:{persistentExpression:t.attrs.persistentExpression,node:t}}))},children:(0,r.FD)(b.Ye,{paddingY:8,paddingX:16,flex:"grow",justifyContent:"center",alignItems:"center",children:[s||t.attrs.persistentExpression?(0,r.Y)(b.I1,{alignItems:"center",justifyContent:"center",children:(0,r.Y)(o.A,{typesettingOptions:{fn:"tex2chtml",options:void 0},text:"".concat(s||t.attrs.persistentExpression),renderMode:"pre",inline:!1,dynamic:!0})}):(0,r.Y)(b.I1,{alignSelf:"center",children:(0,r.Y)(k.EY.Meta,{fontStyle:"italic",translated:!0,color:"secondary",children:"Edit & enter LaTeX expressions here"})}),(0,r.Y)(b.I1,{children:(0,r.Y)(v.$n,{"aria-label":i("Edit LaTeX"),className:E.A.latexEdit,priority:"secondary",size:"sm",children:(0,r.Y)(u.A,{width:20,height:20})})})]})})})})})}},9472:function(e,t,n){n.d(t,{g:()=>l});var r=n(4006);let l=e=>(0,r.Y)("div",{className:"file-embed-wrapper-editor",children:(0,r.Y)("div",{className:"file-embed-aligner",children:(0,r.Y)("div",{className:"file-embed-container placeholder",children:(0,r.Y)(o,{})})})}),o=()=>(0,r.FD)("div",{className:"embed-loader-container",children:[(0,r.Y)("div",{className:"embed-loader"}),(0,r.Y)("div",{className:"embed-loader-text",children:"Loading..."})]})},90827:function(e,t,n){n.d(t,{P:()=>u,X:()=>d});var r=n(69277),l=n(70408),o=n(32641),i=n(4006),a=n(17402),s=n(35369),c=n(66511);let d=(0,a.forwardRef)((e,t)=>{var{onClick:n,children:a,disabled:c=!1,size:d="md"}=e,u=(0,o._)(e,["onClick","children","disabled","size"]);return(0,i.Y)(s.mZ,(0,l._)((0,r._)({},u),{ref:t,rounded:!0,onClick:n,disabled:c,size:d,children:a}))}),u=e=>{let{label:t,children:n}=e;return(0,i.Y)(c.m_,{text:null!=t?t:"",side:"left",disabled:!t,children:n})}},37575:function(e,t,n){n.d(t,{H2:()=>B,_R:()=>I});var r=n(69277),l=n(86500);n(68349);var o=n(98111),i=n(46754),a=n(82776),s=n(38474),c=n(26116),d=n(39729),u=n(42985),p=n(79431),f=n(45595),m=n(70679),h=n(97966),g=n(70084),v=n(37859),y=n(31611);n(86508);var b=n(17768),w=n(82979),k=n(58097),_=n(30131),x=n(41298),E=n(60440),A=n(41758),D=n(75594),S=n(84262),C=n(14304),T=n(13625);n(33333);var O=n(39248),L=n(60147);let N=async(e,t)=>{var n;if(!e)throw Error("No URL provided");return"undefined"!=typeof window&&(null==(n=window._preloads.siteConfigs)?void 0:n.enable_polymarket_post_embeds)&&(0,i.QE)(e)?(0,E.hI)(e,t):(0,A.i1)(e,t)},M=[[y.NT,y.h$],[_.FR,_.yJ],[T.hq,T.GW],[b.Ys,b.VM],[L.NO,L.Sw],[O.ou,O.zd],[S.mc,S.Xs],[f.RD,f.oM],[p.Bp,p.so],[u.XB,u.w1],[D.AF,D.d1],[c.ez,c.lQ],[w.Rj,w.gE],[v.SU,v.Z7],[h.iO,h.Xs],[g.oI,g.t2],[s.q_,s.TM],[k.Hh,k.Wc],[m.t7,m.eZ],[x.sF,x.DI],[e=>{var t;if(!e)return null;if("undefined"!=typeof window&&(null==(t=window._preloads.siteConfigs)?void 0:t.enable_polymarket_post_embeds)){let t=(0,i.QE)(e);if(t)return t}return(0,A.J7)(e)},N],[function(){for(var e=arguments.length,t=Array(e),n=0;ne===o.T.FIRST_NOTE_EMBED,u.x7]],I=(e,t,n)=>{if(t.nodes.augmentation_placeholder)for(let[l]of M){let o=l(e,(0,r._)({customSchema:t},n));if(o){let e=t.nodes.augmentation_placeholder.create({request_id:(0,a.randomString)(),url:o});return[o,e]}}return[null,null]},B=async(e,t,n,o)=>{let i,a,{request_id:s,url:c}=e.attrs;try{for(let[t,a]of M)if(t(e.attrs.url,(0,r._)({customSchema:n},o))&&((0,l.u4)(l.qY.EMBED_URL_ATTEMPTED,{url:c,source:"paste"}),i=await a(c,{customSchema:n}),(0,l.u4)(l.qY.EMBED_URL_SUCCEEDED,{url:c,source:"paste"}),i))break}catch(t){(0,l.u4)(l.qY.EMBED_URL_FAILED,{url:c,source:"paste"}),console.error("Failed to process augmentation placeholder:",e.attrs,t),400<=t.status&&t.status<600&&(a=t)}if(a){let r=(0,T.hq)(e.attrs.url);if(setTimeout(()=>{z(s,t,n,(e,t,l)=>{r&&n.marks.link&&e.replaceRangeWith(t,t+l.nodeSize,n.text(l.attrs.url,[n.marks.link.create({title:l.attrs.url,href:l.attrs.url})])),e.delete(t,t+l.nodeSize)})},0),!r)throw a}else i?setTimeout(()=>{z(s,t,n,(e,t,n)=>{i&&e.setNodeMarkup(t,i.type,i.attrs,n.marks)})},0):setTimeout(()=>{z(s,t,n,(e,t,r)=>{e.replaceRangeWith(t,t+r.nodeSize,n.text(r.attrs.url))})},0)},z=(e,t,n,r)=>{let l=!1,o=t.state.tr;return t.state.doc.descendants((t,i)=>{t.type===n.nodes.augmentation_placeholder&&t.attrs.request_id===e&&!1!==r(o,i,t)&&(l=!0)}),l&&t.dispatch(o),l}},35974:function(e,t,n){n.d(t,{c:()=>l});var r=n(87166);"undefined"!=typeof navigator&&/Mac/.test(navigator.platform);let l=e=>(t,n,l)=>{if(n){var o,i,a;if(!e.marks.link)return console.warn("link mark not found in schema"),!1;(0,r.S)(e.marks.link,{scrollParent:".editor-scroll",language:"undefined"!=typeof window?null==(a=window)||null==(i=a._preloads)||null==(o=i.publication)?void 0:o.language:void 0}).spec.run(t,n,l)}return!0}},32526:function(e,t,n){n.d(t,{A_:()=>p,Lz:()=>s,PN:()=>f,Rh:()=>h,cz:()=>v,dG:()=>g,yb:()=>m});var r=n(99851),l=n(43712),o=n(86500),i=n(68349),a=n(39318);class s extends l.Dr{static fromMenuItem(e,t){let{spec:n}=e;return new s(n,t)}constructor(e,t){super(e);const n=this.spec.run;this.spec.run=(e,r,l,i)=>((0,o.u4)(o.qY.EDITOR_MENU_ICON_CLICKED,{button:t||this.spec.label||this.spec.title}),n.call(this,e,r,l,i))}}let c="ProseMirror-prompt",d="".concat(c,"-visible");class u{read(e){return e.value}validate(e){return(e=this.clean(e))||!this.options.required?this.options.validate&&this.options.validate(e):"Required field"}clean(e){return this.options.clean?this.options.clean(e):e}constructor(e){(0,r._)(this,"options",void 0),this.options=e}}class p extends u{render(){let e=document.createElement("input");return e.type="text",e.placeholder=this.options.label,e.value=this.options.value||"",e.className=this.options.className||"",e.autocomplete="off",e}}class f extends p{constructor(e,t,n="en"){const{iString:r}=I18N.i(n);super({label:r("Enter URL..."),className:"url-input",value:t||e&&e.mark.attrs.href||"",required:!0,clean:e=>{let t;return e?(t=e.trim()).startsWith("http")||t.startsWith("mailto")||/^%%.*%%$/.test(t)?t:"http://".concat(t):""},validate:e=>{if(!/^%%.*%%$/.test(e)){if(e.startsWith("".concat((0,a.$_T)(),"/publish/post/"))&&alert(r("This is a link to a post draft. Readers will not be able to access this page.")),e.length>1900)return r("Link is too long");try{let t=new URL(e);if(["http:","https:","mailto:"].includes(t.protocol))return}catch(e){}return e.startsWith("http")?r("Invalid URL"):r("Invalid URL. Try using http://")}}})}}function m(e,t){let{from:n,$from:r,to:l,empty:o}=e.selection;return o?!!t.isInSet(e.storedMarks||r.marks()):e.doc.rangeHasMark(n,l,t)}function h(e){if(g(e))return;let{iString:t}=I18N.i(e.language||"en"),n="".concat(c,"-").concat(e.parentClass),r=e.root||document.body,l=e.scrollParent&&document.querySelector&&document.querySelector(e.scrollParent)||function e(t){return null==t?null:t.scrollHeight>t.clientHeight?t:e(t.parentElement)}(r)||window,o=r.appendChild(document.createElement("div"));o.classList.add(c),e.className&&o.classList.add(e.className),o.id=n,(0,i.iQ)(document.body,d);let a=e=>{o.contains(e.target)||p()},s=()=>{if(e.position)e.position(o,f);else{var t,n;let r=e.parentClass&&(null==(t=(n=document).querySelector)?void 0:t.call(n,".".concat(e.parentClass)));if(r){let t=r.getBoundingClientRect();o.style.top="".concat(t.bottom+(e.offsetTop||0),"px"),o.style.left="".concat(t.left+(e.offsetLeft||0),"px")}else{let t=o.getBoundingClientRect();o.style.top="".concat((window.innerHeight-t.height)/2+(e.offsetTop||0),"px"),o.style.left="".concat((window.innerWidth-t.width)/2+(e.offsetLeft||0),"px")}}},u=t=>{var n;t&&t.preventDefault();let r=function(e,t){let n={},r=0;for(let l in e){let o=e[l],i=t[r++];if(!o){console.warn("field missing for name",l);continue}let a=o.read(i),s=o.validate(a);if(s){if(!i){console.warn("missing domField, cannot reportInvalid");continue}return function(e,t){let n=e.parentNode;if(!n)return;let r=n.appendChild(document.createElement("div"));r.style.left="".concat(e.offsetLeft+e.offsetWidth+2,"px"),r.style.top="".concat(e.offsetTop-5,"px"),r.className="ProseMirror-invalid",r.textContent=t,setTimeout(()=>n.removeChild(r),1500)}(i,s),null}n[l]=o.clean(a)}return n}(null!=(n=e.fields)?n:{},m);r&&p(r)},p=t=>{(0,i.vy)(document.body,d),window.removeEventListener("mousedown",a),window.removeEventListener("resize",s,!1),l.removeEventListener("scroll",s,!1),o.parentNode&&o.parentNode.removeChild(o),t?(e.onSubmit&&e.onSubmit(t),e.callback&&e.callback(t)):e.onCancel&&e.onCancel(),e.onClose&&e.onClose()};setTimeout(()=>window.addEventListener("mousedown",a),50),window.addEventListener("resize",s,!1),l.addEventListener("scroll",s,!1);let f=o.appendChild(document.createElement("span"));f.className="head";let m=[],h=0;for(let t in e.fields){var v;h++;let n=null==(v=e.fields[t])?void 0:v.render();if(!n){console.warn("missing field for name",t);continue}n.tabIndex=h,m.push(n)}let y=o.appendChild(document.createElement("form"));if(e.title&&(y.appendChild(document.createElement("h5")).textContent=e.title),m.forEach(e=>{y.appendChild(document.createElement("div")).appendChild(e)}),!e.no_buttons){let n=document.createElement("button");n.type="submit",n.className="".concat(c,"-submit"),n.textContent=e.submitText||"OK",n.addEventListener("click",u);let r=document.createElement("button");r.type="button",r.className="".concat(c,"-cancel"),r.textContent=t("Cancel"),r.addEventListener("click",()=>p());let l=y.appendChild(document.createElement("div"));l.className="".concat(c,"-buttons"),l.appendChild(n),l.appendChild(document.createTextNode(" ")),l.appendChild(r)}if(e.footer&&y.appendChild(e.footer),e.openseaEmbedFooter&&y.appendChild(e.openseaEmbedFooter),s(),y.addEventListener("submit",u),e.onInput&&y.addEventListener("input",t=>{var n;null==(n=e.onInput)||n.call(e,t,o)}),y.addEventListener("keydown",e=>{if(27==e.keyCode)e.preventDefault(),p();else if(13!=e.keyCode||e.ctrlKey||e.metaKey||e.shiftKey){if(9==e.keyCode&&(window.setTimeout(()=>{o.contains(document.activeElement)||p()},500),m.length>1)){for(let r=0;r0){let e=y.elements[0];for(let t of Array.from(y.elements))if(!t.value&&["INPUT","TEXTAREA"].includes(t.nodeName)){e=t;break}e.focus()}}function g(e){let t="".concat(c,"-").concat(e.parentClass),n=document.getElementById(t);if(n){let e;if(n.querySelector&&(e=n.querySelector(".".concat(c,"-cancel"))),e)e.click();else{var r;null==(r=n.parentNode)||r.removeChild(n),(0,i.vy)(document.body,d)}return!0}}function v(e,t){let n=e.selection.$from;for(let e=n.depth;e>=0;e--){let r=n.index(e);if(n.node(e).canReplaceWith(r,r,t))return!0}return!1}},56909:function(e,t,n){n.d(t,{o:()=>r}),n(4006),n(17402),n(62716);let r=()=>{if(window)return window.LatexModalEvent||(window.LatexModalEvent=new EventTarget),window.LatexModalEvent}},84810:function(e,t,n){n.d(t,{L:()=>a});var r=n(69277),l=n(70408),o=n(17402),i=n(73484);let a=()=>{let{initialTab:e,isDrawerOpen:t,setInitialTab:n,setIsDrawerOpen:a,setPreventChange:s}=(0,i.gJ)(),c=(0,o.useCallback)(e=>{a((0,l._)((0,r._)({},e),{drawerId:"podcast"}))},[a]);return{initialTab:e,isPodcastDrawerOpen:t("podcast"),setInitialTab:n,setIsPodcastDrawerOpen:c,setPreventChange:e=>s({preventChange:e,preventChangeMessage:"Please wait until the upload is finished before closing the drawer"})}}},9129:function(e,t,n){n.d(t,{e4:()=>r}),n(68349);let r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAY4AAAB0BAMAAABgVMiEAAAAMFBMVEX////7+/vt7e3o6Ojm5ubn5+fu7u709PTs7Oz39/f19fX29vby8vLx8fHz8/Pw8PCxY+A8AAAAoklEQVR4AWJgVHYZ+sBIgEE0vXzog7JAhrZZq4Y+WJnB4A5o5w5oAAYBGAi6mcKpQgIaClhCBklz7+AM/Gjo5+Dg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODgeO7g4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4OD4Zse3dmVXfIST0/B1vh0UtMKbNF7rAAAAAElFTkSuQmCC"},45378:function(e,t,n){n.d(t,{i:()=>r});async function r(e,t){let{editImage:r}=await Promise.all([n.e("40397"),n.e("67363")]).then(n.bind(n,57998));return r(e,t)}},47885:function(e,t,n){n.d(t,{Y:()=>a});var r=n(4006),l=n(76977),o=n(63136),i=n(82776);let a=e=>{let{duration:t,icon:n,position:a="bottom-left",previewDuration:s}=e;return(0,r.FD)(l.Ye,{alignItems:"center",bg:"glass-inverted-medium",gap:6,paddingX:8,paddingY:2,position:"absolute",radius:"sm",style:"bottom-left"===a?{left:8,bottom:8}:{right:8,bottom:8},children:[n,(0,r.Y)(o.EY.Meta,{color:"white",lineHeight:20,children:s?"".concat((0,i.secondsToHHMMSS)(s)," / ").concat((0,i.secondsToHHMMSS)(null!=t?t:0)):(0,i.secondsToHHMMSS)(null!=t?t:0)})]})}},8037:function(e,t,n){let r;n.d(t,{Rq:()=>o,T_:()=>c,f9:()=>a,iW:()=>d,mw:()=>s,qy:()=>i});var l=n(82776);n.e("27578").then(n.t.bind(n,86049,19)).then(e=>{r=e.default});let o={"application/x-cbr":[[82,97,114,33,26,7,0],[82,97,114,33,26,7,1,0],[127,69,76,70]],"application/x-cbz":[[80,75,3,4],[80,75,5,6],[80,75,7,8]]},i={"application/vnd.amazon.kfx":[[75,70,88,32]],"application/vnd.amazon.kpf":[[80,75,3,4]],"application/epub+zip":[[80,75,3,4]],"application/x-mobipocket-ebook":[[77,79,66,73]]},a={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[[80,75,3,4],[80,75,5,6],[80,75,7,8]]},s={"application/pdf":[[37,80,68,70]]};function c(e){let{mimeTypesToSignature:t,substackType:n,actionButtonAttr:r}=e;return[{tag:"div.file-embed-wrapper",getAttrs:e=>{let o={};try{var i,a,s;let[c,d,u]=e.children[0].children;if(!c)return!1;let[p,f]=c.children;if(!f||!p)return!1;let[m,h]=f.children;if(!h)return!1;o.title=null==m?void 0:m.textContent;let[g,v]=(null==(i=h.textContent)?void 0:i.split("∙"))||[];if(!g||!v)return!1;o.filesize=(0,l.formattedBytesToNumber)(g);let y=null==(s=v.split("File"))||null==(a=s[0])?void 0:a.trim().toLowerCase();if(!y)return!1;if(t[y]||n===y)o.filetype=y;else{if("file"!==n)return!1;o.filetype=y}return(null==p?void 0:p.classList.contains("file-embed-thumbnail-default"))||(o.thumbnail=p.getAttribute("src")||""),o.description=null==d?void 0:d.innerText,o[r]=null==u?void 0:u.getAttribute("href"),o}catch(e){return!1}}}]}function d(e){var t;let{attrs:n}=e;return"".concat((0,l.numberToHumanFileSize)(null!=(t=Number(n.filesize))?t:void 0)," ∙ ").concat(function(e){var t,n,l,o;let{filetype:i}=e;return r&&i?["application/vnd.amazon.kfx","application/vnd.amazon.kpf","application/vnd.amazon.ebook"].includes(i)?"Kindle":null!=(o=null==(n=r.extension(i)||(null==(l=i.split("/").pop())?void 0:l.split("-").pop()))||null==(t=n.toUpperCase)?void 0:t.call(n))?o:"":""}({filetype:n.filetype})," file")}},86508:function(e,t,n){n.r(t),n.d(t,{EMPTY_DOC:()=>t_,HEADER_IMAGE_ATTRS_FROM_NODE_TYPE:()=>tx,addIdsToHeaders:()=>tX,checkForUnpublishableComments:()=>nr,checkForUnsafeLinks:()=>nl,createStringDoc:()=>nc,customMediaNodes:()=>tA,extractTags:()=>tQ,fromHtml:()=>tZ,getCoverImage:()=>t2,getCoverImages:()=>t5,getDefaultPodcastDescriptionWithoutFeedCTAs:()=>ns,getDescription:()=>t7,getDimensionsFromImageUrl:()=>tk,getFirstImageFromBody:()=>t9,getHeaderImageFromBody:()=>t6,getImageUrlsFromPostBody:()=>t4,getImagesFromBody:()=>t8,getLinks:()=>nn,getPreviewImageUrl:()=>ne,hasExplicitPaywall:()=>nd,migrateMarkdown:()=>t0,migratePost:()=>t1,migrateProsemirrorToTiptap:()=>tF,migratePublication:()=>t3,migrateTiptapToProsemirror:()=>tq,nodeToHtml:()=>tV,normalizeDbPodcastDescriptionToHtmlString:()=>na,purgeUnsafeLinks:()=>no,schema:()=>tT,schemaStatic:()=>tO,serializeDoc:()=>tJ,serializedToPodcastDescription:()=>t$,setBelowTheFoldAttribute:()=>ni,setButtonActions:()=>nt,tipTapNodes:()=>tz,tipTapSchema:()=>tY,toHtml:()=>tG,toText:()=>tK,trackedCustomNodes:()=>tS,unserializeDoc:()=>tH,unserializeDocAsync:()=>tj,unserializeDocToJSON:()=>tW,unserializeJson:()=>tP});var r=n(69277),l=n(70408),o=n(32641),i=n(88285),a=n(76229),s=n(93993),c=n(16571),d=n(55895),u=n(55679),p=n(31707),f=n(16233),m=n(96436),h=n(96282),g=n(58521),v=n(18708),y=n(60526),b=n(34688),w=n(61292),k=n(6142),_=n(35933),x=n(41002),E=n(39001),A=n(80829),D=n(90846),S=n(579),C=n(99595),T=n(83673),O=n.n(T),L=n(69843),N=n.n(L),M=n(63375),I=n.n(M),B=n(77003),z=n(98111),Y=n(56458),R=n(58278),U=n(463),F=n(83075),q=n(39318),P=n(82776),W=n(38474),H=n(79589),j=n(26082),J=n(55277),V=n(58588),X=n(26116),G=n(55029),K=n(39729),$=n(82086),Q=n(37855),Z=n(32422),ee=n(82311),et=n(34202),en=n(83485),er=n(30909),el=n(42985),eo=n(79431),ei=n(45595),ea=n(60282),es=n(70679),ec=n(21577),ed=n(85052),eu=n(26746),ep=n(97966),ef=n(70084),em=n(66151),eh=n(32365),eg=n(33967),ev=n(92678),ey=n(66347),eb=n(64287),ew=n(89909),ek=n(43146),e_=n(79493),ex=n(28072),eE=n(5113),eA=n(96208),eD=n(93692),eS=n(56456),eC=n(95663),eT=n(28177),eO=n(38435),eL=n(36986),eN=n(67902),eM=n(19015),eI=n(31933),eB=n(19062),ez=n(37859),eY=n(50170),eR=n(83733),eU=n(36504),eF=n(31611),eq=n(8540),eP=n(61972),eW=n(17768),eH=n(53680),ej=n(82979),eJ=n(78598),eV=n(58097),eX=n(6905),eG=n(63998),eK=n(30131),e$=n(69866),eQ=n(54958),eZ=n(41298),e0=n(76527),e1=n(60440),e3=n(41758),e7=n(14489),e2=n(88457),e8=n(88213),e9=n(96384),e6=n(48818),e4=n(40282),e5=n(75594),te=n(66613),tt=n(52910),tn=n(84262),tr=n(25187),tl=n(51600),to=n(90565),ti=n(54544),ta=n(47727),ts=n(14304),tc=n(23491),td=n(13625),tu=n(60597),tp=n(33333),tf=n(90032),tm=n(79207),th=n(68530),tg=n(47579),tv=n(39248),ty=n(72385),tb=n(54749),tw=n(60147);let tk=e=>{var t,n,r,l;let[o,i]=((null==(l=e.split("_"))||null==(r=l[1])||null==(n=r.split("."))||null==(t=n[0])?void 0:t.split("x"))||[0,0]).map(Number);return{width:o||0,height:i||0}},t_={type:"doc",content:[{type:"paragraph"}]},tx={captionedImage:e=>{var t,n,r,l;let o=null==(t=e.content)?void 0:t.find(e=>{var t,n;return"image2"===e.type&&(null==(t=e.attrs)?void 0:t.width)>=300&&(null==e||null==(n=e.attrs)?void 0:n.height)>=300});if(!o)return{url:null,caption:void 0,alt:void 0};let i=null==e||null==(n=e.content)?void 0:n.find(e=>"caption"===e.type);return{url:null==o||null==(r=o.attrs)?void 0:r.src,caption:i,alt:null==o||null==(l=o.attrs)?void 0:l.alt}},image2:e=>{var t,n,r,l;return"number"!=typeof(null==(t=e.attrs)?void 0:t.width)&&"number"!=typeof(null==(n=e.attrs)?void 0:n.height)||e.attrs.width>=300&&e.attrs.height>=300?{url:null==e||null==(r=e.attrs)?void 0:r.src,alt:null==e||null==(l=e.attrs)?void 0:l.alt}:{url:null,caption:void 0,alt:void 0}},image3:e=>{var t,n,r,l,o;let i=tk(null==(t=e.attrs)?void 0:t.src);return"number"!=typeof(null==(n=e.attrs)?void 0:n.width)&&"number"!=typeof(null==(r=e.attrs)?void 0:r.height)||e.attrs.width>=300&&e.attrs.height>=300||i.width>=300&&i.height>=300?{url:null==(l=e.attrs)?void 0:l.src,caption:e.content,alt:null==(o=e.attrs)?void 0:o.alt}:{url:null,caption:void 0,alt:void 0}}},tE={image:e=>{var t;return ne(null==(t=e.attrs)?void 0:t.src)},image2:e=>{var t,n,r;return"number"!=typeof(null==(t=e.attrs)?void 0:t.width)&&"number"!=typeof(null==(n=e.attrs)?void 0:n.height)||e.attrs.width>=300&&e.attrs.height>=300?ne(null==(r=e.attrs)?void 0:r.src):null},image3:e=>{var t,n,r,l;let o=tk(null==(t=e.attrs)?void 0:t.src);return"number"!=typeof(null==(n=e.attrs)?void 0:n.width)&&"number"!=typeof(null==(r=e.attrs)?void 0:r.height)||e.attrs.width>=300&&e.attrs.height>=300||o.width>=300&&o.height>=300?ne(null==(l=e.attrs)?void 0:l.src):null},imageGallery:e=>{var t,n,r;return ne(null==(r=e.attrs)||null==(n=r.gallery.images)||null==(t=n[0])?void 0:t.src)},spotify:e=>{var t;return ne(null==(t=e.attrs)?void 0:t.image)},spotify2:e=>{var t;return ne(null==(t=e.attrs)?void 0:t.image)},opensea:e=>{var t;return ne(null==(t=e.attrs)?void 0:t.image)},twitter2:e=>{var t,n;if(null==(t=e.attrs)?void 0:t.photos){for(let t of e.attrs.photos)if(t.img_url)return ne(t.img_url)}return(null==(n=e.attrs)?void 0:n.expanded_url)&&e.attrs.expanded_url.image?e.attrs.expanded_url.image.url?ne(e.attrs.expanded_url.image.url):ne(e.attrs.expanded_url.image):null},vimeo:e=>{var t;return tv.VG(null==(t=e.attrs)?void 0:t.videoId,{playButton:!1})},youtube:e=>{var t;return tw.VG(null==(t=e.attrs)?void 0:t.videoId,{playButton:!1})},youtube2:e=>{var t;return tw.VG(null==(t=e.attrs)?void 0:t.videoId,{playButton:!1})},kindle:e=>{var t;return(0,q.dJ9)(null==(t=e.attrs)?void 0:t.imageUrl)},applePodcast:e=>{var t;return(0,q.dJ9)(null==(t=e.attrs)?void 0:t.imageUrl)},tiktok:e=>{var t;return(0,q.dJ9)(null==(t=e.attrs)?void 0:t.thumbnail_url)},polymarket:e=>{var t,n;let r=Math.floor(new Date().getTime()/6e4);if(null==(t=e.attrs)?void 0:t.profileName)return(0,q.dJ9)("".concat((0,q.$_T)(),"/api/v1/polymarket-embed-image/profile/").concat(e.attrs.profileName,"?timestamp=").concat(r),800);if(null==(n=e.attrs)?void 0:n.eventSlug){let t=e.attrs.marketSlug?"/".concat(e.attrs.marketSlug):"";return(0,q.dJ9)("".concat((0,q.$_T)(),"/api/v1/polymarket-embed-image/").concat(e.attrs.eventSlug).concat(t,"?timestamp=").concat(r),800)}return null},prediction_market:e=>{var t;return(0,q.dJ9)(null==(t=e.attrs)?void 0:t.thumbnail_url)},manifold:e=>{var t;return(0,q.dJ9)(null==(t=e.attrs)?void 0:t.thumbnail_url)},lichess:e=>{var t;return(0,q.dJ9)(null==(t=e.attrs)?void 0:t.thumbnail_url)},datawrapper:e=>{var t;return(0,q.dJ9)(null==(t=e.attrs)?void 0:t.thumbnail_url)},pinterest:e=>{var t;return ne(null==(t=e.attrs)?void 0:t.image)}},tA={augmentation_placeholder:V.c,youtube2:tw.c,youtube:tb.c,vimeo:tv.c,install_substack_app:eH.c,preview_in_substack_app:e2.c,opensea:eK.c,twitter2:td.c,twitter:tc.c,communityChat:eo.c,communityPost:ei.c,comment:el.c,spotify2:tn.c,spotify:tt.c,soundcloud:e5.c,instagram:eW.c,image2:eF.c,image:eR.c,button:$.c,comic:er.A.nodeSpec,file:er.A.nodeSpec,pdf:eQ.A.nodeSpec,xlsx:ty.A.nodeSpec,ebook:eu.A.nodeSpec,referral_link:e6.c,bandcamp:X.c,kindle:ej.c,gitgist:ez.c,embeddedPost:ep.c,embeddedPublication:ef.c,applePodcast:W.c,audio:j.c,video:tg.c,audioUrl:J.c,tiktok:ts.c,bluesky:K.c,poll:e0.c,sponsorshipCampaign:te.c,imageGallery:eU.c,image3:eq.c,cashtag:en.c,substack_mentions:eG.c,polymarket:e1.c,prediction_market:e3.c,manifold:e3.c,lichess:eV.c,datawrapper:es.c,digestPostEmbed:ec.c,assetError:H.c,directMessage:ed.c,recipe:e9.c,pinterest:eZ.c},tD=(0,l._)((0,r._)({},tA),{blockquote:G.c,calloutBlock:Q.c,fragmentNode:eB.c,captionedImage:et.c,caption:Z.c,ctaCaption:ea.c,footnote:eN.c,footnoteAnchor:eM.c,inline_latex:eP.c,latex_block:eJ.c,paywall:e$.c,preformatted_text_block:e7.c,pullquote:e8.c,subscribeWidget:tl.c,captionedShareButton:(0,ee.c)({url:z.T.SHARE_URL}),captionedWriterReferralButton:(0,ee.c)({hasDynamicSubstitutions:!1}),templateComment:ta.c,meeting:eX.c,referralTier:e4.c,fpRecircBlock:eI.c,[eY._1]:eY.c}),tS=(0,l._)((0,r._)({},tA),{subscribeWidget:tl.c,paywall:e$.c,templateComment:ta.c}),tC={strikethrough:tr.o,superscript:ti.L,subscript:to.i},tT=new S.Sj({nodes:tR(),marks:tU()}),tO=new S.Sj({nodes:tR({isStatic:!0}),marks:tU({isStatic:!0})}),tL=Object.keys(tD).filter(e=>!["blockquote","pullquote","calloutBlock","fpRecircBlock",eY._1,"inline_latex","latex_block"].includes(e)).map(e=>{let t=(0,tp.m0)(e,tD[e]),n=(0,r._)({},tD[e],t);return"youtube2"===e?n.addNodeView=()=>e=>{let{node:t}=e;return new tw.fe(t)}:"tiktok"===e?n.addNodeView=()=>e=>{let{node:t}=e;return new ts.e1(t)}:"lichess"===e?n.addNodeView=()=>e=>{let{node:t}=e;return new eV.Hk(t)}:"datawrapper"===e?n.addNodeView=()=>e=>{let{node:t}=e;return new es.nV(t)}:"prediction_market"===e||"manifold"===e?n.addNodeView=()=>e=>{let{node:t}=e;return new e3.hG(t)}:"paywall"===e?n.addNodeView=()=>e=>new e$.U:"comic"===e?n.addNodeView=()=>e=>{let{node:t,editor:n,getPos:r}=e;return er.A.getNodeView({node:t,editor:n,getPos:r})}:"pdf"===e?n.addNodeView=()=>e=>{let{node:t,editor:n,getPos:r}=e;return eQ.A.getNodeView({node:t,editor:n,getPos:r})}:"xlsx"===e?n.addNodeView=()=>e=>{let{node:t,editor:n,getPos:r}=e;return ty.A.getNodeView({node:t,editor:n,getPos:r})}:"ebook"===e?n.addNodeView=()=>e=>{let{node:t,editor:n,getPos:r}=e;return eu.A.getNodeView({node:t,editor:n,getPos:r})}:"augmentation_placeholder"===e&&(n.addNodeView=()=>(0,C.gu)(B.i)),i.bP.create(n)}),tN=a.Cv.extend({addCommands(){return{toggleBlockquote:()=>e=>{let{state:t,commands:n}=e;return!(!(0,i.rU)(t,"paragraph")||(0,i.rU)(t,"pullquote")||(0,i.rU)(t,"calloutBlock"))&&n.toggleWrap(this.name)}}},parseHTML:()=>G.c.parseDOM}),tM=a.Cv.extend({name:"calloutBlock",addCommands(){return{toggleCalloutBlock:()=>e=>{let{state:t,commands:n}=e;if((0,i.rU)(t,"calloutBlock"))return n.lift("calloutBlock");if((0,i.rU)(t,"paragraph")||(0,i.rU)(t,"button"))return!((0,i.rU)(t,"pullquote")||(0,i.rU)(t,"blockquote"))&&n.toggleWrap(this.name);let r=[t.schema.nodes.paragraph,t.schema.nodes.button].filter(e=>!!e),l=!0;return t.doc.nodesBetween(t.selection.from,t.selection.to,(e,n,o,i)=>{if(o===t.doc&&(e.type===t.schema.nodes.blockquote||e.type===t.schema.nodes.pullquote||!r.includes(e.type)))return l=!1,!1}),!(!l||(0,i.rU)(t,"pullquote")||(0,i.rU)(t,"blockquote"))&&n.toggleWrap(this.name)}}},parseHTML:()=>[{tag:"div[data-callout]",priority:100},{tag:"div.callout-block",priority:99}],renderHTML:()=>["div",{class:"callout-block","data-callout":"true"},0],addInputRules:()=>[]}),tI=g.d.extend({addCommands:()=>({insertHorizontalRule:()=>e=>{let{state:t,dispatch:n}=e;return n&&t.schema.nodes.horizontalRule&&n((0,tp.DL)(t,t.schema.nodes.horizontalRule.create())),!0},setHorizontalRule:()=>e=>{let{state:t,dispatch:n}=e;if(n){if(!t.schema.nodes.horizontalRule)return console.error("horizontalRule is missing"),!1;n((0,tp.DL)(t,t.schema.nodes.horizontalRule.create()))}return!0}})}),tB=u.NG.extend({marks:"_"}),tz=[tN,s.yN,c.Rg,eh.$,tM,d.Cy,tB,ev.q,p.y,eb.t,f.B,m.D,h.B,tI,em.K,eL.T,ek.W,eP.s,eJ.A,ex.N,eD.P,eT.S,eS.c,eA.k,ew.H,v.J2,e_.u,y.c,b._J,w.f,eE.p,e8.k,k.n,_.E,x.Z,E.E,A.n.extend({addKeyboardShortcuts:()=>({})}).configure({types:[...F.h]}),eg.A,eO.S,ey.I,ed.eW,eI.ik,eY.E6,...tL],tY=(0,i._w)(tz);function tR(){let{isStatic:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=D.wQ.spec.nodes;for(let e of F.h){let n=t.get(e);n&&(t=t.update(e,function(e){let t=e.attrs||{},n=e.toDOM,i=e.parseDOM;return(0,l._)((0,r._)({},e),{attrs:(0,l._)((0,r._)({},t),{textAlign:{default:null}}),toDOM:n?e=>{let t=n(e);return e.attrs.textAlign&&"left"!==e.attrs.textAlign&&Array.isArray(t)&&("object"!=typeof t[1]||null===t[1]||Array.isArray(t[1])?t.splice(1,0,{style:"text-align: ".concat(e.attrs.textAlign)}):t[1]=(0,l._)((0,r._)({},t[1]),{style:"".concat(t[1].style?"".concat(t[1].style,"; "):"","text-align: ").concat(e.attrs.textAlign)})),t}:void 0,parseDOM:i?i.map(e=>{let{attrs:t}=e,n=(0,o._)(e,["attrs"]);return(0,l._)((0,r._)({},n),{getAttrs:n=>{var o;let i=e.getAttrs?e.getAttrs(n):t||{};if(!1===i)return!1;let a=null==(o=n.style)?void 0:o.textAlign;return a&&["center","right","justify"].includes(a)?(0,l._)((0,r._)({},i||{}),{textAlign:a}):i||{}}})}):void 0})}(n)))}for(let n of Object.keys(tD)){let r=Object.assign({},tD[n]);e&&r.toDOMStatic&&(r.toDOM=r.toDOMStatic),delete r.toDOMStatic,t=t.get(n)?t.update(n,r):t.addToEnd(n,r)}return t}function tU(){let{isStatic:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=D.wQ.spec.marks;for(let n of Object.keys(tC)){let r=Object.assign({},tC[n]);e&&r.toDOMStatic&&(r.toDOM=r.toDOMStatic),delete r.toDOMStatic,t=t.get(n)?t.update(n,r):t.addToEnd(n,r)}return t}function tF(e){let{postId:t,pubId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e;return"string"==typeof r&&(r=tP(r,{postId:t,pubId:n})),(0,tp.jE)(r,e=>{let t=tp.rl.find(t=>t[0]===e.type);return t&&(e.type=t[1],e.attrs&&"orderedList"===t[1]&&(e.attrs.start=e.attrs.order)),e.marks&&e.marks.forEach(e=>{var t;let n=tp.EI.find(t=>t[0]===e.type);n&&(e.type=n[1]),"link"===e.type&&(null==(t=e.attrs)?void 0:t.href)===!0&&(e.attrs.href=null)}),e}),r}function tq(e){let{postId:t,pubId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e;return"string"==typeof r&&(r=tP(r,{postId:t,pubId:n})),(0,tp.jE)(r,e=>{let t=tp.rl.find(t=>t[1]===e.type);return t&&(e.type=t[0],e.attrs&&"ordered_list"===t[0]&&(e.attrs.order=e.attrs.start)),e.marks&&e.marks.forEach(e=>{let t=tp.EI.find(t=>t[1]===e.type);t&&(e.type=t[0])}),e}),r}function tP(e){let t,{postId:n,pubId:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&(e=(e=e.replace("http://substack-post-media","https://substack-post-media")).replace("http://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984","https://bucketeer-e05bbc84-baa3-437e-9518-adb32be77984")),e=t0(e))try{t=JSON.parse(e)}catch(t){console.error("unserializeJson for post [".concat(n,"], pubId [").concat(r,"], could not parse serialized:"),e,t)}return null!=t?t:void 0}function tW(e){let{docStr:t,postId:n,pubId:r}=e,l=no(tP(t,{postId:n,pubId:r})||t_);if(!l)throw Error("could not purgeUnsafeLinks");let o=l;return(o=tF(o,{postId:n,pubId:r}))||t_}function tH(e){let{customSchema:t,useTiptap:n,mutateJson:r,shouldSetBelowTheFoldAttribute:l=!1,shouldThrowOnInvalid:o,postId:i,pubId:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{let o=tP(e,{postId:i,pubId:a})||t_;r&&r(o);let s=no(o);if(!s)throw Error("could not purgeUnsafeLinks");let c=s;return l&&(c=ni(c)),c=n?tF(c,{postId:i,pubId:a}):tq(c,{postId:i,pubId:a}),(t||tT).nodeFromJSON(c)}catch(n){if(console.error("Failed to parse JSON for post [".concat(i,"], serialized:"),e,n),o)throw Error("Failed to parse JSON: ".concat(n.message));return(t||tT).nodeFromJSON(t_)}}async function tj(e){let{customSchema:t,useTiptap:n,mutateJson:r,shouldSetBelowTheFoldAttribute:l=!1,shouldThrowOnInvalid:o,postId:i,pubId:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{let o=tP(e,{postId:i,pubId:a})||t_;r&&await r(o);let s=no(o);if(!s)throw Error("could not purgeUnsafeLinks");let c=s;return l&&(c=ni(c)),c=n?tF(c,{postId:i,pubId:a}):tq(c,{postId:i,pubId:a}),(t||tT).nodeFromJSON(c)}catch(n){if(console.error("Failed to parse JSON for post [".concat(i,"], serialized:"),e,n),o)throw Error("Failed to parse JSON: ".concat(n.message));return(t||tT).nodeFromJSON(t_)}}function tJ(e){let{runMigrations:t=!1,postId:n,pubId:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=e.toJSON();return t&&(l=tq(l=no(l=function(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="string"==typeof e?tP(e,{postId:t}):e;return(0,tp.jE)(n,e=>{e.text&&(e.text=(0,P.stripInvalidBytes)(e.text))},{nodeTypes:["text"]}),n}(l)),{postId:n,pubId:r})),JSON.stringify(l)}function tV(e,t){let n=document.createElement("div");return n.appendChild(S.ZF.fromSchema(t?tO:tT).serializeFragment(S.FK.fromArray([e]),{document})),n}function tX(e){Array.from(e.querySelectorAll("h2, h3, h4, h5, h6")).forEach(e=>{if(!e.getAttribute("id")){var t;let n=(0,R.uB)(e.textContent||"",!0),r=document.createElement("div");r.setAttribute("id",n),r.setAttribute("class","anchor-target"),null==(t=e.parentNode)||t.insertBefore(r,e);let l=document.createElement("a");for(l.setAttribute("href","#".concat(n));e.firstChild;)l.appendChild(e.firstChild);e.appendChild(l)}})}function tG(e,t){let{isAmp:n,transform:r,useTipTap:l,pubId:o,postId:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(l){let n=tF(tP(e,{postId:i,pubId:o}),{postId:i,pubId:o});if(!n)throw Error("could not serialize json doc");try{return(0,th.i)({doc:n,extensions:(0,eC.w)({isStatic:null!=t&&t}),customDocument:document})}catch(e){return console.error("could not serialize fragment, for pubId [".concat(o,"], postId [").concat(i,"]"),e),document.createElement("div").innerHTML}}let a=tH(e,{shouldSetBelowTheFoldAttribute:!0,postId:i,pubId:o}),s=S.ZF.fromSchema(t?tO:tT),c=document.createElement("div");try{s.serializeFragment(a.content,{document},c)}catch(e){return console.error("could not serialize fragment, for pubId [".concat(o,"], postId [").concat(i,"]"),e),c.innerHTML}return r&&r(c),n&&Array.from(c.querySelectorAll("img")).forEach(e=>{let t=document.createElement("amp-img");t.setAttribute("layout","intrinsic"),e.getAttributeNames().forEach(n=>{var r;"srcset"!==n&&t.setAttribute(n,null!=(r=e.getAttribute(n))?r:"null")}),e.replaceWith(t)}),c.innerHTML}function tK(e,t){let{postId:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return(0,tp.fE)(tH(e,{postId:n}),t)}function t$(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,tp.Lz)(tH(e,{postId:t}))}function tQ(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,tp.Te)(tH(e,{postId:t}))}function tZ(e){let{stripEmptyParagraphs:t,postId:n,pubId:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=S.S4.fromSchema(tT).parse(new DOMParser().parseFromString(e,"text/html"));return(t&&(l=(0,tf.c)(l,e=>!e.type||"paragraph"!==e.type.name||!!(0,tp.fE)(e))),l)?tJ(l,{postId:n,pubId:r}):null}function t0(e){return e&&"{"!==e[0]&&"null"!==e?tJ(D.ee.parse(e)):e}function t1(e){var t,n;return e.body=null!=(t=t0(e.body))?t:null,e.draft_body=null!=(n=t0(e.draft_body))?n:null,e}function t3(e){var t,n,r,l,o;return e.subscribe_content=null!=(t=t0(e.subscribe_content))?t:null,e.welcome_email_content=null!=(n=t0(e.welcome_email_content))?n:null,e.tos_content=null!=(r=t0(e.tos_content))?r:null,e.privacy_content=null!=(l=t0(e.privacy_content))?l:null,e.disclosures_content=null!=(o=t0(e.disclosures_content))?o:null,e}function t7(e,t){let{post:n=null,pubId:r,minCharacters:l=6,maxStopAfter:o=null,singleSentence:i=!0,language:a="en",excludeMediaPrefix:s=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{iString:c}=I18N.i(a),d=(null==n?void 0:n.type)==="thread"?145:250;(o||0===o)&&(d=Math.min(o,d));let u=(null==n?void 0:n.type)==="thread",p="";if(t)p+=t;else if(0!==d){var f;let t={paragraph:!0,blockquote:!0,list_item:!0,listItem:!0,heading:!0,code_block:!0,codeBlock:!0,hardbreak:!0,hard_break:!0,hardBreak:!0},o={caption:!0,footnote:!0};(0,tp.jE)("string"==typeof e?tP(e,{postId:null!=(f=null==n?void 0:n.id)?f:null,pubId:r}):e,e=>{if(d&&p.length>=d)return!1;if("paywall"===e.type)return tm.Vw;if(e.type&&o[e.type])return!1;if("text"===e.type){let{text:t}=e;if(t)if("string"==typeof t){let e=t.match(/[.?!] /);if(i&&(null==e?void 0:e.index))return p+=t.slice(0,e.index+1),tm.Vw;p+=t}else console.error("Expected text node to have string content, got",{postId:null==n?void 0:n.id,pubId:r})}else if(e.type&&t[e.type]&&p){if(p.length>l)return tm.Vw;" "!==p[p.length-1]&&(p+=" ")}else if("substack_mentions"===e.type){var a,s;p+=null!=(s=null==(a=e.attrs)?void 0:a.name)?s:""}})}if(p=p.replace(/\s+/g," ").trim(),u&&d&&p.length>=d&&(p=(0,P.truncateText)(p,d)),((null==n?void 0:n.type)==="podcast"||(null==n?void 0:n.type)==="video")&&!s){let e=(0,Y.Fk)(n);p="".concat(c((null==n?void 0:n.type)==="video"||(null==n?void 0:n.videoUpload)?"Watch now":"Listen now")," ").concat(e?"(".concat((0,P.secondsToLargestUnit)(e,{minutesCutoff:10800,language:a}),") "):"","| ").concat(p)}return p}function t2(e,t){var n;return null!=(n=t5(e,t)[0])?n:null}function t8(e){let{postId:t,pubId:n,width:r,height:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=tP(e,{postId:t,pubId:n});return o?I()(O()((0,tp.zM)(o,e=>{var t;return!!tE[null!=(t=e.type)?t:""]}).map(e=>{var t,n;let o=null==(t=tE[null!=(n=e.type)?n:""])?void 0:t.call(tE,e);return o?(0,q.dJ9)(o,r,{height:l}):null}))):[]}function t9(e){let{postId:t,pubId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t8(e,{postId:t,pubId:n});return r.length>0&&!N()(r[0])?r[0]:null}function t6(e){let{body:t}=e,n=tP(t);if(n)return(0,tp.zM)(n,e=>{var t;return!!tx[null!=(t=e.type)?t:""]}).map(e=>{var t,n;return null==(t=tx[null!=(n=e.type)?n:""])?void 0:t.call(tx,e)})[0]}async function t4(e){let{body:t,postId:n}=e,r=tH(t,{postId:n}),l=[];return(0,tp.Rv)(r,e=>{switch(e.type.name){case"image":case"image2":e.attrs.src&&l.push(e.attrs.src);break;case"imageGallery":var t;null==(t=e.attrs.gallery.images)||t.map(e=>{e.src&&l.push(e.src)})}}),l}function t5(e,t){var n;let r=[];"podcast_episode_image_info"in t&&t.podcast_episode_image_info&&!t.podcast_episode_image_info.isDefaultArt&&t.podcast_episode_image_info.url!==t.podcast_art_url&&r.unshift(t.podcast_episode_image_info.url),r.unshift(...t8(e,{postId:t.id}));let l="podcastUpload"in t&&t.podcastUpload||"draftPodcastUpload"in t&&t.draftPodcastUpload||void 0;if((null==l?void 0:l.state)==="transcoded"&&(null!=(n=null==l?void 0:l.thumbnail_id)?n:1)>1){let e=(0,q.H10)(l);e&&r.unshift(e)}let o="videoUpload"in t&&t.videoUpload||"draftVideoUpload"in t&&t.draftVideoUpload||void 0;if((null==o?void 0:o.state)==="transcoded"){let e=(0,q.H10)(o);e&&r.unshift(e)}return r}function ne(e){return"string"!=typeof e?null:(e=e.replace(/\/l_twitter_play_button_rvaygk[^/]+/g,""),(0,q.dJ9)(e,void 0,{height:600}))}function nt(e){(0,tp.jE)(e,e=>{var t;return"button"===e.type&&((null==(t=e.attrs)?void 0:t.url)&&"string"==typeof e.attrs.url&&e.attrs.url.startsWith("%%")&&(e.attrs.action=e.attrs.url.replace(/%%/g,"")),!0)},{nodeTypes:"button"})}function nn(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;if("string"==typeof n){let e=tP(n,{postId:t});if(!e)return[];n=e}nt(n);let r=[];return(0,tp.jE)(n,e=>{var t,n,l;if("button"===e.type&&(null==(t=e.attrs)?void 0:t.url)&&!e.attrs.action)r.push({text:e.attrs.text,url:e.attrs.url});else if("image2"===e.type&&(null==(n=e.attrs)?void 0:n.href))r.push({text:e.attrs.href,url:e.attrs.href});else if(e.marks){for(let t of e.marks)if("link"===t.type&&(null==(l=t.attrs)?void 0:l.href)){r.push({text:e.text,url:t.attrs.href});break}}}),r}function nr(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;let n=e;if("string"==typeof n){let e=tP(n,{postId:t});if(!e)return!1;n=e}return!!(0,tp.cy)(n,e=>"templateComment"===e.type)}function nl(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;let n=e;if("string"==typeof n){let e=tP(n,{postId:t});if(!e)return!1;n=e}return!!(0,tp.cy)(n,e=>{for(let a of["href","src","url"]){var t,n,r,l,o,i;if((null==e||null==(l=e.attrs)||null==(r=l[a])||null==(n=r.trim)||null==(t=(o=n.call(r)).toLowerCase)?void 0:t.call(o).startsWith("javascript:"))||(null==e||null==(i=e.marks)?void 0:i.find(e=>{var t,n,r,l,o;return null==(l=e.attrs)||null==(r=l[a])||null==(n=r.trim)||null==(t=(o=n.call(r)).toLowerCase)?void 0:t.call(o).startsWith("javascript:")})))return!0}return!1})}function no(e){let t,{postId:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){let r=tP(e,{postId:n});if(!r)return null;t=r}else t=e;return(0,tu.M5)(t)?(0,tf.c)(t,e=>{for(let a of["href","src","url"]){var t,n,r,l,o,i;if((null==e||null==(l=e.attrs)||null==(r=l[a])||null==(n=r.trim)||null==(t=(o=n.call(r)).toLowerCase)?void 0:t.call(o).startsWith("javascript:"))||(null==e||null==(i=e.marks)?void 0:i.find(e=>{var t,n,r,l,o;return null==(l=e.attrs)||null==(r=l[a])||null==(n=r.trim)||null==(t=(o=n.call(r)).toLowerCase)?void 0:t.call(o).startsWith("javascript:")})))return!1}return!0}):(0,tf.c)(t,e=>{for(let a of["href","src","url"]){var t,n,r,l,o,i;if((null==e||null==(l=e.attrs)||null==(r=l[a])||null==(n=r.trim)||null==(t=(o=n.call(r)).toLowerCase)?void 0:t.call(o).startsWith("javascript:"))||(null==e||null==(i=e.marks)?void 0:i.find(e=>{var t,n,r,l,o;return null==(l=e.attrs)||null==(r=l[a])||null==(n=r.trim)||null==(t=(o=n.call(r)).toLowerCase)?void 0:t.call(o).startsWith("javascript:")})))return!1}return!0})}function ni(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,{postId:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r="string"==typeof e?tP(e,{postId:n}):e;if(!r)return;let l=!1;return"doc"===r.type&&r.content&&r.content.map((e,n)=>{n>t?(0,tp.jE)(e,e=>{!e.content&&e.attrs&&(e.attrs.belowTheFold=!0)}):l||(0,tp.jE)(e,e=>{!e.content&&(null==e?void 0:e.type)=="image2"&&e.attrs&&(e.attrs.topImage=!0,l=!0)})}),r}function na(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{return JSON.parse(e),t$(e,{postId:t})}catch(t){return e}}function ns(e,t){let{body:n,hasPodcastPreview:r}=t;if(!e||!n)return null;let l=n;return r&&(l=JSON.stringify((0,tp.n)(tP(n,{postId:e.id}),{maxLength:"post_preview_limit"in e&&e.post_preview_limit&&"number"==typeof e.post_preview_limit?e.post_preview_limit:356}))),t$(l,{postId:e.id})}function nc(e){return tJ(tT.node("doc",null,e.split("\n").map(e=>e.trim()).filter(e=>e.length>0).map(e=>{let t=[],n=(0,U.P2)(e);if(n.length>0){let r=e;for(;;){let e=n.map(e=>[r.indexOf(e.value),e.value]).sort().find(e=>{let[t]=e;return t>=0});if(!e)break;let[l,o]=e;if(l>0&&t.push(tT.text(r.substring(0,l))),!tT.marks.link){console.error("link is missing from schema");continue}t.push(tT.text(o,[tT.marks.link.create({title:o,href:o,target:"_blank"})])),r=r.substring(l+o.length)}r&&t.push(tT.text(r))}else t.push(tT.text(e));return tT.node("paragraph",null,t)})))}function nd(e){let{postId:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;let n=e;if("string"==typeof e){let r=tP(e,{postId:t});if(!r)return!1;n=r}else n=e;return(0,tp.Ll)(n)}Object.entries(tY.nodes).forEach(e=>{let[t,n]=e;void 0!==tD[t]&&(n.spec=(0,r._)({},tD[t],n.spec))})},60597:function(e,t,n){function r(e){let{fragment:t}=e;return"content"in t?t.content:[]}function l(e){let{fragment:t,content:n}=e;t.content=n}function o(e){return"type"in e&&"object"==typeof e.type}function i(e){return"type"in e&&"string"==typeof e.type}n.d(t,{M5:()=>i,p0:()=>r,rQ:()=>o,x6:()=>l})},33333:function(e,t,n){n.d(t,{Ao:()=>R,DL:()=>J,EI:()=>v,JK:()=>B,Ll:()=>X,Lz:()=>C,OB:()=>M,Q7:()=>W,Rv:()=>h.Rv,Te:()=>_,WS:()=>j,Z3:()=>V,cy:()=>k,f$:()=>z,fD:()=>F,fE:()=>T,jE:()=>h.jE,jp:()=>N,m0:()=>L,n:()=>b,rl:()=>g,zM:()=>w,zl:()=>I});var r=n(69277),l=n(70408),o=n(26469);n(83673);var i=n(69843),a=n.n(i),s=n(31521),c=n.n(s),d=n(17460),u=n(28700),p=n(82776),f=n(82061),m=n(90032),h=n(79207);let g=[["list_item","listItem"],["bullet_list","bulletList"],["ordered_list","orderedList"],["hard_break","hardBreak"],["horizontal_rule","horizontalRule"],["code_block","codeBlock"]],v=[["em","italic"],["strong","bold"],["strikethrough","strike"]],y={image2:1,image:0,horizontal_rule:0,audio:0,video:0,youtube:0,youtube2:0,vimeo:0,opensea:0,twitter:0,twitter2:0,spotify:0,spotify2:0,soundcloud:0,bandcamp:0,kindle:0,tiktok:0,polymarket:0,prediction_market:0,lichess:0,datawrapper:0,recipe:0,pinterest:0},b=function(e){let{maxLength:t=356,getAfterCutoff:n=!1,withEllipsis:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l="",o=!1,i={},a=X(e),s=!1,c=(0,m.c)(e,e=>{var r;if(o)return n;if("paywall"===e.type)return o=!0,!1;if(a)return!0;let c=null!=(r=e.type)?r:"undefined";if(i[c]=(i[c]||0)+1,e.type&&e.type in y&&i[c]>y[e.type])return o=!0,n;let d=t-l.length;if(d<=0&&!a||!(d>0))return n;if(n){if("text"===e.type&&e.text){if(!(t-(l+=e.text).length<=0))return!1;e.text=e.text.substring(e.text.length+t-l.length-1,e.text.length)}}else if("text"===e.type&&e.text){l+=e.text;let t=e.text;e.text=(0,p.truncateText)(t,d),s=t!==e.text}return!0});if(c&&r&&!s){let e=function(e){let t=[],n=[e];for(;n.length;){var r;let e=n.pop();if(!e)break;if(e.content&&(null==(r=e.content)?void 0:r.length)>0)for(let t=e.content.length-1;t>=0;t--){let r=e.content[t];r&&n.push(r)}else t.push(e)}return t}(c),t=null,n=null;for(let r=e.length-1;r>=0&&(!t||!n);r--){let l=e[r];null===t&&(null==l?void 0:l.type)==="text"&&(t=r),null===n&&(null==l?void 0:l.type)!=="text"&&(null==l?void 0:l.type)!=="paragraph"&&(n=r)}let r=null!==t?e[t]:null,l=r&&null!==n&&null!==t&&n>t;r&&!l&&(r.text=O(r.text))}return c},w=(e,t)=>{let n=[];if(e&&(t(e)&&n.push(e),e.content))for(let r of e.content)n=n.concat(w(r,t));return n},k=(e,t)=>{if(e){if(t(e))return e;if(e.content)for(let n of e.content){let e=k(n,t);if(e)return e}}return null},_=e=>{let t=[];return e.nodesBetween(0,e.content.size,e=>{var n;(null==(n=e.type)?void 0:n.name)==="cashtag"&&t.push(e.attrs.symbol)},0),t},x=new Set(["caption","footnote","captionedImage","image","image2"]),E=new Set(["bullet_list","bulletList","ordered_list","orderedList","blockquote"]),A="x_li_start_placeholder_x",D=(e,t)=>{var n,r,l,o;if((null==(n=e.type)?void 0:n.name)==="list_item"||(null==(r=e.type)?void 0:r.name)==="listItem")return{open:A,close:""};if((null==(l=e.type)?void 0:l.name)==="paragraph"||e.isBlock&&e.textContent.length>0&&!E.has(null==(o=e.type)?void 0:o.name)){let e="

";return(t.length>0?t[t.length-1]:null)===A&&(t.pop(),e+="* "),{open:e,close:"

"}}return null},S=e=>{var t,n,r;let{node:l,recursiveDepth:o,tokens:i}=e;if(o>100)return console.warn("Reached max recursive depth while converting document to HTML for podcast"),!1;let a=!0;if(x.has(null==(t=l.type)?void 0:t.name))a=!1;else if(l.isText){if(l.text&&l.text.length>0){let e=l.marks.find(e=>"link"===e.type.name&&e.attrs.href&&"string"==typeof e.attrs.href),t=l.marks.find(e=>"em"===e.type.name),n=l.marks.find(e=>"strong"===e.type.name),r=l.text;t&&(r="".concat(r,"")),n&&(r="".concat(r,"")),e&&(r='').concat(r,"")),i.push(r)}}else if(D(l,[])){let e=D(l,i);e&&i.push(e.open),l.descendants(e=>S({node:e,recursiveDepth:o+1,tokens:i})),e&&i.push(e.close),a=!1}else if((null==(n=l.type)?void 0:n.name)==="cashtag")i.push("".concat(l.attrs.symbol," "));else if((null==(r=l.type)?void 0:r.name)==="substack_mentions"){let e=l.marks.find(e=>"em"===e.type.name),t=l.marks.find(e=>"strong"===e.type.name),n=l.attrs.name;if(e&&(n="".concat(n,"")),t&&(n="".concat(n,"")),"user"===l.attrs.type){let e=(0,u.rf)(l.attrs.id,l.attrs.name);i.push('').concat(n,""))}else if("pub"===l.attrs.type){let e=l.attrs.url;i.push('').concat(n,""))}}return a},C=e=>{let t=[];return e.descendants(e=>S({node:e,recursiveDepth:1,tokens:t})),t.filter(e=>e!==A).join("").trim()},T=function(e){let{withLinks:t=!0,withCaptionsAndFootnotes:n=!1,withQuotes:r=!0,forPodcast:l=!1,truncateAt:o=null,truncateTo:i=o,truncateEllipsis:s="…",truncateExtension:c=null}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u="",f="",m="",h=!0;return e.nodesBetween(0,e.content.size,e=>{var o,g,v,y,b,w,k;if(!n&&["caption","footnote"].includes(null==(o=e.type)?void 0:o.name)||!r&&((null==(g=e.type)?void 0:g.name)==="pullquote"||(null==(v=e.type)?void 0:v.name)==="blockquote"||(null==(y=e.type)?void 0:y.name)==="calloutBlock"))return!1;if(e.isText){if(e.text&&e.text.length>0){let n;h=!1,!a()(i)&&u.length=i&&(n=(0,p.truncateText)(e.text,i-u.length,{ellipsis:s,extension:c}));let r=e.marks.filter(e=>"link"===e.type.name&&e.attrs.href)[0],o=e.marks.filter(e=>"em"===e.type.name)[0],g=e.marks.filter(e=>"strong"===e.type.name)[0],v=e.text;u+=v,o&&l&&(n&&(n="".concat(n,"")),v="".concat(v,"")),g&&l&&(n&&(n="".concat(n,"")),v="".concat(v,"")),r&&t?l?(n&&(m="".concat(f,'').concat(n,"")),f+='').concat(v,"")):(n&&(m="".concat(f).concat(n," [ ").concat(r.attrs.href," ]")),f+="".concat(v," [ ").concat(r.attrs.href," ]")):(n&&(m=f+n),f+=v)}}else!h&&["hard_break","hardBreak"].includes(null==(b=e.type)?void 0:b.name)?(h=!0,u+="\n",l?f+="
":f+="\n"):!h&&e.isBlock?(h=!0,u+="\n",l?f+="

":f+="\n"):(null==(w=e.type)?void 0:w.name)==="cashtag"?f+="".concat(e.attrs.symbol," "):(null==(k=e.type)?void 0:k.name)==="substack_mentions"&&(f+="".concat(e.attrs.name," "))},0),!a()(o)&&u.length>o&&m&&(f=m),f=f.trim(),l&&(f=f.replace(/\s*()+$/,"").trim()),f},O=e=>"".concat(c()(e,"."),"..."),L=(e,t)=>(0,l._)((0,r._)({name:e},t),{addAttributes:()=>t.attrs||{},parseHTML:()=>t.parseDOM,renderHTML(n){let{node:r}=n;if(!t.toDOM)return console.warn("trying to create TipTapNode, no toDOM found for node",e),["span"];try{return t.toDOM(r)}catch(t){try{return console.error("error in toDOM for node",e,t),(0,f.D)({msg:null,node:r,err:t,group:r.isInline?"inline":"block"})}catch(t){return console.error("error rendering error element for node",e,t),(null==r?void 0:r.isInline)?["span"]:["div"]}}}}),N=(e,t)=>{let n,r,l;if(e.doc.nodesBetween(e.selection.from,e.selection.to,(e,o)=>{if(n||r)return!1;let i=e.marks.find(e=>e.type===t);i&&(n=e,r=i,l={from:o,to:o+e.nodeSize})}),n)return{node:n,mark:r,pos:l}},M=(e,t)=>{let n,r,l;if(e.doc.nodesBetween(e.selection.from,e.selection.to,(o,i)=>{if(n||r||!(i<=e.selection.from)||!(e.selection.to<=i+o.nodeSize))return!1;{let e=o.marks.find(e=>e.type===t);e&&(n=o,r=e,l={from:i,to:i+o.nodeSize})}}),!n){if(e.selection.empty){let a=e.doc.resolve(e.selection.from),s=a.nodeBefore&&a.nodeBefore.marks.find(e=>e.type===t),c=a.nodeAfter&&a.nodeAfter.marks.find(e=>e.type===t);if(s||c){var o,i;n=c?a.nodeAfter:a.nodeBefore,r=c||s,l=c?{from:a.pos,to:a.pos+a.nodeAfter.nodeSize}:{from:a.pos-(null!=(i=null==(o=a.nodeBefore)?void 0:o.nodeSize)?i:0),to:a.pos}}}if(!n)return}return{node:n,mark:r,pos:l}},I=function(e){let{allowedMarks:t=[]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!e.selection.empty||B(e,e.selection.from,e.selection.to,{allowedMarks:t})},B=function(e,t,n){let{allowedMarks:r=[]}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=!0,o=!1;return e.doc.nodesBetween(t,n,t=>{if(!l)return!1;t.type!==e.schema.nodes.text?o?l=!1:o=!0:t.marks.find(e=>!r.includes(e.type))&&(l=!1)}),l},z=(e,t)=>{if(e.selection.empty)return!1;let n=Array.isArray(t)?t:[t];if("node"in e.selection){var r;let t=e.selection;return n.includes(null==(r=t.node)?void 0:r.type)}return Y(e,e.selection.from,e.selection.to,n)},Y=(e,t,n,r)=>{let l=null;return e.doc.nodesBetween(t,n,e=>{if(!(!1!==l&&r.includes(e.type)))return l=!1,!1;l=!0}),l||!1},R=e=>e.selection.empty?null:U(e,e.selection.from,e.selection.to),U=(e,t,n)=>{let r=null;return e.doc.nodesBetween(t,n,t=>!r&&(t.type===e.schema.nodes.image2?(r=t.attrs.href,!1):void(t.type===e.schema.nodes.image3&&(r=t.attrs.href)))),r||null},F=(e,t,n)=>{e.selection.empty||q(e,t,e.selection.from,e.selection.to,n)},q=(e,t,n,r,l)=>{e.doc.nodesBetween(n,r,(n,r)=>{(n.type===e.schema.nodes.image2||n.type===e.schema.nodes.image3)&&t.setNodeMarkup(r,n.type,Object.assign({},n.attrs,{href:l}),n.marks)})},P=e=>({top:e.top+window.scrollY,bottom:e.bottom+window.scrollY,left:e.left+window.scrollX,right:e.right+window.scrollX}),W=(e,t,n,r)=>{let l=document.body,o=window.innerWidth<=481,i=H(e,t.from,t.to,t=>[e.state.schema.nodes.image,e.state.schema.nodes.image2].includes(t.type))?-44:8,a=P(e.coordsAtPos(t.from)),s=P(e.coordsAtPos(t.to));n.style.position="fixed";let c=s.bottom+(o?l.scrollTop:0),d=l.clientHeight-n.clientHeight-96-i;a.topn.clientWidth?(r&&(r.style.left="10px"),n.style.right="",n.style.left="".concat(a.left,"px")):(r&&(r.style.left="".concat(a.left-l.clientWidth+n.clientWidth,"px")),n.style.right="10px",n.style.left=""),o||c{let l=!1;return e.state.doc.nodesBetween(t,n,e=>{if(l)return!1;l=r(e)}),l},j=(e,t)=>{var n;return t.includes(null==(n=e.doc.resolve(e.selection.from).node(1))?void 0:n.type)},J=(e,t)=>{var n,r,l;let i=e.tr,a=i.selection instanceof o.U3,s=a&&(null==(l=i.selection.$from)||null==(r=l.parent)||null==(n=r.content)?void 0:n.size)===0?e.selection.to-1:e.selection.to;if(Array.isArray(t))for(let e of t.slice().reverse())i.insert(s,e);else i.insert(s,t);return a||i.setSelection(o.nh.near(i.doc.resolve(s))),i},V=(e,t)=>{let n=e.tr;return n.replaceSelectionWith(t),n},X=e=>!!k(e,e=>"paywall"===e.type)},8221:function(e,t,n){function r(e){let{tr:t,schema:n}=e,r=!1,l=1,o=1;return t.doc.descendants((e,i)=>{if(e.type===n.nodes.footnote){if(e.attrs.number!==l){let o=n.nodes.footnote.create({number:l},e.content);t.replaceWith(i,i+e.nodeSize,o),r=!0}l+=1}else if(e.type===n.nodes.footnoteAnchor){if(e.attrs.number!==o){let l=n.nodes.footnoteAnchor.create({number:o});t.replaceWith(i,i+e.nodeSize,l),r=!0}o+=1}}),r}function l(e){let{tr:t,schema:n}=e,r=0;t.doc.nodesBetween(0,t.selection.from,e=>{e.type===n.nodes.footnoteAnchor&&(r+=1)});let l=[];if(t.doc.forEach((e,t)=>{e.type===n.nodes.footnote&&l.push(t)}),rl,TD:()=>r})}}]);