1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,96282,e=>{"use strict";var t=Object.defineProperty;e.s(["t",0,(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:"Module"}),r}])},94499,10552,63612,76399,56378,55841,34236,27427,3819,92326,2323,36110,33287,97643,36023,91583,89853,55716,2008,e=>{"use strict";let t,n;var r=e.i(47167),i=e.i(71645),o=e.i(74080),s=e.i(2239),l=e.i(43476),a=e.i(96282),d=e.i(74729),c=e.i(28762),h=e.i(27121);let u=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function p(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let f=(e,t,n)=>{let r=p(e,n);if(!r)return!1;let i=x(r);if(!i){let n=r.blockRange(),i=n&&(0,d.liftTarget)(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(T(e,i,t,-1))return!0;if(0==r.parent.content.size&&(g(o,"end")||h.NodeSelection.isSelectable(o)))for(let n=r.depth;;n--){let s=(0,d.replaceStep)(e.doc,r.before(n),r.after(n),c.Slice.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(g(o,"end")?h.Selection.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):h.NodeSelection.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)};function m(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=t.nodeAfter,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let l=(0,d.replaceStep)(e.doc,i,s,c.Slice.empty);if(!l||l.from!=i||l instanceof d.ReplaceStep&&l.slice.size>=s-i)return!1;if(n){let t=e.tr.step(l);t.setSelection(h.TextSelection.create(t.doc,i)),n(t.scrollIntoView())}return!0}function g(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 y=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=x(r)}let s=o&&o.nodeBefore;return!!s&&!!h.NodeSelection.isSelectable(s)&&(t&&t(e.tr.setSelection(h.NodeSelection.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function x(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 b(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let w=(e,t,n)=>{let r=b(e,n);if(!r)return!1;let i=k(r);if(!i)return!1;let o=i.nodeAfter;if(T(e,i,t,1))return!0;if(0==r.parent.content.size&&(g(o,"start")||h.NodeSelection.isSelectable(o))){let n=(0,d.replaceStep)(e.doc,r.before(),r.after(),c.Slice.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(g(o,"start")?h.Selection.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):h.NodeSelection.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},v=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=k(r)}let s=o&&o.nodeAfter;return!!s&&!!h.NodeSelection.isSelectable(s)&&(t&&t(e.tr.setSelection(h.NodeSelection.create(e.doc,o.pos)).scrollIntoView()),!0)};function k(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}let C=(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 N(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let S=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=N(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(h.Selection.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},M=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof h.AllSelection||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=N(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(h.TextSelection.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},j=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if((0,d.canSplit)(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&(0,d.liftTarget)(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function T(e,t,n,r){let i,o,s,l=t.nodeBefore,a=t.nodeAfter,u,p,f=l.type.spec.isolating||a.type.spec.isolating;if(!f&&(i=t.nodeBefore,o=t.nodeAfter,s=t.index(),i&&o&&i.type.compatibleContent(o.type)&&(!i.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(s,s+1)&&!!(o.isTextblock||(0,d.canJoin)(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let m=!f&&t.parent.canReplace(t.index(),t.index()+1);if(m&&(u=(p=l.contentMatchAt(l.childCount)).findWrapping(a.type))&&p.matchType(u[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=c.Fragment.empty;for(let e=u.length-1;e>=0;e--)i=c.Fragment.from(u[e].create(null,i));i=c.Fragment.from(l.copy(i));let o=e.tr.step(new d.ReplaceAroundStep(t.pos-1,r,t.pos,r,new c.Slice(i,1,0),u.length,!0)),s=o.doc.resolve(r+2*u.length);s.nodeAfter&&s.nodeAfter.type==l.type&&(0,d.canJoin)(o.doc,s.pos)&&o.join(s.pos),n(o.scrollIntoView())}return!0}let y=a.type.spec.isolating||r>0&&f?null:h.Selection.findFrom(t,1),x=y&&y.$from.blockRange(y.$to),b=x&&(0,d.liftTarget)(x);if(null!=b&&b>=t.depth)return n&&n(e.tr.lift(x,b).scrollIntoView()),!0;if(m&&g(a,"start",!0)&&g(l,"end")){let r=l,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=a,s=1;for(;!o.isTextblock;o=o.firstChild)s++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=c.Fragment.empty;for(let e=i.length-1;e>=0;e--)r=c.Fragment.from(i[e].copy(r));n(e.tr.step(new d.ReplaceAroundStep(t.pos-i.length,t.pos+a.nodeSize,t.pos+s,t.pos+a.nodeSize-s,new c.Slice(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function A(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(h.TextSelection.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let E=A(-1),R=A(1);function D(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{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<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function O(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let P=O(u,f,y),L=O(u,w,v),I={Enter:O(C,M,j,(e,t)=>{if(e.selection instanceof h.NodeSelection&&e.selection.node.isBlock){let{$from:n}=e.selection;return!!n.parentOffset&&!!(0,d.canSplit)(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let n=e.tr;!e.selection.empty&&(e.selection instanceof h.TextSelection||e.selection instanceof h.AllSelection)&&n.deleteSelection();let{$from:r}=n.selection,i=n.steps.length,o=[],s,l,a=!1,c=!1;for(let e=r.depth;;e--){if(r.node(e).isBlock){let t;a=r.end(e)==r.pos+(r.depth-e),c=r.start(e)==r.pos-(r.depth-e),l=N(r.node(e-1).contentMatchAt(r.indexAfter(e-1)));o.unshift(t||(a&&l?{type:l}:null)),s=e;break}if(1==e)return!1;o.unshift(null)}let u=r.pos,p=(0,d.canSplit)(n.doc,u,o.length,o);if(p||(o[0]=l?{type:l}:null,p=(0,d.canSplit)(n.doc,u,o.length,o)),!p)return!1;if(n.split(u,o.length,o),!a&&c&&r.node(s).type!=l){let e=n.mapping.slice(i),t=e.map(r.before(s)),o=n.doc.resolve(t);l&&r.node(s-1).canReplaceWith(o.index(),o.index()+1,l)&&n.setNodeMarkup(e.map(r.before(s)),l)}return t&&t(n.scrollIntoView()),!0}),"Mod-Enter":S,Backspace:P,"Mod-Backspace":P,"Shift-Backspace":P,Delete:L,"Mod-Delete":L,"Mod-a":(e,t)=>
1(t&&t(e.tr.setSelection(new h.AllSelection(e.doc))),!0)},z={"Ctrl-h":I.Backspace,"Alt-Backspace":I["Mod-Backspace"],"Ctrl-d":I.Delete,"Ctrl-Alt-Backspace":I["Mod-Delete"],"Alt-Delete":I["Mod-Delete"],"Alt-d":I["Mod-Delete"],"Ctrl-a":E,"Ctrl-e":R};for(let e in I)z[e]=I[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();let $=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},H=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},F=null,B=function(e,t,n){let r=F||(F=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},V=function(){F=null},_=function(e,t,n,r){return n&&(U(e,t,n,r,-1)||U(e,t,n,r,1))},W=/^(img|br|input|textarea|hr)$/i;function U(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:K(e))){let n=e.parentNode;if(!n||1!=n.nodeType||q(e)||W.test(e.nodeName)||"false"==e.contentEditable)return!1;t=$(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?K(e):0}}}function K(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function q(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let J=function(e){return e.focusNode&&_(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Y(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let X="u">typeof navigator?navigator:null,G="u">typeof document?document:null,Z=X&&X.userAgent||"",Q=/Edge\/(\d+)/.exec(Z),ee=/MSIE \d/.exec(Z),et=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Z),en=!!(ee||et||Q),er=ee?document.documentMode:et?+et[1]:Q?+Q[1]:0,ei=!en&&/gecko\/(\d+)/i.test(Z);ei&&(/Firefox\/(\d+)/.exec(Z)||[0,0])[1];let eo=!en&&/Chrome\/(\d+)/.exec(Z),es=!!eo,el=eo?+eo[1]:0,ea=!en&&!!X&&/Apple Computer/.test(X.vendor),ed=ea&&(/Mobile\/\w+/.test(Z)||!!X&&X.maxTouchPoints>2),ec=ed||!!X&&/Mac/.test(X.platform),eh=!!X&&/Win/.test(X.platform),eu=/Android \d/.test(Z),ep=!!G&&"webkitFontSmoothing"in G.documentElement.style,ef=ep?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function em(e,t){return"number"==typeof e?e:e[t]}function eg(e,t,n){if(!ev(t)&&0==t.left)return;let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=H(s);continue}let e=s,n=e==o.body,l=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(o):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),a=0,d=0;if(t.top<l.top+em(r,"top")?d=-(l.top-t.top+em(i,"top")):t.bottom>l.bottom-em(r,"bottom")&&(d=t.bottom-t.top>l.bottom-l.top?t.top+em(i,"top")-l.top:t.bottom-l.bottom+em(i,"bottom")),t.left<l.left+em(r,"left")?a=-(l.left-t.left+em(i,"left")):t.right>l.right-em(r,"right")&&(a=t.right-l.right+em(i,"right")),a||d)if(n)o.defaultView.scrollBy(a,d);else{let n=e.scrollLeft,r=e.scrollTop;d&&(e.scrollTop+=d),a&&(e.scrollLeft+=a);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let c=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(c))break;s="absolute"==c?s.offsetParent:H(s)}}function ey(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=H(r));return t}function ex(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let eb=null;function ew(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function ev(e){return e.top<e.bottom||e.left<e.right}function ek(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(ev(e))return e}return Array.prototype.find.call(n,ev)||e.getBoundingClientRect()}let eC=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
vendor: 9,498 bytes, line 1
1function eN(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=ep||ei;if(3==r.nodeType)if(s&&(eC.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=ek(B(r,i,i),n);if(ei&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=ek(B(r,i-1,i-1),-1);if(t.top==e.top){let n=ek(B(r,i,i+1),-1);if(n.top!=e.top)return eS(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,eS(ek(B(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==K(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return eM(e.getBoundingClientRect(),!1)}if(null==o&&i<K(r)){let e=r.childNodes[i];if(1==e.nodeType)return eM(e.getBoundingClientRect(),!0)}return eM(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==K(r))){let e=r.childNodes[i-1],t=3==e.nodeType?B(e,K(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return eS(ek(t,1),!1)}if(null==o&&i<K(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?B(e,0,+!s):1==e.nodeType?e:null:null;if(t)return eS(ek(t,-1),!0)}return eS(ek(3==r.nodeType?B(r):r,-n),n>=0)}function eS(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function eM(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function ej(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let eT=/[\u0590-\u08ac]/,eA=null,eE=null,eR=!1;class eD{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>$(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>e||i instanceof eH){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof eO&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?$(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?$(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],l=o+n.size;if(-1==r&&e<=l){let i=o+n.border;if(e>=i&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=$(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||s==this.children.length-1)){t=l;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=$(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,l=0;s<this.children.length;s++){let a=this.children[s],d=l+a.size;if(i>l&&o<d)return a.setSelection(e-l-a.border,t-l-a.border,n,r);l=d}let s=this.domFromPos(e,e?-1:1),l=t==e?s:this.domFromPos(t,t?-1:1),a=n.root.getSelection(),d=n.domSelectionRange(),c=!1;if((ei||ea)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((c=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=l={node:n.parentNode,offset:$(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(ei&&d.focusNode&&d.focusNode!=l.node&&1==d.focusNode.nodeType){let e=d.focusNode.childNodes[d.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||c&&ea)&&_(s.node,s.offset,d.anchorNode,d.anchorOffset)&&_(l.node,l.offset,d.focusNode,d.focusOffset))return;let h=!1;if((a.extend||e==t)&&!(c&&ei)){a.collapse(s.node,s.offset);try{e!=t&&a.extend(l.node,l.offset),h=!0}catch(e){}}if(!h){if(e>t){let e=s;s=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class eO extends eD{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.hasAttribute("contenteditable")||(o.contentEditable="false"),o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class eP extends eD{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class eL extends eD{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}
1static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=c.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new eL(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=eL.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=eX(i,t,o,n)),e>0&&(i=eX(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class eI extends eD{constructor(e,t,n,r,i,o,s){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],l,a=s&&s(t,i,()=>l?l.parent?l.parent.posBeforeChild(l):void 0:o,n,r),d=a&&a.dom,h=a&&a.contentDOM;if(t.isText)if(d){if(3!=d.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(t.text);else if(!d){let e=c.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:d,contentDOM:h}=e)}h||t.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let u=d;return(d=eU(d,n,t),a)?l=new eF(e,t,n,r,d,h||null,u,a):t.isText?new e$(e,t,n,r,d,u):new eI(e,t,n,r,d,h||null,u)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>1==t.nodeType&&0>e.indexOf(t.parentNode)&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>c.Fragment.empty}}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&eK(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new eJ(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,l=[],a=null;for(let d=0;;){let c,h,u,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(c?(h||(h=[c])).push(e):c=e)}if(c)if(h){h.sort(eY);for(let e=0;e<h.length;e++)n(h[e],d,!!a)}else n(c,d,!!a);if(a)p=-1,u=a,a=null;else if(d<e.childCount)p=d,u=e.child(d++);else break;for(let e=0;e<l.length;e++)l[e].to<=o&&l.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let f=o+u.nodeSize;if(u.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(a=u.cut(e-o),u=u.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=u.isInline&&!u.isLeaf?l.filter(e=>!e.inline):l.slice();r(u,m,t.forChild(o,u),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&l.syncToMarks(i==this.node.childCount?c.Mark.none:this.node.child(i).marks,n,e,i),l.placeWidget(t,e,r)},(t,o,a,d)=>{let c;l.syncToMarks(t.marks,n,e,d),l.findNodeMatch(t,o,a,d)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(c=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,o,a,c,e)||l.updateNextNode(t,o,a,e,d,r)||l.addNode(t,o,a,e,r),r+=t.nodeSize}),l.syncToMarks([],n,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let l=n[s],a=l.dom;if(a.parentNode==t){for(;a!=i;)i=eq(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(a,i);if(l instanceof eL){let n=i?i.previousSibling:t.lastChild;e(l.contentDOM,l.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=eq(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),ed&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof h.TextSelection)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;a+=t.text}
1if(o>=n){if(o>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new eP(this,i,t,r);e.input.compositionNodes.push(o),this.children=eX(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(eK(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=eW(this.dom,this.nodeDOM,e_(this.outerDeco,this.node,t),e_(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ez(e,t,n,r,i){eU(r,t,e);let o=new eI(void 0,e,t,n,r,r,r);return o.contentDOM&&o.updateChildren(i,0),o}class e$ extends eI{constructor(e,t,n,r,i,o){super(e,t,n,r,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new e$(this.parent,r,this.outerDeco,this.innerDeco,i,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class eH extends eD{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class eF extends eI{constructor(e,t,n,r,i,o,s,l){super(e,t,n,r,i,o,s),this.spec=l}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let eB=function(e){e&&(this.nodeName=e)};eB.prototype=Object.create(null);let eV=[new eB];function e_(e,t,n){if(0==e.length)return eV;let r=n?eV[0]:new eB,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new eB(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new eB(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function eW(e,t,n,r){if(n==eV&&r==eV)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=eV[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);
1if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,s||eV[0],o)}return i}function eU(e,t,n){return eW(e,e,eV,e_(t,n,1!=e.nodeType))}function eK(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function eq(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class eJ{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];e:for(;i>0;){let l;for(;;)if(r){let e=n.children[r-1];if(e instanceof eL)n=e,r=e.children.length;else{l=e,r--;break}}else if(n==t)break e;else r=n.parent.children.indexOf(n),n=n.parent;let a=l.node;if(a){if(a!=e.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof eL&&3!=t.dirty&&t.mark.type==e[o].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[o])&&(t.mark=e[o],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=eL.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof eI){let a=this.preMatch.matched.get(l);if(null!=a&&a!=i)return!1;let d=l.dom,c,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&eK(t,l.outerDeco));if(!h&&l.update(e,t,n,r))return this.destroyBetween(this.index,s),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(l,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,o+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!eK(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=eI.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=eI.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new eO(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof eL;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof e$)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ea||es)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new eH(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}
1isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function eY(e,t){return e.type.side-t.type.side}function eX(e,t,n,r,i){let o=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],d=l,c=l+=a.size;d>=n||c<=t?o.push(a):(d<t&&o.push(a.slice(0,t-d,r)),i&&(o.push(i),i=void 0),c>n&&o.push(a.slice(n-d,a.size,r)))}return o}function eG(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,d;if(J(n)){for(a=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&h.NodeSelection.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==K(e);r||i;){if(e==n)return!0;let t=$(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==K(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;d=new h.NodeSelection(s==e?l:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[a,s]=i==e.state.selection.anchor?[i,t]:[t,i],l=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let c=r.resolve(a);if(!d){let n="pointer"==t||e.state.selection.head<l.pos&&!o?1:-1;d=e6(e,c,l,n)}return d}function eZ(e){return e.editable?e.hasFocus():e8(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function eQ(e,t=!1){let n=e.state.selection;if(e5(e,n),!eZ(e))return;let r=e.input.mouseDown;if(!t&&es&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&_(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate())return void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,$(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&en&&er<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var i;let r,o,s,l,{anchor:a,head:d}=n,c,u;e0&&!(n instanceof h.TextSelection)&&(n.$from.parent.inlineContent||(c=e1(e,n.from)),n.empty||n.$from.parent.inlineContent||(u=e1(e,n.to))
1),e.docView.setSelection(a,d,e,t),e0&&(c&&e3(c),u&&e3(u)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((r=(i=e).dom.ownerDocument).removeEventListener("selectionchange",i.input.hideSelectionGuard),s=(o=i.domSelectionRange()).anchorNode,l=o.anchorOffset,r.addEventListener("selectionchange",i.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=l)&&(r.removeEventListener("selectionchange",i.input.hideSelectionGuard),setTimeout(()=>{(!eZ(i)||i.state.selection.visible)&&i.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}let e0=ea||es&&el<63;function e1(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(ea&&i&&"false"==i.contentEditable)return e2(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return e2(i);else if(o)return e2(o)}}function e2(e){return e.contentEditable="true",ea&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function e3(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function e5(e,t){if(t instanceof h.NodeSelection){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(e4(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else e4(e)}function e4(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function e6(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||h.TextSelection.between(t,n,r)}function e7(e){return(!e.editable||!!e.hasFocus())&&e8(e)}function e8(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function e9(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&h.Selection.findFrom(o,t)}function te(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function tt(e,t,n){let r=e.state.selection;if(r instanceof h.TextSelection){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return te(e,new h.TextSelection(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=e9(e.state,t);return!!n&&n instanceof h.NodeSelection&&te(e,n)}else if(!(ec&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(h.NodeSelection.isSelectable(i)?te(e,new h.NodeSelection(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!ep&&te(e,new h.TextSelection(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof h.NodeSelection&&r.node.isInline)return te(e,new h.TextSelection(t>0?r.$to:r.$from));let n=e9(e.state,t);return!!n&&te(e,n)}}function tn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tr(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function ti(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(ei&&1==n.nodeType&&r<tn(n)&&tr(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(tr(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(to(n))break;else{let t=n.previousSibling;for(;t&&tr(t,-1);)i=n.parentNode,o=$(t),t=t.previousSibling;if(t)r=tn(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?ts(e,n,r):i&&ts(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=tn(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(tr(i.childNodes[o],1))t=i,n=++o;else break}else if(to(i))break;else{let r=i.nextSibling;for(;r&&tr(r,1);)t=r.parentNode,n=$(r)+1,r=r.nextSibling;if(r)o=0,s=tn(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&ts(e,t,n)}(e)}function to(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function ts(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!q(e);)t=$(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];
1if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!q(e);)t=$(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(J(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&eQ(e)},50)}function tl(e,t){let n=e.state.doc.resolve(t);if(!(es||eh)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function ta(e,t,n){let r=e.state.selection;if(r instanceof h.TextSelection&&!r.empty||n.indexOf("s")>-1||ec&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=e9(e.state,t);if(n&&n instanceof h.NodeSelection)return te(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof h.AllSelection?h.Selection.near(n,t):h.Selection.findFrom(n,t);return!!s&&te(e,s)}return!1}function td(e,t){if(!(e.state.selection instanceof h.TextSelection))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function tc(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function th(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||c.DOMSerializer.fromSchema(e.state.schema),l=tx(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let d=a.firstChild,h,u=0;for(;d&&1==d.nodeType&&(h=ty[d.nodeName.toLowerCase()]);){for(let e=h.length-1;e>=0;e--){let t=l.createElement(h[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),u++}d=a.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:a,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function tu(e,t,n,r,i){let o,s,l=i.parent.type.spec.code;if(!n&&!t)return null;let a=!!t&&(r||l||!n);if(a){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return s=new c.Slice(c.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,s=c.DOMSerializer.fromSchema(r);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),o=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=tx(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),o;if((o=i&&ty[i[1].toLowerCase()])&&(e=o.map(e=>"<"+e+">").join("")+e+o.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;if(!tb){if(tb=t.defaultPolicy)try{return tb.createHTML(e)}catch(e){}tb=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})}return tb.createHTML(e)}(e),o)for(let e=0;e<o.length;e++)r=r.querySelector(o[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}(n),ep&&function(e){let t=e.querySelectorAll(es?"span:not([class]):not
1([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&"Â "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);let d=o&&o.querySelector("[data-pm-slice]"),h=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||c.DOMParser.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||h),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||tp.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)s=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:s}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{t.checkAttrs(r[e+1])}catch(e){break}i=c.Fragment.from(t.create(r[e+1],i)),o++,s++}return new c.Slice(i,o,s)}(tg(s,+h[1],+h[2]),h[4]);else if((s=c.Slice.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,o=[];if(e.forEach(e=>{if(!o)return;let t=r.findWrapping(e.type),n;if(!t)return o=null;if(n=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){let s=e(t,n,r,i.lastChild,o+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(c.Fragment.from(tf(r,t,o+1))))}}(t,i,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(c.Fragment.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));let n=tf(e,t);o.push(n),r=r.matchType(n.type),i=t}}),o)return c.Fragment.from(o)}return e}(s.content,i),!0)).openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=tg(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,a)}),s}let tp=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function tf(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,c.Fragment.from(e));return e}function tm(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(o=0),i<r-1&&(l=tm(l,t,n,r,i+1,o)),i>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(c.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function tg(e,t,n){return t<e.openStart&&(e=new c.Slice(tm(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new c.Slice(tm(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let ty={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function tx(){return document.implementation.createHTMLDocument("title")}let tb=null,tw={},tv={},tk={touchstart:!0,touchmove:!0};class tC{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function tN(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function tS(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>tM(e,t))})}function tM(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function tj(e){return{left:e.clientX,top:e.clientY}}function tT(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function tA(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function tE(e,t,n){let r=e.state.doc;if(-1==t)return r.inlineContent?h.TextSelection.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),o=i.before(e);if(t.inlineContent)return h.TextSelection.create(r,o+1,o+1+t.content.size);if(n&&h.NodeSelection.isSelectable(t))return h.NodeSelection.create(r,o)}return null}tv.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!tL(e))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!eu||!es||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!ed||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&
1(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||ec&&72==r&&"c"==i)return td(e,-1)||ti(e,-1);if(46==r&&!t.shiftKey||ec&&68==r&&"c"==i)return td(e,1)||ti(e,1);if(13==r||27==r)return!0;if(37==r||ec&&66==r&&"c"==i){let t=37==r?"ltr"==tl(e,e.state.selection.from)?-1:1:-1;return tt(e,t,i)||ti(e,t)}if(39==r||ec&&70==r&&"c"==i){let t=39==r?"ltr"==tl(e,e.state.selection.from)?1:-1:1;return tt(e,t,i)||ti(e,t)}else if(38==r||ec&&80==r&&"c"==i)return ta(e,-1,i)||ti(e,-1);else if(40==r||ec&&78==r&&"c"==i)return function(e){if(!ea||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;tc(e,n,"true"),setTimeout(()=>tc(e,n,"false"),20)}return!1}(e)||ta(e,1,i)||ti(e,1);else if(i==(ec?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():tN(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,Y(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},tv.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},tv.keypress=(e,t)=>{if(tL(e)||!t.charCode||t.ctrlKey&&!t.altKey||ec&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof h.TextSelection)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let tR=ec?"metaKey":"ctrlKey";tw.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=tH(e),s=Date.now(),l="singleClick";s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[tR]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?l="doubleClick":"doubleClick"==e.input.lastClick.type&&(l="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:l,button:t.button},e.input.mouseDown&&e.input.mouseDown.done();let a=e.posAtCoords(tj(t));a&&("singleClick"==l?e.input.mouseDown=new tO(e,a,t,!!o):("doubleClick"==l?function(e,t,n,r){return tT(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return tT(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=tE(e,t,!0),i=e.state.doc;return!!r&&(tA(e,r,"pointer"),r instanceof h.TextSelection&&i.eq(e.state.doc)&&(e.input.mouseDown=new tP(e,r)),!0)}(e,n,r)})(e,a.pos,a.inside,t)?t.preventDefault():tN(e,"pointer"))};class tD{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){0==e.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class tO extends tD{constructor(e,t,n,r){let i,o;if(super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[tR],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:a}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||a instanceof h.NodeSelection&&a.from<=o&&a.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ei&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),tN(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||eQ(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(tj(e))),this.updateAllowDefault(e),this.allowDefault||!t)tN(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,tT(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof h.NodeSelection&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(h.NodeSelection.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(tA(e,h.NodeSelection.create(e.state.doc,i),"pointer"),
1!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&h.NodeSelection.isSelectable(r))&&(tA(e,new h.NodeSelection(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||ea&&this.mightDrag&&!this.mightDrag.node.isAtom||es&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(tA(this.view,h.Selection.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):tN(this.view,"pointer")}}move(e){this.updateAllowDefault(e),tN(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class tP extends tD{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(0==e.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();e.preventDefault(),tN(this.view,"pointer");let t=this.view.posAtCoords(tj(e)),n=t&&tE(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[o,s]=n.from<i.from?[i.to,n.from]:[i.from,n.to];tA(this.view,h.TextSelection.create(r,o,s),"pointer")}}function tL(e,t){return!!e.composing||!!(ea&&500>Math.abs(Date.now()-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}tw.touchstart=e=>{e.input.lastTouch=Date.now(),tH(e),tN(e,"pointer")},tw.touchmove=e=>{e.input.lastTouch=Date.now(),tN(e,"pointer")},tw.contextmenu=e=>tH(e);let tI=eu?5e3:-1;function tz(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>tH(e),t))}function t$(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function tH(e,t=!1){if(!eu||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),t$(e),t||e.docView&&e.docView.dirty){let n=eG(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}tv.compositionstart=tv.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof h.TextSelection&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||es&&eh&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),tH(e,!0),e.markCursor=null;else if(tH(e,!t.selection.empty),ei&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}tz(e,tI)},tv.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,tz(e,20))};let tF=en&&er<15||ed&&ef<604;function tB(e,t,n,r,i){let o=tu(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||c.Slice.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,l=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function tV(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;
1let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}tw.copy=tv.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=tF?null:t.clipboardData,{dom:o,text:s}=th(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},tv.paste=(e,t)=>{if(e.composing&&!eu)return;let n=tF?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&tB(e,tV(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?tB(e,r.value,null,i,t):tB(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class t_{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let tW=ec?"altKey":"ctrlKey";function tU(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[tW]}for(let e in tw.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(tj(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof h.NodeSelection?i.to-1:i.to));else if(r&&r.mightDrag)n=h.NodeSelection.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=h.NodeSelection.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:l,text:a,slice:d}=th(e,s);t.dataTransfer.files.length&&es&&!(el>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(tF?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",tF||t.dataTransfer.setData("text/plain",a),e.dragging=new t_(d,tU(e,t),n)},tw.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},tv.dragover=tv.dragenter=(e,t)=>t.preventDefault(),tv.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(tj(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=tu(e,tV(t.dataTransfer),tF?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&tU(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||c.Slice.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let l=o?(0,d.dropPoint)(e.state.doc,i.pos,o):i.pos;null==l&&(l=i.pos);let a=e.state.tr;if(s){let{node:e}=n;e?e.replace(a):a.deleteSelection()}let u=a.mapping.map(l),p=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,f=a.doc;if(p?a.replaceRangeWith(u,u,o.content.firstChild):a.replaceRange(u,u,o),a.doc.eq(f))return;let m=a.doc.resolve(u);if(p&&h.NodeSelection.isSelectable(o.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new h.NodeSelection(m));else{let t=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection(e6(e,m,a.doc.resolve(t)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},tw.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&eQ(e)},20))},tw.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},tw.beforeinput=(e,t)=>{if(eu&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,Y(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},tv)tw[e]=tv[e];function tK(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class tq{constructor(e,t){this.toDOM=e,this.spec=t||tZ,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new tX(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof tq&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&tK(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class tJ{constructor(e,t){this.attrs=e,this.spec=t||tZ}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new tX(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof tJ&&tK(this.attrs,e.attrs)&&tK(this.spec,e.spec)}static is(e){return e.type instanceof tJ}destroy(){}}class tY{constructor(e,t){this.attrs=e,this.spec=t||tZ}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new tX(i.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof tY&&tK(this.attrs,e.attrs)&&tK(this.spec,e.spec)}destroy(){}}class tX{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new tX(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new tX(e,e,new tq(t,n))}static inline(e,t,n,r){return new tX(e,t,new tJ(n,r))}
vendor: 10,702 bytes, line 1
1static node(e,t,n,r){return new tX(e,t,new tY(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof tJ}get widget(){return this.type instanceof tq}}let tG=[],tZ={};class tQ{constructor(e,t){this.local=e.length?e:tG,this.children=t.length?t:tG}static create(e,t){return t.length?t4(t,e,0,tZ):t0}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==t0||0==e.maps.length?this:this.mapInner(e,t,0,0,n||tZ)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,r);l&&l.type.valid(t,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let l=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<l.length;i+=3){let o=l[i+1];if(o<0||e>o+t-r)continue;let a=l[i]+t-r;n>=a?l[i+1]=e<=a?-2:-1:e>=t&&s&&(l[i]+=s,l[i+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){a=!0,l[t+1]=-1;continue}let d=n.map(e[t]+o),c=d-i;if(c<0||c>=r.content.size){a=!0;continue}let h=n.map(e[t+1]+o,-1)-i,{index:u,offset:p}=r.content.findIndex(c),f=r.maybeChild(u);if(f&&p==c&&p+f.nodeSize==h){let r=l[t+2].mapInner(n,f,d+1,e[t]+o+1,s);r!=t0?(l[t]=c,l[t+1]=h,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=t4(function(e,t,n,r,i,o,s){for(let l=0;l<e.length;l+=3)-1==e[l+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let l=t.local[e].map(r,i,o);l?n.push(l):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[l+2],t[l]+o+1);return n}(l,e,t,n,i,o,s),r,0,s);t=a.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<a.children.length;e+=3){let n=a.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,a.children[e],a.children[e+1],a.children[e+2])}}return new tQ(t.sort(t6),l)}(this.children,o||[],e,t,n,r,i):o?new tQ(o.sort(t6),tG):t0}add(e,t){return t.length?this==t0?tQ.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,l;if(l=t3(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,l,s+1):r.splice(i,0,o,o+e.nodeSize,t4(l,e,s+1,tZ)),i+=3}});let o=t2(i?t5(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new tQ(o.length?this.local.concat(o).sort(t6):this.local,r||this.children)}remove(e){return 0==e.length||this==t0?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(i,o+1);l!=t0?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new tQ(r,n):t0}forChild(e,t){let n,r;if(this==t0)return this;if(t.isLeaf)return tQ.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof tJ){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new tQ(r.sort(t6),tG);return n?new t1([e,n]):e}return n||t0}eq(e){if(this==e)return!0;if(!(e instanceof tQ)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return t7(this.localsInner(e))}localsInner(e){if(this==t0)return tG;if(e.inlineContent||!this.local.some(tJ.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof tJ||t.push(this.local[e]);return t}forEachSet(e){e(this)}}tQ.empty=new tQ([],[]),tQ.removeOverlap=t7;let t0=tQ.empty;class t1{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,tZ));return t1.from(n)}forChild(e,t){if(t.isLeaf)return tQ.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=t0&&(i instanceof t1?n=n.concat(i.members):n.push(i))}return t1.from(n)}eq(e){if(!(e instanceof t1)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?t7(n?t:t.sort(t6)):tG}static from(e){switch(e.length){case 0:return t0;case 1:return e[0];default:return new t1(e.every(e=>e instanceof tQ)?e:e.reduce((e,t)=>e.concat(t instanceof tQ?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function t2(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new tX(i.from+t,i.to+t,i.type))}return n}function t3(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function t5(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function t4(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let l=t3(e,t,s+n);if(l){o=!0;let e=t4(l,t,n+s+1,r);e!=t0&&i.push(s,s+t.nodeSize,e)}});let s=t2(o?t5(e):e,-n).sort(t6);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new tQ(s,i):t0}function t6(e,t){return e.from-t.from||e.to-t.to}function t7(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),t8(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),t8(t,i,r.copy(o.from,r.to)));break}}return t}function t8(e,t,n){for(;t<e.length&&t6(n,e[t])>0;)t++;e.splice(t,0,n)}function t9(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=t0&&t.push(r)}),e.cursorWrapper&&t.push(tQ.create(e.state.doc,[e.cursorWrapper.deco])),t1.from(t)}let ne={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},nt=en&&er<=11;class nn{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class nr{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new nn,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);en&&er<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():ea&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),nt&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ne)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(e7(this.view)){if(this.suppressingSelectionUpdates)return eQ(this.view);if(en&&er<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&_(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=H(n))t.add(n);for(let r=e.anchorNode;r;r=H(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&e7(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],a);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(l=!0))}if(a.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||es&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(e=>
1"childList"==e.type&&e.removedNodes.length))){for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(ei&&a.length){let e=a.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}let d=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&J(r)&&(d=eG(t))&&d.eq(h.Selection.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,eQ(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!ni.has(e)&&(ni.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=ei,no||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),no=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,a)),this.handleDOMChange(o,s,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||eQ(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(en&&er<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?$(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?$(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ni=new WeakMap,no=!1;function ns(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return _(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}let nl=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function na(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:e6(e,t.resolve(n.anchor),t.resolve(n.head))}function nd(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}class nc{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new tC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(nm),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=np(this),nu(this),this.nodeViews=nf(this),this.docView=ez(this.state.doc,nh(this),t9(this),this.dom,this),this.domObserver=new nr(this,(e,t,n,r)=>(function(e,t,n,r,i){let o,s,l,a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=eG(e,t);
1if(n&&!e.state.selection.eq(n)){if(es&&eu&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,Y(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),a&&r.setMeta("composition",a),e.dispatch(r)}return}let d=e.state.doc.resolve(t),u=d.sharedDepth(n);t=d.before(u+1),n=e.state.doc.resolve(n).after(u+1);let p=e.state.selection,f=function(e,t,n,r){let i,o,{node:s,fromOffset:l,toOffset:a,from:d,to:h}=e.docView.parseRange(t,n),u=e.domSelectionRange(),p=u.anchorNode;if(p&&e.dom.contains(1==p.nodeType?p:p.parentNode)&&(o=[{node:p,offset:u.anchorOffset}],J(u)||o.push({node:u.focusNode,offset:u.focusOffset})),es&&8===e.input.lastKeyCode)for(let e=a;e>l;e--){let t=s.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){a=e;break}if(!n||n.size)break}let f=e.state.doc,m=e.someProp("domParser")||c.DOMParser.fromSchema(e.state.schema),g=f.resolve(d),y=null,x=m.parse(s,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:l,to:a,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",findPositions:o,ruleFromNode:(i=r,e=>{let t=e.pmViewDesc;if(t)return t.parseRule(i);if("BR"==e.nodeName&&e.parentNode){if(ea&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||ea&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}),context:g});if(o&&null!=o[0].pos){let e=o[0].pos,t=o[1]&&o[1].pos;null==t&&(t=e),y={anchor:e+d,head:t+d}}return{doc:x,sel:y,from:d,to:h}}(e,t,n,i),m=e.state.doc,g=m.slice(f.from,f.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(o=e.state.selection.to,s="end"):(o=e.state.selection.from,s="start"),e.input.lastKeyCode=null;let y=function(e,t,n,r,i){let o=e.findDiffStart(t,n),s=n+e.size,l=n+t.size;if(null==o)return null;let{a:a,b:d}=e.findDiffEnd(t,s,l);if("end"==i){let e=Math.max(0,o-Math.min(a,d));r-=a+e-o}if(a<o&&s<l){let e=r<=o&&r>=a?o-r:0;o-=e,d=o+(d-a),a=o}else if(d<o){let e=r<=o&&r>=d?o-r:0;o-=e,a=o+(a-d),d=o}return{start:o,endA:a,endB:d}}(g.content,f.doc.content,f.from,o,s);if(y&&e.input.domChangeCount++,(ed&&e.input.lastIOSEnter>Date.now()-225||eu)&&i.some(e=>1==e.nodeType&&!nl.test(e.nodeName))&&(!y||y.endA>=y.endB)&&e.someProp("handleKeyDown",t=>t(e,Y(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!y)if(r&&p instanceof h.TextSelection&&!p.empty&&p.$head.sameParent(p.$anchor)&&!e.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))y={start:p.from,endA:p.to,endB:p.to};else{if(f.sel){let t=na(e,e.state.doc,f.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta("composition",a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&y.start==y.endB&&e.state.selection instanceof h.TextSelection&&(y.start>e.state.selection.from&&y.start<=e.state.selection.from+2&&e.state.selection.from>=f.from?y.start=e.state.selection.from:y.endA<e.state.selection.to&&y.endA>=e.state.selection.to-2&&e.state.selection.to<=f.to&&(y.endB+=e.state.selection.to-y.endA,y.endA=e.state.selection.to)),en&&er<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>f.from&&" Â "==f.doc.textBetween(y.start-f.from-1,y.start-f.from+1)&&(y.start--,y.endA--,y.endB--);let x=f.doc.resolveNoCache(y.start-f.from),b=f.doc.resolveNoCache(y.endB-f.from),w=m.resolve(y.start),v=x.sameParent(b)&&x.parent.inlineContent&&w.end()>=y.endA;if((ed&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!v&&x.pos<f.doc.content.size&&(!x.sameParent(b)||!x.parent.inlineContent)&&x.pos<b.pos&&!/\S/.test(f.doc.textBetween(x.pos,b.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,Y(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>y.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||nd(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(nd(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||nd(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(m,y.start,y.endA,x,b)&&e.someProp("handleKeyDown",t=>t(e,Y(8,"Backspace")))){eu&&es&&e.domObserver.suppressSelectionUpdates();return}
vendor: 5,057 bytes, line 1
1es&&y.endB==y.start&&(e.input.lastChromeDelete=Date.now()),eu&&!v&&x.start()!=b.start()&&0==b.parentOffset&&x.depth==b.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==y.endA&&(y.endB-=2,b=f.doc.resolveNoCache(y.endB-f.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,Y(13,"Enter"))})},20));let k=y.start,C=y.endA,N=t=>{let n=t||e.state.tr.replace(k,C,f.doc.slice(y.start-f.from,y.endB-f.from));if(f.sel){let t=na(e,n.doc,f.sel);t&&!(es&&e.composing&&t.empty&&(y.start!=y.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==k||t.head==n.mapping.map(C)-1)||en&&t.empty&&t.head==k)&&n.setSelection(t)}return a&&n.setMeta("composition",a),n.scrollIntoView()};if(v)if(x.pos==b.pos){en&&er<=11&&0==x.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>eQ(e),20));let t=N(e.state.tr.delete(k,C)),n=m.resolve(y.start).marksAcross(m.resolve(y.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(y.endA==y.endB&&(l=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,s,l,a;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(1==i.length&&0==o.length)l=i[0],s="add",a=e=>e.mark(l.addToSet(e.marks));else{if(0!=i.length||1!=o.length)return null;l=o[0],s="remove",a=e=>e.mark(l.removeFromSet(e.marks))}let d=[];for(let e=0;e<t.childCount;e++)d.push(a(t.child(e)));if(c.Fragment.from(d).eq(e))return{mark:l,type:s}}(x.parent.content.cut(x.parentOffset,b.parentOffset),w.parent.content.cut(w.parentOffset,y.endA-w.start())))){let t=N(e.state.tr);"add"==l.type?t.addMark(k,C,l.mark):t.removeMark(k,C,l.mark),e.dispatch(t)}else if(x.parent.child(x.index()).isText&&x.index()==b.index()-!b.textOffset){let t=x.parent.textBetween(x.parentOffset,b.parentOffset),n=()=>N(e.state.tr.insertText(t,k,C));e.someProp("handleTextInput",r=>r(e,k,C,t,n))||e.dispatch(n())}else e.dispatch(N());else e.dispatch(N())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in tw){let n=tw[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||tM(e,t)||!e.editable&&t.type in tv||n(e,t)},tk[t]?{passive:!0}:void 0)}ea&&e.dom.addEventListener("input",()=>null),tS(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&tS(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(nm),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(t$(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=nf(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&tS(this),this.editable=np(this),nu(this);let d=t9(this),c=nh(this),h=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",u=s||!this.docView.matchesNode(e.doc,c,d);(u||!e.selection.eq(o.selection))&&(l=!0);let p="preserve"==h&&l&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=i-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:ey(e.dom)}}(this);if(l){let t,n,l;this.domObserver.stop();let a=u&&(en||es)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,l=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(l)!=i.$anchor.start(l));if(u){let t=es?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=K(e=e.childNodes[t-1])}else{if(!e.parentNode||q(e))return null;t=$(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||q(e))return null;t=$(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);
1if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(s||!this.docView.update(e.doc,c,d,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ez(e.doc,c,d,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(a=!0)}let h=this.input.mouseDown;a||!(h&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),_(t.node,t.offset,n.anchorNode,n.anchorOffset))&&h.delaySelUpdate())?eQ(this,a):(e5(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==h?this.dom.scrollTop=0:"to selection"==h?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;ex(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof h.NodeSelection){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&eg(this,t.getBoundingClientRect(),e)}else eg(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new t_(e.slice,e.move,r<0?void 0:h.NodeSelection.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(en){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(eb)return e.focus(eb);let t=ey(e);e.focus(null==eb?{get preventScroll(){return eb={preventScroll:!0},!0}}:void 0),eb||(eb=!1,ex(t,0))}(this.dom),eQ(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,l=0,a=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(K(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(K(r.startContainer),r.startOffset)}}}(o,t.left,t.top);a&&({node:s,offset:l}=a);let d=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!d||!e.dom.contains(1!=d.nodeType?d.parentNode:d)){let n=e.dom.getBoundingClientRect();if(!ew(t,n)||!(d=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(ew(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(ea)for(let e=d;s&&e;e=H(e))e.draggable&&(s=void 0);if(d=(r=(n=d).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(ei&&1==s.nodeType&&(l=Math.min(l,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[l],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&l++}ep&&l&&1==s.nodeType&&1==(n=s.childNodes[l-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&l--,s==e.dom&&l==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>
1s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==l||1!=s.nodeType||"BR"!=s.childNodes[l-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,l,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,l,a=0,d=n.top,c=n.top;for(let e=t.firstChild,h=0;e;e=e.nextSibling,h++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=B(e).getClientRects()}for(let u=0;u<t.length;u++){let p=t[u];if(p.top<=d&&p.bottom>=c){d=Math.max(p.bottom,d),c=Math.min(p.top,c);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,l=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(a=h+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(a=h+1)}}return(!o&&r&&(o=r,l=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=ek(r,1);if(n.top!=n.bottom&&ew(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,l):!o||s&&1==o.nodeType?{node:t,offset:a}:e(o,l)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,d,t));let c=e.docView.nearestDesc(d,!0);return{pos:i,inside:c?c.posAtStart-c.border:-1}}(this,e)}coordsAtPos(e,t=1){return eN(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return eA==t&&eE==n?eR:(eA=t,eE=n,eR="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,ej(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=eN(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=B(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?eT.test(r.parent.textContent)&&s.modify?ej(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:l}=e.domSelectionRange(),a=s.caretBidiLevel;s.modify("move",n,"character");let d=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:c,focusOffset:h}=e.domSelectionRange(),u=c&&!d.contains(1==c.nodeType?c:c.parentNode)||t==c&&i==h;try{s.collapse(o,l),t&&(t!=o||i!=l)&&s.extend&&s.extend(t,i)}catch(e){}return null!=a&&(s.caretBidiLevel=a),u}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return tB(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return tB(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return th(this,e)}destroy(){if(this.docView){for(let e in this.input.mouseDown&&this.input.mouseDown.done(),this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],t9(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,V()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!tM(this,e)&&tw[e.type]&&(this.editable||!(e.type in tv))&&tw[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?ea&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return ns(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?ns(e,n):null}
1(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function nh(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[tX.node(0,e.state.doc.content.size,t)]}function nu(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:tX.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function np(e){return!e.someProp("editable",t=>!1===t(e.state))}function nf(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function nm(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}nc.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var ng={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ny={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nx="u">typeof navigator&&/Mac/.test(navigator.platform),nb="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),nw=0;nw<10;nw++)ng[48+nw]=ng[96+nw]=String(nw);for(var nw=1;nw<=24;nw++)ng[nw+111]="F"+nw;for(var nw=65;nw<=90;nw++)ng[nw]=String.fromCharCode(nw+32),ny[nw]=String.fromCharCode(nw);for(var nv in ng)ny.hasOwnProperty(nv)||(ny[nv]=ng[nv]);let nk="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),nC="u">typeof navigator&&/Win/.test(navigator.platform);function nN(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function nS(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))nk?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(nx&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||nb&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?ny:ng)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[nN(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[nN(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(nC&&n.ctrlKey&&n.altKey)&&(o=ng[n.keyCode])&&o!=i){let r=t[nN(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}function nM(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var nj=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],l=!!e,a=e||i.tr,d=()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(a),s.every(e=>!0===e)),c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(a,t),i=n(...e)(r);return s.push(i),c}])),run:d};return c}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if("then"!==n)return"run"===n?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if("then"!==t)return"chain"===t?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:nM({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}};let nT=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),null==(n=window)||null==(n=n.getSelection())||n.removeAllRanges()}}),!0),nA=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),nE=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),l=o.blockRange(s);if(!l)return;let a=(0,d.liftTarget)(l);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(l.start,e)}(a||0===a)&&t.lift(l,a)})}),!0)},nR=e=>t=>e(t),nD=()=>({state:e,dispatch:t})=>M(e,t),nO=(e,t)=>
1({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new h.TextSelection(r.doc.resolve(Math.max(s-1,0)))),!0},nP=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function nL(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}let nI=e=>({tr:t,state:n,dispatch:r})=>{let i=nL(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},nz=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},n$=(e,t,n)=>{var r;return!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()?e.pos:(r=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?e.start()-1:e.end()+1:e.pos},nH=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r,o=n.mapping.slice(i),s=n.doc.resolve(o.map(t.$from.pos)),l=n.doc.resolve(o.map(t.$to.pos)),{from:a,to:d}={from:n$(s,r=e.schema,"left"),to:n$(l,r,"right")};n.deleteRange(a,d)}),n.selection.empty||n.setSelection(h.TextSelection.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},nF=()=>({commands:e})=>e.keyboardShortcut("Enter"),nB=()=>({state:e,dispatch:t})=>S(e,t);function nV(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function n_(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:nV(t[r])?t[r].test(e[r]):t[r]===e[r])}function nW(e,t,n={}){return e.find(e=>e.type===t&&n_(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function nU(e,t,n={}){return!!nW(e,t,n)}function nK(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!nW([...r.node.marks],t,n))return;let i=r.index,o=e.start()+r.offset,s=i+1,l=o+r.node.nodeSize;for(;i>0&&nU([...e.parent.child(i-1).marks],t,n);)i-=1,o-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&nU([...e.parent.child(s).marks],t,n);)l+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function nq(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}let nJ=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=nq(e,r.schema),{doc:s,selection:l}=n,{$from:a,from:d,to:c}=l;if(i){let e=nK(a,o,t);if(e&&e.from<=d&&e.to>=c){let t=h.TextSelection.create(s,e.from,e.to);n.setSelection(t)}}return!0},nY=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function nX(e){return e instanceof h.TextSelection}function nG(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function nZ(e,t=null){if(!t)return null;let n=h.Selection.atStart(e),r=h.Selection.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?h.TextSelection.create(e,nG(0,i,o),nG(e.content.size,i,o)):h.TextSelection.create(e,nG(t,i,o),nG(t,i,o))}function nQ(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function n0(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}let n1=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(n0()||nQ())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!n0()&&!nQ()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!nX(n.state.selection))return s(),!0;let l=nZ(i.doc,e)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},n2=(e,t)=>
1n=>e.every((e,r)=>t(e,{...n,index:r})),n3=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),n5=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&n5(r)}return e};function n4(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return n5(new window.DOMParser().parseFromString(t,"text/html").body)}function n6(e){return"function"==typeof(null==e?void 0:e.nodesBetween)}function n7(e,t,n){if(n6(e))return e;let r="object"==typeof e&&null!==e;n={slice:!0,parseOptions:{},...n};let i="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return c.Fragment.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),n7("",t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i="",o=new c.Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?c.DOMParser.fromSchema(o).parseSlice(n4(e),n.parseOptions):c.DOMParser.fromSchema(o).parse(n4(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=c.DOMParser.fromSchema(t);return n.slice?r.parseSlice(n4(e),n.parseOptions).content:r.parse(n4(e),n.parseOptions)}return n7("",t,n)}function n8(e){return!("type"in e)}function n9(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof d.ReplaceStep||i instanceof d.ReplaceAroundStep))return;let o=e.mapping.maps[r],s=0;o.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(h.Selection.near(e.doc.resolve(s),n))}
1let re=(e,t,n)=>({tr:r,dispatch:i,editor:o})=>{if(i){let i,l;n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a=e=>{o.emit("contentError",{editor:o,error:e,disableCollaboration:()=>{"collaboration"in o.storage&&"object"==typeof o.storage.collaboration&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{n7(t,o.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(e){a(e)}try{var s;i=n7(t,o.schema,{parseOptions:d,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:o.options.enableContentCheck})}catch(e){return a(e),!1}let{from:h,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,f=!0,m=n8(i)?i.content:[i];if(m.forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),h===u&&f){let{parent:e}=r.doc.resolve(h);!e.isTextblock||e.type.spec.code||e.childCount||(h-=1,u+=1)}if(p)l=Array.isArray(t)?t.map(e=>e.text||"").join(""):n6(t)?m.map(e=>{var t;return null!=(t=e.text)?t:""}).join(""):"object"==typeof t&&t&&t.text?t.text:t,r.insertText(l,h,u);else{l=c.Fragment.from(m);let e=r.doc.resolve(h),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,o=t.content.size>0;n&&i&&o&&f&&(h=Math.max(0,h-1)),r.replaceWith(h,u,m)}n.updateSelection&&n9(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:h,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:h,text:l})}return!0};function rt(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let rn=(e={})=>({tr:t,dispatch:n,editor:r})=>{let i,o,{pos:s,attrs:l,content:a,updateSelection:d=!0}=e,c=rt((i="number"==typeof s?t.doc.resolve(s):s||t.selection.$from).parent.contentMatchAt(i.index()));if(!c)return!1;let h=Object.keys(c.spec.attrs||{}),u=l?Object.fromEntries(Object.entries(l).filter(([e])=>h.includes(e))):{};if(a){let e=n7(a,r.schema);o=c.createAndFill(u,e)}else o=c.createAndFill(u);return!!o&&(n&&(t.insert(i.pos,o),d&&n9(t,t.steps.length-1,-1)),!0)},rr=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof h.NodeSelection,i;if(r){if(n.node.isTextblock||!(0,d.canJoin)(e.doc,n.from))return!1;i=n.from}else if(null==(i=(0,d.joinPoint)(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(h.NodeSelection.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),ri=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof h.NodeSelection){if(n.node.isTextblock||!(0,d.canJoin)(e.doc,n.to))return!1;r=n.to}else if(null==(r=(0,d.joinPoint)(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),ro=()=>({state:e,dispatch:t})=>f(e,t),rs=()=>({state:e,dispatch:t})=>w(e,t),rl=()=>({state:e,dispatch:t,tr:n})=>{try{let r=(0,d.joinPoint)(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},ra=()=>({state:e,dispatch:t,tr:n})=>{try{let r=(0,d.joinPoint)(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},rd=()=>({state:e,dispatch:t})=>((e,t)=>{let n=p(e,void 0);if(!n)return!1;let r=x(n);return!!r&&m(e,r,t)})(e,t),rc=()=>({state:e,dispatch:t})=>((e,t)=>{let n=b(e,void 0);if(!n)return!1;let r=k(n);return!!r&&m(e,r,t)})(e,t);function rh(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}let ru=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))n0()||rh()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"
1===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});return null==a||a.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function rp(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?nL(t,e.schema):null,l=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);l.push({node:e,from:n,to:o})});let a=i-r,d=l.filter(e=>!s||s.name===e.node.type.name).filter(e=>n_(e.node.attrs,n,{strict:!1}));return o?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=a}let rf=(e,t={})=>({state:n,dispatch:r})=>!!rp(n,nL(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&(0,d.liftTarget)(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r),rm=()=>({state:e,dispatch:t})=>j(e,t),rg=e=>({state:t,dispatch:n})=>{var r;return(r=nL(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);return!!o&&(!t||(n.node(o.depth-1).type==r?function(e,t,n,r){let i=e.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new d.ReplaceAroundStep(o-1,s,o,s,new c.Slice(c.Fragment.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new c.NodeRange(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let l=(0,d.liftTarget)(r);if(null==l)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return(0,d.canJoin)(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),t(i.scrollIntoView()),!0}(e,t,r,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,a=n.endIndex==i.childCount,h=o.node(-1),u=o.index(-1);if(!h.canReplace(u+ +!l,u+1,s.content.append(a?c.Fragment.empty:c.Fragment.from(i))))return!1;let p=o.pos,f=p+s.nodeSize;return r.step(new d.ReplaceAroundStep(p-!!l,f+ +!!a,p+1,f-1,new c.Slice((l?c.Fragment.empty:c.Fragment.from(i.copy(c.Fragment.empty))).append(a?c.Fragment.empty:c.Fragment.from(i.copy(c.Fragment.empty))),+!l,+!a),+!l)),t(r.scrollIntoView()),!0}(e,t,o)))})(t,n)},ry=()=>({state:e,dispatch:t})=>C(e,t);function rx(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function rb(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}let rw=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=rx("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=nL(e,r.schema)),"mark"===l&&(s=nq(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,rb(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(a=!0,i&&n.addMark(r,r+e.nodeSize,s.create(rb(o.attrs,t))))})})}),a},rv=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),rk=()=>({tr:e,dispatch:t})=>{if(t){let t=new h.AllSelection(e.doc);e.setSelection(t)}return!0},rC=()=>({state:e,dispatch:t})=>y(e,t),rN=()=>({state:e,dispatch:t})=>v(e,t),rS=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(h.NodeSelection.create(e.doc,i))),!0)})(e,t),rM=()=>({state:e,dispatch:t})=>R(e,t),rj=()=>({state:e,dispatch:t})=>E(e,t);function rT(e,t,n={},r={}){return n7(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}let rA=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{let{doc:a}=o;if("full"!==r.preserveWhitespace){let l=rT(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});if(s){let e=n8(l)?l.content:[l];o.replaceWith(0,a.content.size,e).setMeta("preventUpdate",!n)}return!0}return s&&o.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};
1function rE(e,t){let n=nq(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let l=s.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function rR(e,t){let n=new d.Transform(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function rD(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function rO(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function rP(e){return t=>rO(t.$from,e)}function rL(e,t,n){return void 0===e.config[t]&&e.parent?rL(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?rL(e.parent,t,n):null}):e.config[t]}function rI(e){return e.map(e=>{let t=rL(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...rI(t())]:e}).flat(10)}function rz(e,t){let n=c.DOMSerializer.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function r$(e){return"function"==typeof e}function rH(e,t,...n){return r$(e)?t?e.bind(t)(...n):e(...n):e}function rF(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function rB(e){let t=[],{nodeExtensions:n,markExtensions:r}=rF(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),l=r.map(e=>e.name),a=[...s,...l];return e.forEach(e=>{let n=rL(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?a:"nodes"===e.types?s:"marks"===e.types?l:[]).forEac
1h(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}),i.forEach(e=>{let n=rL(e,"addAttributes",{name:e.name,options:e.options,storage:e.storage});n&&Object.entries(n()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function rV(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,o=0,s=e.length;for(let l=0;l<s;l+=1){let s=e[l];if("'"===s&&!i){r=!r,n+=s;continue}if('"'===s&&!r){i=!i,n+=s;continue}if(!r&&!i){if("("===s){o+=1,n+=s;continue}if(")"===s&&o>0){o-=1,n+=s;continue}if(";"===s&&0===o){t.push(n),n="";continue}}n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&s&&t.push([o,s])}return t}function r_(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if("__proto__"===e)return void Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=new Map([...rV(n[e]),...rV(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function rW(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>r_(e,t),{})}function rU(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function rK(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function rq(e){var t,n;let r={};return!(null==e||null==(t=e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==e||null==(n=e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function rJ(e){return e.sort((e,t)=>{let n=rL(e,"priority")||100,r=rL(t,"priority")||100;return n>r?-1:+(n<r)})}function rY(e){var t;let n=rJ(rI(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function rX(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},l="";return e.nodesBetween(r,i,(e,n,a,d)=>{e.isBlock&&n>r&&(l+=o);let c=null==s?void 0:s[e.type.name];if(c)return a&&(l+=c({node:e,pos:n,parent:a,index:d,range:t})),!1;if(e.isText){var h;l+=null==e||null==(h=e.text)?void 0:h.slice(Math.max(r,n)-n,i-n)}}),l}function rG(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function rZ(e,t){let n=rx("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=nL(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?rE(e,t):{}}function rQ(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),l=n.invert().map(o,-1),a=n.invert().map(s);i.push({oldRange:{from:l,to:a},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}
1(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function r0(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=nK(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}let r1=(e,t,n,r=20)=>{let i=e.doc.resolve(n),o=r,s=null;for(;o>0&&null===s;){let e=i.node(o);(null==e?void 0:e.type.name)===t?s=e:o-=1}return[s,o]},r2=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return 0===n?null:e.node(t).child(n-1)};function r3(e,t){return t.nodes[e]||t.marks[e]||null}function r5(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function r4(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?nq(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>n_(e.attrs,n,{strict:!1}));let s=0,l=[];
1if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s+=a-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),0===s)return!1;let a=l.filter(e=>!o||o.name===e.mark.type.name).filter(e=>n_(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=l.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+d:a)>=s}let r6=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=rP(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos},r7=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos};function r8(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function r9(e,t){let{nodeExtensions:n}=rF(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=rH(rL(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function ie(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if("hardBreak"===e.type.name)return!0;if(e.isText){var r;return!/\S/.test(null!=(r=e.text)?r:"")}}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(ie(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function it(e){return e instanceof h.NodeSelection}function ir({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:o}=e;return!!(i<=t&&o>=t+n||r&&nX(e)&&i>t&&o<t+n)}var ii=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function io(e,t){let n=t.mapping.mapResult(e.position);return{position:new ii(n.pos),mapResult:n}}function is(e){return new ii(e)}let il=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,a=nq(e,r.schema);if(i)if(s){let e=rE(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),l=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))}):n.addMark(s,l,a.create(t))})});return function(e,t,n){let{selection:r}=t,i=null;if(nX(r)&&(i=r.$cursor),i){var o;let t=null!=(o=e.storedMarks)?o:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=r;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,a)},ia=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),id=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=nL(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!D(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>D(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ic=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=nG(e,0,n.content.size),i=h.NodeSelection.create(n,r);t.setSelection(i)}return!0},ih=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:l}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=l.from,s=l.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},iu=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=h.TextSelection.atStart(n).from,s=h.TextSelection.atEnd(n).to,l=nG(r,o,s),a=nG(i,o,s),d=h.TextSelection.create(n,l,a);t.setSelection(d)}return!0},ip=e=>({state:t,dispatch:n})=>{var r;return(r=nL(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=r)return!1;if(t){let n=a.lastChild&&a.lastChild.type==l.type,i=c.Fragment.from(n?r.create():null),s=new c.Slice(c.Fragment.from(r.create(null,c.Fragment.from(l.type.create(null,i)))),n?3:1,0),h=o.start,u=o.end;t(e.tr.step(new d.ReplaceAroundStep(h-(n?3:1),u,h,u,s,1,!0)).scrollIntoView())}return!0})(t,n)};function im(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>
1null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}let ig=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:l,$to:a}=o,c=r5(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(o instanceof h.NodeSelection&&o.node.isBlock)return!!l.parentOffset&&!!(0,d.canSplit)(s,l.pos)&&(r&&(e&&im(n,i.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let u=a.parentOffset===a.parent.content.size,p=0===l.depth?void 0:rt(l.node(-1).contentMatchAt(l.indexAfter(-1))),f=u&&p?[{type:p,attrs:c}]:void 0,m=(0,d.canSplit)(t.doc,t.mapping.map(l.pos),1,f);if(!f&&!m&&(0,d.canSplit)(t.doc,t.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,f=p?[{type:p,attrs:c}]:void 0),r){if(m&&(o instanceof h.TextSelection&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,f),p&&!u&&!l.parentOffset&&l.parent.type!==p)){let e=t.mapping.map(l.before()),n=t.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,p)&&t.setNodeMarkup(t.mapping.map(l.before()),p)}e&&im(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},iy=(e,t={})=>({tr:n,state:r,dispatch:i,editor:o})=>{let s=nL(e,r.schema),{$from:l,$to:a}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(a))return!1;let p=l.node(-1);if(p.type!==s)return!1;let f=o.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){var m;let e=c.Fragment.empty,r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=c.Fragment.from(l.node(t).copy(e));let i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,o={...r5(f,l.node().type.name,l.node().attrs),...t},a=(null==(m=s.contentMatch.defaultType)?void 0:m.createAndFill(o))||void 0;e=e.append(c.Fragment.from(s.createAndFill(null,a)||void 0));let d=l.before(l.depth-(r-1));n.replace(d,l.after(-i),new c.Slice(e,4-r,0));let u=-1;n.doc.nodesBetween(d,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=t+1)}),u>-1&&n.setSelection(h.TextSelection.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let g=a.pos===l.end()?p.contentMatchAt(0).defaultType:null,y={...r5(f,p.type.name,p.attrs),...t},x={...r5(f,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,a.pos);let b=g?[{type:s,attrs:y},{type:g,attrs:x}]:[{type:s,attrs:y}];if(!(0,d.canSplit)(n.doc,l.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:s}=o.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!a||!i)return!0;let d=a.filter(e=>s.includes(e.type.name));n.ensureMarks(d)}return!0};function ix(e){return e&&"1"!==e?e:null}let ib=(e,t)=>{var n,r;let i=rP(e=>e.type===t)(e.selection);if(!i)return!0;let o=e.doc.resolve(Math.max(0,i.pos-1)).before(i.depth);if(void 0===o)return!0;let s=e.doc.nodeAt(o);return!(i.node.type===(null==s?void 0:s.type)&&(0,d.canJoin)(e.doc,i.pos))||(n=i.node.attrs.type,r=null==s?void 0:s.attrs.type,ix(n)!==ix(r)||(e.join(i.pos),!0))},iw=(e,t)=>{var n,r;let i=rP(e=>e.type===t)(e.selection);if(!i)return!0;let o=e.doc.resolve(i.start).after(i.depth);if(void 0===o)return!0;let s=e.doc.nodeAt(o);return!(i.node.type===(null==s?void 0:s.type)&&(0,d.canJoin)(e.doc,o))||(n=i.node.attrs.type,r=null==s?void 0:s.attrs.type,ix(n)!==ix(r)||(e.join(o),!0))},iv=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:d,can:c})=>{let{extensions:u,splittableMarks:p}=i.extensionManager,f=nL(e,s.schema),m=nL(t,s.schema),{selection:g,storedMarks:y}=s,{$from:x,$to:b}=g,w=x.blockRange(b),v=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;let k=rP(e=>r9(e.type.name,u))(g),C=0===g.from&&g.to===s.doc.content.size,N=s.doc.content.content,S=1===N.length?N[0]:null,M=C&&S&&r9(S.type.name,u)?{node:S,pos:0,depth:0}:null,j=null!=k?k:M,T=!!k&&w.depth>
1=1&&w.depth-k.depth<=1,A=!!M;if((T||A)&&j){if(j.node.type===f)return C&&A?a().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return h.TextSelection.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(m).run():d.liftListItem(m);if(r9(j.node.type.name,u)&&f.validContent(j.node.content))return a().command(()=>(o.setNodeMarkup(j.pos,f),!0)).command(()=>ib(o,f)).command(()=>iw(o,f)).run()}return n&&v&&l?a().command(()=>{let e=c().wrapInList(f,r),t=v.filter(e=>p.includes(e.type.name));return o.ensureMarks(t),!!e||d.clearNodes()}).wrapInList(f,r).command(()=>ib(o,f)).command(()=>iw(o,f)).run():a().command(()=>!!c().wrapInList(f,r)||d.clearNodes()).wrapInList(f,r).command(()=>ib(o,f)).command(()=>iw(o,f)).run()},ik=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=nq(e,r.schema);return r4(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},iC=(e,t,n={})=>({state:r,commands:i})=>{let o,s=nL(e,r.schema),l=nL(t,r.schema),a=rp(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),a)?i.setNode(l,o):i.setNode(s,{...o,...n})},iN=(e,t={})=>({state:n,commands:r})=>{let i=nL(e,n.schema);return rp(n,i,t)?r.lift(i):r.wrapIn(i,t)},iS=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},iM=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:o}=t,{empty:s,ranges:l}=o;if(s)return!0;let{nonClearableMarks:a}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!a.includes(e.name));l.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},ij=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:o=!1}=t,{selection:s}=n,l=nq(e,r.schema),{$from:a,empty:d,ranges:c}=s;if(!i)return!0;if(d&&o){var h;let{from:e,to:t}=s,r=nK(a,l,null==(h=a.marks().find(e=>e.type===l))?void 0:h.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,l)}else c.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},iT=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},iA=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=rx("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=nL(e,r.schema)),"mark"===l&&(s=nq(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{let l,d,c,h,u=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(u,p,(e,t)=>{o&&o===e.type&&(a=!0,c=Math.max(t,u),h=Math.min(t+e.nodeSize,p),l=t,d=e)}):r.doc.nodesBetween(u,p,(e,r)=>{r<u&&o&&o===e.type&&(a=!0,c=Math.max(r,u),h=Math.min(r+e.nodeSize,p),l=r,d=e),r>=u&&r<=p&&(o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(a=!0,i)){let i=Math.max(r,u),l=Math.min(r+e.nodeSize,p);n.addMark(i,l,s.create({...o.attrs,...t}))}}))}),d&&(void 0!==l&&i&&n.setNodeMarkup(l,void 0,{...d.attrs,...t}),s&&d.marks.length&&d.marks.forEach(e=>{s===e.type&&i&&n.addMark(c,h,s.create({...e.attrs,...t}))}))}),a},iE=new h.PluginKey("__tiptap_decorations__"),iR=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(iE,{type:"force",name:e}),!0),iD=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&(0,d.findWrapping)(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}})(nL(e,n.schema),t)(n,r),iO=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let i=!1,o=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){
1if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);o=new c.NodeRange(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new c.NodeRange(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let l=(0,d.findWrapping)(o,n,r,t);return!!l&&(e&&function(e,t,n,r,i){let o=c.Fragment.empty;for(let e=n.length-1;e>=0;e--)o=c.Fragment.from(n[e].type.create(n[e].attrs,o));e.step(new d.ReplaceAroundStep(t.start-2*!!r,t.end,t.start,t.end,new c.Slice(o,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==i&&(s=e+1);let l=n.length-s,a=t.start+n.length-2*!!r,h=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&(0,d.canSplit)(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=h.child(n).nodeSize}(e,t,l,i,n),!0)}(l,s,e,t)&&(r&&r(l.scrollIntoView()),!0)}})(nL(e,n.schema),t)(n,r);var iP=(0,a.t)({blur:()=>nT,clearContent:()=>nA,clearNodes:()=>nE,command:()=>nR,createParagraphNear:()=>nD,cut:()=>nO,deleteCurrentNode:()=>nP,deleteNode:()=>nI,deleteRange:()=>nz,deleteSelection:()=>nH,enter:()=>nF,exitCode:()=>nB,extendMarkRange:()=>nJ,first:()=>nY,focus:()=>n1,forEach:()=>n2,insertContent:()=>n3,insertContentAt:()=>re,insertDefaultBlock:()=>rn,joinBackward:()=>ro,joinDown:()=>ri,joinForward:()=>rs,joinItemBackward:()=>rl,joinItemForward:()=>ra,joinTextblockBackward:()=>rd,joinTextblockForward:()=>rc,joinUp:()=>rr,keyboardShortcut:()=>ru,lift:()=>rf,liftEmptyBlock:()=>rm,liftListItem:()=>rg,newlineInCode:()=>ry,resetAttributes:()=>rw,scrollIntoView:()=>rv,selectAll:()=>rk,selectNodeBackward:()=>rC,selectNodeForward:()=>rN,selectParentNode:()=>rS,selectTextblockEnd:()=>rM,selectTextblockStart:()=>rj,setContent:()=>rA,setMark:()=>il,setMeta:()=>ia,setNode:()=>id,setNodeSelection:()=>ic,setTextDirection:()=>ih,setTextSelection:()=>iu,sinkListItem:()=>ip,splitBlock:()=>ig,splitListItem:()=>iy,toggleList:()=>iv,toggleMark:()=>ik,toggleNode:()=>iC,toggleWrap:()=>iN,undoInputRule:()=>iS,unsetAllMarks:()=>iM,unsetMark:()=>ij,unsetTextDirection:()=>iT,updateAttributes:()=>iA,updateDecorations:()=>iR,wrapIn:()=>iD,wrapInList:()=>iO});let iL=new WeakMap;var iI=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};let iz=void 0!==r.default&&!1;function i$(e,t){let n=[],r=new Set;for(let i of e)"widget"===i.kind&&"widget"===i.kind&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function iH({position:e,from:t,to:n,docSize:r}){return!(e<t)&&(e<n||e===n&&n===r)}function iF(e){return"attr"===e.jsonID}function iB(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=null==e?void 0:e.key;"string"==typeof t&&r.delete(t)}})}function iV(e,t){let n=Object.values(t).flatMap(e=>e.find());return tQ.create(e,n)}function i_(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}let iW=new Set;var iU=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=iE.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>(function(e,t){var n;switch(null!=(n=t.update)?n:"document"){case"document":if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}})(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var e,t;return null!=(e=null==(t=iE.getState(this.editor.state))?void 0:t.widgetKeys)?e:iW}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;
1return new h.Plugin({key:iE,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:o}of t){let{set:t,widgetKeys:s}=this.buildFullSet(e,o,n);r[e]=t,i[e]=s}let o={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:i_(i)};return this.warnDuplicateWidgetKeys(o),o},apply:(n,r,i,o)=>{let s=n.getMeta(iE),l=(null==s?void 0:s.type)==="force"&&!s.name,a=(null==s?void 0:s.type)==="force"?s.name:void 0,d={},c={},h=new Set;return(!function(e,t){var n,r;iL.set(e,(null!=(n=iL.get(e))?n:0)+1);try{return t()}finally{let t=(null!=(r=iL.get(e))?r:1)-1;t>0?iL.set(e,t):iL.delete(e)}}(e,()=>{for(let{name:u,spec:p}of t){var s;let t=l||a===u;if(s={editor:e,tr:n,oldState:i,newState:o},t||"manual"!==p.update&&(p.shouldUpdate?p.shouldUpdate(s):s.tr.docChanged))if("changedRanges"===p.update&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(u,p,r,n,o);d[u]=e.set,c[u]=e.widgetKeys,h.add(u)}else{let{set:e,widgetKeys:t}=this.buildFullSet(u,p,o);d[u]=e,c[u]=t,h.add(u)}else{let e=function(e,t,n){var r,i;let o=null!=(r=t.decorationSetsByExtension[e])?r:tQ.empty,s=new Set(null!=(i=t.widgetKeysByExtension[e])?i:[]);return{set:iB(o,n.mapping,n.doc,s),widgetKeys:s}}(u,r,n);d[u]=e.set,c[u]=e.widgetKeys}}}),0!==h.size||n.docChanged)?{decorationSetsByExtension:d,widgetKeysByExtension:c,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:d,recomputedNames:h}),widgetKeys:i_(c)}:r}},props:{decorations(e){var t,n;
1return null!=(t=null==(n=iE.getState(e))?void 0:n.mergedDecorationSet)?t:tQ.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let o=function(e,t){if(e.steps.some(e=>{let t;return t=!1,e.getMap().forEach(()=>{t=!0}),!(t||iF(e))&&("number"!=typeof e.from||"number"!=typeof e.to)}))return{type:"full"};let n=rQ(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!iF(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=function(e,t){let n=null,r=0,i=0;for(let o=0;o<e.childCount&&!(i>t.to);o+=1){let s=i+e.child(o).nodeSize;s>=t.from&&(null===n&&(n=i),r=s),i=s}return null===n?null:{from:n,to:r}}(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:"ranges",ranges:i}}(r,i.doc);return"full"===o.type?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,o.ranges)}rebuildRanges(e,t,n,r,i,o){var s,l;let a=null!=(s=n.decorationSetsByExtension[e])?s:tQ.empty,d=new Set(null!=(l=n.widgetKeysByExtension[e])?l:[]),c=iB(a,r.mapping,r.doc,d),h=i.doc.content.size;for(let{from:n,to:r}of o){let o=c.find(n,r).filter(e=>iH({position:e.from,from:n,to:r,docSize:h}));for(let e of o){let t=function(e){var t;let n=null==(t=e.spec)?void 0:t.key;return"string"==typeof n?n:void 0}(e);t&&d.delete(t)}c=c.remove(o);let{decorations:s,widgetKeys:l}=i$(function({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:o}){return e.filter(e=>!!iH({position:e.anchor,from:t,to:n,docSize:r})||e.anchor!==n&&(o.has(i)||(o.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}({decorations:this.runCreate(e,"createInRange",()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:h,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);for(let e of(c=c.add(i.doc,s),l))d.add(e)}return{set:c,widgetKeys:d}}buildFullSet(e,t,n){let r=this.runCreate(e,"create",()=>t.create({editor:this.editor,state:n,view:this.mountedView}));
1return function(e,t,n){let{decorations:r,widgetKeys:i}=i$(t,n);return{set:tQ.create(e,r),widgetKeys:i}}(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){}buildMergedSet(e,t){let n=Object.keys(t);return 1===n.length?t[n[0]]:iV(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return 1===e.length?r[e[0].name]:0===i.size?t.mergedDecorationSet.map(n.mapping,n.doc):iV(n.doc,r)}};function iK(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof h.NodeSelection){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;i-=1}return!1}function iq(e,t){let n=e.getAttribute("style");if(!n)return null;let r=n.split(";").map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;e-=1){let t=r[e],n=t.indexOf(":");if(-1!==n&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}function iJ(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function iY(e,t,n){let r=e.split("\n"),i=[],o="",s=0,l=t.baseIndentSize||2;for(;s<r.length;){let e,c=r[s],h=c.match(t.itemPattern);if(!h)if(i.length>0)break;else{if(""!==c.trim())return;s+=1,o=`${o}${c} 2`;continue}let u=t.extractItemData(h),{indentLevel:p,mainContent:f}=u;o=`${o}${c} 3`;let m=[f];for(s+=1;s<r.length;){var a,d;let e=r[s];if(""===e.trim()){let t=r.slice(s+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(d=r[s+1+t].match(/^(\s*)/))||null==(d=d[1])?void 0:d.length)||0)>p){m.push(e),o=`${o}${e} 4`,s+=1;continue}break}if(((null==(a=e.match(/^(\s*)/))||null==(a=a[1])?void 0:a.length)||0)>p)m.push(e),o=`${o}${e} 5`,s+=1;else break}let g=m.slice(1);if(g.length>0){let r=g.map(e=>e.slice(p+l)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let y=t.createToken(u,e);i.push(y)}if(0!==i.length)return{items:i,raw:o}}function iX(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[o,...s]=e.content,l=`${i}${t.renderChildren([o])}`;return s&&s.length>0&&s.forEach((e,n)=>{var r,i;let o=null!=(r=null==(i=t.renderChild)?void 0:i.call(t,e,n+1))?r:t.renderChildren([e]);if(null!=o){let n=o.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?` 6 7${n}`:` 8${n}`}}),l}function iG(e,t,n={}){let{state:r}=t,{doc:i,tr:o}=r;i.descendants((t,r)=>{let i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,l=null;if(t.marks.forEach(t=>{if(t!==e)return!1;l=t}),!l)return;let a=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(a=!0)}),a){let t=e.type.create({...e.attrs,...n});o.removeMark(i,s,e.type),o.addMark(i,s,t)}}),o.docChanged&&t.view.dispatch(o)}var iZ=class{constructor(e,t,n){this.component=e,this.editor=t.editor,this.options={...n},this.mark=t.mark,this.HTMLAttributes=t.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(e,t){iG(t||this.mark,this.editor,e)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&(n0()||nQ())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}},iQ=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function i0(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;let d=a.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(t=d.nodeBefore||d.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1,h=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,l;let a=(null==(s=(l=e.type.spec).toText)?void 0:s.call(l,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,r-t))}),n})(d)+o;
8return s.forEach(e=>{if(c)return;let t=((e,t)=>{if(nV(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(h,e.find);if(!t)return;let s=t[0].length-o.length;if(s>0){let e=d.parentOffset-s;if(e<0||d.parent.textBetween(e,d.parentOffset)!==t[0].slice(0,s))return}let u=a.state.tr,p=nM({state:a.state,transaction:u}),f={from:r-(t[0].length-o.length),to:i},{commands:m,chain:g,can:y}=new nj({editor:n,state:p});null!==e.handler({state:p,range:f,match:t,commands:m,chain:g,can:y})&&u.steps.length&&(e.undoable&&u.setMeta(l,{transform:u,from:r,to:i,text:o}),a.dispatch(u),c=!0)}),c}var i1=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...rH(rL(this,"addOptions",{name:this.name}))}}get storage(){return{...rH(rL(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return iJ(t)&&iJ(n)&&Object.keys(n).forEach(i=>{iJ(n[i])&&iJ(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},i2=class e extends i1{constructor(...e){super(...e),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},i3=class{constructor(e){this.find=e.find,this.handler=e.handler}};let i5=null;var i4=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=rY(e),this.schema=function(e,t){var n;let r=rB(e),{nodeExtensions:i,markExtensions:o}=rF(e),s=null==(n=i.find(e=>rL(e,"topNode")))?void 0:n.name,l=Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=rK({...e.reduce((e,t)=>{let r=rL(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:rH(rL(n,"content",o)),marks:rH(rL(n,"marks",o)),group:rH(rL(n,"group",o)),inline:rH(rL(n,"inline",o)),atom:rH(rL(n,"atom",o)),selectable:rH(rL(n,"selectable",o)),draggable:rH(rL(n,"draggable",o)),code:rH(rL(n,"code",o)),whitespace:rH(rL(n,"whitespace",o)),linebreakReplacement:rH(rL(n,"linebreakReplacement",o)),defining:rH(rL(n,"defining",o)),isolating:rH(rL(n,"isolating",o)),attrs:Object.fromEntries(i.map(rq))}),l=rH(rL(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>rU(e,i)));let a=rL(n,"renderHTML",o);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:rW(e,i)}));let d=rL(n,"renderText",o);return d&&(s.toText=d),[n.name,s]})),a=Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=rK({...e.reduce((e,t)=>{let r=rL(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:rH(rL(n,"inclusive",o)),excludes:rH(rL(n,"excludes",o)),group:rH(rL(n,"group",o)),spanning:rH(rL(n,"spanning",o)),code:rH(rL(n,"code",o)),attrs:Object.fromEntries(i.map(rq))}),l=rH(rL(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>rU(e,i)));let a=rL(n,"renderHTML",o);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:rW(e,i)})),[n.name,s]}));return new c.Schema({topNode:s,nodes:l,marks:a})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=rL(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:r3(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=rJ([...this.extensions].reverse()).flatMap(t=>{var n;let r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:r3(t.name,this.schema)},i=[],o=rL(t,"addKeyboardShortcuts",r),s={};if("mark"===t.type&&rL(t,"exitable",r)&&(s.ArrowRight=()=>i2.handleExit({editor:e,mark:t})),o){let t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));s={...s,...t}}let l=(n=s,new h.Plugin({props:{handleKeyDown:nS(n)}}));i.push(l);let a=rL(t,"addInputRules",r);
8if(r8(t,e.options.enableInputRules)&&a){let t=a();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new h.Plugin({state:{init:()=>null,apply(e,i,o){let s=e.getMeta(r);if(s)return s;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=rz(c.Fragment.from(e),o.schema));let{from:i}=l,s=i+e.length;i0({editor:t,from:i,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,o,s)=>i0({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&i0({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&i0({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),r=Array.isArray(n)?n:[n];i.push(...r)}}let d=rL(t,"addPasteRules",r);if(r8(t,e.options.enablePasteRules)&&d){let t=d();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,i=null,o=!1,s=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let a=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:d,can:c}=new nj({editor:t,state:n}),h=[];return n.doc.nodesBetween(r,i,(e,t)=>{var u,p,f,m;if((null==(u=e.type)||null==(u=u.spec)?void 0:u.code)||!(e.isText||e.isTextblock||e.isInline))return;let g=null!=(p=null!=(f=null==(m=e.content)?void 0:m.size)?f:e.nodeSize)?p:0,y=Math.max(r,t),x=Math.min(i,t+g);y>=x||((e,t,n)=>{if(nV(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(y-t,x-t,void 0,""),o.find,s).forEach(e=>{if(void 0===e.index)return;let t=y+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},u=o.handler({state:n,range:i,match:e,commands:a,chain:d,can:c,pasteEvent:s,dropEvent:l});h.push(u)})}),h.every(e=>null!==e)}({editor:n,state:nM({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new h.Plugin({view(e){let t=t=>{var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(i5=n)},r=()=>{i5&&(i5=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(s=i===e.dom.parentElement,t=n,!s){let e=i5;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],d="paste"===i.getMeta("uiEvent")&&!o,h="drop"===i.getMeta("uiEvent")&&!s,u=i.getMeta("applyPasteRules"),p=!!u;if(!d&&!h&&!p)return;if(p){var f,m;let t,{text:n}=u;"string"==typeof n||(n=rz(c.Fragment.from(n),r.schema));let{from:i}=u,o=i+n.length;return a({rule:e,state:r,from:i,to:{b:o},pasteEvt:(f=n,null==(m=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||m.setData("text/html",f),t)})}let g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return a({rule:e,state:r,from:g,to:y,pasteEvt:l})}}))}({editor:e,rules:t});i.push(...n)}}let u=rL(t,"addProseMirrorPlugins",r);if(u){let e=u();i.push(...e)}return i}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;
8null==(e=this.decorationManager)||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=rL(e,"addDecorations",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:r3(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new iU({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return rB(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=rF(this.extensions);return Object.fromEntries(t.filter(e=>!!rL(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=rL(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:nL(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,o,s,l,a)=>{let d=rW(r,n);return i({node:r,view:o,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return rJ([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:r3(n.name,this.schema)},i=rL(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return rJ([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:r3(n.name,this.schema)},i=rL(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=rF(this.extensions);return Object.fromEntries(t.filter(e=>!!rL(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=rL(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:nq(t.name,this.schema)});return r?[t.name,(i,o,s)=>{let l=rW(i,n);return r()({mark:i,view:o,inline:s,editor:e,extension:t,HTMLAttributes:l,updateAttributes:t=>{iG(i,e,t)}})}]:[]}))}destroy(){var e;null==(e=this.decorationManager)||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:r3(e.name,this.schema)};if("mark"===e.type){var n,r;(null==(n=rH(rL(e,"keepOnSplit",t)))||n)&&this.splittableMarks.push(e.name),null==(r=rH(rL(e,"clearable",t)))||r||this.nonClearableMarks.push(e.name)}let i=rL(e,"onBeforeCreate",t),o=rL(e,"onCreate",t),s=rL(e,"onUpdate",t),l=rL(e,"onSelectionUpdate",t),a=rL(e,"onTransaction",t),d=rL(e,"onFocus",t),c=rL(e,"onBlur",t),h=rL(e,"onDestroy",t);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),d&&this.editor.on("focus",d),c&&this.editor.on("blur",c),h&&this.editor.on("destroy",h)})}};i4.resolve=rY,i4.sort=rJ,i4.flatten=rI;var i6=class e extends i1{constructor(...e){super(...e),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}};let i7=i6.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,o=rG(n),{blockSeparator:s}=this.options,l={...void 0!==s?{blockSeparator:s}:{},textSerializers:o};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>rX(r,{from:e.pos,to:t.pos},l)).join(null!=s?s:"\n\n")}}})]}}),i8=i6.create({name:"commands",addCommands:()=>({...iP})}),i9=i6.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r;let i=()=>{var n,r,i;if(null!=(n=null==(r=this.editor.options.coreExtensionOptions)||null==(r=r.delete)||null==(i=r.filterTransaction)?void 0:i.call(r,e))?n:e.getMeta("y-sync$"))return;let o=rR(e.before,[e,...t]);
8rQ(o).forEach(t=>{o.mapping.mapResult(t.oldRange.from).deletedAfter&&o.mapping.mapResult(t.oldRange.to).deletedBefore&&o.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,s=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:o.mapping.map(r),newTo:o.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!s,editor:this.editor,transaction:e,combinedTransform:o})})});let s=o.mapping;o.steps.forEach((t,n)=>{if(t instanceof d.RemoveMarkStep){var r,i;let l=s.slice(n).map(t.from,-1),a=s.slice(n).map(t.to),d=s.invert().map(l,-1),c=s.invert().map(a),h=l>0&&(null==(r=o.doc.nodeAt(l-1))?void 0:r.marks.some(e=>e.eq(t.mark))),u=null==(i=o.doc.nodeAt(a))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:d,to:c},newRange:{from:l,to:a},partial:!!(u||h),editor:this.editor,transaction:e,combinedTransform:o})}})};null==(n=null==(r=this.editor.options.coreExtensionOptions)||null==(r=r.delete)?void 0:r.async)||n?setTimeout(i,0):i()}}),oe=i6.create({name:"drop",addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ot=i6.create({name:"editable",addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),on=new h.PluginKey("focusEvents"),or=i6.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new h.Plugin({key:on,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),oi=i6.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:o}=n,{pos:s,parent:l}=o,a=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,d=a.parent.type.spec.isolating,c=o.pos-o.parentOffset,u=d&&1===a.parent.childCount?c===o.pos:h.Selection.atStart(r).from===s;return!!i&&!!l.type.isTextblock&&!l.textContent.length&&!!u&&(!u||"paragraph"!==o.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return n0()||rh()?i:r},addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:l}=t.selection,a=h.Selection.atStart(t.doc).from,d=h.Selection.atEnd(t.doc).to;if(o||s!==a||l!==d||!ie(n.doc))return;let c=n.tr,u=nM({state:n,transaction:c}),{commands:p}=new nj({editor:this.editor,state:u});if(p.clearNodes(),c.steps.length)return c}})]}}),oo=i6.create({name:"paste",addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),ol=i6.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),oa=i6.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=rF(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),od=!1;
8var oc=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+ +!o;if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!i&&!s&&a.depth<=this.depth)return;let d=new e(a,this.editor,i,i||s?n:null);i&&(d.actualDepth=this.depth+1),t.push(d)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};let oh=`.ProseMirror { 9 position: relative; 10} 11 12.ProseMirror { 13 word-wrap: break-word; 14 white-space: pre-wrap; 15 white-space: break-spaces; 16 -webkit-font-variant-ligatures: none; 17 font-variant-ligatures: none; 18 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 19} 20 21.ProseMirror [contenteditable="false"] { 22 white-space: normal; 23} 24 25.ProseMirror [contenteditable="false"] [contenteditable="true"] { 26 white-space: pre-wrap; 27} 28 29.ProseMirror pre { 30 white-space: pre-wrap; 31} 32 33img.ProseMirror-separator { 34 display: inline !important; 35 border: none !important; 36 margin: 0 !important; 37 width: 0 !important; 38 height: 0 !important; 39} 40 41.ProseMirror-gapcursor { 42 display: none; 43 pointer-events: none; 44 position: absolute; 45 margin: 0; 46} 47 48.ProseMirror-gapcursor:after { 49 content: ""; 50 display: block; 51 position: absolute; 52 top: -2px; 53 width: 20px; 54 border-top: 1px solid black; 55 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 56} 57 58@keyframes ProseMirror-cursor-blink { 59 to { 60 visibility: hidden; 61 } 62} 63 64.ProseMirror-hideselection *::selection { 65 background: transparent; 66} 67 68.ProseMirror-hideselection *::-moz-selection { 69 background: transparent; 70} 71 72.ProseMirror-hideselection * { 73 caret-color: transparent; 74} 75 76.ProseMirror-focused .ProseMirror-gapcursor { 77 display: block; 78}`;var ou=class extends iI{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:io,createMappablePosition:is},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit
78("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const e=nZ(t,this.options.autofocus);this.editorState=h.EditorState.create({doc:t,schema:this.schema,selection:e||void 0})}!function(e){let t;if(!od){od=!0;try{t=d.ReplaceStep.fromJSON(e,{from:0,to:0}).slice.content}catch{return}t instanceof c.Fragment||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}}(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():nj.createFakeChain()}can(){return this.commandManager?this.commandManager.can():nj.createFallbackCan()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(oh,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return iz&&!this.hasWarnedStaleDecorationRead&&iL.has(this),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=r$(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;
78if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[ot,i7.configure({blockSeparator:null==(e=this.options.coreExtensionOptions)||null==(e=e.clipboardTextSerializer)?void 0:e.blockSeparator}),i8,or,oi,ol.configure({value:null==(t=this.options.coreExtensionOptions)||null==(t=t.tabindex)?void 0:t.value}),oe,oo,i9,oa.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new i4(n,this)}createCommandManager(){this.commandManager=new nj({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=rT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;let e=rT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=h.EditorState.create({doc:e,schema:this.schema,selection:nZ(e,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new nc(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),l=null==s?void 0:s.getMeta("focus"),a=null==s?void 0:s.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||o.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return rZ(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return rp(e,null,n)||r4(e,null,n);let r=rx(t,e.schema);return"node"===r?rp(e,t,n):"mark"===r&&r4(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}
78getHTML(){return rz(this.state.doc.content,this.schema)}getText(e){var t,n;let{blockSeparator:r="\n\n",textSerializers:i={}}=e||{};return t=this.state.doc,n={blockSeparator:r,textSerializers:{...rG(this.schema),...i}},rX(t,{from:0,to:t.content.size},n)}get isEmpty(){return ie(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return null==(e=null==(t=this.editorView)?void 0:t.isDestroyed)||e}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new oc(t,this,!1,n)}get $doc(){return this.$pos(0)}},op=class{static Inline(e,t,n={},r){return new of(e,t,n,r)}static Node(e,t,n={},r){return new om(e,t,n,r)}static Widget(e,t,n){let{key:r,...i}=n;return new og(e,t,r,i)}},of=class extends op{constructor(e,t,n={},r){super(),this.kind="inline",this.from=e,this.to=t,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(e){let t=e?{...this.spec,extensionName:e}:this.spec;return tX.inline(this.from,this.to,this.attrs,t)}},om=class extends op{constructor(e,t,n={},r){super(),this.kind="node",this.from=e,this.to=t,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(e){let t=e?{...this.spec,extensionName:e}:this.spec;return tX.node(this.from,this.to,this.attrs,t)}},og=class extends op{constructor(e,t,n,r){super(),this.kind="widget",this.pos=e,this.render=t,this.key=n,this.spec=r}get anchor(){return this.pos}toPMDecoration(e){let t=e?{...this.spec,key:this.key,extensionName:e}:{...this.spec,key:this.key};return tX.widget(this.pos,this.render,t)}};function oy(e){return new iQ({find:e.find,handler:({state:t,range:n,match:r})=>{let i=rH(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],l=r[0];if(s){let r=l.search(/\S/),a=n.from+l.indexOf(s),d=a+s.length;if(r0(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>a).length)return null;
78d<n.to&&o.delete(d,n.to),a>n.from&&o.delete(n.from+r,a);let c=n.from+r+s.length;o.addMark(n.from+r,c,e.type.create(i||{})),o.removeStoredMark(e.type)}},undoable:e.undoable})}function ox(e){return new iQ({find:e.find,handler:({state:t,range:n,match:r})=>{let i=rH(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,l=n.to,a=e.type.create(i);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>l?e=l:l=e+r[1].length;let t=r[0][r[0].length-1];o.insertText(t,s+r[0].length-1),o.replaceWith(e,l,a)}else if(r[0]){let t=e.type.isInline?s:s-1;o.insert(t,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(l))}o.scrollIntoView()},undoable:e.undoable})}function ob(e){return new iQ({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=rH(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)},undoable:e.undoable})}function ow(e){return new iQ({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let o=rH(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&(0,d.findWrapping)(l,e.type,o);if(!a)return null;if(s.wrap(l,a),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>i.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,o).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&(0,d.canJoin)(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}var ov=class{constructor(e){var t,n,r,i,o,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==e||null==(r=e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(i=e.options)?void 0:i.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(o=e.options)?void 0:o.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(s=e.options)?void 0:s.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.n
78ame,e.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes("top"),r=t.includes("bottom"),i=t.includes("left"),o=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),i&&(e.style.left="0"),o&&(e.style.right="0"),("top"===t||"bottom"===t)&&(e.style.left="0",e.style.right="0"),("left"===t||"right"===t)&&(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;(t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e))instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),o=this.applyConstraints(r,i,n);this.element.style.width=`${o.width}px`,this.element.style.height=`${o.height}px`,this.onResize&&this.onResize(o.width,o.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,o=e.includes("right"),s=e.includes("left"),l=e.includes("bottom"),a=e.includes("top");return(o?r=this.startWidth+t:s&&(r=this.startWidth-t),l?i=this.startHeight+n:a&&(i=this.startHeight-n),("right"===e||"left"===e)&&(r=this.startWidth+(o?t:-t)),("top"===e||"bottom"===e)&&(i=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed)?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){var r,i,o,s;if(!n){let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return(null==(o=this.maxSize)?void 0:o.width)&&(n=Math.min(this.maxSize.width,n)),(null==(s=this.maxSize)?void 0:s.height)&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let l=e,a=t;return l<this.minSize.width&&(a=(l=this.minSize.width)/this.aspectRatio),a<this.minSize.height&&(l=(a=this.minSize.height)*this.aspectRatio),(null==(r=this.maxSize)?void 0:r.width)&&l>this.maxSize.width&&(a=(l=this.maxSize.width)/this.aspectRatio),(null==(i=this.maxSize)?void 0:i.height)&&a>this.maxSize.height&&(l=(a=this.maxSize.height)*this.aspectRatio),{width:l,height:a}}applyAspectRatio(e,t,n){return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:"top"===n||"bottom"===n?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},ok=class e extends i1{constructor(...e){super(...e),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},oC=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,i,o,s,l;let{view:a}=this.editor,d=e.target,c=3===d.nodeType?null==(t=d.parentElement)?void 0:t.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(d))||!c)return;let u=0,p=0;if(this.dom!==c){let t=this.dom.getBoundingClientRect(),n=c.getBoundingClientRect(),l=null!=(r=e.offsetX)?r:null==(i=e.nativeEvent)?void 0:i.offsetX,a=null!=(o=e.offsetY)?o:null==(s=e.nativeEvent)?void 0:s.offsetY;u=n.x-t.x+l,p=n.y-t.y+a}let f=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();f.style.width=`${Math.round(e.width)}px`,f.style.height=`${Math.round(e.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let m=null;try{(m=document.createElement("div")).style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(f),document.body.appendChild(m),null==(l=e.dataTransfer)||l.setDragImage(f,u,p)}finally{m&&setTimeout(()=>{try{null==m||m.remove()}catch{}},0)}let g=this.getPos();if("number"!=typeof g)return;let y=h.NodeSelection.create(a.state.doc,g),x=a.state.tr.setSelection(y);a.dispatch(x)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!(null==(t=this.contentDOM)?void 0:t.contains(n))))return!1;let r=e.type.startsWith("drag"),i="dragover"===e.type||"dragenter"===e.type,o="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;let{isEditable:s}=this.editor,{isDragging:l}=this,a=!!this.node.type.spec.draggable,d=h.NodeSelection.isSelectable(this.node),c="copy"===e.type,u="paste"===e.type,p="cut"
78===e.type,f="mousedown"===e.type;if(!a&&d&&r&&e.target===this.dom&&e.preventDefault(),a&&r&&!l&&e.target===this.dom)return e.preventDefault(),!1;if(a&&s&&!l&&f){let e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!l&&!i&&!o&&!c&&!u&&!p&&(!f||!d)&&!0}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===e.type||this.dom.contains(e.target)&&"childList"===e.type&&(n0()||nQ())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target)))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if("number"!=typeof e)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function oN(e){return new i3({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=rH(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,l=r[r.length-1],a=r[0],d=n.to;if(l){let i=a.search(/\S/),c=n.from+a.indexOf(l),h=c+l.length;if(r0(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;h<n.to&&s.delete(h,n.to),c>n.from&&s.delete(n.from+i,c),d=n.from+i+l.length,s.addMark(n.from+i,d,e.type.create(o||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||s.removeStoredMark(e.type)}}})}e.s(["Editor",0,ou,"Extension",0,i6,"InputRule",0,iQ,"Mark",0,i2,"MarkView",0,iZ,"Node",0,ok,"NodeView",0,oC,"PasteRule",0,i3,"ResizableNodeView",0,ov,"callOrReturn",0,rH,"canInsertNode",0,iK,"combineTransactionSteps",0,rR,"createWidgetDecoration",0,function(e){let{editor:t,pos:n,key:r,props:i,cacheKey:o,context:s,create:l,materialize:a,side:d,relaxedSide:c,marks:h,stopEvent:u,ignoreSelection:p,destroy:f}=e,m=function(e,t){let n=e[t];if(!n){n={renderers:new Map,props:new Map,pendingProps:new Map,flushScheduled:!1},e[t]=n;let r=n;e.on("destroy",()=>{r.pendingProps.clear(),r.renderers.forEach(e=>e.destroy()),r.renderers.clear(),r.props.clear()})}return n}(t,o);if(m.renderers.has(r)){var g;let e=null!=(g=m.pendingProps.get(r))?g:m.props.get(r);(!e||!function(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Object.is(e[n],t[n]))}(e,i))&&(m.pendingProps.set(r,i),m.flushScheduled||(m.flushScheduled=!0,queueMicrotask(()=>(function(e){for(let[t,n]of(e.flushScheduled=!1,e.pendingProps)){let r=e.renderers.get(t);r&&(r.updateProps(n),e.props.set(t,{...n}))}e.pendingProps.clear()})(m))))}return op.Widget(n,(e,t)=>{let n={...i,...s(t)},o=m.renderers.get(r);return o?o.updateProps(n):(o=l(n),m.renderers.set(r,o),m.props.set(r,{...i})),a(o)},{key:r,side:d,relaxedSide:c,marks:h,stopEvent:u,ignoreSelection:p,destroy:e=>{var n,i,o;if(!(null!=(n=null==(i=t.extensionManager)||null==(i=i.decorationManager)?void 0:i.liveWidgetKeys())?n:iW).has(r))try{null==(o=m.renderers.get(r))||o.destroy(),m.renderers.delete(r),m.props.delete(r),m.pendingProps.delete(r)}finally{null==f||f(e)}}})},"findChildrenInRange",0,rD,"findParentNodeClosestToPos",0,rO,"getAttributes",0,rZ,"getChangedRanges",0,rQ,"getExtensionField",0,rL,"getMarksBetween",0,r0,"getNodeAtPosition",0,r1,"getNodeType",0,nL,"getPreviousBlockSibling",0,r2,"getRenderedAttributes",0,rW,"getStyleProperty",0,iq,"isAtEndOfNode",0,r6,"isAtStartOfNode",0,r7,"isNodeActive",0,rp,"isNodeEmpty",0,ie,"isNodeSelection",0,it,"isNodeViewSelected",0,ir,"markInputRule",0,oy,"markPasteRule",0,oN,"mergeAttributes",0,r_,"nodeInputRule",0,ox,"parseIndentedBlocks",0,iY,"renderNestedMarkdownContent",0,iX,"textblockTypeInputRule",0,ob,"wrappingInputRule",0,ow],10552);let{getOwnPropertyNames:oS,getOwnPropertySymbols:oM}=Object,{hasOwnProperty:oj}=Object.prototype;function oT(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function oA(e){return function(t,n,r){if(!t||!n||"object"!=typeof t||"object"!=typeof n)return e(t,n,r);let{cache:i}
78=r,o=i.get(t),s=i.get(n);if(o&&s)return o===n&&s===t;i.set(t,n),i.set(n,t);let l=e(t,n,r);return i.delete(t),i.delete(n),l}}function oE(e){return oS(e).concat(oM(e))}let oR=Object.hasOwn||((e,t)=>oj.call(e,t));function oD(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:oO,keys:oP}=Object;function oL(e,t){return e.byteLength===t.byteLength&&oq(new Uint8Array(e),new Uint8Array(t))}function oI(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function oz(e,t){return e.byteLength===t.byteLength&&oq(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function o$(e,t){return oD(e.getTime(),t.getTime())}function oH(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function oF(e,t){return e===t}function oB(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),l=e.entries(),a=0;for(;(r=l.next())&&!r.done;){let o=t.entries(),l=!1,d=0;for(;(i=o.next())&&!i.done;){if(s[d]){d++;continue}let o=r.value,c=i.value;if(n.equals(o[0],c[0],a,d,e,t,n)&&n.equals(o[1],c[1],o[0],c[0],e,t,n)){l=s[d]=!0;break}d++}if(!l)return!1;a++}return!0}function oV(e,t,n){let r=oP(e),i=r.length;if(oP(t).length!==i)return!1;for(;i-- >0;)if(!oY(e,t,n,r[i]))return!1;return!0}function o_(e,t,n){let r,i,o,s=oE(e),l=s.length;if(oE(t).length!==l)return!1;for(;l-- >0;)if(!oY(e,t,n,r=s[l])||(i=oO(e,r),o=oO(t,r),(i||o)&&(!i||!o||i.configurable!==o.configurable||i.enumerable!==o.enumerable||i.writable!==o.writable)))return!1;return!0}function oW(e,t){return oD(e.valueOf(),t.valueOf())}function oU(e,t){return e.source===t.source&&e.flags===t.flags}function oK(e,t,n){let r,i,o=e.size;if(o!==t.size)return!1;if(!o)return!0;let s=Array(o),l=e.values();for(;(r=l.next())&&!r.done;){let o=t.values(),l=!1,a=0;for(;(i=o.next())&&!i.done;){if(!s[a]&&n.equals(r.value,i.value,r.value,i.value,e,t,n)){l=s[a]=!0;break}a++}if(!l)return!1}return!0}function oq(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function oJ(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function oY(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||oR(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let oX={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},oG=Object.prototype.toString,oZ=oQ();function oQ(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=function({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:s,areNumbersEqual:l,areObjectsEqual:a,arePrimitiveWrappersEqual:d,areRegExpsEqual:c,areSetsEqual:h,areTypedArraysEqual:u,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let x=typeof m;if(x!==typeof g)return!1;if("object"!==x)return"number"===x?l(m,g,y):"function"===x&&o(m,g,y);let b=m.constructor;if(b!==g.constructor)return!1;if(b===Object)return a(m,g,y);if(Array.isArray(m))return t(m,g,y);if(b===Date)return r(m,g,y);if(b===RegExp)return c(m,g,y);if(b===Map)return s(m,g,y);if(b===Set)return h(m,g,y);let w=oG.call(m);if("[object Date]"===w)return r(m,g,y);if("[object RegExp]"===w)return c(m,g,y);if("[object Map]"===w)return s(m,g,y);if("[object Set]"===w)return h(m,g,y);if("[object Object]"===w)return"function"!=typeof m.then&&"function"!=typeof g.then&&a(m,g,y);if("[object URL]"===w)return p(m,g,y);if("[object Error]"===w)return i(m,g,y);if("[object Arguments]"===w)return a(m,g,y);if(oX[w])return u(m,g,y);if("[object ArrayBuffer]"===w)return e(m,g,y);if("[object DataView]"===w)return n(m,g,y);if("[object Boolean]"===w||"[object Number]"===w||"[object String]"===w)return d(m,g,y);if(f){let e=f[w];if(!e){let t=null!=m?m[Symbol.toStringTag]:void 0;t&&(e=f[t])}if(e)return e(m,g,y)}return!1}}(function({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:oL,areArraysEqual:n?o_:oI,areDataViewsEqual:oz,areDatesEqual:o$,areErrorsEqual:oH,areFunctionsEqual:oF,areMapsEqual:n?oT(oB,o_):oB,areNumbersEqual:oD,areObjectsEqual:n?o_:oV,arePrimitiveWrappersEqual:oW,areRegExpsEqual:oU,areSetsEqual:n?oT(oK,o_):oK,areTypedArraysEqual:n?oT(oq,o_):oq,areUrlsEqual:oJ,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=oA(r.areArraysEqual),t=oA(r.areMapsEqual),n=oA(r.areObjectsEqual),i=oA(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}(e)),s=n?n(o):function(e,t,n,r,i,s,l){return o(e,t,l)};return function({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(o,s){let{cache:l=e?new WeakMap:void 0,meta:a}=n();return t(o,s,{cache:l,equals:r,meta:a,strict:i})};
78if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let o={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,o)}}({circular:t,comparator:o,createState:r,equals:s,strict:i})}oQ({strict:!0}),oQ({circular:!0}),oQ({circular:!0,strict:!0}),oQ({createInternalComparator:()=>oD}),oQ({strict:!0,createInternalComparator:()=>oD}),oQ({circular:!0,createInternalComparator:()=>oD}),oQ({circular:!0,createInternalComparator:()=>oD,strict:!0});var o0=e.i(30224);let o1=({contentComponent:e})=>{let t=(0,s.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,l.jsx)(l.Fragment,{children:Object.values(t)})};var o2=class extends i.default.Component{constructor(e){super(e),this.editorContentRef=i.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,n,r,i;if(t.contentComponent)return;let s=this.editorContentRef.current;s.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:s}),e=new Set,n={},r=!1,i=()=>{!r&&e.size&&(r=!0,queueMicrotask(()=>{r=!1,e.forEach(e=>e())}))},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(e,t){n={...n,[e]:o.default.createPortal(t.reactElement,t.element,e)},i()},removeRenderer(e){let t={...n};delete t[e],n=t,i()}},t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{var t;if(!(null==(t=e.view.dom)?void 0:t.parentNode))return;let n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("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)&&(0,l.jsx)(o1,{contentComponent:e.contentComponent})]})}};let o3=(0,i.forwardRef)((e,t)=>{let n=i.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return i.default.createElement(o2,{key:n,innerRef:t,...e})}),o5=i.default.memo(o3),o4="u">typeof window?i.useLayoutEffect:i.useEffect;var o6=class{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,t=t=>{((null==t?void 0:t.transaction)===void 0||t.transaction!==e)&&(e=null==t?void 0:t.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on("transaction",t),n.on("update",t),()=>{n.off("transaction",t),n.off("update",t)}}}};let o7="u"<typeof window,o8=o7||!!("u">typeof window&&window.next);var o9=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
78=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=null==e||e;return o7?t=!1:o8&&void 0===e&&(t=!1),t?this.createEditor():null}createEditor(){return new ou({...this.options.current,onBeforeCreate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onBeforeCreate)?void 0:t.call(n,...e)},onBlur:(...e)=>{var t,n;return null==(t=(n=this.options.current).onBlur)?void 0:t.call(n,...e)},onCreate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onCreate)?void 0:t.call(n,...e)},onDestroy:(...e)=>{var t,n;return null==(t=(n=this.options.current).onDestroy)?void 0:t.call(n,...e)},onFocus:(...e)=>{var t,n;return null==(t=(n=this.options.current).onFocus)?void 0:t.call(n,...e)},onSelectionUpdate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onSelectionUpdate)?void 0:t.call(n,...e)},onTransaction:(...e)=>{var t,n;return null==(t=(n=this.options.current).onTransaction)?void 0:t.call(n,...e)},onUpdate:(...e)=>{var t,n;return null==(t=(n=this.options.current).onUpdate)?void 0:t.call(n,...e)},onContentError:(...e)=>{var t,n;return null==(t=(n=this.options.current).onContentError)?void 0:t.call(n,...e)},onDrop:(...e)=>{var t,n;return null==(t=(n=this.options.current).onDrop)?void 0:t.call(n,...e)},onPaste:(...e)=>{var t,n;return null==(t=(n=this.options.current).onPaste)?void 0:t.call(n,...e)},onDelete:(...e)=>{var t,n;return null==(t=(n=this.options.current).onDelete)?void 0:t.call(n,...e)},onMount:(...e)=>{var t,n;return null==(t=(n=this.options.current).onMount)?void 0:t.call(n,...e)},onUnmount:(...e)=>{var t,n;return null==(t=(n=this.options.current).onUnmount)?void 0:t.call(n,...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(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===t.length?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{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)}};let se=(0,i.createContext)({editor:null});se.Consumer;let st=(0,i.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),sn=i.default.forwardRef((e,t)=>{let{onDragStart:n}=(0,i.useContext)(st),r=e.as||"div";return(0,l.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function sr(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function si(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}var so=class{constructor(e,{editor:t,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,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.isEditorContentInitialized?(0,o.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,o=function(){try{if(i.version)return parseInt(i.version.split(".")[0],10)>=19}catch{}return!1}(),s=function(e){if(sr(e)||si(e))return!0;
78if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return sr(t)||si(t)}return!1}(t),a={...n};a.ref&&!(o||s)&&delete a.ref,!a.ref&&(o||s)&&(a.ref=e=>{this.ref=e}),this.reactElement=(0,l.jsx)(t,{...a}),null==r||null==(e=r.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==t||null==(e=t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};i.default.createContext({markViewContentRef:()=>{}});var ss=class extends oC{constructor(e,t,n){if(super(e,t,n),this.selectionRafId=null,this.handlePositionUpdate=()=>{let e=this.getPos();"number"==typeof e&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),"function"==typeof this.options.attrs&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!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]");e?e.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){if("storage"===r){var o;return null!=(o=e.storage[t.name])?o:{}}return Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,i.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=>{if(e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement){e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper");let t=function(e){var t;let n=e.getRootNode(),r="function"==typeof n.getSelection?n.getSelection():null==(t=e.ownerDocument)||null==(t=t.defaultView)?void 0:t.getSelection();if(!r||0===r.rangeCount)return null;let{anchorNode:i,anchorOffset:o,focusNode:s,focusOffset:l}=r;return i&&s&&e.contains(i)&&e.contains(s)?()=>{try{r.setBaseAndExtent(i,o,s,l)}catch{}}:null}(this.contentDOMElement);e.appendChild(this.contentDOMElement),null==t||t()}}},n=this.component,r=(0,i.memo)(e=>(0,l.jsx)(st.Provider,{value:t,children:(0,i.createElement)(n,e)}));r.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);let{className:s=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new so(r,{editor:this.editor,props:e,as:o,className:`node-${this.node.type.name} ${s}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes(),this.currentPos=this.getPos()}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}
78get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{var e;this.selectionRafId=null;let t=null!=(e=this.getPos())?e:this.currentPos;if("number"==typeof t)if(ir({selection:this.editor.state.selection,pos:t,nodeSize:this.node.nodeSize,selectedOnTextSelection:this.options.selectedOnTextSelection})){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.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:o,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let o={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(o.getPos=()=>this.getPos()),r(o),!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.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,n=rW(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};Symbol("tiptapReactWidgetCache");let sl=(0,i.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function sa({children:e,...t}){let n="editor"in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,i.useMemo)(()=>({editor:n}),[n]),o=(0,i.useMemo)(()=>({editor:n}),[n]);return(0,l.jsx)(se.Provider,{value:o,children:(0,l.jsx)(sl.Provider,{value:r,children:e})})}function sd({...e}){let{editor:t}=(0,i.useContext)(sl);return(0,l.jsx)(o5,{editor:t,...e})}sl.displayName="TiptapContext",sa.displayName="Tiptap",sd.displayName="Tiptap.Content",Object.assign(sa,{Content:sd}),e.s(["EditorContent",0,o5,"NodeViewWrapper",0,sn,"ReactNodeViewRenderer",0,function(e,t){return n=>n.editor.contentComponent?new ss(e,n,t):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}},"useEditor",0,function(e={},t=[]){let n=(0,i.useRef)(e);n.current=e;let[r]=(0,i.useState)(()=>new o9(n)),o=(0,s.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,i.useDebugValue)(o),(0,i.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,i.useState)(()=>new o6(e.editor)),r=(0,o0.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:oZ);o4(()=>n.watch(e.editor),[e.editor,n]),(0,i.useDebugValue)(r)}({editor:o,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),o}],94499);let sc=new WeakSet,sh=new WeakSet;function su(e){return sc.add(e),e}function sp(e){return Array.isArray(e)&&sc.has(e)}let sf=(e,t)=>
78(function(e,t){if("slot"===e)return 0;if(e instanceof Function){let n=e(t);return!Array.isArray(n)||sp(n)||sh.has(n)?n:su(n)}let{children:n,...r}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(sp(n))return su([e,r,n]);if(0===n.length)return su([e,r]);let t=function e(t){return t.flatMap(t=>null==t?[]:Array.isArray(t)&&sh.has(t)&&!sp(t)?e(t):[t])}(n);return 0===t.length?su([e,r]):su([e,r,...t])}return null!=n?su([e,r,n]):su([e,r])})(e,t),sm=/^\s*>\s$/,sg=ok.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return sf("blockquote",{...r_(this.options.HTMLAttributes,e),children:sf("slot",{})})},parseMarkdown:(e,t)=>{var n;let r=null!=(n=t.parseBlockChildren)?n:t.parseChildren;return t.createNode("blockquote",void 0,r(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return"";let n=[];return e.content.forEach((e,r)=>{var i,o;let s=(null!=(i=null==(o=t.renderChild)?void 0:o.call(t,e,r))?i:t.renderChildren([e])).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(s.join("\n"))}),n.join(` 79> 80`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>((e,t)=>{var n;let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:o}=i;if(0!==o.parentOffset)return!1;let s=o.depth-1;if(s<0)return!1;let l=o.node(s),a=o.index(s);if(0===a)return!1;if(l.type===t)return e.commands.lift(t.name);let d=l.child(a-1);if(d.type!==t||!(null==(n=d.lastChild)?void 0:n.isTextblock))return!1;let u=o.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=o.parent.content,r=new c.Slice(n,0,0);return e.replace(u,o.after(),r),e.setSelection(h.TextSelection.create(e.doc,u+n.size)),e.scrollIntoView(),t(e),!0})})(this.editor,this.type)}},addInputRules(){return[ow({find:sm,type:this.type})]}}),sy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,sx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,sb=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,sw=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,sv=i2.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return sf("strong",{...r_(this.options.HTMLAttributes,e),children:sf("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}}
80,addInputRules(){return[oy({find:sy,type:this.type}),oy({find:sb,type:this.type})]},addPasteRules(){return[oN({find:sx,type:this.type}),oN({find:sw,type:this.type})]}}),sk=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&"`"===e[t.index-1]?null:{index:t.index,text:t[0],replaceWith:t[1]}},sC=e=>{let t,n=/`([^`]+)`(?!`)/g,r=[];for(;null!==(t=n.exec(e));)t.index>0&&"`"===e[t.index-1]||r.push({index:t.index,text:t[0],replaceWith:t[1]});return r},sN=i2.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",r_(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}}
80,addInputRules(){return[oy({find:sk,type:this.type})]},addPasteRules(){return[oN({find:sC,type:this.type})]}}),sS=/^```([a-z]+)?[\s\n]$/,sM=/^~~~([a-z]+)?[\s\n]$/,sj=ok.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",r_(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return(null==(n=e.raw)?void 0:n.startsWith("```"))===!1&&(null==(r=e.raw)?void 0:r.startsWith("~~~"))===!1&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.language)||"";return e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${r} 81 82\`\`\``},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!!e&&t.parent.type.name===this.name&&(!!n||!t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;if(o.parent.type!==this.type)return!1;let l=" ".repeat(n);return s?e.commands.insertContent(l):e.commands.command(({tr:e})=>{let{from:t,to:n}=i,o=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>l+e).join("\n");return e.replaceWith(t,n,r.schema.text(o)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;let n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:i}=r,{$from:o,empty:s}=i;return o.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;let{pos:i}=o,s=o.start(),l=o.end(),a=r.doc.textBetween(s,l,"\n","\n").split("\n"),d=0,c=0,u=i-s;for(let e=0;e<a.length;e+=1){if(c+a[e].length>=u){d=e;break}c+=a[e].length+1}let p=Math.min(((null==(t=a[d].match(/^ */))?void 0:t[0])||"").length,n);if(0===p)return!0;let f=s;for(let e=0;e<d;e+=1)f+=a[e].length+1;return e.delete(f,f+p),i-f<=p&&e.setSelection(h.TextSelection.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{let{from:t,to:o}=i,s=r.doc.textBetween(t,o,"\n","\n").split("\n").map(e=>{var t;let r=Math.min(((null==(t=e.match(/^ */))?void 0:t[0])||"").length,n);return e.slice(r)}).join("\n");return e.replaceWith(t,o,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!!o&&!!s&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||0!==r.parentOffset)return!1;let o=r.before();return!(o>0)&&e.commands.insertDefaultBlock({pos:o})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let s=i.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(h.Selection.near(r.resolve(s))),!0)):e.commands.exitCode())}}}
82,addInputRules(){return[ob({find:sS,type:this.type,getAttributes:e=>({language:e[1]})}),ob({find:sM,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=null==i?void 0:i.mode;if(!n||!o)return!1;let{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:o},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(h.TextSelection.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),sT=ok.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),sA=ok.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",r_(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>` 83`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,l=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&o){let t=l.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),sE=ok.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,r_(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;let r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,i="#".repeat(r);return e.content?`${i} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>ob({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}}
83)\\s$`),type:this.type,getAttributes:{level:e}}))}}),sR=ok.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",r_(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!iK(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return it(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(h.TextSelection.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(h.NodeSelection.create(t.doc,n.pos)):t.setSelection(h.TextSelection.create(t.doc,n.pos));else{let i=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,o=null==i?void 0:i.create();o&&(t.insert(r,o),t.setSelection(h.TextSelection.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[ox({find:/^(?:---|â-|___\s|\*\*\*\s)$/,type:this.t
83ype})]}}),sD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,sO=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,sP=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,sL=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sI=i2.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",r_(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}}
83,addInputRules(){return[oy({find:sD,type:this.type}),oy({find:sP,type:this.type})]},addPasteRules(){return[oN({find:sO,type:this.type}),oN({find:sL,type:this.type})]}}),sz="numeric",s$="ascii",sH="alpha",sF="asciinumeric",sB="alphanumeric",sV="domain",s_="emoji",sW="whitespace";function sU(e,t,n){for(let r in t[sz]&&(t[sF]=!0,t[sB]=!0),t[s$]&&(t[sF]=!0,t[sH]=!0),t[sF]&&(t[sB]=!0),t[sH]&&(t[sB]=!0),t[sB]&&(t[sV]=!0),t[s_]&&(t[sV]=!0),t){let t=(r in n||(n[r]=[]),n[r]);0>t.indexOf(e)&&t.push(e)}}function sK(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}sK.groups={},sK.prototype={accepts(){return!!this.t},go(e){let t=this.j[e];if(t)return t;for(let t=0;t<this.jr.length;t++){let n=this.jr[t][0],r=this.jr[t][1];if(r&&n.test(e))return r}return this.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){let i;return r=r||sK.groups,t&&t.j?i=t:(i=new sK(t),n&&r&&sU(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,o=e.length;if(!o)return i;for(let t=0;t<o-1;t++)i=i.tt(e[t]);return i.tt(e[o-1],t,n,r)},tt(e,t,n,r){if(r=r||sK.groups,t&&t.j)return this.j[e]=t,t;let i,o=this.go(e);return o?(Object.assign((i=new sK).j,o.j),i.jr.push.apply(i.jr,o.jr),i.jd=o.jd,i.t=o.t):i=new sK,t&&(r&&(i.t&&"string"==typeof i.t?sU(t,Object.assign(function(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(i.t,r),n),r):n&&sU(t,n,r)),i.t=t),this.j[e]=i,i}};let sq=(e,t,n,r,i)=>e.ta(t,n,r,i),sJ=(e,t,n,r,i)=>e.tr(t,n,r,i),sY=(e,t,n,r,i)=>e.ts(t,n,r,i),sX=(e,t,n,r,i)=>e.tt(t,n,r,i),sG="WORD",sZ="UWORD",sQ="ASCIINUMERICAL",s0="ALPHANUMERICAL",s1="LOCALHOST",s2="UTLD",s3="SCHEME",s5="SLASH_SCHEME",s4="OPENBRACE",s6="CLOSEBRACE",s7="OPENBRACKET",s8="CLOSEBRACKET",s9="OPENPAREN",le="CLOSEPAREN",lt="OPENANGLEBRACKET",ln="CLOSEANGLEBRACKET",lr="FULLWIDTHLEFTPAREN",li="FULLWIDTHRIGHTPAREN",lo="LEFTCORNERBRACKET",ls="RIGHTCORNERBRACKET",ll="LEFTWHITECORNERBRACKET",la="RIGHTWHITECORNERBRACKET",ld="FULLWIDTHLESSTHAN",lc="FULLWIDTHGREATERTHAN",lh="AMPERSAND",lu="APOSTROPHE",lp="ASTERISK",lf="BACKSLASH",lm="BACKTICK",lg="CARET",ly="COLON",lx="COMMA",lb="DOLLAR",lw="EQUALS",lv="EXCLAMATION",lk="HYPHEN",lC="PERCENT",lN="PIPE",lS="PLUS",lM="POUND",lj="QUERY",lT="QUOTE",lA="FULLWIDTHMIDDLEDOT",lE="SEMI",lR="SLASH",lD="TILDE",lO="UNDERSCORE",lP="EMOJI";var lL=Object.freeze({__proto__:null,ALPHANUMERICAL:s0,AMPERSAND:lh,APOSTROPHE:lu,ASCIINUMERICAL:sQ,ASTERISK:lp,AT:"AT",BACKSLASH:lf,BACKTICK:lm,CARET:lg,CLOSEANGLEBRACKET:ln,CLOSEBRACE:s6,CLOSEBRACKET:s8,CLOSEPAREN:le,COLON:ly,COMMA:lx,DOLLAR:lb,DOT:"DOT",EMOJI:lP,EQUALS:lw,EXCLAMATION:lv,FULLWIDTHGREATERTHAN:lc,FULLWIDTHLEFTPAREN:lr,FULLWIDTHLESSTHAN:ld,FULLWIDTHMIDDLEDOT:lA,FULLWIDTHRIGHTPAREN:li,HYPHEN:lk,LEFTCORNERBRACKET:lo,LEFTWHITECORNERBRACKET:ll,LOCALHOST:s1,NL:"NL",NUM:"NUM",OPENANGLEBRACKET:lt,OPENBRACE:s4,OPENBRACKET:s7,OPENPAREN:s9,PERCENT:lC,PIPE:lN,PLUS:lS,POUND:lM,QUERY:lj,QUOTE:lT,RIGHTCORNERBRACKET:ls,RIGHTWHITECORNERBRACKET:la,SCHEME:s3,SEMI:lE,SLASH:lR,SLASH_SCHEME:s5,SYM:"SYM",TILDE:lD,TLD:"TLD",UNDERSCORE:lO,UTLD:s2,UWORD:sZ,WORD:sG,WS:"WS"});let lI=/[a-z]/,lz=/\p{L}/u,l$=/\p{Emoji}/u,lH=/\d/,lF=/\s/,lB=null,lV=null;function l_(e,t){let n=function(e){let t=[],n=e.length,r=0;for(;r<n;){let i,o=e.charCodeAt(r),s=o<55296||o>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],o=0,s=0;for(;s<r;){let l=e,a=null,d=0,c=null,h=-1,u=-1;for(;s<r&&(a=l.go(n[s]));)(l=a).accepts()?(h=0,u=0,c=l):h>=0&&(h+=n[s].length,u++),d+=n[s].length,o+=n[s].length,s++;o-=h,s-=u,d-=h,i.push({t:c.t,v:t.slice(o-d,o),s:o-d,e:o})}return i}function lW(e,t,n,r,i){let o,s=t.length;for(let n=0;n<s-1;n++){let s=t[n];e.j[s]?o=e.j[s]:((o=new sK(r)).jr=i.slice(),e.j[s]=o),e=o}return(o=new sK(n)).jr=i.slice(),e.j[t[s-1]]=o,o}function lU(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;"0123456789".indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}let lK={defaultProtocol:"http",events:null,format:lJ,formatHref:lJ,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};
83function lq(e,t=null){let n=Object.assign({},lK);e&&(n=Object.assign(n,e instanceof lq?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}function lJ(e){return e}function lY(e,t){this.t="token",this.v=e,this.tk=t}function lX(e,t){class n extends lY{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}lq.prototype={o:lK,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){let r=null!=t,i=this.o[e];return i&&("object"==typeof i?"function"==typeof(i=n.t in i?i[n.t]:lK[e])&&r&&(i=i(t,n)):"function"==typeof i&&r&&(i=i(t,n.t,n))),i},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},lY.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"â¦":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=lK.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){let t=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",t,this),r=e.get("tagName",t,this),i=this.toFormattedString(e),o={},s=e.get("className",t,this),l=e.get("target",t,this),a=e.get("rel",t,this),d=e.getObj("attributes",t,this),c=e.getObj("events",t,this);return o.href=n,s&&(o.class=s),l&&(o.target=l),a&&(o.rel=a),d&&Object.assign(o,d),{tagName:r,attributes:o,content:i,eventListeners:c}}};let lG=lX("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),lZ=lX("text"),lQ=lX("nl"),l0=lX("url",{isLink:!0,toHref(e=lK.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==s1&&e[1].t===ly}}),l1=e=>new sK(e);function l2(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}let l3="u">typeof console&&console&&console.warn||(()=>{}),l5={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function l4(e,t=!1){if(l5.initialized&&l3(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format. 841. Must only contain digits, lowercase ASCII letters or "-" 852. Cannot start or end with "-" 863. "-" cannot repeat`);l5.customSchemes.push([e,t])}function l6(e){return l5.initialized||function(){l5.scanner=function(e=[]){let t={};sK.groups=t;let n=new sK;null==lB&&(lB=lU("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2
86ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==lV&&(lV=lU("ελ1Ï
2бг1ел3деÑи4еÑ2каÑолик6ом3мÐ
86ºÐ´2он1Ñква6онлайн5Ñг3ÑÑÑ2Ñ2ÑайÑ3Ñб3ÑкÑ3Òаз3Õ°Õ¡Õµ3×שר××5×§××3Ø§Ø¨ÙØ¸Ø¨Ù5راÙ
ÙÙ5ÙØ§Ø±Ø¯Ù4Ø¨ØØ±ÙÙ5جزائر5Ø³Ø¹ÙØ¯ÙØ©6عÙÙØ§Ù5Ù
غرب5Ù
ارات5ÛØ±Ø§Ù5بارت2زار4ÙØªÙ3ھارت5تÙÙØ³4Ø³ÙØ¯Ø§Ù3Ø±ÙØ©5Ø´Ø¨ÙØ©4عراÙ2ب2Ù
اÙ4ÙÙØ³Ø·ÙÙ6ÙØ·Ø±3ÙØ§Ø«ÙÙÙÙ6ÙÙ
3Ù
صر2ÙÙØ³Ùا5ÙØ±ÙتاÙÙØ§7ÙØ¹4ÙÙ
راÙ5پاکستاÙ7ÚØ§Ø±Øª4à¤à¥à¤®3नà¥à¤3à¤à¤¾à¤°à¤¤0मà¥3à¥à¤¤5सà¤à¤à¤ न5বাà¦à¦²à¦¾5à¦à¦¾à¦°à¦¤2ৰত4à¨à¨¾à¨°à¨¤4àªàª¾àª°àª¤4à¬à¬¾à¬°à¬¤4à®à®¨à¯à®¤à®¿à®¯à®¾6லà®à¯à®à¯6à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯11à°à°¾à°°à°¤à±5à²à²¾à²°à²¤4à´à´¾à´°à´¤à´5à¶½à¶à¶à·4à¸à¸à¸¡3à¹à¸à¸¢3ລາວ3áá2ã¿ããª3ã¢ãã¾ã³4ã¯ã©ã¦ã4ã°ã¼ã°ã«4ã³ã 2ã¹ãã¢3ã»ã¼ã«3ãã¡ãã·ã§ã³6ãã¤ã³ã4ä¸ç2ä¸ä¿¡1å½1å1æç½3äºé©¬é3ä¼ä¸2ä½å±±2ä¿¡æ¯2å¥åº·2å
«å¦2å
¬å¸1ç2å°æ¹¾1ç£2åå1åº1æ 2åé0大é
åº5å¨çº¿2大æ¿2天主æ3娱ä¹2å®¶é»2广ä¸2å¾®å2æ
å2æç±ä½ 3ææº2æè2æ¿å¡1åº2æ°å å¡2é»2æ¶å°2æ¸ç±2æºæ2淡马é¡3游æ2æ¾³é2ç¹ç2ç§»å¨2ç»ç»æºæ4ç½å1åº1ç«1ç»2èé2è°·æ2è´ç©2é販2éå¢2é»è¨çç§4é£å©æµ¦3é£å2é¤å
2馿 ¼éæ3港2ë·ë·1ì»´2ì¼ì±2íêµ2")),sX(n,"'",lu),sX(n,"{",s4),sX(n,"}",s6),sX(n,"[",s7),sX(n,"]",s8),sX(n,"(",s9),sX(n,")",le),sX(n,"<",lt),sX(n,">",ln),sX(n,"ï¼",lr),sX(n,"ï¼",li),sX(n,"ã",lo),sX(n,"ã",ls),sX(n,"ã",ll),sX(n,"ã",la),sX(n,"ï¼",ld),sX(n,"ï¼",lc),sX(n,"&",lh),sX(n,"*",lp),sX(n,"@","AT"),sX(n,"`",lm),sX(n,"^",lg),sX(n,":",ly),sX(n,",",lx),sX(n,"$",lb),sX(n,".","DOT"),sX(n,"=",lw),sX(n,"!",lv),sX(n,"-",lk),sX(n,"%",lC),sX(n,"|",lN),sX(n,"+",lS),sX(n,"#",lM),sX(n,"?",lj),sX(n,'"',lT),sX(n,"/",lR),sX(n,";",lE),sX(n,"~",lD),sX(n,"_",lO),sX(n,"\\",lf),sX(n,"ã»",lA);let r=sJ(n,lH,"NUM",{[sz]:!0});sJ(r,lH,r);let i=sJ(r,lI,sQ,{[sF]:!0}),o=sJ(r,lz,s0,{[sB]:!0}),s=sJ(n,lI,sG,{[s$]:!0});sJ(s,lH,i),sJ(s,lI,s),sJ(i,lH,i),sJ(i,lI,i);let l=sJ(n,lz,sZ,{[sH]:!0});sJ(l,lI),sJ(l,lH,o),sJ(l,lz,l),sJ(o,lH,o),sJ(o,lI),sJ(o,lz,o);let a=sX(n,"\n","NL",{[sW]:!0}),d=sX(n,"\r","WS",{[sW]:!0}),c=sJ(n,lF,"WS",{[sW]:!0});sX(n,"",c),sX(d,"\n",a),sX(d,"",c),sJ(d,lF,c),sX(c,"\r"),sX(c,"\n"),sJ(c,lF,c),sX(c,"",c);let h=sJ(n,l$,lP,{[s_]:!0});sX(h,"#"),sJ(h,l$,h),sX(h,"ï¸",h);let u=sX(h,"â");sX(u,"#"),sJ(u,l$,h);let p=[[lI,s],[lH,i]],f=[[lI,null],[lz,l],[lH,o]];for(let e=0;e<lB.length;e++)lW(n,lB[e],"TLD",sG,p);for(let e=0;e<lV.length;e++)lW(n,lV[e],s2,sZ,f);sU("TLD",{tld:!0,ascii:!0},t),sU(s2,{utld:!0,alpha:!0},t),lW(n,"file",s3,sG,p),lW(n,"mailto",s3,sG,p),lW(n,"http",s5,sG,p),lW(n,"https",s5,sG,p),lW(n,"ftp",s5,sG,p),lW(n,"ftps",s5,sG,p),sU(s3,{scheme:!0,ascii:!0},t),sU(s5,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{scheme:!0}:{slashscheme:!0};r.indexOf("-")>=0?i[sV]=!0:lI.test(r)?lH.test(r)?i[sF]=!0:i[s$]=!0:i[sz]=!0,sY(n,r,r,i)}return sY(n,"localhost",s1,{ascii:!0}),n.jd=new sK("SYM"),{start:n,tokens:Object.assign({groups:t},lL)}}(l5.customSchemes);for(let e=0;e<l5.tokenQueue.length;e++)l5.tokenQueue[e][1]({scanner:l5.scanner});l5.parser=function({groups:e}){let t=e.domain.concat([lh,lp,"AT",lf,lm,lg,lb,lw,lk,"NUM",lC,lN,lS,lM,lR,"SYM",lD,lO]),n=[lu,ly,lx,"DOT",lv,lC,lj,lT,lE,lt,ln,s4,s6,s8,s7,s9,le,lr,li,lo,ls,ll,la,ld,lc],r=[lh,lu,lp,lf,lm,lg,lb,lw,lk,s4,s6,lC,lN,lS,lM,lj,lR,"SYM",lD,lO],i=l1(),o=sX(i,lD);sq(o,r,o),sq(o,e.domain,o);let s=l1(),l=l1(),a=l1();sq(i,e.domain,s),sq(i,e.scheme,l),sq(i,e.slashscheme,a),sq(s,r,o),sq(s,e.domain,s);let d=sX(s,"AT");sX(o,"AT",d),sX(l,"AT",d),sX(a,"AT",d);let c=sX(o,"DOT");sq(c,r,o),sq(c,e.domain,o);let h=l1();sq(d,e.domain,h),sq(h,e.domain,h);let u=sX(h,"DOT");sq(u,e.domain,h);let p=l1(lG);sq(u,e.tld,p),sq(u,e.utld,p),sX(d,s1,p);let f=sX(h,lk);sX(f,lk,f),sq(f,e.domain,h),sq(p,e.domain,h),sX(p,"DOT",u),sX(p,lk,f);let m=sX(s,lk),g=sX(s,"DOT");sX(m,lk,m),sq(m,e.domain,s),sq(g,r,o),sq(g,e.domain,s);let y=l1(l0);sq(g,e.tld,y),sq(g,e.utld,y),sq(y,e.domain,s),sq(y,r,o),sX(y,"DOT",g),sX(y,lk,m),sX(y,"AT",d);let x=sX(y,ly),b=l1(l0);sq(x,e.numeric,b);let w=l1(l0),v=l1();sq(w,t,w),sq(w,n,v),sq(v,t,w),sq(v,n,v),sX(y,lR,w),sX(b,lR,w);let k=sX(l,ly),C=sX(a,ly),N=sX(C,lR),S=sX(N,lR);sq(l,e.domain,s),sX(l,"DOT",g),sX(l,lk,m),sq(a,e.domain,s),sX(a,"DOT",g),sX(a,lk,m),sq(k,e.domain,w),sX(k,lR,w),sX(k,lj,w),sq(S,e.domain,w),sq(S,t,w),sX(S,lR,w);let M=[[s4,s6],[s7,s8],[s9,le],[lt,ln],[lr,li],[lo,ls],[ll,la],[ld,lc]];for(let e=0;e<M.length;e++){let[r,i]=M[e],o=sX(w,r);sX(v,r,o);let s=l1(l0);sq(o,t,s);let l=l1();sq(o,n,l),sX(o,i,w),sq(s,t,s),sq(s,n,l),sq(l,t,s),sq(l,n,l),sX(s,i,w),sX(l,i,w)}return sX(i,s1,y),sX(i,"NL",lQ),{start:i,tokens:lL}}(l5.scanner.tokens);for(let e=0;e<l5.pluginQueue.length;e++)l5.pluginQueue[e][1]({scanner:l5.scanner,parser:l5.parser});l5.initialized=!0}(),function(e,t,n){let r=n.length,i=0,o=[],s=[];for(;i<r;){let l=e,a=null,d=null,c=0,h=null,u=-1;for(;i<r&&!(a=l.go(n[i].t));)s.push(n[i++]);for(;i<r&&(d=a||l.go(n[i].t));)a=null,(l=d).accepts()?(u=0,h=l):u>=0&&u++,i++,c++;if(u<0)(i-=c)<r&&(s.push(n[i]),i++);else{s.length>0&&(o.push(l2(lZ,t,s)),s=[]),i-=u,c-=u;let e=h.t,r=n.slice(i-c,i);o.push(l2(e,t,r))}}return s.length>0&&o.push(l2(lZ,t,s)),o}(l5.parser.start,e,l_(l5.scanner.start,e))}function l7(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new lq(n),i=l6(e),o=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&o.push(n.toFormattedObject(r))}return o}l6.scan=l_;let l8="[\0-  áá â-\u2029âã]",l9=new RegExp(l8),ae=RegExp(`${l8}$`),at=RegExp(l8,"g"),an=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|â(.*?)â|â(.*?)â))?\)$/,ar=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|â(.*?)â|â(.*?)â))?\)/g;function ai(e,t){let n=0;for(let r=t-1;r>=0&&"\\"===e[r];r-=1)n+=1;return n%2==1}
86function ao(e,t,n){var r,i;let[,o,s]=t;return!((t.index?e[t.index-1]:void 0)==="!"||ai(e,null!=(r=t.index)?r:0)||function(e,t){let n=0,r=0;for(;r<t;){if("`"!==e[r]||0===n&&ai(e,r)){r+=1;continue}let i=0;for(;r<t&&"`"===e[r];)i+=1,r+=1;0===n?n=i:i===n&&(n=0)}return n>0}(e,null!=(i=t.index)?i:0))&&!!o.trim()&&n(s)}function as(e){var t,n;let[r,i,o,,s,l,a]=e,d=null!=(t=null!=s?s:l)?t:a;return{index:null!=(n=e.index)?n:0,text:r,replaceWith:i,data:{href:o,title:d||null,markdown:!0}}}function al(e){var t,n,r;return{href:null==(t=e.data)?void 0:t.href,title:null!=(n=null==(r=e.data)?void 0:r.title)?n:null}}function aa(e,t){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{let t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(at,"").match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}let ad=i2.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"==typeof e?l4(e):l4(e.scheme,e.optionalSlashes)})},onDestroy(){sK.groups={},l5.scanner=null,l5.parser=null,l5.tokenQueue=[],l5.pluginQueue=[],l5.customSchemes=[],l5.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!aa(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;let r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}),addAttributes(){var e,t,n;return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:null!=(e=this.options.HTMLAttributes.target)?e:null},rel:{default:null!=(t=this.options.HTMLAttributes.rel)?t:null},class:{default:null!=(n=this.options.HTMLAttributes.class)?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{let t=e.getAttribute("href");return!!t&&!!this.options.isAllowedUri(t,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",r_(this.options.HTMLAttributes,e),0]:["a",r_(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,i,o;let s=null!=(n=null==(r=e.attrs)?void 0:r.href)?n:"",l=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",a=t.renderChildren(e);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return(!n||!!this.options.isAllowedUri(n,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){var e;let t;return this.options.markdownLinks?[new iQ({find:(t=oy({find:t=>{let n=an.exec(t);return n&&ao(t,n,e.isAllowedHref)?as(n):null}
86,type:(e={type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})}).type,getAttributes:al})).find,handler:e=>{let n=t.handler(e);return null!==n&&e.state.tr.steps.length&&e.state.tr.setMeta("preventAutolink",!0),n}})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;l7(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!aa(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};if(this.options.markdownLinks){var t;let n;return[new i3({find:(n=oN({find:e=>{var n,r;let i=[];for(let n of e.matchAll(ar))ao(e,n,t.isAllowedHref)&&i.push(as(n));let o=(null!=(n=null==(r=t.findPlainUrls)?void 0:r.call(t,e))?n:[]).filter(e=>!i.some(t=>t.index<e.index+e.text.length&&e.index<t.index+t.text.length));return[...i,...o]},type:(t={type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e}).type,getAttributes:al})).find,handler:e=>{var t;let r=n.handler(e);return null!==r&&e.state.tr.steps.length&&(null==(t=e.match.data)?void 0:t.markdown)&&e.state.tr.setMeta("preventAutolink",!0),r}})]}return[oN({find:e,type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){var e,t,n;let r=[],{protocols:i,defaultProtocol:o}=this.options;return this.options.autolink&&r.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!aa(e,i),protocols:i,defaultProtocol:o}),shouldAutoLink:this.options.shouldAutoLink},new h.Plugin({key:new h.PluginKey("autolink"),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),o=t.some(e=>e.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r;if(rQ(rR(n.doc,[...t])).forEach(({newRange:t})=>{let n,i,o=rD(r.doc,t,e=>e.isTextblock);if(o.length>1)n=o[0],i=r.doc.textBetween(n.pos,n.pos+n.node.nodeSize,void 0," ");else if(o.length){let e=r.doc.textBetween(t.from,t.to," "," ");if(!ae.test(e))return;n=o[0],i=r.doc.textBetween(n.pos,t.to,void 0," ")}if(n&&i){let t=i.split(l9).filter(Boolean);if(t.length<=0)return!1;let o=t[t.length-1],l=n.pos+i.lastIndexOf(o);if(!o)return!1;let a=l6(o).map(t=>t.toObject(e.defaultProtocol));if(!(1===a.length?a[0].isLink:3===a.length&&!!a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;a.filter(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{r0(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||s.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),s.steps.length)return s}}))),r.push((t={type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection},new h.Plugin({key:new h.PluginKey("handleClickLink"),props:{handleClick:(e,n,r)=>{if(0!==r.button||!e.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let e=r.target;if(!e)return!1;let n=t.editor.view.dom;(i=e.closest("a"))&&!n.contains(i)&&(i=null)}if(!i)return!1;let o=!1;if(t.enableClickSelection&&(o=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var s,l;let n=rZ(e.state,t.type.name),r=null!=(s=i.href)?s:n.href,a=null!=(l=i.target)?l:n.target;r&&(window.open(r,a),o=!0)}return o}}}))),this.options.linkOnPaste&&r.push((n={editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink},new h.Plugin({key:new h.PluginKey("handlePasteLink"),props:{handlePaste:(e,t,r)=>{let{shouldAutoLink:i}=n,{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";
86r.content.forEach(e=>{a+=e.textContent});let d=l7(a,{defaultProtocol:n.defaultProtocol}).find(e=>e.isLink&&e.value===a);return!!a&&!!d&&(void 0===i||!!i(d.value))&&n.editor.commands.setMark(n.type,{href:d.href})}}}))),r}});e.s(["Link",0,ad,"default",0,ad],63612);let ac="textStyle",ah=/^\s*([-+*])\s$/,au=ok.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",r_(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(ac)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}}
86,addInputRules(){let e=ow({find:ah,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=ow({find:ah,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ac),editor:this.editor})),[e]}}),ap=(e,t)=>i6.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>{let n;return n=this.editor,((e,t,n,r)=>{let i=((e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let o=-1;for(let e=i.depth;e>0;e-=1)if(i.node(e).type.name===t){o=e;break}if(o<0)return null;let s=i.node(o),l=i.index(o);if(l+1>=s.childCount)return null;let a=s.child(l+1);if(!n.includes(a.type.name))return null;let d=e.schema.nodes[t],c=!1;if(a.forEach(e=>{e.type===d&&e.childCount>1&&(c=!0)}),!c)return null;let h=e.doc.resolve(i.after()).nodeAfter;if(!h||!n.includes(h.type.name))return null;let u=[];return(h.forEach(e=>{u.push(e)}),0===u.length)?null:{listItemDepth:o,nestedList:h,nestedListPos:i.after(),insertPos:i.after(o),items:u}})(e,n,r);if(!i)return!1;let{selection:o}=e,{nestedList:s,nestedListPos:l,insertPos:a,items:d}=i,h=e.tr;h.delete(l,l+s.nodeSize);let u=h.mapping.map(a);return h.insert(u,c.Fragment.from(d)),h.setSelection(o.map(h.doc,h.mapping)),t&&t(h),!0})(n.state,n.view.dispatch,e,t)};return{Delete:n,"Mod-Delete":n}}}),af=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],am="abcdefghijklmnopqrstuvwxyz",ag=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function ay(e){let t=e,n="";for(let[e,r]of af)for(;t>=e;)n+=r,t-=e;return n}function ax(e){return ay(e).toUpperCase()}function ab(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,o]of af)if(t.startsWith(o,n)){r+=i,n+=o.length,e=!0;break}if(!e)return 0}return r}function aw(e){if(e<=26)return am[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?am[n]:am[t]+am[n]}function av(e){if(!(!e||/^\d+$/.test(e))){if(function(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=ab(e);return!(t<=0)&&(e===e.toLowerCase()?ay(t):ax(t))===e}(e))return e===e.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(e))return"a";if(/^[A-Z]{1,2}$/.test(e))return"A"}}function ak(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=av(e);if("i"===t||"I"===t)return ab(e);if("a"===t||"A"===t){let t,n=1===(t=e.toLowerCase()).length?t.charCodeAt(0)-97+1:2===t.length?(t.charCodeAt(0)-97+1)*26+(t.charCodeAt(1)-97)+1:0;return n>0?n:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}let aC=ok.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",r_(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{var n,r,i,o;if("list_item"!==e.type)return[];let s=null!=(n=t.parseBlockChildren)?n:t.parseChildren,l=[];if(e.tokens&&e.tokens.length>0){let n;if(n=null==(r=e.tokens)?void 0:r[0],e.text&&(null==(i=e.tokens)?void 0:i.length)===1&&(null==n?void 0:n.type)==="list"&&n.ordered&&n.raw===e.text)return{type:"listItem",content:[{type:"paragraph",content:(o=e.text||"",t.tokenizeInline?t.parseInline(t.tokenizeInline(o)):t.parseInline([{type:"text",raw:o,text:o}]))}]};if(e.tokens.some(e=>"paragraph"===e.type))l=s(e.tokens);else{let n=e.tokens[0];if(n&&"text"===n.type&&n.tokens&&n.tokens.length>0){if(l=[{type:"paragraph",content:t.parseInline(n.tokens)}],e.tokens.length>1){let t=s(e.tokens.slice(1));l.push(...t)}}else l=s(e.tokens)}}return 0===l.length&&(l=[{type:"paragraph",content:[]}]),{type:"listItem",content:l}},renderMarkdown:(e,t,n)=>iX(e,t,e=>{if("bulletList"===e.parentType)return"- ";if("orderedList"===e.parentType){var t,n;let r=(null==(t=e.meta)||null==(t=t.parentAttrs)?void 0:t.start)||1;return function(e,t,n=". "){let r=t+1;if(!e||"1"===e)return`${r}${n}`;switch(e){case"a":return`${aw(r)}${n}`;case"A":return`${aw(r).toUpperCase()}${n}`;case"i":return`${ay(r)}${n}`;case"I":return`${ax(r)}${n}`;default:return`${r}${n}`}}(null==(n=e.meta)||null==(n=n.parentAttrs)?void 0:n.type,r-1+(e.index||0),". ")}return"- "},n),addExtensions(){return[ap(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),aN=(e,t)=>{let{$from:n}=t.selection,r=nL(e,t.schema),i=n.depth,o=n.pos,s=null;for(;i>0&&null===s;)n.node(i).type===r?s=i:(i-=1,o-=1);return null===s?null:{$pos:t.doc.resolve(o),depth:s}},aS=(e,t)=>{let n=aN(e,t);if(!n)return!1;let[,r]=r1(t,e,n.$pos.pos+4);return r},aM=(e,t,n)=>{if(e.commands.undoInputRule())return!0;
86if(e.state.selection.from!==e.state.selection.to)return!1;if(!rp(e.state,t)&&((e,t)=>{let{$anchor:n}=e.selection,r=Math.max(0,n.pos-2),i=e.doc.resolve(r).node();return!!i&&!!t.includes(i.type.name)})(e.state,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let o=i.at(-1);if(!o)return!1;let s=e.state.doc.resolve(r.start()+o.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!rp(e.state,t)||!r7(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type===e.schema.nodes[t]&&0===r.index(i)&&e.chain().liftListItem(t).run()},aj=(e,t)=>{var n,r;let i,o,s,l;if(!rp(e.state,t)||!r6(e.state,t))return!1;let{selection:a}=e.state,{$from:d,$to:c}=a;return!(!a.empty&&d.sameParent(c))&&((i=aS(t,n=e.state),(o=aN(t,n))&&i&&(i>o.depth||0))?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():(s=aS(t,r=e.state),(l=aN(t,r))&&s&&(s<l.depth||0))?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},aT=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:o}=i;if(0!==o.parentOffset||!o.parent.isTextblock||rp(r,t))return!1;let s=r2(o);if(!s||!n.includes(s.type.name))return!1;let l=s.lastChild;if(!l||l.type.name!==t)return!1;let a=o.parent;if(!l.canReplace(l.childCount,l.childCount,c.Fragment.from(a)))return!1;let d=o.before(),u=o.after(),p=d-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(d,u).insert(p,c.Fragment.from(a)),e.setSelection(h.TextSelection.create(e.doc,p+1)),e.scrollIntoView()),!0))},aA=i6.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&aj(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&aj(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&aM(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&aM(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(void 0!==e.state.schema.nodes[t]&&aT(e,t,n))return!0;return!1}}}}),aE=RegExp(`^(\\s*)(${ag})([.)])\\s+(.*)$`),aR=/^\s/,aD={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/},aO=RegExp(`^(${ag})([.)])\\s+(.+)$`),aP="textStyle",aL=/^(\d+)\.\s$/;function aI(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}let az=ok.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute("type");if(t)return t;let n=e.getAttribute("style");if(n){let e=aI(n);if(e)return e}let r=e.querySelector("li");if(r){let e=r.getAttribute("style");if(e){let t=aI(e);if(t)return t}}return null}}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=r_(this.options.HTMLAttributes,r);return 1!==t&&(i.start=t),n&&"1"!==n&&(i.type=n),["ol",i,0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{var n;if("list"!==e.type||!e.ordered)return[];let r=e.start||1,i=e.typeMarker,o=e.items?(n=e.items,n.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>
860&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){let r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})):[],s={};return(1!==r&&(s.start=r),i&&(s.type=i),Object.keys(s).length>0)?{type:"orderedList",attrs:s,content:o}:{type:"orderedList",content:o}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(e,t,n)=>{var r,i;let o=e.split("\n"),[s,l]=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],o=i.match(aE);if(!o)break;let[,s,l,a,d]=o,c=s.length,h=parseInt(l,10),u=isNaN(h)?av(l):void 0,p=isNaN(h)?ak(l):h,f=[d],m=n+1,g=[i],y=!1;for(;m<e.length;){let t=e[m];if(t.match(aE))break;if(""===t.trim())g.push(t),f.push(""),y=!0,m+=1;else if(t.match(aR)){let e=t.length-t.trimStart().length,n=c+l.length+1;g.push(t),f.push(t.slice(Math.min(e,n))),m+=1}else{if(y||function(e){return Object.values(aD).some(t=>t.test(e))}(t))break;g.push(t),f.push(t),m+=1}}t.push({indent:c,number:p,type:u,content:f.join("\n").trim(),contentLines:f,raw:g.join("\n")}),r=m,n=m}return[t,r]}(o);if(0===s.length)return;let a=function e(t,n,r){let i=[],o=0;for(;o<t.length;){let s=t[o];if(s.indent===n){let{paragraphLines:l,blockLines:a}=function(e){let t=[],n=[],r=!1;return e.forEach(e=>{let i;if(r)return void n.push(e);if(""===e.trim()||t.length>0&&(i=e.trimStart(),aD.bulletItem.test(i)||aE.test(i.trimStart())||aD.heading.test(i)||aD.thematicBreak.test(i)&&!i.startsWith("-")||/^>\s?/.test(i)||aD.codeFence.test(i)||aD.blockMath.test(i))){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}(s.contentLines),d=l.join("\n").trim(),c=[];d&&c.push({type:"paragraph",raw:d,tokens:r.inlineTokens(d)});let h=a.join("\n").trim();if(h){let e=r.blockTokens(h);c.push(...e)}let u=o+1,p=[];for(;u<t.length&&t[u].indent>n;)p.push(t[u]),u+=1;if(p.length>0){let t=e(p,Math.min(...p.map(e=>e.indent)),r);c.push({type:"list",ordered:!0,start:p[0].number,typeMarker:p[0].type,items:t,raw:p.map(e=>e.raw).join("\n")})}i.push({type:"list_item",raw:s.raw,tokens:c}),o=u}else o+=1}return i}(s,s[0].indent,n);if(0!==a.length)return{type:"list",ordered:!0,start:(null==(r=s[0])?void 0:r.number)||1,typeMarker:null==(i=s[0])?void 0:i.type,items:a,raw:o.slice(0,l).join("\n")}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(aP)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins:()=>[new h.Plugin({props:{handlePaste:(e,t)=>
86{var n,r;let i=null==(n=t.clipboardData)?void 0:n.getData("text/html");if(null==i?void 0:i.trim())return!1;let o=null==(r=t.clipboardData)?void 0:r.getData("text/plain");if(!o)return!1;let s=function(e){let t=e.split("\n").filter(e=>e.trim().length>0);if(0===t.length)return null;let n=[];for(let e of t){let t=e.trim().match(aO);if(!t)return null;n.push({marker:t[1],content:t[3]})}return!function(e){var t;if(0===e.length)return!1;let n=null!=(t=av(e[0]))?t:"numeric",r=ak(e[0]);if(r<1)return!1;for(let t=0;t<e.length;t++){let i=function(e,t){if("numeric"===e)return String(t);switch(e){case"a":return aw(t);case"A":return aw(t).toUpperCase();case"i":return ay(t);case"I":return ax(t);default:return String(t)}}(n,r+t);if(e[t]!==i)return!1}return!0}(n.map(e=>e.marker))?null:{type:"orderedList",attrs:function(e){let{type:t,start:n}={type:av(e),start:ak(e)},r={};return t&&(r.type=t),1!==n&&(r.start=n),r}(n[0].marker),content:n.map(e=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:e.content}]}]}))}}(o);if(!s)return!1;try{let t=e.state.schema.nodeFromJSON(s),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})],addInputRules(){let e=(e,t)=>(!t.attrs.type||"1"===t.attrs.type)&&t.childCount+t.attrs.start===+e[1],t=ow({find:aL,type:this.t
86ype,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ow({find:aL,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(aP)}),joinPredicate:e,editor:this.editor})),[t]}}),a$=/^\s*(\[([( |x])?\])\s$/,aH=ok.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>{var t;return null!=(t=e.querySelector("div"))?t:e}}]},renderHTML({node:e,HTMLAttributes:t}){return["li",r_(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;let r=`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `;return iX(e,t,r)},addExtensions(){return this.options.nested?[ap(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");s.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";let d=e=>{var t,n,r;let i=(t=e.attrs.checked,(null==(n=this.options.a11y)||null==(r=n.checkboxLabel)?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||"empty task item"}`);l.setAttribute("aria-label",i),s.textContent=i};d(e),o.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",e=>e.preventDefault()),l.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:i}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if("number"!=typeof t)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:i}),!0}).run(),r.isEditable||!this.options.onReadOnlyChecked||this.options.onReadOnlyChecked(e,i)||(l.checked=!l.checked)}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,o.append(l,s),i.append(o,a),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let c=new Set(Object.keys(t));return{dom:i,contentDOM:a,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,d(e);let t=rW(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),o=this.options.HTMLAttributes;return c.forEach(e=>{n.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),c=n,!0}}}},addInputRules(){return[ow({find:a$,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),aF=ok.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",r_(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;let n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){let r=e=>{let t=iY(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:"taskList",raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=iY(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}}
86,addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});i6.create({name:"listKit",addExtensions(){let e=[];return!1!==this.options.bulletList&&e.push(au.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(aC.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(aA.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(az.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(aH.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(aF.configure(this.options.taskList)),e}});let aB=" ",aV=ok.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",r_(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===n.length&&"text"===n[0].type&&(n[0].raw===aB||n[0].text===aB||"Â "===n[0].raw||"Â "===n[0].text)&&1===r.length&&"text"===r[0].type&&(r[0].text===aB||"Â "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return"";let r=Array.isArray(e.content)?e.content:[];if(0===r.length){var i,o;let e=Array.isArray(null==n||null==(i=n.previousNode)?void 0:i.content)?n.previousNode.content:[];return(null==n||null==(o=n.previousNode)?void 0:o.type)==="paragraph"&&0===e.length?aB:""}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),a_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aW=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,aU=i2.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",r_(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[oy({find:a_,type:this.type})]},addPasteRules(){return[oN({find:aW,type:this.type})]}}),aK=ok.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),aq=i2.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",r_(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});e.s(["Underline",0,aq,"default",0,aq],76399);class aJ{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}
86destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(null!=this.cursorPos&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&t&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*a;i={left:r.left,right:r.right,top:o-s,bottom:o+s}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*l;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let d=this.editorView.dom.offsetParent;if(!this.element&&(this.element=d.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),d&&(d!=document.body||"static"!=getComputedStyle(d).position)){let n=d.getBoundingClientRect(),r=n.width/d.offsetWidth,i=n.height/d.offsetHeight;e=n.left-d.scrollLeft*r,t=n.top-d.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/l+"px",this.element.style.top=(i.top-t)/a+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(!t||i)return null;let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=(0,d.dropPoint)(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=e&&(o=e)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);null!=t&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}var aY=h;class aX extends aY.Selection{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return aX.valid(n)?new aX(n):aY.Selection.near(n)}content(){return c.Slice.empty}eq(e){return e instanceof aX&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new aX(e.resolve(t.pos))}getBookmark(){return new aG(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||aZ(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||aZ(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){t:for(;;){if(!n&&aX.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(aX.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!aY.NodeSelection.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue t}break}i=o,r+=t;let s=e.doc.resolve(r);if(aX.valid(s))return s}return null}}}aX.prototype.visible=!1,aX.findFrom=aX.findGapCursorFrom,aY.Selection.jsonID("gapcursor",aX);class aG{constructor(e){this.pos=e}map(e){return new aG(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return aX.valid(t)?new aX(t):aY.Selection.near(t)}}function aZ(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let aQ=nS({ArrowLeft:a0("horiz",-1),ArrowRight:a0("horiz",1),ArrowUp:a0("vert",-1),ArrowDown:a0("vert",1)});function a0(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,l=o.empty;if(o instanceof aY.TextSelection){if(!i.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=e.doc.resolve(t>0?s.after():s.before())}let a=aX.findGapCursorFrom(s,t,l);return!!a&&(r&&r(e.tr.setSelection(new aX(a))),!0)}}function a1(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!aX.valid(r))return!1;
86let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&aY.NodeSelection.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new aX(r))),!0)}function a2(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof aX))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=c.Fragment.empty;for(let e=r.length-1;e>=0;e--)i=c.Fragment.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new c.Slice(i,0,0));return o.setSelection(aY.TextSelection.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function a3(e){if(!(e.selection instanceof aX))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",tQ.create(e.doc,[tX.widget(e.selection.head,t,{key:"gapcursor"})])}var a5=function(){};a5.prototype.append=function(e){return e.length?(e=a5.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},a5.prototype.prepend=function(e){return e.length?a5.from(e).append(this):this},a5.prototype.appendInner=function(e){return new a6(this,e)},a5.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?a5.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},a5.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},a5.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},a5.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},a5.from=function(e){return e instanceof a5?e:e&&e.length?new a4(e):a5.empty};var a4=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(a5);a5.empty=new a4([]);var a6=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(a5);class a7{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(r=(n=this.remapping(s,this.items.length)).maps.length);let l=e.tr,a=[],d=[];
86return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(s,t+1)).maps.length),r--,d.push(e);return}if(n){d.push(new a8(e.map));let t=e.step.map(n.slice(r)),i;t&&l.maybeStep(t).doc&&(i=l.mapping.maps[l.mapping.maps.length-1],a.push(new a8(i,void 0,void 0,a.length+d.length))),r--,i&&n.appendMap(i,r)}else l.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new a7(this.items.slice(0,s).append(d.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:l,selection:i}}addTransform(e,t,n,r){var i,o;let s,l=[],a=this.eventCount,d=this.items,c=!r&&d.length?d.get(d.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new a8(e.mapping.maps[n],i,t),s;(s=c&&c.merge(o))&&(o=s,n?l.pop():d=d.slice(0,d.length-1)),l.push(o),t&&(a++,t=void 0),r||(c=o)}let h=a-n.depth;return h>de&&(i=d,o=h,i.forEach((e,t)=>{if(e.selection&&0==o--)return s=t,!1}),d=i.slice(s),a-=h),new a7(d.append(l),a)}remapping(e,t){let n=new d.Mapping;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new a7(this.items.append(e.map(e=>new a8(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let l=t;this.items.forEach(t=>{let r=i.getMirror(--l);if(null==r)return;o=Math.min(o,r);let a=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),d=t.selection&&t.selection.map(i.slice(l+1,r));d&&s++,n.push(new a8(a,o,d))}else n.push(new a8(a))},r);let a=[];for(let e=t;e<o;e++)a.push(new a8(i.maps[e]));let d=new a7(this.items.slice(0,r).append(a).append(n),s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=o.selection&&o.selection.map(t.slice(n));l&&i++;let a=new a8(s.invert(),e,l),d,c=r.length-1;(d=r.length&&r[c].merge(a))?r[c]=d:r.push(a)}}else o.map&&n--},this.items.length,0),new a7(a5.from(r.reverse()),i)}}a7.empty=new a7(a5.empty,0);class a8{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new a8(t.getMap().invert(),t,this.selection)}}}class a9{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let de=20;function dt(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function dn(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let dr=!1,di=null;function ds(e){let t=e.plugins;if(di!=t){dr=!1,di=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){dr=!0;break}}return dr}let dl=new h.PluginKey("history"),da=new h.PluginKey("closeHistory");function dd(e,t){return(n,r)=>{let i=dl.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=ds(t),i=dl.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),a=new a9(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(dl,{redo:n,historyState:a})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let dc=dd(!1,!0),dh=dd(!0,!0);dd(!1,!1),dd(!0,!1),i6.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new h.Plugin({key:new h.PluginKey("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,o=this.options.autoTrim;if(null==i||0===i||!1===o){e=!0;return}let s=this.storage.characters({node:r.doc});if(s>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,s-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;
86if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos;return e.deleteRange(o-(i-n),o),!(this.storage.characters({node:e.doc})>n)}})]}});let du=i6.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new h.Plugin({view:t=>new aJ(t,e)})}(this.options)]}});i6.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new h.Plugin({key:new h.PluginKey("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,o=[];if(!n||!r)return tQ.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;s+=1}});let l=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((l+=1,"deepest"===this.options.mode&&s-l>0||"shallowest"===this.options.mode&&l>1)?"deepest"===this.options.mode:void o.push(tX.node(t,t+e.nodeSize,{class:this.options.className})))),tQ.create(e,o)}}})]}});let dp=i6.create({name:"gapCursor",addProseMirrorPlugins:()=>[new aY.Plugin({props:{decorations:a3,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&aX.valid(n)?new aX(n):null,handleClick:a1,handleKeyDown:aQ,handleDOMEvents:{beforeinput
86:a2}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=rH(rL(e,"allowGapCursor",n)))?t:null}}}),df="placeholder",dm=new h.PluginKey("tiptap__placeholder");function dg(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:o,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:d}}=e,c=[a];return s&&c.push(d),tX.node(i,i+o.nodeSize,{class:c.join(" "),[r]:"function"==typeof n?n({editor:t,node:o,pos:i,hasAnchor:l}):n})}function dy(e,t){return"function"==typeof e?e(t):e}function dx({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:o,to:s}){let{anchor:l}=i,a=[],d=e.isEmpty;return r.nodesBetween(o,s,(r,i)=>{let o=l>=i&&l<=i+r.nodeSize,s=!r.isLeaf&&ie(r);return r.type.isTextblock&&(o||!t.showOnlyCurrent)&&s&&a.push(dg({editor:e,isEmptyDoc:d,dataAttribute:n,hasAnchor:o,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:dy(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:o})},node:r,pos:i})),t.includeChildren}),a}function db({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:o}=i,s=[],l=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(o),a=i.depth>0?i.node(1):i.nodeAfter,d=i.depth>0?i.before(1):o;if(a&&a.type.isTextblock&&ie(a)){let r=o>=d&&o<=d+a.nodeSize;s.push(dg({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:dy(t.emptyNodeClass,{editor:e,node:a,pos:d,hasAnchor:r})},node:a,pos:d}))}}else s.push(...dx({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return tQ.create(r,s)}function dw(e,t){let n=e.resolve(t);if(0===n.depth){var r;let e=null!=(r=n.nodeAfter)?r:n.nodeBefore;if(!e)return{from:t,to:t};let i=n.nodeAfter?t:t-e.nodeSize;return{from:i,to:i+e.nodeSize}}let i=n.before(1);return{from:i,to:i+n.node(1).nodeSize}}function dv(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}let dk=i6.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:df,placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[function({editor:e,options:t}){let n=t.dataAttribute?`data-${t.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${df}`,r=t.showOnlyCurrent&&!t.includeChildren;return new h.Plugin({key:dm,...r?{}:{state:function({editor:e,options:t,dataAttribute:n}){return{init(r,i){let o=db({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection});return null!=o?o:tQ.empty},apply:(r,i,o,s)=>r.docChanged||r.selectionSet?function({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:o,selection:s}){let l=e;for(let e of t){let{from:t,to:a}=function(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}(e.from,e.to,o),d=l.find(t,a).filter(e=>e.from>=t&&e.to<=a);d.length&&(l=l.remove(d));let c=dx({editor:n,options:r,dataAttribute:i,doc:o,selection:s,from:t,to:a});c.length&&(l=l.add(o,c))}return l}({decorations:i.map(r.mapping,r.doc),ranges:function(e,t,n){let r=[];if(e.docChanged)for(let t of rQ(e))r.push(...function(e,t){var n,r;let i,o=(n=t.from,r=t.to,i=[],e.forEach((e,t)=>{let o=t+e.nodeSize,s=o+1;t+1<r&&s>n&&i.push({from:t,to:o})}),i);return o.push(dv(e,dw(e,t.from))),t.to>t.from?o.push(dv(e,dw(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&o.push(dv(e,dw(e,Math.min(t.from+1,e.content.size)))),o}(n.doc,t.newRange));return e.selectionSet&&(r.push(dv(n.doc,dw(n.doc,e.mapping.map(t.selection.anchor)))),r.push(dv(n.doc,dw(n.doc,n.selection.anchor)))),function(e){if(0===e.length)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}(r)}(r,o,s),editor:e,options:t,dataAttribute:n,doc:s.doc,selection:s.selection}):i}}({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>db({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>{var r;return t.showOnlyWhenEditable&&!e.isEditable?tQ.empty:null!=(r=dm.getState(n))?r:tQ.empty}}})}({editor:this.editor,options:this.options})]}});function dC(e,t){return!e.selection.empty&&!it(e.selection)&&t.isEditable}function dN({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}i6.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new h.Plugin({key:new h.PluginKey("selection"),props:{decorations:n=>!dC(n,e)||e.isFocused||e.view.dragging?null:tQ.create(n.doc,[tX.inline(n.selection.from,n.selection.to,{class:t.className})]),handleDOMEvents:{blur(t){var n;return!!dC(t.state,e)&&(null==(n=window.getSelection())||n.removeAllRanges(),!1)},focus:t=>!!dC(t.state,e)&&(requestAnimationFrame(()=>
86{!e.isDestroyed&&t.hasFocus()&&t.focus()}),!1)}}})]}});let dS=i6.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new h.PluginKey(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new h.Plugin({key:t,appendTransaction:(e,r,i)=>{let{doc:o,tr:s,schema:l}=i,a=t.getState(i),d=o.content.size,c=l.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&a)return s.insert(d,c.create())},state:{init:(e,t)=>!dN({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!dN({node:e.doc.lastChild,types:r})}})]}}),dM=i6.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>dc(e,t),redo:()=>({state:e,dispatch:t})=>dh(e,t)}),addProseMirrorPlugins(){return[function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new h.Plugin({key:dl,state:{init:()=>new a9(a7.empty,a7.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(dl),o;if(i)return i.historyState;n.getMeta(da)&&(e=new a9(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(dl))if(s.getMeta(dl).redo)return new a9(e.done.addTransform(n,void 0,r,ds(t)),e.undone,dt(n.mapping.maps),e.prevTime,e.prevComposition);else return new a9(e.done,e.undone.addTransform(n,void 0,r,ds(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new a9(e.done.rebased(n,o),e.undone.rebased(n,o),dn(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new a9(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),dn(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=s?dn(e.prevRanges,n.mapping):dt(n.mapping.maps);return new a9(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,ds(t)),a7.empty,l,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?dc:"historyRedo"==n?dh:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}}),dj=i6.create({name:"starterKit",addExtensions(){var e,t,n,r;let i=[];return!1!==this.options.bold&&i.push(sv.configure(this.options.bold)),!1!==this.options.blockquote&&i.push(sg.configure(this.options.blockquote)),!1!==this.options.bulletList&&i.push(au.configure(this.options.bulletList)),!1!==this.options.code&&i.push(sN.configure(this.options.code)),!1!==this.options.codeBlock&&i.push(sj.configure(this.options.codeBlock)),!1!==this.options.document&&i.push(sT.configure(this.options.document)),!1!==this.options.dropcursor&&i.push(du.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&i.push(dp.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&i.push(sA.configure(this.options.hardBreak)),!1!==this.options.heading&&i.push(sE.configure(this.options.heading)),!1!==this.options.undoRedo&&i.push(dM.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&i.push(sR.configure(this.options.horizontalRule)),!1!==this.options.italic&&i.push(sI.configure(this.options.italic)),!1!==this.options.listItem&&i.push(aC.configure(this.options.listItem)),!1!==this.options.listKeymap&&i.push(aA.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&i.push(ad.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&i.push(az.configure(this.options.orderedList)),!1!==this.options.paragraph&&i.push(aV.configure(this.options.paragraph)),!1!==this.options.strike&&i.push(aU.configure(this.options.strike)),!1!==this.options.text&&i.push(aK.configure(this.options.text)),!1!==this.options.underline&&i.push(aq.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&i.push(dS.configure(null==(r=this.options)?void 0:r.trailingNode)),i}});e.s(["default",0,dj],56378),e.s(["default",0,dk],55841);let dT=(e,t=0)=>{let n=[];return!e.children.length||t>
8620||Array.from(e.children).forEach(e=>{"SPAN"===e.tagName?n.push(e):e.children.length&&n.push(...dT(e,t+1))}),n},dA=i2.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{},mergeNestedSpanStyles:!0}),parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>{var t;return!!e.hasAttribute("style")&&(this.options.mergeNestedSpanStyles&&(t=e).children.length&&dT(t).forEach(e=>{var t;let n=e.getAttribute("style"),r=null==(t=e.parentElement)||null==(t=t.closest("span"))?void 0:t.getAttribute("style");e.setAttribute("style",`${r};${n}`)}),{})}}]},renderHTML({HTMLAttributes:e}){return["span",r_(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{let{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(!t.isInline)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),dE=i6.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;let n=null!=(t=iq(e,"background-color"))?t:e.style.backgroundColor;return null==n?void 0:n.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands:()=>({setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()})}),dR=i6.create({name:"color",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;let n=null!=(t=iq(e,"color"))?t:e.style.color;return null==n?void 0:n.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands:()=>({setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()})}),dD=i6.create({name:"fontFamily",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>{var t;return null!=(t=iq(e,"font-family"))?t:e.style.fontFamily},renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands:()=>({setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()})}),dO=i6.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>{var t;return null!=(t=iq(e,"font-size"))?t:e.style.fontSize},renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands:()=>({setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()})}),dP=i6.create({name:"lineHeight",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>{var t;return null!=(t=iq(e,"line-height"))?t:e.style.lineHeight},renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands:()=>({setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()})});i6.create({name:"textStyleKit",addExtensions(){let e=[];return!1!==this.options.backgroundColor&&e.push(dE.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(dR.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(dD.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(dO.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(dP.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(dA.configure(this.options.textStyle)),e}}),e.s(["Color",0,dR,"FontFamily",0,dD,"TextStyle",0,dA],34236),e.s([],27427);let dL=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,dI=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,dz=i2.create({name:"highlight",addOptions:()=>({multicolor:!1,HTMLAttributes:{}}),addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||iq(e,"background-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML:()=>[{tag:"mark"}],renderHTML({HTMLAttributes:e}){return["mark",r_(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){let r=/^(==)([^=]+)(==)/.exec(e);if(r){let e=r[2].trim(),t=n.inlineTokens(e);return{type:"highlight",raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}}
86,addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[oy({find:dL,type:this.type})]},addPasteRules(){return[oN({find:dI,type:this.type})]}});e.s(["default",0,dz],3819);let d$=i2.create({name:"subscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sub"},{style:"vertical-align",getAttrs:e=>"sub"===e&&null}],renderHTML({HTMLAttributes:e}){return["sub",r_(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}});e.s(["default",0,d$],92326);let dH=i2.create({name:"superscript",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"sup"},{style:"vertical-align",getAttrs:e=>"super"===e&&null}],renderHTML({HTMLAttributes:e}){return["sup",r_(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});e.s(["default",0,dH],2323);var dF=h;if("u">typeof WeakMap){let e=new WeakMap;t=t=>e.get(t),n=(t,n)=>(e.set(t,n),n)}else{let e=[],r=0;t=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},n=(t,n)=>(10==r&&(r=0),e[r++]=t,e[r++]=n)}var dB=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,o=r+1,s=i+1;for(let e=1;o<this.width&&this.map[t+e]==n;e++)o++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:i,right:o,bottom:s}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:o,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:i==this.width)?null:this.map[o*this.width+(n<0?r-1:i)]:(n<0?0==o:s==this.height)?null:this.map[r+this.width*(n<0?o-1:s)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:o}=this.findCell(e),{left:s,right:l,top:a,bottom:d}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(i,a),right:Math.max(r,l),bottom:Math.max(o,d)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let o=r*this.width+i,s=this.map[o];!n[s]&&(n[s]=!0,i==e.left&&i&&this.map[o-1]==s||r==e.top&&r&&this.map[o-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let o=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?o-1:this.map[n]}i=o}}static get(e){return t(e)||n(e,function(e){if("table"!=e.type.spec.tableRole)throw RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),o=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(o+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);o+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=o:t!=o&&(t=Math.max(t,o))}return t}(e),n=e.childCount,r=[],i=0,o=null,s=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let l=0,a=0;l<n;l++){let d=e.child(l);a++;for(let e=0;;e++){for(;i<r.length&&0!=r[i];)i++;if(e==d.childCount)break;let c=d.child(e),{colspan:h,rowspan:u,colwidth:p}=c.attrs;for(let e=0;e<u;e++){if(e+l>=n){(o||(o=[])).push({type:"overlong_rowspan",pos:a,n:u-e});break}let d=i+e*t;for(let e=0;e<h;e++){0==r[d+e]?r[d+e]=a:(o||(o=[])).push({type:"collision",row:l,pos:a,n:h-e});let n=p&&p[e];if(n){let r=(d+e)%t*2,i=s[r];null==i||i!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):i==n&&s[r+1]++}}}i+=h,a+=c.nodeSize}let c=(l+1)*t,h=0;for(;i<c;)0==r[i++]&&h++;h&&(o||(o=[])).push({type:"missing",row:l,n:h}),a++}(0===t||0===n)&&(o||(o=[])).push({type:"zero_sized"});let l=new dB(t,n,r,o),a=!1;for(let e=0;!a&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(a=!0);return a&&function(e,t,n){e.problems||(e.problems=[]);let r={};for(let i=0;i<e.map.length;i++){let o=e.map[i];if(r[o])continue;r[o]=!0;let s=n.nodeAt(o);if(!s)throw RangeError(`No cell with offset ${o} found`);let l=null,a=s.attrs;for(let n=0;n<a.colspan;n++){let r=t[(i+n)%e.width*2];null==r||a.colwidth&&a.colwidth[n]==r||((l||(l=function(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}(a)))[n]=r)}l&&e.problems.unshift({type:"colwidth mismatch",pos:o,colwidth:l})}}(l,s,e),l}(e))}};function dV(e){let t=e.cached.tableNodeTypes;
86if(!t)for(let n in t=e.cached.tableNodeTypes={},e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}return t}let d_=new dF.PluginKey("selectingCells");function dW(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function dU(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function dK(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;let n=dW(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function dq(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function dJ(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function dY(e,t,n){let r=e.node(-1),i=dB.get(r),o=e.start(-1),s=i.nextCell(e.pos-o,t,n);return null==s?null:e.node(0).resolve(o+s)}function dX(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function dG(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var dZ=class e extends dF.Selection{constructor(e,t=e){const n=e.node(-1),r=dB.get(n),i=e.start(-1),o=r.rectBetween(e.pos-i,t.pos-i),s=e.node(0),l=r.cellsInRect(o).filter(e=>e!=t.pos-i);l.unshift(t.pos-i);const a=l.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new dF.SelectionRange(s.resolve(r),s.resolve(r+t.content.size))});super(a[0].$from,a[0].$to,a),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(dq(r)&&dq(i)&&dJ(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return dF.TextSelection.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=dB.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},o=[];for(let n=r.top;n<r.bottom;n++){let s=[];for(let o=n*t.width+r.left,l=r.left;l<r.right;l++,o++){let n=t.map[o];if(i[n])continue;i[n]=!0;let l=t.findCell(n),a=e.nodeAt(n);if(!a)throw RangeError(`No cell with offset ${n} found`);let d=r.left-l.left,c=l.right-r.right;if(d>0||c>0){let e=a.attrs;if(d>0&&(e=dX(e,0,d)),c>0&&(e=dX(e,e.colspan-c,c)),l.left<r.left){if(!(a=a.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else a=a.type.create(e,a.content)}if(l.top<r.top||l.bottom>r.bottom){let e={...a.attrs,rowspan:Math.min(l.bottom,r.bottom)-Math.max(l.top,r.top)};a=l.top<r.top?a.type.createAndFill(e):a.type.create(e,a.content)}s.push(a)}o.push(e.child(n).copy(c.Fragment.from(s)))}let s=this.isColSelection()&&this.isRowSelection()?e:o;return new c.Slice(c.Fragment.from(s),1,1)}replace(e,t=c.Slice.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=e.mapping.slice(n);e.replace(l.map(o.pos),l.map(s.pos),i?c.Slice.empty:t)}let i=dF.Selection.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new c.Slice(c.Fragment.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=dB.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);return!(Math.min(e,t)>0)&&Math.max(e+this.$anchorCell.nodeAfter.attrs.rowspan,t+this.$headCell.nodeAfter.attrs.rowspan)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=dB.get(r),o=t.start(-1),s=i.findCell(t.pos-o),l=i.findCell(n.pos-o),a=t.node(0);return s.top<=l.top?(s.top>0&&(t=a.resolve(o+i.map[s.left])),l.bottom<i.height&&(n=a.resolve(o+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(o+i.map[l.left])),s.bottom<i.height&&(t=a.resolve(o+i.map[i.width*(i.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=dB.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);return!(Math.min(r,i)>0)&&Math.max(r+this.$anchorCell.nodeAfter.attrs.colspan,i+this.$headCell.nodeAfter.attrs.colspan)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=dB.get(r),o=t.start(-1),s=i.findCell(t.pos-o),l=i.findCell(n.pos-o),a=t.node(0);return s.left<=l.left?(s.left>0&&(t=a.resolve(o+i.map[s.top*i.width])),l.right<i.width&&(n=a.resolve(o+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(o+i.map[l.top*i.width])),s.right<i.width&&(t=a.resolve(o+i.map[i.width*(s.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new dQ(this.$anchorCell.pos,this.$headCell.pos)}};dZ.prototype.visible=!1,dF.Selection.jsonID("cell",dZ);var dQ=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&dJ(t,n)?new dZ(t,n):dF.Selection.near(n,1)}};function d0(e){if(!(e.selection instanceof dZ))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(tX.node(n,n+e.nodeSize,{class:"selectedCell"}))}),tQ.create(e.doc,t)}let d1=new dF.PluginKey("fix-tables");function d2(e,t){let n,r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){let i,o,s=dB.get(t);if(!s.problems)return r;r||(r=e.tr);let l=[];for(let e=0;e<s.height;e++)l.push(0);for(let e=0;e<s.problems.length;e++){let i=s.problems[e];if("collision"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;let o=e.attrs;for(let e=0;e<o.rowspan;e++)l[i.row+e]+=i.n;
86r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,dX(o,o.colspan-i.n,i.n))}else if("missing"==i.type)l[i.row]+=i.n;else if("overlong_rowspan"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-i.n})}else if("colwidth mismatch"==i.type){let e=t.nodeAt(i.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+i.pos),null,{...e.attrs,colwidth:i.colwidth})}else if("zero_sized"==i.type){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}for(let e=0;e<l.length;e++)l[e]&&(null==i&&(i=e),o=e);for(let a=0,d=n+1;a<s.height;a++){let n=t.child(a),s=d+n.nodeSize,c=l[a];if(c>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);let l=[];for(let n=0;n<c;n++){let n=dV(e.schema)[t].createAndFill();n&&l.push(n)}let h=(0==a||i==a-1)&&o==a?d+1:s-1;r.insert(r.mapping.map(h),l)}d=s}return r.setMeta(d1,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&function e(t,n,r,i){let o=t.childCount,s=n.childCount;e:for(let l=0,a=0;l<s;l++){let s=n.child(l);for(let e=a,n=Math.min(o,l+3);e<n;e++)if(t.child(e)==s){a=e+1,r+=s.nodeSize;continue e}i(s,r),a<o&&t.child(a).sameMarkup(s)?e(t.child(a),s,r+1,i):s.nodesBetween(0,s.content.size,i,r+1),r+=s.nodeSize}}(t.doc,e.doc,0,r):e.doc.descendants(r),n}function d3(e){let t=e.selection,n=dK(e),r=n.node(-1),i=n.start(-1),o=dB.get(r);return{...t instanceof dZ?o.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):o.findCell(n.pos-i),tableStart:i,map:o,table:r}}function d5(e,{map:t,tableStart:n,table:r},i){let o=i>0?-1:0;(function(e,t,n){let r=dV(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0})(t,r,i+o)&&(o=0==i||i==t.width?null:0);for(let s=0;s<t.height;s++){let l=s*t.width+i;if(i>0&&i<t.width&&t.map[l-1]==t.map[l]){let o=t.map[l],a=r.nodeAt(o);e.setNodeMarkup(e.mapping.map(n+o),null,dG(a.attrs,i-t.colCount(o))),s+=a.attrs.rowspan-1}else{let a=null==o?dV(r.type.schema).cell:r.nodeAt(t.map[l+o]).type,d=t.positionAt(s,i,r);e.insert(e.mapping.map(n+d),a.createAndFill())}}return e}function d4(e,{map:t,tableStart:n,table:r},i){let o=n;for(let e=0;e<i;e++)o+=r.child(e).nodeSize;let s=[],l=i>0?-1:0;(function(e,t,n){var r;let i=dV(t.type.schema).header_cell;for(let o=0;o<e.width;o++)if((null==(r=t.nodeAt(e.map[o+n*e.width]))?void 0:r.type)!=i)return!1;return!0})(t,r,i+l)&&(l=0==i||i==t.height?null:0);for(let o=0,d=t.width*i;o<t.width;o++,d++)if(i>0&&i<t.height&&t.map[d]==t.map[d-t.width]){let i=t.map[d],s=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...s,rowspan:s.rowspan+1}),o+=s.colspan-1}else{var a;let e=null==l?dV(r.type.schema).cell:null==(a=r.nodeAt(t.map[d+l*t.width]))?void 0:a.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(o,dV(r.type.schema).row.create(null,s)),e}function d6(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function d7(e,t){let n=e.selection;if(!(n instanceof dZ)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=d3(e),{map:i}=r;if(function({width:e,height:t,map:n},r){let i=r.top*e+r.left,o=i,s=(r.bottom-1)*e+r.left,l=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[o]==n[o-1]||r.right<e&&n[l]==n[l+1])return!0;o+=e,l+=e}for(let o=r.left;o<r.right;o++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[s]==n[s+e])return!0;i++,s++}return!1}(i,r))return!1;if(t){let n,o,s=e.tr,l={},a=c.Fragment.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let d=i.map[e*i.width+t],c=r.table.nodeAt(d);if(!l[d]&&c)if(l[d]=!0,null==n)n=d,o=c;else{d6(c)||(a=a.append(c.content));let e=s.mapping.map(d+r.tableStart);s.delete(e,e+c.nodeSize)}}if(null==n||null==o)return!0;if(s.setNodeMarkup(n+r.tableStart,null,{...dG(o.attrs,o.attrs.colspan,r.right-r.left-o.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){let e=n+1+o.content.size,t=d6(o)?n+1:e;s.replaceWith(t+r.tableStart,e+r.tableStart,a)}s.setSelection(new dZ(s.doc.resolve(n+r.tableStart))),t(s)}return!0}function d8(e,t){var n;let r=dV(e.schema);return(n=({node:e})=>r[e.type.spec.tableRole],(e,t)=>{let r,i,o=e.selection;if(o instanceof dZ){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(!(r=function(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;
86if("cell"===n||"header_cell"===n)return e.node(t)}return null}(o.$from)))return!1;i=null==(s=dW(o.$from))?void 0:s.pos}if(null==r||null==i||1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(t){let s,l=r.attrs,a=[],d=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let c=d3(e),h=e.tr;for(let e=0;e<c.right-c.left;e++)a.push(d?{...l,colwidth:d&&d[e]?[d[e]]:null}:l);for(let e=c.top;e<c.bottom;e++){let t=c.map.positionAt(e,c.left,c.table);e==c.top&&(t+=r.nodeSize);for(let i=c.left,o=0;i<c.right;i++,o++)(i!=c.left||e!=c.top)&&h.insert(s=h.mapping.map(t+c.tableStart,1),n({node:r,row:e,col:i}).createAndFill(a[o]))}h.setNodeMarkup(i,n({node:r,row:c.top,col:c.left}),a[0]),o instanceof dZ&&h.setSelection(new dZ(h.doc.resolve(o.$anchorCell.pos),s?h.doc.resolve(s):void 0)),t(h)}return!0})(e,t)}function d9(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function ce(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,n){if(!dU(t))return!1;if(n){let r=dV(t.schema),i=d3(t),o=t.tr,s=i.map.cellsInRect("column"==e?{left:i.left,top:0,right:i.right,bottom:i.map.height}:"row"==e?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=s.map(e=>i.table.nodeAt(e));for(let e=0;e<s.length;e++)l[e].type==r.header_cell&&o.setNodeMarkup(i.tableStart+s[e],r.cell,l[e].attrs);if(0===o.steps.length)for(let e=0;e<s.length;e++)o.setNodeMarkup(i.tableStart+s[e],r.header_cell,l[e].attrs);n(o)}return!0};return function(t,n){if(!dU(t))return!1;if(n){let r=dV(t.schema),i=d3(t),o=t.tr,s=d9("row",i,r),l=d9("column",i,r),a=+("column"===e?!!s:"row"===e&&!!l),d="column"==e?{left:0,top:a,right:1,bottom:i.map.height}:"row"==e?{left:a,top:0,right:i.map.width,bottom:1}:i,c="column"==e?l?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;i.map.cellsInRect(d).forEach(e=>{let t=e+i.tableStart,n=o.doc.nodeAt(t);n&&o.setNodeMarkup(t,c,n.attrs)}),n(o)}return!0}}ce("row",{useDeprecatedLogic:!0}),ce("column",{useDeprecatedLogic:!0});let ct=ce("cell",{useDeprecatedLogic:!0});function cn(e){return function(t,n){if(!dU(t))return!1;let r=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(dK(t),e);if(null==r)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(dF.TextSelection.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}}function cr(e,t){let n=e.selection;if(!(n instanceof dZ))return!1;if(t){let r=e.tr,i=dV(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new c.Slice(i,0,0))}),r.docChanged&&t(r)}return!0}function ci(e,t){let n=e.createAndFill();return new d.Transform(n).replace(0,n.content.size,t).doc}function co(e,t,n,r,i,o,s,l){if(0==s||s==t.height)return!1;let a=!1;for(let d=i;d<o;d++){let i=s*t.width+d,o=t.map[i];if(t.map[i-t.width]==o){a=!0;let i=n.nodeAt(o),{top:c,left:h}=t.findCell(o);e.setNodeMarkup(e.mapping.slice(l).map(o+r),null,{...i.attrs,rowspan:s-c}),e.insert(e.mapping.slice(l).map(t.positionAt(s,h,n)),i.type.createAndFill({...i.attrs,rowspan:c+i.attrs.rowspan-s})),d+=i.attrs.colspan-1}}return a}function cs(e,t,n,r,i,o,s,l){if(0==s||s==t.width)return!1;let a=!1;for(let d=i;d<o;d++){let i=d*t.width+s,o=t.map[i];if(t.map[i-1]==o){a=!0;let i=n.nodeAt(o),c=t.colCount(o),h=e.mapping.slice(l).map(o+r);e.setNodeMarkup(h,null,dX(i.attrs,s-c,i.attrs.colspan-(s-c))),e.insert(h+i.nodeSize,i.type.createAndFill(dX(i.attrs,0,s-c))),d+=i.attrs.rowspan-1}}return a}function cl(e,t,n,r,i){let o=n?e.doc.nodeAt(n-1):e.doc;if(!o)throw Error("No table found");let s=dB.get(o),{top:l,left:a}=r,d=a+i.width,h=l+i.height,u=e.tr,p=0;function f(){if(!(o=n?u.doc.nodeAt(n-1):u.doc))throw Error("No table found");s=dB.get(o),p=u.mapping.maps.length}(function(e,t,n,r,i,o){let s,l,a=dV(e.doc.type.schema);if(i>t.width)for(let o=0,d=0;o<t.height;o++){let c,h=n.child(o);d+=h.nodeSize;let u=[];c=null==h.lastChild||h.lastChild.type==a.cell?s||(s=a.cell.createAndFill()):l||(l=
86a.header_cell.createAndFill());for(let e=t.width;e<i;e++)u.push(c);e.insert(e.mapping.slice(0).map(d-1+r),u)}if(o>t.height){let d=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==a.header_cell;d.push(i?l||(l=a.header_cell.createAndFill()):s||(s=a.cell.createAndFill()))}let h=a.row.create(null,c.Fragment.from(d)),u=[];for(let e=t.height;e<o;e++)u.push(h);e.insert(e.mapping.slice(0).map(r+n.nodeSize-2),u)}return!!(s||l)})(u,s,o,n,d,h)&&f(),co(u,s,o,n,a,d,l,p)&&f(),co(u,s,o,n,a,d,h,p)&&f(),cs(u,s,o,n,l,h,a,p)&&f(),cs(u,s,o,n,l,h,d,p)&&f();for(let e=l;e<h;e++){let t=s.positionAt(e,a,o),r=s.positionAt(e,d,o);u.replace(u.mapping.slice(p).map(t+n),u.mapping.slice(p).map(r+n),new c.Slice(i.rows[e-l],0,0))}f(),u.setSelection(new dZ(u.doc.resolve(n+s.positionAt(l,a,o)),u.doc.resolve(n+s.positionAt(h-1,d-1,o)))),t(u)}let ca=nS({ArrowLeft:cc("horiz",-1),ArrowRight:cc("horiz",1),ArrowUp:cc("vert",-1),ArrowDown:cc("vert",1),"Shift-ArrowLeft":ch("horiz",-1),"Shift-ArrowRight":ch("horiz",1),"Shift-ArrowUp":ch("vert",-1),"Shift-ArrowDown":ch("vert",1),Backspace:cr,"Mod-Backspace":cr,Delete:cr,"Mod-Delete":cr});function cd(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function cc(e,t){return(n,r,i)=>{if(!i)return!1;let o=n.selection;if(o instanceof dZ)return cd(n,r,dF.Selection.near(o.$headCell,t));if("horiz"!=e&&!o.empty)return!1;let s=cm(i,e,t);if(null==s)return!1;if("horiz"==e)return cd(n,r,dF.Selection.near(n.doc.resolve(o.head+t),t));{let i,o=n.doc.resolve(s),l=dY(o,e,t);return i=l?dF.Selection.near(l,1):t<0?dF.Selection.near(n.doc.resolve(o.before(-1)),-1):dF.Selection.near(n.doc.resolve(o.after(-1)),1),cd(n,r,i)}}}function ch(e,t){return(n,r,i)=>{let o;if(!i)return!1;let s=n.selection;if(s instanceof dZ)o=s;else{let r=cm(i,e,t);if(null==r)return!1;o=new dZ(n.doc.resolve(r))}let l=dY(o.$headCell,e,t);return!!l&&cd(n,r,new dZ(o.$anchorCell,l))}}function cu(e,t){let n=dW(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new dZ(n))),!0)}function cp(e,t,n){if(!dU(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;let i=t.child(0),o=i.type.spec.tableRole,s=i.type.schema,l=[];if("row"==o)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,o=e?0:Math.max(0,n-1),a=e<t.childCount-1?0:Math.max(0,r-1);(o||a)&&(i=ci(dV(s).row,new c.Slice(i,o,a)).content),l.push(i)}else{if("cell"!=o&&"header_cell"!=o)return null;l.push(n||r?ci(dV(s).row,new c.Slice(t,n,r)).content:t)}return function(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:o}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+o}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(c.Fragment.empty),n[i]<r){let o=dV(e).cell.createAndFill(),s=[];for(let e=n[i];e<r;e++)s.push(o);t[i]=t[i].append(c.Fragment.from(s))}return{height:t.length,width:r,rows:t}}(s,l)}(n),i=e.state.selection;if(i instanceof dZ){r||(r={width:1,height:1,rows:[c.Fragment.from(ci(dV(e.state.schema).cell,n))]});let t=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),s=dB.get(t).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=function({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let o=n[e],s=[];for(let n=t[e]||0,i=0;n<r;i++){let l=o.child(i%o.childCount);n+l.attrs.colspan>r&&(l=l.type.createChecked(dX(l.attrs,l.attrs.colspan,n+l.attrs.colspan-r),l.content)),s.push(l),n+=l.attrs.colspan;for(let n=1;n<l.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+l.attrs.colspan}i.push(c.Fragment.from(s))}n=i,e=r}if(t!=i){let e=[];for(let r=0,o=0;r<i;r++,o++){let s=[],l=n[o%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),s.push(t)}e.push(c.Fragment.from(s))}n=e,t=i}return{width:e,height:t,rows:n}}(r,s.right-s.left,s.bottom-s.top),cl(e.state,e.dispatch,o,s,r),!0}if(!r)return!1;{let t=dK(e.state),n=t.start(-1);return cl(e.state,e.dispatch,n,dB.get(t.node(-1)).findCell(t.pos-n),r),!0}}function cf(e,t){var n;let r;if(0!=t.button||t.ctrlKey||t.metaKey)return;let i=cg(e,t.target);if(t.shiftKey&&e.state.selection instanceof dZ)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&i&&null!=(r=dW(e.state.selection.$anchor))&&(null==(n=cy(e,t))?void 0:n.pos)!=r.pos)o(r,t),t.preventDefault();else if(!i)return;function o(t,n){let r=cy(e,n),i=null==d_.getState(e.state);if(!r||!dJ(t,r))if(!i)return;else r=t;let o=new dZ(t,r);if(i||!e.state.selection.eq(o)){let n=e.state.tr.setSelection(o);i&&n.setMeta(d_,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",l),null!=d_.getState(e.state)&&e.dispatch(e.state.tr.setMeta(d_,-1))}function l(n){let r,l=d_.getState(e.state);if(null!=l)r=e.state.doc.resolve(l);else if(cg(e,n.target)!=i&&!(r=cy(e,t)))return s();r&&o(r,n)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",l)}function cm(e,t,n){if(!(e.state.selection instanceof dF.TextSelection))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let o=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:o.childCount))break;if("cell"==o.type.spec.tableRole||"header_cell"==o.type.spec.tableRole){let o=r.before(i),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?o:null}}return null}function cg(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function cy(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&dW(e.state.doc.resolve(r))||dW(e.state.doc.resolve(i))}var cx=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),cb(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,cb(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function cb(e,t,n,r,i,o){let s=0,l=!0,a=t.firstChild,d=e.firstChild;if(d){for(let e=0,n=0;
86e<d.childCount;e++){let{colspan:c,colwidth:h}=d.child(e).attrs;for(let e=0;e<c;e++,n++){let d=i==n?o:h&&h[e],c=d?d+"px":"";if(s+=d||r,d||(l=!1),a)a.style.width!=c&&(a.style.width=c),a=a.nextSibling;else{let e=document.createElement("col");e.style.width=c,t.appendChild(e)}}}for(;a;){var c;let e=a.nextSibling;null==(c=a.parentNode)||c.removeChild(a),a=e}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}let cw=new dF.PluginKey("tableColumnResizing");var cv=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=t.getMeta(cw);if(n&&null!=n.setHandle)return new e(n.setHandle,!1);if(n&&void 0!==n.setDragging)return new e(this.activeHandle,n.setDragging);if(this.activeHandle>-1&&t.docChanged){let n=t.mapping.map(this.activeHandle,-1);return dq(t.doc.resolve(n))||(n=-1),new e(n,this.dragging)}return this}};function ck(e,t,n,r){let i=e.posAtCoords({left:t.clientX+("right"==n?-r:r),top:t.clientY});if(!i)return -1;let{pos:o}=i,s=dW(e.state.doc.resolve(o));if(!s)return -1;if("right"==n)return s.pos;let l=dB.get(s.node(-1)),a=s.start(-1),d=l.map.indexOf(s.pos-a);return d%l.width==0?-1:a+l.map[d-1]}function cC(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function cN(e,t){e.dispatch(e.state.tr.setMeta(cw,{setHandle:t}))}function cS(e,t,n,r){let i=e.state.doc.resolve(t),o=i.node(-1),s=i.start(-1),l=dB.get(o).colCount(i.pos-s)+i.nodeAfter.attrs.colspan-1,a=e.domAtPos(i.start(-1)).node;for(;a&&"TABLE"!=a.nodeName;)a=a.parentNode;a&&cb(o,a.firstChild,a,r,l,n)}function cM(e){return"left"===e||"right"===e||"center"===e?e:null}function cj(){return{default:null,parseHTML:e=>{let t,n;return t=(e.style.textAlign||"").trim().toLowerCase(),n=(e.getAttribute("align")||"").trim().toLowerCase(),cM(t||n)},renderHTML:e=>e.align?{style:`text-align: ${e.align}`}:{}}}function cT(e){let t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):function(e){var t;let n=e.parentElement,r=e.closest("table");if(!n||!r)return null;let i=Array.from(n.children).indexOf(e),o=null==(t=r.querySelectorAll("colgroup > col")[i])?void 0:t.getAttribute("width");return o?[parseInt(o,10)]:null}(e)}let cA=/[ \t\r\n\f]+/g;function cE(e){var t;return!(e.children.length>0)&&""===(null!=(t=e.textContent)?t:"").replace(cA,"")}function cR(e){let t=e.createAndFill();if(!t)throw Error(`[tiptap error]: "${e.name}" has no default content to backfill.`);return t.content}let cD=ok.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:cT},align:cj()}),tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:e=>!!cE(e)&&{},getContent:(e,t)=>cR(t.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",r_(this.options.HTMLAttributes,e),0]}}),cO=ok.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:cT},align:cj()}),tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:e=>!!cE(e)&&{},getContent:(e,t)=>cR(t.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",r_(this.options.HTMLAttributes,e),0]}}),cP=ok.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes:e}){return["tr",r_(this.options.HTMLAttributes,e),0]}});function cL(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function cI(e,t,n,r,i,o){let s=0,l=!0,a=t.firstChild,d=e.firstChild;if(null!==d)for(let e=0,n=0;e<d.childCount;e+=1){let{colspan:c,colwidth:h}=d.child(e).attrs;for(let e=0;e<c;e+=1,n+=1){let d=i===n?o:h&&h[e],c=d?`${d}px`:"";if(s+=d||r,d||(l=!1),a){if(a.style.width!==c){let[e,t]=cL(r,d);a.style.setProperty(e,t)}a=a.nextSibling}else{let e=document.createElement("col"),[n,i]=cL(r,d);e.style.setProperty(n,i),t.appendChild(e)}}}for(;a;){var c;let e=a.nextSibling;null==(c=a.parentNode)||c.removeChild(a),a=e}let h=e.attrs.style&&"string"==typeof e.attrs.style&&/\bwidth\s*:/i.test(e.attrs.style);l&&!h?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}var cz=class{constructor(e,t,n,r={}){for(const[n,i]of(this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),Object.entries(r)))null!=i&&("style"===n?this.table.style.cssText=String(i):this.table.setAttribute(n,Str
86ing(i)));e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),cI(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type===this.node.type&&(this.node=e,cI(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){let t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!n&&!r&&("attributes"===e.type||"childList"===e.type||"characterData"===e.type)}};function c$(e,t){return t?e.createChecked(null,t):e.createAndFill()}let cH=({editor:e})=>{let{selection:t}=e.state;if(!(t instanceof dZ))return!1;let n=0,r=rO(t.ranges[0].$from,e=>"table"===e.type.name);return null==r||r.node.descendants(e=>{if("table"===e.type.name)return!1;["tableCell","tableHeader"].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)};function cF(e,t){let n=e.mapping.map(t),r=rO(e.selection.$from,e=>"table"===e.type.name);if((null==r?void 0:r.pos)===n)return;let i=e.doc.nodeAt(n);if(!i)return;let o=n+i.nodeSize-1;e.setSelection(h.TextSelection.near(e.doc.resolve(o),-1))}let cB=ok.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:cz,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=function(e,t){let n=0,r=!0,i=[],o=e.firstChild;if(!o)return{};for(let e=0,s=0;e<o.childCount;e+=1){let{colspan:l,colwidth:a}=o.child(e).attrs;for(let e=0;e<l;e+=1,s+=1){let o=void 0===s?void 0:a&&a[e];n+=o||t,o||(r=!1);let[l,d]=cL(t,o);i.push(["col",{style:`${l}: ${d}`}])}}return{colgroup:["colgroup",{},...i],tableWidth:r?`${n}px`:"",tableMinWidth:r?"":`${n}px`}}(e,this.options.cellMinWidth),o=t.style,s=["table",r_(this.options.HTMLAttributes,t,{style:o||(r?`width: ${r}`:`min-width: ${i}`)}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},parseMarkdown:(e,t)=>{let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{var o;let s=cM(null!=(o=r[n])?o:e.align);i.push(t.createNode("tableHeader",s?{align:s}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}return e.rows&&e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{var o;let s=cM(null!=(o=r[n])?o:e.align);i.push(t.createNode("tableCell",s?{align:s}:{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},i))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>(function(e,t,n={}){var r;let i=null!=(r=n.cellLineSeparator)?r:"\x1f";if(!e||!e.content||0===e.content.length)return"";let o=[];e.content.forEach(e=>{let n=[];e.content&&e.content.forEach(e=>{var r;let o=((e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(i):e.content?t.renderChildren(e.content):"").split(i).join("\n").replace(/[ \t]*\r?\n[ \t]*/g,"<br>")||"").replace(/\s+/g," ").trim(),s="tableHeader"===e.type,l=cM(null==(r=e.attrs)?void 0:r.align);n.push({text:o,isHeader:s,align:l})}),o.push(n)});let s=o.reduce((e,t)=>Math.max(e,t.length),0);if(0===s)return"";let l=Array.from({length:s}).fill(0);o.forEach(e=>{for(let n=0;n<s;n+=1){var t;let r=((null==(t=e[n])?void 0:t.text)||"").length;r>l[n]&&(l[n]=r),l[n]<3&&(l[n]=3)}});let a=(e,t)=>e+" ".repeat(Math.max(0,t-e.length)),d=o[0],c=d.some(e=>e.isHeader),h=Array.from({length:s}).fill(null);o.forEach(e=>{for(let n=0;n<s;n+=1){var t;!h[n]&&(null==(t=e[n])?void 0:t.align)&&(h[n]=e[n].align)}});let u="\n",p=Array.from({length:s}).map((e,t)=>c&&d[t]&&d[t].text||"");return u+=`| ${p.map((e,t)=>a(e,l[t])).join(" | ")} | 87| ${l.map((e,t)=>{let n=Math.max(3,e),r=h[t];return"left"===r?`:${"-".repeat(n)}`:"right"===r?`${"-".repeat(n)}:`:"center"===r?`:${"-".repeat(n)}:`:"-".repeat(n)}).join(" | ")} | 88`,(c?o.slice(1):o).forEach(e=>{u+=`| ${Array.from({length:s}).fill(0).map((t,n)=>a(e[n]&&e[n].text||"",l[n])).join(" | ")} | 89`}),u})(e,t),markdownTokenizer:{name:"table",level:"block",start:e=>{let t=e.split("\n");if(t.length<2)return -1;let n=t[1];return/^[ \t|:]*-[ \t|:-]*$/.test(n)&&n.includes("|")&&t[0].includes("|")?0:-1},tokenize(e,t,n){let r=e.indexOf("\n\n"),i=r>=0?e.slice(0,r):e,o=i.split("\n");if(o.length<2)return;let s=o[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(s)||!s.includes("|"))return;let l=i.split("\n").map(e=>e.includes("|")&&e.includes("`")?function(e){let t="",n=0;for(;n<e.length;){if("\\"===e[n]&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}if("`"!==e[n]){t+=e[n++];continue}let r=0;for(;n+r<e.length&&"`"===e[n+r];)r+=1;let i=n+r,o=!1;for(;i<e.length;){if("`"!==e[i]){i+=1;continue}let s=0;for(;i+s<e.length&&"`"===e[i+s];)s+=1;if(s===r){let s=e.slice(n+r,i);t+=e.slice(n,n+r)+s.replace(/\\\||\|/g,e=>"|"===e?"\\|":e)+e.slice(i,i+r),n=i+r,o=!0;break}i+=s}o||(t+=e.slice(n,n+r),n+=r)}return t}(e):e).join("\n");if(l===i)return;let a=n.blockTokens(l)[0];if((null==a?void 0:a.type)!=="table"||!a.raw)return;let d=a.raw.split("\n").length,c=e.split("\n").slice(0,d).join("\n");return{...a,raw:c}}},addCommands:()=>({insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:o})=>
89{let s=function(e,t,n,r){let i=function(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;let t={};return Object.keys(e.nodes).forEach(n=>{let r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}(e),o=[],s=[];for(let e=0;e<n;e+=1){let e=c$(i.cell,void 0);if(e&&s.push(e),r){let e=c$(i.header_cell,void 0);e&&o.push(e)}}let l=[];for(let e=0;e<t;e+=1)l.push(i.row.createChecked(null,r&&0===e?o:s));return i.table.createChecked(null,l)}(o.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(h.TextSelection.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!dU(e))return!1;if(t){let n=d3(e);t(d5(e.tr,n,n.left))}return!0})(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!dU(e))return!1;if(t){let n=d3(e);t(d5(e.tr,n,n.right))}return!0})(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=rO(e.selection.$from,e=>"table"===e.type.name);return function(e,t){if(!dU(e))return!1;if(t){let n=d3(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;!function(e,{map:t,table:n,tableStart:r},i){let o=e.mapping.maps.length;for(let s=0;s<t.height;){let l=s*t.width+i,a=t.map[l],d=n.nodeAt(a),c=d.attrs;if(i>0&&t.map[l-1]==a||i<t.width-1&&t.map[l+1]==a)e.setNodeMarkup(e.mapping.slice(o).map(r+a),null,dX(c,i-t.colCount(a)));else{let t=e.mapping.slice(o).map(r+a);e.delete(t,t+d.nodeSize)}s+=c.rowspan}}(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=dB.get(e)}t(r)}return!0}(e,t&&(e=>{n&&cF(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>(function(e,t){if(!dU(e))return!1;if(t){let n=d3(e);t(d4(e.tr,n,n.top))}return!0})(e,t),addRowAfter:()=>({state:e,dispatch:t})=>(function(e,t){if(!dU(e))return!1;if(t){let n=d3(e);t(d4(e.tr,n,n.bottom))}return!0})(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=rO(e.selection.$from,e=>"table"===e.type.name);return function(e,t){if(!dU(e))return!1;if(t){let n=d3(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;!function(e,{map:t,table:n,tableStart:r},i){let o=0;for(let e=0;e<i;e++)o+=n.child(e).nodeSize;let s=o+n.child(i).nodeSize,l=e.mapping.maps.length;e.delete(o+r,s+r);let a=new Set;for(let o=0,s=i*t.width;o<t.width;o++,s++){let d=t.map[s];if(!a.has(d)){if(a.add(d),i>0&&d==t.map[s-t.width]){let t=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(l).map(d+r),null,{...t,rowspan:t.rowspan-1}),o+=t.colspan-1}else if(i<t.height&&d==t.map[s+t.width]){let s=n.nodeAt(d),a=s.attrs,c=s.type.create({...a,rowspan:s.attrs.rowspan-1},s.content),h=t.positionAt(i+1,o,n);e.insert(e.mapping.slice(l).map(r+h),c),o+=a.colspan-1}}}}(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError("No table found");n.table=e,n.map=dB.get(n.table)}t(r)}return!0}(e,t&&(e=>{n&&cF(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>(function(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1})(e,t),mergeCells:()=>({state:e,dispatch:t})=>d7(e,t),splitCell:()=>({state:e,dispatch:t})=>d8(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>ce("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>ce("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>ct(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>!!d7(e,t)||d8(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>(function(n,r){if(!dU(n))return!1;let i=dK(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let o=n.tr;n.selection instanceof dZ?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&o.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):o.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(o)}return!0})(n,r),goToNextCell:()=>({state:e,dispatch:t})=>cn(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>cn(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&d2(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=dZ.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"
89Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:cH,"Mod-Backspace":cH,Delete:cH,"Mod-Delete":cH}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[function({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=cx,lastColumnResizable:i=!0}={}){let o=new dF.Plugin({key:cw,state:{init(e,t){var i;let s=null==(i=o.spec)||null==(i=i.props)?void 0:i.nodeViews,l=dV(t.schema).table.name;return r&&s&&(s[l]=(e,t)=>new r(e,n,t)),new cv(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=cw.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;let i=cw.getState(e.state);if(i&&!i.dragging){let o=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),s=-1;if(o){let{left:r,right:i}=o.getBoundingClientRect();t.clientX-r<=n?s=ck(e,t,"left",n):i-t.clientX<=n&&(s=ck(e,t,"right",n))}if(s!=i.activeHandle){if(!r&&-1!==s){let t=e.state.doc.resolve(s),n=t.node(-1),r=dB.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}cN(e,s)}}}(t,n,e,i)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=cw.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&cN(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var i;if(!e.editable)return;let o=null!=(i=e.dom.ownerDocument.defaultView)?i:window,s=cw.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return;let l=e.state.doc.nodeAt(s.activeHandle),a=function(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let o=e.domAtPos(t),s=o.node.childNodes[o.offset].offsetWidth,l=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],l--);return s/l}(e,s.activeHandle,l.attrs);function d(t){o.removeEventListener("mouseup",d),o.removeEventListener("mousemove",c);let r=cw.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),o=dB.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=e.state.tr;for(let e=0;e<o.height;e++){let t=e*o.width+l;if(e&&o.map[t]==o.map[t-o.width])continue;let r=o.map[t],d=i.nodeAt(r).attrs,c=1==d.colspan?0:l-o.colCount(r);if(d.colwidth&&d.colwidth[c]==n)continue;let h=d.colwidth?d.colwidth.slice():Array(d.colspan).fill(0);h[c]=n,a.setNodeMarkup(s+r,null,{...d,colwidth:h})}a.docChanged&&e.dispatch(a)}(e,r.activeHandle,cC(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(cw,{setDragging:null})))}function c(t){if(!t.which)return d(t);let i=cw.getState(e.state);if(i&&i.dragging){let o=cC(i.dragging,t,n);cS(e,i.activeHandle,o,r)}}e.dispatch(e.state.tr.setMeta(cw,{setDragging:{startX:t.clientX,startWidth:a}})),cS(e,s.activeHandle,a,r),o.addEventListener("mouseup",d),o.addEventListener("mousemove",c),t.preventDefault()}(e,r,t,n)}},decorations:e=>{let t=cw.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return tQ.empty;let o=dB.get(i),s=r.start(-1),l=o.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<o.height;t++){let r=l+t*o.width;if((l==o.width-1||o.map[r]!=o.map[r+1])&&(0==t||o.map[r]!=o.map[r-o.width])){var a;let t=o.map[r],l=s+t+i.nodeAt(t).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",(null==(a=cw.getState(e))?void 0:a.dragging)&&n.push(tX.node(s+t,s+t+i.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push(tX.widget(l,d))}}return tQ.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return o}({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],function({allowTableNodeSelection:e=!1}={}){return new dF.Plugin({key:d_,state:{init:()=>null,apply(e,t){let n=e.getMeta(d_);if(null!=n)return -1==n?null:n;if(null==t||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:d0,handleDOMEvents:{mousedown:cf},createSelectionBetween:e=>null!=d_.getState(e.state)?e.state.selection:null,handleTripleClick:cu,handleKeyDown:ca,handlePaste:cp},appendTransaction:(t,n,r)=>(function(e,t,n){let r,i,o=(t||e).selection,s=(t||e).doc;if(o instanceof dF.NodeSelection&&(i=o.node.type.spec.tableRole)){if("cell"==i||"header_cell"==i)r=dZ.create(s,o.from);else if("row"==i){let e=s.resolve(o.from+1);r=dZ.rowSelection(e,e)}else if(!n){let e=dB.get(o.node),t=o.from+1,n=t+e.map[e.width*e.height-1];r=dZ.create(s,t+1,n)}}else o instanceof dF.TextSelection&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}(o)?r=dF.TextSelection.create(s,o.from):o instanceof dF.TextSelection&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(o)&&(r=dF.TextSelection.create(s,o.$from.start(),o.$from.end()));return r&&(t||(t=e.tr)).setSelection(r),t})(r,d2(r,n),e)})}({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){let e=this.options.resizable&&this.editor.isEditable,t=this.options.View;return e||!t?null:({node:e,view:n,HTMLAttributes:r})=>{let i=r_(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,i)}},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:rH(rL(e,"tableRole",t))}}});i6.create({name:"tableKit",addExtensions(){let e=[];return!1!==this.options.table&&e.push(cB.configure(this.options.table)),!1!==this.options.tableCell&&e.push(cD.configure(this.options.tableCell)),!1!==this.options.tableHeader&&e.push(cO.configure(this.options.tableHeader)),!1!==this.options.tableRow&&e.push(cP.configure(this.options.tableRow)),e}}),e.s(["Table",0,cB,"TableCell",0,cD,"TableHeader",0,cO,"TableRow",0,cP],36110),e.s(["default",0,dD],33287);let cV=i6.create({name:"textAlign",addOptions:()=>({types:[],alignments:["left","center","right","justify"],defaultAlignment:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}}
89,addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});e.s(["default",0,cV],97643);let c_=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,cW=ok.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",r_(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,i,o,s;let l=null!=(t=null==(n=e.attrs)?void 0:n.src)?t:"",a=null!=(r=null==(i=e.attrs)?void 0:i.alt)?r:"",d=null!=(o=null==(s=e.attrs)?void 0:s.title)?o:"";return d?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"u"<typeof document)return null;let{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,i=new Set(["src","width","height"]);return({node:o,getPos:s,HTMLAttributes:l,editor:a})=>{let d=document.createElement("img");d.draggable=!1;let c=r_(this.options.HTMLAttributes,l);Object.entries(c).forEach(([e,t])=>{if(null!=t)switch(e){case"src":case"width":case"height":break;default:d.setAttribute(e,t)}}),null!==c.src&&(d.src=c.src);let h={...l},u=e=>{if("string"==typeof e&&""!==e){d.getAttribute("src")!==e&&(d.src=e);return}d.hasAttribute("src")&&d.removeAttribute("src"),""!==d.src&&(d.src="")};u(l.src);let p=new ov({element:d,editor:a,node:o,getPos:s,onResize:(e,t)=>
89{d.style.width=`${e}px`,d.style.height=`${t}px`},onCommit:(e,t)=>{let n=s();void 0!==n&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:e=>{if(e.type!==o.type)return!1;let t=a.extensionManager.attributes.filter(t=>t.type===e.type.name),n=rW(e,t);return Object.keys(h).forEach(e=>{i.has(e)||e in n||d.removeAttribute(e)}),Object.entries(n).forEach(([e,t])=>{i.has(e)||(null!=t?d.setAttribute(e,t):d.removeAttribute(e))}),u(n.src),h=n,!0},options:{directions:e,min:{width:t,height:n},preserveAspectRatio:!0===r}}),f=p.dom,m=()=>{f.style.visibility="",f.style.pointerEvents=""};return f.style.visibility="hidden",f.style.pointerEvents="none",d.complete&&d.naturalWidth>0?m():(d.onload=m,d.onerror=m),p}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[ox({find:c_,type:this.type,getAttributes:e=>{let[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),cU=new h.PluginKey("findHighlight");function cK(e,t){let{searchTerm:n,caseSensitive:r,currentIndex:i}=t;if(!n.trim())return t.results=[],tQ.empty;let o=[];try{let t=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(t,r?"g":"gi");e.descendants((e,t)=>{let n;if(e.isText&&e.text)for(i.lastIndex=0;null!==(n=i.exec(e.text));)o.push({from:t+n.index,to:t+n.index+n[0].length})})}catch{}t.results=o;let s=o.map(({from:e,to:t},n)=>tX.inline(e,t,{class:n===i?"find-current":"find-match"}));return tQ.create(e,s)}let cq=i6.create({name:"findHighlight",addStorage:()=>({searchTerm:"",caseSensitive:!1,currentIndex:0,results:[]}),addCommands:()=>({setFindTerm:e=>({tr:t,dispatch:n,editor:r})=>{let i=r.storage.findHighlight;return i.searchTerm=e,i.currentIndex=0,n&&n(t.setMeta(cU,"update")),!0},setFindCaseSensitive:e=>({tr:t,dispatch:n,editor:r})=>(r.storage.findHighlight.caseSensitive=e,n&&n(t.setMeta(cU,"update")),!0),nextFindResult:()=>({tr:e,dispatch:t,editor:n})=>{let r=n.storage.findHighlight;if(!r.results.length)return!1;r.currentIndex=(r.currentIndex+1)%r.results.length;let{from:i,to:o}=r.results[r.currentIndex];return t&&t(e.setMeta(cU,"update").setSelection(h.TextSelection.create(e.doc,i,o)).scrollIntoView()),!0},prevFindResult:()=>({tr:e,dispatch:t,editor:n})=>{let r=n.storage.findHighlight;if(!r.results.length)return!1;r.currentIndex=(r.currentIndex-1+r.results.length)%r.results.length;let{from:i,to:o}=r.results[r.currentIndex];return t&&t(e.setMeta(cU,"update").setSelection(h.TextSelection.create(e.doc,i,o)).scrollIntoView()),!0}}),addProseMirrorPlugins(){let e=this.storage;return[new h.Plugin({key:cU,state:{init:(t,n)=>cK(n.doc,e),apply:(t,n)=>"update"===t.getMeta(cU)||t.docChanged?cK(t.doc,e):n},props:{decorations:e=>cU.getState(e)}})]}}),cJ=cD.extend({addAttributes(){return{...this.parent?.(),cellStyles:{default:null,parseHTML:e=>e.getAttribute("data-cell-styles"),renderHTML:e=>e.cellStyles?{"data-cell-styles":e.cellStyles,style:e.cellStyles}:{}}}}}),cY=cO.extend({addAttributes(){return{...this.parent?.(),cellStyles:{default:null,parseHTML:e=>e.getAttribute("data-cell-styles"),renderHTML:e=>e.cellStyles?{"data-cell-styles":e.cellStyles,style:e.cellStyles}:{}}}}}),cX=cW.extend({addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>e.getAttribute("width")||e.style.width||null,renderHTML:e=>e.width?{width:e.width}:{}},align:{default:"center",parseHTML:e=>e.getAttribute("data-align")||"center",renderHTML:e=>({"data-align":e.align||"center"})},alt:{default:null,parseHTML:e=>e.getAttribute("alt"),renderHTML:e=>e.alt?{alt:e.alt}:{}}}}}),cG=i6.create({name:"tabIndent",addKeyboardShortcuts(){return{Tab:()=>!!this.editor.isActive("listItem")&&this.editor.commands.sinkListItem("listItem"),"Shift-Tab":()=>!!this.editor.isActive("listItem")&&this.editor.commands.liftListItem("listItem")}}});e.s(["CustomImage",0,cX,"CustomTableCell",0,cJ,"CustomTableHeader",0,cY,"FindHighlightExtension",0,cq,"TabIndentExtension",0,cG],36023);var cZ=e.i(75254);let cQ=(0,cZ.default)("toggle-left",[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]]);e.s(["ToggleLeft",0,cQ],91583);let c0=(0,cZ.default)("calendar-days",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);e.s(["CalendarDays",0,c0],89853);let c1=(0,cZ.default)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);e.s(["GitBranch",0,c1],55716);let c2=(0,cZ.default)("repeat-2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);e.s(["Repeat2",0,c2],2008)},3116,e=>{"use strict";
89let t=(0,e.i(75254).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["Clock",0,t],3116)},70756,e=>{"use strict";let t=(0,e.i(75254).default)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);e.s(["Lock",0,t],70756)},92270,e=>{"use strict";let t=(0,e.i(75254).default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);e.s(["LogOut",0,t],92270)},63488,e=>{"use strict";let t=(0,e.i(75254).default)("mail",[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]);e.s(["Mail",0,t],63488)},83627,e=>{"use strict";var t=e.i(85873);e.s(["Edit3",()=>t.default])},27612,e=>{"use strict";let t=(0,e.i(75254).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],27612)},32181,e=>{"use strict";var t=e.i(46932);e.i(7051);let n=t.motion;e.s(["motion",0,n],32181)},652,(e,t,n)=>{var r,i,o,s,l,a,d,c,h,u,p,f,m,g,y,x=!1;function b(){if(!x){x=!0;var e=navigator.userAgent,t=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Ice
89weasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),n=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(f=/\b(iPhone|iP[ao]d)/.exec(e),m=/\b(iP[ao]d)/.exec(e),u=/Android/i.exec(e),g=/FBAN\/\w+;/i.exec(e),y=/Mobile/i.exec(e),p=!!/Win64/.exec(e),t){(r=t[1]?parseFloat(t[1]):t[5]?parseFloat(t[5]):NaN)&&document&&document.documentMode&&(r=document.documentMode);var b=/(?:Trident\/(\d+.\d+))/.exec(e);a=b?parseFloat(b[1])+4:r,i=t[2]?parseFloat(t[2]):NaN,o=t[3]?parseFloat(t[3]):NaN,l=(s=t[4]?parseFloat(t[4]):NaN)&&(t=/(?:Chrome\/(\d+\.\d+))/.exec(e))&&t[1]?parseFloat(t[1]):NaN}else r=i=o=l=s=NaN;if(n){if(n[1]){var w=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);d=!w||parseFloat(w[1].replace("_","."))}else d=!1;c=!!n[2],h=!!n[3]}else d=c=h=!1}}var w={ie:function(){return b()||r},ieCompatibilityMode:function(){return b()||a>r},ie64:function(){return w.ie()&&p},firefox:function(){return b()||i},opera:function(){return b()||o},webkit:function(){return b()||s},safari:function(){return w.webkit()},chrome:function(){return b()||l},windows:function(){return b()||c},osx:function(){return b()||d},linux:function(){return b()||h},iphone:function(){return b()||f},mobile:function(){return b()||f||m||u||y},nativeApp:function(){return b()||g},android:function(){return b()||u},ipad:function(){return b()||m}};t.exports=w},10316,(e,t,n)=>{"use strict";var r=!!("u">typeof window&&window.document&&window.document.createElement);t.exports={canUseDOM:r,canUseWorkers:"u">typeof Worker,canUseEventListeners:r&&!!(window.addEventListener||window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r}},33418,(e,t,n)=>{"use strict";var r,i=e.r(10316);i.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")),t.exports=function(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,o=n in document;if(!o){var s=document.createElement("div");s.setAttribute(n,"return;"),o="function"==typeof s[n]}return!o&&r&&"wheel"===e&&(o=document.implementation.hasFeature("Events.wheel","3.0")),o}},52545,(e,t,n)=>{"use strict";var r=e.r(652),i=e.r(33418);function o(e){var t=0,n=0,r=0,i=0;return"detail"in e&&(n=e.detail),"wheelDelta"in e&&(n=-e.wheelDelta/120),"wheelDeltaY"in e&&(n=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=n,n=0),r=10*t,i=10*n,"deltaY"in e&&(i=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||i)&&e.deltaMode&&(1==e.deltaMode?(r*=40,i*=40):(r*=800,i*=800)),r&&!t&&(t=r<1?-1:1),i&&!n&&(n=i<1?-1:1),{spinX:t,spinY:n,pixelX:r,pixelY:i}}o.getEventType=function(){return r.firefox()?"DOMMouseScroll":i("wheel")?"wheel":"mousewheel"},t.exports=o},99733,(e,t,n)=>{t.exports=e.r(52545)},71838,55209,16846,53560,36450,e=>{"use strict";var t=e.i(43476),n=e.i(57688),r=e.i(18566),i=e.i(71645),o=e.i(37727),s=e.i(14764),l=e.i(7233),a=e.i(88699),d=e.i(78583),c=e.i(46932),h=e.i(88653),u=e.i(99575),p=e.i(64816),f=e.i(32341),m=e.i(3489),g=e.i(3015),y=e.i(69712),x=e.i(82882),b=e.i(13582),w=e.i(46983),v=e.i(3023),k=e.i(48307),C=e.i(95131),N=e.i(73828),S=e.i(71085),M=e.i(71011),j=e.i(661),T=e.i(92393),A=e.i(94376);e.i(87085);var E=e.i(10038),R=e.i(91285);function D(){return(0,t.jsxs)("div",{className:"flex gap-2.5 mb-3",children:[(0,t.jsx)("div",{className:"w-7 h-7 rounded-lg bg-gray-100 shrink-0 animate-pulse"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsx)("div",{className:"h-3 bg-gray-100 rounded w-20 animate-pulse"}),(0,t.jsx)("div",{className:"h-3 bg-gray-100 rounded w-10 ml-auto animate-pulse"})]}),(0,t.jsx)("div",{className:"h-3.5 bg-gray-100 rounded w-40 mb-1.5 animate-pulse"}),(0,t.jsx)("div",{className:"h-3 bg-gray-100 rounded w-28 animate-pulse"})]})]})}function O({content:e,selected:n,onClick:r}){let i,{typeLabel:o,sizeLabel:s}=(i=e.contentType??e.type,{typeLabel:(0,g.getContentTypeLabel)(i).toUpperCase(),sizeLabel:(0,y.getContentFileSizeLabel)(e)}),l=s?`${o} \xb7 ${s}`:o;return(0,t.jsxs)("button",{type:"button",onClick:r,className:`group w-full flex items-center gap-3 rounded-2xl px-2 py-3.5 text-left transition-colors ${n?"bg-primary-light/20":" hover:bg-primary-light/20"}`,children:[(0,t.jsx)("div",{className:"relative h-10 w-10 shrink-0 overflow-hidden rounded-tile",children:(0,t.jsx)(A.ContentThumbn
89ail,{content:e,iconSize:40})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-base font-semibold text-neutral-dark group-hover:text-gray-900",children:e.title?.trim()||o}),(0,t.jsx)("p",{className:"mt-0.5 text-sm font-medium text-gray-500 truncate",children:l})]})]})}e.s(["MessageSideDrawer",0,function({isOpen:e,onClose:A,boardId:P,boardName:L,memberCount:I,boardMembers:z=[]}){let $,H,F=(0,r.useRouter)(),{messages:B,isLoading:V,connectToBoardSocket:_,disconnectSocket:W,getSingleBoardMessages:U,clearMessages:K}=(0,u.useMessages)(),{handleCreateMessage:q,handleUpdateMessage:J,handleDeleteMessage:Y,handleReactToMessage:X,handleSendAudioMessage:G,handleReportMessage:Z,handleMarkMessageAsRead:Q,isCreatingMessage:ee,isUpdatingMessage:et,isDeletingMessage:en,isReactingToMessage:er,isSendingAudioMessage:ei,isReportingMessage:eo}=(0,p.useMessageOperations)(),{userId:es}=(0,f.useAuth)(),[el,ea]=(0,i.useState)(""),{inputRef:ed,isOpen:ec,suggestions:eh,activeIndex:eu,setActiveIndex:ep,handleChange:ef,handleKeyDown:em,selectMember:eg,closeSuggestions:ey}=(0,v.useMentionAutocomplete)({members:z,value:el,onChange:ea}),[ex,eb]=(0,i.useState)(null),[ew,ev]=(0,i.useState)(null),[ek,eC]=(0,i.useState)(!1),[eN,eS]=(0,i.useState)(!1),[eM,ej]=(0,i.useState)([]),[eT,eA]=(0,i.useState)(!1),[eE,eR]=(0,i.useState)(null),[eD,eO]=(0,i.useState)(""),[eP,eL]=(0,i.useState)(null),[eI,ez]=(0,i.useState)(void 0),[e$,eH]=(0,i.useState)(!1),[eF,eB]=(0,i.useState)(null),eV=(0,i.useRef)(null),e_=(0,i.useMemo)(()=>[...B].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),[B]);(0,i.useMemo)(()=>[...eM].sort((e,t)=>{let n=new Date(e.createdAt).getTime(),r=new Date(t.createdAt).getTime();return r!==n?r-n:e.title.localeCompare(t.title)}).slice(0,3),[eM]);let eW=(0,i.useMemo)(()=>{let e=eD.trim().toLowerCase();return e?eM.filter(t=>t.title.toLowerCase().includes(e)):eM},[eM,eD]),eU=(0,i.useRef)(!0),eK=(0,i.useRef)(0),eq=(0,i.useRef)(1),eJ=(0,i.useRef)(!0),eY=(0,i.useRef)(!1),[eX,eG]=(0,i.useState)(!1),[eZ,eQ]=(0,i.useState)(!0),e0=(0,i.useRef)(null),e1=(0,i.useRef)(null),e2=(0,i.useRef)(null),e3=(0,i.useRef)(new Set);(0,i.useEffect)(()=>{let t=document.getElementById("app-sidebar");return t&&(t.style.zIndex=e?"1":""),()=>{t&&(t.style.zIndex="")}},[e]),(0,i.useEffect)(()=>{if(e&&P){K(),eK.current=0,eq.current=1,eJ.current=!0,e3.current=new Set;let e=requestAnimationFrame(()=>{eH(!0)});return U(P,1,10,!1).then(e=>{eJ.current=e??!1,eQ(e??!1),eH(!1)}).catch(()=>{eH(!1)}),_(P),()=>cancelAnimationFrame(e)}return()=>{e&&W()}},[e,P,U,_,W,K]),(0,i.useEffect)(()=>{if(!e||!P||0===B.length)return;let t=B.filter(e=>!e.isRead&&!e3.current.has(e.id)&&"SystemMessage"!==e.type);t.length>0&&(Q(P),t.forEach(e=>e3.current.add(e.id)))},[e,P,B,Q,es]);let e5=(0,i.useRef)(B.length),e4=(0,i.useCallback)((e="auto")=>{if(e1.current){let t=e1.current;t.scrollTo({top:t.scrollHeight,behavior:e})}},[]),e6=(0,i.useCallback)(()=>{if(!e1.current)return;let{scrollTop:e,scrollHeight:t,clientHeight:n}=e1.current;eU.current=t-e-n<50},[]);(0,i.useEffect)(()=>{let e=B.length>e5.current;1===eq.current&&B.length>0&&0===e5.current?e4("auto"):e&&eU.current&&requestAnimationFrame(()=>{e4("smooth")}),e5.current=B.length},[B,e4]);let e7=(0,i.useCallback)(()=>{eU.current&&e4("smooth")},[e4]),e8=(0,i.useCallback)(e=>{let t=e1.current;if(!t)return;let n=t.querySelector(`[data-message-id="${e}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"start"})},[]),e9=(0,i.useCallback)(e=>{let t;if(eB(null),0===e_.length)return;let n=new Date,r=new Date(n.getFullYear(),n.getMonth(),n.getDate());switch(e){case"today":t=e_.find(e=>new Date(e.createdAt)>=r);break;case"yesterday":{let e=new Date(r);e.setDate(e.getDate()-1),t=e_.find(t=>new Date(t.createdAt)>=e&&new Date(t.createdAt)<r);break}case"lastWeek":{let e=new Date(r);e.setDate(e.getDate()-7),t=e_.find(t=>new Date(t.createdAt)>=e&&new Date(t.createdAt)<r);break}case"lastMonth":{let e=new Date(r);e.setMonth(e.getMonth()-1),t=e_.find(t=>new Date(t.createdAt)>=e&&new Date(t.createdAt)<r);break}case"first":t=e_[0]}t&&e8(t.id)},[e_,e8]);(0,i.useMemo)(()=>
89{if(0===e_.length)return"Today";let e=e_[e_.length-1];return(0,g.getRelativeDateLabel)(e.createdAt,!0)},[e_]),(0,i.useEffect)(()=>{if(!eF)return;let e=e=>{eV.current&&!eV.current.contains(e.target)&&eB(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[eF]);let te=(0,i.useCallback)(async()=>{if(eY.current||!eJ.current)return;eY.current=!0,eG(!0);let e=eq.current+1,t=e1.current,n=t?.scrollHeight||0,r=await U(P,e,10,!0);eJ.current=r??!1,eq.current=e,eQ(r??!1),t&&setTimeout(()=>{let e=t.scrollHeight;t.scrollTop=e-n},0),eY.current=!1,eG(!1)},[P,U]);(0,i.useEffect)(()=>{let e=e2.current;if(!e)return;let t=new IntersectionObserver(e=>{e[0].isIntersecting&&eJ.current&&!eY.current&&!V&&te()},{threshold:1});return t.observe(e),()=>t.disconnect()},[V,te]);let tt=async e=>{if(e.preventDefault(),ec)return void eg(eh[eu]);if(ex){let e=el.trim();if(!e||et)return;try{await J(P,ex,{message:e}),eb(null),ea(""),ey()}catch{}return}if(el.trim()||eE)try{(el.trim()||eE)&&await q(P,{message:el,...eE&&{contentId:eE.id}}),ea(""),ey(),eR(null),requestAnimationFrame(()=>{e4("smooth"),eU.current=!0})}catch{}},tn=async()=>{if(eS(!0),eO(""),0===eM.length){eA(!0);try{let e=await m.contentAPI.getContent(P);e.isSuccess&&Array.isArray(e.value)&&ej(e.value)}catch{}finally{eA(!1)}}},tr=e=>{new Date(e.createdAt).getTime()+864e5<=Date.now()||(eb(e.id),ea(e.text||"")),ev(null)},ti=()=>{eb(null),ea("")},to=async e=>{try{await Y(P,e),ev(null)}catch{}},ts=async(e,t)=>{try{await X(P,e,{emoji:t}),ev(null)}catch{}},tl=(0,i.useCallback)(()=>{eC(!1),A()},[A]),ta=async(e,t,n)=>{try{await Z(P,{messageId:e,reportType:t,additionalDetails:n}),ev(null)}catch{}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.AnimatePresence,{children:e&&(0,t.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,t.jsx)(c.motion.div,{className:"absolute inset-0 bg-neutral-dark/40 backdrop-blur-lg",style:{willChange:"backdrop-filter, opacity"},initial:{opacity:0}
89,animate:{opacity:1},exit:{opacity:0},transition:{type:"spring",damping:25,stiffness:300},onClick:A}),(0,t.jsxs)(c.motion.div,{className:"fixed right-0 top-0 bottom-0 w-full sm:w-150 bg-white/20 backdrop-blur-xl shadow-modal rounded-tl-4xl rounded-bl-4xl overflow-hidden flex flex-col pl-4",initial:{x:520},animate:{x:0},exit:{x:520},transition:{type:"spring",damping:25,stiffness:300},children:[(0,t.jsxs)("div",{className:"bg-white shadow-modal rounded-tl-4xl rounded-bl-4xl overflow-hidden flex flex-col w-full h-full p-8",children:[(0,t.jsx)("div",{className:" shrink-0",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-neutral-dark",children:"Board Messages"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5 text-base font-medium text-gray-500",children:[(0,t.jsx)(n.default,{src:T.default,alt:"",width:20,height:20,className:"w-5 h-5"}),(0,t.jsx)("span",{children:L||"Board"}),void 0!==I&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-gray-500",children:"â¢"}),(0,t.jsxs)("span",{children:[I," Member",1!==I?"s":""]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{onClick:()=>{tl(),F.push(`/boards/${P}/messages`)},className:"shrink-0 rounded-lg p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600",title:"Expand",children:(0,t.jsx)(n.default,{src:S.default,alt:"Expand",width:24,height:24})}),(0,t.jsx)("button",{onClick:tl,className:"shrink-0 rounded-lg p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600",title:"Close",children:(0,t.jsx)(n.default,{src:N.default,alt:"Close",width:24,height:24})})]})]})}),(0,t.jsx)("div",{className:"h-px bg-gray-200 shrink-0 mt-4 mb-8"}),(0,t.jsxs)("div",{className:"flex-1 min-h-0 relative",children:[(0,t.jsxs)("div",{className:"absolute inset-0 overflow-y-auto overflow-x-hidden p-4 flex flex-col",ref:e1,onScroll:e6,children:[e$?(0,t.jsx)("div",{className:"space-y-3",children:Array.from({length:5}).map((e,n)=>(0,t.jsx)(D,{},n))}):V&&!eX?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(D,{}),(0,t.jsx)(D,{}),(0,t.jsx)(D,{})]}):null,(0,t.jsx)("div",{ref:e2,className:"h-1"}),!eZ&&B.length>0&&(0,t.jsx)("div",{className:"flex justify-center my-1",children:(0,t.jsx)("span",{className:"text-xs text-gray-400 bg-gray-100 px-3 py-1 rounded-full",children:"No older messages"})}),eX&&(0,t.jsx)("div",{className:"flex justify-center py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-violet-400 animate-bounce [animation-delay:0ms]"}),(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-violet-400 animate-bounce [animation-delay:150ms]"}),(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-violet-400 animate-bounce [animation-delay:300ms]"})]})}),!V&&0===B.length&&(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-center",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"w-16 h-16 mx-auto mb-3 bg-gray-100 rounded-2xl flex items-center justify-center",children:(0,t.jsx)(s.Send,{className:"w-6 h-6 text-gray-300"})}),(0,t.jsx)("p",{className:"text-gray-400 text-sm mb-1",children:"No messages yet"}),(0,t.jsx)("p",{className:"text-xs text-gray-300",children:"Be the first to send a message"})]})}),($="",H="",e_.map((e,n)=>{let r=(0,g.getRelativeDateLabel)(e.createdAt,!0),i=r!==$;$=r;let o=e.userId===es,s=new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),l="SystemMessage"===e.type,a=l&&s!==H;return H=l?s:"",(0,t.jsxs)("div",{"data-message-id":e.id,className:`${i?"mt-4":"mt-0.5"} ${0===n?"mt-auto":""}`,children:[i&&(0,t.jsxs)("div",{className:"flex items-center gap-3 my-3",children:[(0,t.jsx)("div",{className:"flex-1 h-px bg-gray-200"}),(0,t.jsxs)("div",{className:"relative shrink-0",ref:eV,children:[(0,t.jsx)("button",{className:"flex items-center gap-1 text-sm font-semibold text-gray-500 px-4 py-2 bg-gray-300 rounded-xl hover:bg-gray-200 transition-colors",children:r}),(0,t.jsx)(h.AnimatePresence,{children:eF===r&&(0,t.jsxs)(c.motion.div,{initial:{opacity:0,y:-4,scale:.95}
89,animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.95},transition:{duration:.15},className:"absolute top-full mt-1 left-1/2 -translate-x-1/2 w-44 shadow-dropdown bg-white rounded-2xl p-3 z-30",children:[(0,t.jsx)("p",{className:"mb-2 text-base font-semibold text-gray-400 font-sans tracking-wide",children:"Jump To"}),[{label:"Today",period:"today"},{label:"Yesterday",period:"yesterday"},{label:"Last Week",period:"lastWeek"},{label:"Last Month",period:"lastMonth"},{label:"First Message",period:"first"}].map(e=>(0,t.jsx)("button",{onClick:()=>e9(e.period),className:"w-full text-left px-3 py-2 text-base font-semibold rounded-xl text-neutral-dark hover:bg-gray-50 transition-colors",children:e.label},e.period))]})})]}),(0,t.jsx)("div",{className:"flex-1 h-px bg-gray-200"})]}),"SystemMessage"===e.type?(0,t.jsx)(b.SystemMessage,{message:e,showTimestamp:a,onContentClick:t=>{tl(),F.push(`/boards/${e.boardId}?contentId=${t.id}`)}}):(0,t.jsx)(x.RegularMessage,{context:"drawer",boardMembers:z,message:e,isOwn:o,editingMessageId:ex,showMenuId:ew,showEmojiPickerId:ew,isUpdatingMessage:et,isReactingToMessage:er,isDeletingMessage:en,isReportingMessage:eo,onEditStart:tr,onEditCancel:ti,onDelete:to,onReact:ts,onReport:ta,onMenuToggle:ev,onReactionPickerToggle:ev,onContentClick:t=>{eL(t),ez(e.createdAt)},onImageLoad:e7})]},e.id)})),(0,t.jsx)("div",{ref:e0})]}),(0,t.jsx)("div",{className:"absolute top-0 left-0 right-3 h-15 bg-linear-to-b from-white/0 to-white z-10 pointer-events-none","aria-hidden":"true"})]}),(0,t.jsxs)("div",{className:" shrink-0",children:[ek&&e&&(0,t.jsx)(w.VoiceRecorderComposer,{boardId:P,isCreatingMessage:ee,isSendingAudioMessage:ei,onSendAudioMessage:G,onDone:()=>eC(!1),onSent:()=>{requestAnimationFrame(()=>{e4("smooth"),eU.current=!0})},className:"mb-2"}),ei&&(0,t.jsx)("div",{className:"mb-2.5 flex items-center justify-between bg-violet-50 border border-violet-200 rounded-xl px-3 py-2",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-light border-t-transparent animate-spin"}),(0,t.jsx)("span",{className:"text-xs text-primary font-medium",children:"Sending voice message..."})]})}),ex&&(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 bg-white border border-primary/10 rounded-xl px-3 py-2",children:[(0,t.jsx)(a.Pencil,{className:"w-3.5 h-3.5 text-primary shrink-0"}),(0,t.jsx)("span",{className:"text-xs text-primary font-medium flex-1",children:"Editing message"}),(0,t.jsx)("button",{type:"button",onClick:ti,className:"p-0.5 hover:bg-violet-200 rounded-lg transition-colors shrink-0",title:"Cancel edit",children:(0,t.jsx)(o.X,{className:"w-3 h-3 text-primary"})})]}),!ex&&eE&&(0,t.jsx)(C.AttachedContentPreview,{content:eE,onRemove:()=>eR(null)}),!ek&&(0,t.jsxs)("form",{onSubmit:tt,className:"relative flex items-center gap-2 bg-gray-300 border border-gray-200 rounded-panel px-1.5 py-1.5",children:[ec&&(0,t.jsx)(k.MentionSuggestionList,{members:eh,activeIndex:eu,onSelect:eg,onHover:ep}),!ex&&(0,t.jsx)("button",{type:"button",onClick:tn,disabled:ee||ei,className:"flex items-center justify-center p-1 bg-white rounded-2xl shadow-subtle text-gray-500 hover:text-violet-600 transition-colors shrink-0 disabled:opacity-50",title:"Attach board content",children:(0,t.jsx)("div",{className:"bg-off-white rounded-xl w-12 h-12 flex items-center justify-center",children:(0,t.jsx)(l.Plus,{className:"w-6 h-6"})})}),!ex&&(0,t.jsx)("button",{type:"button",onClick:()=>eC(!0),disabled:ee||ei,className:"p-2 transition-colors shrink-0 disabled:opacity-50",title:"Start recording",children:(0,t.jsx)(n.default,{src:M.default,alt:"Microphone",width:24,height:24})}),(0,t.jsx)("input",{ref:ed,type:"text",value:el,onChange:ef,onKeyDown:e=>{!em(e)&&"Escape"===e.key&&ex&&ti()},placeholder:ex?"Edit your message...":"Write a message...",disabled:ee||ei||et,className:"flex-1 bg-transparent text-base text-neutral-dark placeholder:text-base placeholder:text-medium placeholder-gray-500 focus:outline-none disabled:opacity-50"}),(0,t.jsx)("button",{type:"submit",disabled:ex?et||!el.trim():ee||!el.trim()&&!eE,className:"flex items-center justify-center w-14 h-14 bg-primary-light shadow-subtle rounded-2xl hover:bg-primary-light/80 transition-colors disabled:opacity-40 shrink-0",title:"Send message",children:(0,t.jsx)(n.default,{src:j.default,alt:"Send",width:28,height:28})})]})]})]}),(0,t.jsx)(h.AnimatePresence,{children:eN&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.motion.div,{initial:{opacity:0}
89,animate:{opacity:1},exit:{opacity:0},onClick:()=>eS(!1),className:"absolute inset-0 z-10"}),(0,t.jsxs)(c.motion.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:25,stiffness:300},className:"absolute bottom-8 left-8 right-8 bg-off-white p-4 rounded-shell shadow-2xl border border-gray-100 z-20 flex flex-col overflow-hidden",style:{maxHeight:"65%"},children:[!eT&&eM.length>0&&(0,t.jsx)("div",{className:"shrink-0 mb-5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 bg-white rounded-2xl px-4 py-3",children:[(0,t.jsx)(R.SearchFilled,{size:20}),(0,t.jsx)("input",{type:"text",value:eD,onChange:e=>eO(e.target.value),placeholder:"Search content...",className:"bg-transparent text-sm flex-1 focus:outline-none text-gray-700 placeholder-gray-500 placeholder:text-base placeholder:font-medium"})]})}),eT&&(0,t.jsx)("div",{className:"space-y-2 py-4 px-4",children:[1,2,3,4,5].map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-2xl bg-white animate-pulse",children:[(0,t.jsx)("div",{className:"w-10 h-10 bg-gray-200 rounded-xl shrink-0"}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"h-3.5 bg-gray-200 rounded w-2/3 mb-1.5"}),(0,t.jsx)("div",{className:"h-2.5 bg-gray-200 rounded w-1/3"})]})]},e))}),!eT&&0===eM.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-14 text-center px-4",children:[(0,t.jsx)(d.FileText,{className:"w-9 h-9 text-gray-300 mb-3"}),(0,t.jsx)("p",{className:"text-sm text-gray-400 font-semibold",children:"No content in this board yet"})]}),!eT&&eM.length>0&&(0,t.jsx)("div",{className:"flex-1 min-h-0 flex flex-col gap-5 overflow-hidden",children:(0,t.jsxs)("div",{className:"flex-1 min-h-0 flex flex-col ",children:[(0,t.jsx)("h4",{className:"text-lg font-semibold text-gray-400 font-sans mb-5 shrink-0",children:"Board Content"}),0===eW.length?(0,t.jsx)("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:(0,t.jsxs)("p",{className:"text-sm text-gray-400 font-medium",children:['No results for "',eD,'"']})}):(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto space-y-3 pr-1",children:eW.map(e=>(0,t.jsx)(O,{content:e,selected:eE?.id===e.id,onClick:()=>{eR(e),eS(!1)}},e.id))})]})})]})]})})]})]})}),(0,t.jsx)(E.ContentDetailDrawer,{open:!!eP,onClose:()=>{eL(null),ez(void 0)},content:eP,boardName:L,boardMembers:z,createdAt:eI,onDownload:()=>{if(!eP)return;let e=(0,y.resolveUrl)(eP.contentPayload)??(0,y.resolveUrl)(eP.r2Url);e&&(0,y.triggerFileDownload)(e,(0,y.getDownloadFileName)(eP))}})]})}],71838);var P=e.i(7952);e.s([],55209),e.s([],16846),e.i(31825),e.s(["ProfilePhotoOptionsModal",0,function({open:e,onClose:r,avatarUrl:i,fallback:o,hasPhoto:s,onUploadNew:l,onEditCurrent:a,onDelete:d,isDeleting:c}){return(0,t.jsx)(P.CenterModal,{open:e,onClose:r,className:"max-w-150! rounded-4xl shadow-modal",children:(0,t.jsxs)("div",{className:"relative w-full rounded-4xl bg-white p-6 sm:p-8 ",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-neutral-dark",children:"Update your profile picture"}),(0,t.jsx)("button",{type:"button",onClick:r,className:"inline-flex shrink-0 rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100","aria-label":"Close",children:(0,t.jsx)(n.default,{src:N.default,alt:"Close",width:24,height:24})})]}),(0,t.jsx)("div",{className:"mt-4 border-t border-gray-200"}),(0,t.jsx)("div",{className:"my-8 flex justify-center",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"flex h-70 w-70 items-center justify-center overflow-hidden rounded-full border-2 border-gray-200 bg-light-gray text-3xl font-bold text-gray-400",children:i?(0,t.jsx)("img",{src:i,alt:"Current profile photo",className:"h-full w-full object-cover"}):o}),!1]})}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"mt-6 space-y-3",children:[(0,t.jsx)("button",{type:"button",onClick:l,className:"w-full rounded-2xl bg-primary px-4 py-4 text-lg font-semibold text-white transition-colors hover:bg-primary/90",children:"Upload New Photo"}),s&&(0,t.jsx)("button",{type:"button",onClick:a,className:"w-full rounded-2xl bg-off-white px-4 py-4 text-lg font-semibold text-gray-600 transition-colors hover:bg-gray-100",children:"Edit Current Photo"})]})]})})}],53560);var L=e.i(90571),I=e.i(99733);function z(e,t,n,r,i){void 0===i&&(i=0);var o=W(t.width,t.height,i),s=o.width,l=o.height;return{x:$(e.x,s,n.width,r),y:$(e.y,l,n.height,r)}}function $(e,t,n,r){var i=Math.abs(t*r/2-n/2);return U(e,-i,i)}function H(e,t){return Math.sqrt(Math.pow(e.y-t.y,2)+Math.pow(e.x-t.x,2))}function F(e,t){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI}function B(e,t){return Math.min(e,Math.max(0,t))}function V(e,t){return t}function _(e,t){return{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}function W(e,t,n){var r=n*Math.PI/180;return{width:Math.abs(Math.cos(r)*e)+Math.abs(Math.sin(r)*t),height:Math.abs(Math.sin(r)*e)+Math.abs(Math.cos(r)*t)}}function U(e,t,n){return Math.min(Math.max(e,t),n)}function K(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return"string"==typeof e&&!!(e.length>0)}).join(" ").trim()}var q=function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.cropperRef=i.createRef(),n.imageRef=i.createRef(),n.videoRef=i.createRef(),n.containerPosition={x:0,y:0}
89,n.containerRef=null,n.styleRef=null,n.containerRect=null,n.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},n.dragStartPosition={x:0,y:0},n.dragStartCrop={x:0,y:0},n.gestureZoomStart=0,n.gestureRotationStart=0,n.isTouching=!1,n.lastPinchDistance=0,n.lastPinchRotation=0,n.rafDragTimeout=null,n.rafPinchTimeout=null,n.wheelTimer=null,n.currentDoc="u">typeof document?document:null,n.currentWindow="u">typeof window?window:null,n.resizeObserver=null,n.previousCropSize=null,n.isInitialized=!1,n.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},n.initResizeObserver=function(){if(void 0!==window.ResizeObserver&&n.containerRef){var e=!0;n.resizeObserver=new window.ResizeObserver(function(t){if(e){e=!1;return}n.computeSizes()}),n.resizeObserver.observe(n.containerRef)}},n.preventZoomSafari=function(e){return e.preventDefault()},n.cleanEvents=function(){n.currentDoc&&(n.currentDoc.removeEventListener("mousemove",n.onMouseMove),n.currentDoc.removeEventListener("mouseup",n.onDragStopped),n.currentDoc.removeEventListener("touchmove",n.onTouchMove),n.currentDoc.removeEventListener("touchend",n.onDragStopped),n.currentDoc.removeEventListener("gesturechange",n.onGestureChange),n.currentDoc.removeEventListener("gestureend",n.onGestureEnd),n.currentDoc.removeEventListener("scroll",n.onScroll))},n.clearScrollEvent=function(){n.containerRef&&n.containerRef.removeEventListener("wheel",n.onWheel),n.wheelTimer&&clearTimeout(n.wheelTimer)},n.onMediaLoad=function(){var e=n.computeSizes();e&&(n.previousCropSize=e,n.emitCropData(),n.setInitialCrop(e),n.isInitialized=!0),n.props.onMediaLoaded&&n.props.onMediaLoaded(n.mediaSize)},n.setInitialCrop=function(e){if(n.props.initialCroppedAreaPercentages){var t,r,i,o,s,l,a,d=(t=n.props.initialCroppedAreaPercentages,r=n.mediaSize,i=n.props.rotation,o=n.props.minZoom,s=n.props.maxZoom,l=W(r.width,r.height,i),{crop:{x:(a=U(e.width/l.width*(100/t.width),o,s))*l.width/2-e.width/2-l.width*a*(t.x/100),y:a*l.height/2-e.height/2-l.height*a*(t.y/100)},zoom:a}),c=d.crop,h=d.zoom;n.props.onCropChange(c),n.props.onZoomChange&&n.props.onZoomChange(h)}else if(n.props.initialCroppedAreaPixels){var u,p,f,m,g,y,x,b,w,v=(u=n.props.initialCroppedAreaPixels,p=n.mediaSize,f=n.props.rotation,m=n.props.minZoom,g=n.props.maxZoom,void 0===f&&(f=0),y=W(p.naturalWidth,p.naturalHeight,f),b=U((x=p.width>p.height?p.width/p.naturalWidth:p.height/p.naturalHeight,e.height>
89e.width?e.height/(u.height*x):e.width/(u.width*x)),m,g),w=e.height>e.width?e.height/u.height:e.width/u.width,{crop:{x:((y.width-u.width)/2-u.x)*w,y:((y.height-u.height)/2-u.y)*w},zoom:b}),c=v.crop,h=v.zoom;n.props.onCropChange(c),n.props.onZoomChange&&n.props.onZoomChange(h)}},n.computeSizes=function(){var e,t,r,i,o,s,l=n.imageRef.current||n.videoRef.current;if(l&&n.containerRef){n.containerRect=n.containerRef.getBoundingClientRect(),n.saveContainerPosition();var a,d,c,h,u,p,f,m,g,y,x,b=n.containerRect.width/n.containerRect.height,w=(null==(e=n.imageRef.current)?void 0:e.naturalWidth)||(null==(t=n.videoRef.current)?void 0:t.videoWidth)||0,v=(null==(r=n.imageRef.current)?void 0:r.naturalHeight)||(null==(i=n.videoRef.current)?void 0:i.videoHeight)||0,k=l.offsetWidth<w||l.offsetHeight<v,C=w/v,N=void 0;if(k)switch(n.state.mediaObjectFit){default:case"contain":N=b>C?{width:n.containerRect.height*C,height:n.containerRect.height}:{width:n.containerRect.width,height:n.containerRect.width/C};break;case"horizontal-cover":N={width:n.containerRect.width,height:n.containerRect.width/C};break;case"vertical-cover":N={width:n.containerRect.height*C,height:n.containerRect.height}}else N={width:l.offsetWidth,height:l.offsetHeight};n.mediaSize=(0,L.__assign)((0,L.__assign)({},N),{naturalWidth:w,naturalHeight:v}),n.props.setMediaSize&&n.props.setMediaSize(n.mediaSize);var S=n.props.cropSize?n.props.cropSize:(a=n.mediaSize.width,d=n.mediaSize.height,c=n.containerRect.width,h=n.containerRect.height,u=n.props.aspect,void 0===(p=n.props.rotation)&&(p=0),m=(f=W(a,d,p)).width,g=f.height,(y=Math.min(m,c))>(x=Math.min(g,h))*u?{width:x*u,height:x}:{width:y,height:y/u});return((null==(o=n.state.cropSize)?void 0:o.height)!==S.height||(null==(s=n.state.cropSize)?void 0:s.width)!==S.width)&&n.props.onCropSizeChange&&n.props.onCropSizeChange(S),n.setState({cropSize:S},n.recomputeCropPosition),n.props.setCropSize&&n.props.setCropSize(S),S}},n.saveContainerPosition=function(){if(n.containerRef){var e=n.containerRef.getBoundingClientRect();n.containerPosition={x:e.left,y:e.top}}},n.onMouseDown=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("mousemove",n.onMouseMove),n.currentDoc.addEventListener("mouseup",n.onDragStopped),n.saveContainerPosition(),n.onDragStart(t.getMousePoint(e)))},n.onMouseMove=function(e){return n.onDrag(t.getMousePoint(e))},n.onScroll=function(e){n.currentDoc&&(e.preventDefault(),n.saveContainerPosition())},n.onTouchStart=function(e){!n.currentDoc||(n.isTouching=!0,(!n.props.onTouchRequest||n.props.onTouchRequest(e))&&(n.currentDoc.addEventListener("touchmove",n.onTouchMove,{passive:!1}),n.currentDoc.addEventListener("touchend",n.onDragStopped),n.saveContainerPosition(),2===e.touches.length?n.onPinchStart(e):1===e.touches.length&&n.onDragStart(t.getTouchPoint(e.touches[0]))))},n.onTouchMove=function(e){e.preventDefault(),2===e.touches.length?n.onPinchMove(e):1===e.touches.length&&n.onDrag(t.getTouchPoint(e.touches[0]))},n.onGestureStart=function(e){n.currentDoc&&(e.preventDefault(),n.currentDoc.addEventListener("gesturechange",n.onGestureChange),n.currentDoc.addEventListener("gestureend",n.onGestureEnd),n.gestureZoomStart=n.props.zoom,n.gestureRotationStart=n.props.rotation)},n.onGestureChange=function(e){if(e.preventDefault(),!n.isTouching){var r=t.getMousePoint(e),i=n.gestureZoomStart-1+e.scale;if(n.setNewZoom(i,r,{shouldUpdatePosition:!0}),n.props.onRotationChange){var o=n.gestureRotationStart+e.rotation;n.props.onRotationChange(o)}}},n.onGestureEnd=function(e){n.cleanEvents()},n.onDragStart=function(e){var t,r;n.dragStartPosition={x:e.x,y:e.y},n.dragStartCrop=(0,L.__assign)({},n.props.crop),null==(r=(t=n.props).onInteractionStart)||r.call(t)},n.onDrag=function(e){var t=e.x,r=e.y;n.currentWindow&&(n.rafDragTimeout&&n.currentWindow.cancelAnimationFrame(n.rafDragTimeout),n.rafDragTimeout=n.currentWindow.requestAnimationFrame(function(){if(n.state.cropSize&&void 0!==t&&void 0!==r){var e=t-n.dragStartPosition.x,i=r-n.dragStartPosition.y,o={x:n.dragStartCrop.x+e,y:n.dragStartCrop.y+i},s=n.props.restrictPosition?z(o,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):o;n.props.onCropChange(s)}}))},n.onDragStopped=function(){var e,t;n.isTouching=!1,n.cleanEvents(),n.emitCropData(),null==(t=(e=n.props).onInteractionEnd)||t.call(e)},n.onWheel=function(e){if(n.currentWindow&&(!n.props.onWheelRequest||n.props.onWheelRequest(e))){e.preventDefault();var r=t.getMousePoint(e),i=(0,I.default)(e).pixelY,o=n.props.zoom-i*n.props.zoomSpeed/200;n.setNewZoom(o,r,{shouldUpdatePosition:!0}),n.state.hasWheelJustStarted||n.setState({hasWheelJustStarted:!0},function(){var e,t;return null==(t=(e=n.props).onInteractionStart)?void 0:t.call(e)}),n.wheelTimer&&clearTimeout(n.wheelTimer),n.wheelTimer=n.currentWindow.setTimeout(function(){return n.setState({hasWheelJustStarted:!1},function(){var e,t;return null==(t=(e=n.props).onInteractionEnd)?void 0:t.call(e)})},250)}},n.getPointOnContainer=function(e,t){var r=e.x,i=e.y;if(!n.containerRect)throw Error("The Cropper is not mounted");return{x:n.containerRect.width/2-(r-t.x),y:n.containerRect.height/2-(i-t.y)}},n.getPointOnMedia=function(e){var t=e.x,r=e.y,i=n.props,o=i.crop,s=i.zoom;return{x:(t+o.x)/s,y:(r+o.y)/s}},n.setNewZoom=function(e,t,r){var i=(void 0===r?{}:r).shouldUpdatePosition;if(n.state.cropSize&&n.props.onZoomChange){var o=U(e,n.props.minZoom,n.props.maxZoom);if(void 0===i||i){var s=n.getPointOnContainer(t,n.containerPosition),l=n.getPointOnMedia(s),a={x:l.x*o-s.x,y:l.y*o-s.y},d=n.props.restrictPosition?z(a,n.mediaSize,n.state.cropSize,o,n.props.rotation):a;n.props.onCropChange(d)}n.props.onZoomChange(o)}},n.getCropData=function(){var e,t,r,i,o,s,l,a,d,c,h,u,p,f,m;return n.state.cropSize?(e=n.props.restrictPosition?z(n.props.crop,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):n.props.crop,t=n.mediaSize,r=n.state.cropSize,i=n.getAspect(),o=n.props.zoom,s=n.props.rotation,l=n.props.restrictPosition,void 0===s&&(s=0),void 0===l&&(l=!0),a=l?B:V,d=W(t.width,t.height,s),c=W(t.naturalWi
89dth,t.naturalHeight,s),h={x:a(100,((d.width-r.width/o)/2-e.x/o)/d.width*100),y:a(100,((d.height-r.height/o)/2-e.y/o)/d.height*100),width:a(100,r.width/d.width*100/o),height:a(100,r.height/d.height*100/o)},u=Math.round(a(c.width,h.width*c.width/100)),p=Math.round(a(c.height,h.height*c.height/100)),f=c.width>=c.height*i?{width:Math.round(p*i),height:p}:{width:u,height:Math.round(u/i)},m=(0,L.__assign)((0,L.__assign)({},f),{x:Math.round(a(c.width-f.width,h.x*c.width/100)),y:Math.round(a(c.height-f.height,h.y*c.height/100))}),{croppedAreaPercentages:h,croppedAreaPixels:m}):null},n.emitCropData=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,r=e.croppedAreaPixels;n.props.onCropComplete&&n.props.onCropComplete(t,r),n.props.onCropAreaChange&&n.props.onCropAreaChange(t,r)}},n.emitCropAreaChange=function(){var e=n.getCropData();if(e){var t=e.croppedAreaPercentages,r=e.croppedAreaPixels;n.props.onCropAreaChange&&n.props.onCropAreaChange(t,r)}},n.recomputeCropPosition=function(){if(n.state.cropSize){var e,t,r=n.props.crop;if(n.isInitialized&&(null==(e=n.previousCropSize)?void 0:e.width)&&(null==(t=n.previousCropSize)?void 0:t.height)&&(Math.abs(n.previousCropSize.width-n.state.cropSize.width)>1e-6||Math.abs(n.previousCropSize.height-n.state.cropSize.height)>1e-6)){var i=n.state.cropSize.width/n.previousCropSize.width,o=n.state.cropSize.height/n.previousCropSize.height;r={x:n.props.crop.x*i,y:n.props.crop.y*o}}var s=n.props.restrictPosition?z(r,n.mediaSize,n.state.cropSize,n.props.zoom,n.props.rotation):r;n.previousCropSize=n.state.cropSize,n.props.onCropChange(s),n.emitCropData()}},n.onKeyDown=function(e){var t,r,i=n.props,o=i.crop,s=i.onCropChange,l=i.keyboardStep,a=i.zoom,d=i.rotation,c=l;if(n.state.cropSize){e.shiftKey&&(c*=.2);var h=(0,L.__assign)({},o);switch(e.key){case"ArrowUp":h.y-=c,e.preventDefault();break;case"ArrowDown":h.y+=c,e.preventDefault();break;case"ArrowLeft":h.x-=c,e.preventDefault();break;case"ArrowRight":h.x+=c,e.preventDefault();break;default:return}n.props.restrictPosition&&(h=z(h,n.mediaSize,n.state.cropSize,a,d)),e.repeat||null==(r=(t=n.props).onInteractionStart)||r.call(t),s(h)}},n.onKeyUp=function(e){var t,r;switch(e.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":e.preventDefault();break;default:return}n.emitCropData(),null==(r=(t=n.props).onInteractionEnd)||r.call(t)},n}return(0,L.__extends)(t,e),t.prototype.componentDidMount=function(){this.currentDoc&&this.currentWindow&&(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),void 0===window.ResizeObserver&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=".reactEasyCrop_Container {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: hidden;\n user-select: none;\n touch-action: none;\n cursor: move;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.reactEasyCrop_Image,\n.reactEasyCrop_Video {\n will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */\n}\n\n.reactEasyCrop_Contain {\n max-width: 100%;\n max-height: 100%;\n margin: auto;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n.reactEasyCrop_Cover_Horizontal {\n width: 100%;\n height: auto;\n}\n.reactEasyCrop_Cover_Vertical {\n width: auto;\n height: 100%;\n}\n\n.reactEasyCrop_CropArea {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n border: 1px solid rgba(255, 255, 255, 0.5);\n box-sizing: border-box;\n box-shadow: 0 0 0 9999em;\n color: rgba(0, 0, 0, 0.5);\n overflow: hidden;\n}\n\n.reactEasyCrop_CropAreaRound {\n border-radius: 50%;\n}\n\n.reactEasyCrop_CropAreaGrid::before {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 0;\n bottom: 0;\n left: 33.33%;\n right: 33.33%;\n border-top: 0;\n border-bottom: 0;\n}
89\n\n.reactEasyCrop_CropAreaGrid::after {\n content: ' ';\n box-sizing: border-box;\n position: absolute;\n border: 1px solid rgba(255, 255, 255, 0.5);\n top: 33.33%;\n bottom: 33.33%;\n left: 0;\n right: 0;\n border-left: 0;\n border-right: 0;\n}\n",this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))},t.prototype.componentWillUnmount=function(){var e,t;this.currentDoc&&this.currentWindow&&(void 0===window.ResizeObserver&&this.currentWindow.removeEventListener("resize",this.computeSizes),null==(e=this.resizeObserver)||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef&&(null==(t=this.styleRef.parentNode)||t.removeChild(this.styleRef)),this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent())},t.prototype.componentDidUpdate=function(e){e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect||e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():(null==(t=e.cropSize)?void 0:t.height)!==(null==(n=this.props.cropSize)?void 0:n.height)||(null==(r=e.cropSize)?void 0:r.width)!==(null==(i=this.props.cropSize)?void 0:i.width)?this.computeSizes():((null==(o=e.crop)?void 0:o.x)!==(null==(s=this.props.crop)?void 0:s.x)||(null==(l=e.crop)?void 0:l.y)!==(null==(a=this.props.crop)?void 0:a.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video&&(null==(d=this.videoRef.current)||d.load());var t,n,r,i,o,s,l,a,d,c=this.getObjectFit();c!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:c},this.computeSizes)},t.prototype.getAspect=function(){var e=this.props,t=e.cropSize,n=e.aspect;return t?t.width/t.height:n},t.prototype.getObjectFit=function(){var e,t,n,r;if("cover"===this.props.objectFit){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){this.containerRect=this.containerRef.getBoundingClientRect();var i=this.containerRect.width/this.containerRect.height;return((null==(e=this.imageRef.current)?void 0:e.naturalWidth)||(null==(t=this.videoRef.current)?void 0:t.videoWidth)||0)/((null==(n=this.imageRef.current)?void 0:n.naturalHeight)||(null==(r=this.videoRef.current)?void 0:r.videoHeight)||0)<i?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit},t.prototype.onPinchStart=function(e){var n=t.getTouchPoint(e.touches[0]),r=t.getTouchPoint(e.touches[1]);this.lastPinchDistance=H(n,r),this.lastPinchRotation=F(n,r),this.onDragStart(_(n,r))},t.prototype.onPinchMove=function(e){var n=this;if(this.currentDoc&&this.currentWindow){var r=t.getTouchPoint(e.touches[0]),i=t.getTouchPoint(e.touches[1]),o=_(r,i);this.onDrag(o),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(function(){var e=H(r,i),t=n.props.zoom*(e/n.lastPinchDistance);n.setNewZoom(t,o,{shouldUpdatePosition:!1}),n.lastPinchDistance=e;var s=F(r,i),l=n.props.rotation+(s-n.lastPinchRotation);n.props.onRotationChange&&n.props.onRotationChange(l),n.lastPinchRotation=s})}},t.prototype.render=function(){var e,t=this,n=this.props,r=n.image,o=n.video,s=n.mediaProps,l=n.cropperProps,a=n.transform,d=n.crop,c=d.x,h=d.y,u=n.rotation,p=n.zoom,f=n.cropShape,m=n.showGrid,g=n.roundCropAreaPixels,y=n.style,x=y.containerStyle,b=y.cropAreaStyle,w=y.mediaStyle,v=n.classes,k=v.containerClassName,C=v.cropAreaClassName,N=v.mediaClassName,S=null!=(e=this.state.mediaObjectFit)?e:this.getObjectFit();return i.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:function(e){return t.containerRef
89=e},"data-testid":"container",style:x,className:K("reactEasyCrop_Container",k)},r?i.createElement("img",(0,L.__assign)({alt:"",className:K("reactEasyCrop_Image","contain"===S&&"reactEasyCrop_Contain","horizontal-cover"===S&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===S&&"reactEasyCrop_Cover_Vertical",N)},s,{src:r,ref:this.imageRef,style:(0,L.__assign)((0,L.__assign)({},w),{transform:a||"translate(".concat(c,"px, ").concat(h,"px) rotate(").concat(u,"deg) scale(").concat(p,")")}),onLoad:this.onMediaLoad})):o&&i.createElement("video",(0,L.__assign)({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:K("reactEasyCrop_Video","contain"===S&&"reactEasyCrop_Contain","horizontal-cover"===S&&"reactEasyCrop_Cover_Horizontal","vertical-cover"===S&&"reactEasyCrop_Cover_Vertical",N)},s,{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:(0,L.__assign)((0,L.__assign)({},w),{transform:a||"translate(".concat(c,"px, ").concat(h,"px) rotate(").concat(u,"deg) scale(").concat(p,")")}),controls:!1}),(Array.isArray(o)?o:[{src:o}]).map(function(e){return i.createElement("source",(0,L.__assign)({key:e.src},e))})),this.state.cropSize&&i.createElement("div",(0,L.__assign)({ref:this.cropperRef,style:(0,L.__assign)((0,L.__assign)({},b),{width:g?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:g?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:K("reactEasyCrop_CropArea","round"===f&&"reactEasyCrop_CropAreaRound",m&&"reactEasyCrop_CropAreaGrid",C)},l)))},t.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:3,minZoom:1,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:1},t.getMousePoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t.getTouchPoint=function(e){return{x:Number(e.clientX),y:Number(e.clientY)}},t}(i.Component);e.s(["default",0,q],36450)},27121,28762,74729,e=>{"use strict";function t(e){this.content=e}function n(e){return e>=56320&&e<57344}function r(e){return e>=55296&&e<56320}t.prototype={constructor:t,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,n,r){var i=r&&r!=e?this.remove(r):this,o=i.find(e),s=i.content.slice();return -1==o?s.push(r||e,n):(s[o+1]=n,r&&(s[o]=r)),new t(s)},remove:function(e){var n=this.find(e);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new t(r)},addToStart:function(e,n){return new t([e,n].concat(this.remove(e).content))},addToEnd:function(e,n){var r=this.remove(e).content.slice();return r.push(e,n),new t(r)},addBefore:function(e,n,r){var i=this.remove(n),o=i.content.slice(),s=i.find(e);return o.splice(-1==s?o.length:s,0,n,r),new t(o)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var n=this;e=t.from(e);for(var r=0;r<e.content.length;r+=2)n=n.remove(e.content[r]);return n},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)};class i{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;if(a>e&&!1!==n(l,r+s,i||null,o)&&l.content.size){let i=s+1;l.nodesBetween(Math.max(0,e-i),Math.min(l.content.size,t-i),n,r+i)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let a=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&a||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new i(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=l}return new i(n,r)}cutByIndex(e,t){return e==t?i.empty:0==e&&t==this.content.length?this:new i(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;
89let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new i(r,o)}addToStart(e){return new i([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new i(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,i,o){for(let s=0;;s++){if(s==t.childCount||s==i.childCount)return t.childCount==i.childCount?null:o;let l=t.child(s),a=i.child(s);if(l==a){o+=l.nodeSize;continue}if(!l.sameMarkup(a))return o;if(l.isText&&l.text!=a.text){let e=l.text,t=a.text,i=0;for(;e[i]==t[i];i++)o++;return i&&i<e.length&&i<t.length&&r(e.charCodeAt(i-1))&&n(e.charCodeAt(i))&&o--,o}if(l.content.size||a.content.size){let t=e(l.content,a.content,o+1);if(null!=t)return t}o+=l.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,i=e.size){return function e(t,i,o,s){for(let l=t.childCount,a=i.childCount;;){if(0==l||0==a)return l==a?null:{a:o,b:s};let d=t.child(--l),c=i.child(--a),h=d.nodeSize;if(d==c){o-=h,s-=h;continue}if(!d.sameMarkup(c))return{a:o,b:s};if(d.isText&&d.text!=c.text){let e=d.text,t=c.text,i=e.length,l=t.length;for(;i>0&&l>0&&e[i-1]==t[l-1];)i--,l--,o--,s--;return i&&l&&i<e.length&&r(e.charCodeAt(i-1))&&n(e.charCodeAt(i))&&(o++,s++),{a:o,b:s}}if(d.content.size||c.content.size){let t=e(d.content,c.content,o-1,s-1);if(t)return t}o-=h,s-=h}}(this,e,t,i)}findIndex(e){if(0==e)return s(0,e);if(e==this.size)return s(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return s(t+1,r);return s(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return i.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return i.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return i.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new i(t||e,n)}static from(e){if(!e)return i.empty;if(e instanceof i)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new i([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}i.empty=new i([],0);let o={index:0,offset:0};function s(e,t){return o.index=e,o.offset=t,o}function l(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!l(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!l(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class a{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&l(this.attrs,e.attrs)}
vendor: 6,047 bytes, line 89
89toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return a.none;if(e instanceof a)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}a.none=[];class d extends Error{}class c{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i,o,s){let{index:l,offset:a}=t.findIndex(n),d=t.maybeChild(l);if(a==n||d.isText)return s&&i<=0&&o<=0&&!s.canReplace(l,l,r)?null:t.cut(0,n).append(r).append(t.cut(n));let c=e(d.content,n-a-1,r,0==l?i-1:0,l==t.childCount-1?o-1:0,d);return c&&t.replaceChild(l,d.copy(c))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new c(n,this.openStart,this.openEnd)}removeBetween(e,t){return new c(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:l,offset:a}=t.findIndex(r);if(o==n||s.isText){if(a!=r&&!t.child(l).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=l)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return c.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new c(i.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new c(e,n,r)}}function h(e,t){if(!t.type.compatibleContent(e.type))throw new d("Cannot join "+t.type.name+" onto "+e.type.name)}function u(e,t,n){let r=e.node(n);return h(r,t.node(n)),r}function p(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function f(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(p(e.nodeAfter,r),o++));for(let e=o;e<s;e++)p(i.child(e),r);t&&t.depth==n&&t.textOffset&&p(t.nodeBefore,r)}function m(e,t){if(!e.type.validContent(t))throw new d("Invalid content for node "+e.type.name);return e.copy(t)}function g(e,t,n){let r=[];return f(null,e,n,r),e.depth>n&&p(m(u(e,t,n+1),g(e,t,n+1)),r),f(t,null,n,r),new i(r)}c.empty=new c(i.empty,0,0);class y{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return a.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new v(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;
89i=s-1,r+=o+1}return new y(t,n,i)}static resolveCached(e,t){let n=w.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else w.set(e,n=new x);let r=n.elts[n.i]=y.resolve(e,t);return n.i=(n.i+1)%b,r}}class x{constructor(){this.elts=[],this.i=0}}let b=12,w=new WeakMap;class v{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let k=Object.create(null);class C{constructor(e,t,n,r=a.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||i.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&l(this.attrs,t||e.defaultAttrs||k)&&a.sameSet(this.marks,n||a.none)}copy(e=null){return e==this.content?this:new C(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new C(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return c.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new c(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),o=this.resolve(t);if(n.openStart>r.depth)throw new d("Inserted content deeper than insertion position");if(r.depth-n.openStart!=o.depth-n.openEnd)throw new d("Inconsistent open depths");return function e(t,n,r,o){let s=t.index(o),l=t.node(o);if(s==n.index(o)&&o<t.depth-r.openStart){let i=e(t,n,r,o+1);return l.copy(l.content.replaceChild(s,i))}if(!r.content.size)return m(l,g(t,n,o));if(r.openStart||r.openEnd||t.depth!=o||n.depth!=o){let{start:e,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(i.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return m(l,function e(t,n,r,o,s){let l=t.depth>s&&u(t,n,s+1),a=o.depth>s&&u(r,o,s+1),d=[];return f(null,t,s,d),l&&a&&n.index(s)==r.index(s)?(h(l,a),p(m(l,e(t,n,r,o,s+1)),d)):(l&&p(m(l,g(t,n,s+1)),d),f(n,r,s,d),a&&p(m(a,g(r,o,s+1)),d)),f(o,null,s,d),new i(d)}(t,e,s,n,o))}{let e=t.parent,i=e.content;return m(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,o,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return y.resolveCached(this,e)}resolveNoCache(e){return y.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}
89toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),S(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=i.empty,r=0,o=n.childCount){let s=this.contentMatchAt(e).matchFragment(n,r,o),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=a.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!a.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=i.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}C.prototype.text=void 0;class N extends C{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):S(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new N(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new N(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function S(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class M{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new j(e,t);if(null==i.next)return M.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=T(e),r=n;return e.eat(",")&&(r="}"!=e.next?T(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}
vendor: 5,540 bytes, line 89
89function i(e,t){e.forEach(e=>e.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);E(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new M(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(A);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(E(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(s,l){let a=s.matchFragment(e,n);if(a&&(!t||a.validEnd))return i.from(l.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:n}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=o(n,l.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}M.empty=new M(!0);class j{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function T(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function A(e,t){return t-e}function E(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(A)}function R(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function D(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function O(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function P(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new I(e,r,t[r]);return n}class L{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=P(e,n.attrs),this.defaultAttrs=R(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==M.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:D(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new C(this,this.computeAttrs(e),i.from(t),a.setFrom(n))}createChecked(e=null,t,n){return t=i.from(t),this.checkContent(t),new C(this,this.computeAttrs(e),t,a.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=i.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(i.empty,!0);return o?new C(this,e,t.append(o),a.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);
89if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){O(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:a.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new L(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class I{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class z{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=P(e,r.attrs),this.excluded=null;let i=R(this.attrs);this.instance=i?new a(this,i):null}create(e=null){return!e&&this.instance?this.instance:new a(this,D(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new z(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){O(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}function $(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class H{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new U(this,t,!1);return n.addAll(e,a.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new U(this,t,!0);return n.addAll(e,a.none,t.from,t.to),c.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=K(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=K(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new H(e,H.schemaRules(e)))}}let F={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},B={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},V={ol:!0,ul:!0};function _(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class W{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=a.none,this.match=i||(4&o?null:e.contentMatch)}
89findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(i.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=i.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(i.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!F.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class U{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=_(null,t.preserveWhitespace,0)|4*!!n;i=r?new W(r.type,r.attrs,a.none,!0,t.topMatch||r.type.contentMatch,o):n?new W(null,null,a.none,!0,null,o):new W(e.schema.topNodeType,null,a.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;V.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&V.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));n:if(l?l.ignore:B.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,r=this.needsBlock;if(F.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break n}let s=l&&l.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,l,n,!1===l.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;
vendor: 4,107 bytes, line 89
89if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],l=s.findWrapping(e);if(l&&(!r||r.length>l.length+o)&&(r=l,i=s,!l.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=a.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):q(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=_(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let l=a.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!q(t.type,e))||(l=t.addToSet(l),!1)),this.nodes.push(new W(e,t,l,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];
89if(t.isTextblock&&t.defaultAttrs)return t}}}function K(e){let t={};for(let n in e)t[n]=e[n];return t}function q(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}function J(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Y(e){return e.document||window.document}let X=new WeakMap;function G(e,t,n,r){let i,o,s;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let l=t[0],a;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=X.get(r))&&X.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),a=o)&&a.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let d=l.indexOf(" ");d>0&&(n=l.slice(0,d),l=l.slice(d+1));let c=n?e.createElementNS(n,l):e.createElement(l),h=t[1],u=1;if(h&&"object"==typeof h&&null==h.nodeType&&!Array.isArray(h)){for(let e in u=2,h)if(null!=h[e]){let t=e.indexOf(" ");t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),h[e]):"style"==e&&c.style?c.style.cssText=h[e]:c.setAttribute(e,h[e])}}for(let o=u;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>u)throw RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}if("string"==typeof s)c.appendChild(e.createTextNode(s));else{let{dom:t,contentDOM:o}=G(e,s,n,r);if(c.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:c,contentDOM:i}}e.s(["DOMParser",0,H,"DOMSerializer",0,class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Y(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return Y(t).createTextNode(e.text);let{dom:n,contentDOM:r}=G(Y(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&G(Y(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:G(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=J(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return J(e.marks)}},"Fragment",0,i,"Mark",0,a,"MarkType",0,z,"Node",0,C,"NodeRange",0,v,"ReplaceError",0,d,"Schema",0,class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let t in e)n[t]=e[t];n.nodes=t.from(e.nodes),n.marks=t.from(e.marks||{}),this.nodes=L.compile(this.spec.nodes,this),this.marks=z.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],n=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=M.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?$(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:$(this,n.split(" "))}this.nodeFromJSON=e=>C.fromJSON(this,e),this.markFromJSON=e=>a.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof L){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new N(n,n.defaultAttrs,e,a.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}},"Slice",0,c],28762);class Z{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Q{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Q.empty)return Q.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;
89for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[s+i],d=this.ranges[s+o],c=l+a;if(e<=c){let i=a?e==l?-1:e==c?1:t:t,o=l+r+(i<0?0:d);if(n)return o;let h=e==(t<0?l:c)?null:s/3+(e-l)*65536,u=e==l?2:e==c?1:4;return(t<0?e!=l:e!=c)&&(u|=8),new Z(o,u,h)}r+=d-a}return n?e+r:new Z(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[t+i];if(e<=s+l&&t==3*r)return!0;n+=this.ranges[t+o]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),l=o+(this.inverted?0:i),a=this.ranges[r+t],d=this.ranges[r+n];e(s,s+a,l,l+d),i+=d-a}}invert(){return new Q(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?Q.empty:new Q(e<0?[0,-e,0]:[0,0,e])}}Q.empty=new Q([]);class ee{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ee(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ee;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new Z(e,r,null)}}let et=Object.create(null);class en{getMap(){return Q.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=et[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in et)throw RangeError("Duplicate use of step JSON ID "+e);return et[e]=t,t.prototype.jsonID=e,t}}class er{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new er(e,null)}static fail(e){return new er(null,e)}static fromReplace(e,t,n,r){try{return er.ok(e.replace(t,n,r))}catch(e){if(e instanceof d)return er.fail(e.message);throw e}}}function ei(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(ei(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return i.fromArray(r)}class eo extends en{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new c(ei(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return er.fromReplace(e,this.from,this.to,i)}invert(){return new es(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new eo(t.pos,n.pos,this.mark)}merge(e){return e instanceof eo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new eo(t.from,t.to,e.markFromJSON(t.mark))}}en.jsonID("addMark",eo);class es extends en{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}
vendor: 19,098 bytes, line 89
89apply(e){let t=e.slice(this.from,this.to),n=new c(ei(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return er.fromReplace(e,this.from,this.to,n)}invert(){return new eo(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new es(t.pos,n.pos,this.mark)}merge(e){return e instanceof es&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new es(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new es(t.from,t.to,e.markFromJSON(t.mark))}}en.jsonID("removeMark",es);class el extends en{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return er.fromReplace(e,this.pos,this.pos+1,new c(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new el(this.pos,t.marks[n]);return new el(this.pos,this.mark)}}return new ea(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new el(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new el(t.pos,e.markFromJSON(t.mark))}}en.jsonID("addNodeMark",el);class ea extends en{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return er.fromReplace(e,this.pos,this.pos+1,new c(i.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new el(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ea(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ea(t.pos,e.markFromJSON(t.mark))}}en.jsonID("removeNodeMark",ea);class ed extends en{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&eh(e,this.from,this.to)?er.fail("Structure replace would overwrite content"):er.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Q([this.from,this.to-this.from,this.slice.size])}invert(e){return new ed(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&ed.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new ed(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ed)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?c.empty:new c(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ed(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?c.empty:new c(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ed(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new ed(t.from,t.to,c.fromJSON(e,t.slice),!!t.structure)}}ed.MAP_BIAS=1,en.jsonID("replace",ed);class ec extends en{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(eh(e,this.from,this.gapFrom)||eh(e,this.gapTo,this.to)))return er.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return er.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?er.fromReplace(e,this.from,this.to,n):er.fail("Content does not fit in gap")}getMap(){return new Q([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new ec(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new ec(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ec(t.from,t.to,t.gapFrom,t.gapTo,c.fromJSON(e,t.slice),t.insert,!!t.structure)}}function eh(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function eu(e,t,n,r=n.contentMatch,o=!0){let s=e.doc.nodeAt(t),l=[],a=t+1;for(let t=0;t<s.childCount;t++){let d=s.child(t),h=a+d.nodeSize,u=r.matchType(d.type);if(u){r=u;for(let t=0;t<d.marks.length;t++)n.allowsMarkType(d.marks[t].type)||e.step(new es(a,h,d.marks[t]));if(o&&d.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(d.text);)r||(r=new c(i.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),l.push(new ed(a+e.index,a+e.index+e[0].length,r))}}else l.push(new ed(a,h,c.empty));a=h}if(!r.validEnd){let t=r.fillBefore(i.empty,!0);e.replace(a,a,new c(t,0,0))}for(let t=l.length-1;t>=0;t--)e.step(l[t])}function ep(e){return{type:e,attrs:null}}function ef(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function em(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function eg(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function ey(e,t,n=t,r=c.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return ex(i,o,r)?new ed(t,n,r):new eb(i,o,r).fit()}function ex(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}en.jsonID("replaceAround",ec);class eb{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=i.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=i.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let l=new c(i,o,s);return e>-1?new ec(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new ed(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=ek(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let o=this.depth;o>=0;o--){let{type:s,match:l}=this.frontier[o],a,d=null;if(1==t&&(r?l.matchType(r.type)||(d=l.fillBefore(i.from(r),!1)):e&&s.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:o,parent:e,inject:d};if(2==t&&r&&(a=l.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:o,parent:e,wrap:a};if(e&&l.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=ek(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new c(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=ek(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new c(ew(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new c(ew(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let s=this.unplaced,l=n?n.content:s.content,a=s.openStart-e,d=0,h=[],{match:u,type:p}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)h.push(r.child(e));u=u.matchFragment(r)}let f=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let e=l.child(d),t=u.matchType(e.type);if(!t)break;(++d>1||0==a||e.content.size)&&(u=t,h.push(function e(t,n,r){if(n<=0)return t;let o=t.content;return n>1&&(o=o.replaceChild(0,e(o.firstChild,n-1,1==o.childCount?r-1:0))),n>0&&(o=t.type.contentMatch.fillBefore(o).append(o),r<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(i.empty,!0)))),t.copy(o)}(e.mark(p.allowedMarks(e.marks)),1==d?a:0,d==l.childCount?f:-1)))}let m=d==l.childCount;m||(f=-1),this.placed=ev(this.placed,t,i.from(h)),this.frontier[t].match=u,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=l;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=m?0==e?c.empty:new c(ew(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new c(ew(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eC(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){r:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=eC(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=eC(e,n,r,t,!0);if(!i||i.childCount)continue r}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ev(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=ev(this.placed,this.depth,i.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(i.empty,!0);e.childCount&&(this.placed=ev(this.placed,this.frontier.length,e))}}function ew(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(ew(e.firstChild.content,t-1,n)))}function ev(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(ev(e.lastChild.content,t-1,n)))}function ek(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function eC(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?l:null}function eN(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class eS extends en{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return er.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return er.fromReplace(e,this.pos,this.pos+1,new c(i.from(r),0,+!t.isLeaf))}getMap(){return Q.empty}invert(e){return new eS(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eS(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new eS(t.pos,t.attr,t.value)}}en.jsonID("attr",eS);class eM extends en{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return er.ok(n)}getMap(){return Q.empty}invert(e){return new eM(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eM(t.attr,t.value)}}en.jsonID("docAttr",eM);let ej=class extends Error{};(ej=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),ej.prototype.constructor=ej,ej.prototype.name="TransformError";class eT{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ee}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ej(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=c.empty){let r=ey(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new c(i.from(n),0,0))}delete(e,t){return this.replace(e,t,c.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),s=e.doc.resolve(n);if(ex(o,s,r))return e.step(new ed(t,n,r));let l=eN(o,s);0==l[l.length-1]&&l.pop();let a=-(o.depth+1);l.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;l.indexOf(e)>-1?a=e:o.before(e)==t&&l.splice(1,0,-e)}let d=l.indexOf(a),h=[],u=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(h.push(n),t==r.openStart)break;e=n.content}for(let e=u-1;e>=0;e--){var p;let t=h[e],n=(p=t.type).spec.defining||p.spec.definingForContent;if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))u=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+u+1)%(r.openStart+1),p=h[a];if(p)for(let t=0;t<l.length;t++){let h=l[(t+d)%l.length],u=!0;h<0&&(u=!1,h=-h);let f=o.node(h-1),m=o.index(h-1);if(f.canReplaceWith(m,m,p.type,p.marks))return e.replace(o.before(h),u?s.after(h):n,new c(function e(t,n,r,o,s){if(n<r){let i=t.firstChild;t=t.replaceChild(0,i.copy(e(i.content,n+1,r,o,i)))}if(n>o){let e=s.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(i.empty,!0))}return t}(r.content,0,r.openStart,a),a,r.openEnd))}}let f=e.steps.length;for(let i=l.length-1;i>=0&&(e.replace(t,n,r),!(e.steps.length>f));i--){let e=l[i];e<0||(t=o.before(e),n=s.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,o=t;if(!n.isInline&&r==o&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=o=e)}return this.replaceRange(r,o,new c(i.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=eN(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:o,depth:s}=t,l=r.before(s+1),a=o.after(s+1),d=l,h=a,u=i.empty,p=0;for(let e=s,t=!1;e>n;e--)t||r.index(e)>
890?(t=!0,u=i.from(r.node(e).copy(u)),p++):d--;let f=i.empty,m=0;for(let e=s,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,f=i.from(o.node(e).copy(f)),m++):h++;e.step(new ec(d,h,l,a,new c(u.append(f),p,m),u.size-p,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let l=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);em(e,r.node(),r.before(),l)}s.inlineContent&&eu(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let a=e.mapping.slice(l),d=a.map(t-n);if(e.step(new ed(d,a.map(t+n,-1),c.empty,!0)),!0===r){let t=e.doc.resolve(d);ef(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=i.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=i.from(n[e].type.create(n[e].attrs,r))}let o=t.start,s=t.end;e.step(new ec(o,s,o,s,new c(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var o=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let s=o.steps.length;return o.doc.nodesBetween(e,t,(e,t)=>{var l,a,d;let h,u,p="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,p)&&(l=o.doc,a=o.mapping.slice(s).map(t),d=n,u=(h=l.resolve(a)).index(),h.parent.canReplaceWith(u,u+1,d))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&em(o,e,t,s),eu(o,o.mapping.slice(s).map(t,1),n,void 0,null===r);let l=o.mapping.slice(s),a=l.map(t,1),d=l.map(t+e.nodeSize,1);return o.step(new ec(a,d,a+1,d-1,new c(i.from(n.create(p,null,e.marks)),0,0),1,!0)),!0===r&&ef(o,e,t,s),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,o){let s=e.doc.nodeAt(t);if(!s)throw RangeError("No node at given position");n||(n=s.type);let l=n.create(r,null,o||s.marks);if(s.isLeaf)return e.replaceWith(t,t+s.nodeSize,l);if(!n.validContent(s.content))throw RangeError("Invalid content for node type "+n.name);e.step(new ec(t,t+s.nodeSize,t+1,t+s.nodeSize-1,new c(i.from(l),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new eS(e,t,n)),this}setDocAttribute(e,t){return this.step(new eM(e,t)),this}addNodeMark(e,t){return this.step(new el(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof a)t.isInSet(n.marks)&&this.step(new ea(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new ea(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let o=e.doc.resolve(t),s=i.empty,l=i.empty;for(let e=o.depth,t=o.depth-n,a=n-1;e>t;e--,a--){s=i.from(o.node(e).copy(s));let t=r&&r[a];l=i.from(t?t.type.create(t.attrs,l):o.node(e).copy(l))}e.step(new ed(t,t,new c(s.append(l),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,l;return r=this,s=[],l=[],r.doc.nodesBetween(e,t,(r,a,d)=>{if(!r.isInline)return;let c=r.marks;if(!n.isInSet(c)&&d.type.allowsMarkType(n.type)){let d=Math.max(a,e),h=Math.min(a+r.nodeSize,t),u=n.addToSet(c);for(let e=0;e<c.length;e++)c[e].isInSet(u)||(i&&i.to==d&&i.mark.eq(c[e])?i.to=h:s.push(i=new es(d,h,c[e])));o&&o.to==d?o.to=h:l.push(o=new eo(d,h,n))}}),s.forEach(e=>r.step(e)),l.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let l=null;if(n instanceof z){let e=r.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<l.length;t++){let r=l[t],a;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(a=t)}a?(a.to=n,a.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}
89),i.forEach(e=>r.step(new es(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return eu(this,e,t,n),this}}e.s(["Mapping",0,ee,"RemoveMarkStep",0,es,"ReplaceAroundStep",0,ec,"ReplaceStep",0,ed,"Transform",0,eT,"canJoin",0,function(e,t){let n=e.resolve(t),r=n.index();return eg(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)},"canSplit",0,function(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),l=r&&r[t+1];l&&(s=s.replaceChild(0,l.type.create(l.attrs)));let a=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!a.type.validContent(s))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)},"dropPoint",0,function(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),l=!1;if(1==e)l=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);l=e&&s.canReplaceWith(o,o,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null},"findWrapping",0,function(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;l&&e<i;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return o?i.map(ep).concat({type:t,attrs:n}).concat(o.map(ep)):null},"joinPoint",0,function(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&eg(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}},"liftTarget",0,function(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,l=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,l,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(l==o.childCount||o.canReplace(0,l))))break;s&&(r=1),l<o.childCount&&(i=1)}return null},"replaceStep",0,ey],74729);let eA=Object.create(null);class eE{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new eR(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<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=c.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],d=e.mapping.slice(i);e.replaceRange(d.map(l.pos),d.map(a.pos),s?c.empty:t),0==s&&eB(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=e.mapping.slice(n),a=l.map(o.pos),d=l.map(s.pos);i?e.deleteRange(a,d):(e.replaceRangeWith(a,d,t),eB(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new eP(e):eF(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?eF(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):eF(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}
vendor: 6,439 bytes, line 89
89static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new e$(e.node(0))}static atStart(e){return eF(e,e,0,0,1)||new e$(e)}static atEnd(e){return eF(e,e,e.content.size,e.childCount,-1)||new e$(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=eA[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in eA)throw RangeError("Duplicate use of selection JSON ID "+e);return eA[e]=t,t.prototype.jsonID=e,t}getBookmark(){return eP.between(this.$anchor,this.$head).getBookmark()}}eE.prototype.visible=!0;class eR{constructor(e,t){this.$from=e,this.$to=t}}let eD=!1;function eO(e){eD||e.parent.inlineContent||(eD=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class eP extends eE{constructor(e,t=e){eO(e),eO(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 eE.near(n);let r=e.resolve(t.map(this.anchor));return new eP(r.parent.inlineContent?r:n,n)}replace(e,t=c.empty){if(super.replace(e,t),t==c.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof eP&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new eL(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 eP(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=eE.findFrom(t,n,!0)||eE.findFrom(t,-n,!0);if(!e)return eE.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(eE.findFrom(e,-n,!0)||eE.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new eP(e,t)}}eE.jsonID("text",eP);class eL{constructor(e,t){this.anchor=e,this.head=t}map(e){return new eL(e.map(this.anchor),e.map(this.head))}resolve(e){return eP.between(e.resolve(this.anchor),e.resolve(this.head))}}class eI extends eE{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?eE.near(i):new eI(i)}content(){return new c(i.from(this.node),0,0)}eq(e){return e instanceof eI&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ez(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new eI(e.resolve(t.anchor))}static create(e,t){return new eI(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}eI.prototype.visible=!1,eE.jsonID("node",eI);class ez{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new eL(n,n):new ez(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&eI.isSelectable(n)?new eI(t):eE.near(t)}}class e$ extends eE{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=c.empty){if(t==c.empty){e.delete(0,e.doc.content.size);let t=eE.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new e$(e)}map(e){return new e$(e)}eq(e){return e instanceof e$}getBookmark(){return eH}}eE.jsonID("all",e$);let eH={map(){return this},resolve:e=>new e$(e)};function eF(e,t,n,r,i,o=!1){if(t.inlineContent)return eP.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&eI.isSelectable(r))return eI.create(e,n-(i<0?r.nodeSize:0))}else{let t=eF(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function eB(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof ed||o instanceof ec)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(eE.near(e.doc.resolve(r),n)))}class eV extends eT{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.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return a.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)||a.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),!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.selection.to!=t+e.length||this.setSelection(eE.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 e_(e,t){return t&&e?e.bind(t):e}
89class eW{constructor(e,t,n){this.name=e,this.init=e_(t.init,n),this.apply=e_(t.apply,n)}}let eU=[new eW("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new eW("selection",{init:(e,t)=>e.selection||eE.atStart(t.doc),apply:e=>e.selection}),new eW("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new eW("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class eK{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=eU.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 eW(e.key,e.spec.state,e))})}}let eq=Object.create(null);function eJ(e){return e in eq?e+"$"+ ++eq[e]:(eq[e]=0,e+"$")}e.s(["AllSelection",0,e$,"EditorState",0,class e{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;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let l=r?r[o].n:0,a=r?r[o].state:this,d=l<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,n);if(d&&n.filterTransaction(d,o)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(d),n=n.applyInner(d),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let n=new e(this.config),r=this.config.fields;for(let e=0;e<r.length;e++){let i=r[e];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new eV(this)}static create(t){let n=new eK(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n);for(let e=0;e<n.fields.length;e++)r[n.fields[e].name]=n.fields[e].init(t,r);return r}reconfigure(t){let n=new eK(this.schema,t.plugins),r=n.fields,i=new e(n);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.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(t,n,r){if(!n)throw RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw RangeError("Required config field 'schema' missing");let i=new eK(t.schema,t.plugins),o=new e(i);return i.fields.forEach(e=>{if("doc"==e.name)o.doc=C.fromJSON(t.schema,n.doc);else if("selection"==e.name)o.selection=eE.fromJSON(o.doc,n.selection);else if("storedMarks"==e.name)n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let i in r){let s=r[i],l=s.spec.state;if(s.key==e.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){o[e.name]=l.fromJSON.call(s,t,n[i],o);return}}o[e.name]=e.init(t,o)}}),o}},"NodeSelection",0,eI,"Plugin",0,class{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:eJ("plugin")}getState(e){return e[this.key]}},"PluginKey",0,class{constructor(e="key"){this.key=eJ(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}},"Selection",0,eE,"SelectionRange",0,eR,"TextSelection",0,eP],27121)},92393,e=>{"use strict";let t={src:e.i(5644).default,width:32,height:32,blurWidth:0,blurHeight:0};e.s(["default",0,t])},79930,2699,e=>{"use strict";let t={src:e.i(64123).default,width:16,height:16,blurWidth:0,blurHeight:0};e.s(["default",0,t],79930);let n={src:e.i(14483).default,width:113,height:100,blurWidth:0,blurHeight:0};e.s(["default",0,n],2699)},35500,e=>{"use strict";let t={src:e.i(373).default,width:20,height:20,blurWidth:0,blurHeight:0};e.s(["default",0,t])},9252,99353,e=>{"use strict";var t=e.i(43476),n=e.i(10552),r=e.i(94499),i=e.i(64659),o=e.i(91583),s=e.i(89853),l=e.i(39312),a=e.i(55716),d=e.i(2008),c=e.i(63209),h=e.i(7899),u=e.i(6886),p=e.i(3116),f=e.i(75254);let m=(0,f.default)("sticky-note",[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}]]);e.s(["StickyNote",0,m],99353);var g=e.i(48256);let y=(0,f.default)("file-input",[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-1",key:"1q9hii"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]),x=(0,f.default)("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);var b=e.i(91285);function w({icon:e,label:n}){return(0,t.jsx)(r.NodeViewWrapper,{as:"span",className:"inline","data-drag-handle":"",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 px-2.5 py-1.5 rounded-full bg-white text-primary-light text-sm font-bold mx-0.5 select-none cursor-grab active:cursor-grabbing",children:[e,(0,t.jsx)("span",{children:n})]})})}function v({node:e}){let{format:n,shiftEnabled:r,shiftDir:i,shiftAmount:o,shiftUnit:s,at:l}=e.attrs,a=n;return r&&(a+=` (${i}${o} ${s})`),l&&(a+=` @ ${l}`),(0,t.jsx)(w,{color:"teal",icon:(0,t.jsx)(b.DateFilled,{size:16}),label:a})}let k=n.Node.create({name:"dateNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({format:{default:"MMMM d, yyyy"},shiftDir:{default:"+"},shiftAmount:{default:"1"},shiftUnit:{default:"days"},shiftEnabled:{default:!1},at:{default:""},pattern:{default:""},locale:{default:"en-US"},trim:{default:"trim"}}),parseHTML:()=>[{tag:'span[data-type="date-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"date-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(v),addCommands:()=>({insertDateNode:e=>({commands:t})=>t.insertContent({type:"dateNode",attrs:{format:e??"MMMM d, yyyy",shiftDir:"+",shiftAmount:"1",shiftUnit:"days",shiftEnabled:!1,at:"",pattern:"",locale:"en-US",trim:"trim"}})})});function C({node:e}){let n=e.attrs.trim;return(0,t.jsx)(w,{color:"orange",icon:(0,t.jsx)(b.CursorFilled,{size:16}),label:n&&"yes"!==n?`cursor \xb7 trim:${n}`:"cursor"})}let N=n.Node.create({name:"cursorNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({trim:{default:"yes"}}),parseHTML:()=>[{tag:'span[data-type="cursor-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"cursor-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(C),addCommands:()=>({insertCursorNode:()=>({commands:e})=>e.insertContent({type:"cursorNode"})})});function S({node:e}){let n=e.attrs.trim;return(0,t.jsx)(w,{color:"blue",icon:(0,t.jsx)(b.ClipboardFilled,{size:16}),label:n&&"yes"!==n?`clipboard \xb7 trim:${n}`:"clipboard"})}let M=n.Node.create({name:"clipboardNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({trim:{default:"yes"}}),parseHTML:()=>[{tag:'span[data-type="clipboard-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"clipboard-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(S),addCommands:()=>({insertClipboardNode:()=>({commands:e})=>e.insertContent({type:"clipboardNode"})})});function j({node:e,editor:n,getPos:i}){let o=e.attrs.label||"Text field",s=n?.isEditable??!1;return(0,t.jsx)(r.NodeViewWrapper,{as:"span",className:"inline","data-drag-handle":"",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!s||!n||"function"!=typeof i)return;let r=i();"number"==typeof r&&(n.chain().focus().setNodeSelection(r).run(),n.view.dom.dispatchEvent(new CustomEvent("snippet-node-action",{detail:{action:"openTextFieldModal",pos:r,attrs:e.attrs}})))},children:(0,t.jsxs)("span",{className:`inline-flex items-center gap-1 px-2.5 py-1.5 rounded-full bg-white text-primary-light text-sm font-bold mx-0.5 select-none ${s?"cursor-grab active:cursor-grabbing":"cursor-default"}`,children:[(0,t.jsx)(b.TextFieldFilled,{size:16,color:"#7d7af8"}),(0,t.jsx)("span",{children:o})]})})}let T=n.Node.create({name:"textFieldNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({label:{default:"Text field"},placeholder:{default:""},defaultValue:{default:""},cols:{default:""},validateType:{default:"Any"},validateRequired:{default:!1},trim:{default:"yes"},formatter:{default:""}}),parseHTML:()=>[{tag:'span[data-type="text-field-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"text-field-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(j),addCommands:()=>({insertTextFieldNode:e=>({commands:t})=>t.insertContent({type:"textFieldNode",attrs:{label:"Text field",placeholder:"",defaultValue:"",cols:"",validateType:"Any",validateRequired:!1,trim:"yes",formatter:"",...e}})})});function A({node:e,editor:n,getPos:i}){let o=e.attrs.label||"Paragraph field",s=e.attrs.placeholder||"";e.attrs.defaultValue;let l=n?.isEditable??!1;return(0,t.jsx)(r.NodeViewWrapper,{as:"span",className:"inline-block mx-0.5","data-drag-handle":"",onClick:t=>{if(t.preventDefault(),t.stopPropagation(),!l||!n||"function"!=typeof i)return;let r=i();"number"==typeof r&&(n.chain().focus().setNodeSelection(r).run(),n.view.dom.dispatchEvent(new CustomEvent("snippet-node-action",{detail:{action:"openParagraphFieldModal",pos:r,attrs:e.attrs}})))},children:(0,t.jsxs)("div",{className:`inline-block p-3 bg-white rounded-lg select-none pr-8 ${l?"curs
89or-grab active:cursor-grabbing":"cursor-default"}`,children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-primary-light",children:[(0,t.jsx)(b.ParagraphFieldFilled,{size:16,color:"#7d7af8"}),(0,t.jsx)("span",{className:"text-primary-light font-bold text-sm",children:o})]}),s&&(0,t.jsx)("div",{className:"mt-1.5 text-gray-400 text-sm font-medium",children:s})]})})}let E=n.Node.create({name:"paragraphFieldNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({label:{default:"Paragraph field"},placeholder:{default:""},defaultValue:{default:""},cols:{default:""},rows:{default:""},validateType:{default:"Any"},validateRequired:{default:!1},trim:{default:"yes"},formatter:{default:""}}),parseHTML:()=>[{tag:'span[data-type="paragraph-field-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"paragraph-field-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(A),addCommands:()=>({insertParagraphFieldNode:e=>({commands:t})=>t.insertContent({type:"paragraphFieldNode",attrs:{label:"Paragraph field",placeholder:"",defaultValue:"",cols:"",rows:"",validateType:"Any",validateRequired:!1,trim:"yes",formatter:"",...e}})})});function R({node:e}){let n=e.attrs.label||"Dropdown",r=e.attrs.defaultValue;return(0,t.jsx)(w,{color:"green",icon:(0,t.jsx)(i.ChevronDown,{className:"w-3 h-3 shrink-0"}),label:r?`${n} \xb7 ${r}`:n})}let D=n.Node.create({name:"dropdownNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({label:{default:"Dropdown"},options:{default:"Option 1,Option 2,Option 3"},defaultValue:{default:""},multiple:{default:!1},cols:{default:""},validateType:{default:"Any"},validateRequired:{default:!1},trim:{default:"yes"},formatter:{default:""},itemformatter:{default:""}}),parseHTML:()=>[{tag:'span[data-type="dropdown-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"dropdown-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(R),addCommands:()=>({insertDropdownNode:e=>({commands:t})=>t.insertContent({type:"dropdownNode",attrs:{label:"Dropdown",options:"Option 1,Option 2,Option 3",defaultValue:"",multiple:!1,cols:"",validateType:"Any",validateRequired:!1,trim:"yes",formatter:"",itemformatter:"",...e}})})});function O({node:e}){let n=e.attrs.label||"Toggle",r=e.attrs.defaultOn;return(0,t.jsx)(w,{color:"pink",icon:(0,t.jsx)(o.ToggleLeft,{className:"w-3 h-3 shrink-0"}),label:`${n} \xb7 ${r?"yes":"no"}`})}let P=n.Node.create({name:"toggleFieldNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({label:{default:"Toggle"},defaultOn:{default:!1},contents:{default:""},trim:{default:"yes"},formatter:{default:""}}),parseHTML:()=>[{tag:'span[data-type="toggle-field-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"toggle-field-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(O),addCommands:()=>({insertToggleFieldNode:e=>({commands:t})=>t.insertContent({type:"toggleFieldNode",attrs:{label:"Toggle",defaultOn:!1,contents:"",trim:"yes",formatter:"",...e}})})});function L({node:e}){let n=e.attrs.label||"Date field",r=e.attrs.format;return(0,t.jsx)(w,{color:"amber",icon:(0,t.jsx)(s.CalendarDays,{className:"w-3 h-3 shrink-0"}),label:r?`${n} \xb7 ${r}`:n})}let I=n.Node.create({name:"dateFieldNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({label:{default:"Date field"},format:{default:"yyyy-MM-dd"},defaultValue:{default:""},start:{default:""},end:{default:""},cols:{default:""},trim:{default:"yes"},formatter:{default:""}}),parseHTML:()=>[{tag:'span[data-type="date-field-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"date-field-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(L),addCommands:()=>({insertDateFieldNode:e=>({commands:t})=>t.insertContent({type:"dateFieldNode",attrs:{label:"Date field",format:"yyyy-MM-dd",defaultValue:"",start:"",end:"",cols:"",trim:"yes",formatter:"",...e}})})});function z({node:e}){return(0,t.jsx)(w,{color:"violet",icon:(0,t.jsx)(l.Zap,{className:"w-3 h-3 shrink-0"}),label:`= ${e.attrs.expression||"formula"}`})}let $=n.Node.create({name:"formulaNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({expression:{default:""}}),parseHTML:()=>[{tag:'span[data-type="formula-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"formula-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(z),addCommands:()=>({insertFormulaNode:()=>({commands:e})=>e.insertContent({type:"formulaNode",attrs:{expression:""}})})});function H({node:e}){return(0,t.jsx)(w,{color:"indigo",icon:(0,t.jsx)(a.GitBranch,{className:"w-3 h-3 shrink-0"}),label:`if ${e.attrs.condition||"condition"}`})}let F=n.Node.create({name:"ifElseNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({condition:{default:""}}),parseHTML:()=>[{tag:'span[data-type="ifelse-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"ifelse-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(H),addCommands:()=>({insertIfElseNode:()=>({commands:e})=>e.insertContent({type:"ifElseNode",attrs:{condition:""}})})});function B({node:e}){return(0,t.jsx)(w,{color:"green",icon:(0,t.jsx)(d.Repeat2,{className:"w-3 h-3 shrink-0"}),label:`repeat ${e.attrs.count||"n"} times`})}let V=n.Node.create({name:"repeatNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({count:{default:"3"}}),parseHTML:()=>[{tag:'span[data-type="repeat-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"repeat-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(B),addCommands:()=>({insertRepeatNode:()=>({commands:e})=>e.insertContent({type:"repeatNode",attrs:{count:"3"}})})});function _({node:e}){return(0,t.jsx)(w,{color:"rose",icon:(0,t.jsx)(c.AlertCircle,{className:"w-3 h-3 shrink-0"}),label:e.attrs.message||"error"})}let W=n.Node.create({name:"errorNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({message:{default:"Error message"}}),parseHTML:()=>[{tag:'span[data-type="error-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"error-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(_),addCommands:()=>({insertErrorNode:()=>({commands:e})=>e.insertContent({type:"errorNode",attrs:{message:"Error message"}})})});
89function U({node:e}){return(0,t.jsx)(w,{color:"amber",icon:(0,t.jsx)(h.MousePointerClick,{className:"w-3 h-3 shrink-0"}),label:`click: ${e.attrs.selector||"element"}`})}let K=n.Node.create({name:"clickNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({selector:{default:"#element"}}),parseHTML:()=>[{tag:'span[data-type="click-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"click-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(U),addCommands:()=>({insertClickNode:()=>({commands:e})=>e.insertContent({type:"clickNode",attrs:{selector:"#element"}})})});function q({node:e}){return(0,t.jsx)(w,{color:"gray",icon:(0,t.jsx)(u.Keyboard,{className:"w-3 h-3 shrink-0"}),label:`key: ${e.attrs.key||"Enter"}`})}let J=n.Node.create({name:"keyPressNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({key:{default:"Enter"}}),parseHTML:()=>[{tag:'span[data-type="keypress-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"keypress-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(q),addCommands:()=>({insertKeyPressNode:()=>({commands:e})=>e.insertContent({type:"keyPressNode",attrs:{key:"Enter"}})})});function Y({node:e}){return(0,t.jsx)(w,{color:"gray",icon:(0,t.jsx)(p.Clock,{className:"w-3 h-3 shrink-0"}),label:`wait ${e.attrs.ms||"500"}ms`})}let X=n.Node.create({name:"waitNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({ms:{default:"500"}}),parseHTML:()=>[{tag:'span[data-type="wait-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"wait-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(Y),addCommands:()=>({insertWaitNode:()=>({commands:e})=>e.insertContent({type:"waitNode",attrs:{ms:"500"}})})});function G({node:e}){return(0,t.jsx)(w,{color:"slate",icon:(0,t.jsx)(m,{className:"w-3 h-3 shrink-0"}),label:e.attrs.text||"note"})}let Z=n.Node.create({name:"noteNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({text:{default:"Note"}}),parseHTML:()=>[{tag:'span[data-type="note-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"note-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(G),addCommands:()=>({insertNoteNode:()=>({commands:e})=>e.insertContent({type:"noteNode",attrs:{text:"Note"}})})});function Q(){return(0,t.jsx)(w,{color:"blue",icon:(0,t.jsx)(g.Globe,{className:"w-3 h-3 shrink-0"}),label:"website"})}let ee=n.Node.create({name:"websiteNode",group:"inline",inline:!0,atom:!0,draggable:!0,parseHTML:()=>[{tag:'span[data-type="website-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"website-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(Q),addCommands:()=>({insertWebsiteNode:()=>({commands:e})=>e.insertContent({type:"websiteNode"})})});function et({node:e}){return(0,t.jsx)(w,{color:"teal",icon:(0,t.jsx)(y,{className:"w-3 h-3 shrink-0"}),label:`import: ${e.attrs.shortcut||"=snippet"}`})}let en=n.Node.create({name:"importNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({shortcut:{default:"=snippet"}}),parseHTML:()=>[{tag:'span[data-type="import-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"import-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(et),addCommands:()=>({insertImportNode:()=>({commands:e})=>e.insertContent({type:"importNode",attrs:{shortcut:"=snippet"}})})});function er({node:e}){return(0,t.jsx)(w,{color:"blue",icon:(0,t.jsx)(x,{className:"w-3 h-3 shrink-0"}),label:`drag: ${e.attrs.from} to ${e.attrs.to}`})}let ei=n.Node.create({name:"dragDropNode",group:"inline",inline:!0,atom:!0,draggable:!0,addAttributes:()=>({from:{default:".source"},to:{default:".target"}}),parseHTML:()=>[{tag:'span[data-type="dragdrop-node"]'}],renderHTML:({HTMLAttributes:e})=>["span",(0,n.mergeAttributes)(e,{"data-type":"dragdrop-node"})],addNodeView:()=>(0,r.ReactNodeViewRenderer)(er),addCommands:()=>({insertDragDropNode:()=>({commands:e})=>e.insertContent({type:"dragDropNode",attrs:{from:".source",to:".target"}})})});e.s(["ALL_SNIPPET_EXTENSIONS",0,[k,N,M,T,E,D,P,I,$,F,V,W,K,J,X,Z,ee,en,ei]],9252)},49036,71068,53245,e=>{"use strict";var t=e.i(43476),n=e.i(16715),r=e.i(71645),i=e.i(94499),o=e.i(68341),s=e.i(7952),l=e.i(57688);let a={src:e.i(68916).default,width:20,height:20,blurWidth:0,blurHeight:0},d={src:e.i(60270).default,width:20,height:20,blurWidth:0,blurHeight:0},c={src:e.i(85922).default,width:20,height:20,blurWidth:0,blurHeight:0},h={src:e.i(70605).default,width:20,height:20,blurWidth:0,blurHeight:0},u={src:e.i(43642).default,width:20,height:20,blurWidth:0,blurHeight:0},p={src:e.i(80790).default,width:20,height:20,blurWidth:0,blurHeight:0},f={src:e.i(71669).default,width:20,height:20,blurWidth:0,blurHeight:0},m={src:e.i(17551).default,width:20,height:20,blurWidth:0,blurHeight:0},g={src:e.i(85342).default,width:20,height:20,blurWidth:0,blurHeight:0},y={src:e.i(63658).default,width:20,height:20,blurWidth:0,blurHeight:0};function x({onClick:e,active:n,title:r,children:i}){return(0,t.jsx)("button",{type:"button",title:r,onClick:e,className:`w-10 h-10 rounded-xl transition-colors flex items-center justify-center ${n?"bg-off-white":"hover:bg-off-white"}`,children:i})}function b({editor:e}){let[n,i]=(0,r.useState)(!1),[o,s]=(0,r.useState)(""),w=(0,r.useRef)(null),v=()=>
89{if(e){if(o.trim()){let t=o.startsWith("http")?o:`https://${o}`;e.chain().focus().setLink({href:t}).run()}else e.chain().focus().unsetLink().run();i(!1)}};return(0,r.useEffect)(()=>{if(!n)return;let e=e=>{w.current?.contains(e.target)||i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]),(0,t.jsxs)("div",{className:"flex items-center gap-0.5 px-1 py-1",children:[(0,t.jsx)(x,{title:"Bold",active:e?.isActive("bold"),onClick:()=>e?.chain().focus().toggleBold().run(),children:(0,t.jsx)(l.default,{src:a,alt:"Bold",width:20,height:20})}),(0,t.jsx)(x,{title:"Italic",active:e?.isActive("italic"),onClick:()=>e?.chain().focus().toggleItalic().run(),children:(0,t.jsx)(l.default,{src:d,alt:"Italic",width:20,height:20})}),(0,t.jsx)(x,{title:"Underline",active:e?.isActive("underline"),onClick:()=>e?.chain().focus().toggleUnderline().run(),children:(0,t.jsx)(l.default,{src:c,alt:"Underline",width:20,height:20})}),(0,t.jsx)(x,{title:"Align left",active:e?.isActive({textAlign:"left"}),onClick:()=>e?.chain().focus().setTextAlign("left").run(),children:(0,t.jsx)(l.default,{src:h,alt:"Align left",width:20,height:20})}),(0,t.jsx)(x,{title:"Align center",active:e?.isActive({textAlign:"center"}),onClick:()=>e?.chain().focus().setTextAlign("center").run(),children:(0,t.jsx)(l.default,{src:u,alt:"Align center",width:20,height:20})}),(0,t.jsx)(x,{title:"Align right",active:e?.isActive({textAlign:"right"}),onClick:()=>e?.chain().focus().setTextAlign("right").run(),children:(0,t.jsx)(l.default,{src:p,alt:"Align right",width:20,height:20})}),(0,t.jsx)(x,{title:"Justify",active:e?.isActive({textAlign:"justify"}),onClick:()=>e?.chain().focus().setTextAlign("justify").run(),children:(0,t.jsx)(l.default,{src:f,alt:"Justify",width:20,height:20})}),(0,t.jsx)(x,{title:"Ordered list",active:e?.isActive("orderedList"),onClick:()=>e?.chain().focus().toggleOrderedList().run(),children:(0,t.jsx)(l.default,{src:m,alt:"Ordered list",width:20,height:20})}),(0,t.jsx)(x,{title:"Bullet list",active:e?.isActive("bulletList"),onClick:()=>e?.chain().focus().toggleBulletList().run(),children:(0,t.jsx)(l.default,{src:g,alt:"Bullet list",width:20,height:20})}),(0,t.jsxs)("div",{className:"relative",ref:w,children:[(0,t.jsx)(x,{title:"Insert link",active:e?.isActive("link")||n,onClick:()=>{s(e?.getAttributes("link").href??""),i(!0)},children:(0,t.jsx)(l.default,{src:y,alt:"Insert link",width:20,height:20})}),n&&(0,t.jsxs)("div",{className:"absolute right-0 top-full mt-1.5 z-50 bg-white border border-gray-200 rounded-xl shadow-lg px-3 py-2 flex items-center gap-2 min-w-64",children:[(0,t.jsx)("input",{type:"url",value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{"Enter"===e.key&&v(),"Escape"===e.key&&i(!1)},placeholder:"https://",autoFocus:!0,className:"flex-1 text-xs border border-violet-400 rounded-lg px-2 py-1 h-7 focus:outline-none focus:ring-1 focus:ring-violet-400 min-w-0"}),(0,t.jsx)("button",{type:"button",onClick:v,className:"text-xs text-violet-600 font-semibold hover:text-violet-700 shrink-0",children:"Save"}),e?.isActive("link")&&(0,t.jsx)("button",{type:"button",onClick:()=>{e.chain().focus().unsetLink().run(),i(!1)},className:"text-xs text-red-400 hover:text-red-600 shrink-0",children:"Remove"})]})]})]})}var w=e.i(56564),v=e.i(3015),k=e.i(73828),C=e.i(9475);e.s(["AddTextContentModal",0,function({isOpen:e,onClose:a,isLink:d,isEditMode:c=!1,title:h,onTitleChange:u,content:p,onContentChange:f,onSubmit:m,isLoading:g}){let[y,x]=(0,r.useState)(null),[N,S]=(0,r.useState)(!1),[M,j]=(0,r.useState)(!1),[T,A]=(0,r.useState)(!1),[E,R]=(0,r.useState)(!0),[D,O]=(0,r.useState)(h),[P,L]=(0,r.useState)(p),[I,z]=(0,r.useState)(null),[$,H]=(0,r.useState)(null),F=(0,r.useRef)(""),B=(0,r.useRef)(f),V=(0,r.useRef)(m),_=(0,r.useRef)(p);(0,r.useEffect)(()=>{B.current=f,V.current=m},[f,m]);let W=d?w.addLinkContentSchema:w.addTextContentSchema,U=(0,r.useCallback)((e,t)=>{let n=W.shape[e].safeParse(t);return n.success?null:n.error.errors[0]?.message??null},[W]),K=(0,o.useTextNoteEditor)({content:d?"":p,isLink:d,onUpdate:e=>{_.current=e},onIsEmptyChange:R});(0,r.useEffect)(()=>{e||!K||K.isDestroyed||K.destroy()},[e,K]),(0,r.useEffect)(()=>
89{if(!K||K.isDestroyed)return;let e=()=>{let e=K.getHTML();_.current=e,L(e),R(K.isEmpty),B.current(e),H(U("content",e))};return K.on("blur",e),()=>{K.off("blur",e)}},[K,d,U]);let q=(0,r.useCallback)(async e=>{let t=(0,v.cleanString)(e);if(F.current=t,!t||!t.startsWith("http")){F.current===t&&(x(null),S(!1));return}S(!0);try{let e=await fetch(`/api/link-preview?url=${encodeURIComponent(t)}`);if(F.current!==t)return;if(e.ok){let n=await e.json(),r={title:(0,v.cleanString)(n.title||""),description:(0,v.cleanString)(n.description||""),image:(0,v.cleanString)(n.image||""),siteName:(0,v.cleanString)(n.siteName||"")};if(F.current!==t)return;x(r),!M&&r.title&&(P||(L(t),B.current(t)),O(r.title),z(null),u(r.title))}else x(null)}catch{F.current===t&&x(null)}finally{F.current===t&&S(!1)}},[M,u,P]),J=(0,r.useRef)(q);(0,r.useEffect)(()=>{J.current=q},[q]);let Y=(0,r.useRef)(null);(0,r.useEffect)(()=>{let e,t;null==Y.current&&(e=null,(t=(...t)=>{e&&clearTimeout(e),e=setTimeout(()=>(e=>{J.current(e)})(...t),500)}).cancel=()=>{e&&(clearTimeout(e),e=null)},Y.current=t)},[]);let X=(0,r.useCallback)(e=>{Y.current&&Y.current(e)},[]),G=(0,r.useRef)(""),Z=(0,r.useRef)(""),Q=(0,r.useRef)(!1);(0,r.useEffect)(()=>{let t=Q.current;if(Q.current=e,!e){t&&(x(null),j(!1),A(!1),z(null),H(null),Y.current&&Y.current.cancel(),F.current="",G.current="",Z.current="");return}if(t)return;G.current=h,Z.current=p;let n=(0,v.cleanString)(G.current),r=(0,v.cleanString)(Z.current);O(n),L(r),_.current=r,!d&&K&&R(K.isEmpty),A(!0),d&&r?queueMicrotask(()=>J.current(r)):(F.current=r,x(null))},[e,d,h,p,K]);let ee=(0,r.useRef)(p);(0,r.useEffect)(()=>{if(!d&&K&&!K.isDestroyed&&p!==ee.current){ee.current=p;try{K.getHTML()!==p&&p&&K.commands.setContent(p)}catch{}}},[p,K,d]);let et=(0,r.useCallback)(()=>{if(!d&&K&&!K.isDestroyed)try{return K.view.dom.innerHTML}catch{}return _.current||P},[K,d,P]),en=(0,r.useCallback)(()=>{if(!d&&K&&!K.isDestroyed)try{let e=K.view.dom.textContent||"";return 0===e.trim().length}catch{}return E},[K,d,E]),er=d?c?"Edit Link":"Add Link":c?"Edit Text Note":"Add Text Note",ei=D.trim().length>0&&(d?P.trim().length>0:!en()),eo=g?c?"Saving":"Adding":c?"Save":"Done";return(0,t.jsx)(s.CenterModal,{open:e,onClose:a,className:"max-w-150! rounded-4xl shadow-modal!",children:(0,t.jsxs)("div",{className:"flex flex-col max-h-[85vh] p-8 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-4 shrink-0 border-b border-gray-200",children:[(0,t.jsx)("h2",{className:"text-2xl font-sans text-neutral-dark font-bold",children:er}),(0,t.jsx)("button",{type:"button",onClick:a,className:"p-1 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors",children:(0,t.jsx)(l.default,{src:k.default,alt:"Close",width:32,height:32})})]}),T?(0,t.jsxs)("div",{className:"flex flex-col min-h-0 flex-1",children:[(0,t.jsxs)("div",{className:"py-4 overflow-y-auto overflow-x-hidden flex-1 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Text Title"}),(0,t.jsx)("input",{type:"text",placeholder:"e.g. Demo Booking Link",value:D,onBlur:()=>{z(U("title",D))},onChange:e=>{let t=e.target.value;j(!0),O(t),u(t),I&&t.trim().length>0&&z(null)},className:`w-full px-4 py-3 rounded-2xl border text-base font-medium placeholder:text-base placeholder:text-gray-500 transition-all text-neutral-dark focus:outline-none ${I?"border-sb-red focus:border-sb-red focus:ring-2 focus:ring-sb-red/20 ":"border-gray-200 focus:border-primary focus:ring-2 focus:ring-primary/20"}`,autoFocus:!0}),I?(0,t.jsxs)("div",{className:"flex items-center mt-2.5 gap-1.5 text-sb-red bg-red-50 px-2.5 py-1.5 rounded-lg text-xs font-semibold border border-red-100",children:[(0,t.jsx)("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,t.jsx)("span",{children:I})]}):(0,t.jsxs)("p",{className:"text-sm font-medium text-gray-400 mt-2.5",children:["This title will appear on the"," ",d?"link":"text note"," card."]})]}),d?(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Link URL"}),(0,t.jsx)("input",{type:"text",placeholder:"e.g. https://cal.com/swiftboard/demo",value:P,onBlur:()=>{H(U("content",P))},onChange:e=>{let t=e.target.value;L(t),f(t),X(t),$&&t.trim().length>0&&H(null)},className:`w-full px-4 py-3 rounded-2xl border text-base font-medium placeholder:text-base placeholder:text-gray-500 transition-all text-neutral-dark focus:outline-none ${$?"border-sb-red focus:border-sb-red focus:ring-2 focus:ring-sb-red/20 ":"border-gray-200 focus:border-primary focus:ring-2 focus:ring-primary/20"}`}),$?(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-sb-red bg-red-50 px-2.5 py-1.5 rounded-lg text-xs font-semibold border border-red-100",children:[(0,t.jsx)("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,t.jsx)("span",{children:$})]}):(0,t.jsx)("p",{className:"text-sm font-medium text-gray-400 mt-1",children:"Paste the link you want to save."})]}):(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("div",{className:`rounded-2xl border-2 transition-colors ${$?"border-red-300":"border-gray-200"}`,children:(0,t.jsxs)("div",{className:"rounded-2xl overflow-hidden bg-off-white",children:[(0,t.jsx)("div",{className:"mx-2 mt-2 mb-1 bg-white rounded-2xl",children:K&&(0,t.jsx)(b,{editor:K})}),(0,t.jsxs)("div",{className:"relative min-w-0",children:[en()&&(0,t.jsx)("div",{className:"absolute top-3 left-4 pointer-events-none text-base font-medium text-gray-500 z-10",children:"Write your note, caption, reply, or instructions here..."}),(0,t.jsx)(i.EditorContent,{editor:K,className:"[&_.tiptap]:outline-none [&_.tiptap]:min-h-60 [&_.tiptap]:max-w-full [&_.tiptap]:px-4 [&_.tiptap]:py-3 [&_.tiptap]:text-sm [&_.tiptap]:text-gray-600 [&_.tiptap]:wrap-break-word [&_.tiptap]:overflow-wrap-anywhere [&_.tiptap_p]:mb-2 [&_.tiptap_p]:leading-relaxed [&_.tiptap_strong]:font-bold [&_.tiptap_b]:font-bold [&_.tiptap_em]:italic [&_.tiptap_i]:italic [&_.tiptap_u]:underline [&_.tiptap_a]:text-violet-600 [&_.tiptap_a]:underline [&_.tiptap_ul]:list-disc [&_.tiptap_ul]:pl-5 [&_.tiptap_ol]:list-decimal [&_.tiptap_ol]:pl-5 [&_.tiptap_li]:mb-1"})]})]})}),$&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-sb-red bg-red-50 px-2.5 py-1.5 rounded-lg text-xs font-semibold border border-red-100",children:[(0,t.jsx)("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,t.jsx)("span",{children:$})]})]}),d&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark",children:"Link Preview"}),P&&(0,t.jsxs)("button",{type:"button",onClick:()=>
89{if(P.trim()){let e=Y.current;e&&e.cancel(),J.current(P.trim())}},className:"flex items-center gap-1.5 text-sm font-bold text-primary hover:text-primary/80 transition-colors",children:[(0,t.jsx)(n.RefreshCw,{className:"w-4 h-4"}),"Refresh Preview"]})]}),N?(0,t.jsxs)("div",{className:" bg-gray-50 p-2.5 bg-off-white rounded-3xl flex items-center gap-2.5",children:[(0,t.jsx)("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"}),(0,t.jsx)("span",{className:"text-sm text-gray-500",children:"Fetching preview..."})]}):y?.image||y?.siteName||y?.description||y?.title?(0,t.jsxs)("div",{className:"flex gap-3 p-2.5 bg-off-white rounded-3xl ",children:[y.image&&(0,t.jsx)("div",{className:"w-40 h-25 shrink-0 bg-gray-200 rounded-2xl overflow-hidden",children:(0,t.jsx)("img",{src:y.image,alt:y.title||"Link preview",className:"w-full h-full object-cover"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 py-0.5",children:[y.siteName&&(0,t.jsx)("p",{className:"text-xs text-gray-400 mb-0.5",children:y.siteName}),y.title&&(0,t.jsx)("p",{className:"text-xl font-semibold text-neutral-dark leading-snug",children:y.title}),y.description&&(0,t.jsx)("p",{className:"text-base text-gray-500 font-medium line-clamp-2 leading-relaxed mt-0.5",children:y.description})]})]}):(0,t.jsxs)("div",{className:"flex items-center gap-3 p-2.5 bg-off-white rounded-3xl ",children:[(0,t.jsx)("div",{className:"flex h-20 w-17.5 shrink-0 items-center justify-center rounded-xl ",children:(0,t.jsx)(l.default,{src:C.default,alt:"",width:80,height:70,className:" h-20 w-17.5","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-xl font-semibold text-neutral-dark leading-snug",children:D||"Link Preview"}),(0,t.jsx)("p",{className:"text-base text-gray-500 font-medium line-clamp-2 leading-relaxed mt-0.5",children:P||"Enter a URL to see preview"})]})]})]})]}),(0,t.jsxs)("div",{className:"shrink-0",children:[(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-4",children:[(0,t.jsx)("button",{type:"button",onClick:a,className:"px-6 py-3 rounded-xl text-lg font-sans font-semibold transition-colors bg-off-white shadow-subtle text-gray-600",children:"Cancel"}),(0,t.jsxs)("button",{type:"button",onClick:()=>{let e=et(),t=W.safeParse({title:D,content:e});if(!t.success){let e=t.error.flatten().fieldErrors;e.title?.[0]&&z(e.title[0]),e.content?.[0]&&H(e.content[0]);return}z(null),H(null),V.current(t.data)},disabled:!ei||g,className:(0,v.cn)("px-6 py-3 rounded-xl text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2",(!ei||g)&&"opacity-50"),children:[g&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),eo]})]})]})]}):(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center p-8",children:(0,t.jsx)("div",{className:"w-6 h-6 border-2 border-violet-500 border-t-transparent rounded-full animate-spin"})})]})})}],49036);var N=e.i(31278);let S={src:e.i(22538).default,width:104,height:100,blurWidth:0,blurHeight:0};e.s(["ConfirmActionModal",0,function({open:e,onClose:n,onConfirm:r,isLoading:i=!1,itemName:o,itemType:a="board",actionType:d="trash",title:c,message:h,confirmButtonText:u,cancelButtonText:p="Cancel"}){let f=o&&""!==o.trim()&&"Untitled"!==o&&"Untitled board"!==o&&"Untitled page"!==o,m=()=>{switch(a){case"folder":return"folder";case"content":return"item";case"page":return"page";case"snippet":return"snippet";default:return"board"}},g=(()=>{if(c)return c;let e=m(),t=f?` "${o}"`:"";return"trash"===d?`Move${t} To Trash?`:`Delete ${e}${t}?`})(),y=(()=>{if(h)return h;let e=m(),t=f?` "${o}"`:" this";return"trash"===d?`This ${e} will be moved to Trash. You can restore it later if needed.`:"folder"===a?`Are you sure you want to delete${t}? This action cannot be undone.`:"snippet"===a?`This will permanently delete${t}. This cannot be undone.`:`Are you sure you want to delete${t}? This action cannot be undone.`})();return(0,t.jsx)(s.CenterModal,{open:e,onClose:i?()=>{}:n,className:"shadow-modal max-w-150 rounded-4xl max-h-[85vh]",disableBackgroun
89dClick:i,children:(0,t.jsxs)("div",{className:"relative w-full rounded-3xl bg-white p-8 max-h-[85vh] overflow-y-auto overflow-x-hidden custom-scrollbar min-w-0",children:[(0,t.jsx)("button",{type:"button",onClick:n,disabled:i,className:"absolute right-8 top-8 inline-flex h-9 w-9 items-center justify-center rounded-xl text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 disabled:opacity-50 z-10 shrink-0","aria-label":"Close",children:(0,t.jsx)(l.default,{src:k.default,alt:"Close",width:32,height:32})}),(0,t.jsxs)("div",{className:"mx-auto flex w-full max-w-md flex-col items-center text-center min-w-0 px-2",children:[(0,t.jsx)("div",{className:"mb-6 flex h-25 w-26 shrink-0 items-center justify-center",children:(0,t.jsx)(l.default,{src:S,alt:"trash"===d?"Move to Trash":"Delete",width:104,height:100,className:"h-full w-full object-contain",priority:!0})}),(0,t.jsx)("h2",{className:"mb-1 w-full text-32 font-bold text-neutral-dark leading-tight break-words [overflow-wrap:anywhere]",children:g}),(0,t.jsx)("p",{className:"w-full text-lg font-semibold text-slate-500 leading-relaxed break-words [overflow-wrap:anywhere]",children:y})]}),(0,t.jsxs)("div",{className:"mt-10 flex items-center gap-4 max-w-sm mx-auto mb-6",children:[(0,t.jsx)("button",{type:"button",onClick:n,disabled:i,className:"flex-1 px-6 py-3 rounded-2xl text-lg font-semibold shadow-subtle transition-all bg-gray-300 text-gray-600 hover:bg-gray-200 disabled:opacity-50 min-w-0",children:p}),(0,t.jsxs)("button",{type:"button",onClick:r,disabled:i,className:"flex-1 px-6 py-3 bg-sb-red text-white rounded-2xl text-lg font-semibold hover:bg-sb-red/90 transition-all disabled:opacity-50 shadow-subtle flex items-center justify-center gap-2 min-w-0",children:[i&&(0,t.jsx)(N.Loader2,{size:18,className:"animate-spin shrink-0"}),u||("trash"===d?"Move To Trash":"Delete")]})]})]})})}],71068);let M=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select();try{return document.execCommand("copy"),document.body.removeChild(t),!0}catch{return document.body.removeChild(t),!1}}},j=()=>!("u"<typeof navigator)&&/android|iphone|ipad|ipod/i.test(navigator.userAgent),T=async({url:e})=>{if(j())return window.location.href="instagram://app",{copied:!1};let t=await M(e);return window.open("https://www.instagram.com/","_blank","noopener,noreferrer"),{copied:t}},A=async({url:e})=>{if(j())return window.location.href=`fb-messenger://share?link=${encodeURIComponent(e)}`,{copied:!1};let t=await M(e);return window.open("https://www.messenger.com/","_blank","noopener,noreferrer"),{copied:t}};e.s(["copyToClipboard",0,M,"shareToGmail",0,({url:e,title:t})=>{let n=encodeURIComponent(`Check out: ${t}`),r=encodeURIComponent(`I wanted to share this with you: 90 91${t} 92${e}`),i=`https://mail.google.com/mail/?view=cm&fs=1&su=${n}&body=${r}`;window.open(i,"_blank","noopener,noreferrer")},"shareToInstagram",0,T,"shareToLinkedIn",0,({url:e,title:t})=>{let n=`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(e)}&title=${encodeURIComponent(t)}`;window.open(n,"_blank","width=550,height=420")},"shareToMessenger",0,A,"shareToWhatsApp",0,({url:e,title:t})=>{let n=encodeURIComponent(`${t} 93${e}`),r=`https://wa.me/?text=${n}`;window.open(r,"_blank")}],53245)},7659,e=>{"use strict";var t=e.i(43476),n=e.i(7952),r=e.i(73828),i=e.i(57688);e.s(["ConfirmModal",0,function({open:e,icon:o,iconBg:s="bg-violet-50",iconColor:l="text-primary",title:a="Are you sure?",message:d,children:c,onNo:h,onYes:u,yesLoading:p,noText:f="Cancel",yesText:m="Confirm",danger:g=!1,disableBackgroundClick:y=!1}){return(0,t.jsx)(n.CenterModal,{open:e,onClose:h,disableBackgroundClick:y,className:"max-w-120!",children:(0,t.jsxs)("div",{className:"relative w-full rounded-3xl bg-white p-8 shadow-modal",children:[(0,t.jsx)("button",{type:"button",onClick:h,className:"absolute right-5 top-5 inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100","aria-label":"Close confirmation modal",children:(0,t.jsx)(i.default,{src:r.default,alt:"Close",width:28,height:28})}),(0,t.jsxs)("div",{className:"mx-auto flex max-w-105 flex-col items-center text-center mb-8",children:[(0,t.jsx)("div",{className:`mb-2 flex h-16 w-16 items-center justify-center rounded-3xl ${s} ${l} shadow-subtle`,children:o}),(0,t.jsx)("h2",{className:"text-32 font-bold text-neutral-dark leading-10",children:a}),d&&(0,t.jsx)("p",{className:"mt-1 text-base font-semibold text-slate-500 max-w-md",children:d})]}),c&&(0,t.jsx)("div",{className:"bg-off-white p-5 rounded-3xl mb-6",children:c}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-2",children:[(0,t.jsx)("button",{type:"button",onClick:h,disabled:p,className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-white shadow-subtle text-gray-600 hover:bg-gray-50 border border-gray-100 disabled:opacity-50",children:f}),(0,t.jsxs)("button",{type:"button",onClick:u,disabled:p,className:`px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-all flex items-center gap-2 disabled:opacity-50 shadow-subtle ${g?"bg-sb-red text-white hover:bg-red-700":"bg-primary text-white hover:opacity-90"}`,children:[p&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),m]})]})]})})}])},85863,10460,68532,334,34422,67242,e=>{"use strict";var t=e.i(43476),n=e.i(71645);e.i(73176);var r=e.i(3015),i=e.i(7952);e.i(96992),e.s([],85863);var o=e.i(57688),s=e.i(73828),l=e.i(41452),a=e.i(56564),d=e.i(17163),c=e.i(12056),h=e.i(16052),u=e.i(74227),p=e.i(8213);let f={src:e.i(24126).default,width:80,height:70,blurWidth:0,blurHeight:0};e.s(["default",0,f],10460);let m={pdf:d.default,excel:c.default,word:h.default,powerpoint:u.default,onenote:p.default};function g({isOpen:e,label:t,accept:i,fileType:o,isLoading:s,onUpload:d}
93){let[c,h]=(0,n.useState)(null),[u,p]=(0,n.useState)(null),[y,x]=(0,n.useState)(null),[b,w]=(0,n.useState)(null),[v,k]=(0,n.useState)(!1),C=(0,n.useRef)(null),N=(0,n.useRef)(0),S=o===r.FILE_TYPES.IMAGE,M=(0,l.useForm)({defaultValues:{title:""},validators:{onBlur:a.uploadContentSchema,onSubmit:a.uploadContentSchema,onChange:a.uploadContentSchema},onSubmit:async({value:e})=>{c&&!b&&d(e.title,c,u)}}),j=(0,n.useCallback)(e=>{if(u&&!u.startsWith("data:")&&"doc"!==u&&URL.revokeObjectURL(u),e){if(e.name.toLowerCase().endsWith(".zip")||"application/zip"===e.type||"application/x-zip-compressed"===e.type){w("ZIP files are not allowed. Please upload the individual files instead."),h(null),p(null);return}if(o===r.FILE_TYPES.VIDEO&&(e.name.toLowerCase().endsWith(".webm")||e.type.toLowerCase().includes("video/webm"))){w("WebM video format is not allowed. Please upload a different video format (MP4, MOV, AVI, etc.)."),h(null),p(null);return}if(o===r.FILE_TYPES.IMAGE){let t=(0,r.validateImageFile)(e);if(!t.valid){w(t.message??"Invalid image file"),h(null),p(null);return}}}if(x(null),w(e?null:"Please select a file to upload"),h(e),e&&""===M.state.values.title.trim()){let t=e.name.replace(/\.[^/.]+$/,"");M.setFieldValue("title",t),M.setFieldMeta("title",e=>({...e,touched:!0,dirty:!0})),M.validateField("title","change")}e?e.type.startsWith("image/")||e.type.startsWith("video/")||e.type.startsWith("audio/")||"application/pdf"===e.type?p(URL.createObjectURL(e)):i.includes("doc")||i.includes("pdf")?p("doc"):p(null):p(null)},[u,o,i,M]),T=(0,n.useCallback)(()=>{u&&!u.startsWith("data:")&&"doc"!==u&&URL.revokeObjectURL(u),h(null),p(null),w("Please select a file to upload"),C.current&&(C.current.value="")},[u]),A=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),s||Array.from(e.dataTransfer.types).includes("Files")&&(N.current+=1,k(!0))},[s]),E=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),s||(e.dataTransfer.dropEffect="copy")},[s]),R=(0,n.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),N.current=Math.max(0,N.current-1),0===N.current&&k(!1)},[]),D=(0,n.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),N.current=0,k(!1),s)return;let t=e.dataTransfer.files?.[0]??null;t&&j(t)},[s,j]);(0,n.useEffect)(()=>{e?setTimeout(()=>w("Please select a file to upload"),0):(u&&!u.startsWith("data:")&&"doc"!==u&&URL.revokeObjectURL(u),N.current=0,setTimeout(()=>{h(null),p(null),x(null),w(null),k(!1)},0),M.reset(),C.current&&(C.current.value=""))},[e]);let O=c?(0,r.getFileCategory)(c.name):null,P=O?m[O]||f:null,L=S?"e.g. Website Hero Screenshot":`Enter ${t.toLowerCase()} title`,I=`This title will appear on the ${S?"image":t.toLowerCase()} card.`;return{form:M,fileInputRef:C,selectedFile:c,filePreview:u,localError:y,fileError:b,isImage:S,label:t,selectedFileIcon:P,titlePlaceholder:L,titleHelperText:I,handleFileSelect:j,handleRemoveFile:T,isDragging:v,dropHandlers:{onDragEnter:A,onDragOver:E,onDragLeave:R,onDrop:D},setFileError:w,setLocalError:x,formatFileSize:r.formatFileSize}}function y({form:e,label:n,isImage:r,placeholder:i,helperText:o,isLoading:s}){return(0,t.jsx)(e.Field,{name:"title",children:e=>{let l=!(e.state.value.trim().length>0)&&e.state.meta.errors&&e.state.meta.errors.length>0,a=e.state.meta.errors?.[0]?.message;return(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:r?"Image Title":`${n} Title`}),(0,t.jsx)("input",{type:"text",placeholder:i,value:e.state.value,onBlur:e.handleBlur,onChange:t=>e.handleChange(t.target.value),disabled:s,className:`w-full px-4 py-3 rounded-2xl border text-base font-medium placeholder:text-base placeholder:text-gray-500 transition-all text-neutral-dark focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed ${l?"border-sb-red focus:border-sb-red focus:ring-2 focus:ring-sb-red/20":"border-gray-200 focus:border-primary focus:ring-2 focus:ring-primary/20"}`,autoFocus:!0}),l&&a?(0,t.jsxs)("div",{className:"flex items-center mt-2.5 gap-1.5 text-sb-red bg-red-50 px-2.5 py-1.5 rounded-lg text-xs font-semibold border border-red-100",children:[(0,t.jsx)("svg",{className:"w-3.5 h-3.5 shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),(0,t.jsx)("span",{children:a})]}):(0,t.jsx)("p",{className:"text-sm font-medium text-gray-400 mt-2.5",children:o})]})}})}var x=e.i(97889),b=e.i(63209),w=e.i(31825);let v={src:e.i(8004).default,width:60,height:60,blurWidth:0,blurHeight:0};function k({selectedFile:e,filePreview:n,isLoading:r,progress:i,error:s,localError:l,fileError:a,selectedFileIcon:c,onRemove:h}){return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 p-5 bg-off-white rounded-3xl",children:[(0,t.jsx)("div",{className:`shrink-0 rounded-2xl overflow-hidden ${e.type.startsWith("image/")?"w-40 h-25 bg-off-white":"w-25 h-25 bg-white"}`,children:n&&e.type.startsWith("image/")?(0,t.jsx)("img",{src:n,alt:"Preview",className:"w-full h-full object-cover"}):n&&e.type.startsWith("video/")?(0,t.jsx)("div",{className:"w-full h-full bg-black flex items-center justify-center",children:(0,t.jsx)(x.default,{src:n,width:"100%",height:"100%",playsInl
93ine:!0,muted:!0})}):n&&e.type.startsWith("audio/")?(0,t.jsx)("div",{className:"w-full h-full bg-lavender rounded-2xl shadow-subtle flex items-center justify-center",children:(0,t.jsx)(o.default,{src:v,alt:"",width:60,height:60,className:"h-15 w-15","aria-hidden":"true"})}):n&&"application/pdf"===e.type&&"doc"!==n?(0,t.jsx)("div",{className:"w-full h-full bg-white flex items-center justify-center",children:(0,t.jsx)(o.default,{src:d.default,alt:"",width:56,height:56,className:"h-14 w-14","aria-hidden":"true"})}):(0,t.jsx)("div",{className:"w-full h-full bg-white flex items-center justify-center",children:c&&(0,t.jsx)(o.default,{src:c,alt:"",width:56,height:56,className:"h-14 w-14","aria-hidden":"true"})})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"text-lg font-semibold text-neutral-dark truncate",children:e.name}),(0,t.jsxs)("p",{className:"text-base capitalize text-gray-500 font-medium mt-0.5",children:[e.name.split(".").pop()?.toUpperCase()," ·"," ",function(e){if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(1))+" "+["B","KB","MB","GB"][t]}(e.size)]}),r&&i>0&&i<1&&(0,t.jsx)("div",{className:"h-1.5 w-full bg-white rounded-full overflow-hidden mt-2",children:(0,t.jsx)("div",{className:"h-full bg-primary-light rounded-full transition-all duration-300 ease-out",style:{width:`${100*i}%`}})})]}),(0,t.jsx)("div",{className:"shrink-0",children:!r&&(0,t.jsx)("button",{type:"button",onClick:h,className:"transition-opacity hover:opacity-70",children:(0,t.jsx)(o.default,{src:w.default,alt:"Remove",width:24,height:24})})})]}),(s||l||a)&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-sb-red bg-red-50 px-2.5 py-1.5 rounded-lg text-xs font-semibold border border-red-100",children:[(0,t.jsx)(b.AlertCircle,{className:"w-3.5 h-3.5 shrink-0"}),(0,t.jsx)("span",{children:a||l||s})]})]})}function C({form:e,isLoading:n,selectedFile:r,fileError:i,onCancel:o,onUpload:s,filePreview:l}){return(0,t.jsxs)("div",{className:"shrink-0",children:[(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-4",children:[(0,t.jsx)("button",{type:"button",onClick:o,className:"px-6 py-3 rounded-xl text-lg font-sans font-semibold transition-colors bg-off-white shadow-subtle text-gray-600",children:"Cancel"}),(0,t.jsx)(e.Subscribe,{selector:e=>e.values.title,children:e=>{let o=e.trim().length>0&&null!==r&&!i;return(0,t.jsxs)("button",{type:"button",onClick:()=>{o&&!n&&s(e,r,l)},disabled:!o||n,className:`px-6 py-3 rounded-xl text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2 ${(!o||n)&&"opacity-50"}`,children:[n&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n?"Uploading":"Done"]})}})]})]})}let N={src:e.i(96040).default,width:80,height:70,blurWidth:0,blurHeight:0};function S({isOpen:e,label:n,accept:r,fileType:i,isLoading:s,progress:l,error:a,onUpload:d,onClose:c}){let{form:h,fileInputRef:u,selectedFile:p,filePreview:f,localError:m,fileError:x,isImage:b,selectedFileIcon:w,titlePlaceholder:v,titleHelperText:M,handleFileSelect:j,handleRemoveFile:T,isDragging:A,dropHandlers:E,setFileError:R}=g({isOpen:e,label:n,accept:r,fileType:i,isLoading:s,onUpload:d});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:u,type:"file",accept:r,onChange:e=>{j(e.target.files?.[0]??null)},className:"hidden"}),(0,t.jsxs)("div",{...E,className:"py-4 overflow-y-auto flex-1 space-y-5",children:[(0,t.jsx)(y,{form:h,label:n,isImage:b,placeholder:v,helperText:M,isLoading:s}),p?(0,t.jsx)(k,{selectedFile:p,filePreview:f,isLoading:s,progress:l,error:a,localError:m,fileError:x,selectedFileIcon:w,onRemove:T}):(0,t.jsxs)("button",{type:"button",onClick:()=>u.current?.click(),className:`relative w-full min-h-30 flex items-center gap-4 p-5 rounded-3xl border border-dashed transition-all duration-200 group ${A?"border-primary bg-primary/10":"border-gray-200 bg-off-white hover:border-primary/40 hover:bg-primary/5"}`,children:[(0,t.jsx)("div",{className:"flex h-17.5 w-20 shrink-0",children:(0,t.jsx)(o.default,{src:N,alt:"",width:80,height:70,className:"h-17.5 w-20","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"text-left min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-lg font-semibold text-neutral-dark",children:["Drop your image here"," ",(0,t.jsx)("span",{className:"text-primary",children:"or browse"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-400 font-medium mt
93-0.5",children:"Upload a screenshot, photo, graphic, or other image."})]})]})]}),(0,t.jsx)(C,{form:h,isLoading:s,selectedFile:p,fileError:x,onCancel:()=>{c()},onUpload:d,filePreview:f})]})}e.s(["default",0,N],68532);let M={pdf:d.default,excel:c.default,word:h.default,powerpoint:u.default,onenote:p.default};function j({isOpen:e,label:n,accept:r,fileType:i,isLoading:s,progress:l,error:a,onUpload:d,onClose:c}){let{form:h,fileInputRef:u,selectedFile:p,filePreview:m,localError:x,fileError:b,isImage:w,selectedFileIcon:v,titlePlaceholder:N,titleHelperText:S,handleFileSelect:T,handleRemoveFile:A,isDragging:E,dropHandlers:R}=g({isOpen:e,label:n,accept:r,fileType:i,isLoading:s,onUpload:d}),D=p&&M[(p.name.split(".").pop()||"").toLowerCase()]||f;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:u,type:"file",accept:r,onChange:e=>{T(e.target.files?.[0]??null)},className:"hidden"}),(0,t.jsxs)("div",{...R,className:"py-4 overflow-y-auto flex-1 space-y-5",children:[(0,t.jsx)(y,{form:h,label:n,isImage:w,placeholder:N,helperText:S,isLoading:s}),p?(0,t.jsx)(k,{selectedFile:p,filePreview:m,isLoading:s,progress:l,error:a,localError:x,fileError:b,selectedFileIcon:v,onRemove:A}):(0,t.jsxs)("button",{type:"button",onClick:()=>u.current?.click(),className:`relative w-full min-h-30 flex items-center gap-4 p-5 rounded-3xl border border-dashed transition-all duration-200 group ${E?"border-primary bg-primary/10":"border-gray-200 bg-off-white hover:border-primary/40 hover:bg-primary/5"}`,children:[(0,t.jsx)("div",{className:"flex h-17.5 w-20 shrink-0",children:(0,t.jsx)(o.default,{src:D,alt:"",width:80,height:70,className:"h-17.5 w-20","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"text-left min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-lg font-semibold text-neutral-dark",children:["Drop your ",n.toLowerCase()," here"," ",(0,t.jsx)("span",{className:"text-primary",children:"or browse"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-400 font-medium mt-0.5",children:"Upload a PDF, document, deck, spreadsheet, or other file."})]})]})]}),(0,t.jsx)(C,{form:h,isLoading:s,selectedFile:p,fileError:b,onCancel:()=>{c()},onUpload:d,filePreview:m})]})}var T=e.i(42751);function A({isOpen:e,label:n,accept:r,fileType:i,isLoading:s,progress:l,error:a,onUpload:d,onClose:c}){let{form:h,fileInputRef:u,selectedFile:p,filePreview:f,localError:m,fileError:x,isImage:b,selectedFileIcon:w,titlePlaceholder:v,titleHelperText:N,handleFileSelect:S,handleRemoveFile:M,isDragging:j,dropHandlers:E}=g({isOpen:e,label:n,accept:r,fileType:i,isLoading:s,onUpload:d});return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:u,type:"file",accept:r,onChange:e=>{S(e.target.files?.[0]??null)},className:"hidden"}),(0,t.jsxs)("div",{...E,className:"py-4 overflow-y-auto flex-1 space-y-5",children:[(0,t.jsx)(y,{form:h,label:n,isImage:b,placeholder:v,helperText:N,isLoading:s}),p?(0,t.jsx)(k,{selectedFile:p,filePreview:f,isLoading:s,progress:l,error:a,localError:m,fileError:x,selectedFileIcon:w,onRemove:M}):(0,t.jsxs)("button",{type:"button",onClick:()=>u.current?.click(),className:`relative w-full min-h-30 flex items-center gap-4 p-5 rounded-3xl border border-dashed transition-all duration-200 group ${j?"border-primary bg-primary/10":"border-gray-200 bg-off-white hover:border-primary/40 hover:bg-primary/5"}`,children:[(0,t.jsx)("div",{className:"flex h-17.5 w-20 shrink-0",children:(0,t.jsx)(o.default,{src:T.default,alt:"",width:80,height:70,className:"h-17.5 w-20","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"text-left min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-lg font-semibold text-neutral-dark",children:["Drop your ",n.toLowerCase()," here"," ",(0,t.jsx)("span",{className:"text-primary",children:"or browse"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-400 font-medium mt-0.5",children:"Upload MP4, MOV, AVI, or other video files."})]})]})]}),(0,t.jsx)(C,{form:h,isLoading:s,selectedFile:p,fileError:x,onCancel:()=>{c()},onUpload:d,filePreview:f})]})}var E=e.i(16715),R=e.i(67132),D=e.i(73635),O=e.i(172),P=e.i(59265),L=e.i(2968);let I={src:e.i(17475).default,width:24,height:24,blurWidth:0,blurHeight:0};function z({isOpen:e,label:i,accept:s,fileType:l,isLoading:a,progress:d,error:c,onUpload:h,onClose:u}){let{form:p,fileInputRef:f,selectedFile:m,filePreview:x,localError:b,fileError:w,isImage:v,selectedFileIcon:N,titlePlaceholder:S,titleHelperText:M,handleFileSelect:j,handleRemoveFile:T,isDragging:A,dropHandlers:$,setFileError:H}=g({isOpen:e,label:i,accept:s,fileType:l,isLoading:a,onUpload:h}
93),[F,B]=(0,n.useState)("select"),[V,_]=(0,n.useState)(!1),[W,U]=(0,n.useState)(!1),[K,q]=(0,n.useState)(!1),[J,Y]=(0,n.useState)(!1),[X,G]=(0,n.useState)(0),[Z,Q]=(0,n.useState)(0),[ee,et]=(0,n.useState)(Array(120).fill(0)),[en,er]=(0,n.useState)(Array(120).fill(!1)),[ei,eo]=(0,n.useState)(0),[es,el]=(0,n.useState)(Array(120).fill(.15)),ea=(0,n.useRef)(null),ed=(0,n.useRef)([]),ec=(0,n.useRef)(null),eh=(0,n.useRef)(null),eu=(0,n.useRef)(null),ep=(0,n.useRef)(null),ef=(0,n.useRef)(null),em=(0,n.useRef)(0),eg=(0,n.useRef)(0),ey=(0,n.useRef)(null),ex=(0,n.useRef)(null),eb=(0,n.useRef)(Array(120).fill(0)),ew=(0,n.useRef)(Array(120).fill(!1)),ev=(0,n.useRef)(0),ek=(0,n.useRef)(0),eC=(0,n.useCallback)(()=>{ef.current&&(cancelAnimationFrame(ef.current),ef.current=null);let e=ea.current;if(e){if("recording"===e.state||"paused"===e.state)try{e.stop()}catch(e){}ea.current=null}if(ep.current){try{ep.current.close()}catch(e){}ep.current=null}eh.current&&(eh.current.getTracks().forEach(e=>{try{e.stop()}catch(e){}}),eh.current=null),ec.current&&(clearInterval(ec.current),ec.current=null)},[]),eN=(0,n.useCallback)(()=>{if(!eu.current)return;let e=eu.current,t=e.fftSize,n=new Uint8Array(t),r=()=>{ef.current=requestAnimationFrame(r),e.getByteTimeDomainData(n);let i=0;for(let e=0;e<t;e++){let t=(n[e]-128)/128;i+=t*t}let o=Math.min(1,30*Math.sqrt(i/t)),s=performance.now();if(s-ek.current>=100){ek.current=s,ev.current>=120&&(ev.current=0,ew.current=Array(120).fill(!1),er(Array(120).fill(!1)));let e=ev.current;et(t=>{let n=[...t];return n[e]=o,eb.current=n,n}),er(t=>{let n=[...t];return n[e]=!0,ew.current=n,n}),ev.current+=1,eo(ev.current/120*100)}};r()},[]),eS=(0,n.useCallback)(()=>{eC(),_(!1),U(!1)},[eC]),eM=(0,n.useCallback)(()=>{ea.current&&V&&(W?(ea.current.resume(),U(!1),em.current=Date.now()-eg.current,ec.current=setInterval(()=>{Q(Date.now()-em.current)},10),eN()):(ea.current.pause(),U(!0),eg.current=Date.now()-em.current,ec.current&&clearInterval(ec.current),ef.current&&cancelAnimationFrame(ef.current)))},[V,W,eN]),ej=(0,n.useCallback)(()=>{eC(),ey.current&&(ey.current.pause(),ey.current=null),Y(!1),G(0),ex.current&&(URL.revokeObjectURL(ex.current),ex.current=null),_(!1),U(!1),q(!1),Q(0),ed.current=[],eb.current=Array(120).fill(0),ew.current=Array(120).fill(!1),ev.current=0,ek.current=performance.now(),et(Array(120).fill(0)),er(Array(120).fill(!1)),eo(0),el(Array(120).fill(.15))},[eC]),eT=(0,n.useCallback)(async()=>{if(!(0,R.isAudioRecordingSupported)())return void(0,D.showToastError)(Error((0,R.getMicrophoneErrorMessage)(null)),"microphoneAccessFailed");try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});eh.current=e;let t=(0,R.getSupportedAudioMimeType)(),n=new MediaRecorder(e,{mimeType:t||void 0});ea.current=n,ed.current=[],eb.current=Array(120).fill(0),ew.current=Array(120).fill(!1),ev.current=0,ek.current=performance.now();let r=await (0,R.createResumedAudioContext)();ep.current=r;let i=r.createMediaStreamSource(e),o=r.createAnalyser();o.fftSize=2048,o.smoothingTimeConstant=.8,i.connect(o),eu.current=o,n.ondataavailable=e=>{e.data.size>0&&ed.current.push(e.data)},n.onstop=async()=>{eC();let e=t||"audio/webm",n=(0,R.audioExtensionForMimeType)(e),r=new Blob(ed.current,{type:e}),i=new File([r],`recording-${Date.now()}.${n}`,{type:e}),o=eb.current.map((e,t)=>ew.current[t]?e:.15);if(el(o),j(i),""===p.state.values.title.trim()){let e=`Audio Recording ${new Date().toLocaleTimeString()}`;p.setFieldValue("title",e),p.setFieldMeta("title",e=>({...e,touched:!0,dirty:!0})),p.validateField("title","change")}q(!0)},n.start(),_(!0),U(!1),Q(0),em.current=Date.now(),eg.current=0,ec.current=setInterval(()=>{Q(Date.now()-em.current)},10),eN()}catch(e){eC(),(0,D.showToastError)(Error((0,R.getMicrophoneErrorMessage)(e)),"microphoneAccessFailed")}},[j,p,eN,eC]);return(0,n.useEffect)(()=>{e||(eC(),ey.current&&(ey.current.pause(),ey.current=null),ex.current&&(URL.revokeObjectURL(ex.current),ex.current=null),B("select"),q(!1),eb.current=Array(120).fill(0),ew.current=Array(120).fill(!1),ev.current=0,ek.current=performance.now(),et(Array(120).fill(0)),er(Array(120).fill(!1)),eo(0),el(Array(120).fill(.15)
93))},[e,eC]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:f,type:"file",accept:s,onChange:e=>{j(e.target.files?.[0]??null)},className:"hidden"}),(0,t.jsxs)("div",{..."select"===F&&!m?$:{},className:"py-4 overflow-y-auto flex-1 space-y-5",children:[(0,t.jsx)(y,{form:p,label:i,isImage:v,placeholder:S,helperText:M,isLoading:a}),(0,t.jsxs)("div",{className:"bg-off-white p-2 rounded-3xl space-y-5",children:[!m&&(0,t.jsxs)("div",{className:"flex bg-white p-1.5 rounded-2xl",children:[(0,t.jsx)("button",{type:"button",onClick:()=>B("select"),className:`flex-1 py-3 text-base rounded-xl font-sans transition-all ${"select"===F?"bg-sb-light-purple text-neutral-dark font-semibold":"text-gray-500 hover:text-gray-700 font-bold"}`,children:"Upload"}),(0,t.jsx)("button",{type:"button",onClick:()=>B("record"),className:`flex-1 py-3 text-base font-sans rounded-xl transition-all ${"record"===F?"bg-sb-light-purple text-neutral-dark font-semibold":"text-gray-500 hover:text-gray-700 font-bold"}`,children:"Record"})]}),K?(0,t.jsx)("div",{className:"w-full rounded-3xl p-8 bg-gray-50/50 border border-gray-100",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsx)("span",{className:"text-sm font-medium text-gray-400 tracking-wide",children:"Recording Complete"}),(0,t.jsx)("span",{className:"text-2xl font-bold text-neutral-dark font-mono tabular-nums",children:(0,r.formatCentiseconds)(Z)})]}),(0,t.jsxs)("div",{className:"relative w-full h-[8rem] mt-2",children:[(0,t.jsx)("div",{className:"absolute left-0 right-0 top-1/2 h-px bg-gray-300 -translate-y-1/2"}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center gap-[2.5px]",children:es.map((e,n)=>{let r=Math.max(100*e,4),i=(n+1)/es.length*100;return(0,t.jsx)("div",{className:`flex-1 rounded-xs ${i<=X?"bg-primary-light":"bg-[#6B7280]"}`,style:{height:`${r}%`}},n)})}),(0,t.jsxs)("div",{className:`absolute top-0 bottom-0 w-0 transition-all duration-100 ${!J&&0===X?"opacity-0":"opacity-100"}`,style:{left:`${X}%`},children:[(0,t.jsx)("div",{className:"absolute left-0 top-[-3px] w-3 h-3 -ml-1.5 rounded-full bg-primary-light"}),(0,t.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 -ml-px bg-primary-light"}),(0,t.jsx)("div",{className:"absolute left-0 bottom-[-3px] w-3 h-3 -ml-1.5 rounded-full bg-primary-light"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4 mt-2",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{if(!m)return;ex.current||(ex.current=URL.createObjectURL(m)),ey.current||(ey.current=new Audio(ex.current),ey.current.onended=()=>{Y(!1),G(0)},ey.current.ontimeupdate=()=>{let e=ey.current;e&&e.duration&&G(e.currentTime/e.duration*100)});let e=ey.current;e.paused?(e.play(),Y(!0)):(e.pause(),Y(!1))},className:"flex items-center gap-2 px-5 py-3 rounded-2xl shadow-subtle bg-white transition-all ",children:[(0,t.jsx)(o.default,{src:J?L.default:P.default,alt:J?"Pause":"Play",width:20,height:20}),(0,t.jsx)("span",{className:"text-lg font-semibold text-gray-600",children:J?"Pause":"Play"})]}),(0,t.jsxs)("button",{type:"button",onClick:()=>{ey.current&&(ey.current.pause(),ey.current=null),T(),ej()},className:"flex items-center gap-2 px-5 py-2.5 rounded-full hover:bg-white/50 transition-all",children:[(0,t.jsx)(E.RefreshCw,{className:"w-6 h-6 text-primary"}),(0,t.jsx)("span",{className:"text-lg font-bold text-primary",children:"Re-record"})]})]})]})}):m?(0,t.jsx)(k,{selectedFile:m,filePreview:x,isLoading:a,progress:d,error:c,localError:b,fileError:w,selectedFileIcon:N,onRemove:T}):"select"===F?(0,t.jsxs)("button",{type:"button",onClick:()=>f.current?.click(),className:`relative w-full min-h-30 flex items-center gap-4 p-5 rounded-3xl border border-dashed transition-all duration-200 group ${A?"border-primary bg-primary/10":"border-gray-200 bg-white hover:border-primary/40 hover:bg-primary/5"}`,children:[(0,t.jsx)("div",{className:"flex h-17.5 w-20 shrink-0",children:(0,t.jsx)(o.default,{src:O.default,alt:"",width:80,height:70,className:"h-17.5 w-20","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"text-left min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-lg font-semibold text-neutral-dark",children:["Drop your audio here"," ",(0,t.jsx)("span",{className:"text-primary",children:"or browse"})]}),(0,t.jsx)("p",{className:"text-sm text-gray-400 font-medium mt
93-0.5",children:"Upload MP3, WAV, M4A, or other audio files."})]})]}):(0,t.jsx)("div",{className:"w-full rounded-3xl p-8 bg-gray-50/50 border border-gray-100",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsx)("h3",{className:"text-2xl font-bold text-neutral-dark",children:"Record Voice Note"}),(0,t.jsx)("p",{className:"text-sm text-gray-400 font-medium text-center max-w-sm",children:"Press record to capture audio directly in side this board."}),V?(0,t.jsxs)("div",{className:"w-full flex flex-col items-center gap-4 mt-2",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center",children:[(0,t.jsxs)("span",{className:"text-sm font-medium text-gray-400 tracking-wide flex items-center gap-2",children:[!W&&(0,t.jsx)("span",{className:"inline-block w-2 h-2 rounded-full bg-red-500",style:{boxShadow:"0 0 0 0 rgba(239,68,68,0.6)",animation:"pulse-dot 1.4s infinite"}}),W?"Paused":"Recording"]}),(0,t.jsx)("span",{className:"text-2xl font-bold text-neutral-dark font-mono tabular-nums",children:(0,r.formatCentiseconds)(Z)})]}),(0,t.jsxs)("div",{className:"relative w-full h-[8rem] mt-2",children:[(0,t.jsx)("div",{className:"absolute left-0 right-0 top-1/2 h-px bg-gray-300 -translate-y-1/2"}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center gap-[2.5px]",children:ee.map((e,n)=>{let r=en[n],i=Math.max(100*e,4);return(0,t.jsx)("div",{className:"flex-1 rounded-xs bg-[#6B7280] transition-all duration-75",style:{height:`${i}%`,opacity:+!!r}},n)})}),(0,t.jsxs)("div",{className:`absolute top-0 bottom-0 w-0 transition-opacity duration-200 ${W?"opacity-60":"opacity-100"}`,style:{left:`${ei}%`},children:[(0,t.jsx)("div",{className:"absolute left-0 top-[-3px] w-3 h-3 -ml-1.5 rounded-full bg-primary-light"}),(0,t.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 -ml-px bg-primary-light"}),(0,t.jsx)("div",{className:"absolute left-0 bottom-[-3px] w-3 h-3 -ml-1.5 rounded-full bg-primary-light"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4 mt-2",children:[(0,t.jsx)("button",{type:"button",onClick:ej,className:"p-1 rounded-2xl bg-white shadow-subtle flex items-center justify-center transition-all",children:(0,t.jsx)("div",{className:"w-12 h-12 rounded-xl bg-off-white flex items-center justify-center",children:(0,t.jsx)(E.RefreshCw,{className:"w-6 h-6 text-gray-600"})})}),(0,t.jsx)("button",{type:"button",onClick:eM,className:"p-1 rounded-2xl bg-white shadow-subtle flex items-center justify-center transition-all ",children:(0,t.jsx)("div",{className:"w-12 h-12 rounded-xl bg-off-white flex items-center justify-center",children:(0,t.jsx)(o.default,{src:W?P.default:L.default,alt:W?"Play":"Pause",width:24,height:24})})}),(0,t.jsx)("button",{type:"button",onClick:eS,className:"p-1 rounded-2xl bg-sb-red shadow-subtle flex items-center justify-center transition-all",children:(0,t.jsx)("div",{className:"w-12 h-12 rounded-xl bg-white/30 flex items-center justify-center",children:(0,t.jsx)(o.default,{src:I,alt:"Stop",width:24,height:24})})})]})]}):(0,t.jsx)("button",{type:"button",onClick:eT,className:"mt-2 text-lg font-bold text-primary hover:underline",children:"Start Recording"})]})})]})]}),(0,t.jsx)(C,{form:p,isLoading:a,selectedFile:m,fileError:w,onCancel:()=>{eS(),u()},onUpload:h,filePreview:x})]})}e.s(["ContentUploadModal",0,function({isOpen:e,onClose:n,onUpload:l,isLoading:a=!1,progress:d=0,error:c=null,label:h,accept:u,fileType:p}){let f,m=h.toLowerCase().includes("audio")||h.toLowerCase().includes("recording")||h.toLowerCase().includes("voice"),g=p===r.FILE_TYPES.IMAGE,y=u.includes("video")||h.toLowerCase().includes("video"),x={isOpen:e,label:h,accept:u,fileType:p,isLoading:a,progress:d,error:c,onUpload:l,onClose:n};return f=m?(0,t.jsx)(z,{...x}):g?(0,t.jsx)(S,{...x}):y?(0,t.jsx)(A,{...x}):(0,t.jsx)(j,{...x}),(0,t.jsx)(i.CenterModal,{open:e,onClose:n,className:"max-w-150! rounded-4xl shadow-modal!",children:(0,t.jsxs)("div",{className:"flex flex-col max-h-[85vh] p-8 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-4 shrink-0 border-b border-gray-200",children:[(0,t.jsxs)("h2",{className:"text-2xl font-sans text-neutral-dark font-bold",children:["Upload ",h]}),(0,t.jsx)("button",{type:"button",onClick:n,className:"p-1 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors",children:(0,t.jsx)(o.default,{src:s.default,alt:"Close",width:32,height:32})})]}),(0,t.jsx)("form",{onSubmit:e=>{e.preventDefault()},onDragOver:e=>e.preventDefault(),onDrop:e=>e.preventDefault(),className:"flex flex-col min-h-0 flex-1",children:f})]})})}],334),e.s([],34422),e.s([],67242)},60802,52757,96021,73176,e=>{"use strict";var t=e.i(43476),n=e.i(92270),r=e.i(7952),i=e.i(73828),o=e.i(57688);e.s(["LogoutModal",0,function({open:e,onCancel:s,onConfirm:l,isLoading:a}){return(0,t.jsx)(r.CenterModal,{open:e,onClose:s,className:"max-w-120!",children:(0,t.jsxs)("div",{className:"w-full rounded-3xl bg-white p-8 shadow-modal",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-2xl bg-red-50 flex items-center justify-center shrink-0",children:(0,t.jsx)(n.LogOut,{className:"w-6 h-6 text-sb-red"})}),(0,t.jsx)("h2",{className:"text-2xl font-bold text-neutral-dark",children:"Logout"})]}),(0,t.jsx)("button",{type:"button",onClick:s,className:"inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100","aria-label":"Close",children:(0,t.jsx)(o.default,{src:i.default,alt:"Close",width:28,height:28})})]}),(0,t.jsx)("p",{className:"text-base font-medium text-gray-600 mb-8",children:"Are you sure you want to logout from your account?"}),(0,t.jsx)("div",{className:"border-t border-gray-100 mb-6"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:s,disabled:a,className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-
93off-white shadow-subtle text-gray-600 hover:bg-gray-200 disabled:opacity-50",children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:l,disabled:a,className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-sb-red shadow-subtle text-white hover:bg-red-700 disabled:opacity-50",children:a?"Logging out...":"Logout"})]})]})})}],60802),e.s([],52757),e.i(71645),e.i(3015),e.i(69712),e.i(22215),e.i(62697),e.s([],96021),e.i(3489),e.i(87763),e.s([],73176)},96992,e=>{"use strict";var t=e.i(43476),n=e.i(71645);e.s(["ModalFooter",0,function({onCancel:e,cancelText:n="Cancel",actionText:r,onAction:i,actionDisabled:o,actionLoading:s,actionType:l="button",actionColor:a="var(--sb-accent)",danger:d=!1}){return(0,t.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,t.jsx)("button",{type:"button",onClick:e,className:"flex-1 py-3 px-4 rounded-xl font-bold transition-colors text-sm",style:{background:"var(--sb-surface-2)",color:"var(--sb-text-soft)"},children:n}),(0,t.jsx)("button",{type:l,onClick:i,disabled:o||s,className:"flex-1 py-3 px-4 font-bold rounded-xl transition-all text-sm flex items-center justify-center gap-2 text-white",style:{background:d?"var(--sb-danger)":a,opacity:o||s?.5:1},children:s?(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),r,"..."]}
93):r})]})},"ModalHeader",0,function({icon:e,title:r,description:i,iconBg:o="var(--sb-surface-2)",iconColor:s="var(--sb-text-muted)",className:l=""}){return(0,t.jsxs)("div",{className:`space-y-4 ${l}`,children:[e&&(0,t.jsx)("div",{className:"w-12 h-12 flex items-center justify-center rounded-xl",style:{background:o,color:s},children:"function"==typeof e||"object"==typeof e&&e&&!n.default.isValidElement(e)?n.default.createElement(e,{className:"w-6 h-6"}):e}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-bold",style:{color:"var(--sb-text)"},children:r}),i&&(0,t.jsx)("p",{className:"text-sm mt-1 leading-relaxed",style:{color:"var(--sb-text-muted)"},children:i})]})]})}])},80724,71085,e=>{"use strict";var t=e.i(43476),n=e.i(57688),r=e.i(76639),i=e.i(43531),o=e.i(64659),s=e.i(53245),l=e.i(73635),a=e.i(71645),d=e.i(46932),c=e.i(88653),h=e.i(57843),u=e.i(3015),p=e.i(67171);let f={src:e.i(43505).default,width:42,height:42,blurWidth:0,blurHeight:0},m={src:e.i(27782).default,width:42,height:42,blurWidth:0,blurHeight:0}
93,g={src:e.i(84705).default,width:42,height:42,blurWidth:0,blurHeight:0},y={src:e.i(43228).default,width:42,height:42,blurWidth:0,blurHeight:0},x={src:e.i(63975).default,width:42,height:42,blurWidth:0,blurHeight:0};var b=e.i(73828);e.s(["ShareModal",0,function({open:e,onOpenChange:w,contentTitle:v,contentUrl:k,contentThumbnail:C,contentSubtitle:N,contentType:S,rawContent:M}){let[j,T]=(0,a.useState)(!1),[A,E]=(0,a.useState)(!1),[R,D]=(0,a.useState)("anyone-with-link"),[O,P]=(0,a.useState)({top:0,left:0,width:0}),L=(0,a.useRef)(null),I=async()=>{await (0,s.copyToClipboard)(k)?(T(!0),(0,l.showToast)("linkCopied"),setTimeout(()=>T(!1),2e3)):(0,l.showToast)("failedToCopyLink")};(0,a.useLayoutEffect)(()=>{if(A&&L.current){let e=L.current.getBoundingClientRect();P({top:e.bottom-30,left:e.left,width:e.width})}},[A]);let z=[{id:"gmail",name:"Gmail",icon:(0,t.jsx)(n.default,{src:y,alt:"Gmail",width:42,height:42}),action:()=>(0,s.shareToGmail)({url:k,title:v})},{id:"whatsapp",name:"WhatsApp",icon:(0,t.jsx)(n.default,{src:g,alt:"WhatsApp",width:42,he
93ight:42}),action:()=>(0,s.shareToWhatsApp)({url:k,title:v})},{id:"instagram",name:"Instagram",icon:(0,t.jsx)(n.default,{src:x,alt:"Instagram",width:42,height:42}),action:async()=>{let{copied:e}=await (0,s.shareToInstagram)({url:k,title:v});e&&(0,l.showNotificationToast)("Link copied","Instagram doesn't support direct link sharing â paste it into a DM, bio, or story.")}},{id:"messenger",name:"Messenger",icon:(0,t.jsx)(n.default,{src:f,alt:"Messenger",width:42,height:42}),action:async()=>{let{copied:e}=await (0,s.shareToMessenger)({url:k,title:v});e&&(0,l.showNotificationToast)("Link copied","Paste it into a Messenger conversation to share.")}},{id:"linkedin",name:"LinkedIn",icon:(0,t.jsx)(n.default,{src:m,alt:"LinkedIn",width:42,height:42}),action:()=>(0,s.shareToLinkedIn)({url:k,title:v})}],$=async e=>{try{await e.action()}catch(t){console.error(`Failed to share to ${e.name}:`,t)}};return(0,t.jsx)(r.Dialog,{open:e,onOpenChange:w,children:(0,t.jsx)(r.DialogContent,{className:"w-[90vw] sm:max-w-150 bg-white rounded-4xl! p-8 overflow-hidden shadow-modal",children:(0,t.jsxs)("div",{className:"flex flex-col min-w-0 w-full max-h-[85vh] overflow-hidden",children:[(0,t.jsxs)(r.DialogHeader,{className:"flex-row items-center justify-between gap-3 border-b border-gray-200 pb-4 space-y-0",children:[(0,t.jsx)(r.DialogTitle,{className:"text-2xl font-sans font-bold text-neutral-dark",children:"Share Content"}),(0,t.jsx)("button",{type:"button",onClick:()=>w(!1),"aria-label":"Close",className:"shrink-0 rounded-lg p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600",children:(0,t.jsx)(n.default,{src:b.default,alt:"Close",width:24,height:24})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto custom-scrollbar min-h-0 my-8 space-y-5 min-w-0 pr-1",children:[(0,t.jsx)(p.DynamicPreviewCard,{contentType:S,contentThumbnail:C,contentTitle:v,rawContent:M}),(0,t.jsxs)("div",{className:"bg-off-white p-5 space-y-5 rounded-2xl",children:[(0,t.jsxs)("div",{className:"min-w-0",ref:L,children:[(0,t.jsx)("label",{className:"block text-sm font-semibold capitalize mb-3 tracking-wider text-neutral-dark",children:"Who can access"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("button",{onClick:()=>E(!A),className:"w-full text-left rounded-2xl border border-gray-200 bg-white px-3 py-2.5 pr-9 text-base font-medium text-gray-500 outline-none transition-colors hover:border-gray-300 focus:border-violet-300 focus:ring-2 focus:ring-violet-50",children:"anyone-with-link"===R?"Anyone with the link":R}),(0,t.jsx)(o.ChevronDown,{className:(0,u.cn)("pointer-events-none absolute right-3 top-1/2 h-5 w-5 -translate-y-1/2 text-gray-400 transition-transform duration-200",A&&"rotate-180")}),(0,t.jsx)(c.AnimatePresence,{children:A&&(0,t.jsxs)(h.Portal,{children:[(0,t.jsx)(d.motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15}
93,className:"fixed z-100",style:{top:`${O.top}px`,left:`${O.left}px`,width:`${O.width}px`},children:(0,t.jsx)("div",{className:"relative z-0 overflow-hidden rounded-2xl bg-white shadow-base border border-gray-100",children:(0,t.jsxs)("button",{onClick:()=>{D("anyone-with-link"),E(!1)},className:"w-full px-4 py-3 text-left transition-all duration-150 hover:bg-gray-50 flex items-center justify-between border-b border-gray-100 last:border-b-0",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("div",{className:"font-semibold text-base text-neutral-dark",children:"Anyone with the link"}),(0,t.jsx)("div",{className:"text-sm font-medium text-gray-500 mt-0.5",children:"Anyone can view this content"})]}),"anyone-with-link"===R&&(0,t.jsx)(i.Check,{className:"h-5 w-5 text-violet-600 shrink-0 ml-2"})]})})}),(0,t.jsx)("div",{className:"fixed inset-0 z-90",onClick:()=>E(!1)})]})})]}),(0,t.jsx)("p",{className:"text-sm font-medium text-gray-400 mt-2.5",children:"anyone-with-link"===R?"Anyone with this link can view this content.":"Only people you invite can access this content."})]}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold capitalize mb-3 tracking-wider text-neutral-dark",children:"Share link"}),(0,t.jsxs)("div",{className:"flex items-center w-full min-w-0 rounded-2xl border border-gray-200 bg-white pl-4 pr-1.5 py-1.5 transition-colors focus-within:border-violet-300 focus-within:ring-2 focus-within:ring-violet-50",children:[(0,t.jsx)("div",{className:"min-w-0 flex-1 truncate font-sans font-medium text-base text-gray-500",children:k}),(0,t.jsx)("button",{onClick:I,className:"group flex h-12 shrink-0 items-center capitalize gap-1.5 rounded-lg bg-primary-light px-6 text-sm font-semibold text-white transition-all hover:bg-violet-700 hover:shadow-md active:scale-95",children:j?(0,t.jsx)(t.Fragment,{children:"Copied"}):(0,t.jsx)(t.Fragment,{children:"Copy Link"})})]})]}),(0,t.jsxs)("div",{className:"space-y-5 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,t.jsx)("div",{className:"h-px flex-1 bg-gray-200"}),(0,t.jsx)("span",{className:"shrink-0 text-base font-semibold text-gray-400",children:"Or share via"}),(0,t.jsx)("div",{className:"h-px flex-1 bg-gray-200"})]}),(0,t.jsx)("div",{className:"flex items-start justify-between gap-2 min-w-0",children:z.map(e=>(0,t.jsxs)("button",{onClick:()=>$(e),className:"group flex flex-1 flex-col items-center gap-1.5",children:[(0,t.jsx)("span",{className:"flex h-11 w-11 items-center justify-center transition-transform duration-150 group-hover:-translate-y-0.5 group-active:scale-95 ",children:e.icon}),(0,t.jsx)("span",{className:"text-base font-semibold text-neutral-dark",children:e.name})]},e.id))})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-6 mt-6",children:[(0,t.jsx)("button",{className:"rounded-2xl text-lg font-semibold shadow-subtle font-sans px-6 py-3 bg-off-white text-gray-600 hover:bg-off-white/80",onClick:()=>w(!1),children:"Cancel"}),(0,t.jsx)("button",{className:"rounded-2xl text-lg font-semibold shadow-subtle font-sans px-6 py-3 bg-primary text-white hover:bg-primary/80",onClick:()=>w(!1),children:"Done"})]})]})})})}],80724);let w={src:e.i(29333).default,width:24,height:24,blurWidth:0,blurHeight:0};e.s(["default",0,w],71085)},33069,7737,e=>{"use strict";var t=e.i(43476),n=e.i(7952),r=e.i(73828),i=e.i(57688);e.s(["CreateBoardModal",0,function({open:e,onOpenChange:o,boardName:s,onBoardNameChange:l,boardDescription:a,onBoardDescriptionChange:d,onSubmit:c,isLoading:h}){let u=s.trim().length>0&&!h;return(0,t.jsx)(n.CenterModal,{open:e,onClose:()=>o(!1),className:"max-w-150!",children:(0,t.jsxs)("div",{className:"w-full rounded-3xl bg-white p-8 shadow-modal",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-neutral-dark",children:"Create New Board"}),(0,t.jsx)("button",{type:"button",onClick:()=>o(!1),className:"inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100","aria-label":"Close create board modal",children:(0,t.jsx)(i.default,{src:r.default,alt:"Close",width:28,height:28})})]}),(0,t.jsxs)("form",{onSubmit:c,className:"space-y-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Board Name"}),(0,t.jsx)("div",{className:"flex items-center border border-gray-200 rounded-2xl bg-white overflow-hidden",children:(0,t.jsx)("input",{type:"text",placeholder:"e.g. Product Launch",value:s,onChange:e=>l(e.target.value),autoFocus:!0,maxLength:60,className:"flex-1 min-w-0 px-5 py-3 text-base font-medium text-neutral-dark outline-none placeholder:font-medium placeholder:text-gray-400 bg-transparent placeholder:text-base focus:border-primary transition-colors"})}),(0,t.jsx)("p",{className:"mt-2.5 text-sm font-medium text-gray-400",children:"Use a clear name based on the project, client, or workflow."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Board Description"}),(0,t.jsx)("textarea",{placeholder:"e.g. Launch assets, campaign plans, and team updates...",value:a,onChange:e=>d(e.target.value),rows:3,maxLength:200,className:"w-full px-4 py-3 rounded-2xl border border-gray-200 bg-white text-base font-medium text-neutral-dark outline-none placeholder:text-gray-400 placeholder:text-base placeholder:font-medium resize-none focus:border-primary transition-colors"})]}),(0,t.jsx)("div",{className:"border-t border-gray-100"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(!1),className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-
93off-white shadow-subtle text-gray-600 hover:bg-gray-200",children:"Cancel"}),(0,t.jsxs)("button",{type:"submit",disabled:!u,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2 disabled:opacity-50 hover:opacity-90",children:[h&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),h?"Creating...":"Create Board"]})]})]})]})})}],33069),e.i(71645),e.i(16787),e.i(91285),e.i(98182),e.i(32341),e.s([],7737)},34234,e=>{"use strict";var t=e.i(43476),n=e.i(71645),r=e.i(70756),i=e.i(7952),o=e.i(73828),s=e.i(57688),l=e.i(3015);let a={src:e.i(25687).default,width:20,height:20,blurWidth:0,blurHeight:0};e.s(["DuplicateBoardModal",0,function({open:e,onOpenChange:d,boardName:c,boardIcon:h,onDuplicate:u,isLoading:p=!1}){let[f,m]=(0,n.useState)(""),[g,y]=(0,n.useState)(""),[x,b]=(0,n.useState)("private"),[w,v]=(0,n.use
93State)("same-folder"),[k,C]=(0,n.useState)(!1),[N,S]=(0,n.useState)(!1),M=(0,n.useRef)(null),j=(0,n.useRef)(null);(0,n.useEffect)(()=>{e&&(m(`${c} (Copy)`),y(""),b("private"),v("same-folder"),C(!1),S(!1))},[e,c]),(0,n.useEffect)(()=>{function e(e){M.current&&!M.current.contains(e.target)&&C(!1),j.current&&!j.current.contains(e.target)&&S(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let T=()=>{m(`${c} (Copy)`),y(""),b("private"),v("same-folder"),C(!1),S(!1),d(!1)},A=async e=>{e.preventDefault();try{await u(!0),T()}catch{}},E=[{value:"private",label:"Private",icon:(0,t.jsx)(r.Lock,{size:16})}],R=[{value:"same-folder",label:"Same Folder"},{value:"root",label:"My Boards"}],D=E.find(e=>e.value===x),O=R.find(e=>e.value===w);return(0,t.jsx)(i.CenterModal,{open:e,onClose:T,className:"max-w-150!",children:(0,t.jsxs)("div",{className:"w-full rounded-4xl bg-white p-8 shadow-modal",children:[(0,t.jsxs)("div",{className:"mb-6 flex items-center justify-between border-b border-gray-100 pb-5",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-neutral-dark",children:"Duplicate Board"}),(0,t.jsx)("button",{type:"button",onClick:T,className:"inline-flex items-center justify-center rounded-lg p-1 transition-colors hover:bg-gray-100","aria-label":"Close duplicate board modal",children:(0,t.jsx)(s.default,{src:o.default,alt:"Close",width:28,height:28})})]}),(0,t.jsxs)("form",{onSubmit:A,className:"space-y-7",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-3 block text-sm font-semibold text-neutral-dark",children:"Board Name"}),(0,t.jsxs)("div",{className:"flex items-center overflow-hidden rounded-2xl border border-gray-200 bg-white focus-within:border-primary transition-colors",children:[(0,t.jsx)("input",{type:"text",value:f,onChange:e=>m(e.target.value),autoFocus:!0,maxLength:60,className:"min-w-0 flex-1 bg-transparent px-5 py-3 text-base font-medium text-neutral-dark outline-none placeholder:font-medium placeholder:text-base placeholder:text-gray-400"}),(0,t.jsxs)("div",{ref:M,className:"relative mr-1.5 shrink-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{C(e=>!e),S(!1)},className:"inline-flex h-10 items-center gap-2 rounded-xl bg-gray-300 px-3 text-sm font-semibold text-gray-500 transition-colors hover:bg-gray-100",children:[(0,t.jsx)("span",{className:"text-gray-400",children:D?.icon}),(0,t.jsx)("span",{children:D?.label}),(0,t.jsx)(s.default,{src:a,alt:"",width:16,height:16,className:(0,l.cn)("h-4 w-4 text-gray-400 transition-transform duration-200",k&&"rotate-180")})]}),k&&(0,t.jsx)("div",{className:"absolute right-0 top-[calc(100%+0.5rem)] z-50 w-44 overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-lg animate-in fade-in-0 zoom-in-95",children:E.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>{b(e.value),C(!1)},className:(0,l.cn)("flex w-full items-center gap-2 px-4 py-3 text-left text-sm transition-colors",x===e.value?"bg-primary-light/10 font-semibold text-neutral-dark":"font-medium text-gray-600 hover:bg-gray-50"),children:[(0,t.jsx)("span",{className:"text-gray-400",children:e.icon}),(0,t.jsx)("span",{children:e.label})]},e.value))})]})]}),(0,t.jsx)("p",{className:"mt-2.5 text-sm font-medium text-gray-400",children:"Give the copied board a name that makes it easy to identify."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-3 block text-sm font-semibold text-neutral-dark",children:"Board Description"}),(0,t.jsx)("textarea",{placeholder:"e.g. Launch assets, campaign plans, and team updates...",value:g,onChange:e=>y(e.target.value),rows:4,maxLength:200,className:"w-full resize-none rounded-2xl border border-gray-200 bg-white px-4 py-3 text-base font-medium text-neutral-dark outline-none placeholder:font-medium placeholder:text-base placeholder:text-gray-400 focus:border-primary transition-colors"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-3 block text-sm font-semibold text-neutral-dark",children:"Save To"}),(0,t.jsxs)("div",{ref:j,className:"relative",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{S(e=>!e),C(!1)},className:"flex w-full items-center justify-between rounded-2xl border border-gray-200 bg-white px-5 py-3 text-left text-base font-medium transition-colors hover:border-gray-300 focus:border-primary",children:[(0,t.jsx)("span",{className:"text-gray-700",children:O?.label}),(0,t.jsx)(s.default,{src:a,alt:"",width:16,height:16,className:(0,l.cn)("w-4 h-4 transition-transform",N&&"rotate-180")}
93)]}),N&&(0,t.jsx)("div",{className:"absolute left-0 right-0 top-[calc(100%+0.5rem)] z-50 overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-lg animate-in fade-in-0 zoom-in-95",children:R.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{v(e.value),S(!1)},className:(0,l.cn)("block w-full px-5 py-3 text-left text-sm transition-colors",w===e.value?"bg-primary-light/10 font-semibold text-neutral-dark":"font-medium text-gray-600 hover:bg-gray-50"),children:e.label},e.value))})]}),(0,t.jsx)("p",{className:"mt-2.5 text-sm font-medium text-gray-400",children:"Choose where you want to save the duplicated board."})]}),(0,t.jsxs)("div",{className:"border-t border-gray-100 pt-6 flex items-center justify-end gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:T,className:"rounded-2xl text-lg font-semibold font-sans px-6 py-3 bg-off-white text-gray-600 hover:bg-off-white/80 transition-colors",children:"Cancel"}),(0,t.jsx)("button",{type:"submit",disabled:p||!f.trim(),className:"rounded-2xl text-lg font-semibold font-sans px-6 py-3 bg-primary text-white hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:p?"Duplicating...":"Duplicate Board"})]})]})]})})}],34234)},46636,22038,e=>{"use strict";var t=e.i(43476),n=e.i(71645),r=e.i(69638),i=e.i(76639),o=e.i(57688),s=e.i(73828),l=e.i(92393),a=e.i(69386),d=e.i(67171),c=e.i(91285);e.s(["MoveContentModal",0,function({open:e,onOpenChange:h,sourceBoard:u,selectedContents:p,availableBoards:f,contentThumbnail:m,contentType:g,onMove:y,isLoading:x=!1}){let[b,w]=(0,n.useState)(""),[v,k]=(0,n.useState)(""),C=(0,n.useMemo)(()=>[u,...f.filter(e=>e.id!==u.id)].filter(e=>e.name.toLowerCase().includes(v.toLowerCase())),[f,v,u]),N=async()=>{if(b)try{await y(b),w(""),k(""),h(!1)}catch{}},S=p[0],M=S?.title||"Content";return(0,t.jsx)(i.Dialog,{open:e,onOpenChange:h,children:(0,t.jsx)(i.DialogContent,{className:"w-[90vw] sm:max-w-1
9350 bg-white rounded-4xl! p-8 overflow-hidden shadow-modal",children:(0,t.jsxs)("div",{className:"flex flex-col min-w-0 w-full max-h-[85vh] overflow-hidden",children:[(0,t.jsxs)(i.DialogHeader,{className:"flex-row items-center justify-between gap-3 border-b border-gray-200 pb-4 space-y-0",children:[(0,t.jsx)(i.DialogTitle,{className:"text-2xl font-sans font-bold text-neutral-dark",children:"Move Content"}),(0,t.jsx)("button",{type:"button",onClick:()=>h(!1),"aria-label":"Close",className:"shrink-0 rounded-lg p-1 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600",children:(0,t.jsx)(o.default,{src:s.default,alt:"Close",width:24,height:24})})]}),(0,t.jsx)("div",{className:"my-5 min-w-0",children:(0,t.jsx)(d.DynamicPreviewCard,{contentType:g,contentThumbnail:m,contentTitle:M,rawContent:S?.content})}),(0,t.jsxs)("div",{className:"flex flex-col min-h-0 flex-1 bg-off-white p-3 rounded-2xl",children:[(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("div",{className:"flex items-center w-full rounded-2xl border border-gray-200 bg-white pl-3 focus-within:border-violet-300 focus-within:ring-2 focus-within:ring-violet-50 transition-all",children:[(0,t.jsx)("span",{className:"shrink-0",children:(0,t.jsx)(c.SearchFilled,{size:20})}),(0,t.jsx)("input",{type:"text",placeholder:"Search boards...",value:v,onChange:e=>k(e.target.value),className:"ml-2 h-full w-full border-none bg-transparent pr-4 py-3 text-base font-medium text-gray-500 outline-none placeholder:text-base placeholder:font-medium placeholder:text-gray-500 focus:outline-none"})]}),(0,t.jsx)("p",{className:"text-sm font-medium text-gray-400 mt-2",children:"Select the board where this content should be moved."})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto custom-scrollbar min-h-0 bg-white rounded-2xl p-4 pr-1",children:0===C.length?(0,t.jsx)("div",{className:"text-center py-8",children:(0,t.jsx)("p",{className:"text-gray-500 text-sm font-medium",children:"No boards found."})}):(0,t.jsx)("div",{className:"space-y-2",children:C.map(e=>{let n=e.id===u.id;return(0,t.jsxs)("label",{className:`flex items-center justify-between gap-4 p-4 rounded-2xl transition-all ${n?"bg-off-white border-none cursor-not-allowed opacity-60":b===e.id?"bg-primary/10 border border-primary-light cursor-pointer hover:bg-primary-light/15":"bg-off-white hover:bg-off-white border-none cursor-pointer"}`,children:[(0,t.jsx)("input",{type:"radio",name:"destination",value:e.id,checked:b===e.id,onChange:e=>{w(e.target.value)},disabled:n,className:"hidden"}),(0,t.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,t.jsx)("div",{className:"bg-off-white shadow-subtle flex items-center justify-center shrink-0",children:(0,t.jsx)(o.default,{src:l.default,alt:"",width:24,height:24,className:"w-6 h-6"})}),(0,t.jsx)("p",{className:"font-semibold text-neutral-dark text-base truncate capitalize",children:e.name})]}),(0,t.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:n?(0,t.jsx)("span",{className:"text-base font-semibold text-primary-light whitespace-nowrap",children:"⢠Current"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 text-base font-semibold text-gray-500 whitespace-nowrap",children:[(0,t.jsx)(o.default,{src:a.default,alt:"",width:16,height:16,className:"w-4 h-4 shrink-0"}),(0,t.jsx)("span",{children:"Private"}),(0,t.jsx)("span",{children:"â¢"}),(0,t.jsxs)("span",{children:[e.contentCount||0," items"]})]}),b===e.id&&(0,t.jsx)(r.CheckCircle,{className:"w-5 h-5 text-primary"})]})})]},e.id)})})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-gray-200 pt-6 mt-6",children:[(0,t.jsx)("button",{className:"rounded-2xl text-lg font-semibold font-sans px-6 py-3 bg-off-white text-gray-600 hover:bg-off-white/80 transition-colors",onClick:()=>h(!1),children:"Cancel"}),(0,t.jsx)("button",{disabled:!b||x,className:"rounded-2xl text-lg font-semibold font-sans px-6 py-3 bg-primary text-white hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",onClick:N,children:x?"Moving...":"Move Content"})]})]})})})}],46636);let h=(0,e.i(75254).default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}
93]]);e.s(["FolderPlus",0,h],22038)},15401,73964,81424,e=>{"use strict";e.i(33069),e.i(7737),e.i(34234),e.i(46636);var t=e.i(43476),n=e.i(71645),r=e.i(22038),i=e.i(7952),o=e.i(96992);function s({name:e,icon:n}){let r=e.trim()||"Untitled";return(0,t.jsx)("div",{className:"flex flex-col items-center gap-3 select-none",children:(0,t.jsxs)("div",{className:"relative w-52 h-44",children:[(0,t.jsx)("div",{className:"absolute bottom-0 left-0 w-full h-36 rounded-2xl bg-linear-to-br from-primary to-purple-700 shadow-lg",children:(0,t.jsx)("div",{className:"absolute -top-5 left-0 w-24 h-7 rounded-t-2xl bg-linear-to-br from-primary to-purple-700"})}),(0,t.jsxs)("div",{className:"absolute bottom-14 left-1/2 -translate-x-1/2 w-44 h-24 pointer-events-none",children:[(0,t.jsx)("div",{className:"absolute bottom-0 left-2 w-28 h-20 rounded-xl shadow-md",style:{background:"linear-gradient(135deg,#e0f2fe,#bae6fd)",transform:"rotate(-8deg) translateY(-4px)"}}),(0,t.jsx)("div",{className:"absolute bottom-0 right-2 w-28 h-20 rounded-xl shadow-md",style:{background:"linear-gradient(135deg,#f0f9ff,#e0f2fe)",transform:"rotate(6deg) translateY(-6px)"}})]}),(0,t.jsxs)("div",{className:"absolute bottom-0 left-0 w-full h-20 rounded-b-2xl bg-linear-to-br from-primary to-purple-700 shadow-md flex flex-col items-center justify-center gap-0.5 px-3",children:[n&&(0,t.jsx)("span",{className:"text-xl leading-none drop-shadow",children:n}),(0,t.jsx)("span",{className:"text-sm font-bold text-white/95 drop-shadow text-center truncate max-w-full leading-tight",style:{textShadow:"0 1px 4px rgba(0,0,0,0.2)"},children:r})]})]})})}e.s(["CreateFolderModal",0,function({open:e,onClose:l,onCreate:a,isLoading:d=!1}){let[c,h]=(0,n.useState)(""),[u,p]=(0,n.useState)("ð"),f=async e=>{if(e.preventDefault(),c.trim())try{await a(c.trim(),u),h(""),p("ð"),l()}catch{}},m=()=>{h(""),p("ð"),l()};return(0,t.jsx)(i.CenterModal,{open:e,onClose:m,children:(0,t.jsxs)("div",{className:"p-8 space-y-6",children:[(0,t.jsx)(o.ModalHeader,{icon:r.FolderPlus,title:"Create Folder",description:"Organize your content into folders."}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-6",children:[(0,t.jsx)(s,{name:c,icon:u}),(0,t.jsx)("div",{className:"flex flex-wrap justify-center gap-2 w-full",children:["ð","ð","ðï¸","ð","ð","ð","ð¨","ð","ð¯","ð¼","ð","â"].map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>p(e),className:`w-10 h-10 text-xl rounded-full transition-all duration-200 flex items-center justify-center 94 ${u===e?"bg-purple-100 ring-2 ring-primary scale-110":"bg-gray-100 hover:bg-gray-200 hover:scale-105"}`,children:e},e))})]}),(0,t.jsxs)("form",{onSubmit:f,className:"space-y-6",children:[(0,t.jsx)("input",{type:"text",placeholder:"Folder name...",value:c,onChange:e=>h(e.target.value),autoFocus:!0,maxLength:40,className:"w-full px-4 py-3 rounded-2xl border border-gray-200 bg-gray-50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-purple-100 text-sm font-medium transition-colors"}),(0,t.jsx)(o.ModalFooter,{onCancel:m,actionText:d?"Creating":"Create Folder",actionType:"submit",actionDisabled:!c.trim()||d,actionLoading:d})]})]})})}],73964);var l=e.i(73828),a=e.i(57688);e.s(["RenameBoardModal",0,function({open:e,onOpenChange:n,boardName:r,onBoardNameChange:o,onSubmit:s,isLoading:d}){let c=r.trim().length>0&&!d;return(0,t.jsx)(i.CenterModal,{open:e,onClose:()=>n(!1),className:"max-w-150!",children:(0,t.jsxs)("div",{className:"w-full rounded-3xl bg-white p-8 shadow-modal",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-neutral-dark",children:"Rename Board"}),(0,t.jsx)("button",{type:"button",onClick:()=>n(!1),className:"inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100","aria-label":"Close rename board modal",children:(0,t.jsx)(a.default,{src:l.default,alt:"Close",width:28,height:28})})]}),(0,t.jsxs)("form",{onSubmit:s,className:"space-y-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Board Name"}),(0,t.jsx)("div",{className:"flex items-center border border-gray-200 rounded-2xl bg-white overflow-hidden",children:(0,t.jsx)("input",{type:"text",placeholder:"e.g. Product Launch",value:r,onChange:e=>o(e.target.value),autoFocus:!0,maxLength:60,className:"flex-1 min-w-0 px-5 py-3 text-base font-medium text-neutral-dark outline-none placeholder:font-medium placeholder:text-gray-400 bg-transparent placeholder:text-base focus:border-primary transition-colors"})}),(0,t.jsx)("p",{className:"mt-2.5 text-sm font-medium text-gray-400",children:"Use a clear name based on the project, client, or workflow."})]}),(0,t.jsx)("div",{className:"border-t border-gray-100"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>n(!1),className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-
94off-white shadow-subtle text-gray-600 hover:bg-gray-200",children:"Cancel"}),(0,t.jsxs)("button",{type:"submit",disabled:!c,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2 disabled:opacity-50 hover:opacity-90",children:[d&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),d?"Saving...":"Save Changes"]})]})]})]})})}],81424),e.s([],15401)},67171,e=>{"use strict";var t=e.i(43476),n=e.i(57688),r=e.i(78583),i=e.i(94918),o=e.i(37108),s=e.i(41929),l=e.i(3015),a=e.i(62368),d=e.i(12056),c=e.i(17163),h=e.i(74227),u=e.i(16052);let p={excel:{bg:"bg-green-100",icon:i.FileSpreadsheet,color:"text-green-600"},word:{bg:"bg-blue-100",icon:r.FileText,color:"text-blue-600"},archive:{bg:"bg-amber-100",icon:o.FileArchive,color:"text-amber-600"},powerpoint:{bg:"bg-orange-100",icon:r.FileText,color:"text-orange-600"},code:{bg:"bg-indigo-100",icon:s.FileCode,color:"text-indigo-600"},pdf:{bg:"bg-red-100",icon:r.FileText,color:"text-red-600"}};e.s(["DynamicPreviewCard",0,function({contentType:e,contentThumbnail:r,contentTitle:i,rawContent:o}){let s=e?e===l.FILE_TYPES.PDF?"pdf":e===l.FILE_TYPES.WORD?"word":e===l.FILE_TYPES.EXCEL?"excel":e===l.FILE_TYPES.POWERPOINT?"powerpoint":"generic":"generic",f="excel"===s?d.default:"word"===s?u.default:"powerpoint"===s?h.default:"pdf"===s||e===l.FILE_TYPES.PDF?c.default:null,m=p[s],{previewData:g,loading:y,error:x,isYouTube:b,linkThumbnail:w,retry:v}=(0,a.useLinkPreview)(e===l.FILE_TYPES.LINK||e===l.FILE_TYPES.YOUTUBE_LINK?o:void 0,r);if(e===l.FILE_TYPES.LINK||e===l.FILE_TYPES.YOUTUBE_LINK){let e=w&&w.trim().length>0;return(0,t.jsxs)("div",{className:"flex gap-6 rounded-3xl bg-off-white p-2.5 min-w-0 items-center",children:[(0,t.jsx)("div",{className:"relative w-40 h-24 shrink-0 overflow-hidden rounded-2xl bg-linear-to-br from-violet-100 via-violet-50 to-purple-100 flex items-center justify-center border border-violet-200/50",children:y?(0,t.jsx)("div",{className:"w-5 h-5 border-2 border-violet-200 border-t-violet-500 rounded-full animate-spin"}):e?(0,t.jsx)("img",{src:w,alt:i,className:"object-cover w-full h-full",onError:e=>{e.currentTarget.style.display="none"}}):null}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col justify-center",children:[(0,t.jsx)("p",{className:"truncate text-xl font-semibold text-neutral-dark",children:g?.title||i}),(0,t.jsx)("p",{className:"truncate text-base font-medium text-gray-500 mt-1",children:g?.description||g?.siteName||(b?"YouTube":"Link")})]})]})}if(e===l.FILE_TYPES.IMAGE||e===l.FILE_TYPES.VIDEO||e===l.FILE_TYPES.FOLDER){let n=r&&r.trim().length>0;return(0,t.jsxs)("div",{className:"flex gap-6 rounded-3xl bg-off-white p-2.5 min-w-0 items-center",children:[(0,t.jsx)("div",{className:"relative w-40 h-24 shrink-0 overflow-hidden rounded-2xl bg-linear-to-br from-violet-100 to-violet-50 flex items-center justify-center",children:n?(0,t.jsx)("img",{src:r,alt:i,className:"object-cover w-full h-full"}):(0,t.jsx)("div",{className:"w-full h-full bg-linear-to-br from-violet-100 via-violet-50 to-purple-100"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col justify-center",children:[(0,t.jsx)("p",{className:"truncate text-xl font-semibold text-neutral-dark",children:i}),(0,t.jsx)("p",{className:"truncate text-base font-medium text-gray-500 mt-1",children:e===l.FILE_TYPES.IMAGE?"Image":"Video"})]})]})}if(f)return(0,t.jsxs)("div",{className:"flex gap-6 rounded-3xl bg-off-white p-2.5 min-w-0 items-center",children:[(0,t.jsx)("div",{className:"relative w-40 h-24 shrink-0 overflow-hidden rounded-2xl bg-white flex items-center justify-center border border-gray-200",children:(0,t.jsx)(n.default,{src:f,alt:"",width:80,height:80,className:"h-20 w-20","aria-hidden":"true"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col justify-center",children:[(0,t.jsx)("p",{className:"truncate text-xl font-semibold text-neutral-dark",children:i}),(0,t.jsx)("p",{className:"truncate text-base font-medium text-gray-500 mt-1",children:s.toUpperCase()})]})]});if(m){let e=m.icon;return(0,t.jsxs)("div",{className:"flex gap-6 rounded-3xl bg-off-white p-2.5 min-w-0 items-center",children:[" ",(0,t.jsx)("div",{className:`w-40 h-24 shrink-0 rounded-2xl flex items-center justify-center shadow-sm ${m.bg}`,children:(0,t.jsx)(e,{className:`w-8 h-8 ${m.color}`})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col justify-center",children:[(0,t.jsx)("p",{className:"truncate text-xl font-semibold text-neutral-dark",children:i}),(0,t.jsx)("p",{className:"truncate text-base font-medium text-gray-500 mt-1",children:s.charAt(0).toUpperCase()+s.slice(1)})]})]})}let k=r&&r.trim().length>0;return(0,t.jsxs)("div",{className:"flex gap-6 rounded-3xl bg-off-white p-2.5 min-w-0 items-center",children:[(0,t.jsx)("div",{className:"relative w-40 h-24 shrink-0 overflow-hidden rounded-2xl bg-violet-100 flex items-center justify-center",children:k?(0,t.jsx)("img",{src:r,alt:i,className:"object-cover w-full h-full"}):(0,t.jsx)("div",{className:"w-full h-full bg-linear-to-br from-violet-100 via-violet-50 to-purple-100"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex flex-col justify-center",children:[(0,t.jsx)("p",{className:"truncate text-xl font-semibold text-neutral-dark",children:i}),(0,t.jsx)("p",{className:"truncate text-base font-medium text-gray-500 mt-1",children:"File"})]})]})}])},81627,e=>{"use strict";e.i(7659),e.i(7952),e.i(60802),e.i(52757),e.i(96021),e.i(85863),e.i(34422),e.i(67242),e.i(49036),e.i(71068),e.i(80724),e.i(71838),e.i(55209),e.i(89758),e.i(59545),e.i(15401),e.s([])},27518,e=>{"use strict";var t=e.i(43476),n=e.i(71645),r=e.i(7952);e.i(16787);var i=e.i(57843),o=e.i(53736),s=e.i(64659),l=e.i(31278),a=e.i(72103),d=e.i(73828),c=e.i(79930),h=e.i(2699),u=e.i(57688);let p=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;
94e.s(["InviteMemberModal",0,function({open:e,onClose:f,onSend:m,onUpdateMemberRole:g,onRemoveMember:y,isLoading:x,isLoadingMembers:b,updatingMemberId:w=null,removingMemberId:v=null,canUpdateMemberRole:k=!1,existingMembers:C=[],title:N="Invite Members",description:S="Invite people to collaborate on this board.",invitationQuota:M}){var j;let T=(j=M)&&null!==j.totalAllowed?{used:void 0!==j.used?j.used:j.totalAllowed-(j.remaining??0),isLimitReached:void 0!==j.isLimitReached?j.isLimitReached:(j.remaining??0)<=0}:{used:0,isLimitReached:!1},[A,E]=(0,n.useState)(""),[R,D]=(0,n.useState)(null),[O,P]=(0,n.useState)(a.MemberRole.VIEWER),[L,I]=(0,n.useState)(!1),[z,$]=(0,n.useState)(null),[H,F]=(0,n.useState)({top:0,left:0}),B=(0,n.useRef)(null),V=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!L&&!z)return;let e=e=>{let t=e.target;if(B.current&&!B.current.contains(t)&&I(!1),z){let e=V.current?.contains(t),n=t?.closest?.("[data-member-role-dropdown]");e||n||$(null)}};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[L,z]),(0,n.useEffect)(()=>{if(!e){let e=setTimeout(()=>{E(""),D(null),P(a.MemberRole.VIEWER),I(!1),$(null)},0);return()=>clearTimeout(e)}},[e]);let _=e=>{if(e?.preventDefault(),T.isLimitReached)return void D("Invitation limit reached.");let t=(()=>{let e=A.trim();return e?p.test(e.trim())?C.some(t=>t.email.toLowerCase()===e.toLowerCase())?(D("That email is already in the members list."),null):(D(null),e):(D("Enter a valid email address."),null):(D("Enter an email address."),null)})();t&&m([{email:t,role:O}])},W=A.trim().length>0&&!x&&!T.isLimitReached,U=e=>{switch(e){case a.MemberRole.ADMIN:return"Admin";case a.MemberRole.EDITOR:return"Editor";case a.MemberRole.VIEWER:return"Viewer";default:return""}},K=e=>"1"===e||"Admin"===e?"Admin":"2"===e||"Editor"===e?"Editor":"Viewer",q=[a.MemberRole.VIEWER,a.MemberRole.EDITOR],J=[...C].sort((e,t)=>{let n=K(e.role),r=K(t.role);return n===r?0:"Admin"===n?-1:+("Admin"===r)}),{scrollRef:Y,showFade:X}=(0,o.useScrollFade)([e,b,J.length]);return(0,t.jsx)(r.CenterModal,{open:e,onClose:f,className:"max-w-150",children:(0,t.jsxs)("div",{className:"relative w-full max-w-150 rounded-4xl bg-white py-8 px-4 shadow-modal ",children:[(0,t.jsx)("button",{type:"button",onClick:f,className:"absolute right-5 top-5 inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100 hover:text-gray-600","aria-label":"Close invite members modal",children:(0,t.jsx)(u.default,{src:d.default,alt:"Close",width:32,height:32})}),(0,t.jsxs)("div",{className:"mx-auto flex max-w-105 flex-col items-center text-center",children:[(0,t.jsx)("div",{className:"mb-2 flex h-28 w-25 items-center justify-center ",children:(0,t.jsx)(u.default,{src:h.default,alt:"Invite User",width:113,height:100})}),(0,t.jsx)("h2",{className:"text-32 font-bold text-neutral-dark leading-10",children:N}),(0,t.jsx)("p",{className:"mt-1 text-lg font-semibold font-sans text-slate-500",children:S})]}),(0,t.jsxs)("div",{className:"bg-off-white p-5 rounded-3xl mt-10",children:[(0,t.jsxs)("form",{onSubmit:_,className:" space-y-3 border-b border-gray-200 pb-6",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 ",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2 rounded-2xl border border-gray-200 bg-white py-1.5 pr-1.5 pl-5",children:[(0,t.jsx)("input",{type:"email",placeholder:"e.g. [email protected]",value:A,onChange:e=>{E(e.target.value),D(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),_())},className:"min-w-0 flex-1 bg-transparent text-sm text-neutral-dark outline-none placeholder:text-slate-500 placeholder:text-base placeholder:font-medium",autoFocus:!0,disabled:x}),(0,t.jsxs)("div",{className:"relative shrink-0",ref:B,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>!x&&I(e=>!e),disabled:x,className:"inline-flex h-13 items-center gap-1 rounded-xl bg-off-white px-3 text-sm font-semibold text-slate-400 transition-colors hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-60",children:[U(O),(0,t.jsx)(s.ChevronDown,{className:`h-4 w-4 transition-transform ${L?"rotate-180":""}`})]}),L&&(0,t.jsx)("div",{className:"absolute right-0 top-[calc(100%+0.625rem)] z-20 w-32 overflow-hidden rounded-xl border border-slate-200 bg-white py-1 shadow-xl",children:q.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{P(e),I(!1)},className:`block w-full px-3 py-2 text-left text-base font-medium transition-colors ${O===e?"bg-primary-light/10 text-nuetral-dark":"text-gray-600 hover:bg-slate-50"}`,children:U(e)},e))})]})]}),(0,t.jsx)("button",{type:"submit",disabled:!W,className:"inline-flex h-15 shrink-0 items-center justify-center shadow-subtle rounded-2xl bg-primary px-4 text-lg font-semibold text-white transition-colors hover:bg-primary disabled:cursor-not-allowed disabled:bg-primary/40",children:x?"Sending...":"Send Invite"})]}),R&&(0,t.jsx)("p",{className:"px-1 text-xs font-medium text-red-500",children:R}),M&&null!==M.totalAllowed&&(0,t.jsxs)("div",{className:"space-y-2 rounded-2xl bg-slate-50 px-4 py-3",children:[(0,t.jsxs)("div",{className:"text-xs text-slate-500",children:["Currently using"," ",(0,t.jsxs)("span",{className:"font-semibold text-slate-700",children:[T.used," out of ",M.totalAllowed]})," ","available shares"]}),(0,t.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-slate-200",children:(0,t.jsx)("div",{className:`h-full rounded-full transition-all ${T.isLimitReached?"bg-sb-red":"bg-primary"}`,style:{width:`${Math.min(T.used/M.totalAllowed*100,100)}%`}})}),T.isLimitReached&&(0,t.jsx)("p",{className:"text-xs font-medium text-sb-red",children:"Invitation limit reached."})]})]}),(0,t.jsxs)("div",{className:"mt-6 rounded-card bg-slate-50",children:[(0,t.jsx)("div",{className:"mb-3 text-base font-semibold font-sans text-gray-400",children:"Members List"}),b?(0,t.jsxs)("div",{className:"flex items-center justify-center py-10 text-sm text-slate-500",children:[(0,t.jsx)(l.L
94oader2,{className:"mr-2 h-4 w-4 animate-spin text-violet-600"}),"Loading members..."]}):J.length>0?(0,t.jsxs)("div",{className:"relative flex-1 overflow-hidden",children:[(0,t.jsx)("div",{ref:Y,className:"max-h-80 space-y-3 overflow-y-auto pr-1",children:J.map(e=>{var n;let r=e.status?.toLowerCase()==="pending",o=K(e.role),d="1"===(n=e.role)||"Admin"===n?a.MemberRole.ADMIN:"2"===n||"Editor"===n?a.MemberRole.EDITOR:a.MemberRole.VIEWER,h=e.userId||e.email,p=k&&!!g&&!r&&"Admin"!==o&&!!e.userId,f=!!e.userId&&w===e.userId,m=!!e.userId&&v===e.userId,x=!!w||!!v;return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[e.profileImage?(0,t.jsx)(u.default,{src:e.profileImage,width:50,height:50,alt:e.fullName||e.email,className:"h-12 w-12 border-2 border-white bg-light-gray shrink-0 rounded-full object-cover "}):(0,t.jsx)("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full text-base font-sans font-semibold text-neutral-dark border-2 border-white bg-light-gray",children:(e.fullName||e.email).charAt(0).toUpperCase()}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"truncate text-base font-semibold text-neutral-dark",children:e.fullName||e.email}),(0,t.jsxs)("p",{className:"truncate text-base font-sans text-slate-400 font-semibold",children:[e.email,r&&(0,t.jsx)("span",{className:"ml-1 text-slate-400",children:"(Invite sent)"})]})]})]}),"Admin"===o?(0,t.jsx)("div",{className:"inline-flex shrink-0 items-center rounded-tile bg-white px-4 py-2 text-sm font-semibold text-slate-400 ",children:"Admin"}):p?(0,t.jsxs)("div",{className:"relative shrink-0",children:[(0,t.jsx)("button",{ref:V,type:"button",disabled:x,onMouseDown:e=>e.stopPropagation(),onClick:()=>{$(e=>{if(e===h)return null;if(V.current){let e=V.current.getBoundingClientRect();F({top:e.bottom+window.scrollY+8,left:e.right+window.scrollX-128})}return h})},className:"inline-flex shrink-0 items-center gap-1.5 rounded-tile bg-white px-4 py-2 text-sm font-semibold text-slate-400 disabled:cursor-not-allowed disabled:opacity-60",children:f||m?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.Loader2,{className:"h-3.5 w-3.5 animate-spin text-violet-600"}),m?"Removingâ¦":"Updatingâ¦"]}):(0,t.jsxs)(t.Fragment,{children:[o,(0,t.jsx)(s.ChevronDown,{className:`h-4 w-4 transition-transform ${z===h?"rotate-180":""}`})]})}),z===h&&(0,t.jsx)(i.Portal,{children:(0,t.jsxs)("div",{"data-member-role-dropdown":!0,onMouseDown:e=>e.stopPropagation(),className:"fixed z-100 w-44 overflow-hidden rounded-2xl bg-white p-3 shadow-dropdown",style:{to
94p:`${H.top}px`,left:`${H.left}px`},children:[(0,t.jsxs)("button",{type:"button",disabled:x,onClick:()=>{$(null),g?.(e,a.MemberRole.VIEWER)},className:`flex w-full items-center mt-1 gap-3 py-2 pl-3 pr-3 text-left text-base font-seimibold transition-colors ${d===a.MemberRole.VIEWER?" bg-primary-light/10 text-primary-light rounded-tr-xl rounded-br-xl rounded-bl-xl":"text-neutral-dark hover:bg-primary-light/10 hover:text-primary-light rounded-tr-xl rounded-br-xl rounded-bl-xl"} disabled:cursor-not-allowed`,children:[(0,t.jsx)("span",{children:"Can View"}),d===a.MemberRole.VIEWER&&(0,t.jsx)(u.default,{src:c.default,alt:"",width:16,height:16,className:"ml-auto"})]}),(0,t.jsxs)("button",{type:"button",disabled:x,onClick:()=>{$(null),g?.(e,a.MemberRole.EDITOR)},className:`flex w-full items-center gap-3 py-2 pl-3 pr-3 text-left text-base font-semibold transition-colors ${d===a.MemberRole.EDITOR?" bg-primary-light/10 text-primary-light rounded-tr-xl rounded-br-xl rounded-bl-xl":"text-neutral-dark hover:bg-primary-light/10 hover:text-primary-light rounded-tr-xl rounded-br-xl rounded-bl-xl"} disabled:cursor-not-allowed`,children:[(0,t.jsx)("span",{children:"Can Edit"}),d===a.MemberRole.EDITOR&&(0,t.jsx)(u.default,{src:c.default,alt:"",width:16,height:16,className:"ml-auto"})]}),y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"my-1 h-px bg-gray-200"}),(0,t.jsx)("button",{type:"button",disabled:x,onClick:()=>{$(null),y(e)},className:"block w-full px-3 py-2 text-left text-base font-seimbold text-sb-red transition-colors hover:bg-red-50 disabled:cursor-not-allowed",children:"Remove"})]})]})})]}):(0,t.jsx)("div",{className:"inline-flex shrink-0 items-center rounded-tile bg-white px-2 py-4 text-sm font-semibold text-slate-400 ",children:o})]},h)})}),(0,t.jsx)(o.ScrollFadeOverlay,{show:X})]}):(0,t.jsx)("p",{className:"py-8 text-center text-sm text-slate-400",children:"No members yet."})]})]})]})})}])},77330,78497,28755,8921,e=>{"use strict";var t=e.i(43476),n=e.i(57688),r=e.i(83627),i=e.i(86536),o=e.i(27612),s=e.i(72103),l=e.i(3015),a=e.i(7952);e.s(["MemberRoleModal",0,function({open:e,onClose:d,member:c,onMakeEditor:h,onMakeViewer:u,onRemove:p,onDeleteInvite:f,isUpdating:m,isRemoving:g}){if(!c)return null;let y=(e=>{switch(e){case"Admin":return s.MemberRole.ADMIN;case"Editor":return s.MemberRole.EDITOR;default:return s.MemberRole.VIEWER}})(c.role),x=c.status?.toLowerCase()==="pending";return(0,t.jsx)(a.CenterModal,{open:e,onClose:d,className:"max-w-xs",children:(0,t.jsxs)("div",{className:"p-8",children:[(0,t.jsxs)("div",{className:"text-center mb-6",children:[c.profileImage?(0,t.jsx)(n.default,{src:c.profileImage,alt:c.fullName||c.email||"Member",width:56,height:56,className:"w-14 h-14 rounded-full object-cover mx-auto mb-3",unoptimized:!0}):(0,t.jsx)("div",{className:`w-14 h-14 rounded-full ${(0,l.getAvatarColor)(c.fullName||c.email||"?")} flex items-center justify-center text-white font-bold text-xl mx-auto mb-3`,children:(c.fullName||c.email||"?").charAt(0).toUpperCase()}),(0,t.jsx)("h3",{className:"text-base font-bold text-gray-900",children:c.fullName||c.email}),c.fullName&&(0,t.jsx)("p",{className:"text-xs text-gray-500",children:c.email})]}),(0,t.jsx)("div",{className:"space-y-1",children:y!==s.MemberRole.ADMIN&&(0,t.jsxs)(t.Fragment,{children:[!x&&"Viewer"!==c.role&&(0,t.jsxs)("button",{onClick:u,disabled:m,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-gray-50 rounded-xl transition-colors text-sm disabled:opacity-50",children:[(0,t.jsx)(i.Eye,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)("span",{className:"font-medium text-gray-700",children:"Make as viewer"})]}),!x&&"Editor"!==c.role&&(0,t.jsxs)("button",{onClick:h,disabled:m,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-gray-50 rounded-xl transition-colors text-sm disabled:opacity-50",children:[(0,t.jsx)(r.Edit3,{className:"w-4 h-4 text-gray-400"}),(0,t.jsx)("span",{className:"font-medium text-gray-700",children:"Make as editor"})]}),x?(0,t.jsxs)("button",{onClick:()=>f?.(c.email),disabled:g,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-red-50 text-red-600 rounded-xl transition-colors text-sm disabled:opacity-50",children:[(0,t.jsx)(o.Trash2,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"font-bold",children:"Delete invitation"})]}):(0,t.jsxs)("button",{onClick:p,disabled:g,className:"w-full flex items-center gap-3 px-4 py-3 text-left hover:bg-red-50 text-red-600 rounded-xl transition-colors text-sm disabled:opacity-50",children:[(0,t.jsx)(o.Trash2,{className:"w-4 h-4"}),(0,t.jsx)("span",{className:"font-bold",children:"Remove from board"})]})]})}),(0,t.jsx)("button",{onClick:d,className:"w-full mt-6 py-3 px-4 bg-gray-100 rounded-xl text-gray-700 font-bold hover:bg-gray-200 transition-colors text-sm",children:"Cancel"})]})})}],77330);var d=e.i(7659),c=e.i(92270);e.s(["LeaveBoardModal",0,function({open:e,onCancel:n,onConfirm:r,isLoading:i}
94){return(0,t.jsx)(d.ConfirmModal,{open:e,icon:(0,t.jsx)(c.LogOut,{className:"w-6 h-6 text-orange-500"}),iconBg:"bg-orange-50",title:"Leave Board",message:"Are you sure you want to leave this board? You won't be able to access it anymore.",onNo:n,onYes:r,yesLoading:i,noText:"Cancel",yesText:"Leave Board",danger:!0})}],78497);let h=(0,e.i(75254).default)("user-minus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);e.s(["RemoveMemberModal",0,function({open:e,onCancel:n,onConfirm:r,isLoading:i,memberName:o}){return(0,t.jsx)(d.ConfirmModal,{open:e,icon:(0,t.jsx)(h,{className:"w-6 h-6 text-red-500"}),iconBg:"bg-red-50",title:"Remove Member",message:o?`Are you sure you want to remove ${o}?`:"Are you sure you want to remove this member?",onNo:n,onYes:r,yesLoading:i,noText:"Cancel",yesText:"Remove",danger:!0})}],28755);var u=e.i(66027),p=e.i(54616),f=e.i(12598),m=e.i(83562),g=e.i(32341),y=e.i(73635);let x=["board-invitations","pending"];e.s(["useBoardInvitations",0,function(){let{token:e}=(0,g.useAuth)(),t=(0,f.useQueryClient)(),{data:n=[],isLoading:r}=(0,u.useQuery)({queryKey:x,queryFn:async()=>{let e=await m.membersAPI.getPendingInvitations();return e.isSuccess&&Array.isArray(e.value)?e.value:[]},enabled:!!e,refetchOnMount:!0,refetchOnWindowFocus:!0,retry:2}),i=(0,p.useMutation)({mutationFn:({invitationId:e,action:t})=>m.membersAPI.respondToInvitation(e,t),onSuccess:(e,{invitationId:n,action:r})=>{t.setQueryData(x,e=>(e??[]).filter(e=>e.invitationId!==n)),t.invalidateQueries({queryKey:["boards"]}),window.dispatchEvent(new CustomEvent("sb:refresh-notifications")),r===s.InvitationAction.Accepted?(0,y.showToast)("invitationAcceptedSuccessfully"):(0,y.showToast)("invitationRejectedSuccessfully")},onError:e=>{(0,y.showToastError)(e,"failedToRespondToInvitation")}});return{pendingBoardInvitations:n,isLoadingBoardInvitations:r,acceptBoardInvitation:e=>i.mutateAsync({invitationId:e,action:s.InvitationAction.Accepted}),rejectBoardInvitation:e=>i.mutateAsync({invitationId:e,action:s.InvitationAction.Rejected}),isHandlingBoardInvitation:i.isPending}}],8921)},59545,53287,e=>{"use strict";e.i(27518),e.i(77330),e.i(78497),e.i(28755);var t=e.i(43476),n=e.i(8921),r=e.i(43531),i=e.i(37727),o=e.i(63488),s=e.i(84614),l=e.i(32181),a=e.i(88653);e.s(["BoardPendingInvitationsModal",0,function({open:e,onClose:d}){let{pendingBoardInvitations:c,acceptBoardInvitation:h,rejectBoardInvitation:u,isHandlingBoardInvitation:p}=(0,n.useBoardInvitations)();return e?(0,t.jsxs)("div",{className:"fixed inset-0 z-100 flex items-center justify-center p-4",children:[(0,t.jsx)(l.motion.div,{initial:{opacity:0}
94,animate:{opacity:1},exit:{opacity:0},onClick:d,className:"absolute inset-0 bg-black/40 backdrop-blur-sm"}),(0,t.jsxs)(l.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},className:"relative w-full max-w-lg bg-white rounded-3xl shadow-2xl overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-8 py-6 border-b border-gray-100 flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-extrabold text-gray-900 tracking-tight",children:"Board Invitations"}),(0,t.jsxs)("p",{className:"text-sm text-gray-500 font-medium",children:["You have ",c.length," pending requests"]})]}),(0,t.jsx)("button",{onClick:d,className:"p-2 hover:bg-gray-100 rounded-xl transition-colors text-gray-400 hover:text-gray-600",children:(0,t.jsx)(i.X,{size:20})})]}),(0,t.jsx)("div",{className:"max-h-100 overflow-y-auto p-4",children:(0,t.jsx)(a.AnimatePresence,{mode:"popLayout",children:0===c.length?(0,t.jsxs)(l.motion.div,{initial:{opacity:0}
94,animate:{opacity:1},className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,t.jsx)("div",{className:"w-16 h-16 bg-gray-50 rounded-full flex items-center justify-center mb-4",children:(0,t.jsx)(o.Mail,{className:"w-8 h-8 text-gray-300"})}),(0,t.jsx)("p",{className:"text-gray-500 font-bold",children:"No pending invitations"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"You're all caught up!"})]}):(0,t.jsx)("div",{className:"space-y-3",children:c.map(e=>(0,t.jsx)(l.motion.div,{layout:!0,initial:{opacity:0,x:-20},animate:{opacity:1,x:0},exit:{opacity:0,scale:.95},className:"p-4 bg-gray-50 hover:bg-white hover:shadow-md border border-transparent hover:border-gray-100 rounded-2xl transition-all group",children:(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[(0,t.jsx)("div",{className:"w-12 h-12 bg-violet-100 rounded-xl flex items-center justify-center shrink-0 group-hover:scale-110 transition-transform",children:(0,t.jsx)("span",{className:"text-2xl",children:e.boardIcon||"ð"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,t.jsx)("span",{className:"font-bold text-gray-900 truncate",children:e.boardName})}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[e.invitedBy&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-gray-500",children:[(0,t.jsx)(s.User,{size:12,className:"text-gray-400"}),(0,t.jsxs)("span",{children:["Invited by"," ",(0,t.jsx)("span",{className:"font-semibold text-gray-700",children:e.invitedBy})]})]}),e.invitedByEmail&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-gray-400",children:[(0,t.jsx)(o.Mail,{size:12}),(0,t.jsx)("span",{className:"truncate",children:e.invitedByEmail})]}),!e.invitedBy&&!e.invitedByEmail&&(0,t.jsxs)("div",{className:"text-[10px] text-gray-400 italic",children:["Invitation received on"," ",new Date(e.createdAt).toLocaleDateString()]})]})]}),(0,t.jsxs)("div",{className:"flex gap-2 self-center",children:[(0,t.jsx)("button",{disabled:p,onClick:()=>h(e.invitationId),className:"w-10 h-10 bg-green-500 hover:bg-green-600 text-white rounded-xl flex items-center justify-center shadow-lg shadow-green-100 transition-all active:scale-95 disabled:opacity-50",title:"Accept",children:(0,t.jsx)(r.Check,{size:18,strokeWidth:3})}),(0,t.jsx)("button",{disabled:p,onClick:()=>u(e.invitationId),className:"w-10 h-10 bg-white border border-gray-200 text-gray-400 hover:text-red-500 hover:border-red-100 hover:bg-red-50 rounded-xl flex items-center justify-center transition-all active:scale-95 disabled:opacity-50",title:"Reject",children:(0,t.jsx)(i.X,{size:18,strokeWidth:3})})]})]})},e.invitationId))})})}),(0,t.jsx)("div",{className:"p-6 bg-gray-50/50 border-t border-gray-100",children:(0,t.jsx)("button",{onClick:d,className:"w-full py-3 bg-white border border-gray-200 text-gray-600 font-bold rounded-2xl hover:bg-gray-50 transition-all active:scale-[0.98]",children:"Close"})})]})]}):null}],53287),e.s([],59545)},78522,61111,e=>{"use strict";var t=e.i(43476),n=e.i(71645),r=e.i(36450),i=e.i(57688),o=e.i(7952),s=e.i(3015),l=e.i(73828),a=e.i(35500);let d={src:e.i(34930).default,width:20,height:20,blurWidth:0,blurHeight:0},c={src:e.i(52700).default,width:20,height:20,blurWidth:0,blurHeight:0},h={src:e.i(98950).default,width:20,height:20,blurWidth:0,blurHeight:0},u=(e,t,n)=>Math.min(Math.max(e,t),Math.max(t,n));e.s(["EditProfilePhotoModal",0,function({open:e,onClose:p,imageSrc:f,onSave:m,isLoading:g,title:y="Edit your profile picture",description:x="Drag to reposition or zoom to crop."}){let[b,w]=(0,n.useState)({x:0,y:0}),[v,k]=(0,n.useState)(1),[C,N]=(0,n.useState)(0),[S,M]=(0,n.useState)(null),[j,T]=(0,n.use
94State)({width:200,height:200}),[A,E]=(0,n.useState)(!1),R=(0,n.useRef)(null),D=(0,n.useRef)(null),[O,P]=(0,n.useState)(null),L=e?f??"current":null;L!==O&&(P(L),w({x:0,y:0}),k(1),N(0),M(null),T({width:200,height:200}),E(!1));let[I,z]=(0,n.useState)(!1);!!g!==I&&(z(!!g),I&&!g&&E(!1));let $=(0,n.useCallback)((e,t)=>{M(t)},[]),H=(e,t)=>{e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),D.current={handle:t,startX:e.clientX,startY:e.clientY,startW:j.width,startH:j.height}},F=e=>{let t=D.current;if(!t)return;e.preventDefault();let n=e.clientX-t.startX,r=e.clientY-t.startY,i=R.current,o=(i?.clientWidth??400)-32,s=(i?.clientHeight??320)-32,l=t.startW,a=t.startH;t.handle.includes("l")&&(l=t.startW-2*n),t.handle.includes("r")&&(l=t.startW+2*n),t.handle.includes("t")&&(a=t.startH-2*r),t.handle.includes("b")&&(a=t.startH+2*r),T({width:u(l,96,o),height:u(a,96,s)})},B=e=>{D.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},V=(v-1)/2*100,_=A||!!g,W=async()=>{if(!_&&f&&S){E(!0);try{let e=await (0,s.getCroppedImg)(f,S,C,"profile-image.png");m(e)}catch{E(!1)}}};return(0,t.jsx)(o.CenterModal,{open:e&&!!f,onClose:p,className:"max-w-150! rounded-4xl shadow-modal",children:(0,t.jsxs)("div",{className:"relative w-full rounded-3xl bg-white p-6 sm:p-8 shadow-modal",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-neutral-dark",children:y}),(0,t.jsx)("button",{type:"button",onClick:p,className:"inline-flex shrink-0 rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100","aria-label":"Close",children:(0,t.jsx)(i.default,{src:l.default,alt:"Close",width:24,height:24})})]}),(0,t.jsx)("div",{className:"mt-4 border-t border-gray-200"}),(0,t.jsxs)("div",{className:"mt-5 rounded-card bg-off-white p-3",children:[(0,t.jsxs)("div",{ref:R,className:"relative h-80 w-full overflow-hidden rounded-3xl bg-[#E0E0E0] dark:bg-surface-raised",children:[f&&(0,t.jsx)(r.default,{image:f,crop:b,zoom:v,rotation:C,cropShape:"rect",cropSize:j,showGrid:!1,minZoom:1,maxZoom:3,onCropChange:w,onZoomChange:k,onRotationChange:N,onCropComplete:$,style:{cropAreaStyle:{border:"none",borderRadius:12,color:"rgba(17, 24, 39, 0.7)"}}}),(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"relative",style:{width:j.width,height:j.height},children:[(0,t.jsx)("span",{onPointerDown:e=>H(e,"tl"),onPointerMove:F,onPointerUp:B,onPointerCancel:B,className:"pointer-events-auto absolute left-0 top-0 h-7 w-7 cursor-nwse-resize touch-none rounded-tl-xl border-l-3 border-t-3 border-primary-light"}),(0,t.jsx)("span",{onPointerDown:e=>H(e,"tr"),onPointerMove:F,onPointerUp:B,onPointerCancel:B,className:"pointer-events-auto absolute right-0 top-0 h-7 w-7 cursor-nesw-resize touch-none rounded-tr-xl border-r-3 border-t-3 border-primary-light"}),(0,t.jsx)("span",{onPointerDown:e=>H(e,"bl"),onPointerMove:F,onPointerUp:B,onPointerCancel:B,className:"pointer-events-auto absolute bottom-0 left-0 h-7 w-7 cursor-nesw-resize touch-none rounded-bl-xl border-b-3 border-l-3 border-primary-light"}),(0,t.jsx)("span",{onPointerDown:e=>H(e,"br"),onPointerMove:F,onPointerUp:B,onPointerCancel:B,className:"pointer-events-auto absolute bottom-0 right-0 h-7 w-7 cursor-nwse-resize touch-none rounded-br-xl border-b-3 border-r-3 border-primary-light"}),(0,t.jsx)("span",{onPointerDown:e=>H(e,"t"),onPointerMove:F,onPointerUp:B,onPointerCancel:B,className:"pointer-events-auto absolute left-1/2 top-0 h-2 w-10 -translate-x-1/2 -translate-y-1/2 cursor-ns-resize touch-none rounded-full border-t-3 border-primary-light"}),(0,t.jsx)("span",{onPointerDown:e=>H(e,"b"),onPointerMove:F,onPointerUp:B,onPointerCancel:B,className:"pointer-events-auto absolute bottom-0 left-1/2 h-2 w-10 -translate-x-1/2 translate-y-1/2 cursor-ns-resize touch-none rounded-full border-b-3 border-primary-light"})]})})]}),(0,t.jsx)("p",{className:"mt-3 text-center text-base font-medium text-gray-400",children:x}),(0,t.jsxs)("div",{className:"mt-5 rounded-card bg-white p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-lg font-semibold text-neutral-dark",children:"Rotate Image"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>N(e=>(e-90+360)%360),className:"flex h-11.5 w-11.5 items-center justify-center rounded-xl bg-off-white transition-colors hover:bg-gray-100","aria-label":"Rotate counter-clockwise",children:(0,t.jsx)(i.default,{src:c,alt:"",width:20,height:20})}),(0,t.jsx)("button",{type:"button",onClick:()=>N(e=>(e+90)%360),className:"flex h-11.5 w-11.5 items-center justify-center rounded-xl bg-off-white transition-colors hover:bg-gray-100","aria-label":"Rotate clockwise",children:(0,t.jsx)(i.default,{src:h,alt:"",width:20,height:20})})]})]}),(0,t.jsx)("div",{className:"my-4 border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("span",{className:"flex h-11.5 w-11.5\n shrink-0 items-center justify-center rounded-xl bg-off-white",children:(0,t.jsx)(i.default,{src:a.default,alt:"",width:20,height:20})}),(0,t.jsx)("input",{type:"range",min:1,max:3,step:.01,value:v,onCh
94ange:e=>k(Number(e.target.value)),"aria-label":"Zoom",className:"sb-range w-full cursor-pointer",style:{background:`linear-gradient(to right, var(--color-primary-light) 0%, var(--color-primary-light) ${V}%, #f1f2f6 ${V}%, #f1f2f6 100%)`}}),(0,t.jsx)("span",{className:"flex h-11.5 w-11.5 shrink-0 items-center justify-center rounded-xl bg-off-white",children:(0,t.jsx)(i.default,{src:d,alt:"",width:28,height:28})})]})]})]}),(0,t.jsxs)("div",{className:"mt-6 flex items-center justify-end gap-3 border-t border-gray-200 pt-6",children:[(0,t.jsx)("button",{type:"button",onClick:p,disabled:_,className:"rounded-2xl bg-off-white px-6 py-3 text-lg font-semibold text-gray-600 transition-colors hover:bg-gray-600 disabled:opacity-50",children:"Cancel"}),(0,t.jsxs)("button",{type:"button",onClick:W,disabled:_||!S,className:"flex items-center gap-2 rounded-2xl bg-primary px-6 py-3 text-lg font-semibold text-white transition-colors hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50",children:[_&&(0,t.jsxs)("svg",{className:"h-4 w-4 animate-spin text-white",viewBox:"0 0 24 24","aria-hidden":"true",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),_?"Savingâ¦":"Save"]})]})]})})}],78522),e.s([],61111)},89758,68145,55504,91810,52704,82123,e=>{"use strict";e.i(16846),e.i(53560),e.i(78522),e.i(61111);var t=e.i(43476),n=e.i(71645),r=e.i(70756),i=e.i(7952),o=e.i(72813),s=e.i(56564),l=e.i(73828);let a={src:e.i(34374).default,width:96,height:96,blurWidth:0,blurHeight:0};var d=e.i(57688);e.s(["ChangePasswordModal",0,function({open:e,onClose:c,onForgotPassword:h,currentPassword:u,onCurrentPasswordChange:p,newPassword:f,onNewPasswordChange:m,confirmPassword:g,onConfirmPasswordChange:y,onSave:x,isLoading:b}
94){let[w,v]=(0,n.useState)({currentPassword:!1,password:!1,confirmPassword:!1});(0,n.useEffect)(()=>{if(!e){let e=setTimeout(()=>{v({currentPassword:!1,password:!1,confirmPassword:!1})},0);return()=>clearTimeout(e)}},[e]);let k=s.changePasswordSchema.safeParse({currentPassword:u,password:f,confirmPassword:g}),C=k.success,N=k.success?{currentPassword:null,password:null,confirmPassword:null}:{currentPassword:w.currentPassword||u?k.error.formErrors.fieldErrors.currentPassword?.[0]??null:null,password:w.password||f?k.error.formErrors.fieldErrors.password?.[0]??null:null,confirmPassword:w.confirmPassword||g?k.error.formErrors.fieldErrors.confirmPassword?.[0]??null:null};return(0,t.jsx)(i.CenterModal,{open:e,onClose:c,className:"max-w-150",children:(0,t.jsxs)("div",{className:"relative w-full max-w-150 rounded-4xl bg-white py-8 px-4 shadow-modal",children:[(0,t.jsx)("button",{type:"button",onClick:c,className:"absolute right-5 top-5 inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100 hover:text-gray-600","aria-label":"Close change password modal",children:(0,t.jsx)(d.default,{src:l.default,alt:"Close",width:32,height:32})}),(0,t.jsxs)("div",{className:"mx-auto flex max-w-105 flex-col items-center text-center",children:[(0,t.jsx)("div",{className:"mb-2 flex h-24 w-24 items-center justify-center",children:(0,t.jsx)(d.default,{src:a,alt:"",width:96,height:96})}),(0,t.jsx)("h2",{className:"text-32 font-bold text-neutral-dark leading-10",children:"Change Password"}),(0,t.jsx)("p",{className:"mt-1 text-lg font-semibold font-sans text-slate-500",children:"Update your password to keep your account secure."})]}),(0,t.jsx)("div",{className:"bg-off-white p-5 rounded-3xl mt-10",children:(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),C&&!b&&x()},className:"space-y-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark",children:"Current Password"}),h&&(0,t.jsx)("button",{type:"button",onClick:h,className:"text-xs font-bold text-primary hover:text-primary/80 transition-colors",children:"Forgot password?"})]}),(0,t.jsxs)("div",{className:"flex items-center border border-gray-200 rounded-2xl bg-white overflow-hidden focus-within:border-primary transition-colors",children:[(0,t.jsx)("div",{className:"pl-4 pr-2 py-3 text-gray-400 shrink-0",children:(0,t.jsx)(r.Lock,{className:"w-5 h-5"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 relative",children:[(0,t.jsx)("input",{type:"password",id:"_cp_current_pw_inline",autoComplete:"current-password",value:u,onChange:e=>{p(e.target.value),w.currentPassword||v(e=>({...e,currentPassword:!0}))},onBlur:()=>v(e=>({...e,currentPassword:!0})),autoFocus:!0,placeholder:"Enter current password",className:"w-full min-w-0 px-2 py-3 pr-12 border-none bg-transparent text-base font-medium text-neutral-dark outline-none placeholder:font-medium placeholder:text-gray-400 placeholder:text-base"}),(0,t.jsx)("button",{type:"button",onClick:()=>{let e=document.getElementById("_cp_current_pw_inline");e&&(e.type="password"===e.type?"text":"password")},className:"absolute right-0 top-1/2 -translate-y-1/2 pr-4 pl-2 py-3 text-gray-400 hover:text-gray-600 transition-colors",tabIndex:-1,"aria-label":"Toggle visibility",children:(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"})]})})]})]}),N.currentPassword&&(0,t.jsx)("p",{className:"text-xs font-medium text-red-500 mt-2 pl-1",children:N.currentPassword})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"New Password"}),(0,t.jsx)(o.default,{placeholder:"Enter new password",value:f,onChange:e=>{m(e.target.value),w.password||v(e=>({...e,password:!0}))},onBlur:()=>v(e=>({...e,password:!0})),className:"w-full",error:N.password??void 0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Confirm Password"}),(0,t.jsx)(o.default,{placeholder:"Confirm new password",value:g,onChange:e=>{y(e.target.value),w.confirmPassword||v(e=>({...e,confirmPassword:!0}))},onBlur:()=>v(e=>({...e,confirmPassword:!0})),className:"w-full",error:N.confirmPassword??void 0})]}),(0,t.jsx)("p",{className:"text-xs font-medium text-gray-400",children:"Use at least 8 characters with a mix of letters, numbers, and symbols for a stronger password."}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-3",children:[(0,t.jsx)("button",{type:"button",onClick:c,disabled:b,className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-white shadow-subtle text-gray-600 hover:bg-gray-50 border border-gray-100 disabled:opacity-50",children:"Cancel"}),(0,t.jsxs)("button",{type:"submit",disabled:!C||b,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2 disabled:opacity-50 hover:opacity-90",children:[b&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),b?"Updating...":"Update Password"]})]})]})})]})})}],68145);var c=e.i(54616),h=e.i(71689),u=e.i(3812),p=e.i(5451),f=e.i(73635),m=e.i(76352);let g={src:e.i(45106).default,width:96,height:96,blurWidth:0,blurHeight:0},y={src:e.i(32381).default,width:96,height:96,blurWidth:0,blurHeight:0},x={src:e.i(27408).default,width:96,height:96,blurWidth:0,blurHeight:0},b={src:e.i(59330).default,width:96,height:96,blurWidth:0,blurHeight:0};e.s(["ForgotPasswordModal",0,function({open:e,onClose:r,defaultEmail:a}
94){let[w,v]=(0,n.useState)("email"),[k,C]=(0,n.useState)(a??""),[N,S]=(0,n.useState)(null),[M,j]=(0,n.useState)(""),[T,A]=(0,n.useState)(""),[E,R]=(0,n.useState)(""),[D,O]=(0,n.useState)(""),[P,L]=(0,n.useState)(""),[I,z]=(0,n.useState)({email:!1,password:!1,confirmPassword:!1}),$=(0,n.useCallback)(()=>{v("email"),C(a??""),S(null),j(""),A(""),R(""),O(""),L(""),z({email:!1,password:!1,confirmPassword:!1})},[a]),H=(()=>{let e=null;if(k||I.email){let t=s.forgotPasswordSchema.safeParse({email:k});t.success||(e=t.error.formErrors.fieldErrors.email?.[0]??null)}let t=null,n=null;if(D||P||I.password||I.confirmPassword){let e=s.resetPasswordSchema.safeParse({password:D,confirmPassword:P});if(!e.success){let r=e.error.flatten().fieldErrors;t=r.password?.[0]??null,n=r.confirmPassword?.[0]??null}}return{email:e,password:t,confirmPassword:n}})();(0,n.useEffect)(()=>{e||queueMicrotask($)},[e,$]);let F=(0,c.useMutation)({mutationFn:e=>p.authAPI.forgotPassword({email:e.email}),onSuccess:e=>{j("string"==typeof e.value?e.value:""),v("otp"),S(null),(0,f.showToast)("verificationCodeSent")},onError:e=>{S(e.message)}}),B=(0,c.useMutation)({mutationFn:()=>p.authAPI.otpVerification({id:M,otp:T},!1),onSuccess:e=>{R("string"==typeof e.value?e.value:""),v("reset"),S(null),A("")},onError:e=>{S(e.message),A("")}}),V=(0,c.useMutation)({mutationFn:()=>p.authAPI.resetPassword({passwordResetToken:E,password:D,confirmPassword:P}),onSuccess:()=>{v("success"),S(null),(0,f.showToast)("passwordResetSuccessfully")},onError:e=>{S(e.message)}});return(0,t.jsx)(i.CenterModal,{open:e,onClose:r,className:"max-w-150",children:(0,t.jsxs)("div",{className:"relative w-full max-w-150 rounded-4xl bg-white py-8 px-4 shadow-modal",children:[(0,t.jsx)("button",{type:"button",onClick:r,className:"absolute right-5 top-5 inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100 hover:text-gray-600","aria-label":"Close forgot password modal",children:(0,t.jsx)(d.default,{src:l.default,alt:"Close",width:32,height:32})}),(0,t.jsx)("div",{className:"mx-auto flex max-w-105 flex-col items-center text-center",children:"email"===w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-2 flex h-24 w-24 items-center justify-center",children:(0,t.jsx)(d.default,{src:g,alt:"",width:96,height:96})}),(0,t.jsx)("h2",{className:"text-32 font-bold text-neutral-dark leading-10",children:"Forgot Password"}),(0,t.jsx)("p",{className:"mt-1 text-lg font-semibold font-sans text-slate-500",children:"No worries. We'll email you a 6-digit reset code."})]}):"otp"===w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-2 flex h-24 w-24 items-center justify-center",children:(0,t.jsx)(d.default,{src:y,alt:"",width:96,height:96})}),(0,t.jsx)("h2",{className:"text-32 font-bold text-neutral-dark leading-10",children:"Verify your email"}),(0,t.jsxs)("p",{className:"mt-1 text-lg font-semibold font-sans text-slate-500",children:["We sent a 6-digit code to"," ",(0,t.jsx)("span",{className:"font-bold text-neutral-dark",children:k})]})]}):"reset"===w?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-2 flex h-24 w-24 items-center justify-center",children:(0,t.jsx)(d.default,{src:x,alt:"",width:96,height:96})}),(0,t.jsx)("h2",{className:"text-32 font-bold text-neutral-dark leading-10",children:"Set a new password"}),(0,t.jsx)("p",{className:"mt-1 text-lg font-semibold font-sans text-slate-500",children:"Choose a strong password you haven't used before."})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"mb-2 flex h-24 w-24 items-center justify-center",children:(0,t.jsx)(d.default,{src:b,alt:"",width:96,height:96})}),(0,t.jsx)("h2",{className:"text-32 font-bold text-neutral-dark leading-10",children:"All done!"}),(0,t.jsx)("p",{className:"mt-1 text-lg font-semibold font-sans text-slate-500",children:"Your password has been updated successfully."})]})}),(0,t.jsx)("div",{className:"bg-off-white p-5 rounded-3xl mt-10",children:"email"===w?(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),S(null),s.forgotPasswordSchema.safeParse({email:k}).success&&F.mutate({email:k})},className:"space-y-5",children:[N&&(0,t.jsx)("div",{className:"p-4 bg-red-50 border border-red-100 rounded-2xl text-red-700 text-sm font-medium",children:N}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Email Address"}),(0,t.jsx)(u.Input,{type:"email",placeholder:"[email protected]",value:k,onChange:e=>{C(e.target.value),I.email||z(e=>({...e,email:!0}))},onBlur:()=>z(e=>({...e,email:!0})),error:H.email||void 0,disabled:!!a}),(0,t.jsx)("p",{className:"mt-2.5 text-sm font-medium text-gray-400",children:"We'll only use this to send you a reset link once."})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-3",children:[(0,t.jsx)("button",{type:"button",onClick:r,className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-white shadow-subtle text-gray-600 hover:bg-gray-50 border border-gray-100",children:"Cancel"}),(0,t.jsxs)("button",{type:"submit",disabled:F.isPending,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2 disabled:opacity-50 hover:opacity-90",children:[F.isPending&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),F.isPending?"Sending...":"Send code"]})]})]}):"otp"===w?(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),S(null);let t=s.otpSchema.safeParse(T);if(!t.success)return void S(t.error.errors[0].message);if(!M){S("Unable to verify code. Please request a new link."),v("email");return}B.mutate()},className:"space-y-5",children:[N&&(0,t.jsx)("div",{className:"p-4 bg-red-50 border border-red-100 rounded-2xl text-red-700 text-sm font-medium",children:N}),(0,t.jsx)("div",{className:"py-3",children:(0,t.jsx)(m.OTPInput,{length:6,value:T,onChange:e=>A(e),disabled:B.isPending})}),(0,t.jsx)("p",{className:"text-xs font-semibold text-gray-400 text-center",children:"Didn't get the code? It might be in your spam folder."}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center justify-end gap-3 pt-3",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>v("email"),className:"flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-5 py-3 rounded-2xl text-base font-sans font-semibold transition-colors bg-white shadow-subtle text-gray-600 hover:bg-gray-50 border border-gray-100",children:[(0,t.jsx)(h.ArrowLeft,{className:"w-4 h-4"}),"Back"]}),(0,t.jsx)("button",{type:"button",onClick:()=>{S(null),k&&F.mutate({email:k})},disabled:F.isPending,className:"flex-1 sm:flex-none inline-flex items-center justify-center px-5 py-3 rounded-2xl text-base font-sans font-semibold transition-colors bg-white border border-gray-100 text-primary hover:bg-off-white shadow-subtle disabled:opacity-50",children:F.isPending?"Resending...":"Resend code"}),(0,t.jsxs)("button",{type:"submit",disabled:6!==T.length||B.isPending,className:"flex-1 sm:flex-none inline-flex items-center justify-center gap-2 px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all disabled:opacity-50 hover:opacity-90",children:[B.isPending&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}
94),B.isPending?"Verifying...":"Verify code"]})]})]}):"reset"===w?(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),S(null),s.resetPasswordSchema.safeParse({password:D,confirmPassword:P}).success&&V.mutate()},className:"space-y-5",children:[N&&(0,t.jsx)("div",{className:"p-4 bg-red-50 border border-red-100 rounded-2xl text-red-700 text-sm font-medium",children:N}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"New Password"}),(0,t.jsx)(o.default,{placeholder:"At least 8 characters",value:D,onChange:e=>{O(e.target.value),I.password||z(e=>({...e,password:!0}))},onBlur:()=>z(e=>({...e,password:!0})),error:H.password??void 0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-semibold text-neutral-dark mb-3",children:"Confirm New Password"}),(0,t.jsx)(o.default,{placeholder:"Confirm your new password",value:P,onChange:e=>{L(e.target.value),I.confirmPassword||z(e=>({...e,confirmPassword:!0}))},onBlur:()=>z(e=>({...e,confirmPassword:!0})),error:H.confirmPassword??void 0})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-3",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>v("otp"),className:"inline-flex items-center justify-center gap-2 px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-white shadow-subtle text-gray-600 hover:bg-gray-50 border border-gray-100",children:[(0,t.jsx)(h.ArrowLeft,{className:"w-4 h-4"}),"Back"]}),(0,t.jsxs)("button",{type:"submit",disabled:V.isPending,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2 disabled:opacity-50 hover:opacity-90",children:[V.isPending&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),V.isPending?"Resetting...":"Reset Password"]})]})]}):(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)("p",{className:"text-center text-base font-semibold text-slate-500",children:"You can now sign in with your new password."}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsx)("div",{className:"flex items-center justify-end pt-3",children:(0,t.jsx)("button",{type:"button",onClick:r,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all hover:opacity-90",children:"Close"})})]})})]})})}],55504);var w=n,v={x:0,y:0,width:0,height:0,unit:"px"},k=(e,t,n)=>Math.min(Math.max(e,t),n),C=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function N(e,t,n){return"%"===e.unit?{...v,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function S(e,t,n){return e.unit&&"px"!==e.unit?{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...v,...e,unit:"px"}}function M(e,t,n,r,i,o=0,s=0,l=r,a=i){let d={...e},c=Math.min(o,r),h=Math.min(s,i),u=Math.min(l,r),p=Math.min(a,i);t&&(t>1?(h=(c=s?s*t:c)/t,u=l*t):(c=(h=o?o/t:h)*t,p=a/t)),d.y<0&&(d.height=Math.max(d.height+d.y,h),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,c),d.x=0);let f=r-(d.x+d.width);f<0&&(d.x=Math.min(d.x,r-c),d.width+=f);let m=i-(d.y+d.height);if(m<0&&(d.y=Math.min(d.y,i-h),d.height+=m),d.width<c&&(("sw"===n||"nw"==n)&&(d.x-=c-d.width),d.width=c),d.height<h&&(("nw"===n||"ne"==n)&&(d.y-=h-d.height),d.height=h),d.width>u&&(("sw"===n||"nw"==n)&&(d.x-=u-d.width),d.width=u),d.height>p&&(("nw"===n||"ne"==n)&&(d.y-=p-d.height),d.height=p),t){let e=d.width/d.height;if(e<t){let e=Math.max(d.width/t,h);("nw"===n||"ne"==n)&&(d.y-=e-d.height),d.height=e}else if(e>t){let e=Math.max(d.height*t,c);("sw"===n||"nw"==n)&&(d.x-=e-d.width),d.width=e}}return d}var j={capture:!0,passive:!1},T=0,A=class e extends w.PureComponent{static xOrds=["e","w"];static yOrds=["n","s"];static xyOrds=["nw","ne","se","sw"];static nudgeStep=1;static nudgeStepMedium=10;static nudgeStepLarge=100;static defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};get document(){return document}docMoveBound=!1;mouseDownOnCrop=!1;dragStarted=!1;evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0};componentRef=(0,w.createRef)();mediaRef=(0,w.createRef)();resizeObserver;initChangeCalled=!1;instanceId=`rc-${T++}`;state={cropIsActive:!1,newCropIsBeingDrawn:!1};getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:t,y:n,width:r,height:i}=e.getBoundingClientRect();return{x:t,y:n,width:r,height:i}}componentDidUpdate(e){let{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){let{width:e,height:r}=this.getBox();e&&r&&n(S(t,e,r),N(t,e,r))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||=(this.document.addEventListener("pointermove",this.onDocPointerMove,j),this.document.addEventListener("pointerup",this.onDocPointerDone,j),this.document.addEventListener("pointercancel",this.onDocPointerDone,j),!0)}unbindDocMove(){this.docMoveBound&&=(this.document.removeEventListener("pointermove",this.onDocPointerMove,j),this.document.removeEventListener("pointerup",this.onDocPointerDone,j),this.document.removeEventListener("pointercancel",this.onDocPointerDone,j),!1)}onCropPointerDown=e=>{let{crop:t,disabled:n}=this.props,r=this.getBox();if(!t)return;let i=S(t,r.width,r.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let o=e.target.dataset.ord,s=e.clientX,l=e.clientY,a=i.x,d=i.y;if(o){let t=e.clientX-r.x,n=e.clientY-r.y,c=0,h=0;"ne"===o||"e"==o?(c=t-(i.x+i.width),h=n-i.y,a=i.x,d=i.y+i.height):"se"===o||"s"===o?(c=t-(i.x+i.width),h=n-(i.y+i.height),a=i.x,d=i.y):"sw"===o||"w"==o?(c=t-i.x,h=n-(i.y+i.height),a=i.x+i.width,d=i.y):("nw"===o||"n"==o)&&(c=t-i.x,h=n-i.y,a=i.x+i.width,d=i.y+i.height),s=a+r.x+c,l=d+r.y+h}this.evData={startClientX:s,startClientY:l,startCropX:a,startCropY:d,clientX:e.clientX,clientY:e.clientY,isResize:!!o,ord:o},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})};onComponentPointerDown=e=>{let{crop:t,disabled:n,locked:r,keepSelection:i,onChange:o}=this.props,s=this.getBox();if(n||r||i&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let l=e.clientX-s.x,a=e.clientY-s.y,d={unit:"px",x:l,y:a,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:l,startCropY:a,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,o(S(d,s.width,s.height),N(d,s.width,s.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})};onDocPointerMove=e=>{let t,{crop:n,disabled:r,onChange:i,onDragStart:o}=this.props,s=this.getBox();if(r||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(e));let{evData:l}=this;l.clientX=e.clientX,l.clientY=e.clientY,C(n,t=l.isResize?this.resizeCrop():this.dragCrop())||i(S(t,s.width,s.height),N(t,s.width,s.height))};onComponentKeyDown=t=>{let{crop:n,disabled:r,onChange:i,onComplete:o}=this.props;if(r)return;let s=t.key,l=!1;if(!n)return;let a=this.getBox(),d=this.makePixelCrop(a),c=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===s?(d.x-=c,l=!0):"ArrowRight"===s?(d.x+=c,l=!0):"ArrowUp"===s?(d.y-=c,l=!0):"ArrowDown"===s&&(d.y+=c,l=!0),l){t.cancelable&&t.preventDefault(),d.x=k(d.x,0,a.width-d.width),d.y=k(d.y,0,a.height-d.height);let e=S(d,a.width,a.height),n=N(d,a.width,a.height);i(e,n),o&&o(e,n)}};onHandlerKeyDown=(t,n)=>{var r,i;let o,{aspect:s=0,crop:l,disabled:a,minWidth:d=0,minHeight:c=0,maxWidth:h,maxHeight:u,onChange:p,onComplete:f}=this.props,m=this.getBox();if(a||!l||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.stopPropagation(),t.preventDefault();let g=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?e.nudgeStepLarge:t.shiftKey?e.nudgeStepMedium:e.nudgeStep,y=M((r=S(l,m.width,m.height),i=t.key,o={...r},"ArrowLeft"===i?"nw"===n?(o.x-=g,o.y-=g,o.width+=g,o.height+=g):"w"===n?(o.x-=g,o.width+=g):"sw"===n?(o.x-=g,o.width+=g,o.height+=g):"ne"===n?(o.y+=g,o.width-=g,o.height-=g):"e"===n?o.width-=g:"se"===n&&(o.width-=g,o.height-=g):"ArrowRight"===i&&("nw"===n?(o.x+=g,o.y+=g,o.width-=g,o.height-=g):"w"===n?(o.x+=g,o.width-=g):"sw"===n?(o.x+=g,o.width-=g,o.height-=g):"ne"===n?(o.y-=g,o.width+=g,o.height+=g):"e"===n?o.width+=g:"se"===n&&(o.width+=g,o.height+=g)),"ArrowUp"===i?"nw"===n?(o.x-=g,o.y-=g,o.width+=g,o.height+=g):"n"===n?(o.y-=g,o.height+=g):"ne"===n?(o.y-=g,o.width+=g,o.height+=g):"sw"===n?(o.x+=g,o.width-=g,o.height-=g):"s"===n?o.height-=g:"se"===n&&(o.width-=g,o.height-=g):"ArrowDown"===i&&("nw"===n?(o.x+=g,o.y+=g,o.width-=g,o.height-=g):"n"===n?(o.y+=g,o.height-=g):"ne"===n?(o.y+=g,o.width-=g,o.height-=g):"sw"===n?(o.x-=g,o.width+=g,o.height+=g):"s"===n?o.height+=g:"se"===n&&(o.width+=g,o.height+=g)),o),s,n,m.width,m.height,d,c,h,u);
94if(!C(l,y)){let e=N(y,m.width,m.height);p(y,e),f&&f(y,e)}};onDocPointerDone=e=>{let{crop:t,disabled:n,onComplete:r,onDragEnd:i}=this.props,o=this.getBox();this.unbindDocMove(),!(n||!t)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,i&&i(e),r&&r(S(t,o.width,o.height),N(t,o.width,o.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))};onDragFocus=()=>{this.componentRef.current?.scrollTo(0,0)};getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(t),r=e.clientX-e.startClientX,i=e.clientY-e.startClientY;return n.x=k(e.startCropX+r,0,t.width-n.width),n.y=k(e.startCropY+i,0,t.height-n.height),n}getPointRegion(e,t,n,r){let{evData:i}=this,o=i.clientX-e.x,s=i.clientY-e.y,l;return l=r&&t?"nw"===t||"n"===t||"ne"===t:s<i.startCropY,(n&&t?"nw"===t||"w"===t||"sw"===t:o<i.startCropX)?l?"nw":"sw":l?"ne":"se"}resolveMinDimensions(e,t,n=0,r=0){let i=Math.min(n,e.width),o=Math.min(r,e.height);return t&&(i||o)?t>1?i?[i,i/t]:[o*t,o]:o?[o*t,o]:[i,i/t]:[i,o]}resizeCrop(){let{evData:t}=this,{aspect:n=0,maxWidth:r,maxHeight:i}=this.props,o=this.getBox(),[s,l]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight),a=this.makePixelCrop(o),d=this.getPointRegion(o,t.ord,s,l),c=t.ord||d,h=t.clientX-t.startClientX,u=t.clientY-t.startClientY;(s&&"nw"===c||"w"===c||"sw"===c)&&(h=Math.min(h,-s)),(l&&"nw"===c||"n"===c||"ne"===c)&&(u=Math.min(u,-l));let p={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(p.x=t.startCropX,p.width=h,n?p.height=p.width/n:p.height=Math.abs(u),p.y=t.startCropY-p.height):"se"===d?(p.x=t.startCropX,p.y=t.startCropY,p.width=h,n?p.height=p.width/n:p.height=u):"sw"===d?(p.x=t.startCropX+h,p.y=t.startCropY,p.width=Math.abs(h),n?p.height=p.width/n:p.height=u):"nw"===d&&(p.x=t.startCropX+h,p.width=Math.abs(h),n?(p.height=p.width/n,p.y=t.startCropY-p.height):(p.height=Math.abs(u),p.y=t.startCropY+u));let f=M(p,n,d,o.width,o.height,s,l,r,i);return n||e.xyOrds.indexOf(c)>-1?a=f:e.xOrds.indexOf(c)>-1?(a.x=f.x,a.width=f.width):e.yOrds.indexOf(c)>-1&&(a.y=f.y,a.height=f.height),a.x=k(a.x,0,o.width-a.width),a.y=k(a.y,0,o.height-a.height),a}renderCropSelection(){let{ariaLabels:t=e.defaultProps.ariaLabels,disabled:n,locked:r,renderSelectionAddon:i,ruleOfThirds:o,crop:s}=this.props,l=this.getCropStyle();if(s)return w.default.createElement("div",{style:l,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!r&&w.default.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},w.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),w.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),w.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),w.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),w.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),i&&w.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},i(this.state)),o&&w.default.createElement(w.default.Fragment,null,w.default.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),w.default.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return S({...v,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:t,circularCrop:n,className:r,crop:i,disabled:o,locked:s,style:l,ruleOfThirds:a}=this.props,{cropIsActive:d,newCropIsBeingDrawn:c}=this.state,h=i?this.renderCropSelection():null,u=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",r,d&&"ReactCrop--active",o&&"ReactCrop--disabled",s&&"ReactCrop--locked",c&&"ReactCrop--new-crop",i&&e&&"ReactCrop--fixed-aspect",i&&n&&"ReactCrop--circular-crop",i&&a&&"ReactCrop--rule-of-thirds",!this.dragStarted&&i&&!i.width&&!i.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return w.default.createElement("div",{ref:this.componentRef,className:u,style:l},w.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},t),i?w.default.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},w.default.createElement("defs",null,w.default.createElement("mask",{id:`hole-${this.instanceId}`},w.default.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?w.default.createElement("ellipse",{cx:`${i.x+i.width/2}${i.unit}`,cy:`${i.y+i.height/2}${i.unit}`,rx:`${i.width/2}${i.unit}`,ry:`${i.height/2}${i.unit}`,fill:"black"}):w.default.createElement("rect",{x:`${i.x}${i.unit}`,y:`${i.y}${i.unit}`,width:`${i.width}${i.unit}`,height:`${i.height}${i.unit}`,fill:"black"}))),w.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,h)}},E=e.i(75254);let R=(0,E.default)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);e.s(["RotateCw",0,R],91810);var D=e.i(68553);let O=(0,E.default)("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),P=(0,E.default)("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]),L=(0,E.default)("crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);e.s(["CropImageModal",0,function({open:e,onClose:r,imageSrc:o,title:s="Edit Image",description:a="Crop and rotate your image.",saveButtonText:c="Save Image",onCropComplete:h,isLoading:u}
94){let[p,f]=(0,n.useState)(),[m,g]=(0,n.useState)(),[y,x]=(0,n.useState)(0),[b,w]=(0,n.useState)(!1),[v,k]=(0,n.useState)([]),[C,N]=(0,n.useState)(0),S=(0,n.useRef)(null),M=()=>v.length>0?v[C]:o;(0,n.useEffect)(()=>{if(e&&o){let e=setTimeout(()=>{w(!1),f(void 0),g(void 0),x(0),k([o]),N(0)},0);return()=>clearTimeout(e)}},[e,o]);let j=async()=>{if(!S.current||!m)return;await S.current.decode().catch(()=>{});let e=S.current,t={x:m.x/100*e.naturalWidth,y:m.y/100*e.naturalHeight,width:m.width/100*e.naturalWidth,height:m.height/100*e.naturalHeight},n=document.createElement("canvas"),r=n.getContext("2d");if(!r)return;let i=90===y||270===y;n.width=i?t.height:t.width,n.height=i?t.width:t.height,r.translate(n.width/2,n.height/2),r.rotate(y*Math.PI/180),r.drawImage(e,t.x,t.y,t.width,t.height,-t.width/2,-t.height/2,t.width,t.height);let o=n.toDataURL("image/png"),s=v.slice(0,C+1);s.push(o),k(s),N(s.length-1),w(!1),f(void 0),g(void 0),x(0)},T=M();return(0,t.jsx)(i.CenterModal,{open:e&&!!T,onClose:r,className:"max-w-150! max-h-[92vh]",children:(0,t.jsxs)("div",{className:"relative w-full rounded-3xl bg-white p-8 shadow-modal max-h-[92vh] flex flex-col overflow-hidden",children:[(0,t.jsx)("button",{type:"button",onClick:r,className:"absolute right-5 top-5 z-10 inline-flex rounded-lg p-1 items-center justify-center transition-colors hover:bg-gray-100 bg-white/70 backdrop-blur","aria-label":"Close crop modal",children:(0,t.jsx)(d.default,{src:l.default,alt:"Close",width:28,height:28})}),(0,t.jsxs)("div",{className:"mx-auto flex max-w-105 flex-col items-center text-center mb-6 shrink-0",children:[(0,t.jsx)("div",{className:"mb-2 flex h-14 w-14 items-center justify-center rounded-2xl bg-violet-50 text-primary shadow-subtle",children:(0,t.jsx)(D.Camera,{size:26,strokeWidth:1.8})}),(0,t.jsx)("h2",{className:"text-28 font-bold text-neutral-dark leading-9",children:s}),(0,t.jsx)("p",{className:"mt-1 text-base font-semibold text-slate-500",children:a})]}),(0,t.jsxs)("div",{className:"bg-off-white p-5 rounded-3xl flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,t.jsx)("div",{className:"flex-1 overflow-auto min-h-0",children:T?(0,t.jsx)("div",{className:"relative w-full rounded-2xl overflow-hidden bg-neutral-dark",style:{minHeight:260},children:b?(0,t.jsx)("div",{className:"w-full flex items-center justify-center",children:(0,t.jsx)(A,{crop:p,onChange:(e,t)=>
94f(t),onComplete:(e,t)=>g(t),aspect:void 0,children:(0,t.jsx)("img",{ref:S,src:T,alt:"Crop preview",style:{maxWidth:"100%",maxHeight:360,transform:`rotate(${y}deg)`}})})}):(0,t.jsx)("div",{className:"w-full flex items-center justify-center py-4",children:(0,t.jsx)("img",{src:T,alt:"Preview",style:{maxWidth:"100%",maxHeight:360,borderRadius:16}})})}):null}),(0,t.jsx)("div",{className:"mt-5 space-y-4 shrink-0",children:b?(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,t.jsx)("button",{type:"button",onClick:()=>x((y+90)%360),className:"h-11 w-11 shrink-0 flex items-center justify-center rounded-2xl bg-violet-50 text-primary hover:bg-violet-100 transition-colors",title:"Rotate 90°",children:(0,t.jsx)(R,{className:"h-5 w-5"})}),(0,t.jsxs)("span",{className:"text-sm font-semibold text-gray-500",children:["Rotate ",y,"°"]})]}):(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{C>0&&(N(C-1),w(!1),f(void 0),g(void 0),x(0))},disabled:C<=0,className:"h-11 w-11 shrink-0 flex items-center justify-center rounded-2xl bg-white text-gray-500 hover:text-gray-700 hover:bg-gray-50 transition-colors disabled:opacity-40 disabled:cursor-not-allowed shadow-subtle border border-gray-100",title:"Undo",children:(0,t.jsx)(O,{className:"h-5 w-5"})}),(0,t.jsx)("button",{type:"button",onClick:()=>{C<v.length-1&&(N(C+1),w(!1),f(void 0),g(void 0),x(0))},disabled:C>=v.length-1,className:"h-11 w-11 shrink-0 flex items-center justify-center rounded-2xl bg-white text-gray-500 hover:text-gray-700 hover:bg-gray-50 transition-colors disabled:opacity-40 disabled:cursor-not-allowed shadow-subtle border border-gray-100",title:"Redo",children:(0,t.jsx)(P,{className:"h-5 w-5"})}),(0,t.jsx)("div",{className:"w-px h-8 bg-gray-200 mx-1"}),(0,t.jsxs)("button",{type:"button",onClick:()=>{let e={unit:"%",width:50,height:50,x:25,y:25};f(e),g(e),w(!0)},className:"inline-flex h-11 px-5 shrink-0 items-center justify-center gap-2 rounded-2xl bg-primary text-white font-bold shadow-lg shadow-purple-100 transition-colors hover:bg-primary/90",title:"Enable Crop",children:[(0,t.jsx)(L,{className:"h-5 w-5"}),"Enable Crop"]})]})}),(0,t.jsx)("div",{className:"border-t border-gray-200 mt-5 shrink-0"}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 pt-5 shrink-0",children:[(0,t.jsx)("button",{type:"button",onClick:b?()=>{w(!1),f(void 0),g(void 0)}:r,disabled:u,className:"px-6 py-3 rounded-2xl text-lg font-sans font-semibold transition-colors bg-white shadow-subtle text-gray-600 hover:bg-gray-50 border border-gray-100 disabled:opacity-50",children:b?"Cancel Crop":"Cancel"}),b?(0,t.jsx)("button",{type:"button",onClick:j,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all hover:opacity-90",children:"Apply Crop"}):(0,t.jsxs)("button",{type:"button",onClick:()=>{let e=M();if(!e)return;let t=new window.Image;t.crossOrigin="anonymous";let n=()=>{let e=document.createElement("canvas"),n=e.getContext("2d");n&&(e.width=t.naturalWidth,e.height=t.naturalHeight,n.drawImage(t,0,0),e.toBlob(e=>{e&&h(e)},"image/png",1))};t.onload=n,t.onerror=()=>{},t.src=e,t.complete&&t.naturalWidth>0&&n()},disabled:u,className:"px-6 py-3 rounded-2xl shadow-subtle text-lg font-sans font-semibold bg-primary text-white transition-all flex items-center gap-2 disabled:opacity-50 hover:opacity-90",children:[u&&(0,t.jsxs)("svg",{className:"animate-spin h-4 w-4 text-white",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),u?"Saving...":c]})]})]})]})})}],52704);var I=e.i(7659);let z=(0,E.default)("user-x",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);e.s(["DeleteAccountModal",0,function({open:e,onCancel:n,onConfirm:r,isLoading:i}){return(0,t.jsx)(I.ConfirmModal,{open:e,icon:(0,t.jsx)(z,{className:"w-6 h-6"}),iconBg:"bg-red-50",iconColor:"text-red-600",title:"Delete Account",message:"Are you sure you want to delete your account? This action cannot be undone.",onNo:n,onYes:r,yesLoading:i,yesText:"Delete Account",danger:!0})}],82123),e.s([],89758)},68341,e=>{"use strict";var t=e.i(71645),n=e.i(94499),r=e.i(27121),i=e.i(56378),o=e.i(76399),s=e.i(63612),l=e.i(55841);e.i(27427);var a=e.i(34236),d=e.i(3819),c=e.i(92326),h=e.i(2323),u=e.i(36110),p=e.i(33287),f=e.i(97643),m=e.i(36023),g=e.i(9252),y=e.i(85465);e.s(["useSimulatorEditor",0,function({snippet:e,allSnippets:l,tools:x,shortcut:b,isDirtyRef:w,editorRef:v,onIsEmptyChange:k,simulatorContentRef:C,onFieldsRequired:N}){let S=(0,t.useRef)(null),M=async(e,t,n,i)=>{let o=(0,y.evaluateContent)(t,i,x),{text:s}=await (0,y.resolveSnippet)(o,x,{keepCursorMarker:!0}),l=-1,a=-1;e.state.doc.descendants((e,t)=>{if(e.isText&&e.text?.includes(n))return a=(l=t+e.text.indexOf(n))+n.length,!1}),-1!==l&&e.chain().insertContentAt({from:l,to:a},s).command(({tr:e,dispatch:t})=>{if(t){let t=[];if(e.doc.descendants((e,n)=>{if(e.isText&&e.text?.includes("â")){let r=0;for(;;){let i=e.text.indexOf("â",r);
94if(-1===i)break;t.push({from:n+i,to:n+i+1}),r=i+1}}}),t.length>0){let n=t[0];e.setSelection(r.TextSelection.create(e.doc,n.from))}}return!0}).focus().run()};return(0,n.useEditor)({immediatelyRender:!1,extensions:[i.default.configure({underline:!1,link:!1}),o.default,a.TextStyle,a.Color,d.default.configure({multicolor:!0}),c.default,h.default,s.default.configure({openOnClick:!1,autolink:!0,linkOnPaste:!0}),m.CustomImage.configure({inline:!1,allowBase64:!0}),f.default.configure({types:["heading","paragraph"]}),p.default,m.TabIndentExtension,u.Table.configure({resizable:!0}),u.TableRow,m.CustomTableHeader,m.CustomTableCell,...g.ALL_SNIPPET_EXTENSIONS],editorProps:{attributes:{class:"prose prose-sm max-w-none focus:outline-none min-h-[12.5rem] p-4","data-sb-ignore-snippets":"true"},handleKeyDown:(e,t)=>{if("Tab"===t.key){let{state:n,dispatch:i}=e,{doc:o,selection:s}=n,l=[];if(o.descendants((e,t)=>{if(e.isText&&e.text?.includes("â")){let n=0;for(;;){let r=e.text.indexOf("â",n);if(-1===r)break;l.push({from:t+r,to:t+r+1}),n=r+1}}}),l.length>0){t.preventDefault();let e=l.find(e=>e.from>s.from);return e||(e=l[0]),i(n.tr.setSelection(r.TextSelection.create(o,e.from)).scrollIntoView()),!0}}return!1}},content:"",onUpdate:async({editor:t})=>{let n=t.getText();k&&k(t.isEmpty),C.current=t.getHTML();let r=n.match(/(=[a-zA-Z0-9_-]+)/);if(r){let n=r[0],i=null;if(n===b)if(w.current)i=v.current?.getJSON();else try{i=JSON.parse(e.contentJson)}catch{i=v.current?.getJSON()}else{let e=l.find(e=>e.shortcut===n);e&&(i=JSON.parse(e.contentJson))}if(i){let e=(0,y.collectFormFields)(i);if(e.length>0&&N){S.current!==n&&(S.current=n,N(e,i,e=>{S.current=null,M(t,i,n,e)}));return}S.current=null,await M(t,i,n,{})}}}})},"useSnippetEditor",0,function({snippet:e,isReadOnly:t=!1,onUpdate:r,editorRef:x}){return(0,n.useEditor)({immediatelyRender:!1,editable:!t,extensions:[i.default.configure({underline:!1,link:!1}),o.default,a.TextStyle,a.Color,d.default.configure({multicolor:!0}),c.default,h.default,s.default.configure({openOnClick:!1,autolink:!0,linkOnPaste:!0}),m.CustomImage.configure({inline:!1,allowBase64:!0}),f.default.configure({types:["heading","paragraph"]}),p.default,m.FindHighlightExtension,m.TabIndentExtension,u.Table.configure({resizable:!1}),u.TableRow,m.CustomTableHeader,m.CustomTableCell,l.default.configure({placeholder:"Start typing your snippet contentâ¦"}),...g.ALL_SNIPPET_EXTENSIONS],content:(()=>{try{return JSON.parse(e.contentJson)}catch{return{type:"doc",content:[{type:"paragraph"}]}}})(),onUpdate:({editor:t})=>{let n=JSON.stringify(t.getJSON());n!==e.contentJson&&r&&r(n)},editorProps:{attributes:{"data-sb-ignore-snippets":"true"},handleDrop(e,t){let n=t.dataTransfer?.getData("application/x-tiptap-command");if(n&&x?.current){let r=e.posAtCoords({left:t.clientX,top:t.clientY});if(r){let e=(0,y.buildInsertFn)(x.current);return x.current.chain().focus().setTextSelection(r.pos).run(),e(n),!0}}return!1}}},[e.id])},"useTextNoteEditor",0,function({content:e,isLink:t,onUpdate:r,onIsEmptyChange:a}){return(0,n.useEditor)({immediatelyRender:!1,extensions:[i.default.configure({heading:!1,codeBlock:!1,blockquote:!1,horizontalRule:!1,underline:!1,link:!1}),o.default,s.default.configure({openOnClick:!1}),f.default.configure({types:["paragraph"]}),l.default.configure({placeholder:"Write your note, caption, reply, or instructions here..."})],content:t?"":e,editorProps:{attributes:{class:"tiptap-note-editor prose prose-sm max-w-none focus:outline-none min-h-[7.5rem] px-4 py-3 text-sm text-gray-700"}},onUpdate:({editor:e})=>{let t=e.getHTML();r&&r(t),a&&a(e.isEmpty)}})}])},85465,15514,2065,e=>{"use strict";var t=e.i(1851),n=e.i(85479),r=e.i(95727),i=e.i(77241),o=e.i(81092);function s(e,t,n){let r=(0,o.toDate)(e,n?.in);if(isNaN(t))return(0,i.constructFrom)(n?.in||e,NaN);if(!t)return r;let s=r.getDate(),l=(0,i.constructFrom)(n?.in||e,r.getTime());return(l.setMonth(r.getMonth()+t+1,0),s>=l.getDate())?l:(r.setFullYear(l.getFullYear(),l.getMonth(),s),r)}function l(e,t,n){let{years:l=0,months:a=0,weeks:d=0,days:c=0,hours:h=0,minutes:u=0,seconds:p=0}=t,f=(0,o.toDate)(e,n?.in),m=a||l?s(f,a+12*l):f,g=c||d?(0,r.addDays)(m,c+7*d):m;
94return(0,i.constructFrom)(n?.in||e,+g+1e3*(p+60*(u+60*h)))}function a(e,t,n){var o,l;let{years:a=0,months:d=0,weeks:c=0,days:h=0,hours:u=0,minutes:p=0,seconds:f=0}=t,m=(o=s(e,-(d+12*a),n),l=h+7*c,(0,r.addDays)(o,-l,n));return(0,i.constructFrom)(n?.in||e,m-1e3*(f+60*(p+60*u)))}e.s(["add",0,l],15514),e.s(["sub",0,a],2065);let d="249229d2-e055-4b21-bf51-770b7a81b002",c="81acb230-a9ad-4061-9e46-a6d055cc34e2",h="6e947d38-da7e-4a0e-b6e6-3d6cd6c35ceb";function u(e,t){if(!e)return e;switch(t){case"yes":case"trim":return e.trim();case"left":return e.trimStart();case"right":return e.trimEnd();default:return e}}function p(e,t){if(!e||!t)return e;if(t.includes("upper(value)"))return e.toUpperCase();if(t.includes("lower(value)"))return e.toLowerCase();if(t.includes("capitalize(value)"))return e.charAt(0).toUpperCase()+e.slice(1);try{if((t.includes("=>")||t.includes("function"))&&!t.includes("window")&&!t.includes("document")&&!t.includes("eval")){let n=Function("value",`return (${t.replace(/.*=>\s*/,"")})`)(e);return"string"==typeof n?n:String(n)}}catch{}return e}function f(e,t){let n=(e[t]??0)+1;return e[t]=n,1===n?t:`${t}__${n}`}function m(e,r,i,o={}){if(!e)return"";let s=e.type,l=e.attrs??{};if("text"===s){let t=e.text??"";for(let n of e.marks??[]){if("bold"===n.type&&(t=`<strong>${t}</strong>`),"italic"===n.type&&(t=`<em>${t}</em>`),"underline"===n.type&&(t=`<u>${t}</u>`),"strike"===n.type&&(t=`<del>${t}</del>`),"subscript"===n.type&&(t=`<sub>${t}</sub>`),"superscript"===n.type&&(t=`<sup>${t}</sup>`),"link"===n.type&&(t=`<a href="${n.attrs?.href??""}">${t}</a>`),"textStyle"===n.type){let e=[];n.attrs?.color&&e.push(`color: ${n.attrs.color}`),n.attrs?.fontFamily&&e.push(`font-family: ${n.attrs.fontFamily}`),e.length>0&&(t=`<span style="${e.join("; ")}">${t}</span>`)}"highlight"===n.type&&(t=`<mark style="background-color: ${n.attrs?.color||"yellow"}">${t}</mark>`)}return t}if("hardBreak"===s)return"<br/>";if("horizontalRule"===s)return"<hr/>";if("image"===s)return`<img src="${l.src}" alt="${l.alt||""}" title="${l.title||""}" />`;if("dateNode"===s)return`__SB_START__${JSON.stringify({id:c,attrs:l})}__SB_END__`;if("cursorNode"===s)return`__SB_START__${JSON.stringify({id:h,attrs:l})}__SB_END__`;if("clipboardNode"===s)return`__SB_START__${JSON.stringify({id:d,attrs:l})}__SB_END__`;if("websiteNode"===s)return`__SB_START__${JSON.stringify({type:s,attrs:l})}__SB_END__`;if("noteNode"===s)return"";if("textFieldNode"===s){let e=l.label??"Text field",t=r[f(o,e)],n=t&&t.trim()?t:l.defaultValue||l.placeholder||`[${e}]`;return p(n=u(n,l.trim),l.formatter)}if("paragraphFieldNode"===s){let e=l.label??"Paragraph field",t=r[f(o,e)],n=t&&t.trim()?t:l.defaultValue||l.placeholder||`[${e}]`;return p(n=u(n,l.trim),l.formatter)}if("dropdownNode"===s){let e=r[f(o,l.label??"Dropdown")]??l.defaultValue??(l.options??"").split(",")[0]?.trim()??"";return p(e=u(e,l.trim),l.formatter)}if("toggleFieldNode"===s){let e=f(o,l.label??"Toggle"),t="true"===r[e]||void 0===r[e]&&"true"===l.defaultOn;return p(u(l.contents?t?l.contents:"":t?"yes":"no",l.trim),l.formatter)}if("dateFieldNode"===s){let e=l.label??"Date field",i=r[f(o,e)]??l.defaultValue;if(!i)return`[${e}]`;let s=i;if(l.format)try{let e=(0,n.parse)(i,"yyyy-MM-dd",new Date);s=(0,t.format)(e,l.format)}catch{}return p(s=u(s,l.trim),l.formatter)}if(["formulaNode","ifElseNode","repeatNode","errorNode","clickNode","keyPressNode","waitNode","importNode","dragDropNode"].includes(s))return`__SB_START__${JSON.stringify({type:s,attrs:l})}__SB_END__`;let a=(e.content??[]).map(e=>m(e,r,i,o)).join(""),g=l.textAlign?` style="text-align: ${l.textAlign}"`:"";if("paragraph"===s)return`<p${g}>${a}</p>`;if("heading"===s)return`<h${l.level||1}${g}>${a}</h${l.level||1}>`;if("blockquote"===s)return`<blockquote>${a}</blockquote>`;if("codeBlock"===s)return`<pre><code>${a}</code></pre>`;if("bulletList"===s)return`<ul>${a}</ul>`;if("orderedList"===s)return`<ol>${a}</ol>`;if("listItem"===s)return`<li>${a}</li>`;if("taskList"===s)return`<ul data-type="taskList">${a}</ul>`;if("taskItem"===s)return`<li data-type="taskItem"><input type="checkbox" ${l.checked?"checked":""}/> ${a}</li>`;if("table"===s){let t=1,n=e.content;n&&n[0]&&n[0].content&&(t=n[0].content.length);let r=Array.from({length:t}).map(()=>'<col style="width:120px;">').join("");return`<table style="border-collapse:collapse;border:none;"><colgroup>${r}</colgroup><tbody>${a}</tbody></table>`}return"tableRow"===s?`<tr style="height:20px;">${a}</tr>`:"tableCell"===s||"tableHeader"===s?`<td style="border:1px solid #000000;padding:5pt 5pt 5pt 5pt;vertical-align:top;overflow:hidden;"><p style="margin:0;">${a}</p></td>`:a}function g(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}let y="display:inline-block;min-width:2ch;background:#fdf6b2;border:1px solid #e3d377;border-radius:3px;padding:1px 6px;margin:0 1px;font:inherit;color:#111827;outline:none;vertical-align:baseline;";async function x(e,r,i={}){let o=-1,s="__SB_START__",p="__SB_END__",f=e,m=f.indexOf(s);for(;-1!==m;){let e=f.indexOf(p,m+s.length);if(-1===e)break;let r=f.substring(m,e+p.length),i=f.substring(m+s.length,e),o="";try{let e=JSON.parse(i);if(e.id===c){let r=e.attrs||{};try{let e=new Date;if(r.at)try{e=(0,n.parse)(r.at,r.pattern||"yyyy-MM-dd",new Date)}catch{}if(r.shiftEnabled){let t=parseInt(r.shiftAmount||"1",10),n={[r.shiftUnit||"days"]:t};e="-"===r.shiftDir?a(e,n):l(e,n)}o=(0,t.format)(e,r.format||"MMMM d, yyyy"),o=u(o,r.trim)}catch{o=(0,t.format)(new Date,"MMMM d, yyyy")}}else if(e.id===d)try{o=await navigator.clipboard.readText(),o=u(o,e.attrs?.trim)}catch{o="[Clipboard Access Denied]"}else if(e.id===h)o="â";else if(e.type)switch(e.type){case"websiteNode":o="[Website URL]";break;case"formulaNode":o=`[= ${e.attrs?.expression||""}]`;break;case"ifElseNode":o=`[if: ${e.attrs?.condition||"condition"}]`;break;case"repeatNode":o=`[repeat \xd7${e.attrs?.count||"3"}]`;break;case"waitNode":o=`[wait ${e.attrs?.ms||"500"}ms]`;break;case"keyPressNode":o=`[key: ${e.attrs?.key||"Enter"}]`;break;case"importNode":o=`[snippet: ${e.attrs?.shortcut||"=snippet"}]`;break;default:o=`[${e.type}]`}e.attrs?.trim&&("yes"===e.attrs.trim||"trim"===e.attrs.trim?o=o.trim():"left"===e.attrs.trim?o=o.trimStart():"right"===e.attrs.trim&&(o=o.trimEnd()))}catch{o=r}m=(f=f.substring(0,m)+o+f.substring(e+p.length)).indexOf(s,m+o.length)}return -1!==(o=f.indexOf("â"))&&!i.keepCursorMarker,{text:f,cursorIdx:o}}e.s(["buildInsertFn",0,function(e){let t=()=>e?.chain().focus();return n=>{if(e)switch(n){case"date":t().insertDateNode("MMMM d, yyyy").run();break;case"clipboard":t().insertClipboardNode().run();break;case"cursor":t().insertCursorNode().run();break;case"textField":t().insertTextFieldNode("Text field").run();break;case"paragraphField":t().insertParagraphFieldNode("Paragraph field").run();break;case"dropdown":t().insertDropdownNode("Dropdown").run();break;case"toggle":t().insertToggleFieldNode("Toggle").run();break;case"dateField":t().insertDateFieldNode("Date field").run();break;case"formula":t().insertFormulaNode().run();break;case"ifelse":t().insertIfElseNode().run();break;case"repeat":t().insertRepeatNode().run();break;case"error":t().insertErrorNode().run();break;case"click":t().insertClickNode().run();break;case"keypress":t().insertKeyPressNode().run();break;case"wait":t().insertWaitNode().run();break;case"import":t().insertImportNode().run();break;case"note":t().insertNoteNode().run();break;case"website":t().insertWebsiteNode().run();break;case"dragdrop":t().insertDragDropNode().run()}}},"collectFormFields",0,function e(t){if(!t)return[];let n=t.type,r=t.attrs??{},i=e=>"string"==typeof e?e:void 0;if("textFieldNode"===n)return[{key:i(r.label)??"Text field",type:"text",defaultValue:i(r.defaultValue)}];if("paragraphFieldNode"===n)return[{key:i(r.label)??"Paragraph field",type:"textarea",defaultValue:i(r.defaultValue)}];if("dropdownNode"===n){let e=i(r.options)??"";return[{key:i(r.label)??"Dropdown",type:"select",options:e.split(",").map(e=>e.trim()),defaultValue:i(r.defaultValue)}]}return"toggleFieldNode"===n?[{key:i(r.label)??"Toggle",type:"checkbox",defaultValue:String(r.defaultOn??!1)}]:"dateFieldNode"===n?[{key:i(r.label)??"Date field",type:"date",defaultValue:i(r.defaultValue)}]:(t.content??[]).flatMap(e)},"evaluateContent",0,m,"evaluateContentForPreview",0,function e(t,n,r,i={}){if(!t)return"";let o=t.type,s=t.attrs??{};if("textFieldNode"===o){let e=s.label??"Text field",t=f(i,e),r=n[t]??s.defaultValue??"",o=Math.max(r.length,(s.placeholder||e).length,4);return`<span style="display:inline-flex;align-items:center;gap:4px;padding:6px 10px;border-radius:9999px;background:#ffffff;border:1px solid #ece9fe;margin:0 2px;vertical-align:middle;">
94<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#7d7af8" stroke-width="1.5" stroke-linecap="round" style="flex-shrink:0;"><path d="M3 9H21"/><path d="M3 15H11"/></svg><input type="text" data-sb-field="${g(t)}" data-sb-type="text" value="${g(r)}" placeholder="${g(s.placeholder||e)}" size="${o}" style="border:none;outline:none;background:transparent;color:#7d7af8;font-weight:700;font-size:14px;font-family:inherit;padding:0;min-width:3ch;" /></span>`}if("paragraphFieldNode"===o){let e=s.label??"Paragraph field",t=f(i,e),r=n[t]??s.defaultValue??"";return`<span style="display:block;width:100%;margin:10px 0;"><span style="display:block;width:100%;box-sizing:border-box;padding:14px 16px;background:#ffffff;border:1px solid #ece9fe;border-radius:12px;"><span style="display:flex;align-items:center;gap:8px;margin-bottom:10px;"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#7d7af8" stroke-width="1.5" stroke-linecap="round" style="flex-shrink:0;"><path d="M3 3H21"/><path d="M3 9H11"/><path d="M3 15H21"/><path d="M3 21H11"/></svg><span style="color:#7d7af8;font-weight:700;font-size:14px;">${g(e)}</span></span><textarea data-sb-field="${g(t)}" data-sb-type="textarea" rows="3" placeholder="${g(s.placeholder||e)}" style="display:block;width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid #ece9fe;border-radius:8px;background:#fdfdff;color:#111827;font-size:14px;font-weight:500;font-family:inherit;line-height:1.6;outline:none;resize:vertical;min-height:64px;">${g(r)}</textarea></span></span>`}if("dropdownNode"===o){let e=f(i,s.label??"Dropdown"),t=(s.options??"").split(",").map(e=>e.trim()),r=n[e]??s.defaultValue??t[0]??"",o=t.map(e=>`<option value="${g(e)}" ${e===r?"selected":""}>${g(e)}</option>`).join("");return`<select data-sb-field="${g(e)}" data-sb-type="select" style="${y}">${o}</select>`}if("toggleFieldNode"===o){let e=f(i,s.label??"Toggle"),t="true"===n[e]||void 0===n[e]&&"true"===s.defaultOn;return`<input type="checkbox" data-sb-field="${g(e)}" data-sb-type="checkbox" ${t?"checked":""} style="vertical-align:middle;margin:0 4px;accent-color:#4c3d99;" />`}if("dateFieldNode"===o){let e=f(i,s.label??"Date field"),t=n[e]??s.defaultValue??"";return`<input type="date" data-sb-field="${g(e)}" data-sb-type="date" value="${g(t)}" style="${y}" />`}if("text"===o||"hardBreak"===o||"horizontalRule"===o||["image","dateNode","cursorNode","clipboardNode","websiteNode","noteNode","formulaNode","ifElseNode","repeatNode","errorNode","clickNode","keyPressNode","waitNode","importNode","dragDropNode"].includes(o))return m(t,n,r);let l=(t.content??[]).map(t=>e(t,n,r,i)).join(""),a=s.textAlign?` style="text-align: ${s.textAlign}"`:"";return"paragraph"===o?`<p${a}>${l}</p>`:"heading"===o?`<h${s.level||1}${a}>${l}</h${s.level||1}>`:"blockquote"===o?`<blockquote>${l}</blockquote>`:"codeBlock"===o?`<pre><code>${l}</code></pre>`:"bulletList"===o?`<ul>${l}</ul>`:"orderedList"===o?`<ol>${l}</ol>`:"listItem"===o?`<li>${l}</li>`:"taskList"===o?`<ul data-type="taskList">${l}</ul>`:"taskItem"===o?`<li data-type="taskItem"><input type="checkbox" ${s.checked?"checked":""}/> ${l}</li>`:"table"===o||"tableRow"===o||"tableCell"===o||"tableHeader"===o?m(t,n,r):l},"resolveSnippet",0,x],85465)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.