You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
292 KiB
99 lines
292 KiB
4 weeks ago
|
import{M as Ho}from"./index-_1HmtNlW.js";import{u as Wo,I as Jo,$ as jo,as as Ko,a3 as qo,at as Uo,C as _o,t as Go,D as Yo,V as Xo,_ as Zo}from"./index-D9S4mNPt.js";import{s as Qo,z as ts,q as ns,r as rs,M as el,h as is,d as Ue,a as tl,k as An,O as nl,Z as rl,A as il,u as U,g as sl,c as ss,a3 as $r,a4 as Je,B as jt,_ as Dn,a0 as Hr,m as je,Q as In,V as Rn,$ as ol,a5 as ll,F as al,a1 as cl}from"./vue-Cj9QYd7Z.js";import{a as ls,C as Ie}from"./mxcad-Din5fhsn.js";import"./mapbox-gl-DQAr7S0z.js";import{V as Wr,g as ul,c as dl,b as fl}from"./vuetify-BqCp6y38.js";import"./mxdraw-CvD1WFQ5.js";import"./handsontable-Ch5RdAT_.js";function _(n){this.content=n}_.prototype={constructor:_,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,i=r.find(n),s=r.content.slice();return i==-1?s.push(t||n,e):(s[i+1]=e,t&&(s[i]=t)),new _(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new _(t)},addToStart:function(n,e){return new _([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new _(t)},addBefore:function(n,e,t){var r=this.remove(e),i=r.content.slice(),s=r.find(n);return i.splice(s==-1?i.length:s,0,e,t),new _(i)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=_.from(n),n.size?new _(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=_.from(n),n.size?new _(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=_.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};_.from=function(n){if(n instanceof _)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new _(e)};function as(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=as(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function cs(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=cs(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,i+l,s||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,i+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new k(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.m
|
||
|
`)}}rt.empty=new rt(!0);class yl{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function gs(n){let e=[];do e.push(kl(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function kl(n){let e=[];do e.push(bl(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function bl(n){let e=Ml(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=xl(n,e);else break;return e}function Jr(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function xl(n,e){let t=Jr(n),r=t;return n.eat(",")&&(n.next!="}"?r=Jr(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Sl(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.groups.indexOf(e)>-1&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function Ml(n){if(n.eat("(")){let e=gs(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Sl(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Cl(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();i(s(o.expr,a),u),a=u}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),i(s(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ys(n,e){return e-n}function jr(n,e){let t=[];return r(e),t.sort(ys);function r(i){let s=n[i];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&r(a)}}}function wl(n){let e=Object.create(null);return t(jr(n,0));function t(r){let i=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<i.length;u++)i[u][0]==l&&(c=i[u][1]);jr(n,a).forEach(u=>{c||i.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let s=e[r.join(",")]=new rt(r.indexOf(n.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(ys);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function Tl(n,e){for(let t=0,r=[n];t<r.length;t++){let i=r[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ks(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function bs(n,e){let t=Object.create(null);for(let r in n){let i=e&&e[r];if(i===void 0){let s=n[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=i}return t}function xs(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new Ol(n[t]);return e}let Kr=class Ss{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,thi
|
||
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],s=e.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),i;Cs.hasOwnProperty(r)&&this.parser.normalizeLists&&Dl(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,t));if(s?s.ignore:Al.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let o,l=this.top,a=this.needsBlock;if(Ms.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),o=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?i:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
||
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=B.none,r=B.none;for(let i=0,s=e.length;i<s;i++){let o=e.item(i);for(let l=void 0;;){let a=this.parser.matchStyle(o,e.getPropertyValue(o),this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{a.clearMark(c)&&(r=c.addToSet(r))}):t=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(t),a.consuming===!1)l=a;else break}}return[t,r]}addElementByRule(e,t,r){let i,s,o;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):i=this.enter(s,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}i&&this.sync(l)&&this.open--,o&&this.removePendingMark(o,l)}addAll(e,t,r){let i=t||0;for(let s=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s);this.findAtPoint(e,i)}findPlace(e){let t,r;for(let i=this.open;i>=0;i--){let s=this.nodes[i],o=s.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=s,!o.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let i=0;i<t.length;i++)this.enterInner(t[i],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let i=0;i<e.marks.length;i++)(!t.type||t.type.allowsMarkType(e.marks[i].type))&&(r=e.marks[i].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let i=this.findPlace(e.create(t));return i&&this.enterInner(e,t,!0,r),i}enterInner(e,t=null,r=!1,i){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let o=Ur(e,i,s.options);s.options&Et&&s.content.length==0&&(o|=Et),this.nodes.push(new qt(e,t,s.activeMarks,s.pendingMarks,r,null,o)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].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("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&i?this
|
||
|
`))}})}function Ul(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function _l(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new j(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new x(k.from(o),0,0),1,!0))}function ht(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,u=t-2;c>s;c--,u--){let d=i.node(c),f=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Gl(n,e,t=1,r){let i=n.doc.resolve(e),s=k.empty,o=k.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=k.from(i.node(l).copy(s));let u=r&&r[c];o=k.from(u?u.type.create(u.attrs,o):i.node(l).copy(o))}n.step(new J(e,e,new x(s.append(o),t,t),!0))}function $e(n,e){let t=n.resolve(e),r=t.index();return As(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function As(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function kn(n,e,t=-1){let r=n.resolve(e);for(let i=r.depth;;i--){let s,o,l=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):t>0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&As(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Yl(n,e,t){let r=new J(e-t,e+t,x.empty,!0);n.step(r)}function Xl(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function Ds(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=r.depth;o>=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),u=!1;if(s==1)u=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function bn(n,e,t=e,r=x.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Is(i,s,r)?new J(e,t,r):new Zl(i,s,r).fit()}function Is(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Zl{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=k.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=k.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new x(s,o,l);return e>-1?new j(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new J(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=t
|
||
|
`),u&&h==f.nodeValue.length)for(let p=f,m;p;p=p.parentNode){if(m=p.nextSibling){m.nodeName=="BR"&&(l=a={node:m.parentNode,offset:G(m)+1});break}let g=p.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let p=f.childNodes[h-1];u=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(pe&&c.focusNode&&c.focusNode!=a.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||u&&te)&&it(l.node,l.offset,c.anchorNode,c.anchorOffset)&&it(a.node,a.offset,c.focusNode,c.focusOffset))return;let d=!1;if((c.extend||e==t)&&!u){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),d=!0}catch{}}if(!d){if(e>t){let h=l;l=a,a=h}let f=document.createRange();f.setEnd(a.node,a.offset),f.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&t>=r:e<o&&t>r){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?_e:fi,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=xe:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?_e:xe}r=o}this.dirty=_e}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?_e:fi;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Ks extends Wt{constructor(e,t,r,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==ce&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Pa extends Wt{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}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 e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class st extends Wt{constructor(e,t,r,i){super(e,[],r,i),this.mark=t}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=ye.renderSpec(document,t.type.spec.toDOM(t,r))),new st(e,t,o.dom,o.contentDOM||o.dom)}parseRule(){return this.dirty&xe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=xe&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ce){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=ce}}slice(e,t,r){let i=st.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;t<o&&(s=hr(s,t,o,r)),e>0&&(s=hr(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}}class Le extends Wt{constructor(e,t,r,i,s,o,l,a,c){super(e,[],s,o),this.node=t,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=l}static create(e,t,r,i,s,o){let l=s.nodeViews[t.type.name],a,c=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),u=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=ye.renderSpec(document,t.type.spec.toDOM(t)));!d&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.dragg
|
||
|
|
||
|
`);return{dom:a,text:f,slice:e}}function to(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",f=>{e=f(e,s||r,n)}),s)return e?new x(k.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
||
|
`))),0,0):x.empty;let d=n.someProp("clipboardTextParser",f=>f(e,i,r,n));if(d)l=d;else{let f=i.marks(),{schema:h}=n.state,p=ye.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,f)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=tc(t),Ht&&nc(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||gt.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||u),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Qa.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=rc(Ti(l,+u[1],+u[2]),u[4]);else if(l=x.maxOpen(ec(l.content,i),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=Ti(l,d,f)}return n.someProp("transformPasted",d=>{l=d(l,n)}),l}const Qa=/^(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 ec(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&ro(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=io(o[o.length-1],s.length));let u=no(l,a);o.push(u),i=i.matchType(u.type),s=a}}),o)return k.from(o)}return n}function no(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,k.from(n));return n}function ro(n,e,t,r,i){if(i<n.length&&i<e.length&&n[i]==e[i]){let s=ro(n,e,t,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?t.type:n[i+1]))return r.copy(r.content.append(k.from(no(t,n,i+1))))}}function io(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,io(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(k.empty,!0);return n.copy(t.append(r))}function gr(n,e,t,r,i,s){let o=e<0?n.firstChild:n.lastChild,l=o.content;return n.childCount>1&&(s=0),i<r-1&&(l=gr(l,e,t,r,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(k.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function Ti(n,e,t){return e<n.openStart&&(n=new x(gr(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new x(gr(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const so={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Oi=null;function oo(){return Oi||(Oi=document.implementation.createHTMLDocument("title"))}function tc(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=oo().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&so[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=n,i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function nc(n){let e=n.querySelectorAll(ee?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function rc(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:i,openStart:s,openEnd:o}=n;for(let l=r.length-2;l>=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=k.from(a.create(r[l+1],i)),s++,o++}return new x(i,s,o)}const ne={},re={},ic={touchstart:!0,touchmove:!0};class sc{constructor(){this.shiftKey=!1,this.mouseDown=null,this
|
||
|
`).scrollIntoView()),!0)};function Mo(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const lu=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Mo(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(E.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},au=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof he||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Mo(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,l=n.tr.insert(o,s.createAndFill());l.setSelection(O.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},cu=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(ht(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&Ct(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},uu=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(w.create(n.doc,i))),!0)};function du(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||$e(n.doc,e.pos))?!1:(t&&t(n.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function Co(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s,o;if(r.type.spec.isolating||i.type.spec.isolating)return!1;if(du(n,e,t))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(s=(o=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&o.matchType(s[0]||i.type).validEnd){if(t){let d=e.pos+i.nodeSize,f=k.empty;for(let m=s.length-1;m>=0;m--)f=k.from(s[m].create(null,f));f=k.from(r.copy(f));let h=n.tr.step(new j(e.pos-1,d,e.pos,d,new x(f,1,0),s.length,!0)),p=d+2*s.length;$e(h.doc,p)&&h.join(p),t(h.scrollIntoView())}return!0}let a=E.findFrom(e,1),c=a&&a.$from.blockRange(a.$to),u=c&&Ct(c);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(c,u).scrollIntoView()),!0;if(l&&xt(i,"start",!0)&&xt(r,"end")){let d=r,f=[];for(;f.push(d),!d.isTextblock;)d=d.lastChild;let h=i,p=1;for(;!h.isTextblock;h=h.firstChild)p++;if(d.canReplace(d.childCount,d.childCount,h.content)){if(t){let m=k.empty;for(let y=f.length-1;y>=0;y--)m=k.from(f[y].copy(m));let g=n.tr.step(new j(e.pos-f.length,e.pos+i.nodeSize,e.pos+p,e.pos+i.nodeSize-p,new x(m,f.length,0),0,!0));t(g.scrollIntoView())}return!0}}return!1}function wo(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(O.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}const fu=wo(-1),hu=wo(1);function pu(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&Cr(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Fi(n,e=null){return function(t,r){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let u=t.doc.resolve(c),d=u.index();i=u.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,n,e)}r(s.scrollIntoView())}return!0}}typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function mu(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=!1,a=o;if(!o)return!1;if(o.depth>=2&&i.node(o.depth-1).type.compatibleContent(n)&&o.startIndex==0){if(i.index(o.depth-1)==0)return!1;let u=t.
|
||
|
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function Nu(n){return typeof n=="number"}class Eu{constructor(e){this.find=e.find,this.handler=e.handler}}const Au=(n,e,t)=>{if(Br(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function Du(n){const{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:u}=new Tn({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"");Au(y,s.find,o).forEach(M=>{if(M.index===void 0)return;const C=m+M.index+1,A=C+M[0].length,v={from:t.tr.mapping.map(C),to:t.tr.mapping.map(A)},R=s.handler({state:t,range:v,match:M,commands:a,chain:c,can:u,pasteEvent:o,dropEvent:l});d.push(R)})}),d.every(h=>h!==null)}const Iu=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function Ru(n){const{editor:e,rules:t}=n;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l=typeof DragEvent<"u"?new DragEvent("drop"):null;const a=({state:u,from:d,to:f,rule:h,pasteEvt:p})=>{const m=u.tr,g=wn({state:u,transaction:m});if(!(!Du({editor:e,state:g,from:Math.max(d-1,0),to:f.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length))return l=typeof DragEvent<"u"?new DragEvent("drop"):null,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m};return t.map(u=>new le({view(d){const f=h=>{var p;r=!((p=d.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(d,f)=>(s=r===d.dom.parentElement,l=f,!1),paste:(d,f)=>{var h;const p=(h=f.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=f,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,h)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),b=!!y;if(!m&&!g&&!b)return;if(b){const{from:A,text:v}=y,R=A+v.length,z=Iu(v);return a({rule:u,state:h,from:A,to:{b:R},pasteEvt:z})}const M=f.doc.content.findDiffStart(h.doc.content),C=f.doc.content.findDiffEnd(h.doc.content);if(!(!Nu(M)||!C||M===C.b))return a({rule:u,state:h,from:M,to:C,pasteEvt:o})}}))}function Pu(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return[...new Set(e)]}class dt{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=dt.resolve(e),this.schema=wu(this.extensions,t),this.setupExtensions()}static resolve(e){const t=dt.sort(dt.flatten(e)),r=Pu(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{const r={name:t.name,options:t.options,storage:t.storage},i=S(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=S(r,"priority")||100,o=S(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,t)=>{const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Yn(t.name,this.schema)},i=S(t,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,t=dt.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{const l={name:o.name,options:o.options,storage:o.storage,editor:e,type:Yn(o.name,this.schema)},a=[],c=S(o,"addKeyboardShortcuts",l);let u={};if(o.type==="mark"&&o.config.exitable&&(u.ArrowRight=()=>ue.handleExit({editor:e,mark:o})),c){const m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));u={...u,...m}}const d=Gc(u);a.push(d);const f=S(o,"addInputRules",l);Hi(o,e.options.enableInputR
|
||
|
|
||
|
`,textSerializers:o={}}=t||{};let l="";return n.nodesBetween(r,i,(a,c,u,d)=>{var f;a.isBlock&&c>r&&(l+=s);const h=o?.[a.type.name];if(h)return u&&(l+=h({node:a,pos:c,parent:u,index:d,range:e})),!1;a.isText&&(l+=(f=a?.text)===null||f===void 0?void 0:f.slice(Math.max(r,c)-c,i-c))}),l}function No(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}const zu=W.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new le({key:new Oe("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(u=>u.$from.pos)),l=Math.max(...s.map(u=>u.$to.pos)),a=No(t);return vo(r,{from:o,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Lu=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),Fu=(n=!1)=>({commands:e})=>e.setContent("",n),Vu=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;const p=Ct(h);if(l.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},$u=n=>e=>n(e),Hu=()=>({state:n,dispatch:e})=>au(n,e),Wu=(n,e)=>({editor:t,tr:r})=>{const{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new O(r.doc.resolve(o-1))),!0},Ju=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1},ju=n=>({tr:e,state:t,dispatch:r})=>{const i=q(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},Ku=n=>({tr:e,dispatch:t})=>{const{from:r,to:i}=n;return t&&e.delete(r,i),!0},qu=()=>({state:n,dispatch:e})=>Yc(n,e),Uu=()=>({commands:n})=>n.keyboardShortcut("Enter"),_u=()=>({state:n,dispatch:e})=>lu(n,e);function fn(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Br(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function br(n,e,t={}){return n.find(r=>r.type===e&&fn(r.attrs,t))}function Gu(n,e,t={}){return!!br(n,e,t)}function zr(n,e,t={}){if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if(n.parentOffset===r.offset&&r.offset!==0&&(r=n.parent.childBefore(n.parentOffset)),!r.node)return;const i=br([...r.node.marks],e,t);if(!i)return;let s=r.index,o=n.start()+r.offset,l=s+1,a=o+r.node.nodeSize;for(br([...r.node.marks],e,t);s>0&&i.isInSet(n.parent.child(s-1).marks);)s-=1,o-=n.parent.child(s).nodeSize;for(;l<n.parent.childCount&&Gu([...n.parent.child(l).marks],e,t);)a+=n.parent.child(l).nodeSize,l+=1;return{from:o,to:a}}function We(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}const Yu=(n,e={})=>({tr:t,state:r,dispatch:i})=>{const s=We(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:u}=l;if(i){const d=zr(a,s,e);if(d&&d.from<=c&&d.to>=u){const f=O.create(o,d.from,d.to);t.setSelection(f)}}return!0},Xu=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Eo(n){return n instanceof O}function Ye(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Ao(n,e=null){if(!e)return null;const t=E.atStart(n),r=E.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const i=t.from,s=r.to;return e==="all"?O.create(n,Ye(0,i,s),Ye(n.content.size,i,s)):O
|
||
|
position: relative;
|
||
|
}
|
||
|
|
||
|
.ProseMirror {
|
||
|
word-wrap: break-word;
|
||
|
white-space: pre-wrap;
|
||
|
white-space: break-spaces;
|
||
|
-webkit-font-variant-ligatures: none;
|
||
|
font-variant-ligatures: none;
|
||
|
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
||
|
}
|
||
|
|
||
|
.ProseMirror [contenteditable="false"] {
|
||
|
white-space: normal;
|
||
|
}
|
||
|
|
||
|
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
||
|
white-space: pre-wrap;
|
||
|
}
|
||
|
|
||
|
.ProseMirror pre {
|
||
|
white-space: pre-wrap;
|
||
|
}
|
||
|
|
||
|
img.ProseMirror-separator {
|
||
|
display: inline !important;
|
||
|
border: none !important;
|
||
|
margin: 0 !important;
|
||
|
width: 1px !important;
|
||
|
height: 1px !important;
|
||
|
}
|
||
|
|
||
|
.ProseMirror-gapcursor {
|
||
|
display: none;
|
||
|
pointer-events: none;
|
||
|
position: absolute;
|
||
|
margin: 0;
|
||
|
}
|
||
|
|
||
|
.ProseMirror-gapcursor:after {
|
||
|
content: "";
|
||
|
display: block;
|
||
|
position: absolute;
|
||
|
top: -2px;
|
||
|
width: 20px;
|
||
|
border-top: 1px solid black;
|
||
|
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
||
|
}
|
||
|
|
||
|
@keyframes ProseMirror-cursor-blink {
|
||
|
to {
|
||
|
visibility: hidden;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.ProseMirror-hideselection *::selection {
|
||
|
background: transparent;
|
||
|
}
|
||
|
|
||
|
.ProseMirror-hideselection *::-moz-selection {
|
||
|
background: transparent;
|
||
|
}
|
||
|
|
||
|
.ProseMirror-hideselection * {
|
||
|
caret-color: transparent;
|
||
|
}
|
||
|
|
||
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
||
|
display: block;
|
||
|
}
|
||
|
|
||
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
||
|
opacity: 0
|
||
|
}`;function af(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}let cf=class extends Su{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=af(lf,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!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})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const r=Oo(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(e){if(this.isDestroyed)return;const t=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(i=>!i.key.startsWith(t))});this.view.updateState(r)}createExtensionManager(){var e,t;const i=[...this.options.enableCoreExtensions?[nf,zu.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),tf,rf,sf,of]:[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new dt(i,this)}createCommandManager(){this.commandManager=new Tn({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){const e=Ro(this.options.content,this.schema,this.options.parseOptions),t=Ao(e,this.options.autofocus);this.view=new $c(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:ut.create({doc:e,selection:t||void 0})});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();const i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const 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(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)
|
||
|
|
||
|
`,textSerializers:r={}}=e||{};return Ad(this.state.doc,{blockSeparator:t,textSerializers:{...No(this.schema),...r}})}get isEmpty(){return Pd(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new qe(t,this)}get $doc(){return this.$pos(0)}};function St(n){return new vn({find:n.find,handler:({state:e,range:t,match:r})=>{const i=N(n.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],l=r[0];if(o){const a=l.search(/\S/),c=t.from+l.indexOf(o),u=c+o.length;if(Po(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;u<t.to&&s.delete(u,t.to),c>t.from&&s.delete(t.from+a,c);const f=t.from+a+o.length;s.addMark(t.from+a,f,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function uf(n){return new vn({find:n.find,handler:({state:e,range:t,match:r})=>{const i=N(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from;let l=t.to;const a=n.type.create(i);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>l?u=l:l=u+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(u,l,a)}else r[0]&&s.insert(o-1,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l));s.scrollIntoView()}})}function Sr(n){return new vn({find:n.find,handler:({state:e,range:t,match:r})=>{const i=e.doc.resolve(t.from),s=N(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function Vt(n){return new vn({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{const s=N(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&Cr(a,n.type,s);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:h}=n.editor.extensionManager,p=f||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const u=o.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&$e(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&o.join(t.from-1)}})}class ue{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=N(S(this,"addOptions",{name:this.name}))),this.storage=N(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ue(e)}configure(e={}){const t=this.extend();return t.options=Nn(this.options,e),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){const t=new ue({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=N(S(t,"addOptions",{name:t.name})),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const
|
||
|
|
||
|
`);return!s||!o?!1:n.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:i,empty:s}=t;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const l=i.after();return l===void 0||r.nodeAt(l)?!1:n.commands.exitCode()}}},addInputRules(){return[Sr({find:Of,type:this.type,getAttributes:n=>({language:n[1]})}),Sr({find:vf,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new le({key:new Oe("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!t||!s)return!1;const{tr:o}=n.state;return n.state.selection.from===n.state.doc.nodeSize-(1+n.state.selection.$to.depth*2)?o.insert(n.state.selection.from-1,this.type.create({language:s})):o.replaceSelectionWith(this.type.create({language:s})),o.setSelection(O.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.insertText(t.replace(/\r\n?/g,`
|
||
|
`)),o.setMeta("paste",!0),n.dispatch(o),!0}}})]}}),Ef=Z.create({name:"doc",topNode:!0,content:"block+"});function Af(n={}){return new le({view(e){return new Df(e,n)}})}class Df{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r;if(t){let l=e.nodeBefore,a=e.nodeAfter;if(l||a){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=l?u.bottom:u.top;l&&a&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let s,o;if(!i||i==document.body&&getComputedStyle(i).position=="static")s=-pageXOffset,o=-pageYOffset;else{let l=i.getBoundingClientRect();s=l.left-i.scrollLeft,o=l.top-i.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-o+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,t,e):i;if(t&&!s){let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Ds(this.editorView.state.doc,o,this.editorView.dragging.slice);l!=null&&(o=l)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const If=W.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Af(this.options)]}});class L extends E{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return L.valid(r)?new L(r):E.near(r)}content(){return x.empty}eq(e){return e instanceof L&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new L(e.resolve(t.pos))}getBookmark(){return new Vr(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!Rf(e)||!Pf(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let i=t.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&L.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let l=e.node(o);if(t>0?e.indexAfter(o)<l.childCount:e.index(o)>0){s=l.child(t>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=t;let a=e.doc.resolve(i);if(L.valid(a))return a}for(;
|
||
|
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:i,storedMarks:s}=t;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:l}=r.extensionManager,a=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&o){const d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Wf=Z.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,H(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Sr({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var pn=200,K=function(){};K.prototype.append=function(e){return e.length?(e=K.from(e),!this.length&&e||e.length<pn&&this.leafAppend(e)||this.length<pn&&e.leafPrepend(this)||this.appendInner(e)):this};K.prototype.prepend=function(e){return e.length?K.from(e).append(this):this};K.prototype.appendInner=function(e){return new Jf(this,e)};K.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?K.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};K.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};K.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)};K.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},t,r),i};K.from=function(e){return e instanceof K?e:e&&e.length?new Bo(e):K.empty};var Bo=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,l){for(var a=s;a<o;a++)if(i(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,l){for(var a=s-1;a>=o;a--)if(i(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=pn)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=pn)return new e(i.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(K);K.empty=new Bo([]);var Jf=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var l=this.left.length;if(i<l&&this.left.forEachInner(r,i,Math.min(s,l),o)===!1||s>l&&thi
|
||
|
.ProseMirror ::selection {
|
||
|
background-color: transparent;
|
||
|
color: inherit;
|
||
|
}
|
||
|
`,document.head.appendChild(r),[new le({key:new Oe("selectedText"),props:{decorations(i){const{doc:s,selection:o}=i,{empty:l,from:a,to:c}=o,u=[];return l||(Object.assign(n,{from:a,to:c}),s.nodesBetween(a,c,(d,f)=>{const h=t(d,f,a,c);return h&&u.push(h),!0})),V.create(s,u)},handleDOMEvents:{focus:i=>(n.from!==n.to&&i.dispatch(i.state.tr.removeMark(n.from,n.to,i.state.schema.marks.selectedText)),!1),blur:()=>!1}}})]}}),Mh=n=>(n||(n={}),hf({content:"",extensions:[hh.configure({strike:!1}),ph,mh,gh,yh,kh,bh,xh,Sh.configure({HTMLAttributes:{style:"background-color: #00349e; color: inherit;display: inline-block; line-height: 1.5;"}})],autofocus:!0,...n})),mn=12,we=Ue(mn),Ch=ss(()=>(Ne.value,gn(we.value,Array.from(Ce),we.value)));let Ce=new Set;const es=()=>{Ce.clear()};function gn(n,e,t=12,r=1,i=40){e.includes(t)||e.push(t);const s=Math.min(...e),o=Math.max(...e),l=Math.max(s,r),a=n/l,c=mn*r*a;if(c<i&&o<i)return o<i&&r*a>mn?r*a:c;{let u;return n<=s?u=0:n>=o?u=1:u=(n-s)/(o-s),r+u*(i-r)}}const wh=(n,e,t)=>n+e*256+t*256*256,Th=n=>{const e=n>>16,t=n>>8&255,r=n&255;return new ls(r,t,e)},Oh=n=>{if(!n||n.length===0)return"";let e="",t={};return n.forEach(({type:r,attrs:i})=>{if(r==="bold"&&(t.bold=!0),r==="italic"&&(t.italic=!0),r==="textStyle"&&i){const{color:s,fontFamily:o,fontSize:l,overline:a,strike:c,underline:u}=i;if(s)if(s.method==Ie.kByColor){const d=_o(s.color);e+="\\c"+wh(d.red(),d.green(),d.blue())+";"}else s.method===Ie.kByACI?e+="\\C"+s.index+";":(s.method===Ie.kByBlock&&(e+="\\C0"),s.method===Ie.kByLayer&&(e+="\\C256"));o&&(t.family=o),l&&(e+="\\H"+Number(l)/we.value+"x;"),a&&(e+="\\O"),c&&(e+="\\K"),u&&(e+="\\L")}}),Object.keys(t).length!==0&&(e=`\\f${t.family??""}|${t.bold?"b1":"b0"}|${t.italic?"i1":"i0"}|c134|p49;`+e),e},Vo=n=>{if(!n)return"";let e="";if(n.type==="text"){const t=Oh(n.marks);t&&(e+="{",e+=t),e+=n.text,t&&(e+="}")}return n.content&&(e+=n.content.map(t=>Vo(t)).join("")),n.type==="paragraph"&&(e+="\\P"),n.type==="doc"&&e.endsWith("\\P")&&(e=e.replace(/\\P$/,"")),e},vh=n=>{let e=[],t={type:"doc",content:[{type:"paragraph",content:e}]},r=0,i=!1,s="",o=["c","C","F","f","H"],l=!1,a="",c=[],u={type:"textStyle",attrs:{}},d={};const{createColor:f}=Wo(),h=()=>{if(a){let p={};if(l){const{bold:m,italic:g,...y}=d;p=y;const b=c?.some(({type:C})=>C==="bold"),M=c?.some(({type:C})=>C==="italic");m&&m!==b&&c?.push({type:"bold"}),g&&g!==M&&c?.push({type:"italic"})}u.attrs=Object.assign(p,u.attrs),c&&c.push(u),e.push({type:"text",text:a,marks:c}),a="",u={type:"textStyle",attrs:{}},c=[]}};for(;r<n.length;){const p=n[r];if(r++,i){if(s&&p===";"){const m=s.startsWith("c"),g=s.startsWith("C");if(m||g){let y;if(g){const b=Number(s.slice(1,s.length)),M=new ls;M.setColorIndex(b),y=f({...M,name:Ko(b)||M.getColorString(),index:b,color:`rgba(${M.red},${M.green},${M.blue},${M.n})`}),y.method=Ie.kByACI,b===256&&(M.method=Ie.kByLayer),b===0&&(M.method=Ie.kByBlock)}if(m){const b=s.slice(1,s.length);y=f({...qo(Uo(Th(Number(b))),Ie.kByColor)})}if(!y){i=!1;continue}y.toString=()=>y.color,l&&(typeof d.color<"u"?d.color?.name!==y.name&&(h(),d.color=y):d.color=y),u.attrs.color=y}if(s.startsWith("f")||s.startsWith("F")){const y=s.slice(1,s.length),[b,M,C]=y.split("|");if(l){const A=typeof d.fontFamily<"u",v=typeof d.bold<"u",R=typeof d.italic<"u",z=b!==d.fontFamily,T=M==="b1"!==d.bold,F=C==="i1"!==d.italic;(A&&z||v&&T||R&&F)&&h(),(!A||z)&&(d.fontFamily=b),(!v||T)&&(d.bold=M==="b1"),(!R||F)&&(d.italic=C==="i1")}u.attrs.fontFamily=b,M==="b1"&&c.push({type:"bold"}),C==="i1"&&c.push({type:"italic"}),i=!1,s="";continue}if(s.startsWith("H")){const y=s.slice(1,s.length),b=parseFloat(y)*we.value,M=new Number(b);Ce.add(b),M.toString=()=>gn(b,Array.from(Ce),we.value)+"px",l&&(typeof d.fontSize>"u"?d.fontSize=M:Number(d.fontSize)!==Number(M)&&(h(),d.fontSize=M)),u.attrs.fontSize=M}i=!1,s="";continue}if(s===""){if(p==="P"){h(),e=[],t.content?.push({type:"paragraph",content:e}),i=!1;continue}if(p==="O"){l&&(typeof d.overline>"u"?d.overline=!0:d.overline||(h(),d.overline=!0)),u.attrs.overline=!0,i=!1;continue}if(p==="o"){h(),l&&(d.overline=!1),i=!1;con
|