!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]="330a3643-b510-4100-9b18-8002f8d64745",e._sentryDebugIdIdentifier="sentry-dbid-330a3643-b510-4100-9b18-8002f8d64745")}catch(e){}}(),(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["47415"],{95201:function(e,t,n){e.exports=n(67358).default},33031:function(e,t,n){var r=n(83120),i=n(46155),o=n(69302),s=n(36800);e.exports=o(function(e,t){if(null==e)return[];var n=t.length;return n>1&&s(e,t[0],t[1])?t=[]:n>2&&s(t[0],t[1],t[2])&&(t=[t[0]]),i(e,r(t,1),[])})},67502:function(e,t,n){"use strict";n.d(t,{b:()=>d});var r=n(17402),i=n(29607),o=n(97372),s=n(73550),l=n(4006),a="Toggle",c=r.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:c,...d}=e,[u,h]=(0,o.i)({prop:n,onChange:c,defaultProp:r??!1,caller:a});return(0,l.Y)(s.sG.button,{type:"button","aria-pressed":u,"data-state":u?"on":"off","data-disabled":e.disabled?"":void 0,...d,ref:t,onClick:(0,i.mK)(e.onClick,()=>{e.disabled||h(!u)})})});c.displayName=a;var d=c},99595:function(e,t,n){"use strict";n.d(t,{$Z:()=>m,$p:()=>$,NV:()=>A,VR:()=>N,gu:()=>z,hG:()=>x,mM:()=>I});var r,i,o,s=n(73568),l=n(17402),a=n(88285),c={exports:{}},d={};c.exports=function(){if(i)return d;i=1;var e=l.default,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=e.useState,r=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function a(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var i=t(),l=n({inst:{value:i,getSnapshot:t}}),c=l[0].inst,d=l[1];return o(function(){c.value=i,c.getSnapshot=t,a(c)&&d({inst:c})},[e,i,t]),r(function(){return a(c)&&d({inst:c}),e(function(){a(c)&&d({inst:c})})},[e]),s(i),i};return d.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:c,d}();var u=c.exports;let h=({contentComponent:e})=>{let t=u.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return l.default.createElement(l.default.Fragment,null,Object.values(t))};class p extends l.default.Component{constructor(e){var t;super(e),this.editorContentRef=l.default.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(null==(t=e.editor)?void 0:t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){let t,n;if(e.contentComponent)return;let r=this.editorContentRef.current;r.append(...e.options.element.childNodes),e.setOptions({element:r}),t=new Set,n={},e.contentComponent={subscribe:e=>(t.add(e),()=>{t.delete(e)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(e,r){n={...n,[e]:l.default.createPortal(r.reactElement,r.element,e)},t.forEach(e=>e())},removeRenderer(e){let r={...n};delete r[e],n=r,t.forEach(e=>e())}},this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){let e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;let t=document.createElement("div");t.append(...e.options.element.childNodes),e.setOptions({element:t})}render(){let{editor:e,innerRef:t,...n}=this.props;return l.default.createElement(l.default.Fragment,null,l.default.createElement("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...n}),(null==e?void 0:e.contentComponent)&&l.default.createElement(h,{contentComponent:e.contentComponent}))}}let f=(0,l.forwardRef)((e,t)=>{let n=l.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return l.default.createElement(p,{key:n,innerRef:t,...e})}),m=l.default.memo(f);var g=(r=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;for(i of t.entries())if(!e(i[1],n.get(i[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(i of t.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(t[i]!==n[i])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){var r,i,o,s=o[i];if(("_owner"!==s||!t.$$typeof)&&!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n}).__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r,y={exports:{}},b={};y.exports=function(){if(o)return b;o=1;var e=l.default,t="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=u.useSyncExternalStore,r=e.useRef,i=e.useEffect,s=e.useMemo,a=e.useDebugValue;return b.useSyncExternalStoreWithSelector=function(e,o,l,c,d){var u=r(null);if(null===u.current){var h={hasValue:!1,value:null};u.current=h}else h=u.current;var p=n(e,(u=s(function(){function e(e){if(!i){if(i=!0,n=e,e=c(e),void 0!==d&&h.hasValue){var o=h.value;if(d(o,e))return r=o}return r=e}if(o=r,t(n,e))return o;var s=c(e);return void 0!==d&&d(o,s)?o:(n=e,r=s)}var n,r,i=!1,s=void 0===l?null:l;return[function(){return e(o())},null===s?void 0:function(){return e(s())}]},[o,l,c,d]))[0],u[1]);return i(function(){h.hasValue=!0,h.value=p},[p]),a(p),p},b}();var S=y.exports;let v="undefined"!=typeof window?l.useLayoutEffect:l.useEffect;class w{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on("transaction",e),()=>{t.off("transaction",e)}}}}let k="undefined"==typeof window,C=k||!!("undefined"!=typeof window&&window.next);class E{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?k||C?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){let e={...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBeforeCreate)?void 0:n.call(t,...e)},onBlur:(...e)=>{var t,n;return null==(n=(t=this.options.current).onBlur)?void 0:n.call(t,...e)},onCreate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onCreate)?void 0:n.call(t,...e)},onDestroy:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDestroy)?void 0:n.call(t,...e)},onFocus:(...e)=>{var t,n;return null==(n=(t=this.options.current).onFocus)?void 0:n.call(t,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onSelectionUpdate)?void 0:n.call(t,...e)},onTransaction:(...e)=>{var t,n;return null==(n=(t=this.options.current).onTransaction)?void 0:n.call(t,...e)},onUpdate:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUpdate)?void 0:n.call(t,...e)},onContentError:(...e)=>{var t,n;return null==(n=(t=this.options.current).onContentError)?void 0:n.call(t,...e)},onDrop:(...e)=>{var t,n;return null==(n=(t=this.options.current).onDrop)?void 0:n.call(t,...e)},onPaste:(...e)=>{var t,n;return null==(n=(t=this.options.current).onPaste)?void 0:n.call(t,...e)}};return new a.KE(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(n)||("extensions"===n&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>{var r;return e===(null==(r=t.extensions)?void 0:r[n])}):e[n]===t[n]))}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===e.length?E.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function x(e={},t=[]){let n=(0,l.useRef)(e);n.current=e;let[r]=(0,l.useState)(()=>new E(n)),i=u.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,l.useDebugValue)(i),(0,l.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,l.useState)(()=>new w(e.editor)),r=S.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:g);v(()=>n.watch(e.editor),[e.editor,n]),(0,l.useDebugValue)(r)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}let M=(0,l.createContext)({editor:null});M.Consumer;let I=e=>{let[t,n]=(0,l.useState)(null),{editor:r}=(0,l.useContext)(M);return(0,l.useEffect)(()=>{var n;if(!t||(null==(n=e.editor)?void 0:n.isDestroyed)||(null==r?void 0:r.isDestroyed))return;let{pluginKey:i="bubbleMenu",editor:o,tippyOptions:l={},updateDelay:a,shouldShow:c=null}=e,d=o||r;if(!d)return void console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");let u=(0,s.V$)({updateDelay:a,editor:d,element:t,pluginKey:i,shouldShow:c,tippyOptions:l});return d.registerPlugin(u),()=>{d.unregisterPlugin(i)}},[e.editor,r,t]),l.default.createElement("div",{ref:n,className:e.className,style:{visibility:"hidden"}},e.children)},O=(0,l.createContext)({onDragStart:void 0}),D=()=>(0,l.useContext)(O),$=e=>{let t=e.as||"div",{nodeViewContentRef:n}=D();return l.default.createElement(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style}})},N=l.default.forwardRef((e,t)=>{let{onDragStart:n}=D(),r=e.as||"div";return l.default.createElement(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function R(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function T(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}class A{constructor(e,{editor:t,props:n={},as:r="div",className:i=""}){this.ref=null,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?(0,l.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var e;let t=this.component,n=this.props,r=this.editor,i=function(){try{if(l.version)return parseInt(l.version.split(".")[0],10)>=19}catch{}return!1}(),o=function(e){if(R(e)||T(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return R(t)||T(t)}return!1}(t),s={...n};s.ref&&!(i||o)&&delete s.ref,!s.ref&&(i||o)&&(s.ref=e=>{this.ref=e}),this.reactElement=l.default.createElement(t,{...s}),null==(e=null==r?void 0:r.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;let t=this.editor;null==(e=null==t?void 0:t.contentComponent)||e.removeRenderer(this.id)}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}}class V extends a.Yv{constructor(e,t,n){if(super(e,t,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");if(!e)return;e.appendChild(this.contentDOMElement)}}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,l.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper"),e.appendChild(this.contentDOMElement))}},n=this.component,r=(0,l.memo)(e=>l.default.createElement(O.Provider,{value:t},(0,l.createElement)(n,e)));r.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:o=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new A(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${o}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){let{from:e,to:t}=this.editor.state.selection,n=this.getPos();if("number"==typeof n)if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,n){let r=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,o=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n})})}return e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n}),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,n=(0,a.zU)(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}}function z(e,t){return n=>n.editor.contentComponent?new V(e,n,t):{}}},52674:function(e,t,n){"use strict";n.d(t,{$f:()=>$,G2:()=>S,I$:()=>E,Im:()=>R,Qv:()=>a,Sd:()=>y,Z1:()=>x,_G:()=>d,_e:()=>p,bh:()=>v,eB:()=>c,eT:()=>g,ec:()=>N,hy:()=>I,ic:()=>s,iz:()=>M,pC:()=>k,yY:()=>w,y_:()=>T});var r=n(97070),i=n(579),o=n(26469);let s=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function l(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let a=(e,t,n)=>{let s=l(e,n);if(!s)return!1;let a=f(s);if(!a){let n=s.blockRange(),i=n&&(0,r.jP)(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let c=a.nodeBefore;if(O(e,a,t,-1))return!0;if(0==s.parent.content.size&&(h(c,"end")||o.nh.isSelectable(c)))for(let n=s.depth;;n--){let l=(0,r.$L)(e.doc,s.before(n),s.after(n),i.Ji.empty);if(l&&l.slice.size1)break}return!!c.isAtom&&a.depth==s.depth-1&&(t&&t(e.tr.delete(a.pos-c.nodeSize,a.pos).scrollIntoView()),!0)},c=(e,t,n)=>{let r=l(e,n);if(!r)return!1;let i=f(r);return!!i&&u(e,i,t)},d=(e,t,n)=>{let r=m(e,n);if(!r)return!1;let i=b(r);return!!i&&u(e,i,t)};function u(e,t,n){let s=t.nodeBefore,l=t.pos-1;for(;!s.isTextblock;l--){if(s.type.spec.isolating)return!1;let e=s.lastChild;if(!e)return!1;s=e}let a=t.nodeAfter,c=t.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let e=a.firstChild;if(!e)return!1;a=e}let d=(0,r.$L)(e.doc,l,c,i.Ji.empty);if(!d||d.from!=l||d instanceof r.Ln&&d.slice.size>=c-l)return!1;if(n){let t=e.tr.step(d);t.setSelection(o.U3.create(t.doc,l)),n(t.scrollIntoView())}return!0}function h(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let p=(e,t,n)=>{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;s=f(r)}let l=s&&s.nodeBefore;return!!l&&!!o.nh.isSelectable(l)&&(t&&t(e.tr.setSelection(o.nh.create(e.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function f(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function m(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset{let s=m(e,n);if(!s)return!1;let l=b(s);if(!l)return!1;let a=l.nodeAfter;if(O(e,l,t,1))return!0;if(0==s.parent.content.size&&(h(a,"start")||o.nh.isSelectable(a))){let n=(0,r.$L)(e.doc,s.before(),s.after(),i.Ji.empty);if(n&&n.slice.size{let{$head:r,empty:i}=e.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let n=e.selection,i=n instanceof o.nh,s;if(i){if(n.node.isTextblock||!(0,r.n9)(e.doc,n.from))return!1;s=n.from}else if(null==(s=(0,r.N0)(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(s);i&&n.setSelection(o.nh.create(n.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0},v=(e,t)=>{let n=e.selection,i;if(n instanceof o.nh){if(n.node.isTextblock||!(0,r.n9)(e.doc,n.to))return!1;i=n.to}else if(null==(i=(0,r.N0)(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(i).scrollIntoView()),!0},w=(e,t)=>{let{$from:n,$to:i}=e.selection,o=n.blockRange(i),s=o&&(0,r.jP)(o);return null!=s&&(t&&t(e.tr.lift(o,s).scrollIntoView()),!0)},k=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function C(e){for(let t=0;t{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),l=C(i.contentMatchAt(s));if(!l||!i.canReplaceWith(s,s,l))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,l.createAndFill());i.setSelection(o.LN.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},x=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof o.i5||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=C(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if((0,r.zy)(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let i=n.blockRange(),o=i&&(0,r.jP)(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)},I=(e,t)=>{let{$from:n,to:r}=e.selection,i,s=n.sharedDepth(r);return 0!=s&&(i=n.before(s),t&&t(e.tr.setSelection(o.nh.create(e.doc,i))),!0)};function O(e,t,n,s){let l,a,c,d=t.nodeBefore,u=t.nodeAfter,p,f,m=d.type.spec.isolating||u.type.spec.isolating;if(!m&&(l=t.nodeBefore,a=t.nodeAfter,c=t.index(),l&&a&&l.type.compatibleContent(a.type)&&(!l.content.size&&t.parent.canReplace(c-1,c)?(n&&n(e.tr.delete(t.pos-l.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(c,c+1)&&!!(a.isTextblock||(0,r.n9)(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let g=!m&&t.parent.canReplace(t.index(),t.index()+1);if(g&&(p=(f=d.contentMatchAt(d.childCount)).findWrapping(u.type))&&f.matchType(p[0]||u.type).validEnd){if(n){let o=t.pos+u.nodeSize,s=i.FK.empty;for(let e=p.length-1;e>=0;e--)s=i.FK.from(p[e].create(null,s));s=i.FK.from(d.copy(s));let l=e.tr.step(new r.Wg(t.pos-1,o,t.pos,o,new i.Ji(s,1,0),p.length,!0)),a=l.doc.resolve(o+2*p.length);a.nodeAfter&&a.nodeAfter.type==d.type&&(0,r.n9)(l.doc,a.pos)&&l.join(a.pos),n(l.scrollIntoView())}return!0}let y=u.type.spec.isolating||s>0&&m?null:o.LN.findFrom(t,1),b=y&&y.$from.blockRange(y.$to),S=b&&(0,r.jP)(b);if(null!=S&&S>=t.depth)return n&&n(e.tr.lift(b,S).scrollIntoView()),!0;if(g&&h(u,"start",!0)&&h(d,"end")){let o=d,s=[];for(;s.push(o),!o.isTextblock;)o=o.lastChild;let l=u,a=1;for(;!l.isTextblock;l=l.firstChild)a++;if(o.canReplace(o.childCount,o.childCount,l.content)){if(n){let o=i.FK.empty;for(let e=s.length-1;e>=0;e--)o=i.FK.from(s[e].copy(o));n(e.tr.step(new r.Wg(t.pos-s.length,t.pos+u.nodeSize,t.pos+a,t.pos+u.nodeSize-a,new i.Ji(o,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function D(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(t.tr.setSelection(o.U3.create(t.doc,e<0?i.start(s):i.end(s)))),!0)}}let $=D(-1),N=D(1);function R(e,t=null){return function(n,i){let{$from:o,$to:s}=n.selection,l=o.blockRange(s),a=l&&(0,r.oM)(l,e,t);return!!a&&(i&&i(n.tr.wrap(l,a).scrollIntoView()),!0)}}function T(e,t=null){return function(n,r){let i=!1;for(let r=0;r{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r{let{$from:n,$to:i}=e.selection;if(e.selection instanceof o.nh&&e.selection.node.isBlock)return!!n.parentOffset&&!!(0,r.zy)(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],l,a,c=!1,d=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){let t;c=n.end(e)==n.pos+(n.depth-e),d=n.start(e)==n.pos-(n.depth-e),a=C(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));s.unshift(t||(c&&a?{type:a}:null)),l=e;break}if(1==e)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof o.U3||e.selection instanceof o.i5)&&u.deleteSelection();let h=u.mapping.map(n.pos),p=(0,r.zy)(u.doc,h,s.length,s);if(p||(s[0]=a?{type:a}:null,p=(0,r.zy)(u.doc,h,s.length,s)),!p)return!1;if(u.split(h,s.length,s),!c&&d&&n.node(l).type!=a){let e=u.mapping.map(n.before(l)),t=u.doc.resolve(e);a&&n.node(l-1).canReplaceWith(t.index(),t.index()+1,a)&&u.setNodeMarkup(u.mapping.map(n.before(l)),a)}return t&&t(u.scrollIntoView()),!0}),"Mod-Enter":E,Backspace:V,"Mod-Backspace":V,"Shift-Backspace":V,Delete:z,"Mod-Delete":z,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new o.i5(e.doc))),!0)},J={"Ctrl-h":F.Backspace,"Alt-Backspace":F["Mod-Backspace"],"Ctrl-d":F.Delete,"Ctrl-Alt-Backspace":F["Mod-Delete"],"Alt-Delete":F["Mod-Delete"],"Alt-d":F["Mod-Delete"],"Ctrl-a":$,"Ctrl-e":N};for(let e in F)J[e]=F[e];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform()},9204:function(e,t,n){"use strict";n.d(t,{$B:()=>l,Sd:()=>o,T2:()=>s});var r=n(97070),i=n(579);function o(e,t=null){return function(n,o){let{$from:s,$to:l}=n.selection,a=s.blockRange(l),c=!1,d=a;if(!a)return!1;if(a.depth>=2&&s.node(a.depth-1).type.compatibleContent(e)&&0==a.startIndex){if(0==s.index(a.depth-1))return!1;let e=n.doc.resolve(a.start-2);d=new i.u$(e,e,a.depth),a.endIndex=0;e--)l=i.FK.from(n[e].type.create(n[e].attrs,l));e.step(new r.Wg(t.start-2*!!o,t.end,t.start,t.end,new i.Ji(l,0,0),n.length,!0));let a=0;for(let e=0;et.childCount>0&&t.firstChild.type==e);return!!l&&(!n||(o.node(l.depth-1).type==e?function(e,t,n,o){let s=e.tr,l=o.end,a=o.$to.end(o.depth);lr;t--)e-=s.child(t).nodeSize,o.delete(e-1,e+1);let l=o.doc.resolve(n.start),a=l.nodeAfter;if(o.mapping.map(n.end)!=n.start+l.nodeAfter.nodeSize)return!1;let c=0==n.startIndex,d=n.endIndex==s.childCount,u=l.node(-1),h=l.index(-1);if(!u.canReplace(h+ +!c,h+1,a.content.append(d?i.FK.empty:i.FK.from(s))))return!1;let p=l.pos,f=p+a.nodeSize;return o.step(new r.Wg(p-!!c,f+ +!!d,p+1,f-1,new i.Ji((c?i.FK.empty:i.FK.from(s.copy(i.FK.empty))).append(d?i.FK.empty:i.FK.from(s.copy(i.FK.empty))),+!c,+!d),+!c)),t(o.scrollIntoView()),!0}(t,n,l)))}}function l(e){return function(t,n){let{$from:o,$to:s}=t.selection,l=o.blockRange(s,t=>t.childCount>0&&t.firstChild.type==e);if(!l)return!1;let a=l.startIndex;if(0==a)return!1;let c=l.parent,d=c.child(a-1);if(d.type!=e)return!1;if(n){let o=d.lastChild&&d.lastChild.type==c.type,s=i.FK.from(o?e.create():null),a=new i.Ji(i.FK.from(e.create(null,i.FK.from(c.type.create(null,s)))),o?3:1,0),u=l.start,h=l.end;n(t.tr.step(new r.Wg(u-(o?3:1),h,u,h,a,1,!0)).scrollIntoView())}return!0}}},26469:function(e,t,n){"use strict";n.d(t,{$t:()=>C,LN:()=>s,U3:()=>d,hs:()=>I,i5:()=>f,k_:()=>E,nh:()=>h});var r=n(579),i=n(97070);let o=Object.create(null);class s{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new l(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t=0;r--){let i=t<0?g(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):g(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))}static atStart(e){return g(e,e,0,0,1)||new f(e)}static atEnd(e){return g(e,e,e.content.size,e.childCount,-1)||new f(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=o[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in o)throw RangeError("Duplicate use of selection JSON ID "+e);return o[e]=t,t.prototype.jsonID=e,t}getBookmark(){return d.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class l{constructor(e,t){this.$from=e,this.$to=t}}let a=!1;function c(e){a||e.parent.inlineContent||(a=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class d extends s{constructor(e,t=e){c(e),c(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return s.near(n);let r=e.resolve(t.map(this.anchor));return new d(r.parent.inlineContent?r:n,n)}replace(e,t=r.Ji.empty){if(super.replace(e,t),t==r.Ji.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof d&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new u(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new d(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=s.findFrom(t,n,!0)||s.findFrom(t,-n,!0);if(!e)return s.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(s.findFrom(e,-n,!0)||s.findFrom(e,n,!0)).$anchor).posnew f(e)};function g(e,t,n,r,i,o=!1){if(t.inlineContent)return d.create(e,n);for(let s=r-(i>0?0:1);i>0?s=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&h.isSelectable(r))return h.create(e,n-(i<0?r.nodeSize:0))}else{let t=g(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function y(e,t,n){let r,o=e.steps.length-1;if(o{null==r&&(r=i)}),e.setSelection(s.near(e.doc.resolve(r),n)))}class b extends i.dL{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return r.CU.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.CU.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function S(e,t){return t&&e?e.bind(t):e}class v{constructor(e,t,n){this.name=e,this.init=S(t.init,n),this.apply=S(t.apply,n)}}let w=[new v("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new v("selection",{init:(e,t)=>e.selection||s.atStart(t.doc),apply:e=>e.selection}),new v("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new v("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class k{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=w.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new v(e.key,e.spec.state,e))})}}class C{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;ne.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let i=new k(e.schema,e.plugins),o=new C(i);return i.fields.forEach(i=>{if("doc"==i.name)o.doc=r.bP.fromJSON(e.schema,t.doc);else if("selection"==i.name)o.selection=s.fromJSON(o.doc,t.selection);else if("storedMarks"==i.name)t.storedMarks&&(o.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let r in n){let s=n[r],l=s.spec.state;if(s.key==i.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,r)){o[i.name]=l.fromJSON.call(s,e,t[r],o);return}}o[i.name]=i.init(e,o)}}),o}}class E{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:M("plugin")}getState(e){return e[this.key]}}let x=Object.create(null);function M(e){return e in x?e+"$"+ ++x[e]:(x[e]=0,e+"$")}class I{constructor(e="key"){this.key=M(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}}}]);