2026-01-18 19:17:29 +08:00
function ge ( t ) { this . content = t } ge . prototype = { constructor : ge , find : function ( t ) { for ( var e = 0 ; e < this . content . length ; e += 2 ) if ( this . content [ e ] === t ) return e ; return - 1 } , get : function ( t ) { var e = this . find ( t ) ; return e == - 1 ? void 0 : this . content [ e + 1 ] } , update : function ( t , e , n ) { var r = n && n != t ? this . remove ( n ) : this , o = r . find ( t ) , i = r . content . slice ( ) ; return o == - 1 ? i . push ( n || t , e ) : ( i [ o + 1 ] = e , n && ( i [ o ] = n ) ) , new ge ( i ) } , remove : function ( t ) { var e = this . find ( t ) ; if ( e == - 1 ) return this ; var n = this . content . slice ( ) ; return n . splice ( e , 2 ) , new ge ( n ) } , addToStart : function ( t , e ) { return new ge ( [ t , e ] . concat ( this . remove ( t ) . content ) ) } , addToEnd : function ( t , e ) { var n = this . remove ( t ) . content . slice ( ) ; return n . push ( t , e ) , new ge ( n ) } , addBefore : function ( t , e , n ) { var r = this . remove ( e ) , o = r . content . slice ( ) , i = r . find ( t ) ; return o . splice ( i == - 1 ? o . length : i , 0 , e , n ) , new ge ( o ) } , forEach : function ( t ) { for ( var e = 0 ; e < this . content . length ; e += 2 ) t ( this . content [ e ] , this . content [ e + 1 ] ) } , prepend : function ( t ) { return t = ge . from ( t ) , t . size ? new ge ( t . content . concat ( this . subtract ( t ) . content ) ) : this } , append : function ( t ) { return t = ge . from ( t ) , t . size ? new ge ( this . subtract ( t ) . content . concat ( t . content ) ) : this } , subtract : function ( t ) { var e = this ; t = ge . from ( t ) ; for ( var n = 0 ; n < t . content . length ; n += 2 ) e = e . remove ( t . content [ n ] ) ; return e } , toObject : function ( ) { var t = { } ; return this . forEach ( function ( e , n ) { t [ e ] = n } ) , t } , get size ( ) { return this . content . length >> 1 } } ; ge . from = function ( t ) { if ( t instanceof ge ) return t ; var e = [ ] ; if ( t ) for ( var n in t ) e . push ( n , t [ n ] ) ; return new ge ( e ) } ; var vi = ge ; function ba ( t , e , n ) { for ( let r = 0 ; ; r ++ ) { if ( r == t . childCount || r == e . childCount ) return t . childCount == e . childCount ? null : n ; let o = t . child ( r ) , i = e . child ( r ) ; if ( o == i ) { n += o . nodeSize ; continue } if ( ! o . sameMarkup ( i ) ) return n ; if ( o . isText && o . text != i . text ) { for ( let s = 0 ; o . text [ s ] == i . text [ s ] ; s ++ ) n ++ ; return n } if ( o . content . size || i . content . size ) { let s = ba ( o . content , i . content , n + 1 ) ; if ( s != null ) return s } n += o . nodeSize } } function wa ( t , e , n , r ) { for ( let o = t . childCount , i = e . childCount ; ; ) { if ( o == 0 || i == 0 ) return o == i ? null : { a : n , b : r } ; let s = t . child ( -- o ) , l = e . child ( -- i ) , a = s . nodeSize ; if ( s == l ) { n -= a , r -= a ; continue } if ( ! s . sameMarkup ( l ) ) return { a : n , b : r } ; if ( s . isText && s . text != l . text ) { let c = 0 , d = Math . min ( s . text . length , l . text . length ) ; for ( ; c < d && s . text [ s . text . length - c - 1 ] == l . text [ l . text . length - c - 1 ] ; ) c ++ , n -- , r -- ; return { a : n , b : r } } if ( s . content . size || l . content . size ) { let c = wa ( s . content , l . content , n - 1 , r - 1 ) ; if ( c ) return c } n -= a , r -= a } } var v = class t { constructor ( e , n ) { if ( this . content = e , this . size = n || 0 , n == null ) for ( let r = 0 ; r < e . length ; r ++ ) this . size += e [ r ] . nodeSize } nodesBetween ( e , n , r , o = 0 , i ) { for ( let s = 0 , l = 0 ; l < n ; s ++ ) { let a = this . content [ s ] , c = l + a . nodeSize ; if ( c > e && r ( a , o + l , i || null , s ) !== ! 1 && a . content . size ) { let d = l + 1 ; a . nodesBetween ( Math . max ( 0 , e - d ) , Math . min ( a . content . size , n - d ) , r , o + d ) } l = c } } descendants ( e ) { this . nodesBetween ( 0 , this . size , e ) } textBetween ( e , n , r , o ) { let i = "" , s = ! 0 ; return this . nodesBetween ( e , n , ( l , a ) => { let c = l . isText ? l . text . slice ( Math . max ( e , a ) - a , n - a ) : l . isLeaf ? o ? typeof o == "function" ? o ( l ) : o : l . type . spec . leafText ? l . type . spec . leafText ( l ) : "" : "" ; l . isBlock && ( l . isLeaf && c || l . isTextblock ) && r && ( s ? s = ! 1 : i += r ) , i += c } , 0 ) , i } append ( e ) { if ( ! e . size ) return this ; if ( ! this . size ) return e ; let n = this . lastChild , r = e . firstChild , o = this . content . slice ( ) , i = 0 ; for ( n . isText && n . sameMarkup ( r ) && ( o [ o . length - 1 ] = n . withText ( n . text + r . text ) , i = 1 ) ; i < e . content . length ; i ++ ) o . push ( e . content [ i ] ) ; return new t ( o , this . size + e . size ) } cut ( e , n = this . size ) { if ( e == 0 && n == this . size ) return this ; let r = [ ] , o = 0 ; if ( n > e ) for ( let i = 0 , s = 0 ; s < n ; i ++ ) { let l = this . content [ i ] , a = s + l . nodeSize ; a > e && ( ( s < e || a > n ) && ( l . isText ? l = l . cut ( Math . max ( 0 , e - s ) , Math . min ( l . text . length , n - s ) ) : l = l . cut ( Math . max ( 0 , e - s - 1 ) , Math . min ( l . content . size , n - s - 1 ) ) ) , r . push ( l ) , o += l . nodeSize ) , s = a } return new t ( r , o ) } cutByIndex ( e , n ) { return e == n ? t . empty : e == 0 && n == this . content . length ? this : new t ( this . content . slice ( e , n ) ) } replaceChild ( e , n ) { let r = this . content [ e ] ; if ( r == n ) return this ; let o = this . content . slice ( ) , i = this . size + n . nodeSize - r . nodeSize ; return o [ e ] = n , new t ( o , i ) } addToStart ( e ) { return new t ( [ e ] . concat ( this . content ) , this . size + e . nodeSize ) } addToEnd ( e ) { return new t ( this . content . concat ( e ) , this . size + e . nodeSize ) } eq ( e ) { if ( this . content . length != e . content . length ) return ! 1 ; for ( let n = 0 ; n < this . content . length ; n ++ ) if ( ! this . content [ n ]
` )}};_t.empty=new _t(!0);var Oi=class{constructor(e,n){this.string=e,this.nodeTypes=n,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 Ta(t){let e=[];do e.push(dp(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function dp(t){let e=[];do e.push(up(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function up(t){let e=pp(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=fp(t,e);else break;return e}function da(t){/ \D /.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function fp(t,e){let n=da(t),r=n;return t.eat(",")&&(t.next!="}"?r=da(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function hp(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function pp(t){if(t.eat("(")){let e=Ta(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/ \W /.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=hp(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function mp(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let d=n();o(i(s.expr,a),d),a=d}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let d=n();r(a,d),o(i(s.expr,a),d),a=d}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Aa(t,e){return e-t}function ua(t,e){let n=[];return r(e),n.sort(Aa);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function gp(t){let e=Object.create(null);return n(ua(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let d=0;d<o.length;d++)o[d][0]==l&&(c=o[d][1]);ua(t,a).forEach(d=>{c||o.push([l,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let i=e[r.join(",")]=new _t(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(Aa);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function yp(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ea(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Na(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Oa(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError( ` Unsupported attribute $ { o } for $ { n } of type $ { o } ` );for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}funct
` ) ; else if ( s . linebreakReplacement && /[\r\n]/ . test ( r ) && this . top . findWrapping ( s . linebreakReplacement . create ( ) ) ) { let l = r . split ( /\r?\n|\r/ ) ; for ( let a = 0 ; a < l . length ; a ++ ) a && this . insertNode ( s . linebreakReplacement . create ( ) , n , ! 0 ) , l [ a ] && this . insertNode ( s . text ( l [ a ] ) , n , ! /\S/ . test ( l [ a ] ) ) ; r = "" } else r = r . replace ( /\r?\n|\r/g , " " ) ; else if ( r = r . replace ( /[ \t\r\n\u000c]+/g , " " ) , /^[ \t\r\n\u000c]/ . test ( r ) && this . open == this . nodes . length - 1 ) { let l = o . content [ o . content . length - 1 ] , a = e . previousSibling ; ( ! l || a && a . nodeName == "BR" || l . isText && /[ \t\r\n\u000c]$/ . test ( l . text ) ) && ( r = r . slice ( 1 ) ) } r && this . insertNode ( s . text ( r ) , n , ! /\S/ . test ( r ) ) , this . findInText ( e ) } else this . findInside ( e ) } addElement ( e , n , r ) { let o = this . localPreserveWS , i = this . top ; ( e . tagName == "PRE" || /pre/ . test ( e . style && e . style . whiteSpace ) ) && ( this . localPreserveWS = ! 0 ) ; let s = e . nodeName . toLowerCase ( ) , l ; Ia . hasOwnProperty ( s ) && this . parser . normalizeLists && Sp ( e ) ; let a = this . options . ruleFromNode && this . options . ruleFromNode ( e ) || ( l = this . parser . matchTag ( e , this , r ) ) ; e : if ( a ? a . ignore : kp . hasOwnProperty ( s ) ) this . findInside ( e ) , this . ignoreFallback ( e , n ) ; else if ( ! a || a . skip || a . closeParent ) { a && a . closeParent ? this . open = Math . max ( 0 , this . open - 1 ) : a && a . skip . nodeType && ( e = a . skip ) ; let c , d = this . needsBlock ; if ( Da . hasOwnProperty ( s ) ) i . content . length && i . content [ 0 ] . isInline && this . open && ( this . open -- , i = this . top ) , c = ! 0 , i . type || ( this . needsBlock = ! 0 ) ; else if ( ! e . firstChild ) { this . leafFallback ( e , n ) ; break e } let u = a && a . skip ? n : this . readStyles ( e , n ) ; u && this . addAll ( e , u ) , c && this . sync ( i ) , this . needsBlock = d } else { let c = this . readStyles ( e , n ) ; c && this . addElementByRule ( e , a , c , a . consuming === ! 1 ? l : void 0 ) } this . localPreserveWS = o } leafFallback ( e , n ) { e . nodeName == "BR" && this . top . type && this . top . type . inlineContent && this . addTextNode ( e . ownerDocument . createTextNode ( `
` ) , n ) } ignoreFallback ( e , n ) { e . nodeName == "BR" && ( ! this . top . type || ! this . top . type . inlineContent ) && this . findPlace ( this . parser . schema . text ( "-" ) , n , ! 0 ) } readStyles ( e , n ) { let r = e . style ; if ( r && r . length ) for ( let o = 0 ; o < this . parser . matchedStyles . length ; o ++ ) { let i = this . parser . matchedStyles [ o ] , s = r . getPropertyValue ( i ) ; if ( s ) for ( let l = void 0 ; ; ) { let a = this . parser . matchStyle ( i , s , this , l ) ; if ( ! a ) break ; if ( a . ignore ) return null ; if ( a . clearMark ? n = n . filter ( c => ! a . clearMark ( c ) ) : n = n . concat ( this . parser . schema . marks [ a . mark ] . create ( a . attrs ) ) , a . consuming === ! 1 ) l = a ; else break } } return n } addElementByRule ( e , n , r , o ) { let i , s ; if ( n . node ) if ( s = this . parser . schema . nodes [ n . node ] , s . isLeaf ) this . insertNode ( s . create ( n . attrs ) , r , e . nodeName == "BR" ) || this . leafFallback ( e , r ) ; else { let a = this . enter ( s , n . attrs || null , r , n . preserveWhitespace ) ; a && ( i = ! 0 , r = a ) } else { let a = this . parser . schema . marks [ n . mark ] ; r = r . concat ( a . create ( n . attrs ) ) } let l = this . top ; if ( s && s . isLeaf ) this . findInside ( e ) ; else if ( o ) this . addElement ( e , r , o ) ; else if ( n . getContent ) this . findInside ( e ) , n . getContent ( e , this . parser . schema ) . forEach ( a => this . insertNode ( a , r , ! 1 ) ) ; else { let a = e ; typeof n . contentElement == "string" ? a = e . querySelector ( n . contentElement ) : typeof n . contentElement == "function" ? a = n . contentElement ( e ) : n . contentElement && ( a = n . contentElement ) , this . findAround ( e , a , ! 0 ) , this . addAll ( a , r ) , this . findAround ( e , a , ! 1 ) } i && this . sync ( l ) && this . open -- } addAll ( e , n , r , o ) { let i = r || 0 ; for ( let s = r ? e . childNodes [ r ] : e . firstChild , l = o == null ? null : e . childNodes [ o ] ; s != l ; s = s . nextSibling , ++ i ) this . findAtPoint ( e , i ) , this . addDOM ( s , n ) ; this . findAtPoint ( e , i ) } findPlace ( e , n , r ) { let o , i ; for ( let s = this . open , l = 0 ; s >= 0 ; s -- ) { let a = this . nodes [ s ] , c = a . findWrapping ( e ) ; if ( c && ( ! o || o . length > c . length + l ) && ( o = c , i = a , ! c . length ) ) break ; if ( a . solid ) { if ( r ) break ; l += 2 } } if ( ! o ) return null ; this . sync ( i ) ; for ( let s = 0 ; s < o . length ; s ++ ) n = this . enterInner ( o [ s ] , null , n , ! 1 ) ; return n } insertNode ( e , n , r ) { if ( e . isInline && this . needsBlock && ! this . top . type ) { let i = this . textblockFromContext ( ) ; i && ( n = this . enterInner ( i , null , n ) ) } let o = this . findPlace ( e , n , r ) ; if ( o ) { this . closeExtra ( ) ; let i = this . top ; i . match && ( i . match = i . match . matchType ( e . type ) ) ; let s = J . none ; for ( let l of o . concat ( e . marks ) ) ( i . type ? i . type . allowsMarkType ( l . type ) : ma ( l . type , e . type ) ) && ( s = l . addToSet ( s ) ) ; return i . content . push ( e . mark ( s ) ) , ! 0 } return ! 1 } enter ( e , n , r , o ) { let i = this . findPlace ( e . create ( n ) , r , ! 1 ) ; return i && ( i = this . enterInner ( e , n , r , ! 0 , o ) ) , i } enterInner ( e , n , r , o = ! 1 , i ) { this . closeExtra ( ) ; let s = this . top ; s . match = s . match && s . match . matchType ( e ) ; let l = ha ( e , i , s . options ) ; s . options & Hn && s . content . length == 0 && ( l |= Hn ) ; let a = J . none ; return r = r . filter ( c => ( s . type ? s . type . allowsMarkType ( c . type ) : ma ( c . type , e ) ) ? ( a = c . addToSet ( a ) , ! 1 ) : ! 0 ) , this . nodes . push ( new un ( e , n , a , o , null , l ) ) , this . open ++ , r } closeExtra ( e = ! 1 ) { let n = this . nodes . length - 1 ; if ( n > this . open ) { for ( ; n > this . open ; n -- ) this . nodes [ n - 1 ] . content . push ( this . nodes [ n ] . 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 n = this . open ; n >= 0 ; n -- ) { if ( this . nodes [ n ] == e ) return this . open = n , ! 0 ; this . localPreserveWS && ( this . nodes [ n ] . options |= Fn ) } return ! 1 } get currentPos ( ) { this . closeExtra ( ) ; let e = 0 ; for ( let n = this . open ; n >= 0 ; n -- ) { let r = this . nodes [ n ] . content ; for ( let o = r . length - 1 ; o >= 0 ; o -- ) e += r [ o ] . nodeSize ; n && e ++ } return e } findAtPoint ( e , n ) { if ( this . find ) for ( let r = 0 ; r < this . find . length ; r ++ ) this . find [ r ] . node == e && this . find [ r ] . offset == n && ( this . find [ r ] . pos = this . currentPos ) } findInside ( e ) { if ( this . find ) for ( let n = 0 ; n < this . find . length ; n ++ ) this . find [ n ] . pos == null && e . nodeType == 1 && e . contains ( this . find [ n ] . node ) && ( this . find [ n ] . pos = this . currentPos ) } findAround ( e , n , r ) { if ( e != n && this . find ) for ( let o = 0 ; o < this . find . length ; o ++ ) this . find [ o ] . pos == null && e . nodeType == 1 && e . contains ( this . find [ o ] . node ) && n . compareDocumentPosition ( this . find [ o ] . node ) & ( r ? 2 : 4 ) && ( this . find [ o ] . pos = this . currentPos ) } findInText ( e ) { if ( this . find ) for ( let n = 0 ; n < this . find . length ; n ++ ) this . find [ n ] . node == e && ( this . find [ n ] . pos = this . currentPos - ( e . nodeValue . length - this . find [ n ] . offset ) ) } matchesContext ( e ) { if ( e . indexOf ( "|" ) > - 1 ) return e . split ( /\s*\|\s*/ ) . some ( this . matchesContext , this ) ; let n = e . split ( "/" ) , r = this . options . context , o = ! this . isOpen && ( ! r || r .
` ))}})}function Bp(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function zp(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new se(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new E(v.from(s),0,0),1,!0))}function Ee(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,d=n-2;c>i;c--,d--){let u=o.node(c),f=o.index(c);if(u.type.spec.isolating)return!1;let h=u.content.cutByIndex(f,u.childCount),p=r&&r[d+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[d]||u;if(!u.canReplace(f+1,u.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function Hp(t,e,n=1,r){let o=t.doc.resolve(e),i=v.empty,s=v.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=v.from(o.node(l).copy(i));let d=r&&r[c];s=v.from(d?d.type.create(d.attrs,s):o.node(l).copy(s))}t.step(new ye(e,e,new E(i.append(s),n,n),!0))}function Re(t,e){let n=t.resolve(e),r=n.index();return Wa(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function $ p(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function Wa(t,e){return!!(t&&e&&!t.isLeaf&& $ p(t,e))}function Wt(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&Wa(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function Fp(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(o);d&&!u?r=!1:!d&&u&&(r=!0)}let l=t.steps.length;if(r===!1){let d=t.doc.resolve(e+n);_a(t,d.node(),d.before(),l)}s.inlineContent&& $ i(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new ye(c,a.map(e+n,-1),E.empty,!0)),r===!0){let d=t.doc.resolve(c);Va(t,d.node(),d.before(),t.steps.length)}return t}function Vp(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function zr(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),d=!1;if(i==1)d=c.canReplace(a,a,o);else{let u=c.contentMatchAt(a).findWrapping(o.firstChild.type);d=u&&c.canReplaceWith(a,a,u[0])}if(d)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function qn(t,e,n=e,r=E.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return ja(o,i,r)?new ye(e,n,r):new zi(o,i,r).fit()}function ja(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var zi=class{constructor(e,n,r){this. $ from=e,this. $ to=n,this.unplaced=r,this.frontier=[],this.placed=v.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.fro
` ) . scrollIntoView ( ) ) , ! 0 ) } ; function Qi ( t ) { for ( let e = 0 ; e < t . edgeCount ; e ++ ) { let { type : n } = t . edge ( e ) ; if ( n . isTextblock && ! n . hasRequiredAttrs ( ) ) return n } return null } var Zi = ( t , e ) => { let { $head : n , $anchor : r } = t . selection ; if ( ! n . parent . type . spec . code || ! n . sameParent ( r ) ) return ! 1 ; let o = n . node ( - 1 ) , i = n . indexAfter ( - 1 ) , s = Qi ( o . contentMatchAt ( i ) ) ; if ( ! s || ! o . canReplaceWith ( i , i , s ) ) return ! 1 ; if ( e ) { let l = n . after ( ) , a = t . tr . replaceWith ( l , l , s . createAndFill ( ) ) ; a . setSelection ( I . near ( a . doc . resolve ( l ) , 1 ) ) , e ( a . scrollIntoView ( ) ) } return ! 0 } , es = ( t , e ) => { let n = t . selection , { $from : r , $to : o } = n ; if ( n instanceof ke || r . parent . inlineContent || o . parent . inlineContent ) return ! 1 ; let i = Qi ( o . parent . contentMatchAt ( o . indexAfter ( ) ) ) ; if ( ! i || ! i . isTextblock ) return ! 1 ; if ( e ) { let s = ( ! r . parentOffset && o . index ( ) < o . parent . childCount ? r : o ) . pos , l = t . tr . insert ( s , i . createAndFill ( ) ) ; l . setSelection ( D . create ( l . doc , s + 1 ) ) , e ( l . scrollIntoView ( ) ) } return ! 0 } , ts = ( t , e ) => { let { $cursor : n } = t . selection ; if ( ! n || n . parent . content . size ) return ! 1 ; if ( n . depth > 1 && n . after ( ) != n . end ( - 1 ) ) { let i = n . before ( ) ; if ( Ee ( t . doc , i ) ) return e && e ( t . tr . split ( i ) . scrollIntoView ( ) ) , ! 0 } let r = n . blockRange ( ) , o = r && ft ( r ) ; return o == null ? ! 1 : ( e && e ( t . tr . lift ( r , o ) . scrollIntoView ( ) ) , ! 0 ) } ; function Gp ( t ) { return ( e , n ) => { let { $from : r , $to : o } = e . selection ; if ( e . selection instanceof L && e . selection . node . isBlock ) return ! r . parentOffset || ! Ee ( e . doc , r . pos ) ? ! 1 : ( n && n ( e . tr . split ( r . pos ) . scrollIntoView ( ) ) , ! 0 ) ; if ( ! r . depth ) return ! 1 ; let i = [ ] , s , l , a = ! 1 , c = ! 1 ; for ( let h = r . depth ; ; h -- ) if ( r . node ( h ) . isBlock ) { a = r . end ( h ) == r . pos + ( r . depth - h ) , c = r . start ( h ) == r . pos - ( r . depth - h ) , l = Qi ( r . node ( h - 1 ) . contentMatchAt ( r . indexAfter ( h - 1 ) ) ) ; let m = t && t ( o . parent , a , r ) ; i . unshift ( m || ( a && l ? { type : l } : null ) ) , s = h ; break } else { if ( h == 1 ) return ! 1 ; i . unshift ( null ) } let d = e . tr ; ( e . selection instanceof D || e . selection instanceof ke ) && d . deleteSelection ( ) ; let u = d . mapping . map ( r . pos ) , f = Ee ( d . doc , u , i . length , i ) ; if ( f || ( i [ 0 ] = l ? { type : l } : null , f = Ee ( d . doc , u , i . length , i ) ) , ! f ) return ! 1 ; if ( d . split ( u , i . length , i ) , ! a && c && r . node ( s ) . type != l ) { let h = d . mapping . map ( r . before ( s ) ) , p = d . doc . resolve ( h ) ; l && r . node ( s - 1 ) . canReplaceWith ( p . index ( ) , p . index ( ) + 1 , l ) && d . setNodeMarkup ( d . mapping . map ( r . before ( s ) ) , l ) } return n && n ( d . scrollIntoView ( ) ) , ! 0 } } var Xp = Gp ( ) ; var uc = ( t , e ) => { let { $from : n , to : r } = t . selection , o , i = n . sharedDepth ( r ) ; return i == 0 ? ! 1 : ( o = n . before ( i ) , e && e ( t . tr . setSelection ( L . create ( t . doc , o ) ) ) , ! 0 ) } , Yp = ( t , e ) => ( e && e ( t . tr . setSelection ( new ke ( t . doc ) ) ) , ! 0 ) ; function Qp ( t , e , n ) { let r = e . nodeBefore , o = e . nodeAfter , i = e . index ( ) ; return ! r || ! o || ! r . type . compatibleContent ( o . type ) ? ! 1 : ! r . content . size && e . parent . canReplace ( i - 1 , i ) ? ( n && n ( t . tr . delete ( e . pos - r . nodeSize , e . pos ) . scrollIntoView ( ) ) , ! 0 ) : ! e . parent . canReplace ( i , i + 1 ) || ! ( o . isTextblock || Re ( t . doc , e . pos ) ) ? ! 1 : ( n && n ( t . tr . join ( e . pos ) . scrollIntoView ( ) ) , ! 0 ) } function fc ( t , e , n , r ) { let o = e . nodeBefore , i = e . nodeAfter , s , l , a = o . type . spec . isolating || i . type . spec . isolating ; if ( ! a && Qp ( t , e , n ) ) return ! 0 ; let c = ! a && e . parent . canReplace ( e . index ( ) , e . index ( ) + 1 ) ; if ( c && ( s = ( l = o . contentMatchAt ( o . childCount ) ) . findWrapping ( i . type ) ) && l . matchType ( s [ 0 ] || i . type ) . validEnd ) { if ( n ) { let h = e . pos + i . nodeSize , p = v . empty ; for ( let y = s . length - 1 ; y >= 0 ; y -- ) p = v . from ( s [ y ] . create ( null , p ) ) ; p = v . from ( o . copy ( p ) ) ; let m = t . tr . step ( new se ( e . pos - 1 , h , e . pos , h , new E ( p , 1 , 0 ) , s . length , ! 0 ) ) , g = m . doc . resolve ( h + 2 * s . length ) ; g . nodeAfter && g . nodeAfter . type == o . type && Re ( m . doc , g . pos ) && m . join ( g . pos ) , n ( m . scrollIntoView ( ) ) } return ! 0 } let d = i . type . spec . isolating || r > 0 && a ? null : I . findFrom ( e , 1 ) , u = d && d . $from . blockRange ( d . $to ) , f = u && ft ( u ) ; if ( f != null && f >= e . depth ) return n && n ( t . tr . lift ( u , f ) . scrollIntoView ( ) ) , ! 0 ; if ( c && bn ( i , "start" , ! 0 ) && bn ( o , "end" ) ) { let h = o , p = [ ] ; for ( ; p . push ( h ) , ! h . isTextblock ; ) h = h . lastChild ; let m = i , g = 1 ; for ( ; ! m . isTextblock ; m = m . firstChild ) g ++ ; if ( h . canReplace ( h . childCount , h . childCount , m . content ) ) { if ( n ) { let y = v . empty ; for ( let b = p . length - 1 ; b >= 0 ; b -- ) y = v . from ( p [ b ] . copy ( y ) ) ; let w = t . tr . step ( new se ( e . pos - p . length , e . pos + i . nodeSize , e . pos + g , e . pos + i . nodeSize - g , new E ( y , p . length , 0 ) , 0 , ! 0 ) ) ; n ( w . scrollIntoView ( ) ) } return ! 0 } } return ! 1 } function hc ( t ) { return function ( e , n ) { let r = e . selection , o = t < 0 ? r . $from : r . $to , i = o . depth ; for ( ; o . node ( i ) . isInline ; ) { if ( ! i ) return ! 1 ; i -- } return o . node ( i ) . isTextblock ? ( n && n ( e . tr . setSelection ( D . create ( e . doc , t < 0 ? o . start ( i ) : o . end ( i ) ) ) ) , ! 0 ) : ! 1 }
` ),u&&p==h.nodeValue.length)for(let m=h,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:fe(g)+1});break}let y=m.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let m=h.childNodes[p-1];u=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Pe&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||u&&we)&&Yt(l.node,l.offset,d.anchorNode,d.anchorOffset)&&Yt(a.node,a.offset,d.focusNode,d.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(u&&Pe)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?Kt:Mc,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Qe:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Kt:Qe}r=s}this.dirty=Kt}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Kt:Mc;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},_r=class extends Qt{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Le&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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 ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}},gs=class extends Qt{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Mn=class t extends Qt{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=ct.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Qe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Qe&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Le){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Le}}slice(e,n,r){let o=t.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=xs(i,n,s,r)),e>0&&(i=xs(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Dt=class t extends Qt{constructor(e,n,r,o,i,s,l,a,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(n.isText){if(!d)d=document.crea
` ) ; return { dom : a , text : f , slice : e } } function hd ( t , e , n , r , o ) { let i = o . parent . type . spec . code , s , l ; if ( ! n && ! e ) return null ; let a = ! ! e && ( r || i || ! n ) ; if ( a ) { if ( t . someProp ( "transformPastedText" , f => { e = f ( e , i || r , t ) } ) , i ) return l = new E ( v . from ( t . state . schema . text ( e . replace ( /\r\n?/g , `
` ) ) ) , 0 , 0 ) , t . someProp ( "transformPasted" , f => { l = f ( l , t , ! 0 ) } ) , l ; let u = t . someProp ( "clipboardTextParser" , f => f ( e , o , r , t ) ) ; if ( u ) l = u ; else { let f = o . marks ( ) , { schema : h } = t . state , p = ct . fromSchema ( h ) ; s = document . createElement ( "div" ) , e . split ( /(?:\r\n?|\n)+/ ) . forEach ( m => { let g = s . appendChild ( document . createElement ( "p" ) ) ; m && g . appendChild ( p . serializeNode ( h . text ( m , f ) ) ) } ) } } else t . someProp ( "transformPastedHTML" , u => { n = u ( n , t ) } ) , s = Km ( n ) , rr && qm ( s ) ; let c = s && s . querySelector ( "[data-pm-slice]" ) , d = c && /^(\d+) (\d+)(?: -(\d+))? (.*)/ . exec ( c . getAttribute ( "data-pm-slice" ) || "" ) ; if ( d && d [ 3 ] ) for ( let u = + d [ 3 ] ; u > 0 ; u -- ) { let f = s . firstChild ; for ( ; f && f . nodeType != 1 ; ) f = f . nextSibling ; if ( ! f ) break ; s = f } if ( l || ( l = ( t . someProp ( "clipboardParser" ) || t . someProp ( "domParser" ) || Xe . fromSchema ( t . state . schema ) ) . parseSlice ( s , { preserveWhitespace : ! ! ( a || d ) , context : o , ruleFromNode ( f ) { return f . nodeName == "BR" && ! f . nextSibling && f . parentNode && ! Wm . test ( f . parentNode . nodeName ) ? { ignore : ! 0 } : null } } ) ) , d ) l = Jm ( Hc ( l , + d [ 1 ] , + d [ 2 ] ) , d [ 4 ] ) ; else if ( l = E . maxOpen ( jm ( l . content , o ) , ! 0 ) , l . openStart || l . openEnd ) { let u = 0 , f = 0 ; for ( let h = l . content . firstChild ; u < l . openStart && ! h . type . spec . isolating ; u ++ , h = h . firstChild ) ; for ( let h = l . content . lastChild ; f < l . openEnd && ! h . type . spec . isolating ; f ++ , h = h . lastChild ) ; l = Hc ( l , u , f ) } return t . someProp ( "transformPasted" , u => { l = u ( l , t , a ) } ) , l } var Wm = /^(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 jm ( t , e ) { if ( t . childCount < 2 ) return t ; for ( let n = e . depth ; n >= 0 ; n -- ) { let o = e . node ( n ) . contentMatchAt ( e . index ( n ) ) , i , s = [ ] ; if ( t . forEach ( l => { if ( ! s ) return ; let a = o . findWrapping ( l . type ) , c ; if ( ! a ) return s = null ; if ( c = s . length && i . length && md ( a , i , l , s [ s . length - 1 ] , 0 ) ) s [ s . length - 1 ] = c ; else { s . length && ( s [ s . length - 1 ] = gd ( s [ s . length - 1 ] , i . length ) ) ; let d = pd ( l , a ) ; s . push ( d ) , o = o . matchType ( d . type ) , i = a } } ) , s ) return v . from ( s ) } return t } function pd ( t , e , n = 0 ) { for ( let r = e . length - 1 ; r >= n ; r -- ) t = e [ r ] . create ( null , v . from ( t ) ) ; return t } function md ( t , e , n , r , o ) { if ( o < t . length && o < e . length && t [ o ] == e [ o ] ) { let i = md ( t , e , n , r . lastChild , o + 1 ) ; if ( i ) return r . copy ( r . content . replaceChild ( r . childCount - 1 , i ) ) ; if ( r . contentMatchAt ( r . childCount ) . matchType ( o == t . length - 1 ? n . type : t [ o + 1 ] ) ) return r . copy ( r . content . append ( v . from ( pd ( n , t , o + 1 ) ) ) ) } } function gd ( t , e ) { if ( e == 0 ) return t ; let n = t . content . replaceChild ( t . childCount - 1 , gd ( t . lastChild , e - 1 ) ) , r = t . contentMatchAt ( t . childCount ) . fillBefore ( v . empty , ! 0 ) ; return t . copy ( n . append ( r ) ) } function Cs ( t , e , n , r , o , i ) { let s = e < 0 ? t . firstChild : t . lastChild , l = s . content ; return t . childCount > 1 && ( i = 0 ) , o < r - 1 && ( l = Cs ( l , e , n , r , o + 1 , i ) ) , o >= n && ( l = e < 0 ? s . contentMatchAt ( 0 ) . fillBefore ( l , i <= o ) . append ( l ) : l . append ( s . contentMatchAt ( s . childCount ) . fillBefore ( v . empty , ! 0 ) ) ) , t . replaceChild ( e < 0 ? 0 : t . childCount - 1 , s . copy ( l ) ) } function Hc ( t , e , n ) { return e < t . openStart && ( t = new E ( Cs ( t . content , - 1 , e , t . openStart , 0 , t . openEnd ) , e , t . openEnd ) ) , n < t . openEnd && ( t = new E ( Cs ( t . content , 1 , n , t . openEnd , 0 , 0 ) , t . openStart , n ) ) , t } var yd = { thead : [ "table" ] , tbody : [ "table" ] , tfoot : [ "table" ] , caption : [ "table" ] , colgroup : [ "table" ] , col : [ "table" , "colgroup" ] , tr : [ "table" , "tbody" ] , td : [ "table" , "tbody" , "tr" ] , th : [ "table" , "tbody" , "tr" ] } , $c = null ; function bd ( ) { return $c || ( $c = document . implementation . createHTMLDocument ( "title" ) ) } var cs = null ; function Um ( t ) { let e = window . trustedTypes ; return e ? ( cs || ( cs = e . defaultPolicy || e . createPolicy ( "ProseMirrorClipboard" , { createHTML : n => n } ) ) , cs . createHTML ( t ) ) : t } function Km ( t ) { let e = /^(\s*<meta [^>]*>)*/ . exec ( t ) ; e && ( t = t . slice ( e [ 0 ] . length ) ) ; let n = bd ( ) . createElement ( "div" ) , r = /<([a-z][^>\s]+)/i . exec ( t ) , o ; if ( ( o = r && yd [ r [ 1 ] . toLowerCase ( ) ] ) && ( t = o . map ( i => "<" + i + ">" ) . join ( "" ) + t + o . map ( i => "</" + i + ">" ) . reverse ( ) . join ( "" ) ) , n . innerHTML = Um ( t ) , o ) for ( let i = 0 ; i < o . length ; i ++ ) n = n . querySelector ( o [ i ] ) || n ; return n } function qm ( t ) { let e = t . querySelectorAll ( de ? "span:not([class]):not([style])" : "span.Apple-converted-space" ) ; for ( let n = 0 ; n < e . length ; n ++ ) { let r = e [ n ] ; r . childNodes . length == 1 && r . textContent == "\xA0" && r . parentNode && r . parentNode . replaceChild ( t . ownerDocument . createTextNode ( " " ) , r ) } } function Jm ( t , e ) { if ( ! t . size ) return t ; let n = t . content . firstChild . type . schema , r ; try { r = JSON . parse ( e ) } catch { return t } let { content : o , openStart : i , openEnd : s } = t ; for ( let l = r . length - 2 ; l >= 0 ; l -= 2 ) { let a = n . nodes [ r [ l ]
` ,textSerializers:s={}}=n||{},l="";return t.nodesBetween(r,o,(a,c,d,u)=>{var f;a.isBlock&&c>r&&(l+=i);let h=s?.[a.type.name];if(h)return d&&(l+=h({node:a,pos:c,parent:d,index:u,range:e})),!1;a.isText&&(l+=(f=a?.text)==null?void 0:f.slice(Math.max(r,c)-c,o-c))}),l}function Iy(t,e){let n={from:0,to:t.content.size};return Jd(t,n,e)}function Gd(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function Py(t,e){let n=ne(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});let s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Zs(t,e){let n=ho(typeof e=="string"?e:e.name,t.schema);return n==="node"?Py(t,e):n==="mark"?Wd(t,e):{}}function Ly(t,e=JSON.stringify){let n={};return t.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function By(t){let e=Ly(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function el(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{let s=[];if(o.ranges.length)o.forEach((l,a)=>{s.push({from:l,to:a})});else{let{from:l,to:a}=n[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{let c=e.slice(i).map(l,-1),d=e.slice(i).map(a),u=e.invert().map(c,-1),f=e.invert().map(d);r.push({oldRange:{from:u,to:f},newRange:{from:c,to:d}})})}),By(r)}function po(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(o=>{let i=n.resolve(t),s=Ks(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var Xd=(t,e,n,r=20)=>{let o=t.doc.resolve(n),i=r,s=null;for(;i>0&&s===null;){let l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function $ s(t,e){return e.nodes[t]||e.marks[t]||null}function so(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var zy=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;let d=((c=(a=o.type.spec).toText)==null?void 0:c.call(a,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?d:d.slice(0,Math.max(0,r-i))}),n};function Ws(t,e,n={}){let{empty:r,ranges:o}=t.selection,i=e?wt(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection. $ from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>lo(u.attrs,n,{strict:!1}));let s=0,l=[];if(o.forEach(({ $ from:u, $ to:f})=>{let h=u.pos,p=f.pos;t.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;let y=Math.max(h,g),w=Math.min(p,g+m.nodeSize),b=w-y;s+=b,l.push(...m.marks.map(C=>({mark:C,from:y,to:w})))})}),s===0)return!1;let a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>lo(u.mark.attrs,n,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,f)=>u+f.to-f.from,0);return(a>0?a+c:a)>=s}function tl(t,e,n={}){if(!e)return Ze(t,null,n)||Ws(t,null,n);let r=ho(e,t.schema);return r==="node"?Ze(t,e,n):r==="mark"?Ws(t,e,n):!1}var Yd=(t,e)=>{let{ $ from:n, $ to:r, $ anchor:o}=t.selection;if(e){let i=et(l=>l.type.name===e)(t.selection);if(!i)return!1;let s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Qd=t=>{let{ $ from:e, $ to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Ld(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Bd(t,e){let{nodeExtensions:n}=An(e),r=n.find(s=>s.name===t);if(!r)return!1;let o={name:r.name,options:r.options,storage:r.storage},i=G(B(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function lr(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^ \s * $ /m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.
` , rules : n , plugin : r } ) : ! 1 } } , isInputRules : ! 0 } ) ; return r } function db ( t ) { return Object . prototype . toString . call ( t ) . slice ( 8 , - 1 ) } function oo ( t ) { return db ( t ) !== "Object" ? ! 1 : t . constructor === Object && Object . getPrototypeOf ( t ) === Object . prototype } function nu ( t , e ) { let n = { ... t } ; return oo ( t ) && oo ( e ) && Object . keys ( e ) . forEach ( r => { oo ( e [ r ] ) && oo ( t [ r ] ) ? n [ r ] = nu ( t [ r ] , e [ r ] ) : n [ r ] = e [ r ] } ) , n } var nl = class { constructor ( t = { } ) { this . type = "extendable" , this . parent = null , this . child = null , this . name = "" , this . config = { name : this . name } , this . config = { ... this . config , ... t } , this . name = this . config . name } get options ( ) { return { ... G ( B ( this , "addOptions" , { name : this . name } ) ) || { } } } get storage ( ) { return { ... G ( B ( this , "addStorage" , { name : this . name , options : this . options } ) ) || { } } } configure ( t = { } ) { let e = this . extend ( { ... this . config , addOptions : ( ) => nu ( this . options , t ) } ) ; return e . name = this . name , e . parent = this . parent , e } extend ( t = { } ) { let e = new this . constructor ( { ... this . config , ... t } ) ; return e . parent = this , this . child = e , e . name = "name" in t ? t . name : e . parent . name , e } } , ee = class ru extends nl { constructor ( ) { super ( ... arguments ) , this . type = "mark" } static create ( e = { } ) { let n = typeof e == "function" ? e ( ) : e ; return new ru ( n ) } static handleExit ( { editor : e , mark : n } ) { let { tr : r } = e . state , o = e . state . selection . $from ; if ( o . pos === o . end ( ) ) { let s = o . marks ( ) ; if ( ! ! ! s . find ( c => c ? . type . name === n . name ) ) return ! 1 ; let a = s . find ( c => c ? . type . name === n . name ) ; return a && r . removeStoredMark ( a ) , r . insertText ( " " , o . pos ) , e . view . dispatch ( r ) , ! 0 } return ! 1 } configure ( e ) { return super . configure ( e ) } extend ( e ) { let n = typeof e == "function" ? e ( ) : e ; return super . extend ( n ) } } ; function ub ( t ) { return typeof t == "number" } var fb = class { constructor ( t ) { this . find = t . find , this . handler = t . handler } } , hb = ( t , e , n ) => { if ( Us ( e ) ) return [ ... t . matchAll ( e ) ] ; let r = e ( t , n ) ; return r ? r . map ( o => { let i = [ o . text ] ; return i . index = o . index , i . input = t , i . data = o . data , o . replaceWith && ( o . text . includes ( o . replaceWith ) || console . warn ( '[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".' ) , i . push ( o . replaceWith ) ) , i } ) : [ ] } ; function pb ( t ) { let { editor : e , state : n , from : r , to : o , rule : i , pasteEvent : s , dropEvent : l } = t , { commands : a , chain : c , can : d } = new uo ( { editor : e , state : n } ) , u = [ ] ; return n . doc . nodesBetween ( r , o , ( h , p ) => { var m , g , y , w , b ; if ( ( g = ( m = h . type ) == null ? void 0 : m . spec ) != null && g . code || ! ( h . isText || h . isTextblock || h . isInline ) ) return ; let C = ( b = ( w = ( y = h . content ) == null ? void 0 : y . size ) != null ? w : h . nodeSize ) != null ? b : 0 , x = Math . max ( r , p ) , S = Math . min ( o , p + C ) ; if ( x >= S ) return ; let k = h . isText ? h . text || "" : h . textBetween ( x - p , S - p , void 0 , "\uFFFC" ) ; hb ( k , i . find , s ) . forEach ( T => { if ( T . index === void 0 ) return ; let A = x + T . index + 1 , $ = A + T [ 0 ] . length , z = { from : n . tr . mapping . map ( A ) , to : n . tr . mapping . map ( $ ) } , K = i . handler ( { state : n , range : z , match : T , commands : a , chain : c , can : d , pasteEvent : s , dropEvent : l } ) ; u . push ( K ) } ) } ) , u . every ( h => h !== null ) } var io = null , mb = t => { var e ; let n = new ClipboardEvent ( "paste" , { clipboardData : new DataTransfer } ) ; return ( e = n . clipboardData ) == null || e . setData ( "text/html" , t ) , n } ; function gb ( t ) { let { editor : e , rules : n } = t , r = null , o = ! 1 , i = ! 1 , s = typeof ClipboardEvent < "u" ? new ClipboardEvent ( "paste" ) : null , l ; try { l = typeof DragEvent < "u" ? new DragEvent ( "drop" ) : null } catch { l = null } let a = ( { state : d , from : u , to : f , rule : h , pasteEvt : p } ) => { let m = d . tr , g = co ( { state : d , transaction : m } ) ; if ( ! ( ! pb ( { editor : e , state : g , from : Math . max ( u - 1 , 0 ) , to : f . b - 1 , rule : h , pasteEvent : p , dropEvent : l } ) || ! m . steps . length ) ) { try { l = typeof DragEvent < "u" ? new DragEvent ( "drop" ) : null } catch { l = null } return s = typeof ClipboardEvent < "u" ? new ClipboardEvent ( "paste" ) : null , m } } ; return n . map ( d => new P ( { view ( u ) { let f = p => { var m ; r = ( m = u . dom . parentElement ) != null && m . contains ( p . target ) ? u . dom . parentElement : null , r && ( io = e ) } , h = ( ) => { io && ( io = null ) } ; return window . addEventListener ( "dragstart" , f ) , window . addEventListener ( "dragend" , h ) , { destroy ( ) { window . removeEventListener ( "dragstart" , f ) , window . removeEventListener ( "dragend" , h ) } } } , props : { handleDOMEvents : { drop : ( u , f ) => { if ( i = r === u . dom . parentElement , l = f , ! i ) { let h = io ; h ? . isEditable && setTimeout ( ( ) => { let p = h . state . selection ; p && h . commands . deleteRange ( { from : p . from , to : p . to } ) } , 10 ) } return ! 1 } , paste : ( u , f ) => { var h ; let p = ( h = f . clipboardData ) == null ? void 0 : h . getData ( "text/html" ) ; return s = f , o = ! ! p ? . includes ( "data-pm-slice" ) , ! 1 } } } , appendTransaction : ( u , f , h ) => { let p = u [ 0 ] ,
2025-09-21 18:07:30 +08:00
position : relative ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. 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 */
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror [ contenteditable = "false" ] {
white - space : normal ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror [ contenteditable = "false" ] [ contenteditable = "true" ] {
white - space : pre - wrap ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror pre {
white - space : pre - wrap ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
img . ProseMirror - separator {
display : inline ! important ;
border : none ! important ;
margin : 0 ! important ;
width : 0 ! important ;
height : 0 ! important ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror - gapcursor {
display : none ;
pointer - events : none ;
position : absolute ;
margin : 0 ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror - gapcursor : after {
content : "" ;
display : block ;
position : absolute ;
top : - 2 px ;
width : 20 px ;
border - top : 1 px solid black ;
animation : ProseMirror - cursor - blink 1.1 s steps ( 2 , start ) infinite ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
@ keyframes ProseMirror - cursor - blink {
to {
visibility : hidden ;
}
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror - hideselection * : : selection {
background : transparent ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror - hideselection * : : - moz - selection {
background : transparent ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror - hideselection * {
caret - color : transparent ;
2024-12-25 23:09:07 +08:00
}
2025-09-21 18:07:30 +08:00
. ProseMirror - focused . ProseMirror - gapcursor {
display : block ;
2026-01-18 19:17:29 +08:00
} ` ;function xb(t,e,n){let r=document.querySelector( ` style [ data - tiptap - style$ { n ? ` - ${ n } ` : "" } ] ` );if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute( ` data - tiptap - style$ { n ? ` - ${ n } ` : "" } ` ,""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var gu=class extends lb{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?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:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Hy,createMappablePosition: $ y},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("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:r,slice:o,moved:i})=>this.options.onDrop(r,o,i)),this.on("paste",({event:r,slice:o})=>this.options.onPaste(r,o)),this.on("delete",this.options.onDelete);let e=this.createDoc(),n=Fd(e,this.options.autofocus);this.editorState=Fr.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll( ` . $ { this . className } ` ).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}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&&typeof document<"u"&&(this.css=xb(wb,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing
` , textSerializers : n = { } } = t || { } ; return Iy ( this . state . doc , { blockSeparator : e , textSerializers : { ... Gd ( this . schema ) , ... n } } ) } get isEmpty ( ) { return lr ( this . state . doc ) } destroy ( ) { this . emit ( "destroy" ) , this . unmount ( ) , this . removeAllListeners ( ) } get isDestroyed ( ) { var t , e ; return ( e = ( t = this . editorView ) == null ? void 0 : t . isDestroyed ) != null ? e : ! 0 } $node ( t , e ) { var n ; return ( ( n = this . $doc ) == null ? void 0 : n . querySelector ( t , e ) ) || null } $nodes ( t , e ) { var n ; return ( ( n = this . $doc ) == null ? void 0 : n . querySelectorAll ( t , e ) ) || null } $pos ( t ) { let e = this . state . doc . resolve ( t ) ; return new bb ( e , this ) } get $doc ( ) { return this . $pos ( 0 ) } } ; function Be ( t ) { return new go ( { find : t . find , handler : ( { state : e , range : n , match : r } ) => { let o = G ( t . getAttributes , void 0 , r ) ; if ( o === ! 1 || o === null ) return null ; let { tr : i } = e , s = r [ r . length - 1 ] , l = r [ 0 ] ; if ( s ) { let a = l . search ( /\S/ ) , c = n . from + l . indexOf ( s ) , d = c + s . length ; if ( po ( n . from , n . to , e . doc ) . filter ( h => h . mark . type . excluded . find ( m => m === t . type && m !== h . mark . type ) ) . filter ( h => h . to > c ) . length ) return null ; d < n . to && i . delete ( d , n . to ) , c > n . from && i . delete ( n . from + a , c ) ; let f = n . from + a + s . length ; i . addMark ( n . from + a , f , t . type . create ( o || { } ) ) , i . removeStoredMark ( t . type ) } } , undoable : t . undoable } ) } function bo ( t ) { return new go ( { find : t . find , handler : ( { state : e , range : n , match : r } ) => { let o = G ( t . getAttributes , void 0 , r ) || { } , { tr : i } = e , s = n . from , l = n . to , a = t . type . create ( o ) ; if ( r [ 1 ] ) { let c = r [ 0 ] . lastIndexOf ( r [ 1 ] ) , d = s + c ; d > l ? d = l : l = d + r [ 1 ] . length ; let u = r [ 0 ] [ r [ 0 ] . length - 1 ] ; i . insertText ( u , s + r [ 0 ] . length - 1 ) , i . replaceWith ( d , l , a ) } else if ( r [ 0 ] ) { let c = t . type . isInline ? s : s - 1 ; i . insert ( c , t . type . create ( o ) ) . delete ( i . mapping . map ( s ) , i . mapping . map ( l ) ) } i . scrollIntoView ( ) } , undoable : t . undoable } ) } function ar ( t ) { return new go ( { find : t . find , handler : ( { state : e , range : n , match : r } ) => { let o = e . doc . resolve ( n . from ) , i = G ( t . getAttributes , void 0 , r ) || { } ; if ( ! o . node ( - 1 ) . canReplaceWith ( o . index ( - 1 ) , o . indexAfter ( - 1 ) , t . type ) ) return null ; e . tr . delete ( n . from , n . to ) . setBlockType ( n . from , n . from , t . type , i ) } , undoable : t . undoable } ) } function tt ( t ) { return new go ( { find : t . find , handler : ( { state : e , range : n , match : r , chain : o } ) => { let i = G ( t . getAttributes , void 0 , r ) || { } , s = e . tr . delete ( n . from , n . to ) , a = s . doc . resolve ( n . from ) . blockRange ( ) , c = a && mn ( a , t . type , i ) ; if ( ! c ) return null ; if ( s . wrap ( a , c ) , t . keepMarks && t . editor ) { let { selection : u , storedMarks : f } = e , { splittableMarks : h } = t . editor . extensionManager , p = f || u . $to . parentOffset && u . $from . marks ( ) ; if ( p ) { let m = p . filter ( g => h . includes ( g . type . name ) ) ; s . ensureMarks ( m ) } } if ( t . keepAttributes ) { let u = t . type . name === "bulletList" || t . type . name === "orderedList" ? "listItem" : "taskList" ; o ( ) . updateAttributes ( u , i ) . run ( ) } let d = s . doc . resolve ( n . from - 1 ) . nodeBefore ; d && d . type === t . type && Re ( s . doc , n . from - 1 ) && ( ! t . joinPredicate || t . joinPredicate ( r , d ) ) && s . join ( n . from - 1 ) } , undoable : t . undoable } ) } var kb = t => "touches" in t , yu = class { constructor ( t ) { 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 = l => { if ( ! this . isResizing || ! this . activeHandle ) return ; let a = l . clientX - this . startX , c = l . clientY - this . startY ; this . handleResize ( a , c ) } , this . handleTouchMove = l => { if ( ! this . isResizing || ! this . activeHandle ) return ; let a = l . touches [ 0 ] ; if ( ! a ) return ; let c = a . clientX - this . startX , d = a . clientY - this . startY ; this . handleResize ( c , d ) } , this . handleMouseUp = ( ) => { if ( ! this . isResizing ) return ; let l = this . element . offsetWidth , a = this . element . offsetHeight ; this . onCommit ( l , a ) , 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 = l => { l . key === "Shift" && ( this . isShiftKeyPressed = ! 0 ) } , this . handleKeyUp = l => { l . k
` );return ` : : : $ { c } $ { m }
$ { g }
: : : ` }}}function vb(t){if(!t.trim())return{};let e={},n=/( \w +)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(t);for(;r!==null;){let[,o,i,s]=r;e[o]=i||s,r=n.exec(t)}return e}function Mb(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=> ` $ { e } = "${n}" ` ).join(" ")}function Tb(t){let{nodeName:e,name:n,getContent:r,parseAttributes:o=vb,serializeAttributes:i=Mb,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=t,c=n||e,d=f=>{if(!a)return f;let h={};return a.forEach(p=>{let m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in f){let y=f[m];if(g!==void 0&&y===g)return;h[m]=y}}),h},u=c.replace(/[.*+?^ ${ } ()|[ \] \\ ]/g," \\ $ &");return{parseMarkdown:(f,h)=>{let p={...s,...f.attributes};if(l)return h.createNode(e,p);let m=r?r(f):f.content||"";return m?h.createNode(e,p,[h.createTextNode(m)]):h.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(f){let h=l?new RegExp( ` \ \ [ $ { u } \ \ s * [ ^ \ \ ] ] * \ \ ] ` ):new RegExp( ` \ \ [ $ { u } \ \ s * [ ^ \ \ ] ] * \ \ ] [ \ \ s \ \ S ] * ? \ \ [ \ \ / $ { u } \ \ ] ` ),p=f.match(h),m=p?.index;return m!==void 0?m:-1},tokenize(f,h,p){let m=l?new RegExp( ` ^ \ \ [ $ { u } \ \ s * ( [ ^ \ \ ] ] * ) \ \ ] ` ):new RegExp( ` ^ \ \ [ $ { u } \ \ s * ( [ ^ \ \ ] ] * ) \ \ ] ( [ \ \ s \ \ S ] * ? ) \ \ [ \ \ / $ { u } \ \ ] ` ),g=f.match(m);if(!g)return;let y="",w="";if(l){let[,C]=g;w=C}else{let[,C,x]=g;w=C,y=x||""}let b=o(w.trim());return{type:e,raw:g[0],content:y.trim(),attributes:b}}},renderMarkdown:f=>{let h="";r?h=r(f):f.content&&f.content.length>0&&(h=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));let p=d(f.attrs||{}),m=i(p),g=m? ` $ { m } ` :"";return l? ` [ $ { c } $ { g } ] ` : ` [ $ { c } $ { g } ] $ { h } [ / $ { c } ] ` } } } f u n c t i o n w o ( t , e , n ) { v a r r , o , i , s ; l e t l = t . s p l i t ( `
` ),a=[],c="",d=0,u=e.baseIndentSize||2;for(;d<l.length;){let f=l[d],h=f.match(e.itemPattern);if(!h){if(a.length>0)break;if(f.trim()===""){d+=1,c= ` $ { c } $ { f }
` ;continue}else return}let p=e.extractItemData(h),{indentLevel:m,mainContent:g}=p;c= ` $ { c } $ { f }
` ;let y=[g];for(d+=1;d<l.length;){let x=l[d];if(x.trim()===""){let k=l.slice(d+1).findIndex(A=>A.trim()!=="");if(k===-1)break;if((((o=(r=l[d+1+k].match(/^( \s *)/))==null?void 0:r[1])==null?void 0:o.length)||0)>m){y.push(x),c= ` $ { c } $ { x }
` ,d+=1;continue}else break}if((((s=(i=x.match(/^( \s *)/))==null?void 0:i[1])==null?void 0:s.length)||0)>m)y.push(x),c= ` $ { c } $ { x }
` ,d+=1;else break}let w,b=y.slice(1);if(b.length>0){let x=b.map(S=>S.slice(m+u)).join( `
` );x.trim()&&(e.customNestedParser?w=e.customNestedParser(x):w=n.blockTokens(x))}let C=e.createToken(p,w);a.push(C)}if(a.length!==0)return{items:a,raw:c}}function cr(t,e,n,r){if(!t||!Array.isArray(t.content))return"";let o=typeof n=="function"?n(r):n,[i,...s]=t.content,l=e.renderChildren([i]),a=[ ` $ { o } $ { l } ` ];return s&&s.length>0&&s.forEach(c=>{let d=e.renderChildren([c]);if(d){let u=d.split( `
` ).map(f=>f?e.indent(f):"").join( `
` );a.push(u)}}),a.join( `
` )}function Ab(t,e,n={}){let{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((l,a)=>{let c=i.mapping.map(a),d=i.mapping.map(a)+l.nodeSize,u=null;if(l.marks.forEach(h=>{if(h!==s)return!1;u=h}),!u)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==u.attrs[h]&&(f=!0)}),f){let h=t.type.create({...t.attrs,...n});i.removeMark(c,d,t.type),i.addMark(c,d,h)}}),i.docChanged&&e.view.dispatch(i)}var F=class xu extends nl{constructor(){super(...arguments),this.type="node"}static create(e={}){let n=typeof e=="function"?e():e;return new xu(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}};function Me(t){return new fb({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{let i=G(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,l=r[r.length-1],a=r[0],c=n.to;if(l){let d=a.search(/ \S /),u=n.from+a.indexOf(l),f=u+l.length;if(po(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>u).length)return null;f<n.to&&s.delete(f,n.to),u>n.from&&s.delete(n.from+d,u),c=n.from+d+l.length,s.addMark(n.from+d,c,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function ku(t={}){return new P({view(e){return new il(e,t)}})}var il=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let u=e.nodeBefore,f=e.nodeAfter;if(u||f){let h=this.editorView.nodeDOM(this.cursorPos-(u?u.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=u?p.bottom:p.top;u&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*l;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let u=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:u.left-f,right:u.left+f,top:u.top,bottom:u.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,d=-pageYOffset;else{let u=a.getBoundingClientRect(),f=u.width/a.offsetWidth,h=u.height/a.offsetHeight;c=u.left-a.scrollLeft*f,d=u.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-d)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=zr(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.schedu
` ) . map ( a => a . trim ( ) === "" ? n : ` ${ n } ${ a } ` ) ; r . push ( l . join ( `
` ) ) } ) , r . join ( `
${ n }
` ) } , addCommands ( ) { return { setBlockquote : ( ) => ( { commands : t } ) => t . wrapIn ( this . name ) , toggleBlockquote : ( ) => ( { commands : t } ) => t . toggleWrap ( this . name ) , unsetBlockquote : ( ) => ( { commands : t } ) => t . lift ( this . name ) } } , addKeyboardShortcuts ( ) { return { "Mod-Shift-b" : ( ) => this . editor . commands . toggleBlockquote ( ) } } , addInputRules ( ) { return [ tt ( { find : _b , type : this . type } ) ] } } ) , Du = Wb ; var jb = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/ , Ub = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g , Kb = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/ , qb = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g , Jb = ee . create ( { name : "bold" , addOptions ( ) { return { HTMLAttributes : { } } } , parseHTML ( ) { return [ { tag : "strong" } , { tag : "b" , getAttrs : t => t . style . fontWeight !== "normal" && null } , { style : "font-weight=400" , clearMark : t => t . type . name === this . name } , { style : "font-weight" , getAttrs : t => / ^ ( bold ( er ) ? | [ 5 - 9 ] \ d { 2 , } ) $ / . test ( t ) && null } ] } , renderHTML ( { HTMLAttributes : t } ) { return Nn ( "strong" , { ... R ( this . options . HTMLAttributes , t ) , children : Nn ( "slot" , { } ) } ) } , markdownTokenName : "strong" , parseMarkdown : ( t , e ) => e . applyMark ( "bold" , e . parseInline ( t . tokens || [ ] ) ) , renderMarkdown : ( t , e ) => ` ** ${ e . renderChildren ( t ) } ** ` , addCommands ( ) { return { setBold : ( ) => ( { commands : t } ) => t . setMark ( this . name ) , toggleBold : ( ) => ( { commands : t } ) => t . toggleMark ( this . name ) , unsetBold : ( ) => ( { commands : t } ) => t . unsetMark ( this . name ) } } , addKeyboardShortcuts ( ) { return { "Mod-b" : ( ) => this . editor . commands . toggleBold ( ) , "Mod-B" : ( ) => this . editor . commands . toggleBold ( ) } } , addInputRules ( ) { return [ Be ( { find : jb , type : this . type } ) , Be ( { find : Kb , type : this . type } ) ] } , addPasteRules ( ) { return [ Me ( { find : Ub , type : this . type } ) , Me ( { find : qb , type : this . type } ) ] } } ) , Iu = Jb ; var Gb = /(^|[^`])`([^`]+)`(?!`)$/ , Xb = /(^|[^`])`([^`]+)`(?!`)/g , Yb = ee . create ( { name : "code" , addOptions ( ) { return { HTMLAttributes : { } } } , excludes : "_" , code : ! 0 , exitable : ! 0 , parseHTML ( ) { return [ { tag : "code" } ] } , renderHTML ( { HTMLAttributes : t } ) { return [ "code" , R ( this . options . HTMLAttributes , t ) , 0 ] } , markdownTokenName : "codespan" , parseMarkdown : ( t , e ) => e . applyMark ( "code" , [ { type : "text" , text : t . text || "" } ] ) , renderMarkdown : ( t , e ) => t . content ? ` \` ${ e . renderChildren ( t . content ) } \` ` : "" , addCommands ( ) { return { setCode : ( ) => ( { commands : t } ) => t . setMark ( this . name ) , toggleCode : ( ) => ( { commands : t } ) => t . toggleMark ( this . name ) , unsetCode : ( ) => ( { commands : t } ) => t . unsetMark ( this . name ) } } , addKeyboardShortcuts ( ) { return { "Mod-e" : ( ) => this . editor . commands . toggleCode ( ) } } , addInputRules ( ) { return [ Be ( { find : Gb , type : this . type } ) ] } , addPasteRules ( ) { return [ Me ( { find : Xb , type : this . type } ) ] } } ) , Pu = Yb ; var hl = 4 , Qb = /^```([a-z]+)?[\s\n]$/ , Zb = /^~~~([a-z]+)?[\s\n]$/ , e0 = F . create ( { name : "codeBlock" , addOptions ( ) { return { languageClassPrefix : "language-" , exitOnTripleEnter : ! 0 , exitOnArrowDown : ! 0 , defaultLanguage : null , enableTabIndentation : ! 1 , tabSize : hl , HTMLAttributes : { } } } , content : "text*" , marks : "" , group : "block" , code : ! 0 , defining : ! 0 , addAttributes ( ) { return { language : { default : this . options . defaultLanguage , parseHTML : t => { var e ; let { languageClassPrefix : n } = this . options ; if ( ! n ) return null ; let i = [ ... ( ( e = t . firstElementChild ) == null ? void 0 : e . classList ) || [ ] ] . filter ( s => s . startsWith ( n ) ) . map ( s => s . replace ( n , "" ) ) [ 0 ] ; return i || null } , rendered : ! 1 } } } , parseHTML ( ) { return [ { tag : "pre" , preserveWhitespace : "full" } ] } , renderHTML ( { node : t , HTMLAttributes : e } ) { return [ "pre" , R ( this . options . HTMLAttributes , e ) , [ "code" , { class : t . attrs . language ? this . options . languageClassPrefix + t . attrs . language : null } , 0 ] ] } , markdownTokenName : "code" , parseMarkdown : ( t , e ) => { var n ; return ( ( n = t . raw ) == null ? void 0 : n . startsWith ( "```" ) ) === ! 1 && t . codeBlockStyle !== "indented" ? [ ] : e . createNode ( "codeBlock" , { language : t . lang || null } , t . text ? [ e . createTextNode ( t . text ) ] : [ ] ) } , renderMarkdown : ( t , e ) => { var n ; let r = "" , o = ( ( n = t . attrs ) == null ? void 0 : n . language ) || "" ; return t . content ? r = [ ` \` \` \` ${ o } ` , e . renderChildren ( t . content ) , "```" ] . join ( `
` ) : r = ` \` \` \` ${ o }
\` \` \` ` , r } , addCommands ( ) { return { setCodeBlock : t => ( { commands : e } ) => e . setNode ( this . name , t ) , toggleCodeBlock : t => ( { commands : e } ) => e . toggleNode ( this . name , "paragraph" , t ) } } , addKeyboardShortcuts ( ) { return { "Mod-Alt-c" : ( ) => this . editor . commands . toggleCodeBlock ( ) , Backspace : ( ) => { let { empty : t , $anchor : e } = this . editor . state . selection , n = e . pos === 1 ; return ! t || e . parent . type . name !== this . name ? ! 1 : n || ! e . parent . textContent . length ? this . editor . commands . clearNodes ( ) : ! 1 } , Tab : ( { editor : t } ) => { var e ; if ( ! this . options . enableTabIndentation ) return ! 1 ; let n = ( e = this . options . tabSize ) != null ? e : hl , { state : r } = t , { selection : o } = r , { $from : i , empty : s } = o ; if ( i . parent . type !== this . type ) return ! 1 ; let l = " " . repeat ( n ) ; return s ? t . commands . insertContent ( l ) : t . commands . command ( ( { tr : a } ) => { let { from : c , to : d } = o , h = r . doc . textBetween ( c , d , `
2025-09-21 18:07:30 +08:00
` , `
` ) . split ( `
2026-01-18 19:17:29 +08:00
` ) . map ( p => l + p ) . join ( `
` ) ; return a . replaceWith ( c , d , r . schema . text ( h ) ) , ! 0 } ) } , "Shift-Tab" : ( { editor : t } ) => { var e ; if ( ! this . options . enableTabIndentation ) return ! 1 ; let n = ( e = this . options . tabSize ) != null ? e : hl , { state : r } = t , { selection : o } = r , { $from : i , empty : s } = o ; return i . parent . type !== this . type ? ! 1 : s ? t . commands . command ( ( { tr : l } ) => { var a ; let { pos : c } = i , d = i . start ( ) , u = i . end ( ) , h = r . doc . textBetween ( d , u , `
2025-09-21 18:07:30 +08:00
` , `
` ) . split ( `
2026-01-18 19:17:29 +08:00
` ) , p = 0 , m = 0 , g = c - d ; for ( let S = 0 ; S < h . length ; S += 1 ) { if ( m + h [ S ] . length >= g ) { p = S ; break } m += h [ S ] . length + 1 } let w = ( ( a = h [ p ] . match ( /^ */ ) ) == null ? void 0 : a [ 0 ] ) || "" , b = Math . min ( w . length , n ) ; if ( b === 0 ) return ! 0 ; let C = d ; for ( let S = 0 ; S < p ; S += 1 ) C += h [ S ] . length + 1 ; return l . delete ( C , C + b ) , c - C <= b && l . setSelection ( D . create ( l . doc , C ) ) , ! 0 } ) : t . commands . command ( ( { tr : l } ) => { let { from : a , to : c } = o , f = r . doc . textBetween ( a , c , `
2025-09-21 18:07:30 +08:00
` , `
` ) . split ( `
2026-01-18 19:17:29 +08:00
` ) . map ( h => { var p ; let m = ( ( p = h . match ( /^ */ ) ) == null ? void 0 : p [ 0 ] ) || "" , g = Math . min ( m . length , n ) ; return h . slice ( g ) } ) . join ( `
` ) ; return l . replaceWith ( a , c , r . schema . text ( f ) ) , ! 0 } ) } , Enter : ( { editor : t } ) => { if ( ! this . options . exitOnTripleEnter ) return ! 1 ; let { state : e } = t , { selection : n } = e , { $from : r , empty : o } = n ; if ( ! o || r . parent . type !== this . type ) return ! 1 ; let i = r . parentOffset === r . parent . nodeSize - 2 , s = r . parent . textContent . endsWith ( `
` ) ; return ! i || ! s ? ! 1 : t . chain ( ) . command ( ( { tr : l } ) => ( l . delete ( r . pos - 2 , r . pos ) , ! 0 ) ) . exitCode ( ) . run ( ) } , ArrowDown : ( { editor : t } ) => { if ( ! this . options . exitOnArrowDown ) return ! 1 ; let { state : e } = t , { selection : n , doc : r } = e , { $from : o , empty : i } = n ; if ( ! i || o . parent . type !== this . type || ! ( o . parentOffset === o . parent . nodeSize - 2 ) ) return ! 1 ; let l = o . after ( ) ; return l === void 0 ? ! 1 : r . nodeAt ( l ) ? t . commands . command ( ( { tr : c } ) => ( c . setSelection ( I . near ( r . resolve ( l ) ) ) , ! 0 ) ) : t . commands . exitCode ( ) } } } , addInputRules ( ) { return [ ar ( { find : Qb , type : this . type , getAttributes : t => ( { language : t [ 1 ] } ) } ) , ar ( { find : Zb , type : this . type , getAttributes : t => ( { language : t [ 1 ] } ) } ) ] } , addProseMirrorPlugins ( ) { return [ new P ( { key : new H ( "codeBlockVSCodeHandler" ) , props : { handlePaste : ( t , e ) => { if ( ! e . clipboardData || this . editor . isActive ( this . type . name ) ) return ! 1 ; let n = e . clipboardData . getData ( "text/plain" ) , r = e . clipboardData . getData ( "vscode-editor-data" ) , o = r ? JSON . parse ( r ) : void 0 , i = o ? . mode ; if ( ! n || ! i ) return ! 1 ; let { tr : s , schema : l } = t . state , a = l . text ( n . replace ( /\r\n?/g , `
` ) ) ; return s . replaceSelectionWith ( this . type . create ( { language : i } , a ) ) , s . selection . $from . parent . type !== this . type && s . setSelection ( D . near ( s . doc . resolve ( Math . max ( 0 , s . selection . from - 2 ) ) ) ) , s . setMeta ( "paste" , ! 0 ) , t . dispatch ( s ) , ! 0 } } } ) ] } } ) , Lu = e0 ; var Bu = F . create ( { name : "customBlock" , group : "block" , atom : ! 0 , defining : ! 0 , draggable : ! 0 , selectable : ! 0 , isolating : ! 0 , allowGapCursor : ! 0 , inline : ! 1 , addNodeView ( ) { return ( { editor : t , node : e , getPos : n , HTMLAttributes : r , decorations : o , extension : i } ) => { let s = document . createElement ( "div" ) ; s . setAttribute ( "data-config" , e . attrs . config ) , s . setAttribute ( "data-id" , e . attrs . id ) , s . setAttribute ( "data-type" , "customBlock" ) ; let l = document . createElement ( "div" ) ; if ( l . className = "fi-fo-rich-editor-custom-block-header fi-not-prose" , s . appendChild ( l ) , t . isEditable && typeof e . attrs . config == "object" && e . attrs . config !== null && Object . keys ( e . attrs . config ) . length > 0 ) { let c = document . createElement ( "div" ) ; c . className = "fi-fo-rich-editor-custom-block-edit-btn-ctn" , l . appendChild ( c ) ; let d = document . createElement ( "button" ) ; d . className = "fi-icon-btn" , d . type = "button" , d . innerHTML = i . options . editCustomBlockButtonIconHtml , d . addEventListener ( "click" , ( ) => i . options . editCustomBlockUsing ( e . attrs . id , e . attrs . config ) ) , c . appendChild ( d ) } let a = document . createElement ( "p" ) ; if ( a . className = "fi-fo-rich-editor-custom-block-heading" , a . textContent = e . attrs . label , l . appendChild ( a ) , t . isEditable ) { let c = document . createElement ( "div" ) ; c . className = "fi-fo-rich-editor-custom-block-delete-btn-ctn" , l . appendChild ( c ) ; let d = document . createElement ( "button" ) ; d . className = "fi-icon-btn" , d . type = "button" , d . innerHTML = i . options . deleteCustomBlockButtonIconHtml , d . addEventListener ( "click" , ( ) => t . chain ( ) . setNodeSelection ( n ( ) ) . deleteSelection ( ) . run ( ) ) , c . appendChild ( d ) } if ( e . attrs . preview ) { let c = document . createElement ( "div" ) ; c . className = "fi-fo-rich-editor-custom-block-preview fi-not-prose" , c . innerHTML = new TextDecoder ( ) . decode ( Uint8Array . from ( atob ( e . attrs . preview ) , d => d . charCodeAt ( 0 ) ) ) , s . appendChild ( c ) } return { dom : s } } } , addOptions ( ) { return { deleteCustomBlockButtonIconHtml : null , editCustomBlockButtonIconHtml : null , editCustomBlockUsing : ( ) => { } , insertCustomBlockUsing : ( ) => { } } } , addAttributes ( ) { return { config : { default : null , parseHTML : t => JSON . parse ( t . getAttribute ( "data-config" ) ) } , id : { default : null , parseHTML : t => t . getAttribute ( "data-id" ) , renderHTML : t => t . id ? { "data-id" : t . id } : { } } , label : { default : null , parseHTML : t => t . getAttribute ( "data-label" ) , rendered : ! 1 } , preview : { default : null , parseHTML : t => t . getAttribute ( "data-preview" ) , rendered : ! 1 } } } , parseHTML ( ) { return [ { tag : ` div[data-type=" ${ this . name } "] ` } ] } , renderHTML ( { HTMLAttributes : t } ) { return [ "div" , R ( t ) ] } , addKeyboardShortcuts ( ) { return { Backspace : ( ) => this . editor . commands . command ( ( { tr : t , state : e } ) => { let n = ! 1 , { selection : r } = e , { empty : o , anchor : i } = r ; if ( ! o ) return ! 1 ; let s = new ie , l = 0 ; return e . doc . nodesBetween ( i - 1 , i , ( a , c ) => { if ( a . type . name === this . name ) return n = ! 0 , s = a , l = c , ! 1 } ) , n } ) } } , addProseMirrorPlugins ( ) { let { insertCustomBlockUsing : t } = this . options ; return [ new P ( { props : { handleDrop ( e , n ) { if ( ! n || ( n . preventDefault ( ) , ! n . dataTransfer . getData ( "customBlock" ) ) ) return ! 1 ; let r = n . dataTransfer . getData ( "customBlock" ) ; return t ( r , e . posAtCoords ( { left : n . clientX , top : n . clientY } ) . pos ) , ! 1 } } } ) ] } } ) ; var vo = ( t , e ) => e . view . domAtPos ( t ) . node . offsetParent !== null , t0 = ( t , e , n ) => { for ( let r = t . depth ; r > 0 ; r -= 1 ) { let o = t . node ( r ) , i = e ( o ) , s = vo ( t . start ( r ) , n ) ; if ( i && s ) return { pos : r > 0 ? t . before ( r ) : 0 , start : t . start ( r ) , depth : r , node : o } } } , zu = ( t , e ) => { let { state : n , view : r , extensionManager : o } = t , { schema : i , selection : s } = n , { empty : l , $anchor : a } = s , c = ! ! o . extensions . find ( y => y . name === "gapCursor" ) ; if ( ! l || a . parent . type !== i . nodes . detailsSummary || ! c || e === "right" && a . parentOffset !== a . parent . nodeSize - 2 ) return ! 1 ; let d = et ( y => y . type === i . nodes . details ) ( s ) ; if ( ! d ) return ! 1 ; let u = En ( d . node , y => y . type === i . nodes . detailsContent ) ; if ( ! u . length || vo ( d . start + u [ 0 ] . pos + 1 , t ) ) return ! 1 ; let h = n . doc . resolve ( d . pos + d . node . nodeSize ) , p = ae . findFrom ( h , 1 , ! 1 ) ; if ( ! p ) return ! 1 ; let { tr : m } = n , g = new ae ( p ) ; return m . setSelection ( g ) , m . scrollIntoView ( ) , r . dispatch ( m ) , ! 0 } , Hu = F . create ( { name : "details" , content : "detailsSummary detailsContent" , group : "block" , defining : ! 0 , isolating : ! 0 , allowGapCursor : ! 1 , addOptions ( ) { return { persist : ! 1 , openClassN
2025-09-21 18:07:30 +08:00
2026-01-18 19:17:29 +08:00
` ):""}),Vu=n0;var _u=F.create({name:"grid",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,content:"gridColumn+",addOptions(){return{HTMLAttributes:{class:"grid-layout"}}},addAttributes(){return{"data-cols":{default:2,parseHTML:t=>t.getAttribute("data-cols")},"data-from-breakpoint":{default:"md",parseHTML:t=>t.getAttribute("data-from-breakpoint")},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>({style: ` grid - template - columns : repeat ( $ { t [ "data-cols" ] } , 1 fr ) ` })}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("grid-layout")&&null}]},renderHTML({HTMLAttributes:t}){return["div",R(this.options.HTMLAttributes,t),0]},addCommands(){return{insertGrid:({columns:t=[1,1],fromBreakpoint:e,coordinates:n=null}={})=>({tr:r,dispatch:o,editor:i})=>{let s=i.schema.nodes.gridColumn,l=Array.isArray(t)&&t.length?t:[1,1],a=[];for(let u=0;u<l.length;u+=1)a.push(s.createAndFill({"data-col-span":Number(l[u]??1)||1}));let c=l.map(u=>Number(u)||1).reduce((u,f)=>u+f,0),d=i.schema.nodes.grid.createChecked({"data-cols":c,"data-from-breakpoint":e},a);if(o){let u=r.selection.anchor+1;[null,void 0].includes(n?.from)?r.replaceSelectionWith(d).scrollIntoView().setSelection(D.near(r.doc.resolve(u))):r.replaceRangeWith(n.from,n.to,d).scrollIntoView().setSelection(D.near(r.doc.resolve(n.from)))}return!0}}}});var Wu=F.create({name:"gridColumn",content:"block+",isolating:!0,addOptions(){return{HTMLAttributes:{class:"grid-layout-col"}}},addAttributes(){return{"data-col-span":{default:1,parseHTML:t=>t.getAttribute("data-col-span"),renderHTML:t=>({"data-col-span":t["data-col-span"]??1})},style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>({style: ` grid - column : span $ { t [ "data-col-span" ] ? ? 1 } ; ` })}}},parseHTML(){return[{tag:"div",getAttrs:t=>t.classList.contains("grid-layout-col")&&null}]},renderHTML({HTMLAttributes:t}){return["div",R(this.options.HTMLAttributes,t),0]}});var r0=F.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",R(this.options.HTMLAttributes,t)]},renderText(){return `
` },renderMarkdown:()=> `
` ,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:o,storedMarks:i}=n;if(o. $ from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o. $ to.parentOffset&&o. $ from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&a&&s){let u=a.filter(f=>l.includes(f.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ju=r0;var o0=F.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(t=>({tag: ` h$ { t } ` ,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[ ` h$ { this . options . levels . includes ( t . attrs . level ) ? t . attrs . level : this . options . levels [ 0 ] } ` ,R(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;let r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content? ` $ { o } $ { e . renderChildren ( t . content ) } ` :""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[ ` Mod - Alt - $ { e } ` ]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ar({find:new RegExp( ` ^ ( # { $ { Math . min ( ... this . options . levels ) } , $ { t } } ) \ \ s$ ` ),type:this.type,getAttributes:{level:t}}))}}),Uu=o0;var i0=/(?:^| \s )(==(?! \s +==)((?:[^=]+))==(?! \s +==)) $ /,s0=/(?:^| \s )(==(?! \s +==)((?:[^=]+))==(?! \s +==))/g,l0=ee.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style: ` background - color : $ { t . color } ; color : inherit ` }:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",R(this.options.HTMLAttributes,t),0]},renderMarkdown:(t,e)=> ` == $ { e . renderChildren ( t ) } == ` ,parseMarkdown:(t,e)=>e.applyMark("highlight",e.parseInline(t.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:t=>t.indexOf("=="),tokenize(t,e,n){let o=/^(==)([^=]+)(==)/.exec(t);if(o){let i=o[2].trim(),s=n.inlineTokens(i);return{type:"highlight",raw:o[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Be({find:i0,type:this.type})]},addPasteRules(){return[Me({find:s0,type:this.type})]}}),Ku=l0;var a0=F.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",R(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!bu(e,e.schema.nodes[this.name]))return!1;let{selection:n}=e,{ $ to:r}=n,o=t();return mo(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){let{ $ to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(D.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(L.create(s.doc,a.pos)):s.setSelection(D.create(s.doc,a.pos));else{let d=i.schema.nodes[this.options.nextNodeType]||a.parent.typ
` , S0 = "\uFE0F" , C0 = "\u200D" , bl = "\uFFFC" , Mo = null , To = null ; function v0 ( t = [ ] ) { let e = { } ; Te . groups = e ; let n = new Te ; Mo == null && ( Mo = ef ( g0 ) ) , To == null && ( To = ef ( y0 ) ) , M ( n , "'" , jo ) , M ( n , "{" , hr ) , M ( n , "}" , pr ) , M ( n , "[" , No ) , M ( n , "]" , Oo ) , M ( n , "(" , Ro ) , M ( n , ")" , Do ) , M ( n , "<" , Io ) , M ( n , ">" , Po ) , M ( n , "\uFF08" , Lo ) , M ( n , "\uFF09" , Bo ) , M ( n , "\u300C" , zo ) , M ( n , "\u300D" , Ho ) , M ( n , "\u300E" , $o ) , M ( n , "\u300F" , Fo ) , M ( n , "\uFF1C" , Vo ) , M ( n , "\uFF1E" , _o ) , M ( n , "&" , Wo ) , M ( n , "*" , Uo ) , M ( n , "@" , Lt ) , M ( n , "`" , qo ) , M ( n , "^" , Jo ) , M ( n , ":" , Bt ) , M ( n , "," , Ol ) , M ( n , "$" , Go ) , M ( n , "." , ot ) , M ( n , "=" , Xo ) , M ( n , "!" , Rl ) , M ( n , "-" , He ) , M ( n , "%" , mr ) , M ( n , "|" , Yo ) , M ( n , "+" , Qo ) , M ( n , "#" , Zo ) , M ( n , "?" , gr ) , M ( n , '"' , Dl ) , M ( n , "/" , it ) , M ( n , ";" , Il ) , M ( n , "~" , yr ) , M ( n , "_" , ei ) , M ( n , "\\" , Ko ) , M ( n , "\u30FB" , af ) ; let r = re ( n , kt , El , { [ xl ] : ! 0 } ) ; re ( r , kt , r ) ; let o = re ( r , xt , sf , { [ fr ] : ! 0 } ) , i = re ( r , dr , lf , { [ ur ] : ! 0 } ) , s = re ( n , xt , St , { [ kl ] : ! 0 } ) ; re ( s , kt , o ) , re ( s , xt , s ) , re ( o , kt , o ) , re ( o , xt , o ) ; let l = re ( n , dr , vl , { [ Sl ] : ! 0 } ) ; re ( l , xt ) , re ( l , kt , i ) , re ( l , dr , l ) , re ( i , kt , i ) , re ( i , xt ) , re ( i , dr , i ) ; let a = M ( n , yl , Nl , { [ pl ] : ! 0 } ) , c = M ( n , Zu , Al , { [ pl ] : ! 0 } ) , d = re ( n , gl , Al , { [ pl ] : ! 0 } ) ; M ( n , bl , d ) , M ( c , yl , a ) , M ( c , bl , d ) , re ( c , gl , d ) , M ( d , Zu ) , M ( d , yl ) , re ( d , gl , d ) , M ( d , bl , d ) ; let u = re ( n , ml , cf , { [ of ] : ! 0 } ) ; M ( u , "#" ) , re ( u , ml , u ) , M ( u , S0 , u ) ; let f = M ( u , C0 ) ; M ( f , "#" ) , re ( f , ml , u ) ; let h = [ [ xt , s ] , [ kt , o ] ] , p = [ [ xt , null ] , [ dr , l ] , [ kt , i ] ] ; for ( let m = 0 ; m < Mo . length ; m ++ ) Pt ( n , Mo [ m ] , Ml , St , h ) ; for ( let m = 0 ; m < To . length ; m ++ ) Pt ( n , To [ m ] , Tl , vl , p ) ; nn ( Ml , { tld : ! 0 , ascii : ! 0 } , e ) , nn ( Tl , { utld : ! 0 , alpha : ! 0 } , e ) , Pt ( n , "file" , Eo , St , h ) , Pt ( n , "mailto" , Eo , St , h ) , Pt ( n , "http" , On , St , h ) , Pt ( n , "https" , On , St , h ) , Pt ( n , "ftp" , On , St , h ) , Pt ( n , "ftps" , On , St , h ) , nn ( Eo , { scheme : ! 0 , ascii : ! 0 } , e ) , nn ( On , { slashscheme : ! 0 , ascii : ! 0 } , e ) , t = t . sort ( ( m , g ) => m [ 0 ] > g [ 0 ] ? 1 : - 1 ) ; for ( let m = 0 ; m < t . length ; m ++ ) { let g = t [ m ] [ 0 ] , w = t [ m ] [ 1 ] ? { [ b0 ] : ! 0 } : { [ w0 ] : ! 0 } ; g . indexOf ( "-" ) >= 0 ? w [ Cl ] = ! 0 : xt . test ( g ) ? kt . test ( g ) ? w [ fr ] = ! 0 : w [ kl ] = ! 0 : w [ xl ] = ! 0 , Qu ( n , g , g , w ) } return Qu ( n , "localhost" , br , { ascii : ! 0 } ) , n . jd = new Te ( ti ) , { start : n , tokens : Object . assign ( { groups : e } , df ) } } function uf ( t , e ) { let n = M0 ( e . replace ( /[A-Z]/g , l => l . toLowerCase ( ) ) ) , r = n . length , o = [ ] , i = 0 , s = 0 ; for ( ; s < r ; ) { let l = t , a = null , c = 0 , d = null , u = - 1 , f = - 1 ; for ( ; s < r && ( a = l . go ( n [ s ] ) ) ; ) l = a , l . accepts ( ) ? ( u = 0 , f = 0 , d = l ) : u >= 0 && ( u += n [ s ] . length , f ++ ) , c += n [ s ] . length , i += n [ s ] . length , s ++ ; i -= u , s -= f , c -= u , o . push ( { t : d . t , v : e . slice ( i - c , i ) , s : i - c , e : i } ) } return o } function M0 ( t ) { let e = [ ] , n = t . length , r = 0 ; for ( ; r < n ; ) { let o = t . charCodeAt ( r ) , i , s = o < 55296 || o > 56319 || r + 1 === n || ( i = t . charCodeAt ( r + 1 ) ) < 56320 || i > 57343 ? t [ r ] : t . slice ( r , r + 2 ) ; e . push ( s ) , r += s . length } return e } function Pt ( t , e , n , r , o ) { let i , s = e . length ; for ( let l = 0 ; l < s - 1 ; l ++ ) { let a = e [ l ] ; t . j [ a ] ? i = t . j [ a ] : ( i = new Te ( r ) , i . jr = o . slice ( ) , t . j [ a ] = i ) , t = i } return i = new Te ( n ) , i . jr = o . slice ( ) , t . j [ e [ s - 1 ] ] = i , i } function ef ( t ) { let e = [ ] , n = [ ] , r = 0 , o = "0123456789" ; for ( ; r < t . length ; ) { let i = 0 ; for ( ; o . indexOf ( t [ r + i ] ) >= 0 ; ) i ++ ; if ( i > 0 ) { e . push ( n . join ( "" ) ) ; for ( let s = parseInt ( t . substring ( r , r + i ) , 10 ) ; s > 0 ; s -- ) n . pop ( ) ; r += i } else n . push ( t [ r ] ) , r ++ } return e } var wr = { defaultProtocol : "http" , events : null , format : tf , formatHref : tf , nl2br : ! 1 , tagName : "a" , target : null , rel : null , validate : ! 0 , truncate : 1 / 0 , className : null , attributes : null , ignoreTags : [ ] , render : null } ; function Pl ( t , e = null ) { let n = Object . assign ( { } , wr ) ; t && ( n = Object . assign ( n , t instanceof Pl ? t . o : t ) ) ; let r = n . ignoreTags , o = [ ] ; for ( let i = 0 ; i < r . length ; i ++ ) o . push ( r [ i ] . toUpperCase ( ) ) ; this . o = n , e && ( this . defaultRender = e ) , this . ignoreTags = o } Pl . prototype = { o : wr , ignoreTags : [ ] , defaultRender ( t ) { return t } , check ( t ) { return this . get ( "validate" , t . toString ( ) , t ) } , get ( t , e , n ) { let r = e != null , o = this . o [ t ] ; return o && ( typeof o == "object" ? ( o = n . t in o ? o [ n . t ] : wr [ t ] , typeof o == "function" && r && ( o = o ( e , n ) ) ) : typeof o == "function" && r && ( o = o ( e , n . t , n ) ) , o ) } , getObj ( t , e , n ) { let r = this . o [ t ] ; return typeof r == "function" && e != null && ( r = r ( e , n . t , n ) ) , r } , render ( t ) { let e = t . render ( this ) ; return ( this . get ( "render" , null , t ) || this . defaultRender ) ( e , t . t , t ) } } ; function tf ( t ) { return t } function ff ( t , e ) { this . t = "token" , this . v = t , this . tk = e } ff . prototype = { isLink : ! 1 , toString ( ) { return this . v } , toHref ( t ) { return this . toString ( ) } , toFormattedString ( t ) { let e = this . toString ( ) , n = t . get ( "truncate" , e , this ) , r = t . get ( "format" , e , this ) ; return n && r . length > n ? r . substring ( 0 , n ) + "\u2026" : r } , toFormattedHref ( t ) { return t . get ( "formatHref" , this . toHref ( t . get ( "defaultProtocol" ) ) , this ) } , startIndex ( ) { return this . tk
2025-09-21 18:07:30 +08:00
1. Must only contain digits , lowercase ASCII letters or "-"
2. Cannot start or end with "-"
2026-01-18 19:17:29 +08:00
3. "-" cannot repeat ` );Z.customSchemes.push([t,e])}function R0(){Z.scanner=v0(Z.customSchemes);for(let t=0;t<Z.tokenQueue.length;t++)Z.tokenQueue[t][1]({scanner:Z.scanner});Z.parser=A0(Z.scanner.tokens);for(let t=0;t<Z.pluginQueue.length;t++)Z.pluginQueue[t][1]({scanner:Z.scanner,parser:Z.parser});return Z.initialized=!0,Z}function ri(t){return Z.initialized||R0(),E0(Z.parser.start,t,uf(Z.scanner.start,t))}ri.scan=uf;function oi(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error( ` linkifyjs : Invalid link type $ { e } ; must be a string ` );n=e,e=null}let r=new Pl(n),o=ri(t),i=[];for(let s=0;s<o.length;s++){let l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var Bl="[ \0 - \x A0 \u 1680 \u 180E \u 2000- \u 2029 \u 205F \u 3000]",D0=new RegExp(Bl),I0=new RegExp( ` $ { Bl } $ ` ),P0=new RegExp(Bl,"g");function L0(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function B0(t){return new P({key:new H("autolink"),appendTransaction:(e,n,r)=>{let o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=Js(n.doc,[...e]);if(el(l).forEach(({newRange:c})=>{let d=jd(r.doc,c,h=>h.isTextblock),u,f;if(d.length>1)u=d[0],f=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){let h=r.doc.textBetween(c.from,c.to," "," ");if(!I0.test(h))return;u=d[0],f=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&f){let h=f.split(D0).filter(Boolean);if(h.length<=0)return!1;let p=h[h.length-1],m=u.pos+f.lastIndexOf(p);if(!p)return!1;let g=ri(p).map(y=>y.toObject(t.defaultProtocol));if(!L0(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{po(y.from,y.to,r.doc).some(w=>w.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function z0(t){return new P({key:new H("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let u=r.target,f=[];for(;u.nodeName!=="DIV";)f.push(u),u=u.parentNode;l=f.find(h=>h.nodeName==="A")}if(!l)return s;let a=Zs(e.state,t.type.name),c=(o=l?.href)!=null?o:a.href,d=(i=l?.target)!=null?i:a.target;l&&c&&(window.open(c,d),s=!0)}return s}}})}function H0(t){return new P({key:new H("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});let c=oi(a,{defaultProtocol:t.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c||o!==void 0&&!o(c.href)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function rn(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(P0,"").match(new RegExp( ` ^ ( ? : ( ? : $ { n . join ( "|" ) } ) : | [ ^ a - z ] | [ a - z0 - 9 + . - ] + ( ? : [ ^ a - z + . - : ] | $ ) ) ` ,"i"))}var $ 0=ee.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(t=>{if(typeof t=="string"){Ll(t);return}Ll(t.scheme,t.optionalSlashes)})},onDestroy(){hf()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!rn(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttri
` ) : "" , markdownOptions : { indentsContent : ! 0 } , addCommands ( ) { return { toggleBulletList : ( ) => ( { commands : t , chain : e } ) => this . options . keepAttributes ? e ( ) . toggleList ( this . name , this . options . itemTypeName , this . options . keepMarks ) . updateAttributes ( _0 , this . editor . getAttributes ( mf ) ) . run ( ) : t . toggleList ( this . name , this . options . itemTypeName , this . options . keepMarks ) } } , addKeyboardShortcuts ( ) { return { "Mod-Shift-8" : ( ) => this . editor . commands . toggleBulletList ( ) } } , addInputRules ( ) { let t = tt ( { find : gf , type : this . type } ) ; return ( this . options . keepMarks || this . options . keepAttributes ) && ( t = tt ( { find : gf , type : this . type , keepMarks : this . options . keepMarks , keepAttributes : this . options . keepAttributes , getAttributes : ( ) => this . editor . getAttributes ( mf ) , editor : this . editor } ) ) , [ t ] } } ) , Fl = F . create ( { name : "listItem" , addOptions ( ) { return { HTMLAttributes : { } , bulletListTypeName : "bulletList" , orderedListTypeName : "orderedList" } } , content : "paragraph block*" , defining : ! 0 , parseHTML ( ) { return [ { tag : "li" } ] } , renderHTML ( { HTMLAttributes : t } ) { return [ "li" , R ( this . options . HTMLAttributes , t ) , 0 ] } , markdownTokenName : "list_item" , parseMarkdown : ( t , e ) => { if ( t . type !== "list_item" ) return [ ] ; let n = [ ] ; if ( t . tokens && t . tokens . length > 0 ) if ( t . tokens . some ( o => o . type === "paragraph" ) ) n = e . parseChildren ( t . tokens ) ; else { let o = t . tokens [ 0 ] ; if ( o && o . type === "text" && o . tokens && o . tokens . length > 0 ) { if ( n = [ { type : "paragraph" , content : e . parseInline ( o . tokens ) } ] , t . tokens . length > 1 ) { let s = t . tokens . slice ( 1 ) , l = e . parseChildren ( s ) ; n . push ( ... l ) } } else n = e . parseChildren ( t . tokens ) } return n . length === 0 && ( n = [ { type : "paragraph" , content : [ ] } ] ) , { type : "listItem" , content : n } } , renderMarkdown : ( t , e , n ) => cr ( t , e , r => r . parentType === "bulletList" ? "- " : r . parentType === "orderedList" ? ` ${ r . index + 1 } . ` : "- " , n ) , addKeyboardShortcuts ( ) { return { Enter : ( ) => this . editor . commands . splitListItem ( this . name ) , Tab : ( ) => this . editor . commands . sinkListItem ( this . name ) , "Shift-Tab" : ( ) => this . editor . commands . liftListItem ( this . name ) } } } ) , W0 = { } ; V0 ( W0 , { findListItemPos : ( ) => xr , getNextListDepth : ( ) => Vl , handleBackspace : ( ) => zl , handleDelete : ( ) => Hl , hasListBefore : ( ) => xf , hasListItemAfter : ( ) => j0 , hasListItemBefore : ( ) => kf , listItemHasSubList : ( ) => Sf , nextListIsDeeper : ( ) => Cf , nextListIsHigher : ( ) => vf } ) ; var xr = ( t , e ) => { let { $from : n } = e . selection , r = ne ( t , e . schema ) , o = null , i = n . depth , s = n . pos , l = null ; for ( ; i > 0 && l === null ; ) o = n . node ( i ) , o . type === r ? l = i : ( i -= 1 , s -= 1 ) ; return l === null ? null : { $pos : e . doc . resolve ( s ) , depth : l } } , Vl = ( t , e ) => { let n = xr ( t , e ) ; if ( ! n ) return ! 1 ; let [ , r ] = Xd ( e , t , n . $pos . pos + 4 ) ; return r } , xf = ( t , e , n ) => { let { $anchor : r } = t . selection , o = Math . max ( 0 , r . pos - 2 ) , i = t . doc . resolve ( o ) . node ( ) ; return ! ( ! i || ! n . includes ( i . type . name ) ) } , kf = ( t , e ) => { var n ; let { $anchor : r } = e . selection , o = e . doc . resolve ( r . pos - 2 ) ; return ! ( o . index ( ) === 0 || ( ( n = o . nodeBefore ) == null ? void 0 : n . type . name ) !== t ) } , Sf = ( t , e , n ) => { if ( ! n ) return ! 1 ; let r = ne ( t , e . schema ) , o = ! 1 ; return n . descendants ( i => { i . type === r && ( o = ! 0 ) } ) , o } , zl = ( t , e , n ) => { if ( t . commands . undoInputRule ( ) ) return ! 0 ; if ( t . state . selection . from !== t . state . selection . to ) return ! 1 ; if ( ! Ze ( t . state , e ) && xf ( t . state , e , n ) ) { let { $anchor : l } = t . state . selection , a = t . state . doc . resolve ( l . before ( ) - 1 ) , c = [ ] ; a . node ( ) . descendants ( ( f , h ) => { f . type . name === e && c . push ( { node : f , pos : h } ) } ) ; let d = c . at ( - 1 ) ; if ( ! d ) return ! 1 ; let u = t . state . doc . resolve ( a . start ( ) + d . pos + 1 ) ; return t . chain ( ) . cut ( { from : l . start ( ) - 1 , to : l . end ( ) + 1 } , u . end ( ) ) . joinForward ( ) . run ( ) } if ( ! Ze ( t . state , e ) || ! Qd ( t . state ) ) return ! 1 ; let r = xr ( e , t . state ) ; if ( ! r ) return ! 1 ; let i = t . state . doc . resolve ( r . $pos . pos - 2 ) . node ( r . depth ) , s = Sf ( e , t . state , i ) ; return kf ( e , t . state ) && ! s ? t . commands . joinItemBackward ( ) : t . chain ( ) . liftListItem ( e ) . run ( ) } , Cf = ( t , e ) => { let n = Vl ( t , e ) , r = xr ( t , e ) ; return ! r || ! n ? ! 1 : n > r . depth } , vf = ( t , e ) => { let n = Vl ( t , e ) , r = xr ( t , e ) ; return ! r || ! n ? ! 1 : n < r . depth } , Hl = ( t , e ) => { if ( ! Ze ( t . state , e ) || ! Yd ( t . state , e ) ) return ! 1 ; let { selection : n } = t . state , { $from : r , $to : o } = n ; return ! n . empty && r . sameParent ( o ) ? ! 1 : Cf ( e , t . state ) ? t . chain ( ) . focus ( t . state . selection . from + 4 ) . lift ( e ) . joinBackward ( ) . run ( ) : vf ( e , t . state ) ? t . chain ( ) . joinForward ( ) . joinBackward ( ) . run ( ) : t . commands . joinItemForward ( ) } , j0 = ( t , e ) => { var n ; let { $anchor : r } = e . selection , o = e . doc . resolve ( r . pos - r . parentOffset - 2 ) ; return ! ( o . index ( ) === o . parent . childCount - 1 || ( ( n = o . nodeAfter ) == null ? void 0 : n . type . name ) !== t ) } , U0 = U . create ( { name : "listKeymap" , addOptio
` ,u+=1;else if(h.match(K0))f.push(h),d+= `
$ { h . slice ( c + 2 ) } ` ,u+=1;else break}e.push({indent:c,number:parseInt(l,10),content:d.trim(),raw:f.join( `
` )}),r=u,n=u}return[e,r]}function Mf(t,e,n){var r;let o=[],i=0;for(;i<t.length;){let s=t[i];if(s.indent===e){let l=s.content.split( `
` ),a=((r=l[0])==null?void 0:r.trim())||"",c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});let d=l.slice(1).join( `
` ).trim();if(d){let h=n.blockTokens(d);c.push(...h)}let u=i+1,f=[];for(;u<t.length&&t[u].indent>e;)f.push(t[u]),u+=1;if(f.length>0){let h=Math.min(...f.map(m=>m.indent)),p=Mf(f,h,n);c.push({type:"list",ordered:!0,start:f[0].number,items:p,raw:f.map(m=>m.raw).join( `
` )})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=u}else i+=1}return o}function J0(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];let r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){let i=e.parseChildren([o]);r.push({type:"paragraph",content:i})}else{let i=e.parseChildren([o]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var G0="listItem",bf="textStyle",wf=/^( \d +) \. \s $ /,_l=F.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return ` $ { this . options . itemTypeName } + ` },addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,...n}=t;return e===1?["ol",R(this.options.HTMLAttributes,n),0]:["ol",R(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];let n=t.start||1,r=t.items?J0(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content, `
` ):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{let e=t.match(/^( \s *)( \d +) \. \s +/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;let o=t.split( `
` ),[i,s]=q0(o);if(i.length===0)return;let l=Mf(i,0,n);return l.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:l,raw:o.slice(0,s).join( `
` )}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(G0,this.editor.getAttributes(bf)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=tt({find:wf,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=tt({find:wf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(bf)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),X0=/^ \s *( \[ ([( |x])? \] ) \s $ /,Y0=F.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag: ` li [ data - type = "${this.name}" ] ` ,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",R(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{let n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){let r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;let o= ` - [ $ { ( n = t . attrs ) != null && n . checked ? "x" : " " } ] ` ;return cr(t,e,o)},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),c=d=>{var u,f;l.ariaLabel=((f=(u=this.options.a11y)==null?void 0:u.checkboxLabel)==null?void 0:f.call(u,d,l.checked))|| ` Task item checkbox for $ { d . textContent || "empty task item" } ` };return c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:u}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{let h=n();if(typeof h!="number")return!1;let p=f.doc.nodeAt(h);return f.setNodeMarkup(h,void 0,{...p?.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,u)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,u])=>{o.setAttribute(d,u)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(e).forEach(([d,u])=>{o.setAttribute(d,u)}),{dom:o,contentDOM:a,update:d=>d.type!==this.type?!1:(o.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d),!0)}}},addInputRules(){return[tt({find:X0,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Q0=F.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return ` $ { this . options . itemTypeName } + ` },parseHTML(){return[{tag: ` ul [ data - type = "${this.name}" ] ` ,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",R(this.options.HTMLAttributes,t,{"data-type":t
` ) : "" , markdownTokenizer : { name : "taskList" , level : "block" , start ( t ) { var e ; let n = ( e = t . match ( /^\s*[-+*]\s+\[([ xX])\]\s+/ ) ) == null ? void 0 : e . index ; return n !== void 0 ? n : - 1 } , tokenize ( t , e , n ) { let r = i => { let s = wo ( i , { itemPattern : /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/ , extractItemData : l => ( { indentLevel : l [ 1 ] . length , mainContent : l [ 4 ] , checked : l [ 3 ] . toLowerCase ( ) === "x" } ) , createToken : ( l , a ) => ( { type : "taskItem" , raw : "" , mainContent : l . mainContent , indentLevel : l . indentLevel , checked : l . checked , text : l . mainContent , tokens : n . inlineTokens ( l . mainContent ) , nestedTokens : a } ) , customNestedParser : r } , n ) ; return s ? [ { type : "taskList" , raw : s . raw , items : s . items } ] : n . blockTokens ( i ) } , o = wo ( t , { itemPattern : /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/ , extractItemData : i => ( { indentLevel : i [ 1 ] . length , mainContent : i [ 4 ] , checked : i [ 3 ] . toLowerCase ( ) === "x" } ) , createToken : ( i , s ) => ( { type : "taskItem" , raw : "" , mainContent : i . mainContent , indentLevel : i . indentLevel , checked : i . checked , text : i . mainContent , tokens : n . inlineTokens ( i . mainContent ) , nestedTokens : s } ) , customNestedParser : r } , n ) ; if ( o ) return { type : "taskList" , raw : o . raw , items : o . items } } } , markdownOptions : { indentsContent : ! 0 } , addCommands ( ) { return { toggleTaskList : ( ) => ( { commands : t } ) => t . toggleList ( this . name , this . options . itemTypeName ) } } , addKeyboardShortcuts ( ) { return { "Mod-Shift-9" : ( ) => this . editor . commands . toggleTaskList ( ) } } } ) , dv = U . create ( { name : "listKit" , addExtensions ( ) { let t = [ ] ; return this . options . bulletList !== ! 1 && t . push ( $l . configure ( this . options . bulletList ) ) , this . options . listItem !== ! 1 && t . push ( Fl . configure ( this . options . listItem ) ) , this . options . listKeymap !== ! 1 && t . push ( U0 . configure ( this . options . listKeymap ) ) , this . options . orderedList !== ! 1 && t . push ( _l . configure ( this . options . orderedList ) ) , this . options . taskItem !== ! 1 && t . push ( Y0 . configure ( this . options . taskItem ) ) , this . options . taskList !== ! 1 && t . push ( Q0 . configure ( this . options . taskList ) ) , t } } ) ; var ii = ( t , e , n = { } ) => { t . dom . closest ( "form" ) ? . dispatchEvent ( new CustomEvent ( e , { composed : ! 0 , cancelable : ! 0 , detail : n } ) ) } , Tf = ( { files : t , acceptedTypes : e , acceptedTypesValidationMessage : n , maxSize : r , maxSizeValidationMessage : o } ) => { for ( let i of t ) { if ( e && ! e . includes ( i . type ) ) return n ; if ( r && i . size > + r * 1024 ) return o } return null } , Z0 = ( { editor : t , acceptedTypes : e , acceptedTypesValidationMessage : n , get$WireUsing : r , key : o , maxSize : i , maxSizeValidationMessage : s , statePath : l , uploadingMessage : a } ) => { let c = d => Livewire . fireAction ( $wire . _ _instance , "callSchemaComponentMethod" , [ o , "getUploadedFileAttachmentTemporaryUrl" , { attachment : d } ] , { async : ! 0 } ) ; return new P ( { key : new H ( "localFiles" ) , props : { handleDrop ( d , u ) { if ( ! u . dataTransfer ? . files . length ) return ! 1 ; let f = Array . from ( u . dataTransfer . files ) , h = Tf ( { files : f , acceptedTypes : e , acceptedTypesValidationMessage : n , maxSize : i , maxSizeValidationMessage : s } ) ; if ( h ) return d . dom . dispatchEvent ( new CustomEvent ( "rich-editor-file-validation-message" , { bubbles : ! 0 , detail : { key : o , livewireId : r ( ) . id , validationMessage : h } } ) ) , ! 1 ; if ( ! f . length ) return ! 1 ; ii ( d , "form-processing-started" , { message : a } ) , u . preventDefault ( ) , u . stopPropagation ( ) ; let p = d . posAtCoords ( { left : u . clientX , top : u . clientY } ) ; return f . forEach ( ( m , g ) => { t . setEditable ( ! 1 ) , d . dom . dispatchEvent ( new CustomEvent ( "rich-editor-uploading-file" , { bubbles : ! 0 , detail : { key : o , livewireId : r ( ) . id } } ) ) ; let y = ( "10000000-1000-4000-8000" + - 1e11 ) . replace ( /[018]/g , w => ( w ^ crypto . getRandomValues ( new Uint8Array ( 1 ) ) [ 0 ] & 15 >> w / 4 ) . toString ( 16 ) ) ; r ( ) . upload ( ` componentFileAttachments. ${ l } . ${ y } ` , m , ( ) => { c ( y ) . then ( w => { w && ( t . chain ( ) . insertContentAt ( p ? . pos ? ? 0 , { type : "image" , attrs : { id : y , src : w } } ) . run ( ) , t . setEditable ( ! 0 ) , d . dom . dispatchEvent ( new CustomEvent ( "rich-editor-uploaded-file" , { bubbles : ! 0 , detail : { key : o , livewireId : r ( ) . id } } ) ) , g === f . length - 1 && ii ( d , "form-processing-finished" ) ) } ) } ) } ) , ! 0 } , handlePaste ( d , u ) { if ( ! u . clipboardData ? . files . length || u . clipboardData ? . getData ( "text" ) . length ) return ! 1 ; let f = Array . from ( u . clipboardData . files ) , h = Tf ( { files : f , acceptedTypes : e , acceptedTypesValidationMessage : n , maxSize : i , maxSizeValidationMessage : s } ) ; return h ? ( d . dom . dispatchEvent ( new CustomEvent ( "rich-editor-file-validation-message" , { bubbles : ! 0 , detail : { key : o , livewireId : r ( ) . id , validationMessage : h } } ) ) , ! 1 ) : f . length ? ( u . preventDefault ( ) , u . stopPropagation ( ) , ii ( d , "form-processing-started" , { message : a } ) , f . forE
` ,f=new Array(s).fill(0).map((p,m)=>d&&c[m]&&c[m].text||"");return u+= ` | $ { f . map ( ( p , m ) => a ( p , l [ m ] ) ) . join ( " | " ) } |
` ,u+= ` | $ { l . map ( p => "-" . repeat ( Math . max ( 3 , p ) ) ) . join ( " | " ) } |
` ,(d?i.slice(1):i).forEach(p=>{u+= ` | $ { new Array ( s ) . fill ( 0 ) . map ( ( m , g ) => a ( p [ g ] && p [ g ] . text || "" , l [ g ] ) ) . join ( " | " ) } |
` }),u}var Vx=Fx,_x=F.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Ix,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:o}=Px(t,this.options.cellMinWidth),i=e.style;function s(){return i||(r? ` width : $ { r } ` : ` min - width : $ { o } ` )}let l=["table",R(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{let n=[];if(t.header){let r=[];t.header.forEach(o=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(o.tokens)}]))}),n.push(e.createNode("tableRow",{},r))}return t.rows&&t.rows.forEach(r=>{let o=[];r.forEach(i=>{o.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>Vx(t,e),addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=Bx(i.schema,t,e,n);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(D.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>Bh(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>zh(t,e),deleteColumn:()=>({state:t,dispatch:e})=>Hh(t,e),addRowBefore:()=>({state:t,dispatch:e})=>Fh(t,e),addRowAfter:()=>({state:t,dispatch:e})=>Vh(t,e),deleteRow:()=>({state:t,dispatch:e})=>_h(t,e),deleteTable:()=>({state:t,dispatch:e})=>Uh(t,e),mergeCells:()=>({state:t,dispatch:e})=>ra(t,e),splitCell:()=>({state:t,dispatch:e})=>oa(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>Bn("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>Bn("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>jh(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>ra(t,e)?!0:oa(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>Wh(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>ia(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>ia(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&na(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=X.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ci,"Mod-Backspace":Ci,Delete:Ci,"Mod-Delete":Ci}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[qh({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Gh({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:G(B(t,"tableRole",e))}}}),Qh=U.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(_x.configure(this.options.table)),this.options.tableCell!==!1&&t.push(Ox.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(Rx.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(Dx.configure(this.options.tableRow)),t}});var Wx=F.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Zh=Wx;var jx=U.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{let e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style: ` text - align : $ { t . textAlign } ` }:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})