@yiitap/vue 0.16.3 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,175 +1,31 @@
1
- var YiiEditor=(function(S,c,Ui,fN,qs,Ks,zy,Wi,pN,hN,Hy,Tf,mN){"use strict";var HK=Object.defineProperty;var FK=(S,c,Ui)=>c in S?HK(S,c,{enumerable:!0,configurable:!0,writable:!0,value:Ui}):S[c]=Ui;var qe=(S,c,Ui)=>FK(S,typeof c!="symbol"?c+"":c,Ui);/**
1
+ var YiiEditor=(function(C,e,P,ba,vn,ha,ka,ya,ot,oe,In,jt,Ue,jn,Fn,wt,Fo,Ft,Ae,Je,zn,Hn,Un,qn,wa,Wn,zo,Ca,Yn,Gn,Kn,Xn,Jn,Zn,Qn,el,qe,tl,ol,nl,ll,nt,cm,xa,_a,Ba,Va,Ea,Na,rl,Ho,Sa,Uo,Oa,Aa,$a,Ta){"use strict";var am=Object.defineProperty;var im=(C,e,P)=>e in C?am(C,e,{enumerable:!0,configurable:!0,writable:!0,value:P}):C[e]=P;var ne=(C,e,P)=>im(C,typeof e!="symbol"?e+"":e,P);/**
2
2
  * Copyright 2026 Yiitap
3
3
  * @license MIT
4
- **/function gN(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const re=gN(Wi);function $t(n){this.content=n}$t.prototype={constructor:$t,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new $t(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new $t(t)},addToStart:function(n,e){return new $t([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new $t(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new $t(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=$t.from(n),n.size?new $t(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=$t.from(n),n.size?new $t(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=$t.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},$t.from=function(n){if(n instanceof $t)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new $t(e)};function Fy(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=Fy(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function jy(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let d=jy(s.content,l.content,t-1,o-1);if(d)return d}t-=a,o-=a}}class L{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],d=l+a.nodeSize;if(d>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let d=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new L(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new L(o,r)}cutByIndex(e,t){return e==t?L.empty:e==0&&t==this.content.length?this:new L(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new L(r,i)}addToStart(e){return new L([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new L(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return Fy(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return jy(this,e,t,o)}findIndex(e){if(e==0)return Wa(0,e);if(e==this.size)return Wa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?Wa(t+1,i):Wa(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return L.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new L(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return L.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new L(t||e,o)}static from(e){if(!e)return L.empty;if(e instanceof L)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new L([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}L.empty=new L([],0);const Nf={index:0,offset:0};function Wa(n,e){return Nf.index=n,Nf.offset=e,Nf}function qa(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!qa(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!qa(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let Ue=class Ny{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&qa(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ny.none;if(e instanceof Ny)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};Ue.none=[];class Ka extends Error{}class j{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=Wy(this.content,e+this.openStart,t);return o&&new j(o,this.openStart,this.openEnd)}removeBetween(e,t){return new j(Uy(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return j.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new j(L.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new j(e,o,r)}}j.empty=new j(L.empty,0,0);function Uy(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(Uy(i.content,e-r-1,t-r-1)))}function Wy(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Wy(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function yN(n,e,t){if(t.openStart>n.depth)throw new Ka("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ka("Inconsistent open depths");return qy(n,e,t,0)}function qy(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let s=qy(n,e,t,o+1);return i.copy(i.content.replaceChild(r,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return Qr(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=bN(t,n);return Qr(i,Jy(n,s,l,e,o))}else return Qr(i,Ja(n,e,o))}function Ky(n,e){if(!e.type.compatibleContent(n.type))throw new Ka("Cannot join "+e.type.name+" onto "+n.type.name)}function Af(n,e,t){let o=n.node(t);return Ky(o,e.node(t)),o}function Yr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Js(n,e,t,o){let r=(e||n).node(t),i=0,s=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Yr(n.nodeAfter,o),i++));for(let l=i;l<s;l++)Yr(r.child(l),o);e&&e.depth==t&&e.textOffset&&Yr(e.nodeBefore,o)}function Qr(n,e){return n.type.checkContent(e),n.copy(e)}function Jy(n,e,t,o,r){let i=n.depth>r&&Af(n,e,r+1),s=o.depth>r&&Af(t,o,r+1),l=[];return Js(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(Ky(i,s),Yr(Qr(i,Jy(n,e,t,o,r+1)),l)):(i&&Yr(Qr(i,Ja(n,e,r+1)),l),Js(e,t,r,l),s&&Yr(Qr(s,Ja(t,o,r+1)),l)),Js(o,null,r,l),new L(l)}function Ja(n,e,t){let o=[];if(Js(null,n,t,o),n.depth>t){let r=Af(n,e,t+1);Yr(Qr(r,Ja(n,e,t+1)),o)}return Js(e,null,t,o),new L(o)}function bN(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)r=e.node(i).copy(L.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class Gs{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Ue.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new Ga(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),d=i-a;if(o.push(s,l,r+a),!d||(s=s.child(l),s.isText))break;i=d-1,r+=a+1}return new Gs(t,o,i)}static resolveCached(e,t){let o=Gy.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==t)return s}else Gy.set(e,o=new kN);let r=o.elts[o.i]=Gs.resolve(e,t);return o.i=(o.i+1)%wN,r}}class kN{constructor(){this.elts=[],this.i=0}}const wN=12,Gy=new WeakMap;class Ga{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const xN=Object.create(null);let $n=class Ay{constructor(e,t,o,r=Ue.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||L.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&qa(this.attrs,t||e.defaultAttrs||xN)&&Ue.sameSet(this.marks,o||Ue.none)}copy(e=null){return e==this.content?this:new Ay(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ay(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return j.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new j(d,r.depth-s,i.depth-s)}replace(e,t,o){return yN(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return Gs.resolveCached(this,e)}resolveNoCache(e){return Gs.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Xy(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=L.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Ue.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!Ue.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=L.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};$n.prototype.text=void 0;class Xa extends $n{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Xy(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Xa(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Xa(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Xy(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Zr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new CN(e,t);if(o.next==null)return Zr.empty;let r=Yy(o);o.next&&o.err("Unexpected trailing text");let i=AN(NN(r));return ON(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(s,l){let a=s.matchFragment(e,o);if(a&&(!t||a.validEnd))return L.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
5
- `)}}Zr.empty=new Zr(!0);class CN{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Yy(n){let e=[];do e.push(SN(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function SN(n){let e=[];do e.push(vN(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function vN(n){let e=TN(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=EN(n,e);else break;return e}function Qy(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function EN(n,e){let t=Qy(n),o=t;return n.eat(",")&&(n.next!="}"?o=Qy(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function MN(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let s=t[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function TN(n){if(n.eat("(")){let e=Yy(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=MN(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function NN(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let d={term:a,to:l};return e[s].push(d),d}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,d)=>a.concat(i(d,l)),[]);if(s.type=="seq")for(let a=0;;a++){let d=i(s.exprs[a],l);if(a==s.exprs.length-1)return d;r(d,l=t())}else if(s.type=="star"){let a=t();return o(l,a),r(i(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=t();return r(i(s.expr,l),a),r(i(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let d=0;d<s.min;d++){let u=t();r(i(s.expr,a),u),a=u}if(s.max==-1)r(i(s.expr,a),a);else for(let d=s.min;d<s.max;d++){let u=t();o(a,u),r(i(s.expr,a),u),a=u}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Zy(n,e){return e-n}function eb(n,e){let t=[];return o(e),t.sort(Zy);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&o(a)}}}function AN(n){let e=Object.create(null);return t(eb(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);eb(n,a).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new Zr(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Zy);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function ON(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:a,next:d}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function tb(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function nb(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function ob(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function rb(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new BN(n,o,e[o]);return t}let ib=class YT{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=rb(e,o.attrs),this.defaultAttrs=tb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Zr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:nb(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new $n(this,this.computeAttrs(e),L.from(t),Ue.setFrom(o))}createChecked(e=null,t,o){return t=L.from(t),this.checkContent(t),new $n(this,this.computeAttrs(e),t,Ue.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=L.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(L.empty,!0);return i?new $n(this,e,t.append(i),Ue.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ob(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:Ue.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new YT(i,t,s));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function $N(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class BN{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?$N(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Ya{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=rb(e,r.attrs),this.excluded=null;let i=tb(this.attrs);this.instance=i?new Ue(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ue(this,nb(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Ya(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ob(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let sb=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=$t.from(e.nodes),t.marks=$t.from(e.marks||{}),this.nodes=ib.compile(this.spec.nodes,this),this.marks=Ya.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=Zr.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?lb(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:lb(this,s.split(" "))}this.nodeFromJSON=r=>$n.fromJSON(this,r),this.markFromJSON=r=>Ue.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof ib){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new Xa(o,o.defaultAttrs,e,Ue.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function lb(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function RN(n){return n.tag!=null}function DN(n){return n.style!=null}let dr=class Oy{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(RN(r))this.tags.push(r);else if(DN(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new ub(this,t,!1);return o.addAll(e,Ue.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new ub(this,t,!0);return o.addAll(e,Ue.none,t.from,t.to),j.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(LN(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=fb(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=fb(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Oy(e,Oy.schemaRules(e)))}};const ab={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},_N={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},cb={ol:!0,ul:!0},Xs=1,Of=2,Ys=4;function db(n,e,t){return e!=null?(e?Xs:0)|(e==="full"?Of:0):n&&n.whitespace=="pre"?Xs|Of:t&~Ys}class Qa{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=Ue.none,this.match=i||(s&Ys?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(L.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Xs)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=L.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(L.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ab.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ub{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=db(null,t.preserveWhitespace,0)|(o?Ys:0);r?i=new Qa(r.type,r.attrs,Ue.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new Qa(null,null,Ue.none,!0,null,s):i=new Qa(e.schema.topNodeType,null,Ue.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&Of?"full":this.localPreserveWS||(r.options&Xs)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
6
- `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;cb.hasOwnProperty(s)&&this.parser.normalizeLists&&IN(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:_N.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);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 d,u=this.needsBlock;if(ab.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,a,d,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
7
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.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?t=t.filter(d=>!a.clearMark(d)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],d=a.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=a,!d.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Ue.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):pb(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=db(e,i,s.options);s.options&Ys&&s.content.length==0&&(l|=Ys);let a=Ue.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):pb(d.type,e))?(a=d.addToSet(a),!1):!0),this.nodes.push(new Qa(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Xs)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function IN(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&cb.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function LN(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function fb(n){let e={};for(let t in n)e[t]=n[t];return e}function pb(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:d,next:u}=l.edge(a);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class ei{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=$f(t).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let d=s.marks[a];if(!this.marks[d.type.name]){a++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let d=s.marks[a++],u=this.serializeMark(d,s.isInline,t);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=Za($f(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&Za($f(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Za(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ei(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=hb(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return hb(e.marks)}}function hb(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function $f(n){return n.document||window.document}const mb=new WeakMap;function PN(n){let e=mb.get(n);return e===void 0&&mb.set(n,e=VN(n)),e}function VN(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function Za(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=PN(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(t=r.slice(0,s),r=r.slice(s+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&a.style?a.style.cssText=d[f]:a.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Za(n,p,t,o);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const gb=65535,yb=Math.pow(2,16);function zN(n,e){return n+e*yb}function bb(n){return n&gb}function HN(n){return(n-(n&gb))/yb}const kb=1,wb=2,ec=4,xb=8;class Bf{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&xb)>0}get deletedBefore(){return(this.delInfo&(kb|ec))>0}get deletedAfter(){return(this.delInfo&(wb|ec))>0}get deletedAcross(){return(this.delInfo&ec)>0}}class yn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&yn.empty)return yn.empty}recover(e){let t=0,o=bb(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+HN(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=a+d;if(e<=f){let p=d?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:u);if(o)return h;let m=e==(t<0?a:f)?null:zN(l/3,e-a),g=e==a?wb:e==f?kb:ec;return(t<0?e!=a:e!=f)&&(g|=xb),new Bf(h,g,m)}r+=u-d}return o?e+r:new Bf(e+r,0,null)}touches(e,t){let o=0,r=bb(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let d=this.ranges[l+i],u=a+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),d=this.ranges[r+t],u=this.ranges[r+o];e(l,l+d,a,a+u),i+=u-d}}invert(){return new yn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yn.empty:new yn(e<0?[0,-e,0]:[0,0,e])}}yn.empty=new yn([]);class Qs{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Qs(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new Qs;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Bf(e,r,null)}}const Rf=Object.create(null);class Ft{getMap(){return yn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Rf[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Rf)throw new RangeError("Duplicate use of step JSON ID "+e);return Rf[e]=t,t.prototype.jsonID=e,t}}class pt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new pt(e,null)}static fail(e){return new pt(null,e)}static fromReplace(e,t,o,r){try{return pt.ok(e.replace(t,o,r))}catch(i){if(i instanceof Ka)return pt.fail(i.message);throw i}}}function Df(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Df(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return L.fromArray(o)}class ur extends Ft{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new j(Df(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return pt.fromReplace(e,this.from,this.to,i)}invert(){return new Jn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new ur(t.pos,o.pos,this.mark)}merge(e){return e instanceof ur&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ur(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ur(t.from,t.to,e.markFromJSON(t.mark))}}Ft.jsonID("addMark",ur);class Jn extends Ft{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new j(Df(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return pt.fromReplace(e,this.from,this.to,o)}invert(){return new ur(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Jn(t.pos,o.pos,this.mark)}merge(e){return e instanceof Jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Jn(t.from,t.to,e.markFromJSON(t.mark))}}Ft.jsonID("removeMark",Jn);class fr extends Ft{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return pt.fromReplace(e,this.pos,this.pos+1,new j(L.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new fr(this.pos,t.marks[r]);return new fr(this.pos,this.mark)}}return new ti(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new fr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fr(t.pos,e.markFromJSON(t.mark))}}Ft.jsonID("addNodeMark",fr);class ti extends Ft{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return pt.fromReplace(e,this.pos,this.pos+1,new j(L.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new fr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ti(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new ti(t.pos,e.markFromJSON(t.mark))}}Ft.jsonID("removeNodeMark",ti);class xt extends Ft{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&_f(e,this.from,this.to)?pt.fail("Structure replace would overwrite content"):pt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new yn([this.from,this.to-this.from,this.slice.size])}invert(e){return new xt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new xt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof xt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?j.empty:new j(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new xt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?j.empty:new j(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new xt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new xt(t.from,t.to,j.fromJSON(e,t.slice),!!t.structure)}}Ft.jsonID("replace",xt);class Ct extends Ft{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(_f(e,this.from,this.gapFrom)||_f(e,this.gapTo,this.to)))return pt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return pt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?pt.fromReplace(e,this.from,this.to,o):pt.fail("Content does not fit in gap")}getMap(){return new yn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ct(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new Ct(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ct(t.from,t.to,t.gapFrom,t.gapTo,j.fromJSON(e,t.slice),t.insert,!!t.structure)}}Ft.jsonID("replaceAround",Ct);function _f(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function FN(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,d,u)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new Jn(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new ur(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function jN(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof Ya){let d=s.marks,u;for(;u=o.isInSet(d);)(a||(a=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let d=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let f=a[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>n.step(new Jn(s.from,s.to,s.style)))}function If(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let d=i.child(a),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new xt(l,u,j.empty));else{o=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new Jn(l,u,d.marks[p]));if(r&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new j(L.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new xt(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let a=o.fillBefore(L.empty,!0);n.replace(l,l,new j(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function UN(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function ni(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth,r=0,i=0;;--o){let s=n.$from.node(o),l=n.$from.index(o)+r,a=n.$to.indexAfter(o)-i;if(o<n.depth&&s.canReplace(l,a,t))return o;if(o==0||s.type.spec.isolating||!UN(s,l,a))break;l&&(r=1),a<s.childCount&&(i=1)}return null}function WN(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,d=l,u=L.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,u=L.from(o.node(m).copy(u)),f++):a--;let p=L.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=L.from(r.node(m).copy(p)),h++):d++;n.step(new Ct(a,d,s,l,new j(u.append(p),f,h),u.size-f,!0))}function Lf(n,e,t=null,o=n){let r=qN(n,e),i=r&&KN(o,e);return i?r.map(Cb).concat({type:e,attrs:t}).concat(i.map(Cb)):null}function Cb(n){return{type:n,attrs:null}}function qN(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(o,r,s)?i:null}function KN(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;a&&d<r;d++)a=a.matchType(t.child(d).type);return!a||!a.validEnd?null:s}function JN(n,e,t){let o=L.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=L.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new Ct(r,i,r,i,new j(o,0,0),t.length,!0))}function GN(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&XN(n.doc,n.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&vb(n,s,l,i),If(n,n.mapping.slice(i).map(l,1),o,void 0,d===null);let u=n.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return n.step(new Ct(f,p,f+1,p-1,new j(L.from(o.create(a,null,s.marks)),0,0),1,!0)),d===!0&&Sb(n,s,l,i),!1}})}function Sb(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function vb(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
8
- `))}})}function XN(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function YN(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ct(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new j(L.from(s),0,0),1,!0))}function lo(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=t-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function QN(n,e,t=1,o){let r=n.doc.resolve(e),i=L.empty,s=L.empty;for(let l=r.depth,a=r.depth-t,d=t-1;l>a;l--,d--){i=L.from(r.node(l).copy(i));let u=o&&o[d];s=L.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}n.step(new xt(e,e,new j(i.append(s),t,t),!0))}function pr(n,e){let t=n.resolve(e),o=t.index();return Eb(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function ZN(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Eb(n,e){return!!(n&&e&&!n.isLeaf&&ZN(n,e))}function tc(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):t>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&Eb(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function eA(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let u=n.doc.resolve(e+t);vb(n,u.node(),u.before(),l)}s.inlineContent&&If(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),d=a.map(e-t);if(n.step(new xt(d,a.map(e+t,-1),j.empty,!0)),o===!0){let u=n.doc.resolve(d);Sb(n,u.node(),u.before(),n.steps.length)}return n}function tA(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Mb(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(a,a,r);else{let f=d.contentMatchAt(a).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(a,a,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function nc(n,e,t=e,o=j.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return Tb(r,i,o)?new xt(e,t,o):new nA(r,i,o).fit()}function Tb(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class nA{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=L.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=L.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new j(i,s,l);return e>-1?new Ct(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new xt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Pf(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(L.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Pf(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new j(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Pf(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new j(Zs(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new j(Zs(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||a==0||g.content.size)&&(f=y,u.push(Nb(g.mark(p.allowedMarks(g.marks)),d==1?a:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=el(this.placed,t,L.from(u)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?j.empty:new j(Zs(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new j(Zs(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Vf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Vf(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:d}=this.frontier[l],u=Vf(e,l,d,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=el(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=el(this.placed,this.depth,L.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(L.empty,!0);t.childCount&&(this.placed=el(this.placed,this.frontier.length,t))}}function Zs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Zs(n.firstChild.content,e-1,t)))}function el(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(el(n.lastChild.content,e-1,t)))}function Pf(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Nb(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Nb(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(L.empty,!0)))),n.copy(o)}function Vf(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!oA(t,i.content,s)?l:null}function oA(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function rA(n){return n.spec.defining||n.spec.definingForContent}function iA(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(Tb(r,i,o))return n.step(new xt(e,t,o));let s=Ob(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=rA(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let k=r.node(y-1),x=r.index(y-1);if(k.canReplaceWith(x,x,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new j(Ab(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function Ab(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Ab(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(L.empty,!0))}return n}function sA(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=tA(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new j(L.from(o),0,0))}function lA(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Ob(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function Ob(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class qi extends Ft{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return pt.fromReplace(e,this.pos,this.pos+1,new j(L.from(r),0,t.isLeaf?0:1))}getMap(){return yn.empty}invert(e){return new qi(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new qi(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new qi(t.pos,t.attr,t.value)}}Ft.jsonID("attr",qi);class tl extends Ft{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return pt.ok(o)}getMap(){return yn.empty}invert(e){return new tl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new tl(t.attr,t.value)}}Ft.jsonID("docAttr",tl);let Ki=class extends Error{};Ki=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Ki.prototype=Object.create(Error.prototype),Ki.prototype.constructor=Ki,Ki.prototype.name="TransformError";class zf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Qs}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ki(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=j.empty){let r=nc(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new j(L.from(o),0,0))}delete(e,t){return this.replace(e,t,j.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return iA(this,e,t,o),this}replaceRangeWith(e,t,o){return sA(this,e,t,o),this}deleteRange(e,t){return lA(this,e,t),this}lift(e,t){return WN(this,e,t),this}join(e,t=1){return eA(this,e,t),this}wrap(e,t){return JN(this,e,t),this}setBlockType(e,t=e,o,r=null){return GN(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return YN(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new qi(e,t,o)),this}setDocAttribute(e,t){return this.step(new tl(e,t)),this}addNodeMark(e,t){return this.step(new fr(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof Ue)t.isInSet(o.marks)&&this.step(new ti(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new ti(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return QN(this,e,t,o),this}addMark(e,t,o){return FN(this,e,t,o),this}removeMark(e,t,o){return jN(this,e,t,o),this}clearIncompatible(e,t,o){return If(this,e,t,o),this}}const Hf=Object.create(null);class ie{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new $b(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=j.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(d.pos),l?j.empty:t),l==0&&Db(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),d=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),Db(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new q(e):Ji(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?Ji(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Ji(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new tn(e.node(0))}static atStart(e){return Ji(e,e,0,0,1)||new tn(e)}static atEnd(e){return Ji(e,e,e.content.size,e.childCount,-1)||new tn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Hf[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Hf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Hf[e]=t,t.prototype.jsonID=e,t}getBookmark(){return q.between(this.$anchor,this.$head).getBookmark()}}ie.prototype.visible=!0;class $b{constructor(e,t){this.$from=e,this.$to=t}}let Bb=!1;function Rb(n){!Bb&&!n.parent.inlineContent&&(Bb=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class q extends ie{constructor(e,t=e){Rb(e),Rb(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return ie.near(o);let r=e.resolve(t.map(this.anchor));return new q(r.parent.inlineContent?r:o,o)}replace(e,t=j.empty){if(super.replace(e,t),t==j.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof q&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new oc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new q(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=ie.findFrom(t,o,!0)||ie.findFrom(t,-o,!0);if(i)t=i.$head;else return ie.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(ie.findFrom(e,-o,!0)||ie.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new q(e,t)}}ie.jsonID("text",q);class oc{constructor(e,t){this.anchor=e,this.head=t}map(e){return new oc(e.map(this.anchor),e.map(this.head))}resolve(e){return q.between(e.resolve(this.anchor),e.resolve(this.head))}}class Q extends ie{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?ie.near(i):new Q(i)}content(){return new j(L.from(this.node),0,0)}eq(e){return e instanceof Q&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Ff(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Q(e.resolve(t.anchor))}static create(e,t){return new Q(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Q.prototype.visible=!1,ie.jsonID("node",Q);class Ff{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new oc(o,o):new Ff(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Q.isSelectable(o)?new Q(t):ie.near(t)}}class tn extends ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=j.empty){if(t==j.empty){e.delete(0,e.doc.content.size);let o=ie.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new tn(e)}map(e){return new tn(e)}eq(e){return e instanceof tn}getBookmark(){return aA}}ie.jsonID("all",tn);const aA={map(){return this},resolve(n){return new tn(n)}};function Ji(n,e,t,o,r,i=!1){if(e.inlineContent)return q.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Q.isSelectable(l))return Q.create(n,t-(r<0?l.nodeSize:0))}else{let a=Ji(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function Db(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof xt||r instanceof Ct))return;let i=n.mapping.maps[o],s;i.forEach((l,a,d,u)=>{s==null&&(s=u)}),n.setSelection(ie.near(n.doc.resolve(s),t))}const _b=1,rc=2,Ib=4;class cA extends zf{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|_b)&~rc,this.storedMarks=null,this}get selectionSet(){return(this.updated&_b)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=rc,this}ensureMarks(e){return Ue.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&rc)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~rc,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||Ue.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),!e)return this.deleteRange(t,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=o==t?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(ie.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ib,this}get scrolledIntoView(){return(this.updated&Ib)>0}}function Lb(n,e){return!e||!n?n:n.bind(e)}class nl{constructor(e,t,o){this.name=e,this.init=Lb(t.init,o),this.apply=Lb(t.apply,o)}}const dA=[new nl("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new nl("selection",{init(n,e){return n.selection||ie.atStart(e.doc)},apply(n){return n.selection}}),new nl("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new nl("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class jf{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=dA.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new nl(o.key,o.spec.state,o))})}}class Gi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=t){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=r?r[s].n:0,d=r?r[s].state:this,u=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:t.length}:{state:this,n:0})}t.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:t.length})}}if(!i)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Gi(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new cA(this)}static create(e){let t=new jf(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new Gi(t);for(let r=0;r<t.fields.length;r++)o[t.fields[r].name]=t.fields[r].init(e,o);return o}reconfigure(e){let t=new jf(this.schema,e.plugins),o=t.fields,r=new Gi(t);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(t[o]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new jf(e.schema,e.plugins),i=new Gi(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=$n.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=ie.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let a=o[l],d=a.spec.state;if(a.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=d.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Pb(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Pb(r,e,{})),t[o]=r}return t}class ce{constructor(e){this.spec=e,this.props={},e.props&&Pb(e.props,this,this.props),this.key=e.key?e.key.key:Vb("plugin")}getState(e){return e[this.key]}}const Uf=Object.create(null);function Vb(n){return n in Uf?n+"$"+ ++Uf[n]:(Uf[n]=0,n+"$")}class le{constructor(e="key"){this.key=Vb(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Wf=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function zb(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Hb=(n,e,t)=>{let o=zb(n,t);if(!o)return!1;let r=qf(o);if(!r){let s=o.blockRange(),l=s&&ni(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(Gb(n,r,e,-1))return!0;if(o.parent.content.size==0&&(Xi(i,"end")||Q.isSelectable(i)))for(let s=o.depth;;s--){let l=nc(n.doc,o.before(s),o.after(s),j.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Xi(i,"end")?ie.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):Q.create(a.doc,r.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},uA=(n,e,t)=>{let o=zb(n,t);if(!o)return!1;let r=qf(o);return r?Fb(n,r,e):!1},fA=(n,e,t)=>{let o=Ub(n,t);if(!o)return!1;let r=Kf(o);return r?Fb(n,r,e):!1};function Fb(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=nc(n.doc,i,a,j.empty);if(!d||d.from!=i||d instanceof xt&&d.slice.size>=a-i)return!1;if(t){let u=n.tr.step(d);u.setSelection(q.create(u.doc,i)),t(u.scrollIntoView())}return!0}function Xi(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const jb=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=qf(o)}let s=i&&i.nodeBefore;return!s||!Q.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function qf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ub(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Wb=(n,e,t)=>{let o=Ub(n,t);if(!o)return!1;let r=Kf(o);if(!r)return!1;let i=r.nodeAfter;if(Gb(n,r,e,1))return!0;if(o.parent.content.size==0&&(Xi(i,"start")||Q.isSelectable(i))){let s=nc(n.doc,o.before(),o.after(),j.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Xi(i,"start")?ie.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Q.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},qb=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=Kf(o)}let s=i&&i.nodeAfter;return!s||!Q.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,i.pos)).scrollIntoView()),!0)};function Kf(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const pA=(n,e)=>{let t=n.selection,o=t instanceof Q,r;if(o){if(t.node.isTextblock||!pr(n.doc,t.from))return!1;r=t.from}else if(r=tc(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(Q.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},hA=(n,e)=>{let t=n.selection,o;if(t instanceof Q){if(t.node.isTextblock||!pr(n.doc,t.to))return!1;o=t.to}else if(o=tc(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},mA=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&ni(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Jf=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
9
- `).scrollIntoView()),!0)};function Gf(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const gA=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),s=Gf(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(ie.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Xf=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof tn||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Gf(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(q.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Kb=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(lo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&ni(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function yA(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Q&&e.selection.node.isBlock)return!o.parentOffset||!lo(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,a=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=Gf(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof q||e.selection instanceof tn)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=lo(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=lo(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!a&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return t&&t(u.scrollIntoView()),!0}}const Jb=yA(),bA=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(Q.create(n.doc,r))),!0)};function kA(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||pr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Gb(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&kA(n,e,t))return!0;let d=!a&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=L.empty;for(let b=s.length-1;b>=0;b--)m=L.from(s[b].create(null,m));m=L.from(r.copy(m));let g=n.tr.step(new Ct(e.pos-1,h,e.pos,h,new j(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&pr(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&a?null:ie.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&ni(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&Xi(i,"start",!0)&&Xi(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=L.empty;for(let x=m.length-1;x>=0;x--)b=L.from(m[x].copy(b));let k=n.tr.step(new Ct(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new j(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Xb(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(q.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const wA=Xb(-1),xA=Xb(1);function CA(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&Lf(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Yb(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,d)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let u=t.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}o(i.scrollIntoView())}return!0}}function ic(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}ic(Wf,Hb,jb),ic(Wf,Wb,qb),ic(Jf,Xf,Kb,Jb),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function SA(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i);if(!s)return!1;let l=o?t.tr:null;return vA(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function vA(n,e,t,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Ga(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ga(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Lf(i,t,o,e);return l?(n&&EA(n,e,l,r,t),!0):!1}function EA(n,e,t,o,r){let i=L.empty;for(let u=t.length-1;u>=0;u--)i=L.from(t[u].type.create(t[u].attrs,i));n.step(new Ct(e.start-(o?2:0),e.end,e.start,e.end,new j(i,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==r&&(s=u+1);let l=t.length-s,a=e.start+t.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&lo(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=d.child(u).nodeSize;return n}function MA(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?TA(e,t,n,i):NA(e,t,i):!0:!1}}function TA(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new Ct(i-1,s,i,s,new j(L.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Ga(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=ni(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return pr(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function NA(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),s=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(a?L.empty:L.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new Ct(f-(l?1:0),p+(a?1:0),f+1,p-1,new j((l?L.empty:L.from(r.copy(L.empty))).append(a?L.empty:L.from(r.copy(L.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function AA(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let d=a.lastChild&&a.lastChild.type==l.type,u=L.from(d?n.create():null),f=new j(L.from(n.create(null,L.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;t(e.tr.step(new Ct(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const Bt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Yi=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Yf=null;const _o=function(n,e,t){let o=Yf||(Yf=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},OA=function(){Yf=null},oi=function(n,e,t,o){return t&&(Qb(n,e,t,o,-1)||Qb(n,e,t,o,1))},$A=/^(img|br|input|textarea|hr)$/i;function Qb(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Bn(n))){let s=n.parentNode;if(!s||s.nodeType!=1||ol(n)||$A.test(n.nodeName)||n.contentEditable=="false")return!1;e=Bt(n)+(r<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=s,e=r<0?Bn(n):0}else return!1}}function Bn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function BA(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Bn(n)}else if(n.parentNode&&!ol(n))e=Bt(n),n=n.parentNode;else return null}}function RA(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!ol(n))e=Bt(n)+1,n=n.parentNode;else return null}}function DA(n,e,t){for(let o=e==0,r=e==Bn(n);o||r;){if(n==t)return!0;let i=Bt(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Bn(n)}}function ol(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const sc=function(n){return n.focusNode&&oi(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ri(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function _A(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function IA(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Bn(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Bn(o.startContainer),o.startOffset)}}}const ao=typeof navigator<"u"?navigator:null,Zb=typeof document<"u"?document:null,hr=ao&&ao.userAgent||"",Qf=/Edge\/(\d+)/.exec(hr),ek=/MSIE \d/.exec(hr),Zf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(hr),dn=!!(ek||Zf||Qf),mr=ek?document.documentMode:Zf?+Zf[1]:Qf?+Qf[1]:0,Rn=!dn&&/gecko\/(\d+)/i.test(hr);Rn&&+(/Firefox\/(\d+)/.exec(hr)||[0,0])[1];const ep=!dn&&/Chrome\/(\d+)/.exec(hr),Rt=!!ep,tk=ep?+ep[1]:0,jt=!dn&&!!ao&&/Apple Computer/.test(ao.vendor),Qi=jt&&(/Mobile\/\w+/.test(hr)||!!ao&&ao.maxTouchPoints>2),Dn=Qi||(ao?/Mac/.test(ao.platform):!1),nk=ao?/Win/.test(ao.platform):!1,Io=/Android \d/.test(hr),rl=!!Zb&&"webkitFontSmoothing"in Zb.documentElement.style,LA=rl?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function PA(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Lo(n,e){return typeof n=="number"?n:n[e]}function VA(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function ok(n,e,t){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=Yi(s);continue}let l=s,a=l==i.body,d=a?PA(i):VA(l),u=0,f=0;if(e.top<d.top+Lo(o,"top")?f=-(d.top-e.top+Lo(r,"top")):e.bottom>d.bottom-Lo(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+Lo(r,"top")-d.top:e.bottom-d.bottom+Lo(r,"bottom")),e.left<d.left+Lo(o,"left")?u=-(d.left-e.left+Lo(r,"left")):e.right>d.right-Lo(o,"right")&&(u=e.right-d.right+Lo(r,"right")),u||f)if(a)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let g=l.scrollLeft-h,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Yi(s)}}function zA(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){o=l,r=a.top;break}}return{refDOM:o,refTop:r,stack:rk(n.dom)}}function rk(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=Yi(o));return e}function HA({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;ik(t,o==0?0:o-e)}function ik(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:r,left:i}=n[t];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Zi=null;function FA(n){if(n.setActive)return n.setActive();if(Zi)return n.focus(Zi);let e=rk(n);n.focus(Zi==null?{get preventScroll(){return Zi={preventScroll:!0},!0}}:void 0),Zi||(Zi=!1,ik(e,0))}function sk(n,e){let t,o=2e8,r,i=0,s=e.top,l=e.top,a,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=_o(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){t=u,o=g,r=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!t&&a&&(t=a,r=d,o=0),t&&t.nodeType==3?jA(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:sk(t,r)}function jA(n,e){let t=n.nodeValue.length,o=document.createRange(),r;for(let i=0;i<t;i++){o.setEnd(n,i+1),o.setStart(n,i);let s=gr(o,1);if(s.top!=s.bottom&&tp(e,s)){r={node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:n,offset:0}}function tp(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function UA(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function WA(n,e,t){let{node:o,offset:r}=sk(e,t),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function qA(n,e,t,o){let r=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>o.left||a.top>o.top?r=l.posBefore:(!s&&a.right<o.left||a.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(e,t,-1)}function lk(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),i=r;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let d=l[a];if(tp(e,d))return lk(s,e,d)}}if((i=(i+1)%o)==r)break}return n}function KA(n,e){let t=n.dom.ownerDocument,o,r=0,i=IA(t,e.left,e.top);i&&({node:o,offset:r}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=n.dom.getBoundingClientRect();if(!tp(e,d)||(s=lk(n.dom,e,d),!s))return null}if(jt)for(let d=s;o&&d;d=Yi(d))d.draggable&&(o=void 0);if(s=UA(s,e),o){if(Rn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;rl&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==n.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=qA(n,o,r,e))}l==null&&(l=WA(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function ak(n){return n.top<n.bottom||n.left<n.right}function gr(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(ak(o))return o}return Array.prototype.find.call(t,ak)||n.getBoundingClientRect()}const JA=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ck(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=rl||Rn;if(o.nodeType==3)if(s&&(JA.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let a=gr(_o(o,r,r),t);if(Rn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=gr(_o(o,r-1,r-1),-1);if(d.top==a.top){let u=gr(_o(o,r,r+1),-1);if(u.top!=a.top)return il(u,u.left<d.left)}}return a}else{let a=r,d=r,u=t<0?1:-1;return t<0&&!r?(d++,u=-1):t>=0&&r==o.nodeValue.length?(a--,u=1):t<0?a--:d++,il(gr(_o(o,a,d),u),u<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==Bn(o))){let a=o.childNodes[r-1];if(a.nodeType==1)return np(a.getBoundingClientRect(),!1)}if(i==null&&r<Bn(o)){let a=o.childNodes[r];if(a.nodeType==1)return np(a.getBoundingClientRect(),!0)}return np(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==Bn(o))){let a=o.childNodes[r-1],d=a.nodeType==3?_o(a,Bn(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(d)return il(gr(d,1),!1)}if(i==null&&r<Bn(o)){let a=o.childNodes[r];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let d=a?a.nodeType==3?_o(a,0,s?0:1):a.nodeType==1?a:null:null;if(d)return il(gr(d,-1),!0)}return il(gr(o.nodeType==3?_o(o):o,-t),t>=0)}function il(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function np(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function dk(n,e,t){let o=n.state,r=n.root.activeElement;o!=e&&n.updateState(e),r!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),r!=n.dom&&r&&r.focus()}}function GA(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return dk(n,e,()=>{let{node:i}=n.docView.domFromPos(r.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=ck(n,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=_o(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<a.length;d++){let u=a[d];if(u.bottom>u.top+1&&(t=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const XA=/[\u0590-\u08ac]/;function YA(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=n.domSelection();return l?!XA.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:dk(n,e,()=>{let{focusNode:a,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",t,"character");let h=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||a==m&&d==g;try{l.collapse(u,f),a&&(a!=u||d!=f)&&l.extend&&l.extend(a,d)}catch{}return p!=null&&(l.caretBidiLevel=p),y}):o.pos==o.start()||o.pos==o.end()}let uk=null,fk=null,pk=!1;function QA(n,e,t){return uk==e&&fk==t?pk:(uk=e,fk=t,pk=t=="up"||t=="down"?GA(n,e,t):YA(n,e,t))}const _n=0,hk=1,ii=2,co=3;class sl{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=_n,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,o=this.posAtStart;;t++){let r=this.children[t];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Bt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!t||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let r=this.children[t],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof yk){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,t);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof mk&&i.side>=0;o--);if(t<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Bt(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Bt(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let a=this.children[l],d=s+a.size;if(r==-1&&e<=d){let u=s+a.border;if(e>=u&&t<=d-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,u);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Bt(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>t||l==this.children.length-1)){t=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Bt(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,r=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(i>m&&s<y)return g.setSelection(e-m-g.border,t-m-g.border,o,r);m=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if((Rn||jt)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
10
- `),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Bt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Rn&&u.focusNode&&u.focusNode!=a.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&jt)&&oi(l.node,l.offset,u.anchorNode,u.anchorOffset)&&oi(a.node,a.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==t)&&!(f&&Rn)){d.collapse(l.node,l.offset);try{e!=t&&d.extend(a.node,a.offset),p=!0}catch{}}if(!p){if(e>t){let m=l;l=a,a=m}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.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,t){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&t>=o:e<s&&t>o){let l=o+i.border,a=s-i.border;if(e>=l&&t<=a){this.dirty=e==o||t==s?ii:hk,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=co:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ii:co}o=s}this.dirty=ii}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?ii:hk;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class mk extends sl{constructor(e,t,o,r){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.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=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==_n&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ZA extends sl{constructor(e,t,o,r){super(e,[],t,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class si extends sl{constructor(e,t,o,r,i){super(e,[],o,r),this.mark=t,this.spec=i}static create(e,t,o,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,o);return(!s||!s.dom)&&(s=ei.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new si(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&co||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=co&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=_n){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=_n}}slice(e,t,o){let r=si.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;t<s&&(i=rp(i,t,s,o)),e>0&&(i=rp(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class yr extends sl{constructor(e,t,o,r,i,s,l,a,d){super(e,[],i,s),this.node=t,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,t,o,r,i,s){let l=i.nodeViews[t.type.name],a,d=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=ei.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let p=u;return u=wk(u,o,t),d?a=new eO(e,t,o,r,u,f||null,p,d,i,s+1):t.isText?new lc(e,t,o,r,u,p,i):new yr(e,t,o,r,u,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>L.empty)}return e}matchesNode(e,t,o){return this.dirty==_n&&e.eq(this.node)&&ac(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new nO(this,s&&s.node,e);iO(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?a.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&a.syncToMarks(u==this.node.childCount?Ue.none:this.node.child(u).marks,o,e,u),a.placeWidget(d,e,r)},(d,u,f,p)=>{a.syncToMarks(d.marks,o,e,p);let h;a.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(d,u,f,h,e)||a.updateNextNode(d,u,f,e,p,r)||a.addNode(d,u,f,e,r),r+=d.nodeSize}),a.syncToMarks([],o,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ii)&&(s&&this.protectLocalComposition(e,s),bk(this.contentDOM,this.children,e),Qi&&sO(this.dom))}localCompositionInfo(e,t){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof q)||o<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=lO(this.node.content,s,o-t,r-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new ZA(this,i,t,r);e.input.compositionNodes.push(s),this.children=rp(this.children,o,o+r.length,e,s)}update(e,t,o,r){return this.dirty==co||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,r),!0)}updateInner(e,t,o,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=_n}updateOuterDeco(e){if(ac(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=kk(this.dom,this.nodeDOM,op(this.outerDeco,this.node,t),op(e,this.node,t)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function gk(n,e,t,o,r){wk(o,e,n);let i=new yr(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class lc extends yr{constructor(e,t,o,r,i,s,l){super(e,t,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,o,r){return this.dirty==co||this.dirty!=_n&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=_n||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=_n,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new lc(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=co)}get domAtom(){return!1}isText(e){return this.node.text==e}}class yk extends sl{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==_n&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class eO extends yr{constructor(e,t,o,r,i,s,l,a,d,u){super(e,t,o,r,i,s,l,d,u),this.spec=a}update(e,t,o,r){if(this.dirty==co)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,o);return i&&this.updateInner(e,t,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,r){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function bk(n,e,t){let o=n.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=o;)o=xk(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(s instanceof si){let a=o?o.previousSibling:n.lastChild;bk(s.contentDOM,s.children,t),o=a?a.nextSibling:n.firstChild}}for(;o;)o=xk(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const ll=function(n){n&&(this.nodeName=n)};ll.prototype=Object.create(null);const li=[new ll];function op(n,e,t){if(n.length==0)return li;let o=t?li[0]:new ll,r=[o];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&r.push(o=new ll(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&r.length==1&&r.push(o=new ll(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return r}function kk(n,e,t,o){if(t==li&&o==li)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=t[i];if(i){let a;l&&l.nodeName==s.nodeName&&r!=n&&(a=r.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(r),l=li[0]),r=a}tO(r,l||li[0],s)}return r}function tO(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.add(r[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)n.style.removeProperty(r[1])}t.style&&(n.style.cssText+=t.style)}}function wk(n,e,t){return kk(n,n,li,op(e,t,n.nodeType!=1))}function ac(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function xk(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class nO{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=oO(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=_n,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){a=u;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=si.create(this.top,e[s],t,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let d=this.top.children[l];if(d.matchesNode(e,t,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,o,r,i){let s=this.top.children[r];return s.dirty==co&&s.dom==s.contentDOM&&(s.dirty=ii),s.update(e,t,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=t}}updateNextNode(e,t,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof yr){let d=this.preMatch.matched.get(a);if(d!=null&&d!=i)return!1;let u=a.dom,f,p=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=co&&ac(t,a.outerDeco));if(!p&&a.update(e,t,o,r))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(a,e,t,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=ii,f.updateChildren(r,s+1),f.dirty=_n),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ac(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=yr.create(this.top,t,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,o,r,i){let s=yr.create(this.top,e,t,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new mk(this.top,e,t,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof si;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof lc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((jt||Rt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new yk(this.top,[],o,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function oO(n,e){let t=e,o=t.children.length,r=n.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=t.children[o-1];if(d instanceof si)t=d,o=d.children.length;else{l=d,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function rO(n,e){return n.type.side-e.type.side}function iO(n,e,t,o){let r=e.locals(n),i=0;if(r.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let d=0;;){let u,f;for(;s<r.length&&r[s].to==i;){let y=r[s++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(rO);for(let y=0;y<f.length;y++)t(f[y],d,!!a)}else t(u,d,!!a);let p,h;if(a)h=-1,p=a,a=null;else if(d<n.childCount)h=d,p=n.child(d++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let y=m;s<r.length&&r[s].from<y&&(y=r[s].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(a=p.cut(y-i),p=p.cut(0,y-i),m=y,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let g=p.isInline&&!p.isLeaf?l.filter(y=>!y.inline):l.slice();o(p,g,e.forChild(i,p),h),i=m}}function sO(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function lO(n,e,t,o){for(let r=0,i=0;r<n.childCount&&i<=o;){let s=n.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;r<n.childCount;){let d=n.child(r++);if(i+=d.nodeSize,!d.isText)break;a+=d.text}if(i>=t){if(i>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?a.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=t)return l+d;if(t==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function rp(n,e,t,o,r){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],d=l,u=l+=a.size;d>=t||u<=e?i.push(a):(d<e&&i.push(a.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>t&&i.push(a.slice(t-d,a.size,o)))}return i}function ip(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,d;if(sc(t)){for(a=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Q.isSelectable(f)&&r.parent&&!(f.isInline&&DA(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;d=new Q(s==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,p=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,s]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=o.resolve(a);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;d=lp(n,u,l,f)}return d}function Ck(n){return n.editable?n.hasFocus():Ak(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Po(n,e=!1){let t=n.state.selection;if(Mk(n,t),!!Ck(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Rt){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&oi(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)cO(n);else{let{anchor:o,head:r}=t,i,s;Sk&&!(t instanceof q)&&(t.$from.parent.inlineContent||(i=vk(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=vk(n,t.to))),n.docView.setSelection(o,r,n,e),Sk&&(i&&Ek(i),s&&Ek(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&aO(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Sk=jt||Rt&&tk<63;function vk(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(jt&&r&&r.contentEditable=="false")return sp(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return sp(r);if(i)return sp(i)}}function sp(n){return n.contentEditable="true",jt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Ek(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function aO(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Ck(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function cO(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,Bt(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&dn&&mr<=11&&(t.disabled=!0,t.disabled=!1)}function Mk(n,e){if(e instanceof Q){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Tk(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Tk(n)}function Tk(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function lp(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||q.between(e,t,o)}function Nk(n){return n.editable&&!n.hasFocus()?!1:Ak(n)}function Ak(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function dO(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return oi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function ap(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&ie.findFrom(i,e)}function br(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Ok(n,e,t){let o=n.state.selection;if(o instanceof q)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return br(n,new q(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=ap(n.state,e);return r&&r instanceof Q?br(n,r):!1}else if(!(Dn&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?Q.isSelectable(i)?br(n,new Q(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):rl?br(n,new q(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Q&&o.node.isInline)return br(n,new q(e>0?o.$to:o.$from));{let r=ap(n.state,e);return r?br(n,r):!1}}}function cc(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function al(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function es(n,e){return e<0?uO(n):fO(n)}function uO(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(Rn&&t.nodeType==1&&o<cc(t)&&al(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(al(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if($k(t))break;{let l=t.previousSibling;for(;l&&al(l,-1);)r=t.parentNode,i=Bt(l),l=l.previousSibling;if(l)t=l,o=cc(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?cp(n,t,o):r&&cp(n,r,i)}function fO(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=cc(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(al(l,1))i=t,s=++o;else break}else{if($k(t))break;{let l=t.nextSibling;for(;l&&al(l,1);)i=l.parentNode,s=Bt(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=cc(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&cp(n,i,s)}function $k(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function pO(n,e){for(;n&&e==n.childNodes.length&&!ol(n);)e=Bt(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function hO(n,e){for(;n&&!e&&!ol(n);)e=Bt(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function cp(n,e,t){if(e.nodeType!=3){let i,s;(s=pO(e,t))?(e=s,t=0):(i=hO(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(sc(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Po(n)},50)}function Bk(n,e){let t=n.state.doc.resolve(e);if(!(Rt||nk)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Rk(n,e,t){let o=n.state.selection;if(o instanceof q&&!o.empty||t.indexOf("s")>-1||Dn&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=ap(n.state,e);if(s&&s instanceof Q)return br(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof tn?ie.near(s,e):ie.findFrom(s,e);return l?br(n,l):!1}return!1}function Dk(n,e){if(!(n.state.selection instanceof q))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function _k(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function mO(n){if(!jt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;_k(n,o,"true"),setTimeout(()=>_k(n,o,"false"),20)}return!1}function gO(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function yO(n,e){let t=e.keyCode,o=gO(e);if(t==8||Dn&&t==72&&o=="c")return Dk(n,-1)||es(n,-1);if(t==46&&!e.shiftKey||Dn&&t==68&&o=="c")return Dk(n,1)||es(n,1);if(t==13||t==27)return!0;if(t==37||Dn&&t==66&&o=="c"){let r=t==37?Bk(n,n.state.selection.from)=="ltr"?-1:1:-1;return Ok(n,r,o)||es(n,r)}else if(t==39||Dn&&t==70&&o=="c"){let r=t==39?Bk(n,n.state.selection.from)=="ltr"?1:-1:1;return Ok(n,r,o)||es(n,r)}else{if(t==38||Dn&&t==80&&o=="c")return Rk(n,-1,o)||es(n,-1);if(t==40||Dn&&t==78&&o=="c")return mO(n)||Rk(n,1,o)||es(n,1);if(o==(Dn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function dp(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=n.someProp("clipboardSerializer")||ei.fromSchema(n.state.schema),l=jk(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let d=a.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Hk[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}d=a.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
11
-
12
- `);return{dom:a,text:p,slice:e}}function Ik(n,e,t,o,r){let i=r.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(o||i||!t);if(a){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new j(L.from(n.state.schema.text(e.replace(/\r\n?/g,`
13
- `))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=ei.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=xO(t),rl&&CO(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||dr.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!bO.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=SO(zk(l,+u[1],+u[2]),u[4]);else if(l=j.maxOpen(kO(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=zk(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const bO=/^(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 kO(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=r.findWrapping(l.type),d;if(!a)return s=null;if(d=s.length&&i.length&&Pk(a,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Vk(s[s.length-1],i.length));let u=Lk(l,a);s.push(u),r=r.matchType(u.type),i=a}}),s)return L.from(s)}return n}function Lk(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,L.from(n));return n}function Pk(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=Pk(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(L.from(Lk(t,n,r+1))))}}function Vk(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Vk(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(L.empty,!0);return n.copy(t.append(o))}function up(n,e,t,o,r,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=up(l,e,t,o,r+1,i)),r>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(L.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function zk(n,e,t){return e<n.openStart&&(n=new j(up(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new j(up(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Hk={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Fk=null;function jk(){return Fk||(Fk=document.implementation.createHTMLDocument("title"))}let fp=null;function wO(n){let e=window.trustedTypes;return e?(fp||(fp=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),fp.createHTML(n)):n}function xO(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=jk().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&Hk[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=wO(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function CO(n){let e=n.querySelectorAll(Rt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function SO(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;r=L.from(a.create(o[l+1],r)),i++,s++}return new j(r,i,s)}const nn={},on={},vO={touchstart:!0,touchmove:!0};class EO{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function MO(n){for(let e in nn){let t=nn[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{NO(n,o)&&!hp(n,o)&&(n.editable||!(o.type in on))&&t(n,o)},vO[e]?{passive:!0}:void 0)}jt&&n.dom.addEventListener("input",()=>null),pp(n)}function kr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function TO(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function pp(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>hp(n,o))})}function hp(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function NO(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function AO(n,e){!hp(n,e)&&nn[e.type]&&(n.editable||!(e.type in on))&&nn[e.type](n,e)}on.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Wk(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Io&&Rt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Qi&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,ri(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||yO(n,t)?t.preventDefault():kr(n,"key")},on.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},on.keypress=(n,e)=>{let t=e;if(Wk(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Dn&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof q)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function dc(n){return{left:n.clientX,top:n.clientY}}function OO(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function mp(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),r,!0):l(n,t,i.node(s),i.before(s),r,!1)))return!0;return!1}function ts(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function $O(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Q.isSelectable(o)?(ts(n,new Q(t)),!0):!1}function BO(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Q&&(o=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Q.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(s);break}}return r!=null?(ts(n,Q.create(n.state.doc,r)),!0):!1}function RO(n,e,t,o,r){return mp(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?BO(n,t):$O(n,t))}function DO(n,e,t,o){return mp(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function _O(n,e,t,o){return mp(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||IO(n,t,o)}function IO(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(ts(n,q.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)ts(n,q.create(o,l+1,l+1+s.content.size));else if(Q.isSelectable(s))ts(n,Q.create(o,l));else continue;return!0}}function gp(n){return uc(n)}const Uk=Dn?"metaKey":"ctrlKey";nn.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=gp(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&OO(t,n.input.lastClick)&&!t[Uk]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(dc(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new LO(n,s,t,!!o)):(i=="doubleClick"?DO:_O)(n,s.pos,s.inside,t)?t.preventDefault():kr(n,"pointer"))};class LO{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Uk],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Q&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Rn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),kr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Po(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(dc(e))),this.updateAllowDefault(e),this.allowDefault||!t?kr(this.view,"pointer"):RO(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||jt&&this.mightDrag&&!this.mightDrag.node.isAtom||Rt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(ts(this.view,ie.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):kr(this.view,"pointer")}move(e){this.updateAllowDefault(e),kr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}nn.touchstart=n=>{n.input.lastTouch=Date.now(),gp(n),kr(n,"pointer")},nn.touchmove=n=>{n.input.lastTouch=Date.now(),kr(n,"pointer")},nn.contextmenu=n=>gp(n);function Wk(n,e){return n.composing?!0:jt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const PO=Io?5e3:-1;on.compositionstart=on.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof q&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||Rt&&nk&&VO(n)))n.markCursor=n.state.storedMarks||t.marks(),uc(n,!0),n.markCursor=null;else if(uc(n,!e.selection.empty),Rn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}qk(n,PO)};function VO(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}on.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,qk(n,20))};function qk(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>uc(n),e))}function Kk(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=HO());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function zO(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=BA(e.focusNode,e.focusOffset),o=RA(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let r=o.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return o}}return t||o}function HO(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function uc(n,e=!1){if(!(Io&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Kk(n),e||n.docView&&n.docView.dirty){let t=ip(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function FO(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const cl=dn&&mr<15||Qi&&LA<604;nn.copy=on.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=cl?null:t.clipboardData,s=o.content(),{dom:l,text:a}=dp(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):FO(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jO(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function UO(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?dl(n,o.value,null,r,e):dl(n,o.textContent,o.innerHTML,r,e)},50)}function dl(n,e,t,o,r){let i=Ik(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||j.empty)))return!0;if(!i)return!1;let s=jO(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Jk(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}on.paste=(n,e)=>{let t=e;if(n.composing&&!Io)return;let o=cl?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&dl(n,Jk(o),o.getData("text/html"),r,t)?t.preventDefault():UO(n,t)};class Gk{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const WO=Dn?"altKey":"ctrlKey";function Xk(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[WO]}nn.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(dc(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Q?r.to-1:r.to))){if(o&&o.mightDrag)s=Q.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=Q.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:d,slice:u}=dp(n,l);(!t.dataTransfer.files.length||!Rt||tk>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(cl?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",cl||t.dataTransfer.setData("text/plain",d),n.dragging=new Gk(u,Xk(n,t),s)},nn.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},on.dragover=on.dragenter=(n,e)=>e.preventDefault(),on.drop=(n,e)=>{try{qO(n,e,n.dragging)}finally{n.dragging=null}};function qO(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(dc(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=Ik(n,Jk(e.dataTransfer),cl?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&Xk(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||j.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Mb(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let a=n.state.tr;if(s){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let d=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(u?a.replaceRangeWith(d,d,i.content.firstChild):a.replaceRange(d,d,i),a.doc.eq(f))return;let p=a.doc.resolve(d);if(u&&Q.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new Q(p));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),a.setSelection(lp(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}nn.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Po(n)},20))},nn.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},nn.beforeinput=(n,e)=>{if(Rt&&Io&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,ri(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in on)nn[n]=on[n];function ul(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class fc{constructor(e,t){this.toDOM=e,this.spec=t||ai,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new ze(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof fc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ul(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class wr{constructor(e,t){this.attrs=e,this.spec=t||ai}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new ze(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof wr&&ul(this.attrs,e.attrs)&&ul(this.spec,e.spec)}static is(e){return e.type instanceof wr}destroy(){}}class yp{constructor(e,t){this.attrs=e,this.spec=t||ai}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new ze(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof yp&&ul(this.attrs,e.attrs)&&ul(this.spec,e.spec)}destroy(){}}class ze{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new ze(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new ze(e,e,new fc(t,o))}static inline(e,t,o,r){return new ze(e,t,new wr(o,r))}static node(e,t,o,r){return new ze(e,t,new yp(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof wr}get widget(){return this.type instanceof fc}}const ns=[],ai={};class Se{constructor(e,t){this.local=e.length?e:ns,this.children=t.length?t:ns}static create(e,t){return t.length?pc(t,e,0,ai):Ut}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==Ut||e.maps.length==0?this:this.mapInner(e,t,0,0,o||ai)}mapInner(e,t,o,r,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?KO(this.children,s||[],e,t,o,r,i):s?new Se(s.sort(ci),ns):Ut}add(e,t){return t.length?this==Ut?Se.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let d=a+o,u;if(u=Qk(t,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,a,a+l.nodeSize,pc(u,l,d+1,ai)),i+=3}});let s=Yk(i?Zk(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Se(s.length?this.local.concat(s).sort(ci):this.local,r||this.children)}remove(e){return e.length==0||this==Ut?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+t,a=o[i+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<a&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=Ut?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Se(r,o):Ut}forChild(e,t){if(this==Ut)return this;if(t.isLeaf)return Se.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof wr){let d=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;d<u&&(r||(r=[])).push(a.copy(d,u))}}if(r){let l=new Se(r.sort(ci),ns);return o?new xr([l,o]):l}return o||Ut}eq(e){if(this==e)return!0;if(!(e instanceof Se)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return bp(this.localsInner(e))}localsInner(e){if(this==Ut)return ns;if(e.inlineContent||!this.local.some(wr.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof wr||t.push(this.local[o]);return t}forEachSet(e){e(this)}}Se.empty=new Se([],[]),Se.removeOverlap=bp;const Ut=Se.empty;class xr{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,ai));return xr.from(o)}forChild(e,t){if(t.isLeaf)return Se.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=Ut&&(i instanceof xr?o=o.concat(i.members):o.push(i))}return xr.from(o)}eq(e){if(!(e instanceof xr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?bp(o?t:t.sort(ci)):ns}static from(e){switch(e.length){case 0:return Ut;case 1:return e[0];default:return new xr(e.every(t=>t instanceof Se)?e:e.reduce((t,o)=>t.concat(o instanceof Se?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function KO(n,e,t,o,r,i,s){let l=n.slice();for(let d=0,u=i;d<t.maps.length;d++){let f=0;t.maps[d].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let k=l[b+1];if(k<0||p>k+u-f)continue;let x=l[b]+u-f;h>=x?l[b+1]=p<=x?-2:-1:p>=u&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let a=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){a=!0,l[d+1]=-1;continue}let u=t.map(n[d]+i),f=u-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[d+1]+i,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=l[d+2].mapInner(t,y,u+1,n[d]+i+1,s);b!=Ut?(l[d]=f,l[d+1]=h,l[d+2]=b):(l[d+1]=-2,a=!0)}else a=!0}if(a){let d=JO(l,n,e,t,r,i,s),u=pc(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Se(e.sort(ci),l)}function Yk(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new ze(r.from+e,r.to+e,r.type))}return t}function JO(n,e,t,o,r,i,s){function l(a,d){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(o,r,d);f?t.push(f):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+d+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function Qk(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function Zk(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function pc(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let d=Qk(n,l,a+t);if(d){i=!0;let u=pc(d,l,t+a+1,o);u!=Ut&&r.push(a,a+l.nodeSize,u)}});let s=Yk(i?Zk(n):n,-t).sort(ci);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new Se(s,r):Ut}function ci(n,e){return n.from-e.from||n.to-e.to}function bp(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),ew(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),ew(e,r,o.copy(i.from,o.to)));break}}}return e}function ew(n,e,t){for(;e<n.length&&ci(t,n[e])>0;)e++;n.splice(e,0,t)}function kp(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=Ut&&e.push(o)}),n.cursorWrapper&&e.push(Se.create(n.state.doc,[n.cursorWrapper.deco])),xr.from(e)}const GO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},XO=dn&&mr<=11;class YO{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class QO{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new YO,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);dn&&mr<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():jt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),XO&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,GO)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Nk(this.view)){if(this.suppressingSelectionUpdates)return Po(this.view);if(dn&&mr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&oi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,o;for(let i=e.focusNode;i;i=Yi(i))t.add(i);for(let i=e.anchorNode;i;i=Yi(i))if(t.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Nk(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],a);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}else if(Rn&&a.length){let u=a.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||t$(e,f)!=h)&&p.remove()}}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&sc(o)&&(d=ip(e))&&d.eq(ie.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Po(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),ZO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,n$(e,a)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Po(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(dn&&mr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?Bt(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Bt(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,a,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let tw=new WeakMap,nw=!1;function ZO(n){if(!tw.has(n)&&(tw.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Rn,nw)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),nw=!0}}function ow(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return oi(s.node,s.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function e$(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return ow(n,r)}let t;function o(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?ow(n,t):null}function t$(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function n$(n,e){var t;let{focusNode:o,focusOffset:r}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),o==i&&n.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function o$(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),d,u=a.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:a.anchorOffset}],sc(a)||d.push({node:a.focusNode,offset:a.focusOffset})),Rt&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let b=o.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){i=y;break}if(!k||k.size)break}let f=n.state.doc,p=n.someProp("domParser")||dr.fromSchema(n.state.schema),h=f.resolve(s),m=null,g=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:r$,context:h});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+s,head:b+s}}return{doc:g,sel:m,from:s,to:l}}function r$(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(jt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||jt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const i$=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function s$(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,T=ip(n,E);if(T&&!n.state.selection.eq(T)){if(Rt&&Io&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",$=>$(n,ri(13,"Enter"))))return;let A=n.state.tr.setSelection(T);E=="pointer"?A.setMeta("pointer",!0):E=="key"&&A.scrollIntoView(),i&&A.setMeta("composition",i),n.dispatch(A)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,d=o$(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=c$(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Qi&&n.input.lastIOSEnter>Date.now()-225||Io)&&r.some(E=>E.nodeType==1&&!i$.test(E.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",E=>E(n,ri(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&a instanceof q&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(d.sel){let E=rw(n,n.state.doc,d.sel);if(E&&!E.eq(n.state.selection)){let T=n.state.tr.setSelection(E);i&&T.setMeta("composition",i),n.dispatch(T)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof q&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),dn&&mr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),b=u.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Qi&&n.input.lastIOSEnter>Date.now()-225&&(!k||r.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",E=>E(n,ri(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&a$(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",E=>E(n,ri(8,"Backspace")))){Io&&Rt&&n.domObserver.suppressSelectionUpdates();return}Rt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Io&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,ri(13,"Enter"))})},20));let x=m.start,w=m.endA,C=E=>{let T=E||n.state.tr.replace(x,w,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let A=rw(n,T.doc,d.sel);A&&!(Rt&&n.composing&&A.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(A.head==x||A.head==T.mapping.map(w)-1)||dn&&A.empty&&A.head==x)&&T.setSelection(A)}return i&&T.setMeta("composition",i),T.scrollIntoView()},v;if(k)if(g.pos==y.pos){dn&&mr<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Po(n),20));let E=C(n.state.tr.delete(x,w)),T=u.resolve(m.start).marksAcross(u.resolve(m.endA));T&&E.ensureMarks(T),n.dispatch(E)}else if(m.endA==m.endB&&(v=l$(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let E=C(n.state.tr);v.type=="add"?E.addMark(x,w,v.mark):E.removeMark(x,w,v.mark),n.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,y.parentOffset),T=()=>C(n.state.tr.insertText(E,x,w));n.someProp("handleTextInput",A=>A(n,x,w,E,T))||n.dispatch(T())}else n.dispatch(C());else n.dispatch(C())}function rw(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:lp(n,e.resolve(t.anchor),e.resolve(t.head))}function l$(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,s,l,a;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<t.length;u++)i=t[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(a(e.child(u)));if(L.from(d).eq(n))return{mark:l,type:s}}function a$(n,e,t,o,r){if(t-e<=r.pos-o.pos||wp(o,!0,!1)<r.pos)return!1;let i=n.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(wp(i,!0,!0));return!s.parent.isTextblock||s.pos>t||wp(s,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function wp(n,e,t){let o=n.depth,r=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,r++,e=!1;if(t){let i=n.node(o).maybeChild(n.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function c$(n,e,t,o,r){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let a=Math.max(0,i-Math.min(s,l));o-=s+a-i}if(s<i&&n.size<e.size){let a=o<=i&&o>=s?i-o:0;i-=a,i&&i<e.size&&iw(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=o<=i&&o>=l?i-o:0;i-=a,i&&i<n.size&&iw(n.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function iw(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class sw{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new EO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(uw),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=cw(this),aw(this),this.nodeViews=dw(this),this.docView=gk(this.state.doc,lw(this),kp(this),this.dom,this),this.domObserver=new QO(this,(o,r,i,s)=>s$(this,o,r,i,s)),this.domObserver.start(),MO(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&pp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(uw),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Kk(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=dw(this);u$(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&pp(this),this.editable=cw(this),aw(this);let a=kp(this),d=lw(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,a);(f||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&zA(this);if(s){this.domObserver.stop();let h=f&&(dn||Rt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&d$(r.selection,e.selection);if(f){let m=Rt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=zO(this)),(i||!this.docView.update(e.doc,d,a,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=gk(e.doc,d,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&dO(this))?Po(this,h):(Mk(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&HA(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof Q){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&ok(this,t.getBoundingClientRect(),e)}else ok(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new Gk(e.slice,e.move,r<0?void 0:Q.create(this.state.doc,r))}someProp(e,t){let o=this._props&&this._props[e],r;if(o!=null&&(r=t?t(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=t?t(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=t?t(l):l))return r}}hasFocus(){if(dn){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&FA(this.dom),Po(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return KA(this,e)}coordsAtPos(e,t=1){return ck(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,o=-1){let r=this.docView.posFromDOM(e,t,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return QA(this,t||this.state,e)}pasteHTML(e,t){return dl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return dl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return dp(this,e)}destroy(){this.docView&&(TO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],kp(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,OA())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return AO(this,e)}domSelectionRange(){let e=this.domSelection();return e?jt&&this.root.nodeType===11&&_A(this.dom.ownerDocument)==this.dom&&e$(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}sw.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function lw(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[ze.node(0,n.state.doc.content.size,e)]}function aw(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:ze.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function cw(n){return!n.someProp("editable",e=>e(n.state)===!1)}function d$(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function dw(n){let e=Object.create(null);function t(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function u$(n,e){let t=0,o=0;for(let r in n){if(n[r]!=e[r])return!0;t++}for(let r in e)o++;return t!=o}function uw(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Cr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},hc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},f$=typeof navigator<"u"&&/Mac/.test(navigator.platform),p$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Dt=0;Dt<10;Dt++)Cr[48+Dt]=Cr[96+Dt]=String(Dt);for(var Dt=1;Dt<=24;Dt++)Cr[Dt+111]="F"+Dt;for(var Dt=65;Dt<=90;Dt++)Cr[Dt]=String.fromCharCode(Dt+32),hc[Dt]=String.fromCharCode(Dt);for(var xp in Cr)hc.hasOwnProperty(xp)||(hc[xp]=Cr[xp]);function h$(n){var e=f$&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||p$&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?hc:Cr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const m$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),g$=typeof navigator<"u"&&/Win/.test(navigator.platform);function y$(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))m$?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function b$(n){let e=Object.create(null);for(let t in n)e[y$(t)]=n[t];return e}function Cp(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function fw(n){return new ce({props:{handleKeyDown:Sp(n)}})}function Sp(n){let e=b$(n);return function(t,o){let r=h$(o),i,s=e[Cp(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Cp(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(g$&&o.ctrlKey&&o.altKey)&&(i=Cr[o.keyCode])&&i!=r){let l=e[Cp(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var k$=Object.defineProperty,vp=(n,e)=>{for(var t in e)k$(n,t,{get:e[t],enumerable:!0})};function fl(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var pl=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:o}=e,{tr:r}=t,i=this.buildProps(r);return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s=[],l=!!n,a=n||r.tr,d=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(a,e),y=p(...m)(g);return s.push(y),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,o=!1,r=n||t.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...d)=>a(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s={tr:n,editor:o,view:i,state:fl({state:r,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...d)=>a(...d)(s)]))}};return s}},Ep={};vp(Ep,{blur:()=>w$,clearContent:()=>x$,clearNodes:()=>C$,command:()=>S$,createParagraphNear:()=>v$,cut:()=>E$,deleteCurrentNode:()=>M$,deleteNode:()=>T$,deleteRange:()=>N$,deleteSelection:()=>A$,enter:()=>O$,exitCode:()=>$$,extendMarkRange:()=>B$,first:()=>R$,focus:()=>D$,forEach:()=>_$,insertContent:()=>I$,insertContentAt:()=>P$,joinBackward:()=>H$,joinDown:()=>z$,joinForward:()=>F$,joinItemBackward:()=>j$,joinItemForward:()=>U$,joinTextblockBackward:()=>W$,joinTextblockForward:()=>q$,joinUp:()=>V$,keyboardShortcut:()=>J$,lift:()=>G$,liftEmptyBlock:()=>X$,liftListItem:()=>Y$,newlineInCode:()=>Q$,resetAttributes:()=>Z$,scrollIntoView:()=>eB,selectAll:()=>tB,selectNodeBackward:()=>nB,selectNodeForward:()=>oB,selectParentNode:()=>rB,selectTextblockEnd:()=>iB,selectTextblockStart:()=>sB,setContent:()=>lB,setMark:()=>fB,setMeta:()=>pB,setNode:()=>hB,setNodeSelection:()=>mB,setTextDirection:()=>gB,setTextSelection:()=>yB,sinkListItem:()=>bB,splitBlock:()=>kB,splitListItem:()=>wB,toggleList:()=>xB,toggleMark:()=>CB,toggleNode:()=>SB,toggleWrap:()=>vB,undoInputRule:()=>EB,unsetAllMarks:()=>MB,unsetMark:()=>TB,unsetTextDirection:()=>NB,updateAttributes:()=>AB,wrapIn:()=>OB,wrapInList:()=>$B});var w$=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),x$=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),C$=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(a)),p=d.resolve(u.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=ni(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},S$=n=>e=>n(e),v$=()=>({state:n,dispatch:e})=>Xf(n,e),E$=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new q(o.doc.resolve(Math.max(s-1,0)))),!0},M$=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),a=r.after(i);n.delete(l,a).scrollIntoView()}return!0}return!1};function dt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var T$=n=>({tr:e,state:t,dispatch:o})=>{const r=dt(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const a=i.before(s),d=i.after(s);e.delete(a,d).scrollIntoView()}return!0}return!1},N$=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},A$=()=>({state:n,dispatch:e})=>Wf(n,e),O$=()=>({commands:n})=>n.keyboardShortcut("Enter"),$$=()=>({state:n,dispatch:e})=>gA(n,e);function mc(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function hl(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:mc(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function pw(n,e,t={}){return n.find(o=>o.type===e&&hl(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function hw(n,e,t={}){return!!pw(n,e,t)}function di(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!pw([...r.node.marks],e,t)))return;let s=r.index,l=n.start()+r.offset,a=s+1,d=l+r.node.nodeSize;for(;s>0&&hw([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&hw([...n.parent.child(a).marks],e,t);)d+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:d}}function uo(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var B$=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=uo(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:d,to:u}=l;if(r){const f=di(a,i,e);if(f&&f.from<=d&&f.to>=u){const p=q.create(s,f.from,f.to);t.setSelection(p)}}return!0},R$=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function ml(n){return n instanceof q}function fo(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Mp(n,e=null){if(!e)return null;const t=ie.atStart(n),o=ie.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?q.create(n,fo(0,r,i),fo(n.content.size,r,i)):q.create(n,fo(e,r,i),fo(e,r,i))}function gl(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ui(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function mw(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var D$=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(ui()||gl())&&o.dom.focus(),mw()&&!ui()&&!gl()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(o.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!ml(t.state.selection))return s(),!0;const l=Mp(r.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},_$=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),I$=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),gw=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&gw(o)}return n};function rs(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return gw(t)}function is(n,e,t){if(n instanceof $n||n instanceof L)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return L.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),is("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new sb({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?dr.fromSchema(a).parseSlice(rs(n),t.parseOptions):dr.fromSchema(a).parse(rs(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=dr.fromSchema(e);return t.slice?i.parseSlice(rs(n),t.parseOptions).content:i.parse(rs(n),t.parseOptions)}return is("",e,t)}function yw(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof xt||r instanceof Ct))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,d,u)=>{s===0&&(s=u)}),n.setSelection(ie.near(n.doc.resolve(s),t))}var L$=n=>!("type"in n),P$=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{is(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=is(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((L$(l)?l:[l]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===f&&h){const{parent:y}=o.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof L){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;o.insertText(g,u,f)}else{g=l;const y=o.doc.resolve(u),b=y.node(),k=y.parentOffset===0,x=b.isText||b.isTextblock,w=b.content.size>0;k&&x&&w&&(u=Math.max(0,u-1)),o.replaceWith(u,f,g)}t.updateSelection&&yw(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:g})}return!0},V$=()=>({state:n,dispatch:e})=>pA(n,e),z$=()=>({state:n,dispatch:e})=>hA(n,e),H$=()=>({state:n,dispatch:e})=>Hb(n,e),F$=()=>({state:n,dispatch:e})=>Wb(n,e),j$=()=>({state:n,dispatch:e,tr:t})=>{try{const o=tc(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},U$=()=>({state:n,dispatch:e,tr:t})=>{try{const o=tc(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},W$=()=>({state:n,dispatch:e})=>uA(n,e),q$=()=>({state:n,dispatch:e})=>fA(n,e);function Tp(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function K$(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))ui()||Tp()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var J$=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=K$(n).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,l))});return a==null||a.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function Vo(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?dt(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const a=r-o,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>hl(f.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=a}var G$=(n,e={})=>({state:t,dispatch:o})=>{const r=dt(n,t.schema);return Vo(t,r,e)?mA(t,o):!1},X$=()=>({state:n,dispatch:e})=>Kb(n,e),Y$=n=>({state:e,dispatch:t})=>{const o=dt(n,e.schema);return MA(o)(e,t)},Q$=()=>({state:n,dispatch:e})=>Jf(n,e);function yl(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Np(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var Z$=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=yl(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=dt(n,o.schema)),l==="mark"&&(s=uo(n,o.schema));let a=!1;return t.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,Np(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+u.nodeSize,s.create(Np(p.attrs,e))))})})}),a},eB=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),tB=()=>({tr:n,dispatch:e})=>{if(e){const t=new tn(n.doc);n.setSelection(t)}return!0},nB=()=>({state:n,dispatch:e})=>jb(n,e),oB=()=>({state:n,dispatch:e})=>qb(n,e),rB=()=>({state:n,dispatch:e})=>bA(n,e),iB=()=>({state:n,dispatch:e})=>xA(n,e),sB=()=>({state:n,dispatch:e})=>wA(n,e);function gc(n,e,t={},o={}){return is(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var lB=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(o.preserveWhitespace!=="full"){const d=gc(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,d).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function Ap(n,e){const t=uo(e,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function yc(n,e){const t=new zf(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function bc(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function zo(n,e){const t=[];return n.descendants((o,r)=>{e(o)&&t.push({node:o,pos:r})}),t}function Op(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function kc(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function Sr(n){return e=>kc(e.$from,n)}function ne(n,e,t){return n.config[e]===void 0&&n.parent?ne(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ne(n.parent,e,t):null}):n.config[e]}function wc(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=ne(e,"addExtensions",t);return o?[e,...wc(o())]:e}).flat(10)}function bl(n,e){const t=ei.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function $p(n){return typeof n=="function"}function Re(n,e=void 0,...t){return $p(n)?e?n.bind(e)(...t):n(...t):n}function bw(n={}){return Object.keys(n).length===0&&n.constructor===Object}function fi(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function Bp(n){const e=[],{nodeExtensions:t,markExtensions:o}=fi(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=t.filter(d=>d.name!=="text").map(d=>d.name),l=o.map(d=>d.name),a=[...s,...l];return n.forEach(d=>{const u={name:d.name,options:d.options,storage:d.storage,extensions:r},f=ne(d,"addGlobalAttributes",u);if(!f)return;f().forEach(h=>{let m;Array.isArray(h.types)?m=h.types:h.types==="*"?m=a:h.types==="nodes"?m=s:h.types==="marks"?m=l:m=[],m.forEach(g=>{Object.entries(h.attributes).forEach(([y,b])=>{e.push({type:g,name:y,attribute:{...i,...b}})})})})}),r.forEach(d=>{const u={name:d.name,options:d.options,storage:d.storage},f=ne(d,"addAttributes",u);if(!f)return;const p=f();Object.entries(p).forEach(([h,m])=>{const g={...i,...m};typeof(g==null?void 0:g.default)=="function"&&(g.default=g.default()),g!=null&&g.isRequired&&(g==null?void 0:g.default)===void 0&&delete g.default,e.push({type:d.name,name:h,attribute:g})})}),e}function fe(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],a=o[r]?o[r].split(" "):[],d=l.filter(u=>!a.includes(u));o[r]=[...a,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],a=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;a.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function ss(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>fe(t,o),{})}function kw(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Rp(n,e){return"style"in n?n:{...n,getAttrs:t=>{const o=n.getAttrs?n.getAttrs(t):n.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):kw(t.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function ww(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&bw(t)?!1:t!=null))}function xw(n){var e,t;const o={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(o.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(o.validate=n.attribute.validate),[n.name,o]}function Dp(n,e){var t;const o=Bp(n),{nodeExtensions:r,markExtensions:i}=fi(n),s=(t=r.find(d=>ne(d,"topNode")))==null?void 0:t.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((b,k)=>{const x=ne(k,"extendNodeSchema",f);return{...b,...x?x(d):{}}},{}),h=ww({...p,content:Re(ne(d,"content",f)),marks:Re(ne(d,"marks",f)),group:Re(ne(d,"group",f)),inline:Re(ne(d,"inline",f)),atom:Re(ne(d,"atom",f)),selectable:Re(ne(d,"selectable",f)),draggable:Re(ne(d,"draggable",f)),code:Re(ne(d,"code",f)),whitespace:Re(ne(d,"whitespace",f)),linebreakReplacement:Re(ne(d,"linebreakReplacement",f)),defining:Re(ne(d,"defining",f)),isolating:Re(ne(d,"isolating",f)),attrs:Object.fromEntries(u.map(xw))}),m=Re(ne(d,"parseHTML",f));m&&(h.parseDOM=m.map(b=>Rp(b,u)));const g=ne(d,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ss(b,u)}));const y=ne(d,"renderText",f);return y&&(h.toText=y),[d.name,h]})),a=Object.fromEntries(i.map(d=>{const u=o.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((y,b)=>{const k=ne(b,"extendMarkSchema",f);return{...y,...k?k(d):{}}},{}),h=ww({...p,inclusive:Re(ne(d,"inclusive",f)),excludes:Re(ne(d,"excludes",f)),group:Re(ne(d,"group",f)),spanning:Re(ne(d,"spanning",f)),code:Re(ne(d,"code",f)),attrs:Object.fromEntries(u.map(xw))}),m=Re(ne(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>Rp(y,u)));const g=ne(d,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:ss(y,u)})),[d.name,h]}));return new sb({topNode:s,nodes:l,marks:a})}function Cw(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function ls(n){return n.sort((t,o)=>{const r=ne(t,"priority")||100,i=ne(o,"priority")||100;return r>i?-1:r<i?1:0})}function xc(n){const e=ls(wc(n)),t=Cw(e.map(o=>o.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function Cc(n,e){const t=xc(n);return Dp(t,e)}function Sw(n,e){const t=Cc(e),o=$n.fromJSON(t,n);return bl(o.content,t)}function _p(n,e){const t=Cc(e),o=rs(n);return dr.fromSchema(t).parse(o).toJSON()}function Ip(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
14
-
15
- `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,d,u,f)=>{var p;a.isBlock&&d>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return u&&(l+=h({node:a,pos:d,parent:u,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function Sc(n,e){const t={from:0,to:n.content.size};return Ip(n,t,e)}function kl(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function aB(n,e,t){const{blockSeparator:o=`
16
-
17
- `,textSerializers:r={}}=t||{},i=Cc(e),s=$n.fromJSON(i,n);return Sc(s,{blockSeparator:o,textSerializers:{...kl(i),...r}})}function vw(n,e){const t=dt(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function Lp(n,e){const t=yl(typeof e=="string"?e:e.name,n.schema);return t==="node"?vw(n,e):t==="mark"?Ap(n,e):{}}function Ew(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function cB(n){const e=Ew(n);return e.length===1?e:e.filter((t,o)=>!e.filter((i,s)=>s!==o).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function vc(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(a),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),cB(o)}function Mw(n,e=0){const o=n.type===n.type.schema.topNodeType?0:1,r=e,i=r+n.nodeSize,s=n.marks.map(d=>{const u={type:d.type.name};return Object.keys(d.attrs).length&&(u.attrs={...d.attrs}),u}),l={...n.attrs},a={type:n.type.name,from:r,to:i};return Object.keys(l).length&&(a.attrs=l),s.length&&(a.marks=s),n.content.childCount&&(a.content=[],n.forEach((d,u)=>{var f;(f=a.content)==null||f.push(Mw(d,e+u+o))})),n.text&&(a.text=n.text),a}function Ec(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),s=di(i,r.type);s&&o.push({mark:r,...s})}):t.nodesBetween(n,e,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var Tw=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function as(n,e){return e.nodes[n]||e.marks[n]||null}function wl(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var Nw=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var a,d;const u=((d=(a=r.type.spec).toText)==null?void 0:d.call(a,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),t};function Mc(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?uo(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>hl(f.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(i&&g.inlineContent&&!g.type.allowsMarkType(i))return!1;if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),k=Math.min(m,y+g.nodeSize),x=k-b;s+=x,l.push(...g.marks.map(w=>({mark:w,from:b,to:k})))})}),s===0)return!1;const a=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>hl(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(a>0?a+d:a)>=s}function Pp(n,e,t={}){if(!e)return Vo(n,null,t)||Mc(n,null,t);const o=yl(e,n.schema);return o==="node"?Vo(n,e,t):o==="mark"?Mc(n,e,t):!1}var Aw=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Sr(l=>l.type.name===e)(n.selection);if(!i)return!1;const s=n.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},Ow=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Vp(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function zp(n,e){const{nodeExtensions:t}=fi(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Re(ne(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function xl(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(xl(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function Hp(n){return n instanceof Q}var Tc=class QT{constructor(e){this.position=e}static fromJSON(e){return new QT(e.position)}toJSON(){return{position:this.position}}};function Fp(n,e){const t=e.mapping.mapResult(n.position);return{position:new Tc(t.pos),mapResult:t}}function $w(n){return new Tc(n)}function jp(n,e,t){const r=n.state.doc.content.size,i=fo(e,0,r),s=fo(t,0,r),l=n.coordsAtPos(i),a=n.coordsAtPos(s,-1),d=Math.min(l.top,a.top),u=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),p=Math.max(l.right,a.right),h=p-f,m=u-d,b={top:d,bottom:u,left:f,right:p,width:h,height:m,x:f,y:d};return{...b,toJSON:()=>b}}function Bw({json:n,validMarks:e,validNodes:t,options:o,rewrittenContent:r=[]}){return n.marks&&Array.isArray(n.marks)&&(n.marks=n.marks.filter(i=>{const s=typeof i=="string"?i:i.type;return e.has(s)?!0:(r.push({original:JSON.parse(JSON.stringify(i)),unsupported:s}),!1)})),n.content&&Array.isArray(n.content)&&(n.content=n.content.map(i=>Bw({json:i,validMarks:e,validNodes:t,options:o,rewrittenContent:r}).json).filter(i=>i!=null)),n.type&&!t.has(n.type)?(r.push({original:JSON.parse(JSON.stringify(n)),unsupported:n.type}),n.content&&Array.isArray(n.content)&&(o==null?void 0:o.fallbackToParagraph)!==!1?(n.type="paragraph",{json:n,rewrittenContent:r}):{json:null,rewrittenContent:r}):{json:n,rewrittenContent:r}}function dB(n,e,t){return Bw({json:n,validNodes:new Set(Object.keys(e.nodes)),validMarks:new Set(Object.keys(e.marks)),options:t})}function uB(n,e,t){var o;const{selection:r}=e;let i=null;if(ml(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(d=>d.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let d=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var fB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=uo(n,o.schema);if(r)if(s){const d=Ap(o,a);t.addStoredMark(a.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),g=Math.min(h+p.nodeSize,f);p.marks.find(b=>b.type===a)?p.marks.forEach(b=>{a===b.type&&t.addMark(m,g,a.create({...b.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return uB(o,t,a)},pB=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),hB=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=dt(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Yb(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Yb(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},mB=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=fo(n,0,o.content.size),i=Q.create(o,r);e.setSelection(i)}return!0},gB=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(a,d)=>{a.isText||t.setNodeMarkup(d,void 0,{...a.attrs,dir:n})}),!0},yB=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=q.atStart(o).from,l=q.atEnd(o).to,a=fo(r,s,l),d=fo(i,s,l),u=q.create(o,a,d);e.setSelection(u)}return!0},bB=n=>({state:e,dispatch:t})=>{const o=dt(n,e.schema);return AA(o)(e,t)};function Rw(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e==null?void 0:e.includes(r.type.name));n.tr.ensureMarks(o)}}var kB=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,d=r.extensionManager.attributes,u=wl(d,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!lo(s,l.pos)?!1:(o&&(n&&Rw(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,p=l.depth===0?void 0:bc(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=lo(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&lo(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof q&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&Rw(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},wB=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=dt(n,o.schema),{$from:a,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(d))return!1;const f=a.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let b=L.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-k;T>=a.depth-3;T-=1)b=L.from(a.node(T).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...wl(p,a.node().type.name,a.node().attrs),...e},C=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(L.from(l.createAndFill(null,C)||void 0));const v=a.before(a.depth-(k-1));t.replace(v,a.after(-x),new j(b,4-k,0));let E=-1;t.doc.nodesBetween(v,t.doc.content.size,(T,A)=>{if(E>-1)return!1;T.isTextblock&&T.content.size===0&&(E=A+1)}),E>-1&&t.setSelection(q.near(t.doc.resolve(E))),t.scrollIntoView()}return!0}const h=d.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...wl(p,f.type.name,f.attrs),...e},g={...wl(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,d.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!lo(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:k}=o,{splittableMarks:x}=i.extensionManager,w=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!w||!r)return!0;const C=w.filter(v=>x.includes(v.type.name));t.ensureMarks(C)}return!0},Up=(n,e)=>{const t=Sr(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&pr(n.doc,t.pos)&&n.join(t.pos),!0},Wp=(n,e)=>{const t=Sr(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&pr(n.doc,o)&&n.join(o),!0},xB=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=dt(n,s.schema),m=dt(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:k}=g,x=b.blockRange(k),w=y||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const C=Sr(v=>zp(v.type.name,f))(g);if(x.depth>=1&&C&&x.depth-C.depth<=1){if(C.node.type===h)return d.liftListItem(m);if(zp(C.node.type.name,f)&&h.validContent(C.node.content)&&l)return a().command(()=>(i.setNodeMarkup(C.pos,h),!0)).command(()=>Up(i,h)).command(()=>Wp(i,h)).run()}return!t||!w||!l?a().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Up(i,h)).command(()=>Wp(i,h)).run():a().command(()=>{const v=u().wrapInList(h,o),E=w.filter(T=>p.includes(T.type.name));return i.ensureMarks(E),v?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Up(i,h)).command(()=>Wp(i,h)).run()},CB=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=uo(n,o.schema);return Mc(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},SB=(n,e,t={})=>({state:o,commands:r})=>{const i=dt(n,o.schema),s=dt(e,o.schema),l=Vo(o,i,t);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...t})},vB=(n,e={})=>({state:t,commands:o})=>{const r=dt(n,t.schema);return Vo(t,r,e)?o.lift(r):o.wrapIn(r,e)},EB=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},MB=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},TB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=uo(n,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=di(d,a,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,a)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,a)});return t.removeStoredMark(a),!0},NB=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,s;return typeof n=="number"?(i=n,s=n):n&&"from"in n&&"to"in n?(i=n.from,s=n.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(a,void 0,d)}),!0},AB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=yl(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=dt(n,o.schema)),l==="mark"&&(s=uo(n,o.schema));let a=!1;return t.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(u,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(u,f,(y,b)=>{b<u&&i&&i===y.type&&(a=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=u&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(k=>{if(s===k.type&&(a=!0,r)){const x=Math.max(b,u),w=Math.min(b+y.nodeSize,f);t.addMark(x,w,s.create({...k.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&r&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),a},OB=(n,e={})=>({state:t,dispatch:o})=>{const r=dt(n,t.schema);return CA(r,e)(t,o)},$B=(n,e={})=>({state:t,dispatch:o})=>{const r=dt(n,t.schema);return SA(r,e)(t,o)},BB=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(o=>o.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(o=>o!==e):delete this.callbacks[n]),this}once(n,e){const t=(...o)=>{this.off(n,t),e.apply(this,o)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},vr=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},RB=(n,e)=>{if(mc(e))return e.exec(n);const t=e(n);if(!t)return null;const o=[t.text];return o.index=t.index,o.input=n,o.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(t.replaceWith)),o};function Nc(n){var e;const{editor:t,from:o,to:r,text:i,rules:s,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const d=a.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=Nw(d)+i;return s.forEach(p=>{if(u)return;const h=RB(f,p.find);if(!h)return;const m=a.state.tr,g=fl({state:a.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:b,chain:k,can:x}=new pl({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:k,can:x})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),a.dispatch(m),u=!0)}),u}function Dw(n){const{editor:e,rules:t}=n,o=new ce({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const a=r.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:u}=a;typeof u=="string"?u=u:u=bl(L.from(u),s.schema);const{from:f}=a,p=f+u.length;Nc({editor:e,from:f,to:p,text:u,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return Nc({editor:e,from:i,to:s,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Nc({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?Nc({editor:e,from:s.pos,to:s.pos,text:`
18
- `,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function DB(n){return Object.prototype.toString.call(n).slice(8,-1)}function Cl(n){return DB(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function qp(n,e){const t={...n};return Cl(n)&&Cl(e)&&Object.keys(e).forEach(o=>{Cl(e[o])&&Cl(n[o])?t[o]=qp(n[o],e[o]):t[o]=e[o]}),t}var Ac=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Re(ne(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Re(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>qp(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},In=class ZT extends Ac{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new ZT(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>(d==null?void 0:d.type.name)===t.name))return!1;const a=s.find(d=>(d==null?void 0:d.type.name)===t.name);return a&&o.removeStoredMark(a),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function _w(n){return typeof n=="number"}var Oc=class{constructor(n){this.find=n.find,this.handler=n.handler}},_B=(n,e,t)=>{if(mc(e))return[...n.matchAll(e)];const o=e(n,t);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function IB(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:d,can:u}=new pl({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,b,k,x;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const w=(x=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?x:0,C=Math.max(o,m),v=Math.min(r,m+w);if(C>=v)return;const E=h.isText?h.text||"":h.textBetween(C-m,v-m,void 0,"");_B(E,i.find,s).forEach(A=>{if(A.index===void 0)return;const $=C+A.index+1,O=$+A[0].length,B={from:t.tr.mapping.map($),to:t.tr.mapping.map(O)},_=i.handler({state:t,range:B,match:A,commands:a,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(_)})}),f.every(h=>h!==null)}var $c=null,LB=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function Iw(n){const{editor:e,rules:t}=n;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const g=u.tr,y=fl({state:u,transaction:g});if(!(!IB({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new ce({view(f){const p=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&($c=e)},h=()=>{$c&&($c=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=$c;h!=null&&h.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!r,y=m.getMeta("uiEvent")==="drop"&&!i,b=m.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:C}=b;typeof C=="string"?C=C:C=bl(L.from(C),h.schema);const{from:v}=b,E=v+C.length,T=LB(C);return a({rule:u,state:h,from:v,to:{b:E},pasteEvt:T})}const x=p.doc.content.findDiffStart(h.doc.content),w=p.doc.content.findDiffEnd(h.doc.content);if(!(!_w(x)||!w||x===w.b))return a({rule:u,state:h,from:x,to:w,pasteEvt:s})}}))}var Bc=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=xc(n),this.schema=Dp(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:as(e.name,this.schema)},o=ne(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return ls([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:as(o.name,this.schema)},i=[],s=ne(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&ne(o,"exitable",r)&&(l.ArrowRight=()=>In.handleExit({editor:n,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...p}}const a=fw(l);i.push(a);const d=ne(o,"addInputRules",r);if(Vp(o,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=Dw({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=ne(o,"addPasteRules",r);if(Vp(o,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=Iw({editor:n,rules:p});i.push(...h)}}const f=ne(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return Bp(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=fi(this.extensions);return Object.fromEntries(e.filter(t=>!!ne(t,"addNodeView")).map(t=>{const o=this.attributes.filter(a=>a.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:dt(t.name,this.schema)},i=ne(t,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(a,d,u,f,p)=>{const h=ss(a,o);return s({node:a,view:d,getPos:u,decorations:f,innerDecorations:p,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return ls([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:as(r.name,this.schema)},s=ne(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},n)}transformPastedHTML(n){const{editor:e}=this;return ls([...this.extensions]).reduce((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:as(r.name,this.schema)},s=ne(r,"transformPastedHTML",i);return s?(l,a)=>{const d=o(l,a);return s.call(i,d)}:o},n||(o=>o))}get markViews(){const{editor:n}=this,{markExtensions:e}=fi(this.extensions);return Object.fromEntries(e.filter(t=>!!ne(t,"addMarkView")).map(t=>{const o=this.attributes.filter(l=>l.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:uo(t.name,this.schema)},i=ne(t,"addMarkView",r);if(!i)return[];const s=(l,a,d)=>{const u=ss(l,o);return i()({mark:l,view:a,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{Gp(l,n,f)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:as(e.name,this.schema)};e.type==="mark"&&((t=Re(ne(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const r=ne(e,"onBeforeCreate",o),i=ne(e,"onCreate",o),s=ne(e,"onUpdate",o),l=ne(e,"onSelectionUpdate",o),a=ne(e,"onTransaction",o),d=ne(e,"onFocus",o),u=ne(e,"onBlur",o),f=ne(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};Bc.resolve=xc,Bc.sort=ls,Bc.flatten=wc;var Lw={};vp(Lw,{ClipboardTextSerializer:()=>Pw,Commands:()=>Vw,Delete:()=>zw,Drop:()=>Hw,Editable:()=>Fw,FocusEvents:()=>Uw,Keymap:()=>Ww,Paste:()=>qw,Tabindex:()=>Kw,TextDirection:()=>Jw,focusEventsPluginKey:()=>jw});var me=class eN extends Ac{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new eN(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Pw=me.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ce({key:new le("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=kl(t);return Ip(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Vw=me.create({name:"commands",addCommands(){return{...Ep}}}),zw=me.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,d;if((d=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=yc(n.before,[n,...e]);vc(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var g,y;if(h instanceof Jn){const b=p.slice(m).map(h.from,-1),k=p.slice(m).map(h.to),x=p.invert().map(b,-1),w=p.invert().map(k),C=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(E=>E.eq(h.mark)),v=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(E=>E.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:x,to:w},newRange:{from:b,to:k},partial:!!(v||C),editor:this.editor,transaction:n,combinedTransform:u})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Hw=me.create({name:"drop",addProseMirrorPlugins(){return[new ce({key:new le("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),Fw=me.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),jw=new le("focusEvents"),Uw=me.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ce({key:jw,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),Ww=me.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:d}=l,{empty:u,$anchor:f}=a,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:ie.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ui()||Tp()?i:r},addProseMirrorPlugins(){return[new ce({key:new le("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const o=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),r=n.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,a=ie.atStart(e.doc).from,d=ie.atEnd(e.doc).to;if(i||!(s===a&&l===d)||!xl(t.doc))return;const p=t.tr,h=fl({state:t,transaction:p}),{commands:m}=new pl({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),qw=me.create({name:"paste",addProseMirrorPlugins(){return[new ce({key:new le("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Kw=me.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Jw=me.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=fi(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ce({key:new le("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),Gw=class Va{constructor(e,t,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,o=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:t,to:o},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Va(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Va(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Va(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,o)=>{const r=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,s=t.isInline,l=this.pos+o+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!r&&!s&&a.depth<=this.depth)return;const d=new Va(a,this.editor,r,r||s?t:null);r&&(d.actualDepth=this.depth+1),e.push(d)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(t).length>0){const i=r.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==t[a])break}}else o=r;r=r.parent}return o}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(t);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(a=>t[a]===s.node.attrs[a])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,t,o))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},PB=`.ProseMirror {
19
- position: relative;
20
- }
21
-
22
- .ProseMirror {
23
- word-wrap: break-word;
24
- white-space: pre-wrap;
25
- white-space: break-spaces;
26
- -webkit-font-variant-ligatures: none;
27
- font-variant-ligatures: none;
28
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
29
- }
30
-
31
- .ProseMirror [contenteditable="false"] {
32
- white-space: normal;
33
- }
34
-
35
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
36
- white-space: pre-wrap;
37
- }
38
-
39
- .ProseMirror pre {
40
- white-space: pre-wrap;
41
- }
42
-
43
- img.ProseMirror-separator {
44
- display: inline !important;
45
- border: none !important;
46
- margin: 0 !important;
47
- width: 0 !important;
48
- height: 0 !important;
49
- }
50
-
51
- .ProseMirror-gapcursor {
52
- display: none;
53
- pointer-events: none;
54
- position: absolute;
55
- margin: 0;
56
- }
57
-
58
- .ProseMirror-gapcursor:after {
59
- content: "";
60
- display: block;
61
- position: absolute;
62
- top: -2px;
63
- width: 20px;
64
- border-top: 1px solid black;
65
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
66
- }
67
-
68
- @keyframes ProseMirror-cursor-blink {
69
- to {
70
- visibility: hidden;
71
- }
72
- }
73
-
74
- .ProseMirror-hideselection *::selection {
75
- background: transparent;
76
- }
77
-
78
- .ProseMirror-hideselection *::-moz-selection {
79
- background: transparent;
80
- }
81
-
82
- .ProseMirror-hideselection * {
83
- caret-color: transparent;
84
- }
85
-
86
- .ProseMirror-focused .ProseMirror-gapcursor {
87
- display: block;
88
- }`;function Xw(n,e,t){const o=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r),r}var St=class extends BB{constructor(e={}){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,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Fp,createMappablePosition:$w},this.setOptions(e),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:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const t=this.createDoc(),o=Mp(t,this.options.autofocus);this.editorState=Gi.create({doc:t,schema:this.schema,selection:o||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),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){const e=this.editorView.dom;e!=null&&e.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=Xw(PB,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const o=$p(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let o=t;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(s))}),t.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[Fw,Pw.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Vw,Uw,Ww,Kw,Hw,qw,zw,Jw.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new Bc(r,this)}createCommandManager(){this.commandManager=new pl({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=gc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=gc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:o}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=o?this.extensionManager.dispatchTransaction(r):r,s=t.transformPastedHTML,l=this.extensionManager.transformPastedHTML(s);this.editorView=new sw(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const d=this.view.dom;d.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:o}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=o.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:o.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=o.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=l==null?void 0:l.getMeta("focus"),d=l==null?void 0:l.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(u=>u.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return Lp(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return Pp(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return bl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
89
-
90
- `,textSerializers:o={}}=e||{};return Sc(this.state.doc,{blockSeparator:t,textSerializers:{...kl(this.schema),...o}})}get isEmpty(){return xl(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,t))||null}$nodes(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Gw(t,this)}get $doc(){return this.$pos(0)}};function Er(n){return new vr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=Re(n.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const a=l.search(/\S/),d=t.from+l.indexOf(s),u=d+s.length;if(Ec(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&i.delete(u,t.to),d>t.from&&i.delete(t.from+a,d);const p=t.from+a+s.length;i.addMark(t.from+a,p,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function cs(n){return new vr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=Re(n.getAttributes,void 0,o)||{},{tr:i}=e,s=t.from;let l=t.to;const a=n.type.create(r);if(o[1]){const d=o[0].lastIndexOf(o[1]);let u=s+d;u>l?u=l:l=u+o[1].length;const f=o[0][o[0].length-1];i.insertText(f,s+o[0].length-1),i.replaceWith(u,l,a)}else if(o[0]){const d=n.type.isInline?s:s-1;i.insert(d,n.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:n.undoable})}function Rc(n){return new vr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=e.doc.resolve(t.from),i=Re(n.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function rt(n){return new vr({find:n.find,handler:({state:e,range:t,match:o})=>{let r=n.replace,i=t.from;const s=t.to;if(o[1]){const l=o[0].lastIndexOf(o[1]);r+=o[0].slice(l+o[1].length),i+=l;const a=i-s;a>0&&(r=o[0].slice(l-a,l)+r,i=s)}e.tr.insertText(r,i,s)},undoable:n.undoable})}function Ho(n){return new vr({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=Re(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),d=a&&Lf(a,n.type,i);if(!d)return null;if(s.wrap(a,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));s.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&pr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&s.join(t.from-1)},undoable:n.undoable})}function VB(n){return n.children}var Yw=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},zB=n=>"touches"in n,Dc=class{constructor(n){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;const a=l.clientX-this.startX,d=l.clientY-this.startY;this.handleResize(a,d)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const d=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(d,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;const 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.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,t,o,r,i,s;this.node=n.node,this.editor=n.editor,this.element=n.element,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,(e=n.options)!=null&&e.min&&(this.minSize={...this.minSize,...n.options.min}),(t=n.options)!=null&&t.max&&(this.maxSize=n.options.max),(o=n==null?void 0:n.options)!=null&&o.directions&&(this.directions=n.options.directions),(r=n.options)!=null&&r.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),(i=n.options)!=null&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),(s=n.options)!=null&&s.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var n;return(n=this.contentElement)!=null?n:null}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display="flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),o=e.includes("bottom"),r=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),o&&(n.style.bottom="0"),r&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,zB(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:o,height:r}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(o,r,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let o=this.startWidth,r=this.startHeight;const i=n.includes("right"),s=n.includes("left"),l=n.includes("bottom"),a=n.includes("top");return i?o=this.startWidth+e:s&&(o=this.startWidth-e),l?r=this.startHeight+t:a&&(r=this.startHeight-t),(n==="right"||n==="left")&&(o=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(r=this.startHeight+(l?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(o,r,n):{width:o,height:r}}applyConstraints(n,e,t){var o,r,i,s;if(!t){let d=Math.max(this.minSize.width,n),u=Math.max(this.minSize.height,e);return(o=this.maxSize)!=null&&o.width&&(d=Math.min(this.maxSize.width,d)),(r=this.maxSize)!=null&&r.height&&(u=Math.min(this.maxSize.height,u)),{width:d,height:u}}let l=n,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(s=this.maxSize)!=null&&s.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(n,e,t){const o=t==="left"||t==="right",r=t==="top"||t==="bottom";return o?{width:n,height:n/this.aspectRatio}:r?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}},HB=Dc;function Qw(n,e){const{selection:t}=n,{$from:o}=t;if(t instanceof Q){const i=o.index();return o.parent.canReplaceWith(i,i+1,e)}let r=o.depth;for(;r>=0;){const i=o.index(r);if(o.node(r).contentMatchAt(i).matchType(e))return!0;r-=1}return!1}function Kp(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function FB(){return typeof navigator<"u"?/Firefox/.test(navigator.userAgent):!1}function jB(n){return typeof n=="string"}var Zw={};vp(Zw,{createAtomBlockMarkdownSpec:()=>e0,createBlockMarkdownSpec:()=>Sl,createInlineMarkdownSpec:()=>Jp,parseAttributes:()=>_c,parseIndentedBlocks:()=>Lc,renderNestedMarkdownContent:()=>Pc,serializeAttributes:()=>Ic});function _c(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const d=r.map(u=>u.trim().slice(1));e.class=d.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[d]=h.slice(1,-1))});const a=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Ic(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function e0(n){const{nodeName:e,name:t,parseAttributes:o=_c,serializeAttributes:r=Ic,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...i,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!s.find(k=>!(k in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function Sl(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=_c,serializeAttributes:i=Ic,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,d=t||e,u=f=>{if(!a)return f;const p={};return a.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,k=""]=y,x=r(k);let w=1;const C=b.length;let v="";const E=/^:::([\w-]*)(\s.*)?/gm,T=f.slice(C);for(E.lastIndex=0;;){const A=E.exec(T);if(A===null)break;const $=A.index,O=A[1];if(!((m=A[2])!=null&&m.endsWith(":::"))){if(O)w+=1;else if(w-=1,w===0){const B=T.slice(0,$);v=B.trim();const _=f.slice(0,C+$+A[0].length);let D=[];if(v)if(l==="block")for(D=h.blockTokens(B),D.forEach(P=>{P.text&&(!P.tokens||P.tokens.length===0)&&(P.tokens=h.inlineTokens(P.text))});D.length>0;){const P=D[D.length-1];if(P.type==="paragraph"&&(!P.text||P.text.trim()===""))D.pop();else break}else D=h.inlineTokens(v);return{type:e,raw:_,attributes:x,content:v,tokens:D}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
91
-
92
- `);return`:::${d}${g}
93
-
94
- ${y}
95
-
96
- :::`}}}function UB(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=t.exec(n)}return e}function WB(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function Jp(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=UB,serializeAttributes:i=WB,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,d=t||e,u=p=>{if(!a)return p;const h={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const b=p[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",k="";if(l){const[,w]=y;k=w}else{const[,w,C]=y;k=w,b=C||""}const x=r(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:x}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=u(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function Lc(n,e,t){var o,r,i,s;const l=n.split(`
97
- `),a=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<l.length;){const p=l[u],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){u+=1,d=`${d}${p}
98
- `;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;d=`${d}${p}
99
- `;const b=[y];for(u+=1;u<l.length;){const C=l[u];if(C.trim()===""){const E=l.slice(u+1).findIndex($=>$.trim()!=="");if(E===-1)break;if((((r=(o=l[u+1+E].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(C),d=`${d}${C}
100
- `,u+=1;continue}else break}if((((s=(i=C.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(C),d=`${d}${C}
101
- `,u+=1;else break}let k;const x=b.slice(1);if(x.length>0){const C=x.map(v=>v.slice(g+f)).join(`
102
- `);C.trim()&&(e.customNestedParser?k=e.customNestedParser(C):k=t.blockTokens(C))}const w=e.createToken(m,k);a.push(w)}if(a.length!==0)return{items:a,raw:d}}function Pc(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...s]=n.content,l=e.renderChildren([i]),a=[`${r}${l}`];return s&&s.length>0&&s.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
103
- `).map(p=>p?e.indent(p):"").join(`
104
- `);a.push(f)}}),a.join(`
105
- `)}function Gp(n,e,t={}){const{state:o}=e,{doc:r,tr:i}=o,s=n;r.descendants((l,a)=>{const d=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize;let f=null;if(l.marks.forEach(h=>{if(h!==s)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});i.removeMark(d,u,n.type),i.addMark(d,u,h)}}),i.docChanged&&e.view.dispatch(i)}var qB=class{constructor(n,e,t){this.component=n,this.editor=e.editor,this.options={...t},this.mark=e.mark,this.HTMLAttributes=e.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(n,e){Gp(e||this.mark,this.editor,n)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(ui()||gl())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}},Oe=class tN extends Ac{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new tN(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},t0=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t,o,r,i,s,l;const{view:a}=this.editor,d=n.target,u=d.nodeType===3?(e=d.parentElement)==null?void 0:e.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(d)||!u)return;let f=0,p=0;if(this.dom!==u){const k=this.dom.getBoundingClientRect(),x=u.getBoundingClientRect(),w=(r=n.offsetX)!=null?r:(o=n.nativeEvent)==null?void 0:o.offsetX,C=(s=n.offsetY)!=null?s:(i=n.nativeEvent)==null?void 0:i.offsetY;f=x.x-k.x+w,p=x.y-k.y+C}const h=this.dom.cloneNode(!0);try{const k=this.dom.getBoundingClientRect();h.style.width=`${Math.round(k.width)}px`,h.style.height=`${Math.round(k.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(h),document.body.appendChild(m),(l=n.dataTransfer)==null||l.setDragImage(h,f,p)}finally{m&&setTimeout(()=>{try{m==null||m.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=Q.create(a.state.doc,g),b=a.state.tr.setSelection(y);a.dispatch(b)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const r=n.type.startsWith("drag"),i=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!i&&!r)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,d=!!this.node.type.spec.draggable,u=Q.isSelectable(this.node),f=n.type==="copy",p=n.type==="paste",h=n.type==="cut",m=n.type==="mousedown";if(!d&&u&&r&&n.target===this.dom&&n.preventDefault(),d&&r&&!a&&n.target===this.dom)return n.preventDefault(),!1;if(d&&l&&!a&&m){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||f||p||h||m&&u)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(ui()||gl())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function Fo(n){return new Oc({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:r})=>{const i=Re(n.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],a=o[0];let d=t.to;if(l){const u=a.search(/\S/),f=t.from+a.indexOf(l),p=f+l.length;if(Ec(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&s.delete(p,t.to),f>t.from&&s.delete(t.from+u,f),d=t.from+u+l.length,s.addMark(t.from+u,d,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function KB(n){return new Oc({find:n.find,handler({match:e,chain:t,range:o,pasteEvent:r}){const i=Re(n.getAttributes,void 0,e,r),s=Re(n.getContent,void 0,i);if(i===!1||i===null)return null;const l={type:n.type.name,attrs:i};s&&(l.content=s),e.input&&t().deleteRange(o).insertContentAt(o.from,l)}})}function JB(n){return new Oc({find:n.find,handler:({state:e,range:t,match:o})=>{let r=n.replace,i=t.from;const s=t.to;if(o[1]){const l=o[0].lastIndexOf(o[1]);r+=o[0].slice(l+o[1].length),i+=l;const a=i-s;a>0&&(r=o[0].slice(l-a,l)+r,i=s)}e.tr.insertText(r,i,s)}})}var GB=class{constructor(n){this.transaction=n,this.currentStep=this.transaction.steps.length}map(n){let e=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((o,r)=>{const i=r.getMap().mapResult(o);return i.deleted&&(e=!0),i.pos},n),deleted:e}}};function n0(n){return c.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var o0=class extends St{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=n0(this.view.state),this.reactiveExtensionStorage=n0(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),c.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},XB=c.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=c.ref(),t=c.getCurrentInstance();return c.watchEffect(()=>{const o=n.editor;o&&o.options.element&&e.value&&c.nextTick(()=>{var r;if(!e.value||!((r=o.view.dom)!=null&&r.parentNode))return;const i=c.unref(e.value);e.value.append(...o.view.dom.parentNode.childNodes),o.contentComponent=t.ctx._,t&&(o.appContext={...t.appContext,provides:t.provides}),o.setOptions({element:i}),o.createNodeViews()})}),c.onBeforeUnmount(()=>{const o=n.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return c.h("div",{ref:n=>{this.rootEl=n}})}}),jo=c.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return c.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Xp=c.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return c.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}}),YB=(n={})=>{const e=c.shallowRef();return c.onMounted(()=>{e.value=new o0(n)}),c.onBeforeUnmount(()=>{var t,o,r,i;const s=(o=(t=e.value)==null?void 0:t.view.dom)==null?void 0:o.parentNode,l=s==null?void 0:s.cloneNode(!0);(r=s==null?void 0:s.parentNode)==null||r.replaceChild(l,s),(i=e.value)==null||i.destroy()}),e},Vc=class{constructor(n,{props:e={},editor:t}){this.destroyed=!1,this.editor=t,this.component=c.markRaw(n),this.el=document.createElement("div"),this.props=c.reactive(e),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var n,e,t,o;return(e=(n=this.renderedComponent.vNode)==null?void 0:n.component)!=null&&e.exposed?this.renderedComponent.vNode.component.exposed:(o=(t=this.renderedComponent.vNode)==null?void 0:t.component)==null?void 0:o.proxy}renderComponent(){if(this.destroyed)return this.renderedComponent;let n=c.h(this.component,this.props);return this.editor.appContext&&(n.appContext=this.editor.appContext),typeof document<"u"&&this.el&&c.render(n,this.el),{vNode:n,destroy:()=>{this.el&&c.render(null,this.el),this.el=null,n=null},el:this.el?this.el.firstElementChild:null}}updateProps(n={}){this.destroyed||(Object.entries(n).forEach(([e,t])=>{this.props[e]=t}),this.renderComponent())}destroy(){this.destroyed||(this.destroyed=!0,this.renderedComponent.destroy())}};c.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return c.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var ut={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}},QB=class extends t0{constructor(){super(...arguments),this.cachedExtensionWithSyncedStorage=null}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const n=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(t,o,r){var i;return o==="storage"?(i=n.storage[e.name])!=null?i:{}:Reflect.get(t,o,r)}})}return this.cachedExtensionWithSyncedStorage}mount(){const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},e=this.onDragStart.bind(this);this.decorationClasses=c.ref(this.getDecorationClasses());const t=c.defineComponent({extends:{...this.component},props:Object.keys(n),template:this.component.template,setup:o=>{var r,i;return c.provide("onDragStart",e),c.provide("decorationClasses",this.decorationClasses),(i=(r=this.component).setup)==null?void 0:i.call(r,o,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new Vc(t,{editor:this.editor,props:n})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:n,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(n<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(n,e,t){const o=r=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(r)};if(typeof this.options.update=="function"){const r=this.node,i=this.decorations,s=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:r,oldDecorations:i,newNode:n,newDecorations:e,oldInnerDecorations:s,innerDecorations:t,updateProps:()=>o({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})})}return n.type!==this.node.type?!1:(n===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=n,this.decorations=e,this.innerDecorations=t,o({node:n,decorations:e,innerDecorations:t,extension:this.extensionWithSyncedStorage})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(n=>n.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}};function un(n,e){return t=>{if(!t.editor.contentComponent)return{};const o=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new QB(o,t,e)}}var zc=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},ZB=/^\s*>\s$/,eR=Oe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return zc("blockquote",{...fe(this.options.HTMLAttributes,n),children:zc("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",o=[];return n.content.forEach(r=>{const l=e.renderChildren([r]).split(`
106
- `).map(a=>a.trim()===""?t:`${t} ${a}`);o.push(l.join(`
107
- `))}),o.join(`
108
- ${t}
109
- `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ho({find:ZB,type:this.type})]}}),tR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,nR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,oR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,rR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,iR=In.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return zc("strong",{...fe(this.options.HTMLAttributes,n),children:zc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Er({find:tR,type:this.type}),Er({find:oR,type:this.type})]},addPasteRules(){return[Fo({find:nR,type:this.type}),Fo({find:rR,type:this.type})]}}),sR=/(^|[^`])`([^`]+)`(?!`)$/,lR=/(^|[^`])`([^`]+)`(?!`)/g,aR=In.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Er({find:sR,type:this.type})]},addPasteRules(){return[Fo({find:lR,type:this.type})]}}),Yp=4,cR=/^```([a-z]+)?[\s\n]$/,dR=/^~~~([a-z]+)?[\s\n]$/,r0=Oe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Yp,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const i=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",fe(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let o="";const r=((t=n.attrs)==null?void 0:t.language)||"";return n.content?o=[`\`\`\`${r}`,e.renderChildren(n.content),"```"].join(`
110
- `):o=`\`\`\`${r}
111
-
112
- \`\`\``,o},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Yp,{state:o}=n,{selection:r}=o,{$from:i,empty:s}=r;if(i.parent.type!==this.type)return!1;const l=" ".repeat(t);return s?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:d,to:u}=r,h=o.doc.textBetween(d,u,`
113
- `,`
114
- `).split(`
115
- `).map(m=>l+m).join(`
116
- `);return a.replaceWith(d,u,o.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Yp,{state:o}=n,{selection:r}=o,{$from:i,empty:s}=r;return i.parent.type!==this.type?!1:s?n.commands.command(({tr:l})=>{var a;const{pos:d}=i,u=i.start(),f=i.end(),h=o.doc.textBetween(u,f,`
117
- `,`
118
- `).split(`
119
- `);let m=0,g=0;const y=d-u;for(let v=0;v<h.length;v+=1){if(g+h[v].length>=y){m=v;break}g+=h[v].length+1}const k=((a=h[m].match(/^ */))==null?void 0:a[0])||"",x=Math.min(k.length,t);if(x===0)return!0;let w=u;for(let v=0;v<m;v+=1)w+=h[v].length+1;return l.delete(w,w+x),d-w<=x&&l.setSelection(q.create(l.doc,w)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:d}=r,p=o.doc.textBetween(a,d,`
120
- `,`
121
- `).split(`
122
- `).map(h=>{var m;const g=((m=h.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,t);return h.slice(y)}).join(`
123
- `);return l.replaceWith(a,d,o.schema.text(p)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:o,empty:r}=t;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
124
-
125
- `);return!i||!s?!1:n.chain().command(({tr:l})=>(l.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:o}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:o.nodeAt(l)?n.commands.command(({tr:d})=>(d.setSelection(ie.near(o.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Rc({find:cR,type:this.type,getAttributes:n=>({language:n[1]})}),Rc({find:dR,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ce({key:new le("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!t||!i)return!1;const{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
126
- `));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(q.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),i0=Oe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
127
-
128
- `):""}),Qp=i0,uR=Oe.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",fe(this.options.HTMLAttributes,n)]},renderText(){return`
129
- `},renderMarkdown:()=>`
130
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:o})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:r,storedMarks:i}=t;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,a=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&a&&s){const f=a.filter(p=>l.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),fR=Oe.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,fe(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const o=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,r="#".repeat(o);return n.content?`${r} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Rc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),s0=Oe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",fe(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!Qw(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:o}=t,r=n();return Hp(t)?r.insertContentAt(o.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,d=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(q.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(Q.create(s.doc,a.pos)):s.setSelection(q.create(s.doc,a.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=u==null?void 0:u.create();f&&(s.insert(d,f),s.setSelection(q.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[cs({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),pR=s0,hR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,mR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,gR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,yR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,bR=In.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Er({find:hR,type:this.type}),Er({find:gR,type:this.type})]},addPasteRules(){return[Fo({find:mR,type:this.type}),Fo({find:yR,type:this.type})]}});const kR="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",wR="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Zp="numeric",eh="ascii",th="alpha",vl="asciinumeric",El="alphanumeric",nh="domain",l0="emoji",xR="scheme",CR="slashscheme",oh="whitespace";function SR(n,e){return n in e||(e[n]=[]),e[n]}function pi(n,e,t){e[Zp]&&(e[vl]=!0,e[El]=!0),e[eh]&&(e[vl]=!0,e[th]=!0),e[vl]&&(e[El]=!0),e[th]&&(e[El]=!0),e[El]&&(e[nh]=!0),e[l0]&&(e[nh]=!0);for(const o in e){const r=SR(o,t);r.indexOf(n)<0&&r.push(n)}}function vR(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function fn(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}fn.groups={},fn.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,o){for(let r=0;r<n.length;r++)this.tt(n[r],e,t,o)},tr(n,e,t,o){o=o||fn.groups;let r;return e&&e.j?r=e:(r=new fn(e),t&&o&&pi(e,t,o)),this.jr.push([n,r]),r},ts(n,e,t,o){let r=this;const i=n.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(n[s]);return r.tt(n[i-1],e,t,o)},tt(n,e,t,o){o=o||fn.groups;const r=this;if(e&&e.j)return r.j[n]=e,e;const i=e;let s,l=r.go(n);if(l?(s=new fn,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new fn,i){if(o)if(s.t&&typeof s.t=="string"){const a=Object.assign(vR(s.t,o),t);pi(i,a,o)}else t&&pi(i,t,o);s.t=i}return r.j[n]=s,s}};const ve=(n,e,t,o,r)=>n.ta(e,t,o,r),st=(n,e,t,o,r)=>n.tr(e,t,o,r),a0=(n,e,t,o,r)=>n.ts(e,t,o,r),z=(n,e,t,o,r)=>n.tt(e,t,o,r),Uo="WORD",rh="UWORD",c0="ASCIINUMERICAL",d0="ALPHANUMERICAL",Ml="LOCALHOST",ih="TLD",sh="UTLD",Hc="SCHEME",ds="SLASH_SCHEME",lh="NUM",ah="WS",ch="NL",Tl="OPENBRACE",Nl="CLOSEBRACE",Fc="OPENBRACKET",jc="CLOSEBRACKET",Uc="OPENPAREN",Wc="CLOSEPAREN",qc="OPENANGLEBRACKET",Kc="CLOSEANGLEBRACKET",Jc="FULLWIDTHLEFTPAREN",Gc="FULLWIDTHRIGHTPAREN",Xc="LEFTCORNERBRACKET",Yc="RIGHTCORNERBRACKET",Qc="LEFTWHITECORNERBRACKET",Zc="RIGHTWHITECORNERBRACKET",ed="FULLWIDTHLESSTHAN",td="FULLWIDTHGREATERTHAN",nd="AMPERSAND",od="APOSTROPHE",rd="ASTERISK",Mr="AT",id="BACKSLASH",sd="BACKTICK",ld="CARET",Tr="COLON",dh="COMMA",ad="DOLLAR",po="DOT",cd="EQUALS",uh="EXCLAMATION",Ln="HYPHEN",Al="PERCENT",dd="PIPE",ud="PLUS",fd="POUND",Ol="QUERY",fh="QUOTE",u0="FULLWIDTHMIDDLEDOT",ph="SEMI",ho="SLASH",$l="TILDE",pd="UNDERSCORE",f0="EMOJI",hd="SYM";var p0=Object.freeze({__proto__:null,ALPHANUMERICAL:d0,AMPERSAND:nd,APOSTROPHE:od,ASCIINUMERICAL:c0,ASTERISK:rd,AT:Mr,BACKSLASH:id,BACKTICK:sd,CARET:ld,CLOSEANGLEBRACKET:Kc,CLOSEBRACE:Nl,CLOSEBRACKET:jc,CLOSEPAREN:Wc,COLON:Tr,COMMA:dh,DOLLAR:ad,DOT:po,EMOJI:f0,EQUALS:cd,EXCLAMATION:uh,FULLWIDTHGREATERTHAN:td,FULLWIDTHLEFTPAREN:Jc,FULLWIDTHLESSTHAN:ed,FULLWIDTHMIDDLEDOT:u0,FULLWIDTHRIGHTPAREN:Gc,HYPHEN:Ln,LEFTCORNERBRACKET:Xc,LEFTWHITECORNERBRACKET:Qc,LOCALHOST:Ml,NL:ch,NUM:lh,OPENANGLEBRACKET:qc,OPENBRACE:Tl,OPENBRACKET:Fc,OPENPAREN:Uc,PERCENT:Al,PIPE:dd,PLUS:ud,POUND:fd,QUERY:Ol,QUOTE:fh,RIGHTCORNERBRACKET:Yc,RIGHTWHITECORNERBRACKET:Zc,SCHEME:Hc,SEMI:ph,SLASH:ho,SLASH_SCHEME:ds,SYM:hd,TILDE:$l,TLD:ih,UNDERSCORE:pd,UTLD:sh,UWORD:rh,WORD:Uo,WS:ah});const Wo=/[a-z]/,Bl=new RegExp("\\p{L}","u"),hh=new RegExp("\\p{Emoji}","u"),qo=/\d/,mh=/\s/,h0="\r",gh=`
131
- `,ER="️",MR="‍",yh="";let md=null,gd=null;function TR(n=[]){const e={};fn.groups=e;const t=new fn;md==null&&(md=g0(kR)),gd==null&&(gd=g0(wR)),z(t,"'",od),z(t,"{",Tl),z(t,"}",Nl),z(t,"[",Fc),z(t,"]",jc),z(t,"(",Uc),z(t,")",Wc),z(t,"<",qc),z(t,">",Kc),z(t,"(",Jc),z(t,")",Gc),z(t,"「",Xc),z(t,"」",Yc),z(t,"『",Qc),z(t,"』",Zc),z(t,"<",ed),z(t,">",td),z(t,"&",nd),z(t,"*",rd),z(t,"@",Mr),z(t,"`",sd),z(t,"^",ld),z(t,":",Tr),z(t,",",dh),z(t,"$",ad),z(t,".",po),z(t,"=",cd),z(t,"!",uh),z(t,"-",Ln),z(t,"%",Al),z(t,"|",dd),z(t,"+",ud),z(t,"#",fd),z(t,"?",Ol),z(t,'"',fh),z(t,"/",ho),z(t,";",ph),z(t,"~",$l),z(t,"_",pd),z(t,"\\",id),z(t,"・",u0);const o=st(t,qo,lh,{[Zp]:!0});st(o,qo,o);const r=st(o,Wo,c0,{[vl]:!0}),i=st(o,Bl,d0,{[El]:!0}),s=st(t,Wo,Uo,{[eh]:!0});st(s,qo,r),st(s,Wo,s),st(r,qo,r),st(r,Wo,r);const l=st(t,Bl,rh,{[th]:!0});st(l,Wo),st(l,qo,i),st(l,Bl,l),st(i,qo,i),st(i,Wo),st(i,Bl,i);const a=z(t,gh,ch,{[oh]:!0}),d=z(t,h0,ah,{[oh]:!0}),u=st(t,mh,ah,{[oh]:!0});z(t,yh,u),z(d,gh,a),z(d,yh,u),st(d,mh,u),z(u,h0),z(u,gh),st(u,mh,u),z(u,yh,u);const f=st(t,hh,f0,{[l0]:!0});z(f,"#"),st(f,hh,f),z(f,ER,f);const p=z(f,MR);z(p,"#"),st(p,hh,f);const h=[[Wo,s],[qo,r]],m=[[Wo,null],[Bl,l],[qo,i]];for(let g=0;g<md.length;g++)Nr(t,md[g],ih,Uo,h);for(let g=0;g<gd.length;g++)Nr(t,gd[g],sh,rh,m);pi(ih,{tld:!0,ascii:!0},e),pi(sh,{utld:!0,alpha:!0},e),Nr(t,"file",Hc,Uo,h),Nr(t,"mailto",Hc,Uo,h),Nr(t,"http",ds,Uo,h),Nr(t,"https",ds,Uo,h),Nr(t,"ftp",ds,Uo,h),Nr(t,"ftps",ds,Uo,h),pi(Hc,{scheme:!0,ascii:!0},e),pi(ds,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[xR]:!0}:{[CR]:!0};y.indexOf("-")>=0?k[nh]=!0:Wo.test(y)?qo.test(y)?k[vl]=!0:k[eh]=!0:k[Zp]=!0,a0(t,y,y,k)}return a0(t,"localhost",Ml,{ascii:!0}),t.jd=new fn(hd),{start:t,tokens:Object.assign({groups:e},p0)}}function m0(n,e){const t=NR(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=t.length,r=[];let i=0,s=0;for(;s<o;){let l=n,a=null,d=0,u=null,f=-1,p=-1;for(;s<o&&(a=l.go(t[s]));)l=a,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=t[s].length,p++),d+=t[s].length,i+=t[s].length,s++;i-=f,s-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function NR(n){const e=[],t=n.length;let o=0;for(;o<t;){let r=n.charCodeAt(o),i,s=r<55296||r>56319||o+1===t||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);e.push(s),o+=s.length}return e}function Nr(n,e,t,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?i=n.j[a]:(i=new fn(o),i.jr=r.slice(),n.j[a]=i),n=i}return i=new fn(t),i.jr=r.slice(),n.j[e[s-1]]=i,i}function g0(n){const e=[],t=[];let o=0,r="0123456789";for(;o<n.length;){let i=0;for(;r.indexOf(n[o+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(o,o+i),10);s>0;s--)t.pop();o+=i}else t.push(n[o]),o++}return e}const Rl={defaultProtocol:"http",events:null,format:y0,formatHref:y0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function bh(n,e=null){let t=Object.assign({},Rl);n&&(t=Object.assign(t,n instanceof bh?n.o:n));const o=t.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=r}bh.prototype={o:Rl,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const o=e!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=t.t in r?r[t.t]:Rl[n],typeof r=="function"&&o&&(r=r(e,t))):typeof r=="function"&&o&&(r=r(e,t.t,t)),r)},getObj(n,e,t){let o=this.o[n];return typeof o=="function"&&e!=null&&(o=o(e,t.t,t)),o},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function y0(n){return n}function b0(n,e){this.t="token",this.v=n,this.tk=e}b0.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),o=n.get("format",e,this);return t&&o.length>t?o.substring(0,t)+"…":o},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=Rl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),o=n.get("formatHref",t,this),r=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=o,l&&(s.class=l),a&&(s.target=a),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:r,attributes:s,content:i,eventListeners:f}}};function yd(n,e){class t extends b0{constructor(r,i){super(r,i),this.t=n}}for(const o in e)t.prototype[o]=e[o];return t.t=n,t}const k0=yd("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),w0=yd("text"),AR=yd("nl"),bd=yd("url",{isLink:!0,toHref(n=Rl.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Ml&&n[1].t===Tr}}),Pn=n=>new fn(n);function OR({groups:n}){const e=n.domain.concat([nd,rd,Mr,id,sd,ld,ad,cd,Ln,lh,Al,dd,ud,fd,ho,hd,$l,pd]),t=[od,Tr,dh,po,uh,Al,Ol,fh,ph,qc,Kc,Tl,Nl,jc,Fc,Uc,Wc,Jc,Gc,Xc,Yc,Qc,Zc,ed,td],o=[nd,od,rd,id,sd,ld,ad,cd,Ln,Tl,Nl,Al,dd,ud,fd,Ol,ho,hd,$l,pd],r=Pn(),i=z(r,$l);ve(i,o,i),ve(i,n.domain,i);const s=Pn(),l=Pn(),a=Pn();ve(r,n.domain,s),ve(r,n.scheme,l),ve(r,n.slashscheme,a),ve(s,o,i),ve(s,n.domain,s);const d=z(s,Mr);z(i,Mr,d),z(l,Mr,d),z(a,Mr,d);const u=z(i,po);ve(u,o,i),ve(u,n.domain,i);const f=Pn();ve(d,n.domain,f),ve(f,n.domain,f);const p=z(f,po);ve(p,n.domain,f);const h=Pn(k0);ve(p,n.tld,h),ve(p,n.utld,h),z(d,Ml,h);const m=z(f,Ln);z(m,Ln,m),ve(m,n.domain,f),ve(h,n.domain,f),z(h,po,p),z(h,Ln,m);const g=z(h,Tr);ve(g,n.numeric,k0);const y=z(s,Ln),b=z(s,po);z(y,Ln,y),ve(y,n.domain,s),ve(b,o,i),ve(b,n.domain,s);const k=Pn(bd);ve(b,n.tld,k),ve(b,n.utld,k),ve(k,n.domain,s),ve(k,o,i),z(k,po,b),z(k,Ln,y),z(k,Mr,d);const x=z(k,Tr),w=Pn(bd);ve(x,n.numeric,w);const C=Pn(bd),v=Pn();ve(C,e,C),ve(C,t,v),ve(v,e,C),ve(v,t,v),z(k,ho,C),z(w,ho,C);const E=z(l,Tr),T=z(a,Tr),A=z(T,ho),$=z(A,ho);ve(l,n.domain,s),z(l,po,b),z(l,Ln,y),ve(a,n.domain,s),z(a,po,b),z(a,Ln,y),ve(E,n.domain,C),z(E,ho,C),z(E,Ol,C),ve($,n.domain,C),ve($,e,C),z($,ho,C);const O=[[Tl,Nl],[Fc,jc],[Uc,Wc],[qc,Kc],[Jc,Gc],[Xc,Yc],[Qc,Zc],[ed,td]];for(let B=0;B<O.length;B++){const[_,D]=O[B],P=z(C,_);z(v,_,P),z(P,D,C);const R=Pn(bd);ve(P,e,R);const K=Pn();ve(P,t),ve(R,e,R),ve(R,t,K),ve(K,e,R),ve(K,t,K),z(R,D,C),z(K,D,C)}return z(r,Ml,k),z(r,ch,AR),{start:r,tokens:p0}}function $R(n,e,t){let o=t.length,r=0,i=[],s=[];for(;r<o;){let l=n,a=null,d=null,u=0,f=null,p=-1;for(;r<o&&!(a=l.go(t[r].t));)s.push(t[r++]);for(;r<o&&(d=a||l.go(t[r].t));)a=null,l=d,l.accepts()?(p=0,f=l):p>=0&&p++,r++,u++;if(p<0)r-=u,r<o&&(s.push(t[r]),r++);else{s.length>0&&(i.push(kh(w0,e,s)),s=[]),r-=p,u-=p;const h=f.t,m=t.slice(r-u,r);i.push(kh(h,e,m))}}return s.length>0&&i.push(kh(w0,e,s)),i}function kh(n,e,t){const o=t[0].s,r=t[t.length-1].e,i=e.slice(o,r);return new n(i,t)}const BR=typeof console<"u"&&console&&console.warn||(()=>{}),RR="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ze={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function DR(){return fn.groups={},Ze.scanner=null,Ze.parser=null,Ze.tokenQueue=[],Ze.pluginQueue=[],Ze.customSchemes=[],Ze.initialized=!1,Ze}function x0(n,e=!1){if(Ze.initialized&&BR(`linkifyjs: already initialized - will not register custom scheme "${n}" ${RR}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
132
- 1. Must only contain digits, lowercase ASCII letters or "-"
133
- 2. Cannot start or end with "-"
134
- 3. "-" cannot repeat`);Ze.customSchemes.push([n,e])}function _R(){Ze.scanner=TR(Ze.customSchemes);for(let n=0;n<Ze.tokenQueue.length;n++)Ze.tokenQueue[n][1]({scanner:Ze.scanner});Ze.parser=OR(Ze.scanner.tokens);for(let n=0;n<Ze.pluginQueue.length;n++)Ze.pluginQueue[n][1]({scanner:Ze.scanner,parser:Ze.parser});return Ze.initialized=!0,Ze}function wh(n){return Ze.initialized||_R(),$R(Ze.parser.start,n,m0(Ze.scanner.start,n))}wh.scan=m0;function C0(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const o=new bh(t),r=wh(n),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var xh="[\0-   ᠎ -\u2029  ]",IR=new RegExp(xh),LR=new RegExp(`${xh}$`),PR=new RegExp(xh,"g");function VR(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function zR(n){return new ce({key:new le("autolink"),appendTransaction:(e,t,o)=>{const r=e.some(d=>d.docChanged)&&!t.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=yc(t.doc,[...e]);if(vc(l).forEach(({newRange:d})=>{const u=Op(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!LR.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(IR).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=wh(m).map(b=>b.toObject(n.defaultProtocol));if(!VR(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>o.schema.marks.code?!o.doc.rangeHasMark(b.from,b.to,o.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Ec(b.from,b.to,o.doc).some(k=>k.mark.type===n.type)||s.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function HR(n){return new ce({key:new le("handleClickLink"),props:{handleClick:(e,t,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=null;if(o.target instanceof HTMLAnchorElement)s=o.target;else{const a=o.target;if(!a)return!1;const d=n.editor.view.dom;s=a.closest("a"),s&&!d.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(n.enableClickSelection&&(l=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const a=Lp(e.state,n.type.name),d=(r=s.href)!=null?r:a.href,u=(i=s.target)!=null?i:a.target;d&&(window.open(d,u),l=!0)}return l}}})}function FR(n){return new ce({key:new le("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:r}=n,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";o.content.forEach(u=>{a+=u.textContent});const d=C0(a,{defaultProtocol:n.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!d||r!==void 0&&!r(d.value)?!1:n.editor.commands.setMark(n.type,{href:d.href})}}})}function hi(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&t.push(r)}),!n||n.replace(PR,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var S0=In.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(n=>{if(typeof n=="string"){x0(n);return}x0(n.scheme,n.optionalSlashes)})},onDestroy(){DR()},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:(n,e)=>!!hi(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!hi(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!hi(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",fe(this.options.HTMLAttributes,n),0]:["a",fe(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t,o,r,i;const s=(o=(t=n.attrs)==null?void 0:t.href)!=null?o:"",l=(i=(r=n.attrs)==null?void 0:r.title)!=null?i:"",a=e.renderChildren(n);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:o=>!!hi(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:o=>!!hi(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Fo({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=C0(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!hi(s,t),protocols:t,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(zR({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!hi(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(HR({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(FR({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Ch=S0,jR=Object.defineProperty,UR=(n,e)=>{for(var t in e)jR(n,t,{get:e[t],enumerable:!0})},WR="listItem",v0="textStyle",E0=/^\s*([-+*])\s$/,M0=Oe.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
135
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(WR,this.editor.getAttributes(v0)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ho({find:E0,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ho({find:E0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(v0),editor:this.editor})),[n]}}),T0=Oe.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(r=>r.type==="paragraph"))t=e.parseChildren(n.tokens);else{const r=n.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(r.tokens)}],n.tokens.length>1){const s=n.tokens.slice(1),l=e.parseChildren(s);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Pc(n,e,o=>{var r,i;return o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${(((i=(r=o.meta)==null?void 0:r.parentAttrs)==null?void 0:i.start)||1)+o.index}. `:"- "},t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),qR={};UR(qR,{findListItemPos:()=>Dl,getNextListDepth:()=>Sh,handleBackspace:()=>vh,handleDelete:()=>Eh,hasListBefore:()=>N0,hasListItemAfter:()=>KR,hasListItemBefore:()=>A0,listItemHasSubList:()=>O0,nextListIsDeeper:()=>$0,nextListIsHigher:()=>B0});var Dl=(n,e)=>{const{$from:t}=e.selection,o=dt(n,e.schema);let r=null,i=t.depth,s=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Sh=(n,e)=>{const t=Dl(n,e);if(!t)return!1;const[,o]=Tw(e,n,t.$pos.pos+4);return o},N0=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},A0=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},O0=(n,e,t)=>{if(!t)return!1;const o=dt(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},vh=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Vo(n.state,e)&&N0(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),d=[];a.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(a.start()+u.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Vo(n.state,e)||!Ow(n.state))return!1;const o=Dl(e,n.state);if(!o)return!1;const i=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),s=O0(e,n.state,i);return A0(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},$0=(n,e)=>{const t=Sh(n,e),o=Dl(n,e);return!o||!t?!1:t>o.depth},B0=(n,e)=>{const t=Sh(n,e),o=Dl(n,e);return!o||!t?!1:t<o.depth},Eh=(n,e)=>{if(!Vo(n.state,e)||!Aw(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:$0(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():B0(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},KR=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},R0=me.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Eh(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Eh(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&vh(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&vh(n,t,o)&&(e=!0)}),e}}}}),D0=/^(\s*)(\d+)\.\s+(.*)$/,JR=/^\s/;function GR(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(D0);if(!i)break;const[,s,l,a]=i,d=s.length;let u=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(D0))break;if(h.trim()==="")p.push(h),u+=`
136
- `,f+=1;else if(h.match(JR))p.push(h),u+=`
137
- ${h.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:p.join(`
138
- `)}),o=f,t=f}return[e,o]}function _0(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const l=s.content.split(`
139
- `),a=((o=l[0])==null?void 0:o.trim())||"",d=[];a&&d.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const u=l.slice(1).join(`
140
- `).trim();if(u){const h=t.blockTokens(u);d.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(g=>g.indent)),m=_0(p,h,t);d.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(g=>g.raw).join(`
141
- `)})}r.push({type:"list_item",raw:s.raw,tokens:d}),i=f}else i+=1}return r}function XR(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var YR="listItem",I0="textStyle",L0=/^(\d+)\.\s$/,P0=Oe.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",fe(this.options.HTMLAttributes,t),0]:["ol",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?XR(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
142
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
143
- `),[i,s]=GR(r);if(i.length===0)return;const l=_0(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
144
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(YR,this.editor.getAttributes(I0)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ho({find:L0,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ho({find:L0,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(I0)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),QR=/^\s*(\[([( |x])?\])\s$/,V0=Oe.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:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",fe(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Pc(n,e,r)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),d=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,s),r.append(i,a),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const p=o.extensionManager.attributes,h=ss(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,b])=>{b==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,b)}),u=m,!0}}}},addInputRules(){return[Ho({find:QR,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Mh=Oe.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:n}){return["ul",fe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
145
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const s=Lc(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:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:o},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(i)},r=Lc(n,{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:t.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});me.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(M0.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(T0.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(R0.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(P0.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(V0.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Mh.configure(this.options.taskList)),n}});var z0="&nbsp;",ZR=" ",eD=Oe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",fe(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];if(t.length===1&&t[0].type==="image")return e.parseChildren([t[0]]);const o=e.parseInline(t);return o.length===1&&o[0].type==="text"&&(o[0].text===z0||o[0].text===ZR)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,o)},renderMarkdown:(n,e)=>{if(!n)return"";const t=Array.isArray(n.content)?n.content:[];return t.length===0?z0:e.renderChildren(t)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),tD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,nD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,oD=In.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",fe(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Er({find:tD,type:this.type})]},addPasteRules(){return[Fo({find:nD,type:this.type})]}}),rD=Oe.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),H0=In.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",fe(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),F0=H0;function iD(n={}){return new ce({view(e){return new sD(e,n)}})}class sD{constructor(e,t){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=t.width)!==null&&o!==void 0?o:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,o,r=this.editorView.dom,i=r.getBoundingClientRect(),s=i.width/r.offsetWidth,l=i.height/r.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;o={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!o){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;o={left:f.left-p,right:f.left+p,top:f.top,bottom:f.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",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=a.getBoundingClientRect(),p=f.width/a.offsetWidth,h=f.height/a.offsetHeight;d=f.left-a.scrollLeft*p,u=f.top-a.scrollTop*h}this.element.style.left=(o.left-d)/s+"px",this.element.style.top=(o.top-u)/l+"px",this.element.style.width=(o.right-o.left)/s+"px",this.element.style.height=(o.bottom-o.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,t,e):r;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Mb(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class tt extends ie{constructor(e){super(e,e)}map(e,t){let o=e.resolve(t.map(this.head));return tt.valid(o)?new tt(o):ie.near(o)}content(){return j.empty}eq(e){return e instanceof tt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new tt(e.resolve(t.pos))}getBookmark(){return new Th(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!lD(e)||!aD(e))return!1;let o=t.type.spec.allowGapCursor;if(o!=null)return o;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,o=!1){e:for(;;){if(!o&&tt.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=t;let a=e.doc.resolve(r);if(tt.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Q.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),o=!1;continue e}break}i=s,r+=t;let l=e.doc.resolve(r);if(tt.valid(l))return l}return null}}}tt.prototype.visible=!1,tt.findFrom=tt.findGapCursorFrom,ie.jsonID("gapcursor",tt);class Th{constructor(e){this.pos=e}map(e){return new Th(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return tt.valid(t)?new tt(t):ie.near(t)}}function j0(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function lD(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),o=n.node(e);if(t==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||j0(r.type))return!0;if(r.inlineContent)return!1}}return!0}function aD(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),o=n.node(e);if(t==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||j0(r.type))return!0;if(r.inlineContent)return!1}}return!0}function cD(){return new ce({props:{decorations:pD,createSelectionBetween(n,e,t){return e.pos==t.pos&&tt.valid(t)?new tt(t):null},handleClick:uD,handleKeyDown:dD,handleDOMEvents:{beforeinput:fD}}})}const dD=Sp({ArrowLeft:kd("horiz",-1),ArrowRight:kd("horiz",1),ArrowUp:kd("vert",-1),ArrowDown:kd("vert",1)});function kd(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof q){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=o.doc.resolve(e>0?l.after():l.before())}let d=tt.findGapCursorFrom(l,e,a);return d?(r&&r(o.tr.setSelection(new tt(d))),!0):!1}}function uD(n,e,t){if(!n||!n.editable)return!1;let o=n.state.doc.resolve(e);if(!tt.valid(o))return!1;let r=n.posAtCoords({left:t.clientX,top:t.clientY});return r&&r.inside>-1&&Q.isSelectable(n.state.doc.nodeAt(r.inside))?!1:(n.dispatch(n.state.tr.setSelection(new tt(o))),!0)}function fD(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof tt))return!1;let{$from:t}=n.state.selection,o=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!o)return!1;let r=L.empty;for(let s=o.length-1;s>=0;s--)r=L.from(o[s].createAndFill(null,r));let i=n.state.tr.replace(t.pos,t.pos,new j(r,0,0));return i.setSelection(q.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function pD(n){if(!(n.selection instanceof tt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Se.create(n.doc,[ze.widget(n.selection.head,e,{key:"gapcursor"})])}var wd=200,vt=function(){};vt.prototype.append=function(e){return e.length?(e=vt.from(e),!this.length&&e||e.length<wd&&this.leafAppend(e)||this.length<wd&&e.leafPrepend(this)||this.appendInner(e)):this},vt.prototype.prepend=function(e){return e.length?vt.from(e).append(this):this},vt.prototype.appendInner=function(e){return new hD(this,e)},vt.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?vt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},vt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},vt.prototype.forEach=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length),t<=o?this.forEachInner(e,t,o,0):this.forEachInvertedInner(e,t,o,0)},vt.prototype.map=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length);var r=[];return this.forEach(function(i,s){return r.push(e(i,s))},t,o),r},vt.from=function(e){return e instanceof vt?e:e&&e.length?new U0(e):vt.empty};var U0=(function(n){function e(o){n.call(this),this.values=o}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,s,l){for(var a=i;a<s;a++)if(r(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){for(var a=i-1;a>=s;a--)if(r(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=wd)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=wd)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(vt);vt.empty=new U0([]);var hD=(function(n){function e(t,o){n.call(this),this.left=t,this.right=o,this.length=t.length+o.length,this.depth=Math.max(t.depth,o.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,r,i,s){var l=this.left.length;if(r<l&&this.left.forEachInner(o,r,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(o,Math.max(r-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(o,r-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(o,Math.min(r,l),i,s)===!1)return!1},e.prototype.sliceInner=function(o,r){if(o==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(o,r):o>=i?this.right.slice(o-i,r-i):this.left.slice(o,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(o){var r=this.right.leafAppend(o);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(o){var r=this.left.leafPrepend(o);if(r)return new e(r,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e})(vt);const mD=500;class Gn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;t&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,l,a,d=[],u=[];return this.items.forEach((f,p)=>{if(!f.step){r||(r=this.remapping(o,p+1),i=r.maps.length),i--,u.push(f);return}if(r){u.push(new mo(f.map));let h=f.step.map(r.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],d.push(new mo(m,void 0,void 0,d.length+u.length))),i--,m&&r.appendMap(m,i)}else s.maybeStep(f.step);if(f.selection)return l=r?f.selection.map(r.slice(i)):f.selection,a=new Gn(this.items.slice(0,o).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,o,r){let i=[],s=this.eventCount,l=this.items,a=!r&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),p=new mo(e.mapping.maps[u],f,t),h;(h=a&&a.merge(p))&&(p=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(p),t&&(s++,t=void 0),r||(a=p)}let d=s-o.depth;return d>yD&&(l=gD(l,d),s-=d),new Gn(l.append(i),s)}remapping(e,t){let o=new Qs;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,t),o}addMaps(e){return this.eventCount==0?this:new Gn(this.items.append(e.map(t=>new mo(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},r);let a=t;this.items.forEach(p=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(i.slice(a+1,h));y&&l++,o.push(new mo(m,g,y))}else o.push(new mo(m))},r);let d=[];for(let p=t;p<s;p++)d.push(new mo(i.maps[p]));let u=this.items.slice(0,r).append(d).append(o),f=new Gn(u,l);return f.emptyItemCount()>mD&&(f=f.compress(this.items.length-o.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),o=t.maps.length,r=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)r.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(o)),d=a&&a.getMap();if(o--,d&&t.appendMap(d,o),a){let u=s.selection&&s.selection.map(t.slice(o));u&&i++;let f=new mo(d.invert(),a,u),p,h=r.length-1;(p=r.length&&r[h].merge(f))?r[h]=p:r.push(f)}}else s.map&&o--},this.items.length,0),new Gn(vt.from(r.reverse()),i)}}Gn.empty=new Gn(vt.empty,0);function gD(n,e){let t;return n.forEach((o,r)=>{if(o.selection&&e--==0)return t=r,!1}),n.slice(t)}class mo{constructor(e,t,o,r){this.map=e,this.step=t,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new mo(t.getMap().invert(),t,this.selection)}}}class Ar{constructor(e,t,o,r,i){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const yD=20;function bD(n,e,t,o){let r=t.getMeta(mi),i;if(r)return r.historyState;t.getMeta(xD)&&(n=new Ar(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(mi))return s.getMeta(mi).redo?new Ar(n.done.addTransform(t,void 0,o,xd(e)),n.undone,W0(t.mapping.maps),n.prevTime,n.prevComposition):new Ar(n.done,n.undone.addTransform(t,void 0,o,xd(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-o.newGroupDelay||!kD(t,n.prevRanges)),d=s?Nh(n.prevRanges,t.mapping):W0(t.mapping.maps);return new Ar(n.done.addTransform(t,a?e.selection.getBookmark():void 0,o,xd(e)),Gn.empty,d,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new Ar(n.done.rebased(t,i),n.undone.rebased(t,i),Nh(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Ar(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Nh(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function kD(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(t=!0)}),t}function W0(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((o,r,i,s)=>e.push(i,s));return e}function Nh(n,e){if(!n)return null;let t=[];for(let o=0;o<n.length;o+=2){let r=e.map(n[o],1),i=e.map(n[o+1],-1);r<=i&&t.push(r,i)}return t}function wD(n,e,t){let o=xd(e),r=mi.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),a=new Ar(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(mi,{redo:t,historyState:a})}let Ah=!1,q0=null;function xd(n){let e=n.plugins;if(q0!=e){Ah=!1,q0=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Ah=!0;break}}return Ah}const mi=new le("history"),xD=new le("closeHistory");function CD(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ce({key:mi,state:{init(){return new Ar(Gn.empty,Gn.empty,null,0,-1)},apply(e,t,o){return bD(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,r=o=="historyUndo"?J0:o=="historyRedo"?G0:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function K0(n,e){return(t,o)=>{let r=mi.getState(t);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(o){let i=wD(r,t,n);i&&o(e?i.scrollIntoView():i)}return!0}}const J0=K0(!1,!0),G0=K0(!0,!0);me.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ce({key:new le("characterCount"),appendTransaction:(e,t,o)=>{if(n)return;const r=this.options.limit;if(r==null||r===0){n=!0;return}const i=this.storage.characters({node:o.doc});if(i>r){const s=i-r,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const d=o.tr.deleteRange(l,a);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=o||r>o&&i>o&&i<=r)return!0;if(r>o&&i>o&&i>r||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-o,d=l-a,u=l;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>o)}})]}});var SD=me.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[iD(this.options)]}}),X0=me.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ce({key:new le("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!t||!o)return Se.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,d)=>{if(a.isText)return;if(!(r>=d&&r<=d+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,d)=>{if(a.isText||!(r>=d&&r<=d+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(ze.node(d,d+a.nodeSize,{class:this.options.className}))}),Se.create(n,i)}}})]}}),vD=me.create({name:"gapCursor",addProseMirrorPlugins(){return[cD()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Re(ne(n,"allowGapCursor",t)))!=null?e:null}}}),Y0="placeholder";function ED(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}me.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Y0,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${ED(this.options.dataAttribute)}`:`data-${Y0}`;return[new ce({key:new le("placeholder"),props:{decorations:({doc:e,selection:t})=>{const o=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(!o)return null;const s=this.editor.isEmpty;return e.descendants((l,a)=>{const d=r>=a&&r<=a+l.nodeSize,u=!l.isLeaf&&xl(l);if((d||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];s&&f.push(this.options.emptyEditorClass);const p=ze.node(a,a+l.nodeSize,{class:f.join(" "),[n]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:d}):this.options.placeholder});i.push(p)}return this.options.includeChildren}),Se.create(e,i)}}})]}}),me.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ce({key:new le("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||Hp(t.selection)||n.view.dragging?null:Se.create(t.doc,[ze.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Q0({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var MD=me.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new le(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",o=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(t).includes(r.name));return[new ce({key:e,appendTransaction:(r,i,s)=>{const{doc:l,tr:a,schema:d}=s,u=e.getState(s),f=l.content.size,p=d.nodes[t];if(u)return a.insert(f,p.create())},state:{init:(r,i)=>{const s=i.tr.doc.lastChild;return!Q0({node:s,types:o})},apply:(r,i)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return i;const s=r.doc.lastChild;return!Q0({node:s,types:o})}}})]}}),TD=me.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>J0(n,e),redo:()=>({state:n,dispatch:e})=>G0(n,e)}},addProseMirrorPlugins(){return[CD(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),ND=me.create({name:"starterKit",addExtensions(){var n,e,t,o;const r=[];return this.options.bold!==!1&&r.push(iR.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(eR.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(M0.configure(this.options.bulletList)),this.options.code!==!1&&r.push(aR.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(r0.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(i0.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(SD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(vD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(uR.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(fR.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(TD.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(s0.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(bR.configure(this.options.italic)),this.options.listItem!==!1&&r.push(T0.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(R0.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&r.push(S0.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(P0.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(eD.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(oD.configure(this.options.strike)),this.options.text!==!1&&r.push(rD.configure(this.options.text)),this.options.underline!==!1&&r.push(H0.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&r.push(MD.configure((o=this.options)==null?void 0:o.trailingNode)),r}}),AD=ND;const X=c.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("span",{class:c.normalizeClass(["o-icon",{small:n.small}]),style:c.normalizeStyle({color:n.color})},[c.createElementVNode("i",{class:c.normalizeClass(["yiitip-icon",`icon-${n.name}`])},null,2)],6))}});var pn="top",Vn="bottom",zn="right",hn="left",Oh="auto",_l=[pn,Vn,zn,hn],us="start",Il="end",OD="clippingParents",Z0="viewport",Ll="popper",$D="reference",e1=_l.reduce(function(n,e){return n.concat([e+"-"+us,e+"-"+Il])},[]),t1=[].concat(_l,[Oh]).reduce(function(n,e){return n.concat([e,e+"-"+us,e+"-"+Il])},[]),BD="beforeRead",RD="read",DD="afterRead",_D="beforeMain",ID="main",LD="afterMain",PD="beforeWrite",VD="write",zD="afterWrite",HD=[BD,RD,DD,_D,ID,LD,PD,VD,zD];function go(n){return n?(n.nodeName||"").toLowerCase():null}function bn(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function gi(n){var e=bn(n).Element;return n instanceof e||n instanceof Element}function Hn(n){var e=bn(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function $h(n){if(typeof ShadowRoot>"u")return!1;var e=bn(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function FD(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var o=e.styles[t]||{},r=e.attributes[t]||{},i=e.elements[t];!Hn(i)||!go(i)||(Object.assign(i.style,o),Object.keys(r).forEach(function(s){var l=r[s];l===!1?i.removeAttribute(s):i.setAttribute(s,l===!0?"":l)}))})}function jD(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(o){var r=e.elements[o],i=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:t[o]),l=s.reduce(function(a,d){return a[d]="",a},{});!Hn(r)||!go(r)||(Object.assign(r.style,l),Object.keys(i).forEach(function(a){r.removeAttribute(a)}))})}}const n1={name:"applyStyles",enabled:!0,phase:"write",fn:FD,effect:jD,requires:["computeStyles"]};function yo(n){return n.split("-")[0]}var yi=Math.max,Cd=Math.min,fs=Math.round;function Bh(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function o1(){return!/^((?!chrome|android).)*safari/i.test(Bh())}function ps(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var o=n.getBoundingClientRect(),r=1,i=1;e&&Hn(n)&&(r=n.offsetWidth>0&&fs(o.width)/n.offsetWidth||1,i=n.offsetHeight>0&&fs(o.height)/n.offsetHeight||1);var s=gi(n)?bn(n):window,l=s.visualViewport,a=!o1()&&t,d=(o.left+(a&&l?l.offsetLeft:0))/r,u=(o.top+(a&&l?l.offsetTop:0))/i,f=o.width/r,p=o.height/i;return{width:f,height:p,top:u,right:d+f,bottom:u+p,left:d,x:d,y:u}}function Rh(n){var e=ps(n),t=n.offsetWidth,o=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:o}}function r1(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&$h(t)){var o=e;do{if(o&&n.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Ko(n){return bn(n).getComputedStyle(n)}function UD(n){return["table","td","th"].indexOf(go(n))>=0}function Or(n){return((gi(n)?n.ownerDocument:n.document)||window.document).documentElement}function Sd(n){return go(n)==="html"?n:n.assignedSlot||n.parentNode||($h(n)?n.host:null)||Or(n)}function i1(n){return!Hn(n)||Ko(n).position==="fixed"?null:n.offsetParent}function WD(n){var e=/firefox/i.test(Bh()),t=/Trident/i.test(Bh());if(t&&Hn(n)){var o=Ko(n);if(o.position==="fixed")return null}var r=Sd(n);for($h(r)&&(r=r.host);Hn(r)&&["html","body"].indexOf(go(r))<0;){var i=Ko(r);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return r;r=r.parentNode}return null}function Pl(n){for(var e=bn(n),t=i1(n);t&&UD(t)&&Ko(t).position==="static";)t=i1(t);return t&&(go(t)==="html"||go(t)==="body"&&Ko(t).position==="static")?e:t||WD(n)||e}function Dh(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function Vl(n,e,t){return yi(n,Cd(e,t))}function qD(n,e,t){var o=Vl(n,e,t);return o>t?t:o}function s1(){return{top:0,right:0,bottom:0,left:0}}function l1(n){return Object.assign({},s1(),n)}function a1(n,e){return e.reduce(function(t,o){return t[o]=n,t},{})}var KD=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,l1(typeof e!="number"?e:a1(e,_l))};function JD(n){var e,t=n.state,o=n.name,r=n.options,i=t.elements.arrow,s=t.modifiersData.popperOffsets,l=yo(t.placement),a=Dh(l),d=[hn,zn].indexOf(l)>=0,u=d?"height":"width";if(!(!i||!s)){var f=KD(r.padding,t),p=Rh(i),h=a==="y"?pn:hn,m=a==="y"?Vn:zn,g=t.rects.reference[u]+t.rects.reference[a]-s[a]-t.rects.popper[u],y=s[a]-t.rects.reference[a],b=Pl(i),k=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,x=g/2-y/2,w=f[h],C=k-p[u]-f[m],v=k/2-p[u]/2+x,E=Vl(w,v,C),T=a;t.modifiersData[o]=(e={},e[T]=E,e.centerOffset=E-v,e)}}function GD(n){var e=n.state,t=n.options,o=t.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||r1(e.elements.popper,r)&&(e.elements.arrow=r))}const XD={name:"arrow",enabled:!0,phase:"main",fn:JD,effect:GD,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function hs(n){return n.split("-")[1]}var YD={top:"auto",right:"auto",bottom:"auto",left:"auto"};function QD(n,e){var t=n.x,o=n.y,r=e.devicePixelRatio||1;return{x:fs(t*r)/r||0,y:fs(o*r)/r||0}}function c1(n){var e,t=n.popper,o=n.popperRect,r=n.placement,i=n.variation,s=n.offsets,l=n.position,a=n.gpuAcceleration,d=n.adaptive,u=n.roundOffsets,f=n.isFixed,p=s.x,h=p===void 0?0:p,m=s.y,g=m===void 0?0:m,y=typeof u=="function"?u({x:h,y:g}):{x:h,y:g};h=y.x,g=y.y;var b=s.hasOwnProperty("x"),k=s.hasOwnProperty("y"),x=hn,w=pn,C=window;if(d){var v=Pl(t),E="clientHeight",T="clientWidth";if(v===bn(t)&&(v=Or(t),Ko(v).position!=="static"&&l==="absolute"&&(E="scrollHeight",T="scrollWidth")),v=v,r===pn||(r===hn||r===zn)&&i===Il){w=Vn;var A=f&&v===C&&C.visualViewport?C.visualViewport.height:v[E];g-=A-o.height,g*=a?1:-1}if(r===hn||(r===pn||r===Vn)&&i===Il){x=zn;var $=f&&v===C&&C.visualViewport?C.visualViewport.width:v[T];h-=$-o.width,h*=a?1:-1}}var O=Object.assign({position:l},d&&YD),B=u===!0?QD({x:h,y:g},bn(t)):{x:h,y:g};if(h=B.x,g=B.y,a){var _;return Object.assign({},O,(_={},_[w]=k?"0":"",_[x]=b?"0":"",_.transform=(C.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",_))}return Object.assign({},O,(e={},e[w]=k?g+"px":"",e[x]=b?h+"px":"",e.transform="",e))}function ZD(n){var e=n.state,t=n.options,o=t.gpuAcceleration,r=o===void 0?!0:o,i=t.adaptive,s=i===void 0?!0:i,l=t.roundOffsets,a=l===void 0?!0:l,d={placement:yo(e.placement),variation:hs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,c1(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,c1(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const e_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ZD,data:{}};var vd={passive:!0};function t_(n){var e=n.state,t=n.instance,o=n.options,r=o.scroll,i=r===void 0?!0:r,s=o.resize,l=s===void 0?!0:s,a=bn(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&d.forEach(function(u){u.addEventListener("scroll",t.update,vd)}),l&&a.addEventListener("resize",t.update,vd),function(){i&&d.forEach(function(u){u.removeEventListener("scroll",t.update,vd)}),l&&a.removeEventListener("resize",t.update,vd)}}const n_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:t_,data:{}};var o_={left:"right",right:"left",bottom:"top",top:"bottom"};function Ed(n){return n.replace(/left|right|bottom|top/g,function(e){return o_[e]})}var r_={start:"end",end:"start"};function d1(n){return n.replace(/start|end/g,function(e){return r_[e]})}function _h(n){var e=bn(n),t=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:t,scrollTop:o}}function Ih(n){return ps(Or(n)).left+_h(n).scrollLeft}function i_(n,e){var t=bn(n),o=Or(n),r=t.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;var d=o1();(d||!d&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}return{width:i,height:s,x:l+Ih(n),y:a}}function s_(n){var e,t=Or(n),o=_h(n),r=(e=n.ownerDocument)==null?void 0:e.body,i=yi(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=yi(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+Ih(n),a=-o.scrollTop;return Ko(r||t).direction==="rtl"&&(l+=yi(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:l,y:a}}function Lh(n){var e=Ko(n),t=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+o)}function u1(n){return["html","body","#document"].indexOf(go(n))>=0?n.ownerDocument.body:Hn(n)&&Lh(n)?n:u1(Sd(n))}function zl(n,e){var t;e===void 0&&(e=[]);var o=u1(n),r=o===((t=n.ownerDocument)==null?void 0:t.body),i=bn(o),s=r?[i].concat(i.visualViewport||[],Lh(o)?o:[]):o,l=e.concat(s);return r?l:l.concat(zl(Sd(s)))}function Ph(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function l_(n,e){var t=ps(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function f1(n,e,t){return e===Z0?Ph(i_(n,t)):gi(e)?l_(e,t):Ph(s_(Or(n)))}function a_(n){var e=zl(Sd(n)),t=["absolute","fixed"].indexOf(Ko(n).position)>=0,o=t&&Hn(n)?Pl(n):n;return gi(o)?e.filter(function(r){return gi(r)&&r1(r,o)&&go(r)!=="body"}):[]}function c_(n,e,t,o){var r=e==="clippingParents"?a_(n):[].concat(e),i=[].concat(r,[t]),s=i[0],l=i.reduce(function(a,d){var u=f1(n,d,o);return a.top=yi(u.top,a.top),a.right=Cd(u.right,a.right),a.bottom=Cd(u.bottom,a.bottom),a.left=yi(u.left,a.left),a},f1(n,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function p1(n){var e=n.reference,t=n.element,o=n.placement,r=o?yo(o):null,i=o?hs(o):null,s=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(r){case pn:a={x:s,y:e.y-t.height};break;case Vn:a={x:s,y:e.y+e.height};break;case zn:a={x:e.x+e.width,y:l};break;case hn:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var d=r?Dh(r):null;if(d!=null){var u=d==="y"?"height":"width";switch(i){case us:a[d]=a[d]-(e[u]/2-t[u]/2);break;case Il:a[d]=a[d]+(e[u]/2-t[u]/2);break}}return a}function Hl(n,e){e===void 0&&(e={});var t=e,o=t.placement,r=o===void 0?n.placement:o,i=t.strategy,s=i===void 0?n.strategy:i,l=t.boundary,a=l===void 0?OD:l,d=t.rootBoundary,u=d===void 0?Z0:d,f=t.elementContext,p=f===void 0?Ll:f,h=t.altBoundary,m=h===void 0?!1:h,g=t.padding,y=g===void 0?0:g,b=l1(typeof y!="number"?y:a1(y,_l)),k=p===Ll?$D:Ll,x=n.rects.popper,w=n.elements[m?k:p],C=c_(gi(w)?w:w.contextElement||Or(n.elements.popper),a,u,s),v=ps(n.elements.reference),E=p1({reference:v,element:x,placement:r}),T=Ph(Object.assign({},x,E)),A=p===Ll?T:v,$={top:C.top-A.top+b.top,bottom:A.bottom-C.bottom+b.bottom,left:C.left-A.left+b.left,right:A.right-C.right+b.right},O=n.modifiersData.offset;if(p===Ll&&O){var B=O[r];Object.keys($).forEach(function(_){var D=[zn,Vn].indexOf(_)>=0?1:-1,P=[pn,Vn].indexOf(_)>=0?"y":"x";$[_]+=B[P]*D})}return $}function d_(n,e){e===void 0&&(e={});var t=e,o=t.placement,r=t.boundary,i=t.rootBoundary,s=t.padding,l=t.flipVariations,a=t.allowedAutoPlacements,d=a===void 0?t1:a,u=hs(o),f=u?l?e1:e1.filter(function(m){return hs(m)===u}):_l,p=f.filter(function(m){return d.indexOf(m)>=0});p.length===0&&(p=f);var h=p.reduce(function(m,g){return m[g]=Hl(n,{placement:g,boundary:r,rootBoundary:i,padding:s})[yo(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function u_(n){if(yo(n)===Oh)return[];var e=Ed(n);return[d1(n),e,d1(e)]}function f_(n){var e=n.state,t=n.options,o=n.name;if(!e.modifiersData[o]._skip){for(var r=t.mainAxis,i=r===void 0?!0:r,s=t.altAxis,l=s===void 0?!0:s,a=t.fallbackPlacements,d=t.padding,u=t.boundary,f=t.rootBoundary,p=t.altBoundary,h=t.flipVariations,m=h===void 0?!0:h,g=t.allowedAutoPlacements,y=e.options.placement,b=yo(y),k=b===y,x=a||(k||!m?[Ed(y)]:u_(y)),w=[y].concat(x).reduce(function(Fe,Ae){return Fe.concat(yo(Ae)===Oh?d_(e,{placement:Ae,boundary:u,rootBoundary:f,padding:d,flipVariations:m,allowedAutoPlacements:g}):Ae)},[]),C=e.rects.reference,v=e.rects.popper,E=new Map,T=!0,A=w[0],$=0;$<w.length;$++){var O=w[$],B=yo(O),_=hs(O)===us,D=[pn,Vn].indexOf(B)>=0,P=D?"width":"height",R=Hl(e,{placement:O,boundary:u,rootBoundary:f,altBoundary:p,padding:d}),K=D?_?zn:hn:_?Vn:pn;C[P]>v[P]&&(K=Ed(K));var H=Ed(K),W=[];if(i&&W.push(R[B]<=0),l&&W.push(R[K]<=0,R[H]<=0),W.every(function(Fe){return Fe})){A=O,T=!1;break}E.set(O,W)}if(T)for(var ge=m?3:1,Ee=function(Ae){var je=w.find(function(At){var pe=E.get(At);if(pe)return pe.slice(0,Ae).every(function(Me){return Me})});if(je)return A=je,"break"},Le=ge;Le>0;Le--){var We=Ee(Le);if(We==="break")break}e.placement!==A&&(e.modifiersData[o]._skip=!0,e.placement=A,e.reset=!0)}}const p_={name:"flip",enabled:!0,phase:"main",fn:f_,requiresIfExists:["offset"],data:{_skip:!1}};function h1(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function m1(n){return[pn,zn,Vn,hn].some(function(e){return n[e]>=0})}function h_(n){var e=n.state,t=n.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=Hl(e,{elementContext:"reference"}),l=Hl(e,{altBoundary:!0}),a=h1(s,o),d=h1(l,r,i),u=m1(a),f=m1(d);e.modifiersData[t]={referenceClippingOffsets:a,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":f})}const m_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:h_};function g_(n,e,t){var o=yo(n),r=[hn,pn].indexOf(o)>=0?-1:1,i=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,s=i[0],l=i[1];return s=s||0,l=(l||0)*r,[hn,zn].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function y_(n){var e=n.state,t=n.options,o=n.name,r=t.offset,i=r===void 0?[0,0]:r,s=t1.reduce(function(u,f){return u[f]=g_(f,e.rects,i),u},{}),l=s[e.placement],a=l.x,d=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=d),e.modifiersData[o]=s}const b_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:y_};function k_(n){var e=n.state,t=n.name;e.modifiersData[t]=p1({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const w_={name:"popperOffsets",enabled:!0,phase:"read",fn:k_,data:{}};function x_(n){return n==="x"?"y":"x"}function C_(n){var e=n.state,t=n.options,o=n.name,r=t.mainAxis,i=r===void 0?!0:r,s=t.altAxis,l=s===void 0?!1:s,a=t.boundary,d=t.rootBoundary,u=t.altBoundary,f=t.padding,p=t.tether,h=p===void 0?!0:p,m=t.tetherOffset,g=m===void 0?0:m,y=Hl(e,{boundary:a,rootBoundary:d,padding:f,altBoundary:u}),b=yo(e.placement),k=hs(e.placement),x=!k,w=Dh(b),C=x_(w),v=e.modifiersData.popperOffsets,E=e.rects.reference,T=e.rects.popper,A=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,$=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),O=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,B={x:0,y:0};if(v){if(i){var _,D=w==="y"?pn:hn,P=w==="y"?Vn:zn,R=w==="y"?"height":"width",K=v[w],H=K+y[D],W=K-y[P],ge=h?-T[R]/2:0,Ee=k===us?E[R]:T[R],Le=k===us?-T[R]:-E[R],We=e.elements.arrow,Fe=h&&We?Rh(We):{width:0,height:0},Ae=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:s1(),je=Ae[D],At=Ae[P],pe=Vl(0,E[R],Fe[R]),Me=x?E[R]/2-ge-pe-je-$.mainAxis:Ee-pe-je-$.mainAxis,Te=x?-E[R]/2+ge+pe+At+$.mainAxis:Le+pe+At+$.mainAxis,ct=e.elements.arrow&&Pl(e.elements.arrow),Tn=ct?w==="y"?ct.clientTop||0:ct.clientLeft||0:0,or=(_=O==null?void 0:O[w])!=null?_:0,rr=K+Me-or-Tn,Wr=K+Te-or,Kn=Vl(h?Cd(H,rr):H,K,h?yi(W,Wr):W);v[w]=Kn,B[w]=Kn-K}if(l){var ir,qr=w==="x"?pn:hn,Kr=w==="x"?Vn:zn,Qt=v[C],Nn=C==="y"?"height":"width",$o=Qt+y[qr],An=Qt-y[Kr],an=[pn,hn].indexOf(b)!==-1,sr=(ir=O==null?void 0:O[C])!=null?ir:0,Zt=an?$o:Qt-E[Nn]-T[Nn]-sr+$.altAxis,io=an?Qt+E[Nn]+T[Nn]-sr-$.altAxis:An,Bo=h&&an?qD(Zt,Qt,io):Vl(h?Zt:$o,Qt,h?io:An);v[C]=Bo,B[C]=Bo-Qt}e.modifiersData[o]=B}}const S_={name:"preventOverflow",enabled:!0,phase:"main",fn:C_,requiresIfExists:["offset"]};function v_(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function E_(n){return n===bn(n)||!Hn(n)?_h(n):v_(n)}function M_(n){var e=n.getBoundingClientRect(),t=fs(e.width)/n.offsetWidth||1,o=fs(e.height)/n.offsetHeight||1;return t!==1||o!==1}function T_(n,e,t){t===void 0&&(t=!1);var o=Hn(e),r=Hn(e)&&M_(e),i=Or(e),s=ps(n,r,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!t)&&((go(e)!=="body"||Lh(i))&&(l=E_(e)),Hn(e)?(a=ps(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):i&&(a.x=Ih(i))),{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function N_(n){var e=new Map,t=new Set,o=[];n.forEach(function(i){e.set(i.name,i)});function r(i){t.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(l){if(!t.has(l)){var a=e.get(l);a&&r(a)}}),o.push(i)}return n.forEach(function(i){t.has(i.name)||r(i)}),o}function A_(n){var e=N_(n);return HD.reduce(function(t,o){return t.concat(e.filter(function(r){return r.phase===o}))},[])}function O_(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function $_(n){var e=n.reduce(function(t,o){var r=t[o.name];return t[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,t},{});return Object.keys(e).map(function(t){return e[t]})}var g1={placement:"bottom",modifiers:[],strategy:"absolute"};function y1(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function B_(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,o=t===void 0?[]:t,r=e.defaultOptions,i=r===void 0?g1:r;return function(l,a,d){d===void 0&&(d=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},g1,i),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},f=[],p=!1,h={state:u,setOptions:function(b){var k=typeof b=="function"?b(u.options):b;g(),u.options=Object.assign({},i,u.options,k),u.scrollParents={reference:gi(l)?zl(l):l.contextElement?zl(l.contextElement):[],popper:zl(a)};var x=A_($_([].concat(o,u.options.modifiers)));return u.orderedModifiers=x.filter(function(w){return w.enabled}),m(),h.update()},forceUpdate:function(){if(!p){var b=u.elements,k=b.reference,x=b.popper;if(y1(k,x)){u.rects={reference:T_(k,Pl(x),u.options.strategy==="fixed"),popper:Rh(x)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function($){return u.modifiersData[$.name]=Object.assign({},$.data)});for(var w=0;w<u.orderedModifiers.length;w++){if(u.reset===!0){u.reset=!1,w=-1;continue}var C=u.orderedModifiers[w],v=C.fn,E=C.options,T=E===void 0?{}:E,A=C.name;typeof v=="function"&&(u=v({state:u,options:T,name:A,instance:h})||u)}}}},update:O_(function(){return new Promise(function(y){h.forceUpdate(),y(u)})}),destroy:function(){g(),p=!0}};if(!y1(l,a))return h;h.setOptions(d).then(function(y){!p&&d.onFirstUpdate&&d.onFirstUpdate(y)});function m(){u.orderedModifiers.forEach(function(y){var b=y.name,k=y.options,x=k===void 0?{}:k,w=y.effect;if(typeof w=="function"){var C=w({state:u,name:b,instance:h,options:x}),v=function(){};f.push(C||v)}})}function g(){f.forEach(function(y){return y()}),f=[]}return h}}var R_=[n_,w_,e_,n1,b_,p_,S_,XD,m_],D_=B_({defaultModifiers:R_}),__="tippy-box",b1="tippy-content",I_="tippy-backdrop",k1="tippy-arrow",w1="tippy-svg-arrow",bi={passive:!0,capture:!0},x1=function(){return document.body};function L_(n,e){return{}.hasOwnProperty.call(n,e)}function Vh(n,e,t){if(Array.isArray(n)){var o=n[e];return o??(Array.isArray(t)?t[e]:t)}return n}function zh(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function C1(n,e){return typeof n=="function"?n.apply(void 0,e):n}function S1(n,e){if(e===0)return n;var t;return function(o){clearTimeout(t),t=setTimeout(function(){n(o)},e)}}function P_(n,e){var t=Object.assign({},n);return e.forEach(function(o){delete t[o]}),t}function V_(n){return n.split(/\s+/).filter(Boolean)}function ms(n){return[].concat(n)}function v1(n,e){n.indexOf(e)===-1&&n.push(e)}function z_(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function H_(n){return n.split("-")[0]}function Md(n){return[].slice.call(n)}function E1(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function Fl(){return document.createElement("div")}function jl(n){return["Element","Fragment"].some(function(e){return zh(n,e)})}function F_(n){return zh(n,"NodeList")}function j_(n){return zh(n,"MouseEvent")}function U_(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function W_(n){return jl(n)?[n]:F_(n)?Md(n):Array.isArray(n)?n:Md(document.querySelectorAll(n))}function Hh(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function M1(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function q_(n){var e,t=ms(n),o=t[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function K_(n,e){var t=e.clientX,o=e.clientY;return n.every(function(r){var i=r.popperRect,s=r.popperState,l=r.props,a=l.interactiveBorder,d=H_(s.placement),u=s.modifiersData.offset;if(!u)return!0;var f=d==="bottom"?u.top.y:0,p=d==="top"?u.bottom.y:0,h=d==="right"?u.left.x:0,m=d==="left"?u.right.x:0,g=i.top-o+f>a,y=o-i.bottom-p>a,b=i.left-t+h>a,k=t-i.right-m>a;return g||y||b||k})}function Fh(n,e,t){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){n[o](r,t)})}function T1(n,e){for(var t=e;t;){var o;if(n.contains(t))return!0;t=t.getRootNode==null||(o=t.getRootNode())==null?void 0:o.host}return!1}var bo={isTouch:!1},N1=0;function J_(){bo.isTouch||(bo.isTouch=!0,window.performance&&document.addEventListener("mousemove",A1))}function A1(){var n=performance.now();n-N1<20&&(bo.isTouch=!1,document.removeEventListener("mousemove",A1)),N1=n}function G_(){var n=document.activeElement;if(U_(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function X_(){document.addEventListener("touchstart",J_,bi),window.addEventListener("blur",G_)}var Y_=typeof window<"u"&&typeof document<"u",Q_=Y_?!!window.msCrypto:!1;function gs(n){var e=n==="destroy"?"n already-":" ";return[n+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function O1(n){var e=/[ \t]{2,}/g,t=/^[ \t]*/gm;return n.replace(e," ").replace(t,"").trim()}function Z_(n){return O1(`
4
+ **/const O=e.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["o-icon",{small:t.small}]),style:e.normalizeStyle({color:t.color})},[e.createElementVNode("i",{class:e.normalizeClass(["yiitip-icon",`icon-${t.name}`])},null,2)],6))}});var be="top",Ve="bottom",Ee="right",he="left",qo="auto",zt=[be,Ve,Ee,he],Ct="start",Ht="end",Da="clippingParents",al="viewport",Ut="popper",Ma="reference",il=zt.reduce(function(t,o){return t.concat([o+"-"+Ct,o+"-"+Ht])},[]),cl=[].concat(zt,[qo]).reduce(function(t,o){return t.concat([o,o+"-"+Ct,o+"-"+Ht])},[]),La="beforeRead",Pa="read",Ra="afterRead",va="beforeMain",Ia="main",ja="afterMain",Fa="beforeWrite",za="write",Ha="afterWrite",Ua=[La,Pa,Ra,va,Ia,ja,Fa,za,Ha];function Le(t){return t?(t.nodeName||"").toLowerCase():null}function ye(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var o=t.ownerDocument;return o&&o.defaultView||window}return t}function lt(t){var o=ye(t).Element;return t instanceof o||t instanceof Element}function Ne(t){var o=ye(t).HTMLElement;return t instanceof o||t instanceof HTMLElement}function Wo(t){if(typeof ShadowRoot>"u")return!1;var o=ye(t).ShadowRoot;return t instanceof o||t instanceof ShadowRoot}function qa(t){var o=t.state;Object.keys(o.elements).forEach(function(n){var l=o.styles[n]||{},r=o.attributes[n]||{},a=o.elements[n];!Ne(a)||!Le(a)||(Object.assign(a.style,l),Object.keys(r).forEach(function(i){var s=r[i];s===!1?a.removeAttribute(i):a.setAttribute(i,s===!0?"":s)}))})}function Wa(t){var o=t.state,n={popper:{position:o.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(o.elements.popper.style,n.popper),o.styles=n,o.elements.arrow&&Object.assign(o.elements.arrow.style,n.arrow),function(){Object.keys(o.elements).forEach(function(l){var r=o.elements[l],a=o.attributes[l]||{},i=Object.keys(o.styles.hasOwnProperty(l)?o.styles[l]:n[l]),s=i.reduce(function(c,p){return c[p]="",c},{});!Ne(r)||!Le(r)||(Object.assign(r.style,s),Object.keys(a).forEach(function(c){r.removeAttribute(c)}))})}}const sl={name:"applyStyles",enabled:!0,phase:"write",fn:qa,effect:Wa,requires:["computeStyles"]};function Pe(t){return t.split("-")[0]}var rt=Math.max,ao=Math.min,xt=Math.round;function Yo(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(o){return o.brand+"/"+o.version}).join(" "):navigator.userAgent}function dl(){return!/^((?!chrome|android).)*safari/i.test(Yo())}function _t(t,o,n){o===void 0&&(o=!1),n===void 0&&(n=!1);var l=t.getBoundingClientRect(),r=1,a=1;o&&Ne(t)&&(r=t.offsetWidth>0&&xt(l.width)/t.offsetWidth||1,a=t.offsetHeight>0&&xt(l.height)/t.offsetHeight||1);var i=lt(t)?ye(t):window,s=i.visualViewport,c=!dl()&&n,p=(l.left+(c&&s?s.offsetLeft:0))/r,d=(l.top+(c&&s?s.offsetTop:0))/a,f=l.width/r,u=l.height/a;return{width:f,height:u,top:d,right:p+f,bottom:d+u,left:p,x:p,y:d}}function Go(t){var o=_t(t),n=t.offsetWidth,l=t.offsetHeight;return Math.abs(o.width-n)<=1&&(n=o.width),Math.abs(o.height-l)<=1&&(l=o.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:l}}function pl(t,o){var n=o.getRootNode&&o.getRootNode();if(t.contains(o))return!0;if(n&&Wo(n)){var l=o;do{if(l&&t.isSameNode(l))return!0;l=l.parentNode||l.host}while(l)}return!1}function We(t){return ye(t).getComputedStyle(t)}function Ya(t){return["table","td","th"].indexOf(Le(t))>=0}function Ze(t){return((lt(t)?t.ownerDocument:t.document)||window.document).documentElement}function io(t){return Le(t)==="html"?t:t.assignedSlot||t.parentNode||(Wo(t)?t.host:null)||Ze(t)}function fl(t){return!Ne(t)||We(t).position==="fixed"?null:t.offsetParent}function Ga(t){var o=/firefox/i.test(Yo()),n=/Trident/i.test(Yo());if(n&&Ne(t)){var l=We(t);if(l.position==="fixed")return null}var r=io(t);for(Wo(r)&&(r=r.host);Ne(r)&&["html","body"].indexOf(Le(r))<0;){var a=We(r);if(a.transform!=="none"||a.perspective!=="none"||a.contain==="paint"||["transform","perspective"].indexOf(a.willChange)!==-1||o&&a.willChange==="filter"||o&&a.filter&&a.filter!=="none")return r;r=r.parentNode}return null}function qt(t){for(var o=ye(t),n=fl(t);n&&Ya(n)&&We(n).position==="static";)n=fl(n);return n&&(Le(n)==="html"||Le(n)==="body"&&We(n).position==="static")?o:n||Ga(t)||o}function Ko(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Wt(t,o,n){return rt(t,ao(o,n))}function Ka(t,o,n){var l=Wt(t,o,n);return l>n?n:l}function ul(){return{top:0,right:0,bottom:0,left:0}}function ml(t){return Object.assign({},ul(),t)}function gl(t,o){return o.reduce(function(n,l){return n[l]=t,n},{})}var Xa=function(o,n){return o=typeof o=="function"?o(Object.assign({},n.rects,{placement:n.placement})):o,ml(typeof o!="number"?o:gl(o,zt))};function Ja(t){var o,n=t.state,l=t.name,r=t.options,a=n.elements.arrow,i=n.modifiersData.popperOffsets,s=Pe(n.placement),c=Ko(s),p=[he,Ee].indexOf(s)>=0,d=p?"height":"width";if(!(!a||!i)){var f=Xa(r.padding,n),u=Go(a),m=c==="y"?be:he,h=c==="y"?Ve:Ee,b=n.rects.reference[d]+n.rects.reference[c]-i[c]-n.rects.popper[d],y=i[c]-n.rects.reference[c],x=qt(a),k=x?c==="y"?x.clientHeight||0:x.clientWidth||0:0,_=b/2-y/2,g=f[m],V=k-u[d]-f[h],B=k/2-u[d]/2+_,$=Wt(g,B,V),R=c;n.modifiersData[l]=(o={},o[R]=$,o.centerOffset=$-B,o)}}function Za(t){var o=t.state,n=t.options,l=n.element,r=l===void 0?"[data-popper-arrow]":l;r!=null&&(typeof r=="string"&&(r=o.elements.popper.querySelector(r),!r)||pl(o.elements.popper,r)&&(o.elements.arrow=r))}const Qa={name:"arrow",enabled:!0,phase:"main",fn:Ja,effect:Za,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Bt(t){return t.split("-")[1]}var ei={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ti(t,o){var n=t.x,l=t.y,r=o.devicePixelRatio||1;return{x:xt(n*r)/r||0,y:xt(l*r)/r||0}}function bl(t){var o,n=t.popper,l=t.popperRect,r=t.placement,a=t.variation,i=t.offsets,s=t.position,c=t.gpuAcceleration,p=t.adaptive,d=t.roundOffsets,f=t.isFixed,u=i.x,m=u===void 0?0:u,h=i.y,b=h===void 0?0:h,y=typeof d=="function"?d({x:m,y:b}):{x:m,y:b};m=y.x,b=y.y;var x=i.hasOwnProperty("x"),k=i.hasOwnProperty("y"),_=he,g=be,V=window;if(p){var B=qt(n),$="clientHeight",R="clientWidth";if(B===ye(n)&&(B=Ze(n),We(B).position!=="static"&&s==="absolute"&&($="scrollHeight",R="scrollWidth")),B=B,r===be||(r===he||r===Ee)&&a===Ht){g=Ve;var D=f&&B===V&&V.visualViewport?V.visualViewport.height:B[$];b-=D-l.height,b*=c?1:-1}if(r===he||(r===be||r===Ve)&&a===Ht){_=Ee;var M=f&&B===V&&V.visualViewport?V.visualViewport.width:B[R];m-=M-l.width,m*=c?1:-1}}var H=Object.assign({position:s},p&&ei),N=d===!0?ti({x:m,y:b},ye(n)):{x:m,y:b};if(m=N.x,b=N.y,c){var S;return Object.assign({},H,(S={},S[g]=k?"0":"",S[_]=x?"0":"",S.transform=(V.devicePixelRatio||1)<=1?"translate("+m+"px, "+b+"px)":"translate3d("+m+"px, "+b+"px, 0)",S))}return Object.assign({},H,(o={},o[g]=k?b+"px":"",o[_]=x?m+"px":"",o.transform="",o))}function oi(t){var o=t.state,n=t.options,l=n.gpuAcceleration,r=l===void 0?!0:l,a=n.adaptive,i=a===void 0?!0:a,s=n.roundOffsets,c=s===void 0?!0:s,p={placement:Pe(o.placement),variation:Bt(o.placement),popper:o.elements.popper,popperRect:o.rects.popper,gpuAcceleration:r,isFixed:o.options.strategy==="fixed"};o.modifiersData.popperOffsets!=null&&(o.styles.popper=Object.assign({},o.styles.popper,bl(Object.assign({},p,{offsets:o.modifiersData.popperOffsets,position:o.options.strategy,adaptive:i,roundOffsets:c})))),o.modifiersData.arrow!=null&&(o.styles.arrow=Object.assign({},o.styles.arrow,bl(Object.assign({},p,{offsets:o.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),o.attributes.popper=Object.assign({},o.attributes.popper,{"data-popper-placement":o.placement})}const ni={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:oi,data:{}};var co={passive:!0};function li(t){var o=t.state,n=t.instance,l=t.options,r=l.scroll,a=r===void 0?!0:r,i=l.resize,s=i===void 0?!0:i,c=ye(o.elements.popper),p=[].concat(o.scrollParents.reference,o.scrollParents.popper);return a&&p.forEach(function(d){d.addEventListener("scroll",n.update,co)}),s&&c.addEventListener("resize",n.update,co),function(){a&&p.forEach(function(d){d.removeEventListener("scroll",n.update,co)}),s&&c.removeEventListener("resize",n.update,co)}}const ri={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:li,data:{}};var ai={left:"right",right:"left",bottom:"top",top:"bottom"};function so(t){return t.replace(/left|right|bottom|top/g,function(o){return ai[o]})}var ii={start:"end",end:"start"};function hl(t){return t.replace(/start|end/g,function(o){return ii[o]})}function Xo(t){var o=ye(t),n=o.pageXOffset,l=o.pageYOffset;return{scrollLeft:n,scrollTop:l}}function Jo(t){return _t(Ze(t)).left+Xo(t).scrollLeft}function ci(t,o){var n=ye(t),l=Ze(t),r=n.visualViewport,a=l.clientWidth,i=l.clientHeight,s=0,c=0;if(r){a=r.width,i=r.height;var p=dl();(p||!p&&o==="fixed")&&(s=r.offsetLeft,c=r.offsetTop)}return{width:a,height:i,x:s+Jo(t),y:c}}function si(t){var o,n=Ze(t),l=Xo(t),r=(o=t.ownerDocument)==null?void 0:o.body,a=rt(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),i=rt(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),s=-l.scrollLeft+Jo(t),c=-l.scrollTop;return We(r||n).direction==="rtl"&&(s+=rt(n.clientWidth,r?r.clientWidth:0)-a),{width:a,height:i,x:s,y:c}}function Zo(t){var o=We(t),n=o.overflow,l=o.overflowX,r=o.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+l)}function kl(t){return["html","body","#document"].indexOf(Le(t))>=0?t.ownerDocument.body:Ne(t)&&Zo(t)?t:kl(io(t))}function Yt(t,o){var n;o===void 0&&(o=[]);var l=kl(t),r=l===((n=t.ownerDocument)==null?void 0:n.body),a=ye(l),i=r?[a].concat(a.visualViewport||[],Zo(l)?l:[]):l,s=o.concat(i);return r?s:s.concat(Yt(io(i)))}function Qo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function di(t,o){var n=_t(t,!1,o==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function yl(t,o,n){return o===al?Qo(ci(t,n)):lt(o)?di(o,n):Qo(si(Ze(t)))}function pi(t){var o=Yt(io(t)),n=["absolute","fixed"].indexOf(We(t).position)>=0,l=n&&Ne(t)?qt(t):t;return lt(l)?o.filter(function(r){return lt(r)&&pl(r,l)&&Le(r)!=="body"}):[]}function fi(t,o,n,l){var r=o==="clippingParents"?pi(t):[].concat(o),a=[].concat(r,[n]),i=a[0],s=a.reduce(function(c,p){var d=yl(t,p,l);return c.top=rt(d.top,c.top),c.right=ao(d.right,c.right),c.bottom=ao(d.bottom,c.bottom),c.left=rt(d.left,c.left),c},yl(t,i,l));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function wl(t){var o=t.reference,n=t.element,l=t.placement,r=l?Pe(l):null,a=l?Bt(l):null,i=o.x+o.width/2-n.width/2,s=o.y+o.height/2-n.height/2,c;switch(r){case be:c={x:i,y:o.y-n.height};break;case Ve:c={x:i,y:o.y+o.height};break;case Ee:c={x:o.x+o.width,y:s};break;case he:c={x:o.x-n.width,y:s};break;default:c={x:o.x,y:o.y}}var p=r?Ko(r):null;if(p!=null){var d=p==="y"?"height":"width";switch(a){case Ct:c[p]=c[p]-(o[d]/2-n[d]/2);break;case Ht:c[p]=c[p]+(o[d]/2-n[d]/2);break}}return c}function Gt(t,o){o===void 0&&(o={});var n=o,l=n.placement,r=l===void 0?t.placement:l,a=n.strategy,i=a===void 0?t.strategy:a,s=n.boundary,c=s===void 0?Da:s,p=n.rootBoundary,d=p===void 0?al:p,f=n.elementContext,u=f===void 0?Ut:f,m=n.altBoundary,h=m===void 0?!1:m,b=n.padding,y=b===void 0?0:b,x=ml(typeof y!="number"?y:gl(y,zt)),k=u===Ut?Ma:Ut,_=t.rects.popper,g=t.elements[h?k:u],V=fi(lt(g)?g:g.contextElement||Ze(t.elements.popper),c,d,i),B=_t(t.elements.reference),$=wl({reference:B,element:_,placement:r}),R=Qo(Object.assign({},_,$)),D=u===Ut?R:B,M={top:V.top-D.top+x.top,bottom:D.bottom-V.bottom+x.bottom,left:V.left-D.left+x.left,right:D.right-V.right+x.right},H=t.modifiersData.offset;if(u===Ut&&H){var N=H[r];Object.keys(M).forEach(function(S){var T=[Ee,Ve].indexOf(S)>=0?1:-1,v=[be,Ve].indexOf(S)>=0?"y":"x";M[S]+=N[v]*T})}return M}function ui(t,o){o===void 0&&(o={});var n=o,l=n.placement,r=n.boundary,a=n.rootBoundary,i=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,p=c===void 0?cl:c,d=Bt(l),f=d?s?il:il.filter(function(h){return Bt(h)===d}):zt,u=f.filter(function(h){return p.indexOf(h)>=0});u.length===0&&(u=f);var m=u.reduce(function(h,b){return h[b]=Gt(t,{placement:b,boundary:r,rootBoundary:a,padding:i})[Pe(b)],h},{});return Object.keys(m).sort(function(h,b){return m[h]-m[b]})}function mi(t){if(Pe(t)===qo)return[];var o=so(t);return[hl(t),o,hl(o)]}function gi(t){var o=t.state,n=t.options,l=t.name;if(!o.modifiersData[l]._skip){for(var r=n.mainAxis,a=r===void 0?!0:r,i=n.altAxis,s=i===void 0?!0:i,c=n.fallbackPlacements,p=n.padding,d=n.boundary,f=n.rootBoundary,u=n.altBoundary,m=n.flipVariations,h=m===void 0?!0:m,b=n.allowedAutoPlacements,y=o.options.placement,x=Pe(y),k=x===y,_=c||(k||!h?[so(y)]:mi(y)),g=[y].concat(_).reduce(function(de,le){return de.concat(Pe(le)===qo?ui(o,{placement:le,boundary:d,rootBoundary:f,padding:p,flipVariations:h,allowedAutoPlacements:b}):le)},[]),V=o.rects.reference,B=o.rects.popper,$=new Map,R=!0,D=g[0],M=0;M<g.length;M++){var H=g[M],N=Pe(H),S=Bt(H)===Ct,T=[be,Ve].indexOf(N)>=0,v=T?"width":"height",U=Gt(o,{placement:H,boundary:d,rootBoundary:f,altBoundary:u,padding:p}),K=T?S?Ee:he:S?Ve:be;V[v]>B[v]&&(K=so(K));var j=so(K),A=[];if(a&&A.push(U[N]<=0),s&&A.push(U[K]<=0,U[j]<=0),A.every(function(de){return de})){D=H,R=!1;break}$.set(H,A)}if(R)for(var J=h?3:1,ee=function(le){var re=g.find(function(Oe){var F=$.get(Oe);if(F)return F.slice(0,le).every(function(G){return G})});if(re)return D=re,"break"},me=J;me>0;me--){var ge=ee(me);if(ge==="break")break}o.placement!==D&&(o.modifiersData[l]._skip=!0,o.placement=D,o.reset=!0)}}const bi={name:"flip",enabled:!0,phase:"main",fn:gi,requiresIfExists:["offset"],data:{_skip:!1}};function Cl(t,o,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-o.height-n.y,right:t.right-o.width+n.x,bottom:t.bottom-o.height+n.y,left:t.left-o.width-n.x}}function xl(t){return[be,Ee,Ve,he].some(function(o){return t[o]>=0})}function hi(t){var o=t.state,n=t.name,l=o.rects.reference,r=o.rects.popper,a=o.modifiersData.preventOverflow,i=Gt(o,{elementContext:"reference"}),s=Gt(o,{altBoundary:!0}),c=Cl(i,l),p=Cl(s,r,a),d=xl(c),f=xl(p);o.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:p,isReferenceHidden:d,hasPopperEscaped:f},o.attributes.popper=Object.assign({},o.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const ki={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:hi};function yi(t,o,n){var l=Pe(t),r=[he,be].indexOf(l)>=0?-1:1,a=typeof n=="function"?n(Object.assign({},o,{placement:t})):n,i=a[0],s=a[1];return i=i||0,s=(s||0)*r,[he,Ee].indexOf(l)>=0?{x:s,y:i}:{x:i,y:s}}function wi(t){var o=t.state,n=t.options,l=t.name,r=n.offset,a=r===void 0?[0,0]:r,i=cl.reduce(function(d,f){return d[f]=yi(f,o.rects,a),d},{}),s=i[o.placement],c=s.x,p=s.y;o.modifiersData.popperOffsets!=null&&(o.modifiersData.popperOffsets.x+=c,o.modifiersData.popperOffsets.y+=p),o.modifiersData[l]=i}const Ci={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:wi};function xi(t){var o=t.state,n=t.name;o.modifiersData[n]=wl({reference:o.rects.reference,element:o.rects.popper,placement:o.placement})}const _i={name:"popperOffsets",enabled:!0,phase:"read",fn:xi,data:{}};function Bi(t){return t==="x"?"y":"x"}function Vi(t){var o=t.state,n=t.options,l=t.name,r=n.mainAxis,a=r===void 0?!0:r,i=n.altAxis,s=i===void 0?!1:i,c=n.boundary,p=n.rootBoundary,d=n.altBoundary,f=n.padding,u=n.tether,m=u===void 0?!0:u,h=n.tetherOffset,b=h===void 0?0:h,y=Gt(o,{boundary:c,rootBoundary:p,padding:f,altBoundary:d}),x=Pe(o.placement),k=Bt(o.placement),_=!k,g=Ko(x),V=Bi(g),B=o.modifiersData.popperOffsets,$=o.rects.reference,R=o.rects.popper,D=typeof b=="function"?b(Object.assign({},o.rects,{placement:o.placement})):b,M=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),H=o.modifiersData.offset?o.modifiersData.offset[o.placement]:null,N={x:0,y:0};if(B){if(a){var S,T=g==="y"?be:he,v=g==="y"?Ve:Ee,U=g==="y"?"height":"width",K=B[g],j=K+y[T],A=K-y[v],J=m?-R[U]/2:0,ee=k===Ct?$[U]:R[U],me=k===Ct?-R[U]:-$[U],ge=o.elements.arrow,de=m&&ge?Go(ge):{width:0,height:0},le=o.modifiersData["arrow#persistent"]?o.modifiersData["arrow#persistent"].padding:ul(),re=le[T],Oe=le[v],F=Wt(0,$[U],de[U]),G=_?$[U]/2-J-F-re-M.mainAxis:ee-F-re-M.mainAxis,Q=_?-$[U]/2+J+F+Oe+M.mainAxis:me+F+Oe+M.mainAxis,ae=o.elements.arrow&&qt(o.elements.arrow),De=ae?g==="y"?ae.clientTop||0:ae.clientLeft||0:0,mt=(S=H==null?void 0:H[g])!=null?S:0,gt=K+G-mt-De,Dt=K+Q-mt,ze=Wt(m?ao(j,gt):j,K,m?rt(A,Dt):A);B[g]=ze,N[g]=ze-K}if(s){var bt,Mt=g==="x"?be:he,Lt=g==="x"?Ve:Ee,Be=B[V],Me=V==="y"?"height":"width",tt=Be+y[Mt],He=Be-y[Lt],ht=[be,he].indexOf(x)!==-1,Pt=(bt=H==null?void 0:H[V])!=null?bt:0,Xe=ht?tt:Be-$[Me]-R[Me]-Pt+M.altAxis,Rt=ht?Be+$[Me]+R[Me]-Pt-M.altAxis:He,kt=m&&ht?Ka(Xe,Be,Rt):Wt(m?Xe:tt,Be,m?Rt:He);B[V]=kt,N[V]=kt-Be}o.modifiersData[l]=N}}const Ei={name:"preventOverflow",enabled:!0,phase:"main",fn:Vi,requiresIfExists:["offset"]};function Ni(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Si(t){return t===ye(t)||!Ne(t)?Xo(t):Ni(t)}function Oi(t){var o=t.getBoundingClientRect(),n=xt(o.width)/t.offsetWidth||1,l=xt(o.height)/t.offsetHeight||1;return n!==1||l!==1}function Ai(t,o,n){n===void 0&&(n=!1);var l=Ne(o),r=Ne(o)&&Oi(o),a=Ze(o),i=_t(t,r,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(l||!l&&!n)&&((Le(o)!=="body"||Zo(a))&&(s=Si(o)),Ne(o)?(c=_t(o,!0),c.x+=o.clientLeft,c.y+=o.clientTop):a&&(c.x=Jo(a))),{x:i.left+s.scrollLeft-c.x,y:i.top+s.scrollTop-c.y,width:i.width,height:i.height}}function $i(t){var o=new Map,n=new Set,l=[];t.forEach(function(a){o.set(a.name,a)});function r(a){n.add(a.name);var i=[].concat(a.requires||[],a.requiresIfExists||[]);i.forEach(function(s){if(!n.has(s)){var c=o.get(s);c&&r(c)}}),l.push(a)}return t.forEach(function(a){n.has(a.name)||r(a)}),l}function Ti(t){var o=$i(t);return Ua.reduce(function(n,l){return n.concat(o.filter(function(r){return r.phase===l}))},[])}function Di(t){var o;return function(){return o||(o=new Promise(function(n){Promise.resolve().then(function(){o=void 0,n(t())})})),o}}function Mi(t){var o=t.reduce(function(n,l){var r=n[l.name];return n[l.name]=r?Object.assign({},r,l,{options:Object.assign({},r.options,l.options),data:Object.assign({},r.data,l.data)}):l,n},{});return Object.keys(o).map(function(n){return o[n]})}var _l={placement:"bottom",modifiers:[],strategy:"absolute"};function Bl(){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return!o.some(function(l){return!(l&&typeof l.getBoundingClientRect=="function")})}function Li(t){t===void 0&&(t={});var o=t,n=o.defaultModifiers,l=n===void 0?[]:n,r=o.defaultOptions,a=r===void 0?_l:r;return function(s,c,p){p===void 0&&(p=a);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},_l,a),modifiersData:{},elements:{reference:s,popper:c},attributes:{},styles:{}},f=[],u=!1,m={state:d,setOptions:function(x){var k=typeof x=="function"?x(d.options):x;b(),d.options=Object.assign({},a,d.options,k),d.scrollParents={reference:lt(s)?Yt(s):s.contextElement?Yt(s.contextElement):[],popper:Yt(c)};var _=Ti(Mi([].concat(l,d.options.modifiers)));return d.orderedModifiers=_.filter(function(g){return g.enabled}),h(),m.update()},forceUpdate:function(){if(!u){var x=d.elements,k=x.reference,_=x.popper;if(Bl(k,_)){d.rects={reference:Ai(k,qt(_),d.options.strategy==="fixed"),popper:Go(_)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(M){return d.modifiersData[M.name]=Object.assign({},M.data)});for(var g=0;g<d.orderedModifiers.length;g++){if(d.reset===!0){d.reset=!1,g=-1;continue}var V=d.orderedModifiers[g],B=V.fn,$=V.options,R=$===void 0?{}:$,D=V.name;typeof B=="function"&&(d=B({state:d,options:R,name:D,instance:m})||d)}}}},update:Di(function(){return new Promise(function(y){m.forceUpdate(),y(d)})}),destroy:function(){b(),u=!0}};if(!Bl(s,c))return m;m.setOptions(p).then(function(y){!u&&p.onFirstUpdate&&p.onFirstUpdate(y)});function h(){d.orderedModifiers.forEach(function(y){var x=y.name,k=y.options,_=k===void 0?{}:k,g=y.effect;if(typeof g=="function"){var V=g({state:d,name:x,instance:m,options:_}),B=function(){};f.push(V||B)}})}function b(){f.forEach(function(y){return y()}),f=[]}return m}}var Pi=[ri,_i,ni,sl,Ci,bi,Ei,Qa,ki],Ri=Li({defaultModifiers:Pi}),vi="tippy-box",Vl="tippy-content",Ii="tippy-backdrop",El="tippy-arrow",Nl="tippy-svg-arrow",at={passive:!0,capture:!0},Sl=function(){return document.body};function ji(t,o){return{}.hasOwnProperty.call(t,o)}function en(t,o,n){if(Array.isArray(t)){var l=t[o];return l??(Array.isArray(n)?n[o]:n)}return t}function tn(t,o){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(o+"]")>-1}function Ol(t,o){return typeof t=="function"?t.apply(void 0,o):t}function Al(t,o){if(o===0)return t;var n;return function(l){clearTimeout(n),n=setTimeout(function(){t(l)},o)}}function Fi(t,o){var n=Object.assign({},t);return o.forEach(function(l){delete n[l]}),n}function zi(t){return t.split(/\s+/).filter(Boolean)}function Vt(t){return[].concat(t)}function $l(t,o){t.indexOf(o)===-1&&t.push(o)}function Hi(t){return t.filter(function(o,n){return t.indexOf(o)===n})}function Ui(t){return t.split("-")[0]}function po(t){return[].slice.call(t)}function Tl(t){return Object.keys(t).reduce(function(o,n){return t[n]!==void 0&&(o[n]=t[n]),o},{})}function Kt(){return document.createElement("div")}function Xt(t){return["Element","Fragment"].some(function(o){return tn(t,o)})}function qi(t){return tn(t,"NodeList")}function Wi(t){return tn(t,"MouseEvent")}function Yi(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function Gi(t){return Xt(t)?[t]:qi(t)?po(t):Array.isArray(t)?t:po(document.querySelectorAll(t))}function on(t,o){t.forEach(function(n){n&&(n.style.transitionDuration=o+"ms")})}function Dl(t,o){t.forEach(function(n){n&&n.setAttribute("data-state",o)})}function Ki(t){var o,n=Vt(t),l=n[0];return l!=null&&(o=l.ownerDocument)!=null&&o.body?l.ownerDocument:document}function Xi(t,o){var n=o.clientX,l=o.clientY;return t.every(function(r){var a=r.popperRect,i=r.popperState,s=r.props,c=s.interactiveBorder,p=Ui(i.placement),d=i.modifiersData.offset;if(!d)return!0;var f=p==="bottom"?d.top.y:0,u=p==="top"?d.bottom.y:0,m=p==="right"?d.left.x:0,h=p==="left"?d.right.x:0,b=a.top-l+f>c,y=l-a.bottom-u>c,x=a.left-n+m>c,k=n-a.right-h>c;return b||y||x||k})}function nn(t,o,n){var l=o+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){t[l](r,n)})}function Ml(t,o){for(var n=o;n;){var l;if(t.contains(n))return!0;n=n.getRootNode==null||(l=n.getRootNode())==null?void 0:l.host}return!1}var Re={isTouch:!1},Ll=0;function Ji(){Re.isTouch||(Re.isTouch=!0,window.performance&&document.addEventListener("mousemove",Pl))}function Pl(){var t=performance.now();t-Ll<20&&(Re.isTouch=!1,document.removeEventListener("mousemove",Pl)),Ll=t}function Zi(){var t=document.activeElement;if(Yi(t)){var o=t._tippy;t.blur&&!o.state.isVisible&&t.blur()}}function Qi(){document.addEventListener("touchstart",Ji,at),window.addEventListener("blur",Zi)}var ec=typeof window<"u"&&typeof document<"u",tc=ec?!!window.msCrypto:!1;function Et(t){var o=t==="destroy"?"n already-":" ";return[t+"() was called on a"+o+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Rl(t){var o=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(o," ").replace(n,"").trim()}function oc(t){return Rl(`
146
5
  %ctippy.js
147
6
 
148
- %c`+O1(n)+`
7
+ %c`+Rl(t)+`
149
8
 
150
9
  %c👷‍ This is a development-only message. It will be removed in production.
151
- `)}function $1(n){return[Z_(n),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Ul;process.env.NODE_ENV!=="production"&&eI();function eI(){Ul=new Set}function Jo(n,e){if(n&&!Ul.has(e)){var t;Ul.add(e),(t=console).warn.apply(t,$1(e))}}function jh(n,e){if(n&&!Ul.has(e)){var t;Ul.add(e),(t=console).error.apply(t,$1(e))}}function tI(n){var e=!n,t=Object.prototype.toString.call(n)==="[object Object]"&&!n.addEventListener;jh(e,["tippy() was passed","`"+String(n)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),jh(t,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var B1={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},nI={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},kn=Object.assign({appendTo:x1,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},B1,nI),oI=Object.keys(kn),rI=function(e){process.env.NODE_ENV!=="production"&&_1(e,[]);var t=Object.keys(e);t.forEach(function(o){kn[o]=e[o]})};function R1(n){var e=n.plugins||[],t=e.reduce(function(o,r){var i=r.name,s=r.defaultValue;if(i){var l;o[i]=n[i]!==void 0?n[i]:(l=kn[i])!=null?l:s}return o},{});return Object.assign({},n,t)}function iI(n,e){var t=e?Object.keys(R1(Object.assign({},kn,{plugins:e}))):oI,o=t.reduce(function(r,i){var s=(n.getAttribute("data-tippy-"+i)||"").trim();if(!s)return r;if(i==="content")r[i]=s;else try{r[i]=JSON.parse(s)}catch{r[i]=s}return r},{});return o}function D1(n,e){var t=Object.assign({},e,{content:C1(e.content,[n])},e.ignoreAttributes?{}:iI(n,e.plugins));return t.aria=Object.assign({},kn.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}function _1(n,e){n===void 0&&(n={}),e===void 0&&(e=[]);var t=Object.keys(n);t.forEach(function(o){var r=P_(kn,Object.keys(B1)),i=!L_(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),Jo(i,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
10
+ `)}function vl(t){return[oc(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Jt;process.env.NODE_ENV!=="production"&&nc();function nc(){Jt=new Set}function Ye(t,o){if(t&&!Jt.has(o)){var n;Jt.add(o),(n=console).warn.apply(n,vl(o))}}function ln(t,o){if(t&&!Jt.has(o)){var n;Jt.add(o),(n=console).error.apply(n,vl(o))}}function lc(t){var o=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;ln(o,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),ln(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var Il={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},rc={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},we=Object.assign({appendTo:Sl,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},Il,rc),ac=Object.keys(we),ic=function(o){process.env.NODE_ENV!=="production"&&zl(o,[]);var n=Object.keys(o);n.forEach(function(l){we[l]=o[l]})};function jl(t){var o=t.plugins||[],n=o.reduce(function(l,r){var a=r.name,i=r.defaultValue;if(a){var s;l[a]=t[a]!==void 0?t[a]:(s=we[a])!=null?s:i}return l},{});return Object.assign({},t,n)}function cc(t,o){var n=o?Object.keys(jl(Object.assign({},we,{plugins:o}))):ac,l=n.reduce(function(r,a){var i=(t.getAttribute("data-tippy-"+a)||"").trim();if(!i)return r;if(a==="content")r[a]=i;else try{r[a]=JSON.parse(i)}catch{r[a]=i}return r},{});return l}function Fl(t,o){var n=Object.assign({},o,{content:Ol(o.content,[t])},o.ignoreAttributes?{}:cc(t,o.plugins));return n.aria=Object.assign({},we.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?o.interactive:n.aria.expanded,content:n.aria.content==="auto"?o.interactive?null:"describedby":n.aria.content},n}function zl(t,o){t===void 0&&(t={}),o===void 0&&(o=[]);var n=Object.keys(t);n.forEach(function(l){var r=Fi(we,Object.keys(Il)),a=!ji(r,l);a&&(a=o.filter(function(i){return i.name===l}).length===0),Ye(a,["`"+l+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
152
11
 
153
12
  `,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
154
- `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var sI=function(){return"innerHTML"};function Uh(n,e){n[sI()]=e}function I1(n){var e=Fl();return n===!0?e.className=k1:(e.className=w1,jl(n)?e.appendChild(n):Uh(e,n)),e}function L1(n,e){jl(e.content)?(Uh(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Uh(n,e.content):n.textContent=e.content)}function Wh(n){var e=n.firstElementChild,t=Md(e.children);return{box:e,content:t.find(function(o){return o.classList.contains(b1)}),arrow:t.find(function(o){return o.classList.contains(k1)||o.classList.contains(w1)}),backdrop:t.find(function(o){return o.classList.contains(I_)})}}function P1(n){var e=Fl(),t=Fl();t.className=__,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var o=Fl();o.className=b1,o.setAttribute("data-state","hidden"),L1(o,n.props),e.appendChild(t),t.appendChild(o),r(n.props,n.props);function r(i,s){var l=Wh(e),a=l.box,d=l.content,u=l.arrow;s.theme?a.setAttribute("data-theme",s.theme):a.removeAttribute("data-theme"),typeof s.animation=="string"?a.setAttribute("data-animation",s.animation):a.removeAttribute("data-animation"),s.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?a.setAttribute("role",s.role):a.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&L1(d,n.props),s.arrow?u?i.arrow!==s.arrow&&(a.removeChild(u),a.appendChild(I1(s.arrow))):a.appendChild(I1(s.arrow)):u&&a.removeChild(u)}return{popper:e,onUpdate:r}}P1.$$tippy=!0;var lI=1,Td=[],qh=[];function aI(n,e){var t=D1(n,Object.assign({},kn,R1(E1(e)))),o,r,i,s=!1,l=!1,a=!1,d=!1,u,f,p,h=[],m=S1(rr,t.interactiveDebounce),g,y=lI++,b=null,k=z_(t.plugins),x={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},w={id:y,reference:n,popper:Fl(),popperInstance:b,props:t,state:x,plugins:k,clearDelayTimeouts:Zt,setProps:io,setContent:Bo,show:_a,hide:Ia,hideWithInteractivity:Hs,enable:an,disable:sr,unmount:Fs,destroy:js};if(!t.render)return process.env.NODE_ENV!=="production"&&jh(!0,"render() function has not been supplied."),w;var C=t.render(w),v=C.popper,E=C.onUpdate;v.setAttribute("data-tippy-root",""),v.id="tippy-"+w.id,w.popper=v,n._tippy=w,v._tippy=w;var T=k.map(function(N){return N.fn(w)}),A=n.hasAttribute("aria-expanded");return ct(),ge(),K(),H("onCreate",[w]),t.showOnCreate&&$o(),v.addEventListener("mouseenter",function(){w.props.interactive&&w.state.isVisible&&w.clearDelayTimeouts()}),v.addEventListener("mouseleave",function(){w.props.interactive&&w.props.trigger.indexOf("mouseenter")>=0&&D().addEventListener("mousemove",m)}),w;function $(){var N=w.props.touch;return Array.isArray(N)?N:[N,0]}function O(){return $()[0]==="hold"}function B(){var N;return!!((N=w.props.render)!=null&&N.$$tippy)}function _(){return g||n}function D(){var N=_().parentNode;return N?q_(N):document}function P(){return Wh(v)}function R(N){return w.state.isMounted&&!w.state.isVisible||bo.isTouch||u&&u.type==="focus"?0:Vh(w.props.delay,N?0:1,kn.delay)}function K(N){N===void 0&&(N=!1),v.style.pointerEvents=w.props.interactive&&!N?"":"none",v.style.zIndex=""+w.props.zIndex}function H(N,V,te){if(te===void 0&&(te=!0),T.forEach(function(he){he[N]&&he[N].apply(he,V)}),te){var we;(we=w.props)[N].apply(we,V)}}function W(){var N=w.props.aria;if(N.content){var V="aria-"+N.content,te=v.id,we=ms(w.props.triggerTarget||n);we.forEach(function(he){var ft=he.getAttribute(V);if(w.state.isVisible)he.setAttribute(V,ft?ft+" "+te:te);else{var zt=ft&&ft.replace(te,"").trim();zt?he.setAttribute(V,zt):he.removeAttribute(V)}})}}function ge(){if(!(A||!w.props.aria.expanded)){var N=ms(w.props.triggerTarget||n);N.forEach(function(V){w.props.interactive?V.setAttribute("aria-expanded",w.state.isVisible&&V===_()?"true":"false"):V.removeAttribute("aria-expanded")})}}function Ee(){D().removeEventListener("mousemove",m),Td=Td.filter(function(N){return N!==m})}function Le(N){if(!(bo.isTouch&&(a||N.type==="mousedown"))){var V=N.composedPath&&N.composedPath()[0]||N.target;if(!(w.props.interactive&&T1(v,V))){if(ms(w.props.triggerTarget||n).some(function(te){return T1(te,V)})){if(bo.isTouch||w.state.isVisible&&w.props.trigger.indexOf("click")>=0)return}else H("onClickOutside",[w,N]);w.props.hideOnClick===!0&&(w.clearDelayTimeouts(),w.hide(),l=!0,setTimeout(function(){l=!1}),w.state.isMounted||je())}}}function We(){a=!0}function Fe(){a=!1}function Ae(){var N=D();N.addEventListener("mousedown",Le,!0),N.addEventListener("touchend",Le,bi),N.addEventListener("touchstart",Fe,bi),N.addEventListener("touchmove",We,bi)}function je(){var N=D();N.removeEventListener("mousedown",Le,!0),N.removeEventListener("touchend",Le,bi),N.removeEventListener("touchstart",Fe,bi),N.removeEventListener("touchmove",We,bi)}function At(N,V){Me(N,function(){!w.state.isVisible&&v.parentNode&&v.parentNode.contains(v)&&V()})}function pe(N,V){Me(N,V)}function Me(N,V){var te=P().box;function we(he){he.target===te&&(Fh(te,"remove",we),V())}if(N===0)return V();Fh(te,"remove",f),Fh(te,"add",we),f=we}function Te(N,V,te){te===void 0&&(te=!1);var we=ms(w.props.triggerTarget||n);we.forEach(function(he){he.addEventListener(N,V,te),h.push({node:he,eventType:N,handler:V,options:te})})}function ct(){O()&&(Te("touchstart",or,{passive:!0}),Te("touchend",Wr,{passive:!0})),V_(w.props.trigger).forEach(function(N){if(N!=="manual")switch(Te(N,or),N){case"mouseenter":Te("mouseleave",Wr);break;case"focus":Te(Q_?"focusout":"blur",Kn);break;case"focusin":Te("focusout",Kn);break}})}function Tn(){h.forEach(function(N){var V=N.node,te=N.eventType,we=N.handler,he=N.options;V.removeEventListener(te,we,he)}),h=[]}function or(N){var V,te=!1;if(!(!w.state.isEnabled||ir(N)||l)){var we=((V=u)==null?void 0:V.type)==="focus";u=N,g=N.currentTarget,ge(),!w.state.isVisible&&j_(N)&&Td.forEach(function(he){return he(N)}),N.type==="click"&&(w.props.trigger.indexOf("mouseenter")<0||s)&&w.props.hideOnClick!==!1&&w.state.isVisible?te=!0:$o(N),N.type==="click"&&(s=!te),te&&!we&&An(N)}}function rr(N){var V=N.target,te=_().contains(V)||v.contains(V);if(!(N.type==="mousemove"&&te)){var we=Nn().concat(v).map(function(he){var ft,zt=he._tippy,Jr=(ft=zt.popperInstance)==null?void 0:ft.state;return Jr?{popperRect:he.getBoundingClientRect(),popperState:Jr,props:t}:null}).filter(Boolean);K_(we,N)&&(Ee(),An(N))}}function Wr(N){var V=ir(N)||w.props.trigger.indexOf("click")>=0&&s;if(!V){if(w.props.interactive){w.hideWithInteractivity(N);return}An(N)}}function Kn(N){w.props.trigger.indexOf("focusin")<0&&N.target!==_()||w.props.interactive&&N.relatedTarget&&v.contains(N.relatedTarget)||An(N)}function ir(N){return bo.isTouch?O()!==N.type.indexOf("touch")>=0:!1}function qr(){Kr();var N=w.props,V=N.popperOptions,te=N.placement,we=N.offset,he=N.getReferenceClientRect,ft=N.moveTransition,zt=B()?Wh(v).arrow:null,Jr=he?{getBoundingClientRect:he,contextElement:he.contextElement||_()}:n,La={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(I){var U=I.state;if(B()){var ye=P(),et=ye.box;["placement","reference-hidden","escaped"].forEach(function(Xe){Xe==="placement"?et.setAttribute("data-placement",U.placement):U.attributes.popper["data-popper-"+Xe]?et.setAttribute("data-"+Xe,""):et.removeAttribute("data-"+Xe)}),U.attributes.popper={}}}},gn=[{name:"offset",options:{offset:we}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ft}},La];B()&&zt&&gn.push({name:"arrow",options:{element:zt,padding:3}}),gn.push.apply(gn,(V==null?void 0:V.modifiers)||[]),w.popperInstance=D_(Jr,v,Object.assign({},V,{placement:te,onFirstUpdate:p,modifiers:gn}))}function Kr(){w.popperInstance&&(w.popperInstance.destroy(),w.popperInstance=null)}function Qt(){var N=w.props.appendTo,V,te=_();w.props.interactive&&N===x1||N==="parent"?V=te.parentNode:V=C1(N,[te]),V.contains(v)||V.appendChild(v),w.state.isMounted=!0,qr(),process.env.NODE_ENV!=="production"&&Jo(w.props.interactive&&N===kn.appendTo&&te.nextElementSibling!==v,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
13
+ `,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var sc=function(){return"innerHTML"};function rn(t,o){t[sc()]=o}function Hl(t){var o=Kt();return t===!0?o.className=El:(o.className=Nl,Xt(t)?o.appendChild(t):rn(o,t)),o}function Ul(t,o){Xt(o.content)?(rn(t,""),t.appendChild(o.content)):typeof o.content!="function"&&(o.allowHTML?rn(t,o.content):t.textContent=o.content)}function an(t){var o=t.firstElementChild,n=po(o.children);return{box:o,content:n.find(function(l){return l.classList.contains(Vl)}),arrow:n.find(function(l){return l.classList.contains(El)||l.classList.contains(Nl)}),backdrop:n.find(function(l){return l.classList.contains(Ii)})}}function ql(t){var o=Kt(),n=Kt();n.className=vi,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var l=Kt();l.className=Vl,l.setAttribute("data-state","hidden"),Ul(l,t.props),o.appendChild(n),n.appendChild(l),r(t.props,t.props);function r(a,i){var s=an(o),c=s.box,p=s.content,d=s.arrow;i.theme?c.setAttribute("data-theme",i.theme):c.removeAttribute("data-theme"),typeof i.animation=="string"?c.setAttribute("data-animation",i.animation):c.removeAttribute("data-animation"),i.inertia?c.setAttribute("data-inertia",""):c.removeAttribute("data-inertia"),c.style.maxWidth=typeof i.maxWidth=="number"?i.maxWidth+"px":i.maxWidth,i.role?c.setAttribute("role",i.role):c.removeAttribute("role"),(a.content!==i.content||a.allowHTML!==i.allowHTML)&&Ul(p,t.props),i.arrow?d?a.arrow!==i.arrow&&(c.removeChild(d),c.appendChild(Hl(i.arrow))):c.appendChild(Hl(i.arrow)):d&&c.removeChild(d)}return{popper:o,onUpdate:r}}ql.$$tippy=!0;var dc=1,fo=[],cn=[];function pc(t,o){var n=Fl(t,Object.assign({},we,jl(Tl(o)))),l,r,a,i=!1,s=!1,c=!1,p=!1,d,f,u,m=[],h=Al(gt,n.interactiveDebounce),b,y=dc++,x=null,k=Hi(n.plugins),_={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},g={id:y,reference:t,popper:Kt(),popperInstance:x,props:n,state:_,plugins:k,clearDelayTimeouts:Xe,setProps:Rt,setContent:kt,show:Mn,hide:Ln,hideWithInteractivity:Po,enable:ht,disable:Pt,unmount:Ro,destroy:vo};if(!n.render)return process.env.NODE_ENV!=="production"&&ln(!0,"render() function has not been supplied."),g;var V=n.render(g),B=V.popper,$=V.onUpdate;B.setAttribute("data-tippy-root",""),B.id="tippy-"+g.id,g.popper=B,t._tippy=g,B._tippy=g;var R=k.map(function(w){return w.fn(g)}),D=t.hasAttribute("aria-expanded");return ae(),J(),K(),j("onCreate",[g]),n.showOnCreate&&tt(),B.addEventListener("mouseenter",function(){g.props.interactive&&g.state.isVisible&&g.clearDelayTimeouts()}),B.addEventListener("mouseleave",function(){g.props.interactive&&g.props.trigger.indexOf("mouseenter")>=0&&T().addEventListener("mousemove",h)}),g;function M(){var w=g.props.touch;return Array.isArray(w)?w:[w,0]}function H(){return M()[0]==="hold"}function N(){var w;return!!((w=g.props.render)!=null&&w.$$tippy)}function S(){return b||t}function T(){var w=S().parentNode;return w?Ki(w):document}function v(){return an(B)}function U(w){return g.state.isMounted&&!g.state.isVisible||Re.isTouch||d&&d.type==="focus"?0:en(g.props.delay,w?0:1,we.delay)}function K(w){w===void 0&&(w=!1),B.style.pointerEvents=g.props.interactive&&!w?"":"none",B.style.zIndex=""+g.props.zIndex}function j(w,E,L){if(L===void 0&&(L=!0),R.forEach(function(z){z[w]&&z[w].apply(z,E)}),L){var Y;(Y=g.props)[w].apply(Y,E)}}function A(){var w=g.props.aria;if(w.content){var E="aria-"+w.content,L=B.id,Y=Vt(g.props.triggerTarget||t);Y.forEach(function(z){var pe=z.getAttribute(E);if(g.state.isVisible)z.setAttribute(E,pe?pe+" "+L:L);else{var ke=pe&&pe.replace(L,"").trim();ke?z.setAttribute(E,ke):z.removeAttribute(E)}})}}function J(){if(!(D||!g.props.aria.expanded)){var w=Vt(g.props.triggerTarget||t);w.forEach(function(E){g.props.interactive?E.setAttribute("aria-expanded",g.state.isVisible&&E===S()?"true":"false"):E.removeAttribute("aria-expanded")})}}function ee(){T().removeEventListener("mousemove",h),fo=fo.filter(function(w){return w!==h})}function me(w){if(!(Re.isTouch&&(c||w.type==="mousedown"))){var E=w.composedPath&&w.composedPath()[0]||w.target;if(!(g.props.interactive&&Ml(B,E))){if(Vt(g.props.triggerTarget||t).some(function(L){return Ml(L,E)})){if(Re.isTouch||g.state.isVisible&&g.props.trigger.indexOf("click")>=0)return}else j("onClickOutside",[g,w]);g.props.hideOnClick===!0&&(g.clearDelayTimeouts(),g.hide(),s=!0,setTimeout(function(){s=!1}),g.state.isMounted||re())}}}function ge(){c=!0}function de(){c=!1}function le(){var w=T();w.addEventListener("mousedown",me,!0),w.addEventListener("touchend",me,at),w.addEventListener("touchstart",de,at),w.addEventListener("touchmove",ge,at)}function re(){var w=T();w.removeEventListener("mousedown",me,!0),w.removeEventListener("touchend",me,at),w.removeEventListener("touchstart",de,at),w.removeEventListener("touchmove",ge,at)}function Oe(w,E){G(w,function(){!g.state.isVisible&&B.parentNode&&B.parentNode.contains(B)&&E()})}function F(w,E){G(w,E)}function G(w,E){var L=v().box;function Y(z){z.target===L&&(nn(L,"remove",Y),E())}if(w===0)return E();nn(L,"remove",f),nn(L,"add",Y),f=Y}function Q(w,E,L){L===void 0&&(L=!1);var Y=Vt(g.props.triggerTarget||t);Y.forEach(function(z){z.addEventListener(w,E,L),m.push({node:z,eventType:w,handler:E,options:L})})}function ae(){H()&&(Q("touchstart",mt,{passive:!0}),Q("touchend",Dt,{passive:!0})),zi(g.props.trigger).forEach(function(w){if(w!=="manual")switch(Q(w,mt),w){case"mouseenter":Q("mouseleave",Dt);break;case"focus":Q(tc?"focusout":"blur",ze);break;case"focusin":Q("focusout",ze);break}})}function De(){m.forEach(function(w){var E=w.node,L=w.eventType,Y=w.handler,z=w.options;E.removeEventListener(L,Y,z)}),m=[]}function mt(w){var E,L=!1;if(!(!g.state.isEnabled||bt(w)||s)){var Y=((E=d)==null?void 0:E.type)==="focus";d=w,b=w.currentTarget,J(),!g.state.isVisible&&Wi(w)&&fo.forEach(function(z){return z(w)}),w.type==="click"&&(g.props.trigger.indexOf("mouseenter")<0||i)&&g.props.hideOnClick!==!1&&g.state.isVisible?L=!0:tt(w),w.type==="click"&&(i=!L),L&&!Y&&He(w)}}function gt(w){var E=w.target,L=S().contains(E)||B.contains(E);if(!(w.type==="mousemove"&&L)){var Y=Me().concat(B).map(function(z){var pe,ke=z._tippy,vt=(pe=ke.popperInstance)==null?void 0:pe.state;return vt?{popperRect:z.getBoundingClientRect(),popperState:vt,props:n}:null}).filter(Boolean);Xi(Y,w)&&(ee(),He(w))}}function Dt(w){var E=bt(w)||g.props.trigger.indexOf("click")>=0&&i;if(!E){if(g.props.interactive){g.hideWithInteractivity(w);return}He(w)}}function ze(w){g.props.trigger.indexOf("focusin")<0&&w.target!==S()||g.props.interactive&&w.relatedTarget&&B.contains(w.relatedTarget)||He(w)}function bt(w){return Re.isTouch?H()!==w.type.indexOf("touch")>=0:!1}function Mt(){Lt();var w=g.props,E=w.popperOptions,L=w.placement,Y=w.offset,z=w.getReferenceClientRect,pe=w.moveTransition,ke=N()?an(B).arrow:null,vt=z?{getBoundingClientRect:z,contextElement:z.contextElement||S()}:t,ga={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Io){var It=Io.state;if(N()){var rm=v(),Rn=rm.box;["placement","reference-hidden","escaped"].forEach(function(jo){jo==="placement"?Rn.setAttribute("data-placement",It.placement):It.attributes.popper["data-popper-"+jo]?Rn.setAttribute("data-"+jo,""):Rn.removeAttribute("data-"+jo)}),It.attributes.popper={}}}},yt=[{name:"offset",options:{offset:Y}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!pe}},ga];N()&&ke&&yt.push({name:"arrow",options:{element:ke,padding:3}}),yt.push.apply(yt,(E==null?void 0:E.modifiers)||[]),g.popperInstance=Ri(vt,B,Object.assign({},E,{placement:L,onFirstUpdate:u,modifiers:yt}))}function Lt(){g.popperInstance&&(g.popperInstance.destroy(),g.popperInstance=null)}function Be(){var w=g.props.appendTo,E,L=S();g.props.interactive&&w===Sl||w==="parent"?E=L.parentNode:E=Ol(w,[L]),E.contains(B)||E.appendChild(B),g.state.isMounted=!0,Mt(),process.env.NODE_ENV!=="production"&&Ye(g.props.interactive&&w===we.appendTo&&L.nextElementSibling!==B,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
155
14
 
156
15
  `,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
157
16
 
158
17
  `,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
159
18
 
160
- `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Nn(){return Md(v.querySelectorAll("[data-tippy-root]"))}function $o(N){w.clearDelayTimeouts(),N&&H("onTrigger",[w,N]),Ae();var V=R(!0),te=$(),we=te[0],he=te[1];bo.isTouch&&we==="hold"&&he&&(V=he),V?o=setTimeout(function(){w.show()},V):w.show()}function An(N){if(w.clearDelayTimeouts(),H("onUntrigger",[w,N]),!w.state.isVisible){je();return}if(!(w.props.trigger.indexOf("mouseenter")>=0&&w.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(N.type)>=0&&s)){var V=R(!1);V?r=setTimeout(function(){w.state.isVisible&&w.hide()},V):i=requestAnimationFrame(function(){w.hide()})}}function an(){w.state.isEnabled=!0}function sr(){w.hide(),w.state.isEnabled=!1}function Zt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function io(N){if(process.env.NODE_ENV!=="production"&&Jo(w.state.isDestroyed,gs("setProps")),!w.state.isDestroyed){H("onBeforeUpdate",[w,N]),Tn();var V=w.props,te=D1(n,Object.assign({},V,E1(N),{ignoreAttributes:!0}));w.props=te,ct(),V.interactiveDebounce!==te.interactiveDebounce&&(Ee(),m=S1(rr,te.interactiveDebounce)),V.triggerTarget&&!te.triggerTarget?ms(V.triggerTarget).forEach(function(we){we.removeAttribute("aria-expanded")}):te.triggerTarget&&n.removeAttribute("aria-expanded"),ge(),K(),E&&E(V,te),w.popperInstance&&(qr(),Nn().forEach(function(we){requestAnimationFrame(we._tippy.popperInstance.forceUpdate)})),H("onAfterUpdate",[w,N])}}function Bo(N){w.setProps({content:N})}function _a(){process.env.NODE_ENV!=="production"&&Jo(w.state.isDestroyed,gs("show"));var N=w.state.isVisible,V=w.state.isDestroyed,te=!w.state.isEnabled,we=bo.isTouch&&!w.props.touch,he=Vh(w.props.duration,0,kn.duration);if(!(N||V||te||we)&&!_().hasAttribute("disabled")&&(H("onShow",[w],!1),w.props.onShow(w)!==!1)){if(w.state.isVisible=!0,B()&&(v.style.visibility="visible"),K(),Ae(),w.state.isMounted||(v.style.transition="none"),B()){var ft=P(),zt=ft.box,Jr=ft.content;Hh([zt,Jr],0)}p=function(){var gn;if(!(!w.state.isVisible||d)){if(d=!0,v.offsetHeight,v.style.transition=w.props.moveTransition,B()&&w.props.animation){var M=P(),I=M.box,U=M.content;Hh([I,U],he),M1([I,U],"visible")}W(),ge(),v1(qh,w),(gn=w.popperInstance)==null||gn.forceUpdate(),H("onMount",[w]),w.props.animation&&B()&&pe(he,function(){w.state.isShown=!0,H("onShown",[w])})}},Qt()}}function Ia(){process.env.NODE_ENV!=="production"&&Jo(w.state.isDestroyed,gs("hide"));var N=!w.state.isVisible,V=w.state.isDestroyed,te=!w.state.isEnabled,we=Vh(w.props.duration,1,kn.duration);if(!(N||V||te)&&(H("onHide",[w],!1),w.props.onHide(w)!==!1)){if(w.state.isVisible=!1,w.state.isShown=!1,d=!1,s=!1,B()&&(v.style.visibility="hidden"),Ee(),je(),K(!0),B()){var he=P(),ft=he.box,zt=he.content;w.props.animation&&(Hh([ft,zt],we),M1([ft,zt],"hidden"))}W(),ge(),w.props.animation?B()&&At(we,w.unmount):w.unmount()}}function Hs(N){process.env.NODE_ENV!=="production"&&Jo(w.state.isDestroyed,gs("hideWithInteractivity")),D().addEventListener("mousemove",m),v1(Td,m),m(N)}function Fs(){process.env.NODE_ENV!=="production"&&Jo(w.state.isDestroyed,gs("unmount")),w.state.isVisible&&w.hide(),w.state.isMounted&&(Kr(),Nn().forEach(function(N){N._tippy.unmount()}),v.parentNode&&v.parentNode.removeChild(v),qh=qh.filter(function(N){return N!==w}),w.state.isMounted=!1,H("onHidden",[w]))}function js(){process.env.NODE_ENV!=="production"&&Jo(w.state.isDestroyed,gs("destroy")),!w.state.isDestroyed&&(w.clearDelayTimeouts(),w.unmount(),Tn(),delete n._tippy,w.state.isDestroyed=!0,H("onDestroy",[w]))}}function Go(n,e){e===void 0&&(e={});var t=kn.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(tI(n),_1(e,t)),X_();var o=Object.assign({},e,{plugins:t}),r=W_(n);if(process.env.NODE_ENV!=="production"){var i=jl(o.content),s=r.length>1;Jo(i&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
19
+ `,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function Me(){return po(B.querySelectorAll("[data-tippy-root]"))}function tt(w){g.clearDelayTimeouts(),w&&j("onTrigger",[g,w]),le();var E=U(!0),L=M(),Y=L[0],z=L[1];Re.isTouch&&Y==="hold"&&z&&(E=z),E?l=setTimeout(function(){g.show()},E):g.show()}function He(w){if(g.clearDelayTimeouts(),j("onUntrigger",[g,w]),!g.state.isVisible){re();return}if(!(g.props.trigger.indexOf("mouseenter")>=0&&g.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(w.type)>=0&&i)){var E=U(!1);E?r=setTimeout(function(){g.state.isVisible&&g.hide()},E):a=requestAnimationFrame(function(){g.hide()})}}function ht(){g.state.isEnabled=!0}function Pt(){g.hide(),g.state.isEnabled=!1}function Xe(){clearTimeout(l),clearTimeout(r),cancelAnimationFrame(a)}function Rt(w){if(process.env.NODE_ENV!=="production"&&Ye(g.state.isDestroyed,Et("setProps")),!g.state.isDestroyed){j("onBeforeUpdate",[g,w]),De();var E=g.props,L=Fl(t,Object.assign({},E,Tl(w),{ignoreAttributes:!0}));g.props=L,ae(),E.interactiveDebounce!==L.interactiveDebounce&&(ee(),h=Al(gt,L.interactiveDebounce)),E.triggerTarget&&!L.triggerTarget?Vt(E.triggerTarget).forEach(function(Y){Y.removeAttribute("aria-expanded")}):L.triggerTarget&&t.removeAttribute("aria-expanded"),J(),K(),$&&$(E,L),g.popperInstance&&(Mt(),Me().forEach(function(Y){requestAnimationFrame(Y._tippy.popperInstance.forceUpdate)})),j("onAfterUpdate",[g,w])}}function kt(w){g.setProps({content:w})}function Mn(){process.env.NODE_ENV!=="production"&&Ye(g.state.isDestroyed,Et("show"));var w=g.state.isVisible,E=g.state.isDestroyed,L=!g.state.isEnabled,Y=Re.isTouch&&!g.props.touch,z=en(g.props.duration,0,we.duration);if(!(w||E||L||Y)&&!S().hasAttribute("disabled")&&(j("onShow",[g],!1),g.props.onShow(g)!==!1)){if(g.state.isVisible=!0,N()&&(B.style.visibility="visible"),K(),le(),g.state.isMounted||(B.style.transition="none"),N()){var pe=v(),ke=pe.box,vt=pe.content;on([ke,vt],0)}u=function(){var yt;if(!(!g.state.isVisible||p)){if(p=!0,B.offsetHeight,B.style.transition=g.props.moveTransition,N()&&g.props.animation){var Pn=v(),Io=Pn.box,It=Pn.content;on([Io,It],z),Dl([Io,It],"visible")}A(),J(),$l(cn,g),(yt=g.popperInstance)==null||yt.forceUpdate(),j("onMount",[g]),g.props.animation&&N()&&F(z,function(){g.state.isShown=!0,j("onShown",[g])})}},Be()}}function Ln(){process.env.NODE_ENV!=="production"&&Ye(g.state.isDestroyed,Et("hide"));var w=!g.state.isVisible,E=g.state.isDestroyed,L=!g.state.isEnabled,Y=en(g.props.duration,1,we.duration);if(!(w||E||L)&&(j("onHide",[g],!1),g.props.onHide(g)!==!1)){if(g.state.isVisible=!1,g.state.isShown=!1,p=!1,i=!1,N()&&(B.style.visibility="hidden"),ee(),re(),K(!0),N()){var z=v(),pe=z.box,ke=z.content;g.props.animation&&(on([pe,ke],Y),Dl([pe,ke],"hidden"))}A(),J(),g.props.animation?N()&&Oe(Y,g.unmount):g.unmount()}}function Po(w){process.env.NODE_ENV!=="production"&&Ye(g.state.isDestroyed,Et("hideWithInteractivity")),T().addEventListener("mousemove",h),$l(fo,h),h(w)}function Ro(){process.env.NODE_ENV!=="production"&&Ye(g.state.isDestroyed,Et("unmount")),g.state.isVisible&&g.hide(),g.state.isMounted&&(Lt(),Me().forEach(function(w){w._tippy.unmount()}),B.parentNode&&B.parentNode.removeChild(B),cn=cn.filter(function(w){return w!==g}),g.state.isMounted=!1,j("onHidden",[g]))}function vo(){process.env.NODE_ENV!=="production"&&Ye(g.state.isDestroyed,Et("destroy")),!g.state.isDestroyed&&(g.clearDelayTimeouts(),g.unmount(),De(),delete t._tippy,g.state.isDestroyed=!0,j("onDestroy",[g]))}}function Ge(t,o){o===void 0&&(o={});var n=we.plugins.concat(o.plugins||[]);process.env.NODE_ENV!=="production"&&(lc(t),zl(o,n)),Qi();var l=Object.assign({},o,{plugins:n}),r=Gi(t);if(process.env.NODE_ENV!=="production"){var a=Xt(l.content),i=r.length>1;Ye(a&&i,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
161
20
 
162
21
  `,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
163
22
 
164
23
  `,`1) content: element.innerHTML
165
- `,"2) content: () => element.cloneNode(true)"].join(" "))}var l=r.reduce(function(a,d){var u=d&&aI(d,o);return u&&a.push(u),a},[]);return jl(n)?l[0]:l}Go.defaultProps=kn,Go.setDefaultProps=rI,Go.currentInput=bo,Object.assign({},n1,{effect:function(e){var t=e.state,o={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,o.popper),t.styles=o,t.elements.arrow&&Object.assign(t.elements.arrow.style,o.arrow)}}),Go.setDefaultProps({render:P1});const cI=new Ui({breaks:!0});function Kh(){return{md:cI}}function Nd(){const n=(o,r,i)=>{const s={type:"text/plain"};switch(o){case"svg":s.type="image/svg+xml;charset=utf-8";break}const l=new Blob([i],s),a=URL.createObjectURL(l),d=document.createElement("a");d.href=a,d.download=r,d.click(),URL.revokeObjectURL(a)},e=async o=>{try{const i=await(await fetch(o)).blob(),s=window.URL.createObjectURL(i),l=t(o),a=document.createElement("a");a.href=s,a.download=l,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(s)}catch{window.open(o,"_blank")}},t=(o,r="png")=>{try{const l=new URL(o).pathname.split("/"),a=l[l.length-1];return a&&a.includes(".")?decodeURIComponent(a):`image-${Date.now()}.${r}`}catch{return`download-${Date.now()}.${r}`}};return{commonDownload:n,downloadImage:e}}function V1(){const n=c.ref(),e=c.ref(!1);function t(s){n.value=s,s.editor.on("selectionUpdate",i)}function o(){var s;(s=n.value)==null||s.editor.off("selectionUpdate",i)}const r=c.computed(()=>{var a;const s=(a=n.value)==null?void 0:a.getPos();if(typeof s!="number")return null;const l=n.value.editor.state.doc.nodeAt(s);return l?{start:s+1,end:s+l.nodeSize-1}:null}),i=()=>{if(!n.value)return;const{editor:s}=n.value;if(!s.isFocused){e.value=!1;return}const{selection:l}=s.state;l&&(e.value=(l==null?void 0:l.$from.pos)>=r.value.start&&(l==null?void 0:l.$to.pos)<=r.value.end)};return{isFocused:e,bind:t,unbind:o,checkFocus:i}}function de(){const n=c.inject("locale",{value:"en"}),e=c.computed(()=>fN.getMessage(n.value)),t=c.computed(()=>{var r;return((r=e.value)==null?void 0:r.name)||"English"});function o(r){return r.split(".").reduce((i,s)=>{if(i)return i[s]},e.value)}return{languageName:t,locale:n,message:e,tr:o}}let Jh,Gh;if(typeof WeakMap<"u"){let n=new WeakMap;Jh=e=>n.get(e),Gh=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Jh=o=>{for(let r=0;r<n.length;r+=2)if(n[r]==o)return n[r+1]},Gh=(o,r)=>(t==10&&(t=0),n[t++]=o,n[t++]=r)}var it=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:o,right:r,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?o==0:r==this.width)?null:this.map[i*this.width+(t<0?o-1:r)]:(t<0?i==0:s==this.height)?null:this.map[o+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:o,top:r,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:d}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,d)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let r=n.left;r<n.right;r++){const i=o*this.width+r,s=this.map[i];t[s]||(t[s]=!0,!(r==n.left&&r&&this.map[i-1]==s||o==n.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let o=0,r=0;;o++){const i=r+t.child(o).nodeSize;if(o==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(n){return Jh(n)||Gh(n,dI(n))}};function dI(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=uI(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let d=0,u=e*t;d<u;d++)o[d]=0;for(let d=0,u=0;d<t;d++){const f=n.child(d);u++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let x=0;x<b;x++){if(x+d>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-x});break}const w=r+x*e;for(let C=0;C<y;C++){o[w+C]==0?o[w+C]=u:(i||(i=[])).push({type:"collision",row:d,pos:u,n:y-C});const v=k&&k[C];if(v){const E=(w+C)%e*2,T=s[E];T==null||T!=v&&s[E+1]==1?(s[E]=v,s[E+1]=1):T==v&&s[E+1]++}}}r+=y,u+=g.nodeSize}const p=(d+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:d,n:h}),u++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new it(e,t,o,i);let a=!1;for(let d=0;!a&&d<s.length;d+=2)s[d]!=null&&s[d+1]<t&&(a=!0);return a&&fI(l,s,n),l}function uI(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const r=n.child(o);let i=0;if(t)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const d=l.child(a);s+d.attrs.rowspan>o&&(i+=d.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function fI(n,e,t){n.problems||(n.problems=[]);const o={};for(let r=0;r<n.map.length;r++){const i=n.map[r];if(o[i])continue;o[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let d=0;d<a.colspan;d++){const u=e[(r+d)%n.width*2];u!=null&&(!a.colwidth||a.colwidth[d]!=u)&&((l||(l=pI(a)))[d]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function pI(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Wt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],r=o.spec.tableRole;r&&(e[r]=o)}}return e}const $r=new le("selectingCells");function ki(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function hI(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function Xn(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Ad(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=ki(e.$head)||mI(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function mI(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Xh(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function gI(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Yh(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function z1(n,e,t){const o=n.node(-1),r=it.get(o),i=n.start(-1),s=r.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function wi(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function H1(n,e,t=1){const o={...n,colspan:n.colspan+t};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<t;r++)o.colwidth.splice(e,0,0)}return o}function yI(n,e,t){const o=Wt(e.type.schema).header_cell;for(let r=0;r<n.height;r++)if(e.nodeAt(n.map[t+r*n.width]).type!=o)return!1;return!0}var Pe=class ar extends ie{constructor(e,t=e){const o=e.node(-1),r=it.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(u=>u!=t.pos-i);a.unshift(t.pos-i);const d=a.map(u=>{const f=o.nodeAt(u);if(!f)throw new RangeError(`No cell with offset ${u} found`);const p=i+u+1;return new $b(l.resolve(p),l.resolve(p+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(Xh(o)&&Xh(r)&&Yh(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?ar.rowSelection(o,r):i&&this.isColSelection()?ar.colSelection(o,r):new ar(o,r)}return q.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=it.get(e),o=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let a=r.top;a<r.bottom;a++){const d=[];for(let u=a*t.width+r.left,f=r.left;f<r.right;f++,u++){const p=t.map[u];if(i[p])continue;i[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=r.left-h.left,y=h.right-r.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=wi(b,0,g)),y>0&&(b=wi(b,b.colspan-y,y)),h.left<r.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<r.top||h.bottom>r.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}s.push(e.child(a).copy(L.from(d)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new j(L.from(l),1,1)}replace(e,t=j.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],d=e.mapping.slice(o);e.replace(d.map(l.pos),d.map(a.pos),s?j.empty:t)}const i=ie.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new j(L.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=it.get(t),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),r=it.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new ar(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=it.get(e),o=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-o),i=t.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof ar&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),r=it.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new ar(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new ar(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new ar(e.resolve(t),e.resolve(o))}getBookmark(){return new bI(this.$anchorCell.pos,this.$headCell.pos)}};Pe.prototype.visible=!1,ie.jsonID("cell",Pe);var bI=class nN{constructor(e,t){this.anchor=e,this.head=t}map(e){return new nN(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&Yh(t,o)?new Pe(t,o):ie.near(o,1)}};function kI(n){if(!(n.selection instanceof Pe))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(ze.node(o,o+t.nodeSize,{class:"selectedCell"}))}),Se.create(n.doc,e)}function wI({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return t==o&&/row|table/.test(n.node(r).type.spec.tableRole)}function xI({$from:n,$to:e}){let t,o;for(let r=n.depth;r>0;r--){const i=n.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return t!==o&&e.parentOffset===0}function CI(n,e,t){const o=(e||n).selection,r=(e||n).doc;let i,s;if(o instanceof Q&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Pe.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=Pe.rowSelection(l,l)}else if(!t){const l=it.get(o.node),a=o.from+1,d=a+l.map[l.width*l.height-1];i=Pe.create(r,a+1,d)}}else o instanceof q&&wI(o)?i=q.create(r,o.from):o instanceof q&&xI(o)&&(i=q.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const SI=new le("fix-tables");function F1(n,e,t,o){const r=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let d=l,u=Math.min(r,s+3);d<u;d++)if(n.child(d)==a){l=d+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?F1(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function j1(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=vI(n,r,i,t))};return e?e.doc!=n.doc&&F1(e.doc,n.doc,0,o):n.doc.descendants(o),t}function vI(n,e,t,o){const r=it.get(e);if(!r.problems)return o;o||(o=n.tr);const i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){const d=r.problems[a];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const f=u.attrs;for(let p=0;p<f.rowspan;p++)i[d.row+p]+=d.n;o.setNodeMarkup(o.mapping.map(t+1+d.pos),null,wi(f,f.colspan-d.n,d.n))}else if(d.type=="missing")i[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(t+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(t+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=o.mapping.map(t);o.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,d=t+1;a<r.height;a++){const u=e.child(a),f=d+u.nodeSize,p=i[a];if(p>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=Wt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?d+1:f-1;o.insert(o.mapping.map(g),m)}d=f}return o.setMeta(SI,{fixTables:!0})}function ko(n){const e=n.selection,t=Ad(n),o=t.node(-1),r=t.start(-1),i=it.get(o);return{...e instanceof Pe?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(t.pos-r),tableStart:r,map:i,table:o}}function U1(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;yI(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],d=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,H1(d.attrs,r-e.colCount(a))),s+=d.attrs.rowspan-1}else{const a=i==null?Wt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,d=e.positionAt(s,r,o);n.insert(n.mapping.map(t+d),a.createAndFill())}}return n}function EI(n,e){if(!Xn(n))return!1;if(e){const t=ko(n);e(U1(n.tr,t,t.left))}return!0}function MI(n,e){if(!Xn(n))return!1;if(e){const t=ko(n);e(U1(n.tr,t,t.right))}return!0}function TI(n,{map:e,table:t,tableStart:o},r){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,a=e.map[l],d=t.nodeAt(a),u=d.attrs;if(r>0&&e.map[l-1]==a||r<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(o+a),null,wi(u,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+d.nodeSize)}s+=u.rowspan}}function NI(n,e){if(!Xn(n))return!1;if(e){const t=ko(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;TI(o,t,r),r!=t.left;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=it.get(i)}e(o)}return!0}function AI(n,e,t){var o;const r=Wt(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((o=e.nodeAt(n.map[i+t*n.width]))===null||o===void 0?void 0:o.type)!=r)return!1;return!0}function W1(n,{map:e,tableStart:t,table:o},r){let i=t;for(let d=0;d<r;d++)i+=o.child(d).nodeSize;const s=[];let l=r>0?-1:0;AI(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let d=0,u=e.width*r;d<e.width;d++,u++)if(r>0&&r<e.height&&e.map[u]==e.map[u-e.width]){const f=e.map[u],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),d+=p.colspan-1}else{var a;const f=l==null?Wt(o.type.schema).cell:(a=o.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,p=f==null?void 0:f.createAndFill();p&&s.push(p)}return n.insert(i,Wt(o.type.schema).row.create(null,s)),n}function OI(n,e){if(!Xn(n))return!1;if(e){const t=ko(n);e(W1(n.tr,t,t.top))}return!0}function $I(n,e){if(!Xn(n))return!1;if(e){const t=ko(n);e(W1(n.tr,t,t.bottom))}return!0}function BI(n,{map:e,table:t,tableStart:o},r){let i=0;for(let d=0;d<r;d++)i+=t.child(d).nodeSize;const s=i+t.child(r).nodeSize,l=n.mapping.maps.length;n.delete(i+o,s+o);const a=new Set;for(let d=0,u=r*e.width;d<e.width;d++,u++){const f=e.map[u];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[u-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),d+=p.colspan-1}else if(r<e.height&&f==e.map[u+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(r+1,d,t);n.insert(n.mapping.slice(l).map(o+g),m),d+=h.colspan-1}}}}function RI(n,e){if(!Xn(n))return!1;if(e){const t=ko(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;BI(o,t,r),r!=t.top;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=it.get(t.table)}e(o)}return!0}function q1(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function DI({width:n,height:e,map:t},o){let r=o.top*n+o.left,i=r,s=(o.bottom-1)*n+o.left,l=r+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&t[i]==t[i-1]||o.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=o.left;a<o.right;a++){if(o.top>0&&t[r]==t[r-n]||o.bottom<e&&t[s]==t[s+n])return!0;r++,s++}return!1}function K1(n,e){const t=n.selection;if(!(t instanceof Pe)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=ko(n),{map:r}=o;if(DI(r,o))return!1;if(e){const i=n.tr,s={};let l=L.empty,a,d;for(let u=o.top;u<o.bottom;u++)for(let f=o.left;f<o.right;f++){const p=r.map[u*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,d=h;else{q1(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||d==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...H1(d.attrs,d.attrs.colspan,o.right-o.left-d.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const u=a+1+d.content.size,f=q1(d)?a+1:u;i.replaceWith(f+o.tableStart,u+o.tableStart,l)}i.setSelection(new Pe(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function J1(n,e){const t=Wt(n.schema);return _I(({node:o})=>t[o.type.spec.tableRole])(n,e)}function _I(n){return(e,t)=>{const o=e.selection;let r,i;if(o instanceof Pe){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(r=hI(o.$from),!r)return!1;i=(s=ki(o.$from))===null||s===void 0?void 0:s.pos}if(r==null||i==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(t){let l=r.attrs;const a=[],d=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=ko(e),f=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(d?{...l,colwidth:d&&d[h]?[d[h]]:null}:l);let p;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=r.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||f.insert(p=f.mapping.map(m+u.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:u.top,col:u.left}),a[0]),o instanceof Pe&&f.setSelection(new Pe(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function II(n,e){return function(t,o){if(!Xn(t))return!1;const r=Ad(t);if(r.nodeAfter.attrs[n]===e)return!1;if(o){const i=t.tr;t.selection instanceof Pe?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:e}),o(i)}return!0}}function LI(n){return function(e,t){if(!Xn(e))return!1;if(t){const o=Wt(e.schema),r=ko(e),i=e.tr,s=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(a=>r.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[a],o.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(r.tableStart+s[a],o.header_cell,l[a].attrs);t(i)}return!0}}function G1(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==t.header_cell)return!1}return!0}function Wl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?LI(n):function(t,o){if(!Xn(t))return!1;if(o){const r=Wt(t.schema),i=ko(t),s=t.tr,l=G1("row",i,r),a=G1("column",i,r),d=(n==="column"?l:n==="row"&&a)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:i.map.height}:n=="row"?{left:d,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(u).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}Wl("row",{useDeprecatedLogic:!0}),Wl("column",{useDeprecatedLogic:!0});const PI=Wl("cell",{useDeprecatedLogic:!0});function VI(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,r=n.before();o>=0;o--){const i=n.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),r=n.after();o<t.childCount;o++){const i=t.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function X1(n){return function(e,t){if(!Xn(e))return!1;const o=VI(Ad(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(q.between(r,gI(r))).scrollIntoView())}return!0}}function zI(n,e){const t=n.selection.$anchor;for(let o=t.depth;o>0;o--)if(t.node(o).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(o),t.after(o)).scrollIntoView()),!0;return!1}function Od(n,e){const t=n.selection;if(!(t instanceof Pe))return!1;if(e){const o=n.tr,r=Wt(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new j(r,0,0))}),o.docChanged&&e(o)}return!0}function HI(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let d=e.child(a).content;const u=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(u||f)&&(d=Qh(Wt(s).row,new j(d,u,f)).content),l.push(d)}else if(i=="cell"||i=="header_cell")l.push(t||o?Qh(Wt(s).row,new j(e,t,o)).content:e);else return null;return FI(s,l)}function FI(n,e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let d=r;d<r+l;d++)t[d]=(t[d]||0)+a}}let o=0;for(let r=0;r<t.length;r++)o=Math.max(o,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(L.empty),t[r]<o){const i=Wt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(L.from(s))}return{height:e.length,width:o,rows:e}}function Qh(n,e){const t=n.createAndFill();return new zf(t).replace(0,t.content.size,e).doc}function jI({width:n,height:e,rows:t},o,r){if(n!=o){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],d=[];for(let u=i[l]||0,f=0;u<o;f++){let p=a.child(f%a.childCount);u+p.attrs.colspan>o&&(p=p.type.createChecked(wi(p.attrs,p.attrs.colspan,u+p.attrs.colspan-o),p.content)),d.push(p),u+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(L.from(d))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],d=t[l%e];for(let u=0;u<d.childCount;u++){let f=d.child(u);s+f.attrs.rowspan>r&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,r-f.attrs.rowspan)},f.content)),a.push(f)}i.push(L.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function UI(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=Wt(l);let d,u;if(r>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=d||(d=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<r;y++)m.push(g);n.insert(n.mapping.slice(s).map(p-1+o),m)}if(i>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;f.push(y?u||(u=a.header_cell.createAndFill()):d||(d=a.cell.createAndFill()))}const p=a.row.create(null,L.from(f)),h=[];for(let m=e.height;m<i;m++)h.push(p);n.insert(n.mapping.slice(s).map(o+t.nodeSize-2),h)}return!!(d||u)}function Y1(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let d=r;d<i;d++){const u=s*e.width+d,f=e.map[u];if(e.map[u-e.width]==f){a=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-s})),d+=p.attrs.colspan-1}}return a}function Q1(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let d=r;d<i;d++){const u=d*e.width+s,f=e.map[u];if(e.map[u-1]==f){a=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(l).map(f+o);n.setNodeMarkup(m,null,wi(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(wi(p.attrs,0,s-h))),d+=p.attrs.rowspan-1}}return a}function Z1(n,e,t,o,r){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=it.get(i);const{top:l,left:a}=o,d=a+r.width,u=l+r.height,f=n.tr;let p=0;function h(){if(i=t?f.doc.nodeAt(t-1):f.doc,!i)throw new Error("No table found");s=it.get(i),p=f.mapping.maps.length}UI(f,s,i,t,d,u,p)&&h(),Y1(f,s,i,t,a,d,l,p)&&h(),Y1(f,s,i,t,a,d,u,p)&&h(),Q1(f,s,i,t,l,u,a,p)&&h(),Q1(f,s,i,t,l,u,d,p)&&h();for(let m=l;m<u;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,d,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new j(r.rows[m-l],0,0))}h(),f.setSelection(new Pe(f.doc.resolve(t+s.positionAt(l,a,i)),f.doc.resolve(t+s.positionAt(u-1,d-1,i)))),e(f)}const WI=Sp({ArrowLeft:Bd("horiz",-1),ArrowRight:Bd("horiz",1),ArrowUp:Bd("vert",-1),ArrowDown:Bd("vert",1),"Shift-ArrowLeft":Rd("horiz",-1),"Shift-ArrowRight":Rd("horiz",1),"Shift-ArrowUp":Rd("vert",-1),"Shift-ArrowDown":Rd("vert",1),Backspace:Od,"Mod-Backspace":Od,Delete:Od,"Mod-Delete":Od});function $d(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Bd(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof Pe)return $d(t,o,ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=ex(r,n,e);if(s==null)return!1;if(n=="horiz")return $d(t,o,ie.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=z1(l,n,e);let d;return a?d=ie.near(a,1):e<0?d=ie.near(t.doc.resolve(l.before(-1)),-1):d=ie.near(t.doc.resolve(l.after(-1)),1),$d(t,o,d)}}}function Rd(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;let s;if(i instanceof Pe)s=i;else{const a=ex(r,n,e);if(a==null)return!1;s=new Pe(t.doc.resolve(a))}const l=z1(s.$headCell,n,e);return l?$d(t,o,new Pe(s.$anchorCell,l)):!1}}function qI(n,e){const t=n.state.doc,o=ki(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Pe(o))),!0):!1}function KI(n,e,t){if(!Xn(n.state))return!1;let o=HI(t);const r=n.state.selection;if(r instanceof Pe){o||(o={width:1,height:1,rows:[L.from(Qh(Wt(n.state.schema).cell,t))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=it.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=jI(o,l.right-l.left,l.bottom-l.top),Z1(n.state,n.dispatch,s,l,o),!0}else if(o){const i=Ad(n.state),s=i.start(-1);return Z1(n.state,n.dispatch,s,it.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function JI(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=tx(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof Pe)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=ki(n.state.selection.$anchor))!=null&&((t=Zh(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,d){let u=Zh(n,d);const f=$r.getState(n.state)==null;if(!u||!Yh(a,u))if(f)u=a;else return;const p=new Pe(a,u);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta($r,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),$r.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta($r,-1))}function l(a){const d=a,u=$r.getState(n.state);let f;if(u!=null)f=n.state.doc.resolve(u);else if(tx(n,d.target)!=o&&(f=Zh(n,e),!f))return s();f&&i(f,d)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function ex(n,e,t){if(!(n.state.selection instanceof q))return null;const{$head:o}=n.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((t<0?o.index(r):o.indexAfter(r))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=o.before(r),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function tx(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Zh(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:o,pos:r}=t;return o>=0&&ki(n.state.doc.resolve(o))||ki(n.state.doc.resolve(r))}var GI=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),em(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,em(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function em(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const d=n.firstChild;if(d){for(let f=0,p=0;f<d.childCount;f++){const{colspan:h,colwidth:m}=d.child(f).attrs;for(let g=0;g<h;g++,p++){const y=r==p?i:m&&m[g],b=y?y+"px":"";if(s+=y||o,y||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;a;){var u;const f=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const wn=new le("tableColumnResizing");function XI({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=GI,lastColumnResizable:r=!0}={}){const i=new ce({key:wn,state:{init(s,l){var a;const d=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Wt(l.schema).table.name;return o&&d&&(d[u]=(f,p)=>new o(f,t,p)),new YI(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=wn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{QI(s,l,n,r)},mouseleave:s=>{ZI(s)},mousedown:(s,l)=>{eL(s,l,e,t)}},decorations:s=>{const l=wn.getState(s);if(l&&l.activeHandle>-1)return iL(s,l.activeHandle)},nodeViews:{}}});return i}var YI=class Cf{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(wn);if(o&&o.setHandle!=null)return new Cf(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Cf(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return Xh(e.doc.resolve(r))||(r=-1),new Cf(r,t.dragging)}return t}};function QI(n,e,t,o){if(!n.editable)return;const r=wn.getState(n.state);if(r&&!r.dragging){const i=nL(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=nx(n,e,"left",t):a-e.clientX<=t&&(s=nx(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),d=it.get(a),u=l.start(-1);if(d.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==d.width-1)return}rx(n,s)}}}function ZI(n){if(!n.editable)return;const e=wn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&rx(n,-1)}function eL(n,e,t,o){var r;if(!n.editable)return!1;const i=(r=n.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,s=wn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=tL(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(wn,{setDragging:{startX:e.clientX,startWidth:a}}));function d(f){i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",u);const p=wn.getState(n.state);p!=null&&p.dragging&&(oL(n,p.activeHandle,ox(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(wn,{setDragging:null})))}function u(f){if(!f.which)return d(f);const p=wn.getState(n.state);if(p&&p.dragging){const h=ox(p.dragging,f,t);ix(n,p.activeHandle,h,o)}}return ix(n,s.activeHandle,a,o),i.addEventListener("mouseup",d),i.addEventListener("mousemove",u),e.preventDefault(),!0}function tL(n,e,{colspan:t,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=n.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=t;if(o)for(let a=0;a<t;a++)o[a]&&(s-=o[a],l--);return s/l}function nL(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function nx(n,e,t,o){const r=t=="right"?-o:o,i=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=ki(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=it.get(l.node(-1)),d=l.start(-1),u=a.map.indexOf(l.pos-d);return u%a.width==0?-1:d+a.map[u-1]}function ox(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function rx(n,e){n.dispatch(n.state.tr.setMeta(wn,{setHandle:e}))}function oL(n,e,t){const o=n.state.doc.resolve(e),r=o.node(-1),i=it.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let d=0;d<i.height;d++){const u=d*i.width+l;if(d&&i.map[u]==i.map[u-i.width])continue;const f=i.map[u],p=r.nodeAt(f).attrs,h=p.colspan==1?0:l-i.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():rL(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function ix(n,e,t,o){const r=n.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=it.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&em(i,a.firstChild,a,o,l,t)}function rL(n){return Array(n).fill(0)}function iL(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return Se.empty;const i=it.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let d=0;d<i.height;d++){const u=l+d*i.width;if((l==i.width-1||i.map[u]!=i.map[u+1])&&(d==0||i.map[u]!=i.map[u-i.width])){var a;const f=i.map[u],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=wn.getState(n))===null||a===void 0)&&a.dragging&&t.push(ze.node(s+f,s+f+r.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),t.push(ze.widget(p,h))}}return Se.create(n.doc,t)}function sL({allowTableNodeSelection:n=!1}={}){return new ce({key:$r,state:{init(){return null},apply(e,t){const o=e.getMeta($r);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:kI,handleDOMEvents:{mousedown:JI},createSelectionBetween(e){return $r.getState(e.state)!=null?e.state.selection:null},handleTripleClick:qI,handleKeyDown:WI,handlePaste:KI},appendTransaction(e,t,o){return CI(o,j1(o,t),n)}})}/**
166
- * Copyright 2026 Yiitap
167
- * @license MIT
168
- **/const Xo=new le("inlinePlaceholder"),sx=me.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1,onShowInline:n=>{},onHideInline:()=>{}}},addProseMirrorPlugins(){return[new ce({key:new le("placeholder"),props:{decorations:n=>{var l;const{doc:e,selection:t,tr:o}=n,r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=t,s=[];return(l=Xo.getState(n))!=null&&l.active||!r?null:(e.descendants((a,d)=>{const u=i>=d&&i<=d+a.nodeSize,f=!a.isLeaf&&!a.childCount,p=this.options.showOnlyCurrent;if((u||!p)&&f){const h=[this.options.emptyNodeClass];this.editor.isEmpty&&h.push(this.options.emptyEditorClass);const m=ze.node(d,d+a.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:d,hasAnchor:u}):this.options.placeholder});s.push(m)}return this.options.includeChildren}),Se.create(e,s))}}}),new ce({key:Xo,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(Xo);return t&&console.log("apply",t),(t==null?void 0:t.type)==="show"?{active:t.payload}:(t==null?void 0:t.type)==="hide"?{active:null}:e}},props:{decorations:n=>{var o;const e=(o=Xo.getState(n))==null?void 0:o.active;if(!e)return null;const t=ze.widget(e.pos,()=>{const r=document.createElement("span");return r.className="inline-placeholder",r.textContent=e.label||"Type...",r.addEventListener("click",()=>{this.options.onShowInline(e)}),r});return Se.create(n.doc,[t])}},view:()=>({destroy:this.options.onHideInline})})]}}),Dd=[{type:"paragraph",content:[]}],lL={type:"aiBlock",content:Dd},aL={type:"audio",attrs:{src:"//init.mp3"}},cL={type:"blockquote",content:Dd},dL={type:"callout",attrs:{icon:"💡"},content:Dd},uL={type:"codeBlock",attrs:{attrs:{language:"shell"}},content:[]},fL={type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:Dd}]},lx={type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
169
- Mermaid --> Diagram`}]},pL={type:"paragraph",content:[{type:"text",text:":"}]},hL={type:"image",attrs:{src:"init"}},mL=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],gL={type:"table",content:Array.from({length:3},()=>({type:"tableRow",content:Array.from({length:3},()=>({type:"tableCell",content:[{type:"paragraph"}]}))}))},yL=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],bL={type:"video",attrs:{src:"init"}};function xe(){const n=c.inject("isEditable",{value:!0});function e(i,s,l={}){if(!i.isEditable)return;const a=i==null?void 0:i.chain().focus(),d=i==null?void 0:i.commands;switch(s){case"inlineMath":o(i);break;default:t(d,a,s,l);break}}function t(i,s,l,a={}){switch(l){case"aiBlock":s.toggleAiBlock().run();break;case"audio":s.setAudio({src:"//init.mp3"}).run();break;case"highlight":a.color?i.setHighlight({color:a.color}):i.unsetHighlight();break;case"backgroundColor":a.color?i.setBackgroundColor(a.color):i.unsetBackgroundColor();break;case"blockMath":i.insertBlockMath({latex:""});break;case"blockquote":s.toggleBlockquote().run();break;case"bold":s.toggleBold().run();break;case"bulletList":s.toggleBulletList().run();break;case"callout":s.toggleCallout().run();break;case"clearFormat":s.unsetAllMarks().run();break;case"code":s.toggleCode().run();break;case"codeBlock":i.toggleCodeBlock({language:"bash"});break;case"color":s.setColor(a.color).run();break;case"copySelected":i.copySelected();break;case"content":i.insertContent(a.content);break;case"deleteSelected":i.deleteSelected();break;case"details":a.type==="detailsSummary"?i.unsetDetails():i.setDetails();break;case"diagram":i.insertContent(lx);break;case"duplicateSelected":i.duplicateSelected();break;case"emoji":i.insertContent(":");break;case"fontFamily":i.setFontFamily(a.fontFamily);break;case"heading":s.toggleHeading(a).run();break;case"horizontalRule":s.setHorizontalRule().run();break;case"image":s.setImage({src:"init"}).run();break;case"imageUpdate":s.setImage(a).run();break;case"inlineMathDelete":i.deleteInlineMath(a);break;case"inlineMathInsert":i.insertInlineMath(a);break;case"inlineMathUpdate":i.updateInlineMath(a);break;case"italic":s.toggleItalic().run();break;case"linkSet":s.extendMarkRange("link").setLink(a).run();break;case"linkUnset":s.extendMarkRange("link").unsetLink().run();break;case"modelViewer":s.setModelViewer({src:"init"}).run();break;case"multiColumn":i.insertMultiColumn(2);break;case"orderedList":s.toggleOrderedList().run();break;case"paragraph":s.setParagraph().run();break;case"strike":s.toggleStrike().run();break;case"subscript":i.toggleSubscript();break;case"superscript":i.toggleSuperscript();break;case"table":s.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":case"tableAddColumnAfter":s.addColumnAfter().run();break;case"tableAddColumnBefore":s.addColumnBefore().run();break;case"tableAddRow":case"tableAddRowAfter":s.addRowAfter().run();break;case"tableAddRowBefore":s.addRowBefore().run();break;case"tableCellAttribute":s.setCellAttribute(a.name,a.value).run();break;case"tableDeleteColumn":s.deleteColumn().run();break;case"tableDeleteRow":s.deleteRow().run();break;case"tableDelete":s.deleteTable().run();break;case"tableInsert":s.insertTable(a).run();break;case"tableMergeCells":s.mergeCells().run();break;case"tableSelectColumn":s.selectColumn(a.pos).run();break;case"tableSelectRow":s.selectRow(a.pos).run();break;case"tableSplitCell":s.splitCell().run();break;case"taskList":i.toggleTaskList();break;case"textAlign":s.setTextAlign(a.textAlign).run();break;case"underline":s.toggleUnderline().run();break;case"video":s.setVideo({src:"init"}).run()}}function o(i){const{state:s,view:l}=i,{from:a}=s.selection,u=l.domAtPos(a).node.getBoundingClientRect(),f=s.tr.setMeta(Xo,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:a,rect:u}}).setSelection(s.selection);l.dispatch(f)}function r(i){const s=[];return i.state.doc.descendants((l,a)=>{l.type.name==="image"&&s.push({pos:a,attrs:l.attrs})}),s}return{isEditable:n,onCommand:t,run:e,getEditorImages:r}}function tm(){const{tr:n}=de(),{isEditable:e,run:t}=xe(),o=c.ref(null),r=c.ref(!1),i=c.ref(!1),s=c.computed(()=>[{label:n("table.selectColumn"),value:"selectColumn",icon:"select_all"},{label:n("table.insertLeft"),value:"tableAddColumnBefore",icon:"arrow_back"},{label:n("table.insertRight"),value:"tableAddColumnAfter",icon:"arrow_back",class:"rotate-180"},{label:n("editor.delete"),value:"tableDeleteColumn",icon:"delete"}]),l=c.computed(()=>[{label:n("table.selectRow"),value:"selectRow",icon:"select_all"},{label:n("table.insertAbove"),value:"tableAddRowBefore",icon:"arrow_back",class:"rotate-90"},{label:n("table.insertBelow"),value:"tableAddRowAfter",icon:"arrow_back",class:"rotate-270"},{label:n("editor.delete"),value:"tableDeleteRow",icon:"delete"}]),a=c.computed(()=>{var C;const{state:h}=o.value.editor,m=(C=o.value)==null?void 0:C.getPos(),g=h.doc.resolve(m);let y=null,b=-1;for(let v=g.depth;v>0;v--)if(g.node(v).type.name==="table"){y=g.node(v),b=g.before(v);break}if(!y)return{rowIndex:-1,colIndex:-1};const k=it.get(y),x=m-b-1,w=k.findCell(x);return{rowIndex:w.top,colIndex:w.left}});function d(h){o.value=h}function u(){var h;r.value=!1,p("tableSelectColumn",{pos:(h=o.value)==null?void 0:h.getPos()})}function f(){var h;i.value=!1,p("tableSelectRow",{pos:(h=o.value)==null?void 0:h.getPos()})}function p(h,m={}){switch(console.log("runCommand",h,m),h){case"selectColumn":u();return;case"selectRow":f();return;case"tableAddRowAfter":case"tableAddRowBefore":case"tableDeleteRow":i.value=!1;break;case"tableAddColumnAfter":case"tableAddColumnBefore":case"tableDeleteColumn":r.value=!1;break}setTimeout(()=>{var g;t((g=o.value)==null?void 0:g.editor,h,m)},0)}return{showColPopover:r,showRowPopover:i,columnActions:s,rowActions:l,isEditable:e,cellInfo:a,initProps:d,selectColumn:u,selectRow:f,runCommand:p}}function xi(){const n=c.inject("darkMode",{value:!1}),e=c.computed(()=>n.value?"dark":"light");return{darkMode:n,theme:e}}const xn=c.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(n){const e=n,{theme:t}=xi(),o=c.ref(),r=c.ref(),i=c.ref();function s(){i.value=Go(o.value,{appendTo:()=>document.body,animation:"perspective",content:r.value,duration:e.duration,delay:e.delay,interactive:!0,offset:e.offset,placement:e.placement,trigger:e.trigger})}function l(){i.value.setProps({theme:t.value})}return c.watch(t,a=>{l()}),c.onMounted(()=>{s()}),c.onUnmounted(()=>{i.value&&i.value.destroy()}),(a,d)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"triggerRef",ref:o,"data-tippy-role":"tooltip"},[c.renderSlot(a.$slots,"trigger"),c.createElementVNode("div",{ref_key:"contentRef",ref:r,class:"tooltip-content"},[c.renderSlot(a.$slots,"default")],512)],512))}}),$e=c.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createBlock(xn,{class:"o-tooltip",placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("button",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:r[0]||(r[0]=i=>t("click",i))},[c.createVNode(X,{name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"]),c.renderSlot(o.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),kL=c.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const e=n,{run:t}=xe(),{tr:o}=de(),r=c.computed(()=>({aiBlock:{icon:"auto_awesome",tooltip:o("editor.aiBlock")},audio:{icon:"graphic_eq",tooltip:o("label.audio")},blockMath:{icon:"functions",tooltip:o("editor.blockMath")},blockquote:{icon:"format_quote_open",tooltip:o("editor.blockquote")},bold:{icon:"format_bold",tooltip:o("editor.bold")},callout:{icon:"card_text",tooltip:o("editor.callout")},clearFormat:{icon:"format_clear",tooltip:o("editor.removeFormat")},code:{icon:"code",tooltip:o("editor.code")},codeBlock:{icon:"code_braces",tooltip:o("editor.codeBlock")},diagram:{icon:"mermaid",tooltip:o("diagram.name")},horizontalRule:{icon:"horizontal_rule",tooltip:o("editor.hr")},italic:{icon:"format_italic",tooltip:o("editor.italic")},image:{icon:"image",tooltip:o("editor.photo")},inlineMath:{icon:"function",tooltip:o("editor.inlineMath")},inlineMathDelete:{icon:"close",tooltip:o("editor.delete")},linkUnset:{icon:"link_off",tooltip:o("link.off")},modelViewer:{icon:"3d_rotation",tooltip:o("label.modelViewer")},multiColumn:{icon:"view_column",tooltip:o("editor.multiColumn")},strike:{icon:"format_strikethrough",tooltip:o("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:o("editor.underline")},video:{icon:"videocam",tooltip:o("editor.video")}})),i=c.computed(()=>r.value[e.name]||{icon:"",isActive:!1,command:()=>{}});function s(){t(e.editor,e.name)}return(l,a)=>{var d;return c.openBlock(),c.createBlock($e,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive(n.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),nm=c.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"click"}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_left"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"},{label:t("editor.justify"),value:"justify",icon:"format_align_justify"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"textAlign",{textAlign:l})}return(l,a)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",placement:n.placement,trigger:n.trigger},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:c.unref(t)("editor.align")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,u)=>{var f;return c.openBlock(),c.createBlock(c.unref(kt),{key:u,class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive({textAlign:d.value})}),onClick:p=>s(d.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive({textAlign:d.value})?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),ax=c.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=xe(),s=c.ref(null),l=c.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function a(u){return t.modelValue===u.value}function d(u){var f;(f=s.value)==null||f.setShow(!1),o("download",u.value)}return(u,f)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:s,class:"o-simple-command-btn","content-class":"dropdown",placement:"bottom-end",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{"content-class":"o-code-block-download-dropdown dropdown",icon:"download",tooltip:c.unref(r)("label.download")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(p,h)=>(c.openBlock(),c.createBlock(c.unref(kt),{key:h,class:c.normalizeClass({"is-active":a(p)}),onClick:m=>d(p)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:p.icon},null,8,["name"])]),suffix:c.withCtx(()=>[a(p)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},512))}}),cx=c.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=xe(),s=c.ref(null),l=c.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:r("label.preview"),value:"preview",icon:"mermaid"},{label:r("label.splitHorizontal"),value:"splitHorizontal",icon:"splitscreen_right"},{label:r("label.splitVertical"),value:"splitVertical",icon:"splitscreen_bottom"},{label:r("label.help"),value:"help",icon:"help",suffixIcon:"open_in_new",separator:!0}]),a=c.computed(()=>l.value.find(f=>f.value===t.modelValue));function d(f){return t.modelValue===f.value}function u(f){var p;switch((p=s.value)==null||p.setShow(!1),f.value){case"help":window.open("https://mermaid.js.org/intro/","target");break;default:o("update:modelValue",f.value)}}return(f,p)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:s,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{"content-class":"o-code-block-view-dropdown dropdown",icon:a.value.icon,tooltip:c.unref(r)("label.view")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(h,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:m},[h.separator?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(kt),{class:c.normalizeClass({"is-active":d(h)}),onClick:g=>u(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:h.icon},null,8,["name"])]),suffix:c.withCtx(()=>[h.suffixIcon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:h.suffixIcon,small:""},null,8,["name"])):d(h)?(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(h.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),jK={key:1,class:"group o-tips"},dx=c.defineComponent({__name:"OExtensionDropdown",props:{editor:{type:St}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.computed(()=>[{label:t("editor.multiColumn"),value:"multiColumn",icon:"view_column"},{label:t("diagram.name"),value:"diagram",icon:"mermaid",separator:!0},{label:t("label.image"),value:"image",icon:"image",group:t("label.media"),separator:!0},{label:t("label.video"),value:"video",icon:"videocam"},{label:t("label.audio"),value:"audio",icon:"graphic_eq"},{label:t("label.model3d"),value:"modelViewer",icon:"3d_rotation"},{label:t("editor.inlineMath"),value:"inlineMath",icon:"function",separator:!0},{label:t("editor.blockMath"),value:"blockMath",icon:"functions"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,l)}return(l,a)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"extension","content-class":"o-extension-dropdown dropdown",tooltip:c.unref(t)("label.more")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,u)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:u},[d.separator?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),(d.group,c.createCommentVNode("",!0)),c.createVNode(c.unref(kt),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive(d.value)}),onClick:p=>s(d.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive(d.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),om=c.defineComponent({__name:"OLinkBtn",props:{editor:{type:St}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(!0);function a(){var p;s.value="",l.value=!0;const f=(p=e.editor)==null?void 0:p.getAttributes("link");f!=null&&f.href&&(s.value=f.href,l.value=f.target==="_blank",console.log("show",i.value,f,l.value))}function d(){var f;(f=r.value)==null||f.setShow(!1)}function u(f){var p;f?o(e.editor,"linkSet",{href:f,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(p=r.value)==null||p.setShow(!1)}return(f,p)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[p[1]||(p[1]=h=>i.value=h),a]},{trigger:c.withCtx(()=>{var h;return[c.createVNode(c.unref(bt),{icon:"link","content-class":{"is-active":(h=n.editor)==null?void 0:h.isActive("link")},tooltip:c.unref(t)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Hd),{key:0,title:c.unref(t)("editor.hyperlink"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(km),{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=h=>l.value=h),label:c.unref(t)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),wL={class:"o-block-placeholder"},xL={class:"icon"},CL={class:"placeholder"},ys=c.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("section",wL,[c.createElementVNode("div",xL,[c.createVNode(c.unref(X),{name:n.icon},null,8,["name"])]),c.createElementVNode("div",CL,c.toDisplayString(n.placeholder),1)]))}}),SL={class:"group o-tips"},vL={key:1,class:"item"},_d=c.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref([]),s=(h,m)=>{h&&(i.value[m]=h)},l=c.ref(0);function a(h,m,g){o("select",h,g),i.value[m]&&i.value[m].setShow(!1)}function d(){l.value=(l.value+t.items.length-1)%t.items.length}function u(){l.value=(l.value+1)%t.items.length}function f(){a(t.items[l.value],l.value)}function p(h){switch(h.key){case"ArrowUp":h.preventDefault(),d();break;case"ArrowDown":h.preventDefault(),u();break;case"Enter":h.preventDefault(),f();break}}return c.watch(()=>t.useKeyboard,h=>{h?window.addEventListener("keydown",p):window.removeEventListener("keydown",p)}),c.onMounted(()=>{t.useKeyboard&&window.addEventListener("keydown",p)}),c.onBeforeUnmount(()=>{t.useKeyboard&&window.removeEventListener("keydown",p)}),(h,m)=>(c.openBlock(),c.createBlock(c.unref(Et),{class:"o-block-list",hoverable:"",clickable:""},{default:c.withCtx(()=>[n.items.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(n.items,(g,y)=>{var b;return c.openBlock(),c.createElementBlock(c.Fragment,{key:y},[g.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[y>0?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",SL,c.toDisplayString(c.unref(r)(g.group)),1)],64)):c.createCommentVNode("",!0),(b=g.children)!=null&&b.length?(c.openBlock(),c.createBlock(c.unref(De),{key:1,ref_for:!0,ref:k=>s(k,y),placement:"right-start",offset:[-10,16]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(rm),{item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:""},null,8,["item","class"])]),default:c.withCtx(()=>[c.createVNode(c.unref(_d),{items:g.children,onSelect:k=>a(g,y,k)},null,8,["items","onSelect"])]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(rm),{key:2,item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:"",onClick:k=>a(g,y)},null,8,["item","class","onClick"]))],64)}),128)):(c.openBlock(),c.createElementBlock("div",vL,c.toDisplayString(c.unref(r)("label.noResults")),1))]),_:1}))}}),EL={key:0,class:"o-tips"},rm=c.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(n,{emit:e}){const{tr:t}=de();return(o,r)=>(c.openBlock(),c.createBlock(c.unref(kt),{class:"o-block-list-item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:n.item.icon,color:n.item.color},null,8,["name","color"])]),suffix:c.withCtx(()=>{var i;return[n.item.tips?(c.openBlock(),c.createElementBlock("span",EL,c.toDisplayString(n.item.tips),1)):c.createCommentVNode("",!0),(i=n.item.children)!=null&&i.length?(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:"navigate_next",class:"o-tips"})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)(n.item.label)),1)]),_:1}))}}),ux=(n,e)=>_p(e,n.extensionManager.extensions),im=(n,e)=>{const t=document.createElement("div");return t.innerHTML=e,dr.fromSchema(n.schema).parse(t).toJSON()},ML=(n,e)=>{const t=document.createElement("div");return t.innerHTML=e,dr.fromSchema(n.schema).parse(t).toJSON()},fx=()=>{const n=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return{mod:n?"⌘":"Ctrl",alt:n?"⌥":"Alt",shift:n?"⇧":"Shift",ctrl:n?"⌃":"Ctrl",meta:n?"⌘":"Meta"}},px=n=>{const e=n==null?void 0:n.split("+").map(r=>r.trim().toLowerCase()).filter(Boolean);if(!e||!e.length)return n;const t=fx();return e.map(r=>t[r]??r.toUpperCase()).join("+")},ke={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},ql=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",keywords:"h1",tips:"#",icon:"format_h1",color:ke.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:ke.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:ke.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:ke.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:ke.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:ke.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:ke.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:ke.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:ke.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:ke.blue},{label:"editor.callout",value:"callout",color:ke.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:ke.blue}],Id=ql.filter(n=>n.style),Ld=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:ke.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:ke.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:ke.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:ke.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:ke.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:ke.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:ke.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:ke.purple},{label:"label.audio",value:"audio",icon:"graphic_eq",tips:"audio",color:ke.teal},{label:"label.model3d",value:"modelViewer",icon:"3d_rotation",tips:"model",color:ke.purple}],hx=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:ke.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:ke.indigo,tips:"math",keywords:"block, math, equation"},{label:"editor.multiColumn",value:"multiColumn",icon:"view_column",color:ke.amber,tips:"column",keywords:"column,columns"}],Pd=[...ql,...Ld,...hx],Vd=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:ke.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:ke.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:ke.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:ke.blue,filter:"audio,image,video,modelViewer"},{label:"label.color",value:"color",icon:"palette",color:ke.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:ke.purple,filter:"callout",component:"OCalloutColorBoard"}],mx=[{label:"ai.improveWriting",value:"improveWriting",icon:"title",color:ke.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fixSpellingGrammar",value:"fixSpellingGrammar",icon:"spellcheck",color:ke.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrichWithEmoji",value:"enrichWithEmoji",icon:"emoji_emotions",color:ke.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:ke.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.english",value:"English",icon:"language"},{label:"language.chineseSimplified",value:"Simplified Chinese",icon:"language"},{label:"language.chineseTraditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"},{label:"language.portuguese",value:"Portuguese",icon:"language"},{label:"language.spanish",value:"Spanish",icon:"language"},{label:"language.russian",value:"Russian",icon:"language"},{label:"language.italian",value:"Italian",icon:"language"},{label:"language.vietnamese",value:"Vietnamese",icon:"language"},{label:"language.polish",value:"Polish",icon:"language"},{label:"language.indonesian",value:"Indonesian",icon:"language"}]},{label:"ai.makeLonger",value:"makeLonger",icon:"subject",color:ke.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.makeShorter",value:"makeShorter",icon:"short_text",color:ke.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.changeTone",value:"changeTone",icon:"invert_colors",color:ke.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:ke.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],gx=[{label:"ai.summarize",value:"summarize",icon:"notes",color:ke.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:ke.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],TL={key:1,class:"group o-tips"},NL={class:"suffix o-tips"},AL={key:1,class:"item"},Yo=c.defineComponent({__name:"OBlockMenu",props:{...ut,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=xe(),s=c.ref([]),l=c.computed(()=>{var b;return(b=t.node)==null?void 0:b.type.name}),a=c.computed(()=>Id.find(b=>b.value===l.value)),d=c.computed(()=>{const b=a.value?Vd.filter(w=>{var C;return((C=w.filter)==null?void 0:C.indexOf("style"))>=0})??[]:[];let k=Vd.filter(w=>{var C;return((C=w.filter)==null?void 0:C.indexOf(l.value))>=0})??[];if(k=k.concat(b),k.length>0){const w=k[0];w.group=`editor.${l.value}`}const x=Vd.filter(w=>{var C;return((C=w.filter)==null?void 0:C.indexOf("common"))>=0});return[...k,...x]});function u(b){switch(b.component){case"OCalloutColorBoard":return sm;case"OTextColorBoard":return lm;default:return null}}function f(b){setTimeout(()=>{p(b),o("action",b)},0)}function p(b){switch(b.value){case"copy":h();break;case"delete":m();break;case"duplicate":g();break}}function h(){i(t.editor,"copySelected")}function m(){i(t.editor,"deleteSelected")}function g(){i(t.editor,"duplicateSelected")}function y(b,k){switch(console.log("select",b,k),k.name){case"backColor":t.updateAttributes({backColor:k.value});break;case"foreColor":t.updateAttributes({borderColor:k.value});break;case"color":i(t.editor,k.name,{color:k.value});break;case"backgroundColor":i(t.editor,k.name,{color:k.value});break}}return(b,k)=>(c.openBlock(),c.createBlock(c.unref(Et),{class:"o-block-menu",hoverable:"",clickable:""},{default:c.withCtx(()=>[d.value.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(d.value,(x,w)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:w},[x.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[w>0||a.value?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),n.showGroup?(c.openBlock(),c.createElementBlock("div",TL,c.toDisplayString(c.unref(r)(x.group)),1)):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),u(x)?(c.openBlock(),c.createBlock(c.unref(De),{key:1,ref_for:!0,ref:s.value[x.value],offset:[0,4],placement:"right"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(kt),{class:"item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:x.icon,color:n.colorful?x.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"navigate_next",class:"o-tips"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(x.label)),1)]),_:2},1024)]),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(u(x)),{onSelect:C=>y(x,C)},null,40,["onSelect"]))]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(kt),{key:2,class:"item",clickable:"",onClick:c.withModifiers(C=>f(x),["stop"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:x.icon,color:n.colorful?x.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("div",NL,c.toDisplayString(c.unref(px)(x.tips)),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(x.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(c.openBlock(),c.createElementBlock("div",AL,"No result"))]),_:1}))}}),wo=c.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(n,{emit:e}){const t=n,o=e,r=c.ref();function i(l){o("update:modelValue",l)}function s(){console.log("click outside"),t.hideClickOutside&&o("update:modelValue",!1)}return c.watch(()=>t.modelValue,l=>{var a,d;l&&!t.readonly?(a=r.value)==null||a.setShow(!0):(d=r.value)==null||d.setShow(!1)}),c.onMounted(()=>{var l;t.modelValue&&((l=r.value)==null||l.setShow(!0))}),c.onUnmounted(()=>{var l;(l=r.value)==null||l.setShow(!1)}),(l,a)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,placement:n.placement,"tippy-class":n.tippyClass,"content-class":n.contentClass,trigger:"manual",arrow:n.showArrow,offset:n.offset,show:n.modelValue&&!n.readonly,"onUpdate:show":i,onClickoutside:s},{trigger:c.withCtx(()=>[c.renderSlot(l.$slots,"default")]),default:c.withCtx(()=>[c.renderSlot(l.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),OL={class:"o-block-toolbar editable-only"},$L={class:"button-group"},Kl=c.defineComponent({__name:"OBlockToolbar",props:{...ut,type:{type:String,default:"link"},trigger:{type:String,default:"click"}},emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{isEditable:s,run:l}=xe(),a=c.ref();function d(u){var f;o("action",u),(f=a.value)==null||f.setShow(!1)}return(u,f)=>(c.openBlock(),c.createElementBlock("div",OL,[c.createElementVNode("section",$L,[c.renderSlot(u.$slots,"default"),c.createVNode(c.unref(De),{ref_key:"popover",ref:a,placement:"bottom-end",size:"medium",trigger:n.trigger,"show-arrow":!1},{trigger:c.withCtx(()=>[c.unref(s)?(c.openBlock(),c.createBlock(c.unref(bt),{key:0,icon:"more_horiz",tooltip:c.unref(i)("label.more")},null,8,["tooltip"])):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createVNode(c.unref(Yo),c.mergeProps(t,{onAction:d}),null,16)]),_:1},8,["trigger"])])]))}}),BL={class:"o-callout-color-board"},RL={class:"fore-colors"},DL={class:"color-row"},_L={class:"color-row"},IL={class:"back-colors"},LL={class:"color-row"},PL={class:"color-row"},sm=c.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e;function o(s,l){t("select",{name:s,value:l.value})}const r=c.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),i=c.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,l)=>(c.openBlock(),c.createElementBlock("section",BL,[c.createElementVNode("section",RL,[l[4]||(l[4]=c.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),c.createElementVNode("div",DL,[c.createVNode(c.unref($e),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:l[0]||(l[0]=a=>o("foreColor",{value:""}))}),n.foreColor?(c.openBlock(),c.createBlock(c.unref($e),{key:0,tooltip:"Last used","content-style":{borderColor:n.foreColor},onClick:l[1]||(l[1]=a=>o("foreColor",{value:n.foreColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",_L,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,d)=>(c.openBlock(),c.createBlock(c.unref($e),{key:`col-${d}`,tooltip:a.label,"content-style":{borderColor:a.value},onClick:u=>o("foreColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])]),c.createElementVNode("section",IL,[l[5]||(l[5]=c.createElementVNode("div",{class:"label o-tips"},"Background",-1)),c.createElementVNode("div",LL,[c.createVNode(c.unref($e),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:l[2]||(l[2]=a=>o("backColor",{value:"#F5F5F5"}))}),n.backColor?(c.openBlock(),c.createBlock(c.unref($e),{key:0,"content-style":{backgroundColor:n.backColor},tooltip:"Last used","content-class":"border",onClick:l[3]||(l[3]=a=>o("backColor",{value:n.backColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",PL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(a,d)=>(c.openBlock(),c.createBlock(c.unref($e),{key:`col-${d}`,tooltip:a.label,"content-style":{backgroundColor:a.value},onClick:u=>o("backColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),VL=c.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:o}=de(),{run:r}=xe(),i=c.ref(null),s=c.ref(""),l=c.ref("");function a(d,u){d==="foreColor"?(s.value=u,localStorage.setItem("yiitap.text-color.fore",u)):d==="backColor"&&(l.value=u,localStorage.setItem("yiitap.text-color.back",u)),t("select",d,u)}return c.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",l.value=localStorage.getItem("yiitap.text-color.back")||""}),(d,u)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:i,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"palette",tooltip:c.unref(o)("editor.textColor")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var f;return[c.createVNode(c.unref(sm),{"fore-color":s.value,"back-color":l.value,"default-label":c.unref(o)("editor.defaultColor"),"active-color":(f=n.editor)==null?void 0:f.getAttributes("textStyle").color,onSelect:a},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),Ci=c.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=c.ref();c.computed(()=>{var l;return t.clientX||((l=t.event)==null?void 0:l.clientX)||0}),c.computed(()=>{var l;return t.clientY||((l=t.event)==null?void 0:l.clientY)||0});function i(l){o("update:modelValue",l)}function s(){o("update:modelValue",!1)}return c.watch(()=>t.modelValue,l=>{var a;l?setTimeout(()=>{var d;(d=r.value)==null||d.setShow(l)},0):(a=r.value)==null||a.setShow(l)}),(l,a)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,placement:"bottom-start",trigger:"manual",show:n.modelValue,"show-arrow":!1,event:n.event,"onUpdate:show":i,onClickoutside:s},{default:c.withCtx(()=>[c.renderSlot(l.$slots,"default")]),_:3},8,["show","event"]))}}),zL={class:"o-color-board"},HL={class:"cell-container"},FL={class:"label"},jL=["onClick"],Si=c.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},defaultDisabled:{type:Boolean,default:!1},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=n,o=e;function r(a){o("select",a.hex)}function i(a){return t.activeColor===a}function s(a){return"abc"}const l=c.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(a,d)=>(c.openBlock(),c.createElementBlock("section",zL,[n.defaultDisabled?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"default-color",onClick:d[0]||(d[0]=u=>r({hex:n.defaultColor}))},[c.createElementVNode("div",HL,[c.createElementVNode("div",{class:"cell border",style:c.normalizeStyle({background:n.defaultColor})},[c.createVNode(c.unref(X),{name:"slash_forward"})],4)]),c.createElementVNode("div",FL,c.toDisplayString(n.defaultLabel),1)])),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(u,f)=>(c.openBlock(),c.createElementBlock("div",{class:"color-row",key:`row-${f}`},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u,(p,h)=>(c.openBlock(),c.createElementBlock("div",{class:"",key:`col-${h}`},[c.createElementVNode("div",{class:"cell-container",onClick:m=>r(p)},[c.createElementVNode("div",{class:c.normalizeClass(["cell",{border:p.border}]),style:c.normalizeStyle({backgroundColor:p.hex})},[i(p.hex)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",style:c.normalizeStyle({color:s(p.rgb)})},null,8,["style"])):c.createCommentVNode("",!0)],6)],8,jL)]))),128))]))),128))]))}}),bt=c.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createBlock(c.unref(xn),{placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("button",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:r[0]||(r[0]=i=>t("click",i))},[n.icon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"])):c.createCommentVNode("",!0),c.renderSlot(o.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),UL={key:0,class:"o-doc-toc toc"},WL={class:"mini-view"},qL={class:"toc__list"},KL={class:"main-view o-scroll",style:{"max-width":"480px"}},JL={class:"toc__title"},GL={class:"toc__list"},XL=["onClick"],YL=c.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:St},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(n,{expose:e,emit:t}){const o=n,r=t,{tr:i}=de(),s=c.ref([]),l=c.ref("");function a(){var h;l.value=window.location.hash,(h=o.editor)==null||h.on("update",u),setTimeout(()=>{d(),u()},0)}function d(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",f)}function u(){var m;const h=[];(m=o.editor)==null||m.state.doc.descendants((g,y)=>{if(g.type.name==="heading"){const b=g.attrs.id;h.push({level:g.attrs.level,text:g.textContent,id:b})}}),s.value=h}function f(h){for(const m of s.value){const g=document.querySelector(`[data-id="${m.id}"]`);if(!g)continue;const y=g.getBoundingClientRect();if(y.top>=0&&y.top<window.innerHeight/2){l.value=m.id;break}}r("docScroll",h)}function p(h){l.value=h.id;const m=document.querySelector(`[data-id="${h.id}"]`);m&&m.scrollIntoView({behavior:"smooth",block:"start"})}return c.watch(()=>o.editor,h=>{a()}),e({onScroll:f,headings:s}),(h,m)=>s.value.length?(c.openBlock(),c.createElementBlock("section",UL,[c.createVNode(c.unref(De),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:c.withCtx(()=>[c.createElementVNode("div",WL,[c.createElementVNode("ul",qL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(g,y)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:y},[g.level<=Math.max(Math.min(n.maxLevel,3),2)?(c.openBlock(),c.createElementBlock("li",{key:0,class:c.normalizeClass(["toc__item",[l.value===g.id?"selected":"",`toc__item--${g.level}`]])},null,2)):c.createCommentVNode("",!0)],64))),128))])])]),default:c.withCtx(()=>[c.createElementVNode("div",KL,[c.createElementVNode("div",JL,c.toDisplayString(c.unref(i)("label.toc")),1),c.renderSlot(h.$slots,"title"),c.createElementVNode("ul",GL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(g,y)=>(c.openBlock(),c.createElementBlock("li",{class:c.normalizeClass(["toc__item",`toc__item--${g.level}`]),key:y},[c.createElementVNode("span",{class:c.normalizeClass(["heading",{selected:l.value===g.id}]),onClick:b=>p(g)},c.toDisplayString(g.text),11,XL)],2))),128))])])]),_:3},512)])):c.createCommentVNode("",!0)}}),QL={class:"o-emoji-select"},ZL={key:0},eP={class:"groups o-scroll"},tP={class:"items"},nP=["onClick"],oP={key:0,class:"groups-empty"},rP={class:"group-icons"},iP=["onClick"],zd=c.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,r=c.ref(null),i=c.ref(""),s=c.ref([]),l=c.ref([]),a=c.ref(0),d=c.computed(()=>i.value?s.value:t.items),u=c.computed(()=>{let m=!1;return d.value.map(g=>{m=m||g.emojis.length}),m});function f(){a.value=0,s.value=i.value?qs.filterEmojiGroups(i.value):[]}function p(m){o("select",m)}function h(m,g){a.value=g,l.value[g].scrollIntoView({behavior:"instant",block:"start"})}return c.onMounted(()=>{}),(m,g)=>(c.openBlock(),c.createElementBlock("section",QL,[n.enableSearch?(c.openBlock(),c.createElementBlock("div",ZL,[c.createVNode(c.unref(jn),{ref_key:"input",ref:r,modelValue:i.value,"onUpdate:modelValue":[g[0]||(g[0]=y=>i.value=y),f],type:"text",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("section",eP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,(y,b)=>{var k;return c.withDirectives((c.openBlock(),c.createElementBlock("div",{key:`group-${b}`,class:"group"},[c.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:l},c.toDisplayString(y.name),513),c.createElementVNode("section",tP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(y.emojis,(x,w)=>(c.openBlock(),c.createElementBlock("div",{key:`item-${w}`},[c.createElementVNode("div",{class:"item",onClick:C=>p(x)},c.toDisplayString(x.emoji),9,nP)]))),128))])],512)),[[c.vShow,(k=y.emojis)==null?void 0:k.length]])}),128)),u.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",oP,"没有记录"))]),c.createElementVNode("section",rP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,(y,b)=>(c.openBlock(),c.createBlock(c.unref(xn),{key:`target-${b}`,delay:300},{trigger:c.withCtx(()=>{var k;return[c.withDirectives(c.createElementVNode("div",{class:c.normalizeClass(["item",{active:a.value===b}]),onClick:x=>h(y,b)},[c.createVNode(c.unref(X),{name:c.unref(qs.emojiGroupIcons)[y.slug]},null,8,["name"])],10,iP),[[c.vShow,(k=y.emojis)==null?void 0:k.length]])]}),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(y.name),1)]),_:2},1024))),128))])]))}}),Jl=[{label:"1C Enterprise",value:"1c",ext:["1c","v8c"],icon:"code_blocks"},{label:"ABNF",value:"abnf",ext:["abnf"],icon:"code_blocks"},{label:"Access Log",value:"accesslog",ext:["log"],icon:"code_blocks"},{label:"ActionScript",value:"actionscript",ext:["as"],icon:"code_blocks"},{label:"Ada",value:"ada",ext:["adb","ads","ada"],icon:"code_blocks"},{label:"AngelScript",value:"angelscript",ext:["as","asc"],icon:"code_blocks"},{label:"Apache Config",value:"apache",ext:["conf","htaccess"],icon:"code_blocks"},{label:"AppleScript",value:"applescript",ext:["scpt","applescript"],icon:"code_blocks"},{label:"Arcade",value:"arcade",ext:["arcade"],icon:"code_blocks"},{label:"Arduino",value:"arduino",ext:["ino","pde"],icon:"code_blocks"},{label:"ARM Assembly",value:"armasm",ext:["s","asm"],icon:"code_blocks"},{label:"AsciiDoc",value:"asciidoc",ext:["adoc","asciidoc"],icon:"code_blocks"},{label:"AspectJ",value:"aspectj",ext:["aj"],icon:"code_blocks"},{label:"AutoHotkey",value:"autohotkey",ext:["ahk"],icon:"code_blocks"},{label:"AutoIt",value:"autoit",ext:["au3"],icon:"code_blocks"},{label:"AVR Assembly",value:"avrasm",ext:["s","asm"],icon:"code_blocks"},{label:"AWK",value:"awk",ext:["awk","gawk","mawk"," nawk"],icon:"code_blocks"},{label:"Axapta",value:"axapta",ext:["xpo","axp"],icon:"code_blocks"},{label:"BASIC",value:"basic",ext:["bas"],icon:"code_blocks"},{label:"Bash",value:"bash",ext:["sh","bash","zsh"],icon:"code_blocks"},{label:"BNF",value:"bnf",ext:["bnf"],icon:"code_blocks"},{label:"Brainfuck",value:"brainfuck",ext:["bf","b"],icon:"code_blocks"},{label:"CAL",value:"cal",ext:["cal"],icon:"code_blocks"},{label:"Capn Proto",value:"capnproto",ext:["capnp"],icon:"code_blocks"},{label:"Ceylon",value:"ceylon",ext:["ceylon"],icon:"code_blocks"},{label:"Clean",value:"clean",ext:["icl","dcl","prg"],icon:"code_blocks"},{label:"Clojure",value:"clojure",ext:["clj","cljs","cljc"],icon:"code_blocks"},{label:"Clojure REPL",value:"clojure-repl",ext:["clj"],icon:"code_blocks"},{label:"CMake",value:"cmake",ext:["cmake","CMakeLists.txt"],icon:"code_blocks"},{label:"CoffeeScript",value:"coffeescript",ext:["coffee","litcoffee"],icon:"code_blocks"},{label:"Coq",value:"coq",ext:["v"],icon:"code_blocks"},{label:"COS",value:"cos",ext:["cos"],icon:"code_blocks"},{label:"C++",value:"cpp",ext:["cpp","hpp","cc","cxx","h","hxx"],icon:"code_blocks"},{label:"crmsh",value:"crmsh",ext:["crm","pcs"],icon:"code_blocks"},{label:"Crystal",value:"crystal",ext:["cr"],icon:"code_blocks"},{label:"C#",value:"csharp",ext:["cs"],icon:"code_blocks"},{label:"CSP",value:"csp",ext:["csp"],icon:"code_blocks"},{label:"CSS",value:"css",ext:["css"],icon:"code_blocks"},{label:"C",value:"c",ext:["c","h"],icon:"code_blocks"},{label:"D",value:"d",ext:["d","di"],icon:"code_blocks"},{label:"Dart",value:"dart",ext:["dart"],icon:"code_blocks"},{label:"Delphi",value:"delphi",ext:["pas","dfm","dpr","dpk"],icon:"code_blocks"},{label:"Diff",value:"diff",ext:["diff","patch"],icon:"code_blocks"},{label:"Django",value:"django",ext:["html","py","css","js"],icon:"code_blocks"},{label:"DNS Zone File",value:"dns",ext:["zone","dns"],icon:"code_blocks"},{label:"Dockerfile",value:"dockerfile",ext:["Dockerfile","dockerfile"],icon:"code_blocks"},{label:"DOS Batch",value:"dos",ext:["bat","cmd"],icon:"code_blocks"},{label:"dsconfig",value:"dsconfig",ext:["dsconfig"],icon:"code_blocks"},{label:"DTS",value:"dts",ext:["dts","dtsi"],icon:"code_blocks"},{label:"Dust",value:"dust",ext:["dust","dst"],icon:"code_blocks"},{label:"EBNF",value:"ebnf",ext:["ebnf"],icon:"code_blocks"},{label:"Elixir",value:"elixir",ext:["ex","exs"],icon:"code_blocks"},{label:"Elm",value:"elm",ext:["elm"],icon:"code_blocks"},{label:"ERB",value:"erb",ext:["erb","rhtml"],icon:"code_blocks"},{label:"Erlang",value:"erlang",ext:["erl","hrl"],icon:"code_blocks"},{label:"Erlang REPL",value:"erlang-repl",ext:["erl"],icon:"code_blocks"},{label:"Excel",value:"excel",ext:["xls","xlsx"],icon:"code_blocks"},{label:"FIX",value:"fix",ext:["fix"],icon:"code_blocks"},{label:"Flix",value:"flix",ext:["flix"],icon:"code_blocks"},{label:"Fortran",value:"fortran",ext:["f","for","f90","f95","f03","f08"],icon:"code_blocks"},{label:"F#",value:"fsharp",ext:["fs","fsi","fsx"],icon:"code_blocks"},{label:"GAMS",value:"gams",ext:["gms","gams"],icon:"code_blocks"},{label:"Gauss",value:"gauss",ext:["gss","prg"],icon:"code_blocks"},{label:"G-code",value:"gcode",ext:["nc","gcode","g","ngc"],icon:"code_blocks"},{label:"Gherkin",value:"gherkin",ext:["feature"],icon:"code_blocks"},{label:"GLSL",value:"glsl",ext:["vert","frag","geom","comp","tesc","tese","glsl"],icon:"code_blocks"},{label:"GameMaker Language",value:"gml",ext:["gml","gm81","gm"],icon:"code_blocks"},{label:"Golo",value:"golo",ext:["golo"],icon:"code_blocks"},{label:"Go",value:"go",ext:["go"],icon:"code_blocks"},{label:"Gradle",value:"gradle",ext:["gradle","gradle.kts"],icon:"code_blocks"},{label:"GraphQL",value:"graphql",ext:["graphql","gql"],icon:"code_blocks"},{label:"Groovy",value:"groovy",ext:["groovy","gvy","gy","gsh"],icon:"code_blocks"},{label:"Haml",value:"haml",ext:["haml"],icon:"code_blocks"},{label:"Handlebars",value:"handlebars",ext:["hbs","handlebars","html"],icon:"code_blocks"},{label:"Haskell",value:"haskell",ext:["hs","lhs"],icon:"code_blocks"},{label:"Haxe",value:"haxe",ext:["hx"],icon:"code_blocks"},{label:"HSP",value:"hsp",ext:["hsp"],icon:"code_blocks"},{label:"HTML",value:"html",ext:["html"],icon:"code_blocks"},{label:"HTTP",value:"http",ext:["http","rest"],icon:"code_blocks"},{label:"Hy",value:"hy",ext:["hy"],icon:"code_blocks"},{label:"Inform 7",value:"inform7",ext:["ni","i7x"],icon:"code_blocks"},{label:"INI",value:"ini",ext:["ini","cfg","conf"],icon:"code_blocks"},{label:"IRPF90",value:"irpf90",ext:["90","f90","f95","f03","f08"],icon:"code_blocks"},{label:"ISBL",value:"isbl",ext:["isbl"],icon:"code_blocks"},{label:"Java",value:"java",ext:["java"],icon:"code_blocks"},{label:"JavaScript",value:"javascript",ext:["js","jsx"],icon:"code_blocks"},{label:"JBoss CLI",value:"jboss-cli",ext:["cli"],icon:"code_blocks"},{label:"Julia",value:"julia",ext:["jl"],icon:"code_blocks"},{label:"Julia REPL",value:"julia-repl",ext:["jl"],icon:"code_blocks"},{label:"JSON",value:"json",ext:["json"],icon:"code_blocks"},{label:"Kotlin",value:"kotlin",ext:["kt","kts"],icon:"code_blocks"},{label:"Lasso",value:"lasso",ext:["lasso","ls","lasso9"],icon:"code_blocks"},{label:"LaTeX",value:"latex",ext:["tex","latex"],icon:"code_blocks"},{label:"LDIF",value:"ldif",ext:["ldif"],icon:"code_blocks"},{label:"Leaf",value:"leaf",ext:["leaf"],icon:"code_blocks"},{label:"Less",value:"less",ext:["less"],icon:"code_blocks"},{label:"Lisp",value:"lisp",ext:["lisp","lsp","cl"],icon:"code_blocks"},{label:"LiveCode Server",value:"livecodeserver",ext:["lc","livecode"],icon:"code_blocks"},{label:"LiveScript",value:"livescript",ext:["ls"],icon:"code_blocks"},{label:"LLVM",value:"llvm",ext:["ll","bc"],icon:"code_blocks"},{label:"LSL",value:"lsl",ext:["lsl"],icon:"code_blocks"},{label:"Lua",value:"lua",ext:["lua"],icon:"code_blocks"},{label:"Makefile",value:"makefile",ext:["make","Makefile","GNUmakefile"],icon:"code_blocks"},{label:"Markdown",value:"markdown",ext:["md","markdown","mdown","mkdn"],icon:"code_blocks"},{label:"Mathematica",value:"mathematica",ext:["nb","m","wl"],icon:"code_blocks"},{label:"MATLAB",value:"matlab",ext:["m"],icon:"code_blocks"},{label:"Maxima",value:"maxima",ext:["mac","max"],icon:"code_blocks"},{label:"MEL",value:"mel",ext:["mel"],icon:"code_blocks"},{label:"Mermaid",value:"mermaid",ext:["mermaid"],icon:"mermaid"},{label:"Mercury",value:"mercury",ext:["m","moo"],icon:"code_blocks"},{label:"MIPS Assembly",value:"mipsasm",ext:["s","asm"],icon:"code_blocks"},{label:"Mizar",value:"mizar",ext:["miz"],icon:"code_blocks"},{label:"Mojolicious",value:"mojolicious",ext:["pl","pm"],icon:"code_blocks"},{label:"Monkey",value:"monkey",ext:["monkey","mk"],icon:"code_blocks"},{label:"MoonScript",value:"moonscript",ext:["moon"],icon:"code_blocks"},{label:"N1QL",value:"n1ql",ext:["n1ql"],icon:"code_blocks"},{label:"NestedText",value:"nestedtext",ext:["nt"],icon:"code_blocks"},{label:"Nginx",value:"nginx",ext:["conf","nginx"],icon:"code_blocks"},{label:"Nim",value:"nim",ext:["nim","nims"],icon:"code_blocks"},{label:"Nix",value:"nix",ext:["nix"],icon:"code_blocks"},{label:"Node.js REPL",value:"node-repl",ext:["js"],icon:"code_blocks"},{label:"NSIS",value:"nsis",ext:["nsi","nsh"],icon:"code_blocks"},{label:"Objective-C",value:"objectivec",ext:["m","mm"],icon:"code_blocks"},{label:"OCaml",value:"ocaml",ext:["ml","mli","mll","mly"],icon:"code_blocks"},{label:"OpenSCAD",value:"openscad",ext:["scad"],icon:"code_blocks"},{label:"Oxygene",value:"oxygene",ext:["pas","dpr","pp"],icon:"code_blocks"},{label:"Parser3",value:"parser3",ext:["p3"],icon:"code_blocks"},{label:"Perl",value:"perl",ext:["pl","pm","t","pod"],icon:"code_blocks"},{label:"PF",value:"pf",ext:["pf"],icon:"code_blocks"},{label:"PostgreSQL",value:"pgsql",ext:["sql","pgsql"],icon:"code_blocks"},{label:"PHP Template",value:"php-template",ext:["phtml","php"],icon:"code_blocks"},{label:"PHP",value:"php",ext:["php","php3","php4","php5","phps","phpt"],icon:"code_blocks"},{label:"Plain Text",value:"plaintext",ext:["txt","text","md","markdown"],icon:"code_blocks"},{label:"Pony",value:"pony",ext:["pony"],icon:"code_blocks"},{label:"PowerShell",value:"powershell",ext:["ps1","psm1","psd1"],icon:"code_blocks"},{label:"Processing",value:"processing",ext:["pde"],icon:"code_blocks"},{label:"Profile",value:"profile",ext:["profile","rc","bashrc","zshrc"],icon:"code_blocks"},{label:"Prolog",value:"prolog",ext:["pl","pro","prolog"],icon:"code_blocks"},{label:"Properties",value:"properties",ext:["properties","ini","cfg"],icon:"code_blocks"},{label:"Protocol Buffers",value:"protobuf",ext:["proto"],icon:"code_blocks"},{label:"Puppet",value:"puppet",ext:["pp"],icon:"code_blocks"},{label:"PureBasic",value:"purebasic",ext:["pb","pbi"],icon:"code_blocks"},{label:"Python REPL",value:"python-repl",ext:["py"],icon:"code_blocks"},{label:"Python",value:"python",ext:["py","pyw","cpy","gyp"],icon:"code_blocks"},{label:"Q",value:"q",ext:["q"],icon:"code_blocks"},{label:"QML",value:"qml",ext:["qml","js"],icon:"code_blocks"},{label:"R",value:"r",ext:["r","R","rmd","Rmd"],icon:"code_blocks"},{label:"ReasonML",value:"reasonml",ext:["re","rei"],icon:"code_blocks"},{label:"RIB",value:"rib",ext:["rib"],icon:"code_blocks"},{label:"Roboconf",value:"roboconf",ext:["graph","instances"],icon:"code_blocks"},{label:"RouterOS",value:"routeros",ext:["rsc","txt"],icon:"code_blocks"},{label:"RSL",value:"rsl",ext:["rsl"],icon:"code_blocks"},{label:"Ruby",value:"ruby",ext:["rb","rbw","rake","gemspec","ru"],icon:"code_blocks"},{label:"Rust",value:"rust",ext:["rs","rlib"],icon:"code_blocks"},{label:"Rules Language",value:"ruleslanguage",ext:["rules"],icon:"code_blocks"},{label:"SAS",value:"sas",ext:["sas"],icon:"code_blocks"},{label:"Scala",value:"scala",ext:["scala","sc","sbt"],icon:"code_blocks"},{label:"Scheme",value:"scheme",ext:["scm","ss","rkt","rktd","rktl"],icon:"code_blocks"},{label:"Scilab",value:"scilab",ext:["sci","sce"],icon:"code_blocks"},{label:"SCSS",value:"scss",ext:["scss","sass"],icon:"code_blocks"},{label:"Shell",value:"shell",ext:["sh","bash","zsh","ksh","csh","tcsh"],icon:"code_blocks"},{label:"Smali",value:"smali",ext:["smali"],icon:"code_blocks"},{label:"Smalltalk",value:"smalltalk",ext:["st"],icon:"code_blocks"},{label:"Standard ML",value:"sml",ext:["sml","sig","fun"],icon:"code_blocks"},{label:"SQL",value:"sql",ext:["sql","ddl","dml"],icon:"code_blocks"},{label:"SQF",value:"sqf",ext:["sqf"],icon:"code_blocks"},{label:"Stan",value:"stan",ext:["stan"],icon:"code_blocks"},{label:"Stata",value:"stata",ext:["do","ado","mata"],icon:"code_blocks"},{label:"Step21",value:"step21",ext:["stp","step"],icon:"code_blocks"},{label:"Stylus",value:"stylus",ext:["styl","stylus"],icon:"code_blocks"},{label:"Subunit",value:"subunit",ext:["subunit"],icon:"code_blocks"},{label:"SVG",value:"svg",ext:["svg"],icon:"code_blocks"},{label:"Swift",value:"swift",ext:["swift"],icon:"code_blocks"},{label:"Tagger Script",value:"taggerscript",ext:["tag"],icon:"code_blocks"},{label:"TAP",value:"tap",ext:["tap"],icon:"code_blocks"},{label:"Tcl",value:"tcl",ext:["tcl","tk","itcl","itk"],icon:"code_blocks"},{label:"Thrift",value:"thrift",ext:["thrift"],icon:"code_blocks"},{label:"TOML",value:"toml",ext:["toml"],icon:"code_blocks"},{label:"TP",value:"tp",ext:["tp"],icon:"code_blocks"},{label:"Twig",value:"twig",ext:["twig","tpl"],icon:"code_blocks"},{label:"TypeScript",value:"typescript",ext:["ts","tsx"],icon:"code_blocks"},{label:"Vala",value:"vala",ext:["vala","vapi"],icon:"code_blocks"},{label:"VB.NET",value:"vbnet",ext:["vb"],icon:"code_blocks"},{label:"VBScript (HTML)",value:"vbscript-html",ext:["html","htm","asp","vbs"],icon:"code_blocks"},{label:"VBScript",value:"vbscript",ext:["vbs","vbe"],icon:"code_blocks"},{label:"Verilog",value:"verilog",ext:["v","vh","sv","svh"],icon:"code_blocks"},{label:"VHDL",value:"vhdl",ext:["vhd","vhdl"],icon:"code_blocks"},{label:"Vim",value:"vim",ext:["vim","vba","vbe","exrc"],icon:"code_blocks"},{label:"WebAssembly",value:"wasm",ext:["wasm","wat"],icon:"code_blocks"},{label:"Wren",value:"wren",ext:["wren"],icon:"code_blocks"},{label:"x86 Assembly",value:"x86asm",ext:["asm","s","S"],icon:"code_blocks"},{label:"XL",value:"xl",ext:["xl","xls","xlsx"],icon:"code_blocks"},{label:"XML",value:"xml",ext:["xml","xsd","xsl","xslt","rss","atom","svg"],icon:"code_blocks"},{label:"XQuery",value:"xquery",ext:["xq","xquery","xql","xqm"],icon:"code_blocks"},{label:"YAML",value:"yaml",ext:["yaml","yml"],icon:"code_blocks"},{label:"Zephir",value:"zephir",ext:["zep"],icon:"code_blocks"}],sP={class:"selected-language"},lP={class:"header"},aP={class:"o-scroll"},yx=c.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(),s=c.ref(),l=c.ref(""),a=c.ref(0),d=c.ref(""),u=c.computed(()=>l.value?Jl.filter(b=>b.value.toLowerCase().indexOf(l.value.toLowerCase())>=0):Jl),f=c.computed(()=>{let b=Jl.find(k=>k.value===d.value);return b||(b=Jl.find(k=>k.ext.includes(d.value))),b});function p(b){b&&setTimeout(()=>{var k;(k=s.value)==null||k.focus(),a.value=0,window.addEventListener("keyup",y)},0)}function h(){var b;window.removeEventListener("keyup",y),(b=i.value)==null||b.setShow(!1)}function m(b){h(),d.value=b.value,o("select",b.value)}function g(){m(u.value[a.value])}function y(b){if(u.value.length>0){switch(b.code){case"ArrowDown":a.value=a.value+1;break;case"ArrowUp":a.value=a.value-1;break;case"Enter":g();break}a.value>=u.value.length&&(a.value=0),a.value<0&&(a.value=u.value.length-1)}else a.value=0}return c.onMounted(()=>{d.value=t.language}),(b,k)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:i,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":p},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ke),{class:"o-dropdown-btn"},{default:c.withCtx(()=>{var x;return[c.createElementVNode("span",sP,c.toDisplayString((x=f.value)==null?void 0:x.label),1),c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:c.withCtx(()=>[c.createElementVNode("header",lP,[c.createVNode(c.unref(jn),{ref_key:"input",ref:s,modelValue:l.value,"onUpdate:modelValue":k[0]||(k[0]=x=>l.value=x),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),c.createElementVNode("section",aP,[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u.value,(x,w)=>(c.openBlock(),c.createBlock(c.unref(kt),{key:w,onClick:C=>m(x),class:c.normalizeClass({"is-active":x.value===d.value,"is-select":w===a.value})},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:x.icon},null,8,["name"])]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(x.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),cP={class:"o-media-input"},dP={class:"fields"},uP={class:"o-media-title"},fP={class:"actions"},Gl=c.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(),s=c.ref(""),l=c.ref("");function a(){return l.value?(s.value="null",!0):(s.value="error",!1)}function d(){a()&&o("input",l.value)}return c.onMounted(()=>{l.value=t.val,setTimeout(()=>{var u;(u=i.value)==null||u.focus()},0)}),(u,f)=>(c.openBlock(),c.createElementBlock("section",cP,[c.createElementVNode("section",dP,[c.createElementVNode("div",uP,c.toDisplayString(c.unref(r)("label.link")),1),c.createVNode(c.unref(jn),{ref_key:"input",ref:i,modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),status:s.value,type:"text",autofocus:"",clearable:"",onEnter:d},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),c.createElementVNode("footer",fP,[c.createVNode(c.unref(Ke),{type:"info",onClick:d},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),pP={class:"o-meta-input"},hP={class:"header"},mP={class:"title"},gP={class:"fields"},yP={class:"actions"},Hd=c.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(null),s=c.ref("");function l(){console.log("confirm",s.value),o("confirm",s.value)}return c.onMounted(()=>{s.value=t.val,setTimeout(()=>{var a;(a=i.value)==null||a.focus()},0)}),(a,d)=>(c.openBlock(),c.createElementBlock("section",pP,[c.createElementVNode("section",hP,[c.createElementVNode("div",mP,c.toDisplayString(n.title),1),c.createElementVNode("div",null,[c.renderSlot(a.$slots,"header-right")])]),c.createElementVNode("section",gP,[c.createVNode(c.unref(jn),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=u=>s.value=u),type:"text",autofocus:"",clearable:"",onEnter:l},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:n.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),c.createElementVNode("footer",yP,[c.createVNode(c.unref(Ke),{type:"tertiary",onClick:d[1]||(d[1]=u=>o("cancel"))},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.cancel")),1)]),_:1}),c.createVNode(c.unref(Ke),{type:"info",onClick:l},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),bP={class:"add"},Fd=c.defineComponent({__name:"OTableCellHandler",props:{modelValue:{type:Boolean,default:!1},row:{type:Boolean,default:!1},column:{type:Boolean,default:!1},tooltip:{type:String,default:""},placement:{type:String,default:"top"},offset:{type:Object,default:function(){return[0,0]}},tippyClass:{type:String,default:""},contentClass:{type:[String,Object],default:""},tooltipPlacement:{type:String,default:"top"},tooltipOffset:{type:Object,default:function(){return[0,2]}}},emits:["update:modelValue","add"],setup(n,{emit:e}){const t=n,o=e,r=c.ref(!1);function i(){setTimeout(()=>{r.value=!0},0)}function s(l){o("update:modelValue",l)}return c.watch(()=>t.modelValue,l=>{r.value=l}),c.onMounted(()=>{r.value=t.modelValue}),(l,a)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-table-cell-handler",{"o-row":n.row,"o-column":n.column}]),onClick:i},[c.createVNode(c.unref(wo),{modelValue:r.value,"onUpdate:modelValue":[a[0]||(a[0]=d=>r.value=d),s],placement:n.placement,"tippy-class":n.tippyClass,offset:n.offset,"hide-click-outside":""},{"popover-content":c.withCtx(()=>[c.renderSlot(l.$slots,"default")]),default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["handler-trigger",`${n.contentClass} ${r.value?"active":""}`]),onClick:i},[...a[2]||(a[2]=[c.createElementVNode("div",{class:"handler"},[c.createElementVNode("svg",{width:"24",height:"12",viewBox:"0 0 24 12",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},[c.createElementVNode("circle",{cx:"2",cy:"2",r:"2"}),c.createElementVNode("circle",{cx:"2",cy:"10",r:"2"}),c.createElementVNode("circle",{cx:"12",cy:"2",r:"2"}),c.createElementVNode("circle",{cx:"12",cy:"10",r:"2"}),c.createElementVNode("circle",{cx:"22",cy:"2",r:"2"}),c.createElementVNode("circle",{cx:"22",cy:"10",r:"2"})])],-1)])],2)]),_:3},8,["modelValue","placement","tippy-class","offset"]),c.createElementVNode("div",bP,[a[4]||(a[4]=c.createElementVNode("div",{class:"indicator"},[c.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[c.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),c.createVNode(c.unref(xn),{placement:n.tooltipPlacement,offset:n.tooltipOffset},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:"circle-button",onClick:a[1]||(a[1]=c.withModifiers(d=>o("add"),["stop"]))},[...a[3]||(a[3]=[c.createElementVNode("div",{class:"plus"},null,-1)])])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:1},8,["placement","offset"])])],2))}}),kP={class:"o-table-grid"},wP=["onMouseover"],bx=c.defineComponent({__name:"OTableGrid",emits:["select"],setup(n,{emit:e}){const t=e,o=c.ref(6),r=c.ref(6),i=c.ref(2),s=c.ref(2);function l(d,u){i.value=d,s.value=u,o.value===d&&o.value<10&&(o.value+=1),r.value===u&&r.value<10&&(r.value+=1)}function a(){t("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(d,u)=>(c.openBlock(),c.createElementBlock("section",kP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.value,(f,p)=>(c.openBlock(),c.createElementBlock("div",{class:"rows",key:`row-${p}`},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(h,m)=>(c.openBlock(),c.createElementBlock("div",{key:`col-${m}`},[c.createElementVNode("div",{class:c.normalizeClass(["cell",{selected:f<=i.value&&h<=s.value}]),onMouseover:g=>l(f,h),onClick:a},null,42,wP)]))),128))]))),128)),c.createElementVNode("footer",null,c.toDisplayString(i.value)+" x "+c.toDisplayString(s.value),1)]))}}),xP={class:"o-table-cell-background o-button-group"},CP={class:"o-command-btn"},kx=c.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"tableCellAttribute",{name:"background",value:i.value})}return(a,d)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(xn),{trigger:"hover"},{trigger:c.withCtx(()=>[c.createElementVNode("div",xP,[c.createElementVNode("div",{class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},[c.createVNode(c.unref(X),{name:"crop_16_9",class:"arrow"}),c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),c.createElementVNode("div",CP,[c.createVNode(c.unref(X),{name:"arrow_drop_down"})])])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(Si),{"default-color":"","default-label":c.unref(t)("editor.noColor"),onSelect:l},null,8,["default-label"])]),_:1},512))}}),SP={class:"o-simple-color-board"},vP={class:"fore-colors"},EP={class:"label o-tips"},MP={class:"color-row"},TP={class:"color-row"},NP={class:"back-colors"},AP={class:"label o-tips"},OP={class:"color-row"},$P={class:"color-row"},lm=c.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:o}=de();function r(l,a){t("select",{name:l,value:a.value})}const i=c.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),s=c.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(l,a)=>(c.openBlock(),c.createElementBlock("section",SP,[c.createElementVNode("section",vP,[c.createElementVNode("header",null,[c.createElementVNode("div",EP,c.toDisplayString(c.unref(o)("editor.textColor")),1),c.createVNode(c.unref(De),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(xn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ke),{icon:"more_horiz",class:"o-command-btn"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(o)("label.more")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(Si),{"default-color":"","default-disabled":"",onSelect:a[0]||(a[0]=d=>r("color",{value:d}))})]),_:1},512)]),c.createElementVNode("div",MP,[c.createVNode(c.unref($e),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:a[1]||(a[1]=d=>r("color",{value:""}))}),n.foreColor?(c.openBlock(),c.createBlock(c.unref($e),{key:0,icon:"format_text",color:n.foreColor,tooltip:"Last used","content-class":"border",onClick:a[2]||(a[2]=d=>r("color",{value:n.foreColor}))},null,8,["color"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",TP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,u)=>(c.openBlock(),c.createBlock(c.unref($e),{key:`col-${u}`,icon:"format_text",color:d.value,tooltip:d.label,onClick:f=>r("color",d)},null,8,["color","tooltip","onClick"]))),128))])]),c.createElementVNode("section",NP,[c.createElementVNode("header",null,[c.createElementVNode("div",AP,c.toDisplayString(c.unref(o)("editor.backgroundColor")),1),c.createVNode(c.unref(De),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(xn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ke),{icon:"more_horiz",class:"o-command-btn"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(o)("label.more")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(Si),{"default-color":"","default-disabled":"",onSelect:a[3]||(a[3]=d=>r("backgroundColor",{value:d}))})]),_:1},512)]),c.createElementVNode("div",OP,[c.createVNode(c.unref($e),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:a[4]||(a[4]=d=>r("backgroundColor",{value:""}))}),n.backColor?(c.openBlock(),c.createBlock(c.unref($e),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:n.backColor},onClick:a[5]||(a[5]=d=>r("backgroundColor",{value:n.backColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",$P,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(d,u)=>(c.openBlock(),c.createBlock(c.unref($e),{key:`col-${u}`,icon:"format_text",tooltip:d.label,"content-style":{backgroundColor:d.value},onClick:f=>r("backgroundColor",d)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),wx=["top","right","bottom","left"],xx=["start","end"],Cx=wx.reduce((n,e)=>n.concat(e,e+"-"+xx[0],e+"-"+xx[1]),[]),Yn=Math.min,qt=Math.max,jd=Math.round,Ud=Math.floor,xo=n=>({x:n,y:n}),BP={left:"right",right:"left",bottom:"top",top:"bottom"},RP={start:"end",end:"start"};function am(n,e,t){return qt(n,Yn(e,t))}function Qo(n,e){return typeof n=="function"?n(e):n}function Fn(n){return n.split("-")[0]}function Qn(n){return n.split("-")[1]}function Sx(n){return n==="x"?"y":"x"}function cm(n){return n==="y"?"height":"width"}const DP=new Set(["top","bottom"]);function Co(n){return DP.has(Fn(n))?"y":"x"}function dm(n){return Sx(Co(n))}function vx(n,e,t){t===void 0&&(t=!1);const o=Qn(n),r=dm(n),i=cm(r);let s=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=qd(s)),[s,qd(s)]}function _P(n){const e=qd(n);return[Wd(n),e,Wd(e)]}function Wd(n){return n.replace(/start|end/g,e=>RP[e])}const Ex=["left","right"],Mx=["right","left"],IP=["top","bottom"],LP=["bottom","top"];function PP(n,e,t){switch(n){case"top":case"bottom":return t?e?Mx:Ex:e?Ex:Mx;case"left":case"right":return e?IP:LP;default:return[]}}function VP(n,e,t,o){const r=Qn(n);let i=PP(Fn(n),t==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Wd)))),i}function qd(n){return n.replace(/left|right|bottom|top/g,e=>BP[e])}function zP(n){return{top:0,right:0,bottom:0,left:0,...n}}function um(n){return typeof n!="number"?zP(n):{top:n,right:n,bottom:n,left:n}}function bs(n){const{x:e,y:t,width:o,height:r}=n;return{width:o,height:r,top:t,left:e,right:e+o,bottom:t+r,x:e,y:t}}function Tx(n,e,t){let{reference:o,floating:r}=n;const i=Co(e),s=dm(e),l=cm(s),a=Fn(e),d=i==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[l]/2-r[l]/2;let h;switch(a){case"top":h={x:u,y:o.y-r.height};break;case"bottom":h={x:u,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-r.width,y:f};break;default:h={x:o.x,y:o.y}}switch(Qn(e)){case"start":h[s]-=p*(t&&d?-1:1);break;case"end":h[s]+=p*(t&&d?-1:1);break}return h}async function HP(n,e){var t;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:l,strategy:a}=n,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=Qo(e,n),m=um(h),y=l[p?f==="floating"?"reference":"floating":f],b=bs(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:a})),k=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=bs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:x,strategy:a}):k);return{top:(b.top-C.top+m.top)/w.y,bottom:(C.bottom-b.bottom+m.bottom)/w.y,left:(b.left-C.left+m.left)/w.x,right:(C.right-b.right+m.right)/w.x}}const FP=async(n,e,t)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=t,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let d=await s.getElementRects({reference:n,floating:e,strategy:r}),{x:u,y:f}=Tx(d,o,a),p=o,h={},m=0;for(let y=0;y<l.length;y++){var g;const{name:b,fn:k}=l[y],{x,y:w,data:C,reset:v}=await k({x:u,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:h,rects:d,platform:{...s,detectOverflow:(g=s.detectOverflow)!=null?g:HP},elements:{reference:n,floating:e}});u=x??u,f=w??f,h={...h,[b]:{...h[b],...C}},v&&m<=50&&(m++,typeof v=="object"&&(v.placement&&(p=v.placement),v.rects&&(d=v.rects===!0?await s.getElementRects({reference:n,floating:e,strategy:r}):v.rects),{x:u,y:f}=Tx(d,p,a)),y=-1)}return{x:u,y:f,placement:p,strategy:r,middlewareData:h}},jP=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:o,placement:r,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:d,padding:u=0}=Qo(n,e)||{};if(d==null)return{};const f=um(u),p={x:t,y:o},h=dm(r),m=cm(h),g=await s.getDimensions(d),y=h==="y",b=y?"top":"left",k=y?"bottom":"right",x=y?"clientHeight":"clientWidth",w=i.reference[m]+i.reference[h]-p[h]-i.floating[m],C=p[h]-i.reference[h],v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let E=v?v[x]:0;(!E||!await(s.isElement==null?void 0:s.isElement(v)))&&(E=l.floating[x]||i.floating[m]);const T=w/2-C/2,A=E/2-g[m]/2-1,$=Yn(f[b],A),O=Yn(f[k],A),B=$,_=E-g[m]-O,D=E/2-g[m]/2+T,P=am(B,D,_),R=!a.arrow&&Qn(r)!=null&&D!==P&&i.reference[m]/2-(D<B?$:O)-g[m]/2<0,K=R?D<B?D-B:D-_:0;return{[h]:p[h]+K,data:{[h]:P,centerOffset:D-P-K,...R&&{alignmentOffset:K}},reset:R}}});function UP(n,e,t){return(n?[...t.filter(r=>Qn(r)===n),...t.filter(r=>Qn(r)!==n)]:t.filter(r=>Fn(r)===r)).filter(r=>n?Qn(r)===n||(e?Wd(r)!==r:!1):!0)}const WP=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,o,r;const{rects:i,middlewareData:s,placement:l,platform:a,elements:d}=e,{crossAxis:u=!1,alignment:f,allowedPlacements:p=Cx,autoAlignment:h=!0,...m}=Qo(n,e),g=f!==void 0||p===Cx?UP(f||null,h,p):p,y=await a.detectOverflow(e,m),b=((t=s.autoPlacement)==null?void 0:t.index)||0,k=g[b];if(k==null)return{};const x=vx(k,i,await(a.isRTL==null?void 0:a.isRTL(d.floating)));if(l!==k)return{reset:{placement:g[0]}};const w=[y[Fn(k)],y[x[0]],y[x[1]]],C=[...((o=s.autoPlacement)==null?void 0:o.overflows)||[],{placement:k,overflows:w}],v=g[b+1];if(v)return{data:{index:b+1,overflows:C},reset:{placement:v}};const E=C.map($=>{const O=Qn($.placement);return[$.placement,O&&u?$.overflows.slice(0,2).reduce((B,_)=>B+_,0):$.overflows[0],$.overflows]}).sort(($,O)=>$[1]-O[1]),A=((r=E.filter($=>$[2].slice(0,Qn($[0])?2:3).every(O=>O<=0))[0])==null?void 0:r[0])||E[0][0];return A!==l?{data:{index:b+1,overflows:C},reset:{placement:A}}:{}}}},qP=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=Qo(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=Fn(r),k=Co(l),x=Fn(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(d.floating)),C=p||(x||!g?[qd(l)]:_P(l)),v=m!=="none";!p&&v&&C.push(...VP(l,g,m,w));const E=[l,...C],T=await a.detectOverflow(e,y),A=[];let $=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&A.push(T[b]),f){const D=vx(r,s,w);A.push(T[D[0]],T[D[1]])}if($=[...$,{placement:r,overflows:A}],!A.every(D=>D<=0)){var O,B;const D=(((O=i.flip)==null?void 0:O.index)||0)+1,P=E[D];if(P&&(!(f==="alignment"?k!==Co(P):!1)||$.every(H=>Co(H.placement)===k?H.overflows[0]>0:!0)))return{data:{index:D,overflows:$},reset:{placement:P}};let R=(B=$.filter(K=>K.overflows[0]<=0).sort((K,H)=>K.overflows[1]-H.overflows[1])[0])==null?void 0:B.placement;if(!R)switch(h){case"bestFit":{var _;const K=(_=$.filter(H=>{if(v){const W=Co(H.placement);return W===k||W==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(W=>W>0).reduce((W,ge)=>W+ge,0)]).sort((H,W)=>H[1]-W[1])[0])==null?void 0:_[0];K&&(R=K);break}case"initialPlacement":R=l;break}if(r!==R)return{reset:{placement:R}}}return{}}}};function Nx(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Ax(n){return wx.some(e=>n[e]>=0)}const KP=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:o}=e,{strategy:r="referenceHidden",...i}=Qo(n,e);switch(r){case"referenceHidden":{const s=await o.detectOverflow(e,{...i,elementContext:"reference"}),l=Nx(s,t.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ax(l)}}}case"escaped":{const s=await o.detectOverflow(e,{...i,altBoundary:!0}),l=Nx(s,t.floating);return{data:{escapedOffsets:l,escaped:Ax(l)}}}default:return{}}}}};function Ox(n){const e=Yn(...n.map(i=>i.left)),t=Yn(...n.map(i=>i.top)),o=qt(...n.map(i=>i.right)),r=qt(...n.map(i=>i.bottom));return{x:e,y:t,width:o-e,height:r-t}}function JP(n){const e=n.slice().sort((r,i)=>r.y-i.y),t=[];let o=null;for(let r=0;r<e.length;r++){const i=e[r];!o||i.y-o.y>o.height/2?t.push([i]):t[t.length-1].push(i),o=i}return t.map(r=>bs(Ox(r)))}const GP=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:o,rects:r,platform:i,strategy:s}=e,{padding:l=2,x:a,y:d}=Qo(n,e),u=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(o.reference))||[]),f=JP(u),p=bs(Ox(u)),h=um(l);function m(){if(f.length===2&&f[0].left>f[1].right&&a!=null&&d!=null)return f.find(y=>a>y.left-h.left&&a<y.right+h.right&&d>y.top-h.top&&d<y.bottom+h.bottom)||p;if(f.length>=2){if(Co(t)==="y"){const $=f[0],O=f[f.length-1],B=Fn(t)==="top",_=$.top,D=O.bottom,P=B?$.left:O.left,R=B?$.right:O.right,K=R-P,H=D-_;return{top:_,bottom:D,left:P,right:R,width:K,height:H,x:P,y:_}}const y=Fn(t)==="left",b=qt(...f.map($=>$.right)),k=Yn(...f.map($=>$.left)),x=f.filter($=>y?$.left===k:$.right===b),w=x[0].top,C=x[x.length-1].bottom,v=k,E=b,T=E-v,A=C-w;return{top:w,bottom:C,left:v,right:E,width:T,height:A,x:v,y:w}}return p}const g=await i.getElementRects({reference:{getBoundingClientRect:m},floating:o.floating,strategy:s});return r.reference.x!==g.reference.x||r.reference.y!==g.reference.y||r.reference.width!==g.reference.width||r.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},XP=new Set(["left","top"]);async function YP(n,e){const{placement:t,platform:o,elements:r}=n,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=Fn(t),l=Qn(t),a=Co(t)==="y",d=XP.has(s)?-1:1,u=i&&a?-1:1,f=Qo(e,n);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof m=="number"&&(h=l==="end"?m*-1:m),a?{x:h*u,y:p*d}:{x:p*d,y:h*u}}const QP=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;const{x:r,y:i,placement:s,middlewareData:l}=e,a=await YP(e,n);return s===((t=l.offset)==null?void 0:t.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:s}}}}},ZP=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:o,placement:r,platform:i}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:b=>{let{x:k,y:x}=b;return{x:k,y:x}}},...d}=Qo(n,e),u={x:t,y:o},f=await i.detectOverflow(e,d),p=Co(Fn(r)),h=Sx(p);let m=u[h],g=u[p];if(s){const b=h==="y"?"top":"left",k=h==="y"?"bottom":"right",x=m+f[b],w=m-f[k];m=am(x,m,w)}if(l){const b=p==="y"?"top":"left",k=p==="y"?"bottom":"right",x=g+f[b],w=g-f[k];g=am(x,g,w)}const y=a.fn({...e,[h]:m,[p]:g});return{...y,data:{x:y.x-t,y:y.y-o,enabled:{[h]:s,[p]:l}}}}}},eV=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,o;const{placement:r,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...d}=Qo(n,e),u=await s.detectOverflow(e,d),f=Fn(r),p=Qn(r),h=Co(r)==="y",{width:m,height:g}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=p===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,y=p==="end"?"top":"bottom");const k=g-u.top-u.bottom,x=m-u.left-u.right,w=Yn(g-u[y],k),C=Yn(m-u[b],x),v=!e.middlewareData.shift;let E=w,T=C;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(T=x),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(E=k),v&&!p){const $=qt(u.left,0),O=qt(u.right,0),B=qt(u.top,0),_=qt(u.bottom,0);h?T=m-2*($!==0||O!==0?$+O:qt(u.left,u.right)):E=g-2*(B!==0||_!==0?B+_:qt(u.top,u.bottom))}await a({...e,availableWidth:T,availableHeight:E});const A=await s.getDimensions(l.floating);return m!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function Kd(){return typeof window<"u"}function ks(n){return $x(n)?(n.nodeName||"").toLowerCase():"#document"}function Cn(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function So(n){var e;return(e=($x(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function $x(n){return Kd()?n instanceof Node||n instanceof Cn(n).Node:!1}function Zn(n){return Kd()?n instanceof Element||n instanceof Cn(n).Element:!1}function vo(n){return Kd()?n instanceof HTMLElement||n instanceof Cn(n).HTMLElement:!1}function Bx(n){return!Kd()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Cn(n).ShadowRoot}const tV=new Set(["inline","contents"]);function Xl(n){const{overflow:e,overflowX:t,overflowY:o,display:r}=eo(n);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&!tV.has(r)}const nV=new Set(["table","td","th"]);function oV(n){return nV.has(ks(n))}const rV=[":popover-open",":modal"];function Jd(n){return rV.some(e=>{try{return n.matches(e)}catch{return!1}})}const iV=["transform","translate","scale","rotate","perspective"],sV=["transform","translate","scale","rotate","perspective","filter"],lV=["paint","layout","strict","content"];function fm(n){const e=pm(),t=Zn(n)?eo(n):n;return iV.some(o=>t[o]?t[o]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||sV.some(o=>(t.willChange||"").includes(o))||lV.some(o=>(t.contain||"").includes(o))}function aV(n){let e=Br(n);for(;vo(e)&&!ws(e);){if(fm(e))return e;if(Jd(e))return null;e=Br(e)}return null}function pm(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cV=new Set(["html","body","#document"]);function ws(n){return cV.has(ks(n))}function eo(n){return Cn(n).getComputedStyle(n)}function Gd(n){return Zn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Br(n){if(ks(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Bx(n)&&n.host||So(n);return Bx(e)?e.host:e}function Rx(n){const e=Br(n);return ws(e)?n.ownerDocument?n.ownerDocument.body:n.body:vo(e)&&Xl(e)?e:Rx(e)}function Yl(n,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=Rx(n),i=r===((o=n.ownerDocument)==null?void 0:o.body),s=Cn(r);if(i){const l=hm(s);return e.concat(s,s.visualViewport||[],Xl(r)?r:[],l&&t?Yl(l):[])}return e.concat(r,Yl(r,[],t))}function hm(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Dx(n){const e=eo(n);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=vo(n),i=r?n.offsetWidth:t,s=r?n.offsetHeight:o,l=jd(t)!==i||jd(o)!==s;return l&&(t=i,o=s),{width:t,height:o,$:l}}function mm(n){return Zn(n)?n:n.contextElement}function xs(n){const e=mm(n);if(!vo(e))return xo(1);const t=e.getBoundingClientRect(),{width:o,height:r,$:i}=Dx(e);let s=(i?jd(t.width):t.width)/o,l=(i?jd(t.height):t.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const dV=xo(0);function _x(n){const e=Cn(n);return!pm()||!e.visualViewport?dV:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function uV(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Cn(n)?!1:e}function vi(n,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),i=mm(n);let s=xo(1);e&&(o?Zn(o)&&(s=xs(o)):s=xs(n));const l=uV(i,t,o)?_x(i):xo(0);let a=(r.left+l.x)/s.x,d=(r.top+l.y)/s.y,u=r.width/s.x,f=r.height/s.y;if(i){const p=Cn(i),h=o&&Zn(o)?Cn(o):o;let m=p,g=hm(m);for(;g&&o&&h!==m;){const y=xs(g),b=g.getBoundingClientRect(),k=eo(g),x=b.left+(g.clientLeft+parseFloat(k.paddingLeft))*y.x,w=b.top+(g.clientTop+parseFloat(k.paddingTop))*y.y;a*=y.x,d*=y.y,u*=y.x,f*=y.y,a+=x,d+=w,m=Cn(g),g=hm(m)}}return bs({width:u,height:f,x:a,y:d})}function Xd(n,e){const t=Gd(n).scrollLeft;return e?e.left+t:vi(So(n)).left+t}function Ix(n,e){const t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Xd(n,t),r=t.top+e.scrollTop;return{x:o,y:r}}function fV(n){let{elements:e,rect:t,offsetParent:o,strategy:r}=n;const i=r==="fixed",s=So(o),l=e?Jd(e.floating):!1;if(o===s||l&&i)return t;let a={scrollLeft:0,scrollTop:0},d=xo(1);const u=xo(0),f=vo(o);if((f||!f&&!i)&&((ks(o)!=="body"||Xl(s))&&(a=Gd(o)),vo(o))){const h=vi(o);d=xs(o),u.x=h.x+o.clientLeft,u.y=h.y+o.clientTop}const p=s&&!f&&!i?Ix(s,a):xo(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-a.scrollLeft*d.x+u.x+p.x,y:t.y*d.y-a.scrollTop*d.y+u.y+p.y}}function pV(n){return Array.from(n.getClientRects())}function hV(n){const e=So(n),t=Gd(n),o=n.ownerDocument.body,r=qt(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=qt(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-t.scrollLeft+Xd(n);const l=-t.scrollTop;return eo(o).direction==="rtl"&&(s+=qt(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:l}}const Lx=25;function mV(n,e){const t=Cn(n),o=So(n),r=t.visualViewport;let i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;const u=pm();(!u||u&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const d=Xd(o);if(d<=0){const u=o.ownerDocument,f=u.body,p=getComputedStyle(f),h=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-f.clientWidth-h);m<=Lx&&(i-=m)}else d<=Lx&&(i+=d);return{width:i,height:s,x:l,y:a}}const gV=new Set(["absolute","fixed"]);function yV(n,e){const t=vi(n,!0,e==="fixed"),o=t.top+n.clientTop,r=t.left+n.clientLeft,i=vo(n)?xs(n):xo(1),s=n.clientWidth*i.x,l=n.clientHeight*i.y,a=r*i.x,d=o*i.y;return{width:s,height:l,x:a,y:d}}function Px(n,e,t){let o;if(e==="viewport")o=mV(n,t);else if(e==="document")o=hV(So(n));else if(Zn(e))o=yV(e,t);else{const r=_x(n);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return bs(o)}function Vx(n,e){const t=Br(n);return t===e||!Zn(t)||ws(t)?!1:eo(t).position==="fixed"||Vx(t,e)}function bV(n,e){const t=e.get(n);if(t)return t;let o=Yl(n,[],!1).filter(l=>Zn(l)&&ks(l)!=="body"),r=null;const i=eo(n).position==="fixed";let s=i?Br(n):n;for(;Zn(s)&&!ws(s);){const l=eo(s),a=fm(s);!a&&l.position==="fixed"&&(r=null),(i?!a&&!r:!a&&l.position==="static"&&!!r&&gV.has(r.position)||Xl(s)&&!a&&Vx(n,s))?o=o.filter(u=>u!==s):r=l,s=Br(s)}return e.set(n,o),o}function kV(n){let{element:e,boundary:t,rootBoundary:o,strategy:r}=n;const s=[...t==="clippingAncestors"?Jd(e)?[]:bV(e,this._c):[].concat(t),o],l=s[0],a=s.reduce((d,u)=>{const f=Px(e,u,r);return d.top=qt(f.top,d.top),d.right=Yn(f.right,d.right),d.bottom=Yn(f.bottom,d.bottom),d.left=qt(f.left,d.left),d},Px(e,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function wV(n){const{width:e,height:t}=Dx(n);return{width:e,height:t}}function xV(n,e,t){const o=vo(e),r=So(e),i=t==="fixed",s=vi(n,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=xo(0);function d(){a.x=Xd(r)}if(o||!o&&!i)if((ks(e)!=="body"||Xl(r))&&(l=Gd(e)),o){const h=vi(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else r&&d();i&&!o&&r&&d();const u=r&&!o&&!i?Ix(r,l):xo(0),f=s.left+l.scrollLeft-a.x-u.x,p=s.top+l.scrollTop-a.y-u.y;return{x:f,y:p,width:s.width,height:s.height}}function gm(n){return eo(n).position==="static"}function zx(n,e){if(!vo(n)||eo(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return So(n)===t&&(t=t.ownerDocument.body),t}function Hx(n,e){const t=Cn(n);if(Jd(n))return t;if(!vo(n)){let r=Br(n);for(;r&&!ws(r);){if(Zn(r)&&!gm(r))return r;r=Br(r)}return t}let o=zx(n,e);for(;o&&oV(o)&&gm(o);)o=zx(o,e);return o&&ws(o)&&gm(o)&&!fm(o)?t:o||aV(n)||t}const CV=async function(n){const e=this.getOffsetParent||Hx,t=this.getDimensions,o=await t(n.floating);return{reference:xV(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function SV(n){return eo(n).direction==="rtl"}const vV={convertOffsetParentRelativeRectToViewportRelativeRect:fV,getDocumentElement:So,getClippingRect:kV,getOffsetParent:Hx,getElementRects:CV,getClientRects:pV,getDimensions:wV,getScale:xs,isElement:Zn,isRTL:SV};function Fx(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function EV(n,e){let t=null,o;const r=So(n);function i(){var l;clearTimeout(o),(l=t)==null||l.disconnect(),t=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const d=n.getBoundingClientRect(),{left:u,top:f,width:p,height:h}=d;if(l||e(),!p||!h)return;const m=Ud(f),g=Ud(r.clientWidth-(u+p)),y=Ud(r.clientHeight-(f+h)),b=Ud(u),x={rootMargin:-m+"px "+-g+"px "+-y+"px "+-b+"px",threshold:qt(0,Yn(1,a))||1};let w=!0;function C(v){const E=v[0].intersectionRatio;if(E!==a){if(!w)return s();E?s(!1,E):o=setTimeout(()=>{s(!1,1e-7)},1e3)}E===1&&!Fx(d,n.getBoundingClientRect())&&s(),w=!1}try{t=new IntersectionObserver(C,{...x,root:r.ownerDocument})}catch{t=new IntersectionObserver(C,x)}t.observe(n)}return s(!0),i}function MV(n,e,t,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,d=mm(n),u=r||i?[...d?Yl(d):[],...Yl(e)]:[];u.forEach(b=>{r&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=d&&l?EV(d,t):null;let p=-1,h=null;s&&(h=new ResizeObserver(b=>{let[k]=b;k&&k.target===d&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(e)})),t()}),d&&!a&&h.observe(d),h.observe(e));let m,g=a?vi(n):null;a&&y();function y(){const b=vi(n);g&&!Fx(g,b)&&t(),g=b,m=requestAnimationFrame(y)}return t(),()=>{var b;u.forEach(k=>{r&&k.removeEventListener("scroll",t),i&&k.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const jx=QP,Ux=WP,ym=ZP,bm=qP,Wx=eV,qx=KP,Kx=jP,Jx=GP,Yd=(n,e,t)=>{const o=new Map,r={platform:vV,...t},i={...r.platform,_c:o};return FP(n,e,{...r,platform:i})};class TV{constructor(){qe(this,"instances",[]);qe(this,"gap",12);qe(this,"topMargin",20)}error(e,t=3e3){this.show(e,"error",t)}info(e,t=3e3){this.show(e,"info",t)}success(e,t=3e3){this.show(e,"success",t)}warning(e,t=3e3){this.show(e,"warning",t)}show(e,t="info",o=3e3){const r=document.createElement("div");r.className=`o-toast ${t}`,Object.assign(r.style,{position:"fixed",left:"0",top:"0",zIndex:"9999",transition:"transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease",opacity:"0",pointerEvents:"none"}),r.innerHTML=`
170
- <i class="yiitip-icon icon-${t}"></i>
171
- <span class="message">${e}</span>
172
- `,document.body.appendChild(r);const i={el:r,cleanup:()=>{},x:0};let s=!0;i.cleanup=MV(document.body,r,()=>{Yd(document.body,r,{placement:"top",middleware:[ym(),bm()]}).then(({x:l})=>{if(i.x=l,s){const a=-r.offsetHeight;r.style.transition="none",r.style.transform=`translate3d(${l}px, ${a}px, 0)`,r.offsetHeight,r.style.transition="transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease",s=!1,this.instances.push(i),this.repositionToasts(),r.style.opacity="1"}else this.repositionToasts()})}),o>0&&setTimeout(()=>this.destroy(i),o)}repositionToasts(){let e=this.topMargin;this.instances.forEach(t=>{t.el.style.transform=`translate3d(${t.x}px, ${e}px, 0)`,e+=t.el.offsetHeight+this.gap})}destroy(e){e.el.style.opacity="0";const t=e.el.style.transform;e.el.style.transform=`${t} translateY(-20px) scale(0.9)`;const o=r=>{r.propertyName==="opacity"&&(e.cleanup(),e.el.parentNode&&document.body.removeChild(e.el),this.instances=this.instances.filter(i=>i!==e),this.repositionToasts(),e.el.removeEventListener("transitionend",o))};e.el.addEventListener("transitionend",o)}}const Ql=new TV,Sn=c.defineComponent({__name:"ONodeView",props:ut,setup(n){return(e,t)=>(c.openBlock(),c.createBlock(c.unref(Xp),{class:"o-node-view","data-id":e.node.attrs.id},{default:c.withCtx(()=>[c.renderSlot(e.$slots,"default")]),_:3},8,["data-id"]))}}),NV={class:"o-add-node-view"},AV={key:0,class:"view-main"},OV={class:"group o-tips"},$V={class:"panel"},BV={class:"group o-tips"},RV={key:1,class:"item"},DV=c.defineComponent({__name:"AddNodeView",props:ut,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s}=xe(),l=c.ref("main");function a(f){let p=null;switch(f.value){case"aiBlock":p=lL;break;case"audio":p=aL;break;case"blockquote":p=cL;break;case"callout":p=dL;break;case"codeBlock":p=uL;break;case"details":p=fL;break;case"diagram":p=lx;break;case"emoji":p=pL;break;case"heading":p={attrs:f.options};break;case"horizontalRule":p={};break;case"paragraph":p={type:"paragraph",content:[]};break;case"bulletList":case"orderedList":p={content:mL};break;case"taskList":p={content:yL};break;case"table":p=gL;break;case"image":p=hL;break;case"model-viewer":p={attrs:{src:"init"}};break;case"video":p=bL;break}if(p){p.type=p.type||f.value;const h=d.value?u.value+1:u.value,m=f.value==="emoji"?h+2:h+1;requestAnimationFrame(()=>{t.editor.chain().insertContentAt(h,p).focus(m).scrollIntoView().run()})}o("action",f)}const d=c.computed(()=>{var f;return((f=t.node)==null?void 0:f.content.size)===0}),u=c.computed(()=>d.value?t.getPos():t.getPos()+t.node.nodeSize);return(f,p)=>(c.openBlock(),c.createElementBlock("section",NV,[l.value==="main"?(c.openBlock(),c.createElementBlock("section",AV,[c.createElementVNode("section",null,[c.createElementVNode("div",OV,c.toDisplayString(c.unref(i)("label.basic")),1),c.createElementVNode("section",$V,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(ql),(h,m)=>(c.openBlock(),c.createBlock(c.unref($e),{key:m,icon:h.icon,tooltip:c.unref(i)(h.label),quaternary:"",onClick:g=>a(h)},null,8,["icon","tooltip","onClick"]))),128))])]),c.createVNode(c.unref(_t)),c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[c.unref(Ld).length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(Ld),(h,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:m},[h.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[m>0?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",BV,c.toDisplayString(c.unref(i)(h.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(kt),{class:"item",clickable:"",onClick:g=>a(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:h.icon,color:h.color},null,8,["name","color"])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(i)(h.label)),1)]),_:2},1032,["onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",RV,"No result"))]),_:1})])):c.createCommentVNode("",!0)]))}}),Gx=c.defineComponent({__name:"AddNode",props:{...ut,add:{type:String,default:"menu"}},setup(n){const e=n,t=c.ref(),o=c.ref(!1),r=c.computed(()=>{var u;return((u=e.node)==null?void 0:u.content.size)===0}),i=c.computed(()=>r.value?e.getPos():e.getPos()+e.node.nodeSize);function s(u){o.value=u}function l(){var u;e.add==="menu"?(u=t.value)==null||u.setShow(!0):a()}function a(){const u={type:"paragraph",content:[{type:"text",text:"/"}]},f=r.value?i.value+1:i.value,p=f+2;requestAnimationFrame(()=>{e.editor.chain().insertContentAt(f,u).focus(p).scrollIntoView().run()})}function d(){var u;(u=t.value)==null||u.setShow(!1),o.value=!1}return(u,f)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:t,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":s},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-add-btn",{"is-selected":o.value}])},[c.createVNode(c.unref(Ke),{type:"tertiary",class:"o-node-btn",onClick:l},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"add",small:""})]),_:1})],2)]),default:c.withCtx(()=>[c.createVNode(DV,c.mergeProps(e,{onAction:d}),null,16)]),_:1},512))}}),_V={class:"o-drag-node-view"},IV={key:0,class:"view-main"},LV={key:0},PV={class:"group o-tips"},VV={class:"panel"},zV=c.defineComponent({__name:"DragNodeView",props:ut,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s,onCommand:l}=xe(),a=c.ref("main"),d=c.ref(["heading","codeBlock","paragraph"]),u=c.computed(()=>{var y,b;const g=(y=t.node)==null?void 0:y.content.content;if(g.length>0){const k=g[0];if(k.type.name==="image")return k.type.name}return(b=t.node)==null?void 0:b.type.name}),f=c.computed(()=>Id.find(g=>g.value===u.value));function p(g){var y;return g.value===u.value&&((y=t.editor)==null?void 0:y.isActive(u.value,g.options))}function h(g){switch(g.value){case"copy":case"delete":case"duplicate":break;default:m(g);break}o("action",g)}function m(g){var x,w,C,v,E;const y=t.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const T=(x=t.editor)==null?void 0:x.isActive(u.value),A=(w=t.editor)==null?void 0:w.commands.lift(u.value);console.log("lift",u.value,T,A);return}const b=(C=t.editor)==null?void 0:C.commands,k=(v=t.editor)==null?void 0:v.chain().focus(y+1);console.log("runCommand",g),l(b,k,g.value,g.options),(E=t.editor)==null||E.commands.focus()}return(g,y)=>(c.openBlock(),c.createElementBlock("section",_V,[a.value==="main"?(c.openBlock(),c.createElementBlock("section",IV,[f.value?(c.openBlock(),c.createElementBlock("section",LV,[c.createElementVNode("div",PV,c.toDisplayString(c.unref(i)("label.turnInto")),1),c.createElementVNode("section",VV,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(Id),(b,k)=>(c.openBlock(),c.createBlock(c.unref($e),{key:k,icon:b.icon,tooltip:c.unref(i)(b.label),"content-class":{"is-active":p(b)},quaternary:"",onClick:x=>h(b)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):c.createCommentVNode("",!0),c.createVNode(c.unref(Yo),c.mergeProps(t,{colorful:"","show-group":"",onAction:h}),null,16)])):c.createCommentVNode("",!0)]))}}),Xx=c.defineComponent({__name:"DragNode",props:ut,emits:["dragstart","dragend"],setup(n,{emit:e}){const t=n,o=e,{run:r}=xe(),i=c.ref(null),s=c.ref(!1),l=c.ref(["heading","codeBlock","paragraph"]),a=c.computed(()=>{var y,b,k;const g=(b=(y=t.node)==null?void 0:y.content)==null?void 0:b.content;if((g==null?void 0:g.length)>0){const x=g[0];if(x.type.name==="image")return x.type.name}return(k=t.node)==null?void 0:k.type.name}),d=c.computed(()=>{var y;let g=a.value;return g==="heading"?{icon:`format_h${((y=t.node.attrs)==null?void 0:y.level)||1}`,color:ke.blue}:(g==="table-wrapper"&&(g="table"),Pd.find(b=>b.value===g)||Pd.find(b=>{var k;return(k=b.keywords)==null?void 0:k.split(",").includes(g)})||{icon:"title"})});function u(g){o("dragstart",g)}function f(g){o("dragend",g)}function p(g){var y;(y=i.value)==null||y.setShow(!1)}function h(g){s.value=g,g&&m()}function m(){var y;let g=t.getPos();l.value.includes(a.value),(y=t.editor)==null||y.commands.setNodeSelection(g)}return c.watch(()=>t.getPos(),g=>{var y;(y=i.value)==null||y.setShow(!1)}),(g,y)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:i,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":h},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-drag-btn",{selected:s.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:u,onDragend:f},[c.createVNode(c.unref(Ke),{type:"tertiary",class:"o-node-btn"},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.value.icon,color:d.value.color,small:""},null,8,["name","color"]),c.createVNode(c.unref(X),{name:"drag_indicator",small:""})]),_:1})],34)]),default:c.withCtx(()=>[c.createVNode(zV,c.mergeProps(t,{onAction:p}),null,16)]),_:1},512))}}),HV={key:0,class:"spinner"},FV={key:2,class:"o-btn__label"},Ke=c.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass(["o-btn",n.type?`type-${n.type}`:""]),onClick:r[0]||(r[0]=i=>t("click",i))},[n.loading?(c.openBlock(),c.createElementBlock("div",HV)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[n.icon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:n.icon,class:c.normalizeClass(n.iconClass)},null,8,["name","class"])):c.createCommentVNode("",!0)],64)),n.label?(c.openBlock(),c.createElementBlock("span",FV,c.toDisplayString(n.label),1)):c.createCommentVNode("",!0),c.renderSlot(o.$slots,"default")],2))}}),jV={class:"o-btn-group"},Yx=c.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(n,{emit:e}){return(t,o)=>(c.openBlock(),c.createElementBlock("div",jV,[c.renderSlot(t.$slots,"default")]))}}),UV={class:"o-checkbox"},WV={class:"o-checkbox__main"},qV={class:"o-checkbox__suffix"},km=c.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=c.computed({get(){return t.modelValue},set(i){o("update:modelValue",i)}});return(i,s)=>(c.openBlock(),c.createElementBlock("div",UV,[c.createElementVNode("div",WV,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),type:"checkbox"},null,512),[[c.vModelCheckbox,r.value]])]),c.createElementVNode("div",qV,c.toDisplayString(n.label),1)]))}}),KV={class:"dialog-header"},JV={class:"dialog-body"},GV={class:"dialog-footer"},wm=c.defineComponent({name:"ODialog",__name:"ODialog",props:{show:{type:Boolean},icon:{},title:{},dialogClass:{},fullscreen:{type:Boolean}},emits:["close","update:show"],setup(n,{emit:e}){const t=e,o=()=>{t("update:show",!1),t("close")};return(r,i)=>(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[n.show?(c.openBlock(),c.createElementBlock("div",{key:0,class:c.normalizeClass(["dialog-overlay o-dialog",n.dialogClass]),onClick:c.withModifiers(o,["self"])},[c.createElementVNode("div",{class:c.normalizeClass(["dialog-box",{fullscreen:n.fullscreen}])},[c.createElementVNode("div",KV,[c.renderSlot(r.$slots,"title",{},()=>[c.createTextVNode(c.toDisplayString(n.title),1)]),c.createVNode(c.unref(Ke),{icon:"close",class:"close",onClick:o})]),c.createElementVNode("div",JV,[c.renderSlot(r.$slots,"default")]),c.createElementVNode("div",GV,[c.renderSlot(r.$slots,"footer")])],2)],2)):c.createCommentVNode("",!0)]))}}),_t=c.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-divider",{"o-divider-vertical":n.vertical}])},null,2))}}),XV={key:0,class:"dialog-overlay o-image-viewer"},YV={class:"dialog-box"},QV={class:"dialog-body"},ZV=["src"],e2={class:"action-group"},t2={class:"action-group"},n2={class:"o-btn scale"},Qx=c.defineComponent({name:"ODialog",__name:"OImageViewer",props:{show:{type:Boolean,default:!1},title:{type:String,default:""},images:{type:Array,default:()=>[]},current:{type:Number,default:0}},emits:["update:show"],setup(n,{emit:e}){const t=n,o=e,{downloadImage:r}=Nd(),i=c.ref(0),s=c.ref(1),l=c.ref({x:0,y:0}),a=c.ref(!1),d=c.ref({x:0,y:0}),u=c.ref(null),f=c.ref(null),p={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},h=c.computed(()=>{const B=t.images.length;let _={};return B>0&&(_=i.value>=0&&i.value<B?t.images.at(i.value):t.images.at(0)),_}),m=c.computed(()=>({transform:`translate(${l.value.x}px, ${l.value.y}px) scale(${s.value})`,transformOrigin:"center center",cursor:a.value?"grabbing":s.value>1?"grab":"default"})),g=c.computed(()=>parseInt(`${s.value*100}`)),y=B=>{B.preventDefault();const _=-B.deltaY*p.WHEEL_SENSITIVITY;let D=s.value+_;if(D=Math.max(p.MIN_SCALE,Math.min(p.MAX_SCALE,D)),f.value&&u.value){const P=f.value.getBoundingClientRect(),R=B.clientX-P.left-P.width/2,K=B.clientY-P.top-P.height/2,H=D-s.value;l.value.x-=R*H,l.value.y-=K*H}s.value=D},b=B=>{s.value<=1||(B.preventDefault(),a.value=!0,d.value={x:B.clientX-l.value.x,y:B.clientY-l.value.y},document.addEventListener("mousemove",k),document.addEventListener("mouseup",x))},k=B=>{a.value&&(l.value.x=B.clientX-d.value.x,l.value.y=B.clientY-d.value.y)},x=()=>{a.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",x)},w=()=>{s.value=Math.min(p.MAX_SCALE,s.value+p.STEP)},C=()=>{s.value=Math.max(p.MIN_SCALE,s.value-p.STEP)},v=()=>{s.value=1,l.value={x:0,y:0}},E=()=>{i.value>0&&(i.value-=1,v())},T=()=>{i.value<t.images.length-1&&(i.value+=1,v())},A=()=>{v(),o("update:show",!1)},$=()=>{var B;r((B=h.value.attrs)==null?void 0:B.src)},O=B=>{if(t.show)switch(B.preventDefault(),B.stopPropagation(),B.key){case"+":case"=":B.preventDefault(),w();break;case"-":B.preventDefault(),C();break;case"0":B.preventDefault(),v();break;case"ArrowLeft":(B.ctrlKey||B.metaKey)&&(B.preventDefault(),E());break;case"ArrowRight":(B.ctrlKey||B.metaKey)&&(B.preventDefault(),T());break;case"Escape":A();break}};return c.watch(()=>t.current,B=>{i.value=B,v()}),c.onMounted(()=>{i.value=t.current,document.addEventListener("keydown",O)}),c.onBeforeUnmount(()=>{document.removeEventListener("keydown",O),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",x)}),(B,_)=>(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[n.show?(c.openBlock(),c.createElementBlock("div",XV,[c.createElementVNode("header",null,[c.createVNode(c.unref(Ke),{icon:"close",onClick:A})]),c.createElementVNode("div",YV,[c.createElementVNode("div",QV,[c.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:f,onWheel:c.withModifiers(y,["prevent"]),onDblclick:v},[c.createElementVNode("img",{ref_key:"imageRef",ref:u,src:h.value.attrs.src,alt:"image",style:c.normalizeStyle(m.value),onMousedown:b},null,44,ZV)],544)])]),c.createElementVNode("footer",null,[c.createElementVNode("div",e2,[c.createVNode(c.unref(Ke),{icon:"arrow_back",class:c.normalizeClass({disabled:i.value<=0}),onClick:E},null,8,["class"]),c.createVNode(c.unref(Ke),{icon:"arrow_back","icon-class":"rotate-180",class:c.normalizeClass({disabled:i.value>=t.images.length-1}),onClick:T},null,8,["class"])]),c.createElementVNode("div",t2,[c.createVNode(c.unref(Ke),{icon:"horizontal_rule",onClick:C}),c.createElementVNode("div",n2,c.toDisplayString(g.value)+"%",1),c.createVNode(c.unref(Ke),{icon:"add",onClick:w}),c.createVNode(c.unref(Ke),{icon:"download",onClick:$}),c.createVNode(c.unref(Ke),{icon:"close",onClick:A})])])])):c.createCommentVNode("",!0)]))}}),o2={class:"o-input__prefix"},r2={class:"o-input__main"},i2=["placeholder"],s2={class:"o-input__suffix"},jn=c.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","enter","focus","update:modelValue"],setup(n,{expose:e,emit:t}){const o=n,r=t,i=c.ref(null),s=c.computed({get(){return o.modelValue},set(d){r("update:modelValue",d)}});function l(){var d;(d=i.value)==null||d.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(d,u)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-input",`type-${n.type}`])},[c.createElementVNode("div",o2,[c.renderSlot(d.$slots,"prefix")]),c.createElementVNode("div",r2,[c.withDirectives(c.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":u[0]||(u[0]=f=>s.value=f),placeholder:n.placeholder,onFocus:u[1]||(u[1]=f=>r("focus")),onBlur:u[2]||(u[2]=f=>r("blur")),onKeyup:u[3]||(u[3]=c.withKeys(f=>r("enter"),["enter"]))},null,40,i2),[[c.vModelText,s.value]])]),c.createElementVNode("div",s2,[c.renderSlot(d.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(X,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),Et=c.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("ul",{class:c.normalizeClass(["o-list",{clickable:n.clickable,hoverable:n.hoverable}])},[c.renderSlot(e.$slots,"default")],2))}}),l2={class:"o-list-item"},a2={class:"o-list-item__prefix"},c2={class:"o-list-item__main"},d2={class:"o-list-item__suffix"},kt=c.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("li",l2,[c.createElementVNode("div",a2,[c.renderSlot(e.$slots,"prefix")]),c.createElementVNode("div",c2,[c.renderSlot(e.$slots,"default")]),c.createElementVNode("div",d2,[c.renderSlot(e.$slots,"suffix")])]))}}),De=c.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(n,{expose:e,emit:t}){const o=n,r=t,{theme:i}=xi(),s=c.ref(null),l=c.ref(),a=c.ref();function d(h){var m,g,y,b;h?((g=a.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?u:null}),(y=a.value)==null||y.show()):(b=a.value)==null||b.hide()}function u(){var h,m;return{width:0,height:0,left:o.event.clientX,right:o.event.clientX,top:o.event.clientY,bottom:o.event.clientY,x:((h=o.event)==null?void 0:h.clientX)||0,y:((m=o.event)==null?void 0:m.clientY)||0,toJSON:()=>{var g,y;return{width:100,height:100,left:((g=o.event)==null?void 0:g.clientX)||0,top:((y=o.event)==null?void 0:y.clientY)||0}}}}function f(){a.value=Go(s.value,{appendTo:()=>document.body,animation:"shift-away",arrow:o.arrow,content:l.value,duration:o.duration,delay:o.delay,interactive:!0,offset:o.offset,placement:o.placement,trigger:o.trigger,theme:i.value,onShow:h=>{h.popper.classList.add(o.tippyClass||"tippy"),r("update:show",!0)},onHide:h=>{r("update:show",!1)}})}function p(){a.value.setProps({theme:i.value})}return c.watch(i,h=>{p()}),e({setShow:d}),c.onMounted(()=>{f()}),c.onUnmounted(()=>{a.value&&a.value.destroy()}),(h,m)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"triggerRef",ref:s,"data-tippy-role":"popover",class:"o-popover"},[c.renderSlot(h.$slots,"trigger"),n.disable?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"contentRef",ref:l,class:c.normalizeClass(["popover-content",n.contentClass])},[c.renderSlot(h.$slots,"default")],2))],512))}}),u2={class:"o-textarea__prefix"},f2={class:"o-textarea__main"},p2=["placeholder","rows"],h2={class:"o-textarea__suffix"},Zx=c.defineComponent({__name:"OTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""},rows:{type:Number,default:3}},emits:["blur","focus","update:modelValue"],setup(n,{expose:e,emit:t}){const o=n,r=t,i=c.ref(null),s=c.computed({get(){return o.modelValue},set(d){r("update:modelValue",d)}});function l(){var d;(d=i.value)==null||d.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(d,u)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-textarea",`type-${n.type}`])},[c.createElementVNode("div",u2,[c.renderSlot(d.$slots,"prefix")]),c.createElementVNode("div",f2,[c.withDirectives(c.createElementVNode("textarea",{ref_key:"input",ref:i,"onUpdate:modelValue":u[0]||(u[0]=f=>s.value=f),placeholder:n.placeholder,rows:n.rows,onFocus:u[1]||(u[1]=f=>r("focus")),onBlur:u[2]||(u[2]=f=>r("blur"))},null,40,p2),[[c.vModelText,s.value]])]),c.createElementVNode("div",h2,[c.renderSlot(d.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(X,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),eC={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},m2=(n,e)=>{const t=eC[n];return t?t[e]:null},xm={writing:`
24
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var s=r.reduce(function(c,p){var d=p&&pc(p,l);return d&&c.push(d),c},[]);return Xt(t)?s[0]:s}Ge.defaultProps=we,Ge.setDefaultProps=ic,Ge.currentInput=Re,Object.assign({},sl,{effect:function(o){var n=o.state,l={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,l.popper),n.styles=l,n.elements.arrow&&Object.assign(n.elements.arrow.style,l.arrow)}}),Ge.setDefaultProps({render:ql});const fc=new ha({breaks:!0});function sn(){return{md:fc}}function uo(){const t=(l,r,a)=>{const i={type:"text/plain"};switch(l){case"svg":i.type="image/svg+xml;charset=utf-8";break}const s=new Blob([a],i),c=URL.createObjectURL(s),p=document.createElement("a");p.href=c,p.download=r,p.click(),URL.revokeObjectURL(c)},o=async l=>{try{const a=await(await fetch(l)).blob(),i=window.URL.createObjectURL(a),s=n(l),c=document.createElement("a");c.href=i,c.download=s,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(i)}catch{window.open(l,"_blank")}},n=(l,r="png")=>{try{const s=new URL(l).pathname.split("/"),c=s[s.length-1];return c&&c.includes(".")?decodeURIComponent(c):`image-${Date.now()}.${r}`}catch{return`download-${Date.now()}.${r}`}};return{commonDownload:t,downloadImage:o}}function Wl(){const t=e.ref(),o=e.ref(!1);function n(i){t.value=i,i.editor.on("selectionUpdate",a)}function l(){var i;(i=t.value)==null||i.editor.off("selectionUpdate",a)}const r=e.computed(()=>{var c;const i=(c=t.value)==null?void 0:c.getPos();if(typeof i!="number")return null;const s=t.value.editor.state.doc.nodeAt(i);return s?{start:i+1,end:i+s.nodeSize-1}:null}),a=()=>{if(!t.value)return;const{editor:i}=t.value;if(!i.isFocused){o.value=!1;return}const{selection:s}=i.state;s&&(o.value=(s==null?void 0:s.$from.pos)>=r.value.start&&(s==null?void 0:s.$to.pos)<=r.value.end)};return{isFocused:o,bind:n,unbind:l,checkFocus:a}}function I(){const t=e.inject("locale",{value:"en"}),o=e.computed(()=>ka.getMessage(t.value)),n=e.computed(()=>{var r;return((r=o.value)==null?void 0:r.name)||"English"});function l(r){return r.split(".").reduce((a,i)=>{if(a)return a[i]},o.value)}return{languageName:n,locale:t,message:o,tr:l}}const mo=[{type:"paragraph",content:[]}],uc={type:"aiBlock",content:mo},mc={type:"audio",attrs:{src:"//init.mp3"}},gc={type:"blockquote",content:mo},bc={type:"callout",attrs:{icon:"💡"},content:mo},hc={type:"codeBlock",attrs:{attrs:{language:"shell"}},content:[]},kc={type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:mo}]},Yl={type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
25
+ Mermaid --> Diagram`}]},yc={type:"paragraph",content:[{type:"text",text:":"}]},wc={type:"image",attrs:{src:"init"}},Cc=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],xc={type:"table",content:Array.from({length:3},()=>({type:"tableRow",content:Array.from({length:3},()=>({type:"tableCell",content:[{type:"paragraph"}]}))}))},_c=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],Bc={type:"video",attrs:{src:"init"}};function W(){const t=e.inject("isEditable",{value:!0});function o(a,i,s={}){if(!a.isEditable)return;const c=a==null?void 0:a.chain().focus(),p=a==null?void 0:a.commands;switch(i){case"inlineMath":l(a);break;default:n(p,c,i,s);break}}function n(a,i,s,c={}){switch(s){case"aiBlock":i.toggleAiBlock().run();break;case"audio":i.setAudio({src:"//init.mp3"}).run();break;case"highlight":c.color?a.setHighlight({color:c.color}):a.unsetHighlight();break;case"backgroundColor":c.color?a.setBackgroundColor(c.color):a.unsetBackgroundColor();break;case"blockMath":a.insertBlockMath({latex:""});break;case"blockquote":i.toggleBlockquote().run();break;case"bold":i.toggleBold().run();break;case"bulletList":i.toggleBulletList().run();break;case"callout":i.toggleCallout().run();break;case"clearFormat":i.unsetAllMarks().run();break;case"code":i.toggleCode().run();break;case"codeBlock":a.toggleCodeBlock({language:"bash"});break;case"color":i.setColor(c.color).run();break;case"copySelected":a.copySelected();break;case"content":a.insertContent(c.content);break;case"deleteSelected":a.deleteSelected();break;case"details":c.type==="detailsSummary"?a.unsetDetails():a.setDetails();break;case"diagram":a.insertContent(Yl);break;case"duplicateSelected":a.duplicateSelected();break;case"emoji":a.insertContent(":");break;case"fontFamily":a.setFontFamily(c.fontFamily);break;case"heading":i.toggleHeading(c).run();break;case"horizontalRule":i.setHorizontalRule().run();break;case"image":i.setImage({src:"init"}).run();break;case"imageUpdate":i.setImage(c).run();break;case"inlineMathDelete":a.deleteInlineMath(c);break;case"inlineMathInsert":a.insertInlineMath(c);break;case"inlineMathUpdate":a.updateInlineMath(c);break;case"italic":i.toggleItalic().run();break;case"linkSet":i.extendMarkRange("link").setLink(c).run();break;case"linkUnset":i.extendMarkRange("link").unsetLink().run();break;case"modelViewer":i.setModelViewer({src:"init"}).run();break;case"multiColumn":a.insertMultiColumn(2);break;case"orderedList":i.toggleOrderedList().run();break;case"paragraph":i.setParagraph().run();break;case"strike":i.toggleStrike().run();break;case"subscript":a.toggleSubscript();break;case"superscript":a.toggleSuperscript();break;case"table":i.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":case"tableAddColumnAfter":i.addColumnAfter().run();break;case"tableAddColumnBefore":i.addColumnBefore().run();break;case"tableAddRow":case"tableAddRowAfter":i.addRowAfter().run();break;case"tableAddRowBefore":i.addRowBefore().run();break;case"tableCellAttribute":i.setCellAttribute(c.name,c.value).run();break;case"tableDeleteColumn":i.deleteColumn().run();break;case"tableDeleteRow":i.deleteRow().run();break;case"tableDelete":i.deleteTable().run();break;case"tableInsert":i.insertTable(c).run();break;case"tableMergeCells":i.mergeCells().run();break;case"tableSelectColumn":i.selectColumn(c.pos).run();break;case"tableSelectRow":i.selectRow(c.pos).run();break;case"tableSplitCell":i.splitCell().run();break;case"taskList":a.toggleTaskList();break;case"textAlign":i.setTextAlign(c.textAlign).run();break;case"underline":i.toggleUnderline().run();break;case"video":i.setVideo({src:"init"}).run()}}function l(a){const{state:i,view:s}=a,{from:c}=i.selection,d=s.domAtPos(c).node.getBoundingClientRect(),f=i.tr.setMeta(ot.InlinePlaceholderKey,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:c,rect:d}}).setSelection(i.selection);s.dispatch(f)}function r(a){const i=[];return a.state.doc.descendants((s,c)=>{s.type.name==="image"&&i.push({pos:c,attrs:s.attrs})}),i}return{isEditable:t,onCommand:n,run:o,getEditorImages:r}}function dn(){const{tr:t}=I(),{isEditable:o,run:n}=W(),l=e.ref(null),r=e.ref(!1),a=e.ref(!1),i=e.computed(()=>[{label:t("table.selectColumn"),value:"selectColumn",icon:"select_all"},{label:t("table.insertLeft"),value:"tableAddColumnBefore",icon:"arrow_back"},{label:t("table.insertRight"),value:"tableAddColumnAfter",icon:"arrow_back",class:"rotate-180"},{label:t("editor.delete"),value:"tableDeleteColumn",icon:"delete"}]),s=e.computed(()=>[{label:t("table.selectRow"),value:"selectRow",icon:"select_all"},{label:t("table.insertAbove"),value:"tableAddRowBefore",icon:"arrow_back",class:"rotate-90"},{label:t("table.insertBelow"),value:"tableAddRowAfter",icon:"arrow_back",class:"rotate-270"},{label:t("editor.delete"),value:"tableDeleteRow",icon:"delete"}]),c=e.computed(()=>{var V;const{state:m}=l.value.editor,h=(V=l.value)==null?void 0:V.getPos(),b=m.doc.resolve(h);let y=null,x=-1;for(let B=b.depth;B>0;B--)if(b.node(B).type.name==="table"){y=b.node(B),x=b.before(B);break}if(!y)return{rowIndex:-1,colIndex:-1};const k=ya.TableMap.get(y),_=h-x-1,g=k.findCell(_);return{rowIndex:g.top,colIndex:g.left}});function p(m){l.value=m}function d(){var m;r.value=!1,u("tableSelectColumn",{pos:(m=l.value)==null?void 0:m.getPos()})}function f(){var m;a.value=!1,u("tableSelectRow",{pos:(m=l.value)==null?void 0:m.getPos()})}function u(m,h={}){switch(console.log("runCommand",m,h),m){case"selectColumn":d();return;case"selectRow":f();return;case"tableAddRowAfter":case"tableAddRowBefore":case"tableDeleteRow":a.value=!1;break;case"tableAddColumnAfter":case"tableAddColumnBefore":case"tableDeleteColumn":r.value=!1;break}setTimeout(()=>{var b;n((b=l.value)==null?void 0:b.editor,m,h)},0)}return{showColPopover:r,showRowPopover:a,columnActions:i,rowActions:s,isEditable:o,cellInfo:c,initProps:p,selectColumn:d,selectRow:f,runCommand:u}}function it(){const t=e.inject("darkMode",{value:!1}),o=e.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:o}}const Ce=e.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(t){const o=t,{theme:n}=it(),l=e.ref(),r=e.ref(),a=e.ref();function i(){a.value=Ge(l.value,{appendTo:()=>document.body,animation:"perspective",content:r.value,duration:o.duration,delay:o.delay,interactive:!0,offset:o.offset,placement:o.placement,trigger:o.trigger})}function s(){a.value.setProps({theme:n.value})}return e.watch(n,c=>{s()}),e.onMounted(()=>{i()}),e.onUnmounted(()=>{a.value&&a.value.destroy()}),(c,p)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"triggerRef",ref:l,"data-tippy-role":"tooltip"},[e.renderSlot(c.$slots,"trigger"),e.createElementVNode("div",{ref_key:"contentRef",ref:r,class:"tooltip-content"},[e.renderSlot(c.$slots,"default")],512)],512))}}),X=e.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:o}){const n=o;return(l,r)=>(e.openBlock(),e.createBlock(Ce,{class:"o-tooltip",placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("button",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=a=>n("click",a))},[e.createVNode(O,{name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"]),e.renderSlot(l.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Vc=e.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const o=t,{run:n}=W(),{tr:l}=I(),r=e.computed(()=>({aiBlock:{icon:"auto_awesome",tooltip:l("editor.aiBlock")},audio:{icon:"graphic_eq",tooltip:l("label.audio")},blockMath:{icon:"functions",tooltip:l("editor.blockMath")},blockquote:{icon:"format_quote_open",tooltip:l("editor.blockquote")},bold:{icon:"format_bold",tooltip:l("editor.bold")},callout:{icon:"card_text",tooltip:l("editor.callout")},clearFormat:{icon:"format_clear",tooltip:l("editor.removeFormat")},code:{icon:"code",tooltip:l("editor.code")},codeBlock:{icon:"code_braces",tooltip:l("editor.codeBlock")},diagram:{icon:"mermaid",tooltip:l("diagram.name")},horizontalRule:{icon:"horizontal_rule",tooltip:l("editor.hr")},italic:{icon:"format_italic",tooltip:l("editor.italic")},image:{icon:"image",tooltip:l("editor.photo")},inlineMath:{icon:"function",tooltip:l("editor.inlineMath")},inlineMathDelete:{icon:"close",tooltip:l("editor.delete")},linkUnset:{icon:"link_off",tooltip:l("link.off")},modelViewer:{icon:"3d_rotation",tooltip:l("label.modelViewer")},multiColumn:{icon:"view_column",tooltip:l("editor.multiColumn")},strike:{icon:"format_strikethrough",tooltip:l("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:l("editor.underline")},video:{icon:"videocam",tooltip:l("editor.video")}})),a=e.computed(()=>r.value[o.name]||{icon:"",isActive:!1,command:()=>{}});function i(){n(o.editor,o.name)}return(s,c)=>{var p;return e.openBlock(),e.createBlock(X,{class:"o-simple-command-btn",icon:a.value.icon,tooltip:a.value.tooltip,"content-class":{"is-active":(p=t.editor)==null?void 0:p.isActive(t.name),"rotate-90":a.value.rotate},onClick:i},null,8,["icon","tooltip","content-class"])}}}),pn=e.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"click"}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_left"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"},{label:n("editor.justify"),value:"justify",icon:"format_align_justify"}]);function i(s){var c;(c=r.value)==null||c.setShow(!1),l(o.editor,"textAlign",{textAlign:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",placement:t.placement,trigger:t.trigger},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:e.unref(n)("editor.align")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(p,d)=>{var f;return e.openBlock(),e.createBlock(e.unref(ce),{key:d,class:e.normalizeClass({"is-active":(f=t.editor)==null?void 0:f.isActive({textAlign:p.value})}),onClick:u=>i(p.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:p.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var u;return[(u=t.editor)!=null&&u.isActive({textAlign:p.value})?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),Gl=e.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(t,{emit:o}){const n=t,l=o,{tr:r}=I(),{run:a}=W(),i=e.ref(null),s=e.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function c(d){return n.modelValue===d.value}function p(d){var f;(f=i.value)==null||f.setShow(!1),l("download",d.value)}return(d,f)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:i,class:"o-simple-command-btn","content-class":"dropdown",placement:"bottom-end",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{"content-class":"o-code-block-download-dropdown dropdown",icon:"download",tooltip:e.unref(r)("label.download")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(u,m)=>(e.openBlock(),e.createBlock(e.unref(ce),{key:m,class:e.normalizeClass({"is-active":c(u)}),onClick:h=>p(u)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:u.icon},null,8,["name"])]),suffix:e.withCtx(()=>[c(u)?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},512))}}),Kl=e.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,l=o,{tr:r}=I(),{run:a}=W(),i=e.ref(null),s=e.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:r("label.preview"),value:"preview",icon:"mermaid"},{label:r("label.splitHorizontal"),value:"splitHorizontal",icon:"splitscreen_right"},{label:r("label.splitVertical"),value:"splitVertical",icon:"splitscreen_bottom"},{label:r("label.help"),value:"help",icon:"help",suffixIcon:"open_in_new",separator:!0}]),c=e.computed(()=>s.value.find(f=>f.value===n.modelValue));function p(f){return n.modelValue===f.value}function d(f){var u;switch((u=i.value)==null||u.setShow(!1),f.value){case"help":window.open("https://mermaid.js.org/intro/","target");break;default:l("update:modelValue",f.value)}}return(f,u)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:i,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{"content-class":"o-code-block-view-dropdown dropdown",icon:c.value.icon,tooltip:e.unref(r)("label.view")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(m,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:h},[m.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ce),{class:e.normalizeClass({"is-active":p(m)}),onClick:b=>d(m)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:m.icon},null,8,["name"])]),suffix:e.withCtx(()=>[m.suffixIcon?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:m.suffixIcon,small:""},null,8,["name"])):p(m)?(e.openBlock(),e.createBlock(e.unref(O),{key:1,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),sm={key:1,class:"group o-tips"},Xl=e.defineComponent({__name:"OExtensionDropdown",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(),a=e.computed(()=>[{label:n("editor.multiColumn"),value:"multiColumn",icon:"view_column"},{label:n("diagram.name"),value:"diagram",icon:"mermaid",separator:!0},{label:n("label.image"),value:"image",icon:"image",group:n("label.media"),separator:!0},{label:n("label.video"),value:"video",icon:"videocam"},{label:n("label.audio"),value:"audio",icon:"graphic_eq"},{label:n("label.model3d"),value:"modelViewer",icon:"3d_rotation"},{label:n("editor.inlineMath"),value:"inlineMath",icon:"function",separator:!0},{label:n("editor.blockMath"),value:"blockMath",icon:"functions"}]);function i(s){var c;(c=r.value)==null||c.setShow(!1),l(o.editor,s)}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"extension","content-class":"o-extension-dropdown dropdown",tooltip:e.unref(n)("label.more")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(p,d)=>{var f;return e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[p.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),(p.group,e.createCommentVNode("",!0)),e.createVNode(e.unref(ce),{class:e.normalizeClass({"is-active":(f=t.editor)==null?void 0:f.isActive(p.value)}),onClick:u=>i(p.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:p.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var u;return[(u=t.editor)!=null&&u.isActive(p.value)?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),fn=e.defineComponent({__name:"OLinkBtn",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(),a=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var u;i.value="",s.value=!0;const f=(u=o.editor)==null?void 0:u.getAttributes("link");f!=null&&f.href&&(i.value=f.href,s.value=f.target==="_blank",console.log("show",a.value,f,s.value))}function p(){var f;(f=r.value)==null||f.setShow(!1)}function d(f){var u;f?l(o.editor,"linkSet",{href:f,target:s.value?"_blank":""}):l(o.editor,"linkUnset"),(u=r.value)==null||u.setShow(!1)}return(f,u)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:a.value,"onUpdate:show":[u[1]||(u[1]=m=>a.value=m),c]},{trigger:e.withCtx(()=>{var m;return[e.createVNode(e.unref(ie),{icon:"link","content-class":{"is-active":(m=t.editor)==null?void 0:m.isActive("link")},tooltip:e.unref(n)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:e.withCtx(()=>[a.value?(e.openBlock(),e.createBlock(e.unref(Co),{key:0,title:e.unref(n)("editor.hyperlink"),val:i.value,icon:"link",onCancel:p,onConfirm:d},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Vn),{modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=m=>s.value=m),label:e.unref(n)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Ec={class:"o-block-placeholder"},Nc={class:"icon"},Sc={class:"placeholder"},Nt=e.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("section",Ec,[e.createElementVNode("div",Nc,[e.createVNode(e.unref(O),{name:t.icon},null,8,["name"])]),e.createElementVNode("div",Sc,e.toDisplayString(t.placeholder),1)]))}}),Oc={class:"group o-tips"},Ac={key:1,class:"item"},go=e.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(t,{emit:o}){const n=t,l=o,{tr:r}=I(),a=e.ref([]),i=(m,h)=>{m&&(a.value[h]=m)},s=e.ref(0);function c(m,h,b){l("select",m,b),a.value[h]&&a.value[h].setShow(!1)}function p(){s.value=(s.value+n.items.length-1)%n.items.length}function d(){s.value=(s.value+1)%n.items.length}function f(){c(n.items[s.value],s.value)}function u(m){switch(m.key){case"ArrowUp":m.preventDefault(),p();break;case"ArrowDown":m.preventDefault(),d();break;case"Enter":m.preventDefault(),f();break}}return e.watch(()=>n.useKeyboard,m=>{m?window.addEventListener("keydown",u):window.removeEventListener("keydown",u)}),e.onMounted(()=>{n.useKeyboard&&window.addEventListener("keydown",u)}),e.onBeforeUnmount(()=>{n.useKeyboard&&window.removeEventListener("keydown",u)}),(m,h)=>(e.openBlock(),e.createBlock(e.unref(se),{class:"o-block-list",hoverable:"",clickable:""},{default:e.withCtx(()=>[t.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.items,(b,y)=>{var x;return e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[b.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[y>0?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",Oc,e.toDisplayString(e.unref(r)(b.group)),1)],64)):e.createCommentVNode("",!0),(x=b.children)!=null&&x.length?(e.openBlock(),e.createBlock(e.unref(Z),{key:1,ref_for:!0,ref:k=>i(k,y),placement:"right-start",offset:[-10,16]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(un),{item:b,class:e.normalizeClass(["item",{"is-active":y===s.value}]),clickable:""},null,8,["item","class"])]),default:e.withCtx(()=>[e.createVNode(e.unref(go),{items:b.children,onSelect:k=>c(b,y,k)},null,8,["items","onSelect"])]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(un),{key:2,item:b,class:e.normalizeClass(["item",{"is-active":y===s.value}]),clickable:"",onClick:k=>c(b,y)},null,8,["item","class","onClick"]))],64)}),128)):(e.openBlock(),e.createElementBlock("div",Ac,e.toDisplayString(e.unref(r)("label.noResults")),1))]),_:1}))}}),$c={key:0,class:"o-tips"},un=e.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(t,{emit:o}){const{tr:n}=I();return(l,r)=>(e.openBlock(),e.createBlock(e.unref(ce),{class:"o-block-list-item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:t.item.icon,color:t.item.color},null,8,["name","color"])]),suffix:e.withCtx(()=>{var a;return[t.item.tips?(e.openBlock(),e.createElementBlock("span",$c,e.toDisplayString(t.item.tips),1)):e.createCommentVNode("",!0),(a=t.item.children)!=null&&a.length?(e.openBlock(),e.createBlock(e.unref(O),{key:1,name:"navigate_next",class:"o-tips"})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(n)(t.item.label)),1)]),_:1}))}}),Jl=(t,o)=>oe.generateJSON(o,t.extensionManager.extensions),mn=(t,o)=>{const n=document.createElement("div");return n.innerHTML=o,In.DOMParser.fromSchema(t.schema).parse(n).toJSON()},Tc=(t,o)=>{const n=document.createElement("div");return n.innerHTML=o,In.DOMParser.fromSchema(t.schema).parse(n).toJSON()},Zl=()=>{const t=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return{mod:t?"⌘":"Ctrl",alt:t?"⌥":"Alt",shift:t?"⇧":"Shift",ctrl:t?"⌃":"Ctrl",meta:t?"⌘":"Meta"}},Ql=t=>{const o=t==null?void 0:t.split("+").map(r=>r.trim().toLowerCase()).filter(Boolean);if(!o||!o.length)return t;const n=Zl();return o.map(r=>n[r]??r.toUpperCase()).join("+")},q={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},Zt=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",keywords:"h1",tips:"#",icon:"format_h1",color:q.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:q.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:q.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:q.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:q.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:q.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:q.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:q.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:q.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:q.blue},{label:"editor.callout",value:"callout",color:q.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:q.blue}],bo=Zt.filter(t=>t.style),ho=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:q.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:q.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:q.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:q.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:q.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:q.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:q.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:q.purple},{label:"label.audio",value:"audio",icon:"graphic_eq",tips:"audio",color:q.teal},{label:"label.model3d",value:"modelViewer",icon:"3d_rotation",tips:"model",color:q.purple}],er=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:q.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:q.indigo,tips:"math",keywords:"block, math, equation"},{label:"editor.multiColumn",value:"multiColumn",icon:"view_column",color:q.amber,tips:"column",keywords:"column,columns"}],ko=[...Zt,...ho,...er],yo=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:q.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:q.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:q.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:q.blue,filter:"audio,image,video,modelViewer"},{label:"label.color",value:"color",icon:"palette",color:q.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:q.purple,filter:"callout",component:"OCalloutColorBoard"}],tr=[{label:"ai.improveWriting",value:"improveWriting",icon:"title",color:q.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fixSpellingGrammar",value:"fixSpellingGrammar",icon:"spellcheck",color:q.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrichWithEmoji",value:"enrichWithEmoji",icon:"emoji_emotions",color:q.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:q.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.english",value:"English",icon:"language"},{label:"language.chineseSimplified",value:"Simplified Chinese",icon:"language"},{label:"language.chineseTraditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"},{label:"language.portuguese",value:"Portuguese",icon:"language"},{label:"language.spanish",value:"Spanish",icon:"language"},{label:"language.russian",value:"Russian",icon:"language"},{label:"language.italian",value:"Italian",icon:"language"},{label:"language.vietnamese",value:"Vietnamese",icon:"language"},{label:"language.polish",value:"Polish",icon:"language"},{label:"language.indonesian",value:"Indonesian",icon:"language"}]},{label:"ai.makeLonger",value:"makeLonger",icon:"subject",color:q.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.makeShorter",value:"makeShorter",icon:"short_text",color:q.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.changeTone",value:"changeTone",icon:"invert_colors",color:q.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:q.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],or=[{label:"ai.summarize",value:"summarize",icon:"notes",color:q.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:q.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],Dc={key:1,class:"group o-tips"},Mc={class:"suffix o-tips"},Lc={key:1,class:"item"},Ke=e.defineComponent({__name:"OBlockMenu",props:{...P.nodeViewProps,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(t,{emit:o}){const n=t,l=o,{tr:r}=I(),{run:a}=W(),i=e.ref([]),s=e.computed(()=>{var x;return(x=n.node)==null?void 0:x.type.name}),c=e.computed(()=>bo.find(x=>x.value===s.value)),p=e.computed(()=>{const x=c.value?yo.filter(g=>{var V;return((V=g.filter)==null?void 0:V.indexOf("style"))>=0})??[]:[];let k=yo.filter(g=>{var V;return((V=g.filter)==null?void 0:V.indexOf(s.value))>=0})??[];if(k=k.concat(x),k.length>0){const g=k[0];g.group=`editor.${s.value}`}const _=yo.filter(g=>{var V;return((V=g.filter)==null?void 0:V.indexOf("common"))>=0});return[...k,..._]});function d(x){switch(x.component){case"OCalloutColorBoard":return gn;case"OTextColorBoard":return bn;default:return null}}function f(x){setTimeout(()=>{u(x),l("action",x)},0)}function u(x){switch(x.value){case"copy":m();break;case"delete":h();break;case"duplicate":b();break}}function m(){a(n.editor,"copySelected")}function h(){a(n.editor,"deleteSelected")}function b(){a(n.editor,"duplicateSelected")}function y(x,k){switch(console.log("select",x,k),k.name){case"backColor":n.updateAttributes({backColor:k.value});break;case"foreColor":n.updateAttributes({borderColor:k.value});break;case"color":a(n.editor,k.name,{color:k.value});break;case"backgroundColor":a(n.editor,k.name,{color:k.value});break}}return(x,k)=>(e.openBlock(),e.createBlock(e.unref(se),{class:"o-block-menu",hoverable:"",clickable:""},{default:e.withCtx(()=>[p.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(p.value,(_,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[_.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[g>0||c.value?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),t.showGroup?(e.openBlock(),e.createElementBlock("div",Dc,e.toDisplayString(e.unref(r)(_.group)),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),d(_)?(e.openBlock(),e.createBlock(e.unref(Z),{key:1,ref_for:!0,ref:i.value[_.value],offset:[0,4],placement:"right"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ce),{class:"item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:_.icon,color:t.colorful?_.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"navigate_next",class:"o-tips"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)(_.label)),1)]),_:2},1024)]),default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d(_)),{onSelect:V=>y(_,V)},null,40,["onSelect"]))]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(ce),{key:2,class:"item",clickable:"",onClick:e.withModifiers(V=>f(_),["stop"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:_.icon,color:t.colorful?_.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("div",Mc,e.toDisplayString(e.unref(Ql)(_.tips)),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)(_.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(e.openBlock(),e.createElementBlock("div",Lc,"No result"))]),_:1}))}}),ve=e.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(t,{emit:o}){const n=t,l=o,r=e.ref();function a(s){l("update:modelValue",s)}function i(){console.log("click outside"),n.hideClickOutside&&l("update:modelValue",!1)}return e.watch(()=>n.modelValue,s=>{var c,p;s&&!n.readonly?(c=r.value)==null||c.setShow(!0):(p=r.value)==null||p.setShow(!1)}),e.onMounted(()=>{var s;n.modelValue&&((s=r.value)==null||s.setShow(!0))}),e.onUnmounted(()=>{var s;(s=r.value)==null||s.setShow(!1)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,placement:t.placement,"tippy-class":t.tippyClass,"content-class":t.contentClass,trigger:"manual",arrow:t.showArrow,offset:t.offset,show:t.modelValue&&!t.readonly,"onUpdate:show":a,onClickoutside:i},{trigger:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),default:e.withCtx(()=>[e.renderSlot(s.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),Pc={class:"o-block-toolbar editable-only"},Rc={class:"button-group"},Qt=e.defineComponent({__name:"OBlockToolbar",props:{...P.nodeViewProps,type:{type:String,default:"link"},trigger:{type:String,default:"click"}},emits:["action"],setup(t,{emit:o}){const n=t,l=o,{locale:r,tr:a}=I(),{isEditable:i,run:s}=W(),c=e.ref();function p(d){var f;l("action",d),(f=c.value)==null||f.setShow(!1)}return(d,f)=>(e.openBlock(),e.createElementBlock("div",Pc,[e.createElementVNode("section",Rc,[e.renderSlot(d.$slots,"default"),e.createVNode(e.unref(Z),{ref_key:"popover",ref:c,placement:"bottom-end",size:"medium",trigger:t.trigger,"show-arrow":!1},{trigger:e.withCtx(()=>[e.unref(i)?(e.openBlock(),e.createBlock(e.unref(ie),{key:0,icon:"more_horiz",tooltip:e.unref(a)("label.more")},null,8,["tooltip"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(n,{onAction:p}),null,16)]),_:1},8,["trigger"])])]))}}),vc={class:"o-callout-color-board"},Ic={class:"fore-colors"},jc={class:"color-row"},Fc={class:"color-row"},zc={class:"back-colors"},Hc={class:"color-row"},Uc={class:"color-row"},gn=e.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:o}){const n=o;function l(i,s){n("select",{name:i,value:s.value})}const r=e.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),a=e.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(i,s)=>(e.openBlock(),e.createElementBlock("section",vc,[e.createElementVNode("section",Ic,[s[4]||(s[4]=e.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),e.createElementVNode("div",jc,[e.createVNode(e.unref(X),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:s[0]||(s[0]=c=>l("foreColor",{value:""}))}),t.foreColor?(e.openBlock(),e.createBlock(e.unref(X),{key:0,tooltip:"Last used","content-style":{borderColor:t.foreColor},onClick:s[1]||(s[1]=c=>l("foreColor",{value:t.foreColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Fc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(c,p)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${p}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:d=>l("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),e.createElementVNode("section",zc,[s[5]||(s[5]=e.createElementVNode("div",{class:"label o-tips"},"Background",-1)),e.createElementVNode("div",Hc,[e.createVNode(e.unref(X),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:s[2]||(s[2]=c=>l("backColor",{value:"#F5F5F5"}))}),t.backColor?(e.openBlock(),e.createBlock(e.unref(X),{key:0,"content-style":{backgroundColor:t.backColor},tooltip:"Last used","content-class":"border",onClick:s[3]||(s[3]=c=>l("backColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Uc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,p)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${p}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:d=>l("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),qc=e.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:o}){const n=o,{tr:l}=I(),{run:r}=W(),a=e.ref(null),i=e.ref(""),s=e.ref("");function c(p,d){p==="foreColor"?(i.value=d,localStorage.setItem("yiitap.text-color.fore",d)):p==="backColor"&&(s.value=d,localStorage.setItem("yiitap.text-color.back",d)),n("select",p,d)}return e.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(p,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:a,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"palette",tooltip:e.unref(l)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var f;return[e.createVNode(e.unref(gn),{"fore-color":i.value,"back-color":s.value,"default-label":e.unref(l)("editor.defaultColor"),"active-color":(f=t.editor)==null?void 0:f.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),ct=e.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,l=o,r=e.ref();e.computed(()=>{var s;return n.clientX||((s=n.event)==null?void 0:s.clientX)||0}),e.computed(()=>{var s;return n.clientY||((s=n.event)==null?void 0:s.clientY)||0});function a(s){l("update:modelValue",s)}function i(){l("update:modelValue",!1)}return e.watch(()=>n.modelValue,s=>{var c;s?setTimeout(()=>{var p;(p=r.value)==null||p.setShow(s)},0):(c=r.value)==null||c.setShow(s)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,placement:"bottom-start",trigger:"manual",show:t.modelValue,"show-arrow":!1,event:t.event,"onUpdate:show":a,onClickoutside:i},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3},8,["show","event"]))}}),Wc={class:"o-color-board"},Yc={class:"cell-container"},Gc={class:"label"},Kc=["onClick"],st=e.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},defaultDisabled:{type:Boolean,default:!1},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:o}){const n=t,l=o;function r(c){l("select",c.hex)}function a(c){return n.activeColor===c}function i(c){return"abc"}const s=e.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(c,p)=>(e.openBlock(),e.createElementBlock("section",Wc,[t.defaultDisabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"default-color",onClick:p[0]||(p[0]=d=>r({hex:t.defaultColor}))},[e.createElementVNode("div",Yc,[e.createElementVNode("div",{class:"cell border",style:e.normalizeStyle({background:t.defaultColor})},[e.createVNode(e.unref(O),{name:"slash_forward"})],4)]),e.createElementVNode("div",Gc,e.toDisplayString(t.defaultLabel),1)])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(d,f)=>(e.openBlock(),e.createElementBlock("div",{class:"color-row",key:`row-${f}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d,(u,m)=>(e.openBlock(),e.createElementBlock("div",{class:"",key:`col-${m}`},[e.createElementVNode("div",{class:"cell-container",onClick:h=>r(u)},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{border:u.border}]),style:e.normalizeStyle({backgroundColor:u.hex})},[a(u.hex)?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",style:e.normalizeStyle({color:i(u.rgb)})},null,8,["style"])):e.createCommentVNode("",!0)],6)],8,Kc)]))),128))]))),128))]))}}),ie=e.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:o}){const n=o;return(l,r)=>(e.openBlock(),e.createBlock(e.unref(Ce),{placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("button",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:r[0]||(r[0]=a=>n("click",a))},[t.icon?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Xc={key:0,class:"o-doc-toc toc"},Jc={class:"mini-view"},Zc={class:"toc__list"},Qc={class:"main-view o-scroll",style:{"max-width":"480px"}},es={class:"toc__title"},ts={class:"toc__list"},os=["onClick"],ns=e.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:oe.Editor},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(t,{expose:o,emit:n}){const l=t,r=n,{tr:a}=I(),i=e.ref([]),s=e.ref("");function c(){var m;s.value=window.location.hash,(m=l.editor)==null||m.on("update",d),setTimeout(()=>{p(),d()},0)}function p(){const m=document.querySelector(".yiitap"),h=m==null?void 0:m.parentElement;h==null||h.addEventListener("scroll",f)}function d(){var h;const m=[];(h=l.editor)==null||h.state.doc.descendants((b,y)=>{if(b.type.name==="heading"){const x=b.attrs.id;m.push({level:b.attrs.level,text:b.textContent,id:x})}}),i.value=m}function f(m){for(const h of i.value){const b=document.querySelector(`[data-id="${h.id}"]`);if(!b)continue;const y=b.getBoundingClientRect();if(y.top>=0&&y.top<window.innerHeight/2){s.value=h.id;break}}r("docScroll",m)}function u(m){s.value=m.id;const h=document.querySelector(`[data-id="${m.id}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"start"})}return e.watch(()=>l.editor,m=>{c()}),o({onScroll:f,headings:i}),(m,h)=>i.value.length?(e.openBlock(),e.createElementBlock("section",Xc,[e.createVNode(e.unref(Z),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:e.withCtx(()=>[e.createElementVNode("div",Jc,[e.createElementVNode("ul",Zc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(b,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[b.level<=Math.max(Math.min(t.maxLevel,3),2)?(e.openBlock(),e.createElementBlock("li",{key:0,class:e.normalizeClass(["toc__item",[s.value===b.id?"selected":"",`toc__item--${b.level}`]])},null,2)):e.createCommentVNode("",!0)],64))),128))])])]),default:e.withCtx(()=>[e.createElementVNode("div",Qc,[e.createElementVNode("div",es,e.toDisplayString(e.unref(a)("label.toc")),1),e.renderSlot(m.$slots,"title"),e.createElementVNode("ul",ts,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(b,y)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["toc__item",`toc__item--${b.level}`]),key:y},[e.createElementVNode("span",{class:e.normalizeClass(["heading",{selected:s.value===b.id}]),onClick:x=>u(b)},e.toDisplayString(b.text),11,os)],2))),128))])])]),_:3},512)])):e.createCommentVNode("",!0)}}),ls={class:"o-emoji-select"},rs={key:0},as={class:"groups o-scroll"},is={class:"items"},cs=["onClick"],ss={key:0,class:"groups-empty"},ds={class:"group-icons"},ps=["onClick"],wo=e.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(t,{emit:o}){const n=t,l=o,r=e.ref(null),a=e.ref(""),i=e.ref([]),s=e.ref([]),c=e.ref(0),p=e.computed(()=>a.value?i.value:n.items),d=e.computed(()=>{let h=!1;return p.value.map(b=>{h=h||b.emojis.length}),h});function f(){c.value=0,i.value=a.value?jt.filterEmojiGroups(a.value):[]}function u(h){l("select",h)}function m(h,b){c.value=b,s.value[b].scrollIntoView({behavior:"instant",block:"start"})}return e.onMounted(()=>{}),(h,b)=>(e.openBlock(),e.createElementBlock("section",ls,[t.enableSearch?(e.openBlock(),e.createElementBlock("div",rs,[e.createVNode(e.unref(Se),{ref_key:"input",ref:r,modelValue:a.value,"onUpdate:modelValue":[b[0]||(b[0]=y=>a.value=y),f],type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("section",as,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(y,x)=>{var k;return e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:`group-${x}`,class:"group"},[e.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:s},e.toDisplayString(y.name),513),e.createElementVNode("section",is,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.emojis,(_,g)=>(e.openBlock(),e.createElementBlock("div",{key:`item-${g}`},[e.createElementVNode("div",{class:"item",onClick:V=>u(_)},e.toDisplayString(_.emoji),9,cs)]))),128))])],512)),[[e.vShow,(k=y.emojis)==null?void 0:k.length]])}),128)),d.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ss,"没有记录"))]),e.createElementVNode("section",ds,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(y,x)=>(e.openBlock(),e.createBlock(e.unref(Ce),{key:`target-${x}`,delay:300},{trigger:e.withCtx(()=>{var k;return[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["item",{active:c.value===x}]),onClick:_=>m(y,x)},[e.createVNode(e.unref(O),{name:e.unref(jt.emojiGroupIcons)[y.slug]},null,8,["name"])],10,ps),[[e.vShow,(k=y.emojis)==null?void 0:k.length]])]}),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(y.name),1)]),_:2},1024))),128))])]))}}),eo=[{label:"1C Enterprise",value:"1c",ext:["1c","v8c"],icon:"code_blocks"},{label:"ABNF",value:"abnf",ext:["abnf"],icon:"code_blocks"},{label:"Access Log",value:"accesslog",ext:["log"],icon:"code_blocks"},{label:"ActionScript",value:"actionscript",ext:["as"],icon:"code_blocks"},{label:"Ada",value:"ada",ext:["adb","ads","ada"],icon:"code_blocks"},{label:"AngelScript",value:"angelscript",ext:["as","asc"],icon:"code_blocks"},{label:"Apache Config",value:"apache",ext:["conf","htaccess"],icon:"code_blocks"},{label:"AppleScript",value:"applescript",ext:["scpt","applescript"],icon:"code_blocks"},{label:"Arcade",value:"arcade",ext:["arcade"],icon:"code_blocks"},{label:"Arduino",value:"arduino",ext:["ino","pde"],icon:"code_blocks"},{label:"ARM Assembly",value:"armasm",ext:["s","asm"],icon:"code_blocks"},{label:"AsciiDoc",value:"asciidoc",ext:["adoc","asciidoc"],icon:"code_blocks"},{label:"AspectJ",value:"aspectj",ext:["aj"],icon:"code_blocks"},{label:"AutoHotkey",value:"autohotkey",ext:["ahk"],icon:"code_blocks"},{label:"AutoIt",value:"autoit",ext:["au3"],icon:"code_blocks"},{label:"AVR Assembly",value:"avrasm",ext:["s","asm"],icon:"code_blocks"},{label:"AWK",value:"awk",ext:["awk","gawk","mawk"," nawk"],icon:"code_blocks"},{label:"Axapta",value:"axapta",ext:["xpo","axp"],icon:"code_blocks"},{label:"BASIC",value:"basic",ext:["bas"],icon:"code_blocks"},{label:"Bash",value:"bash",ext:["sh","bash","zsh"],icon:"code_blocks"},{label:"BNF",value:"bnf",ext:["bnf"],icon:"code_blocks"},{label:"Brainfuck",value:"brainfuck",ext:["bf","b"],icon:"code_blocks"},{label:"CAL",value:"cal",ext:["cal"],icon:"code_blocks"},{label:"Capn Proto",value:"capnproto",ext:["capnp"],icon:"code_blocks"},{label:"Ceylon",value:"ceylon",ext:["ceylon"],icon:"code_blocks"},{label:"Clean",value:"clean",ext:["icl","dcl","prg"],icon:"code_blocks"},{label:"Clojure",value:"clojure",ext:["clj","cljs","cljc"],icon:"code_blocks"},{label:"Clojure REPL",value:"clojure-repl",ext:["clj"],icon:"code_blocks"},{label:"CMake",value:"cmake",ext:["cmake","CMakeLists.txt"],icon:"code_blocks"},{label:"CoffeeScript",value:"coffeescript",ext:["coffee","litcoffee"],icon:"code_blocks"},{label:"Coq",value:"coq",ext:["v"],icon:"code_blocks"},{label:"COS",value:"cos",ext:["cos"],icon:"code_blocks"},{label:"C++",value:"cpp",ext:["cpp","hpp","cc","cxx","h","hxx"],icon:"code_blocks"},{label:"crmsh",value:"crmsh",ext:["crm","pcs"],icon:"code_blocks"},{label:"Crystal",value:"crystal",ext:["cr"],icon:"code_blocks"},{label:"C#",value:"csharp",ext:["cs"],icon:"code_blocks"},{label:"CSP",value:"csp",ext:["csp"],icon:"code_blocks"},{label:"CSS",value:"css",ext:["css"],icon:"code_blocks"},{label:"C",value:"c",ext:["c","h"],icon:"code_blocks"},{label:"D",value:"d",ext:["d","di"],icon:"code_blocks"},{label:"Dart",value:"dart",ext:["dart"],icon:"code_blocks"},{label:"Delphi",value:"delphi",ext:["pas","dfm","dpr","dpk"],icon:"code_blocks"},{label:"Diff",value:"diff",ext:["diff","patch"],icon:"code_blocks"},{label:"Django",value:"django",ext:["html","py","css","js"],icon:"code_blocks"},{label:"DNS Zone File",value:"dns",ext:["zone","dns"],icon:"code_blocks"},{label:"Dockerfile",value:"dockerfile",ext:["Dockerfile","dockerfile"],icon:"code_blocks"},{label:"DOS Batch",value:"dos",ext:["bat","cmd"],icon:"code_blocks"},{label:"dsconfig",value:"dsconfig",ext:["dsconfig"],icon:"code_blocks"},{label:"DTS",value:"dts",ext:["dts","dtsi"],icon:"code_blocks"},{label:"Dust",value:"dust",ext:["dust","dst"],icon:"code_blocks"},{label:"EBNF",value:"ebnf",ext:["ebnf"],icon:"code_blocks"},{label:"Elixir",value:"elixir",ext:["ex","exs"],icon:"code_blocks"},{label:"Elm",value:"elm",ext:["elm"],icon:"code_blocks"},{label:"ERB",value:"erb",ext:["erb","rhtml"],icon:"code_blocks"},{label:"Erlang",value:"erlang",ext:["erl","hrl"],icon:"code_blocks"},{label:"Erlang REPL",value:"erlang-repl",ext:["erl"],icon:"code_blocks"},{label:"Excel",value:"excel",ext:["xls","xlsx"],icon:"code_blocks"},{label:"FIX",value:"fix",ext:["fix"],icon:"code_blocks"},{label:"Flix",value:"flix",ext:["flix"],icon:"code_blocks"},{label:"Fortran",value:"fortran",ext:["f","for","f90","f95","f03","f08"],icon:"code_blocks"},{label:"F#",value:"fsharp",ext:["fs","fsi","fsx"],icon:"code_blocks"},{label:"GAMS",value:"gams",ext:["gms","gams"],icon:"code_blocks"},{label:"Gauss",value:"gauss",ext:["gss","prg"],icon:"code_blocks"},{label:"G-code",value:"gcode",ext:["nc","gcode","g","ngc"],icon:"code_blocks"},{label:"Gherkin",value:"gherkin",ext:["feature"],icon:"code_blocks"},{label:"GLSL",value:"glsl",ext:["vert","frag","geom","comp","tesc","tese","glsl"],icon:"code_blocks"},{label:"GameMaker Language",value:"gml",ext:["gml","gm81","gm"],icon:"code_blocks"},{label:"Golo",value:"golo",ext:["golo"],icon:"code_blocks"},{label:"Go",value:"go",ext:["go"],icon:"code_blocks"},{label:"Gradle",value:"gradle",ext:["gradle","gradle.kts"],icon:"code_blocks"},{label:"GraphQL",value:"graphql",ext:["graphql","gql"],icon:"code_blocks"},{label:"Groovy",value:"groovy",ext:["groovy","gvy","gy","gsh"],icon:"code_blocks"},{label:"Haml",value:"haml",ext:["haml"],icon:"code_blocks"},{label:"Handlebars",value:"handlebars",ext:["hbs","handlebars","html"],icon:"code_blocks"},{label:"Haskell",value:"haskell",ext:["hs","lhs"],icon:"code_blocks"},{label:"Haxe",value:"haxe",ext:["hx"],icon:"code_blocks"},{label:"HSP",value:"hsp",ext:["hsp"],icon:"code_blocks"},{label:"HTML",value:"html",ext:["html"],icon:"code_blocks"},{label:"HTTP",value:"http",ext:["http","rest"],icon:"code_blocks"},{label:"Hy",value:"hy",ext:["hy"],icon:"code_blocks"},{label:"Inform 7",value:"inform7",ext:["ni","i7x"],icon:"code_blocks"},{label:"INI",value:"ini",ext:["ini","cfg","conf"],icon:"code_blocks"},{label:"IRPF90",value:"irpf90",ext:["90","f90","f95","f03","f08"],icon:"code_blocks"},{label:"ISBL",value:"isbl",ext:["isbl"],icon:"code_blocks"},{label:"Java",value:"java",ext:["java"],icon:"code_blocks"},{label:"JavaScript",value:"javascript",ext:["js","jsx"],icon:"code_blocks"},{label:"JBoss CLI",value:"jboss-cli",ext:["cli"],icon:"code_blocks"},{label:"Julia",value:"julia",ext:["jl"],icon:"code_blocks"},{label:"Julia REPL",value:"julia-repl",ext:["jl"],icon:"code_blocks"},{label:"JSON",value:"json",ext:["json"],icon:"code_blocks"},{label:"Kotlin",value:"kotlin",ext:["kt","kts"],icon:"code_blocks"},{label:"Lasso",value:"lasso",ext:["lasso","ls","lasso9"],icon:"code_blocks"},{label:"LaTeX",value:"latex",ext:["tex","latex"],icon:"code_blocks"},{label:"LDIF",value:"ldif",ext:["ldif"],icon:"code_blocks"},{label:"Leaf",value:"leaf",ext:["leaf"],icon:"code_blocks"},{label:"Less",value:"less",ext:["less"],icon:"code_blocks"},{label:"Lisp",value:"lisp",ext:["lisp","lsp","cl"],icon:"code_blocks"},{label:"LiveCode Server",value:"livecodeserver",ext:["lc","livecode"],icon:"code_blocks"},{label:"LiveScript",value:"livescript",ext:["ls"],icon:"code_blocks"},{label:"LLVM",value:"llvm",ext:["ll","bc"],icon:"code_blocks"},{label:"LSL",value:"lsl",ext:["lsl"],icon:"code_blocks"},{label:"Lua",value:"lua",ext:["lua"],icon:"code_blocks"},{label:"Makefile",value:"makefile",ext:["make","Makefile","GNUmakefile"],icon:"code_blocks"},{label:"Markdown",value:"markdown",ext:["md","markdown","mdown","mkdn"],icon:"code_blocks"},{label:"Mathematica",value:"mathematica",ext:["nb","m","wl"],icon:"code_blocks"},{label:"MATLAB",value:"matlab",ext:["m"],icon:"code_blocks"},{label:"Maxima",value:"maxima",ext:["mac","max"],icon:"code_blocks"},{label:"MEL",value:"mel",ext:["mel"],icon:"code_blocks"},{label:"Mermaid",value:"mermaid",ext:["mermaid"],icon:"mermaid"},{label:"Mercury",value:"mercury",ext:["m","moo"],icon:"code_blocks"},{label:"MIPS Assembly",value:"mipsasm",ext:["s","asm"],icon:"code_blocks"},{label:"Mizar",value:"mizar",ext:["miz"],icon:"code_blocks"},{label:"Mojolicious",value:"mojolicious",ext:["pl","pm"],icon:"code_blocks"},{label:"Monkey",value:"monkey",ext:["monkey","mk"],icon:"code_blocks"},{label:"MoonScript",value:"moonscript",ext:["moon"],icon:"code_blocks"},{label:"N1QL",value:"n1ql",ext:["n1ql"],icon:"code_blocks"},{label:"NestedText",value:"nestedtext",ext:["nt"],icon:"code_blocks"},{label:"Nginx",value:"nginx",ext:["conf","nginx"],icon:"code_blocks"},{label:"Nim",value:"nim",ext:["nim","nims"],icon:"code_blocks"},{label:"Nix",value:"nix",ext:["nix"],icon:"code_blocks"},{label:"Node.js REPL",value:"node-repl",ext:["js"],icon:"code_blocks"},{label:"NSIS",value:"nsis",ext:["nsi","nsh"],icon:"code_blocks"},{label:"Objective-C",value:"objectivec",ext:["m","mm"],icon:"code_blocks"},{label:"OCaml",value:"ocaml",ext:["ml","mli","mll","mly"],icon:"code_blocks"},{label:"OpenSCAD",value:"openscad",ext:["scad"],icon:"code_blocks"},{label:"Oxygene",value:"oxygene",ext:["pas","dpr","pp"],icon:"code_blocks"},{label:"Parser3",value:"parser3",ext:["p3"],icon:"code_blocks"},{label:"Perl",value:"perl",ext:["pl","pm","t","pod"],icon:"code_blocks"},{label:"PF",value:"pf",ext:["pf"],icon:"code_blocks"},{label:"PostgreSQL",value:"pgsql",ext:["sql","pgsql"],icon:"code_blocks"},{label:"PHP Template",value:"php-template",ext:["phtml","php"],icon:"code_blocks"},{label:"PHP",value:"php",ext:["php","php3","php4","php5","phps","phpt"],icon:"code_blocks"},{label:"Plain Text",value:"plaintext",ext:["txt","text","md","markdown"],icon:"code_blocks"},{label:"Pony",value:"pony",ext:["pony"],icon:"code_blocks"},{label:"PowerShell",value:"powershell",ext:["ps1","psm1","psd1"],icon:"code_blocks"},{label:"Processing",value:"processing",ext:["pde"],icon:"code_blocks"},{label:"Profile",value:"profile",ext:["profile","rc","bashrc","zshrc"],icon:"code_blocks"},{label:"Prolog",value:"prolog",ext:["pl","pro","prolog"],icon:"code_blocks"},{label:"Properties",value:"properties",ext:["properties","ini","cfg"],icon:"code_blocks"},{label:"Protocol Buffers",value:"protobuf",ext:["proto"],icon:"code_blocks"},{label:"Puppet",value:"puppet",ext:["pp"],icon:"code_blocks"},{label:"PureBasic",value:"purebasic",ext:["pb","pbi"],icon:"code_blocks"},{label:"Python REPL",value:"python-repl",ext:["py"],icon:"code_blocks"},{label:"Python",value:"python",ext:["py","pyw","cpy","gyp"],icon:"code_blocks"},{label:"Q",value:"q",ext:["q"],icon:"code_blocks"},{label:"QML",value:"qml",ext:["qml","js"],icon:"code_blocks"},{label:"R",value:"r",ext:["r","R","rmd","Rmd"],icon:"code_blocks"},{label:"ReasonML",value:"reasonml",ext:["re","rei"],icon:"code_blocks"},{label:"RIB",value:"rib",ext:["rib"],icon:"code_blocks"},{label:"Roboconf",value:"roboconf",ext:["graph","instances"],icon:"code_blocks"},{label:"RouterOS",value:"routeros",ext:["rsc","txt"],icon:"code_blocks"},{label:"RSL",value:"rsl",ext:["rsl"],icon:"code_blocks"},{label:"Ruby",value:"ruby",ext:["rb","rbw","rake","gemspec","ru"],icon:"code_blocks"},{label:"Rust",value:"rust",ext:["rs","rlib"],icon:"code_blocks"},{label:"Rules Language",value:"ruleslanguage",ext:["rules"],icon:"code_blocks"},{label:"SAS",value:"sas",ext:["sas"],icon:"code_blocks"},{label:"Scala",value:"scala",ext:["scala","sc","sbt"],icon:"code_blocks"},{label:"Scheme",value:"scheme",ext:["scm","ss","rkt","rktd","rktl"],icon:"code_blocks"},{label:"Scilab",value:"scilab",ext:["sci","sce"],icon:"code_blocks"},{label:"SCSS",value:"scss",ext:["scss","sass"],icon:"code_blocks"},{label:"Shell",value:"shell",ext:["sh","bash","zsh","ksh","csh","tcsh"],icon:"code_blocks"},{label:"Smali",value:"smali",ext:["smali"],icon:"code_blocks"},{label:"Smalltalk",value:"smalltalk",ext:["st"],icon:"code_blocks"},{label:"Standard ML",value:"sml",ext:["sml","sig","fun"],icon:"code_blocks"},{label:"SQL",value:"sql",ext:["sql","ddl","dml"],icon:"code_blocks"},{label:"SQF",value:"sqf",ext:["sqf"],icon:"code_blocks"},{label:"Stan",value:"stan",ext:["stan"],icon:"code_blocks"},{label:"Stata",value:"stata",ext:["do","ado","mata"],icon:"code_blocks"},{label:"Step21",value:"step21",ext:["stp","step"],icon:"code_blocks"},{label:"Stylus",value:"stylus",ext:["styl","stylus"],icon:"code_blocks"},{label:"Subunit",value:"subunit",ext:["subunit"],icon:"code_blocks"},{label:"SVG",value:"svg",ext:["svg"],icon:"code_blocks"},{label:"Swift",value:"swift",ext:["swift"],icon:"code_blocks"},{label:"Tagger Script",value:"taggerscript",ext:["tag"],icon:"code_blocks"},{label:"TAP",value:"tap",ext:["tap"],icon:"code_blocks"},{label:"Tcl",value:"tcl",ext:["tcl","tk","itcl","itk"],icon:"code_blocks"},{label:"Thrift",value:"thrift",ext:["thrift"],icon:"code_blocks"},{label:"TOML",value:"toml",ext:["toml"],icon:"code_blocks"},{label:"TP",value:"tp",ext:["tp"],icon:"code_blocks"},{label:"Twig",value:"twig",ext:["twig","tpl"],icon:"code_blocks"},{label:"TypeScript",value:"typescript",ext:["ts","tsx"],icon:"code_blocks"},{label:"Vala",value:"vala",ext:["vala","vapi"],icon:"code_blocks"},{label:"VB.NET",value:"vbnet",ext:["vb"],icon:"code_blocks"},{label:"VBScript (HTML)",value:"vbscript-html",ext:["html","htm","asp","vbs"],icon:"code_blocks"},{label:"VBScript",value:"vbscript",ext:["vbs","vbe"],icon:"code_blocks"},{label:"Verilog",value:"verilog",ext:["v","vh","sv","svh"],icon:"code_blocks"},{label:"VHDL",value:"vhdl",ext:["vhd","vhdl"],icon:"code_blocks"},{label:"Vim",value:"vim",ext:["vim","vba","vbe","exrc"],icon:"code_blocks"},{label:"WebAssembly",value:"wasm",ext:["wasm","wat"],icon:"code_blocks"},{label:"Wren",value:"wren",ext:["wren"],icon:"code_blocks"},{label:"x86 Assembly",value:"x86asm",ext:["asm","s","S"],icon:"code_blocks"},{label:"XL",value:"xl",ext:["xl","xls","xlsx"],icon:"code_blocks"},{label:"XML",value:"xml",ext:["xml","xsd","xsl","xslt","rss","atom","svg"],icon:"code_blocks"},{label:"XQuery",value:"xquery",ext:["xq","xquery","xql","xqm"],icon:"code_blocks"},{label:"YAML",value:"yaml",ext:["yaml","yml"],icon:"code_blocks"},{label:"Zephir",value:"zephir",ext:["zep"],icon:"code_blocks"}],fs={class:"selected-language"},us={class:"header"},ms={class:"o-scroll"},nr=e.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:o}){const n=t,l=o,{tr:r}=I(),a=e.ref(),i=e.ref(),s=e.ref(""),c=e.ref(0),p=e.ref(""),d=e.computed(()=>s.value?eo.filter(x=>x.value.toLowerCase().indexOf(s.value.toLowerCase())>=0):eo),f=e.computed(()=>{let x=eo.find(k=>k.value===p.value);return x||(x=eo.find(k=>k.ext.includes(p.value))),x});function u(x){x&&setTimeout(()=>{var k;(k=i.value)==null||k.focus(),c.value=0,window.addEventListener("keyup",y)},0)}function m(){var x;window.removeEventListener("keyup",y),(x=a.value)==null||x.setShow(!1)}function h(x){m(),p.value=x.value,l("select",x.value)}function b(){h(d.value[c.value])}function y(x){if(d.value.length>0){switch(x.code){case"ArrowDown":c.value=c.value+1;break;case"ArrowUp":c.value=c.value-1;break;case"Enter":b();break}c.value>=d.value.length&&(c.value=0),c.value<0&&(c.value=d.value.length-1)}else c.value=0}return e.onMounted(()=>{p.value=n.language}),(x,k)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:a,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":u},{trigger:e.withCtx(()=>[e.createVNode(e.unref(te),{class:"o-dropdown-btn"},{default:e.withCtx(()=>{var _;return[e.createElementVNode("span",fs,e.toDisplayString((_=f.value)==null?void 0:_.label),1),e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:e.withCtx(()=>[e.createElementVNode("header",us,[e.createVNode(e.unref(Se),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":k[0]||(k[0]=_=>s.value=_),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),e.createElementVNode("section",ms,[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(_,g)=>(e.openBlock(),e.createBlock(e.unref(ce),{key:g,onClick:V=>h(_),class:e.normalizeClass({"is-active":_.value===p.value,"is-select":g===c.value})},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:_.icon},null,8,["name"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(_.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),gs={class:"o-media-input"},bs={class:"fields"},hs={class:"o-media-title"},ks={class:"actions"},to=e.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(t,{emit:o}){const n=t,l=o,{tr:r}=I(),a=e.ref(),i=e.ref(""),s=e.ref("");function c(){return s.value?(i.value="null",!0):(i.value="error",!1)}function p(){c()&&l("input",s.value)}return e.onMounted(()=>{s.value=n.val,setTimeout(()=>{var d;(d=a.value)==null||d.focus()},0)}),(d,f)=>(e.openBlock(),e.createElementBlock("section",gs,[e.createElementVNode("section",bs,[e.createElementVNode("div",hs,e.toDisplayString(e.unref(r)("label.link")),1),e.createVNode(e.unref(Se),{ref_key:"input",ref:a,modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=u=>s.value=u),status:i.value,type:"text",autofocus:"",clearable:"",onEnter:p},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),e.createElementVNode("footer",ks,[e.createVNode(e.unref(te),{type:"info",onClick:p},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("label.ok")),1)]),_:1})])]))}}),ys={class:"o-meta-input"},ws={class:"header"},Cs={class:"title"},xs={class:"fields"},_s={class:"actions"},Co=e.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(t,{emit:o}){const n=t,l=o,{tr:r}=I(),a=e.ref(null),i=e.ref("");function s(){console.log("confirm",i.value),l("confirm",i.value)}return e.onMounted(()=>{i.value=n.val,setTimeout(()=>{var c;(c=a.value)==null||c.focus()},0)}),(c,p)=>(e.openBlock(),e.createElementBlock("section",ys,[e.createElementVNode("section",ws,[e.createElementVNode("div",Cs,e.toDisplayString(t.title),1),e.createElementVNode("div",null,[e.renderSlot(c.$slots,"header-right")])]),e.createElementVNode("section",xs,[e.createVNode(e.unref(Se),{ref_key:"input",ref:a,modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=d=>i.value=d),type:"text",autofocus:"",clearable:"",onEnter:s},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),e.createElementVNode("footer",_s,[e.createVNode(e.unref(te),{type:"tertiary",onClick:p[1]||(p[1]=d=>l("cancel"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("label.cancel")),1)]),_:1}),e.createVNode(e.unref(te),{type:"info",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("label.ok")),1)]),_:1})])]))}}),Bs={class:"add"},xo=e.defineComponent({__name:"OTableCellHandler",props:{modelValue:{type:Boolean,default:!1},row:{type:Boolean,default:!1},column:{type:Boolean,default:!1},tooltip:{type:String,default:""},placement:{type:String,default:"top"},offset:{type:Object,default:function(){return[0,0]}},tippyClass:{type:String,default:""},contentClass:{type:[String,Object],default:""},tooltipPlacement:{type:String,default:"top"},tooltipOffset:{type:Object,default:function(){return[0,2]}}},emits:["update:modelValue","add"],setup(t,{emit:o}){const n=t,l=o,r=e.ref(!1);function a(){setTimeout(()=>{r.value=!0},0)}function i(s){l("update:modelValue",s)}return e.watch(()=>n.modelValue,s=>{r.value=s}),e.onMounted(()=>{r.value=n.modelValue}),(s,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-table-cell-handler",{"o-row":t.row,"o-column":t.column}]),onClick:a},[e.createVNode(e.unref(ve),{modelValue:r.value,"onUpdate:modelValue":[c[0]||(c[0]=p=>r.value=p),i],placement:t.placement,"tippy-class":t.tippyClass,offset:t.offset,"hide-click-outside":""},{"popover-content":e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["handler-trigger",`${t.contentClass} ${r.value?"active":""}`]),onClick:a},[...c[2]||(c[2]=[e.createElementVNode("div",{class:"handler"},[e.createElementVNode("svg",{width:"24",height:"12",viewBox:"0 0 24 12",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("circle",{cx:"2",cy:"2",r:"2"}),e.createElementVNode("circle",{cx:"2",cy:"10",r:"2"}),e.createElementVNode("circle",{cx:"12",cy:"2",r:"2"}),e.createElementVNode("circle",{cx:"12",cy:"10",r:"2"}),e.createElementVNode("circle",{cx:"22",cy:"2",r:"2"}),e.createElementVNode("circle",{cx:"22",cy:"10",r:"2"})])],-1)])],2)]),_:3},8,["modelValue","placement","tippy-class","offset"]),e.createElementVNode("div",Bs,[c[4]||(c[4]=e.createElementVNode("div",{class:"indicator"},[e.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[e.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),e.createVNode(e.unref(Ce),{placement:t.tooltipPlacement,offset:t.tooltipOffset},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:"circle-button",onClick:c[1]||(c[1]=e.withModifiers(p=>l("add"),["stop"]))},[...c[3]||(c[3]=[e.createElementVNode("div",{class:"plus"},null,-1)])])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:1},8,["placement","offset"])])],2))}}),Vs={class:"o-table-grid"},Es=["onMouseover"],lr=e.defineComponent({__name:"OTableGrid",emits:["select"],setup(t,{emit:o}){const n=o,l=e.ref(6),r=e.ref(6),a=e.ref(2),i=e.ref(2);function s(p,d){a.value=p,i.value=d,l.value===p&&l.value<10&&(l.value+=1),r.value===d&&r.value<10&&(r.value+=1)}function c(){n("select",{rows:a.value,cols:i.value,withHeaderRow:!0})}return(p,d)=>(e.openBlock(),e.createElementBlock("section",Vs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(f,u)=>(e.openBlock(),e.createElementBlock("div",{class:"rows",key:`row-${u}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(m,h)=>(e.openBlock(),e.createElementBlock("div",{key:`col-${h}`},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{selected:f<=a.value&&m<=i.value}]),onMouseover:b=>s(f,m),onClick:c},null,42,Es)]))),128))]))),128)),e.createElementVNode("footer",null,e.toDisplayString(a.value)+" x "+e.toDisplayString(i.value),1)]))}}),Ns={class:"o-table-cell-background o-button-group"},Ss={class:"o-command-btn"},rr=e.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(),a=e.ref("#ffec3d");function i(){s(a.value)}function s(c){r.value.setShow(!1),a.value=c,l(o.editor,"tableCellAttribute",{name:"background",value:a.value})}return(c,p)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ce),{trigger:"hover"},{trigger:e.withCtx(()=>[e.createElementVNode("div",Ns,[e.createElementVNode("div",{class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},[e.createVNode(e.unref(O),{name:"crop_16_9",class:"arrow"}),e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${a.value}`)},null,4)]),e.createElementVNode("div",Ss,[e.createVNode(e.unref(O),{name:"arrow_drop_down"})])])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(n)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(st),{"default-color":"","default-label":e.unref(n)("editor.noColor"),onSelect:s},null,8,["default-label"])]),_:1},512))}}),Os={class:"o-simple-color-board"},As={class:"fore-colors"},$s={class:"label o-tips"},Ts={class:"color-row"},Ds={class:"color-row"},Ms={class:"back-colors"},Ls={class:"label o-tips"},Ps={class:"color-row"},Rs={class:"color-row"},bn=e.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:o}){const n=o,{tr:l}=I();function r(s,c){n("select",{name:s,value:c.value})}const a=e.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),i=e.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,c)=>(e.openBlock(),e.createElementBlock("section",Os,[e.createElementVNode("section",As,[e.createElementVNode("header",null,[e.createElementVNode("div",$s,e.toDisplayString(e.unref(l)("editor.textColor")),1),e.createVNode(e.unref(Z),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ce),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(te),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(st),{"default-color":"","default-disabled":"",onSelect:c[0]||(c[0]=p=>r("color",{value:p}))})]),_:1},512)]),e.createElementVNode("div",Ts,[e.createVNode(e.unref(X),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:c[1]||(c[1]=p=>r("color",{value:""}))}),t.foreColor?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:"format_text",color:t.foreColor,tooltip:"Last used","content-class":"border",onClick:c[2]||(c[2]=p=>r("color",{value:t.foreColor}))},null,8,["color"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ds,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(p,d)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${d}`,icon:"format_text",color:p.value,tooltip:p.label,onClick:f=>r("color",p)},null,8,["color","tooltip","onClick"]))),128))])]),e.createElementVNode("section",Ms,[e.createElementVNode("header",null,[e.createElementVNode("div",Ls,e.toDisplayString(e.unref(l)("editor.backgroundColor")),1),e.createVNode(e.unref(Z),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ce),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(te),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(st),{"default-color":"","default-disabled":"",onSelect:c[3]||(c[3]=p=>r("backgroundColor",{value:p}))})]),_:1},512)]),e.createElementVNode("div",Ps,[e.createVNode(e.unref(X),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:c[4]||(c[4]=p=>r("backgroundColor",{value:""}))}),t.backColor?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:t.backColor},onClick:c[5]||(c[5]=p=>r("backgroundColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Rs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(p,d)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${d}`,icon:"format_text",tooltip:p.label,"content-style":{backgroundColor:p.value},onClick:f=>r("backgroundColor",p)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),_o=Math.min,dt=Math.max,Bo=Math.round,Vo=Math.floor,Ie=t=>({x:t,y:t}),vs={left:"right",right:"left",bottom:"top",top:"bottom"},Is={start:"end",end:"start"};function ar(t,o,n){return dt(t,_o(o,n))}function hn(t,o){return typeof t=="function"?t(o):t}function St(t){return t.split("-")[0]}function kn(t){return t.split("-")[1]}function ir(t){return t==="x"?"y":"x"}function cr(t){return t==="y"?"height":"width"}const js=new Set(["top","bottom"]);function pt(t){return js.has(St(t))?"y":"x"}function sr(t){return ir(pt(t))}function Fs(t,o,n){n===void 0&&(n=!1);const l=kn(t),r=sr(t),a=cr(r);let i=r==="x"?l===(n?"end":"start")?"right":"left":l==="start"?"bottom":"top";return o.reference[a]>o.floating[a]&&(i=Eo(i)),[i,Eo(i)]}function zs(t){const o=Eo(t);return[yn(t),o,yn(o)]}function yn(t){return t.replace(/start|end/g,o=>Is[o])}const dr=["left","right"],pr=["right","left"],Hs=["top","bottom"],Us=["bottom","top"];function qs(t,o,n){switch(t){case"top":case"bottom":return n?o?pr:dr:o?dr:pr;case"left":case"right":return o?Hs:Us;default:return[]}}function Ws(t,o,n,l){const r=kn(t);let a=qs(St(t),n==="start",l);return r&&(a=a.map(i=>i+"-"+r),o&&(a=a.concat(a.map(yn)))),a}function Eo(t){return t.replace(/left|right|bottom|top/g,o=>vs[o])}function Ys(t){return{top:0,right:0,bottom:0,left:0,...t}}function Gs(t){return typeof t!="number"?Ys(t):{top:t,right:t,bottom:t,left:t}}function No(t){const{x:o,y:n,width:l,height:r}=t;return{width:l,height:r,top:n,left:o,right:o+l,bottom:n+r,x:o,y:n}}function fr(t,o,n){let{reference:l,floating:r}=t;const a=pt(o),i=sr(o),s=cr(i),c=St(o),p=a==="y",d=l.x+l.width/2-r.width/2,f=l.y+l.height/2-r.height/2,u=l[s]/2-r[s]/2;let m;switch(c){case"top":m={x:d,y:l.y-r.height};break;case"bottom":m={x:d,y:l.y+l.height};break;case"right":m={x:l.x+l.width,y:f};break;case"left":m={x:l.x-r.width,y:f};break;default:m={x:l.x,y:l.y}}switch(kn(o)){case"start":m[i]-=u*(n&&p?-1:1);break;case"end":m[i]+=u*(n&&p?-1:1);break}return m}async function Ks(t,o){var n;o===void 0&&(o={});const{x:l,y:r,platform:a,rects:i,elements:s,strategy:c}=t,{boundary:p="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:u=!1,padding:m=0}=hn(o,t),h=Gs(m),y=s[u?f==="floating"?"reference":"floating":f],x=No(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(y)))==null||n?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:p,rootBoundary:d,strategy:c})),k=f==="floating"?{x:l,y:r,width:i.floating.width,height:i.floating.height}:i.reference,_=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),g=await(a.isElement==null?void 0:a.isElement(_))?await(a.getScale==null?void 0:a.getScale(_))||{x:1,y:1}:{x:1,y:1},V=No(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:k,offsetParent:_,strategy:c}):k);return{top:(x.top-V.top+h.top)/g.y,bottom:(V.bottom-x.bottom+h.bottom)/g.y,left:(x.left-V.left+h.left)/g.x,right:(V.right-x.right+h.right)/g.x}}const Xs=async(t,o,n)=>{const{placement:l="bottom",strategy:r="absolute",middleware:a=[],platform:i}=n,s=a.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(o));let p=await i.getElementRects({reference:t,floating:o,strategy:r}),{x:d,y:f}=fr(p,l,c),u=l,m={},h=0;for(let y=0;y<s.length;y++){var b;const{name:x,fn:k}=s[y],{x:_,y:g,data:V,reset:B}=await k({x:d,y:f,initialPlacement:l,placement:u,strategy:r,middlewareData:m,rects:p,platform:{...i,detectOverflow:(b=i.detectOverflow)!=null?b:Ks},elements:{reference:t,floating:o}});d=_??d,f=g??f,m={...m,[x]:{...m[x],...V}},B&&h<=50&&(h++,typeof B=="object"&&(B.placement&&(u=B.placement),B.rects&&(p=B.rects===!0?await i.getElementRects({reference:t,floating:o,strategy:r}):B.rects),{x:d,y:f}=fr(p,u,c)),y=-1)}return{x:d,y:f,placement:u,strategy:r,middlewareData:m}},Js=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(o){var n,l;const{placement:r,middlewareData:a,rects:i,initialPlacement:s,platform:c,elements:p}=o,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:u,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:b=!0,...y}=hn(t,o);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const x=St(r),k=pt(s),_=St(s)===s,g=await(c.isRTL==null?void 0:c.isRTL(p.floating)),V=u||(_||!b?[Eo(s)]:zs(s)),B=h!=="none";!u&&B&&V.push(...Ws(s,b,h,g));const $=[s,...V],R=await c.detectOverflow(o,y),D=[];let M=((l=a.flip)==null?void 0:l.overflows)||[];if(d&&D.push(R[x]),f){const T=Fs(r,i,g);D.push(R[T[0]],R[T[1]])}if(M=[...M,{placement:r,overflows:D}],!D.every(T=>T<=0)){var H,N;const T=(((H=a.flip)==null?void 0:H.index)||0)+1,v=$[T];if(v&&(!(f==="alignment"?k!==pt(v):!1)||M.every(j=>pt(j.placement)===k?j.overflows[0]>0:!0)))return{data:{index:T,overflows:M},reset:{placement:v}};let U=(N=M.filter(K=>K.overflows[0]<=0).sort((K,j)=>K.overflows[1]-j.overflows[1])[0])==null?void 0:N.placement;if(!U)switch(m){case"bestFit":{var S;const K=(S=M.filter(j=>{if(B){const A=pt(j.placement);return A===k||A==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(A=>A>0).reduce((A,J)=>A+J,0)]).sort((j,A)=>j[1]-A[1])[0])==null?void 0:S[0];K&&(U=K);break}case"initialPlacement":U=s;break}if(r!==U)return{reset:{placement:U}}}return{}}}},Zs=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(o){const{x:n,y:l,placement:r,platform:a}=o,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:x=>{let{x:k,y:_}=x;return{x:k,y:_}}},...p}=hn(t,o),d={x:n,y:l},f=await a.detectOverflow(o,p),u=pt(St(r)),m=ir(u);let h=d[m],b=d[u];if(i){const x=m==="y"?"top":"left",k=m==="y"?"bottom":"right",_=h+f[x],g=h-f[k];h=ar(_,h,g)}if(s){const x=u==="y"?"top":"left",k=u==="y"?"bottom":"right",_=b+f[x],g=b-f[k];b=ar(_,b,g)}const y=c.fn({...o,[m]:h,[u]:b});return{...y,data:{x:y.x-n,y:y.y-l,enabled:{[m]:i,[u]:s}}}}}};function So(){return typeof window<"u"}function Ot(t){return ur(t)?(t.nodeName||"").toLowerCase():"#document"}function xe(t){var o;return(t==null||(o=t.ownerDocument)==null?void 0:o.defaultView)||window}function je(t){var o;return(o=(ur(t)?t.ownerDocument:t.document)||window.document)==null?void 0:o.documentElement}function ur(t){return So()?t instanceof Node||t instanceof xe(t).Node:!1}function $e(t){return So()?t instanceof Element||t instanceof xe(t).Element:!1}function Fe(t){return So()?t instanceof HTMLElement||t instanceof xe(t).HTMLElement:!1}function mr(t){return!So()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xe(t).ShadowRoot}const Qs=new Set(["inline","contents"]);function oo(t){const{overflow:o,overflowX:n,overflowY:l,display:r}=Te(t);return/auto|scroll|overlay|hidden|clip/.test(o+l+n)&&!Qs.has(r)}const ed=new Set(["table","td","th"]);function td(t){return ed.has(Ot(t))}const od=[":popover-open",":modal"];function Oo(t){return od.some(o=>{try{return t.matches(o)}catch{return!1}})}const nd=["transform","translate","scale","rotate","perspective"],ld=["transform","translate","scale","rotate","perspective","filter"],rd=["paint","layout","strict","content"];function wn(t){const o=Cn(),n=$e(t)?Te(t):t;return nd.some(l=>n[l]?n[l]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!o&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!o&&(n.filter?n.filter!=="none":!1)||ld.some(l=>(n.willChange||"").includes(l))||rd.some(l=>(n.contain||"").includes(l))}function ad(t){let o=Qe(t);for(;Fe(o)&&!At(o);){if(wn(o))return o;if(Oo(o))return null;o=Qe(o)}return null}function Cn(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const id=new Set(["html","body","#document"]);function At(t){return id.has(Ot(t))}function Te(t){return xe(t).getComputedStyle(t)}function Ao(t){return $e(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Qe(t){if(Ot(t)==="html")return t;const o=t.assignedSlot||t.parentNode||mr(t)&&t.host||je(t);return mr(o)?o.host:o}function gr(t){const o=Qe(t);return At(o)?t.ownerDocument?t.ownerDocument.body:t.body:Fe(o)&&oo(o)?o:gr(o)}function no(t,o,n){var l;o===void 0&&(o=[]),n===void 0&&(n=!0);const r=gr(t),a=r===((l=t.ownerDocument)==null?void 0:l.body),i=xe(r);if(a){const s=xn(i);return o.concat(i,i.visualViewport||[],oo(r)?r:[],s&&n?no(s):[])}return o.concat(r,no(r,[],n))}function xn(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function br(t){const o=Te(t);let n=parseFloat(o.width)||0,l=parseFloat(o.height)||0;const r=Fe(t),a=r?t.offsetWidth:n,i=r?t.offsetHeight:l,s=Bo(n)!==a||Bo(l)!==i;return s&&(n=a,l=i),{width:n,height:l,$:s}}function _n(t){return $e(t)?t:t.contextElement}function $t(t){const o=_n(t);if(!Fe(o))return Ie(1);const n=o.getBoundingClientRect(),{width:l,height:r,$:a}=br(o);let i=(a?Bo(n.width):n.width)/l,s=(a?Bo(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const cd=Ie(0);function hr(t){const o=xe(t);return!Cn()||!o.visualViewport?cd:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function sd(t,o,n){return o===void 0&&(o=!1),!n||o&&n!==xe(t)?!1:o}function ft(t,o,n,l){o===void 0&&(o=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),a=_n(t);let i=Ie(1);o&&(l?$e(l)&&(i=$t(l)):i=$t(t));const s=sd(a,n,l)?hr(a):Ie(0);let c=(r.left+s.x)/i.x,p=(r.top+s.y)/i.y,d=r.width/i.x,f=r.height/i.y;if(a){const u=xe(a),m=l&&$e(l)?xe(l):l;let h=u,b=xn(h);for(;b&&l&&m!==h;){const y=$t(b),x=b.getBoundingClientRect(),k=Te(b),_=x.left+(b.clientLeft+parseFloat(k.paddingLeft))*y.x,g=x.top+(b.clientTop+parseFloat(k.paddingTop))*y.y;c*=y.x,p*=y.y,d*=y.x,f*=y.y,c+=_,p+=g,h=xe(b),b=xn(h)}}return No({width:d,height:f,x:c,y:p})}function $o(t,o){const n=Ao(t).scrollLeft;return o?o.left+n:ft(je(t)).left+n}function kr(t,o){const n=t.getBoundingClientRect(),l=n.left+o.scrollLeft-$o(t,n),r=n.top+o.scrollTop;return{x:l,y:r}}function dd(t){let{elements:o,rect:n,offsetParent:l,strategy:r}=t;const a=r==="fixed",i=je(l),s=o?Oo(o.floating):!1;if(l===i||s&&a)return n;let c={scrollLeft:0,scrollTop:0},p=Ie(1);const d=Ie(0),f=Fe(l);if((f||!f&&!a)&&((Ot(l)!=="body"||oo(i))&&(c=Ao(l)),Fe(l))){const m=ft(l);p=$t(l),d.x=m.x+l.clientLeft,d.y=m.y+l.clientTop}const u=i&&!f&&!a?kr(i,c):Ie(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-c.scrollLeft*p.x+d.x+u.x,y:n.y*p.y-c.scrollTop*p.y+d.y+u.y}}function pd(t){return Array.from(t.getClientRects())}function fd(t){const o=je(t),n=Ao(t),l=t.ownerDocument.body,r=dt(o.scrollWidth,o.clientWidth,l.scrollWidth,l.clientWidth),a=dt(o.scrollHeight,o.clientHeight,l.scrollHeight,l.clientHeight);let i=-n.scrollLeft+$o(t);const s=-n.scrollTop;return Te(l).direction==="rtl"&&(i+=dt(o.clientWidth,l.clientWidth)-r),{width:r,height:a,x:i,y:s}}const yr=25;function ud(t,o){const n=xe(t),l=je(t),r=n.visualViewport;let a=l.clientWidth,i=l.clientHeight,s=0,c=0;if(r){a=r.width,i=r.height;const d=Cn();(!d||d&&o==="fixed")&&(s=r.offsetLeft,c=r.offsetTop)}const p=$o(l);if(p<=0){const d=l.ownerDocument,f=d.body,u=getComputedStyle(f),m=d.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,h=Math.abs(l.clientWidth-f.clientWidth-m);h<=yr&&(a-=h)}else p<=yr&&(a+=p);return{width:a,height:i,x:s,y:c}}const md=new Set(["absolute","fixed"]);function gd(t,o){const n=ft(t,!0,o==="fixed"),l=n.top+t.clientTop,r=n.left+t.clientLeft,a=Fe(t)?$t(t):Ie(1),i=t.clientWidth*a.x,s=t.clientHeight*a.y,c=r*a.x,p=l*a.y;return{width:i,height:s,x:c,y:p}}function wr(t,o,n){let l;if(o==="viewport")l=ud(t,n);else if(o==="document")l=fd(je(t));else if($e(o))l=gd(o,n);else{const r=hr(t);l={x:o.x-r.x,y:o.y-r.y,width:o.width,height:o.height}}return No(l)}function Cr(t,o){const n=Qe(t);return n===o||!$e(n)||At(n)?!1:Te(n).position==="fixed"||Cr(n,o)}function bd(t,o){const n=o.get(t);if(n)return n;let l=no(t,[],!1).filter(s=>$e(s)&&Ot(s)!=="body"),r=null;const a=Te(t).position==="fixed";let i=a?Qe(t):t;for(;$e(i)&&!At(i);){const s=Te(i),c=wn(i);!c&&s.position==="fixed"&&(r=null),(a?!c&&!r:!c&&s.position==="static"&&!!r&&md.has(r.position)||oo(i)&&!c&&Cr(t,i))?l=l.filter(d=>d!==i):r=s,i=Qe(i)}return o.set(t,l),l}function hd(t){let{element:o,boundary:n,rootBoundary:l,strategy:r}=t;const i=[...n==="clippingAncestors"?Oo(o)?[]:bd(o,this._c):[].concat(n),l],s=i[0],c=i.reduce((p,d)=>{const f=wr(o,d,r);return p.top=dt(f.top,p.top),p.right=_o(f.right,p.right),p.bottom=_o(f.bottom,p.bottom),p.left=dt(f.left,p.left),p},wr(o,s,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function kd(t){const{width:o,height:n}=br(t);return{width:o,height:n}}function yd(t,o,n){const l=Fe(o),r=je(o),a=n==="fixed",i=ft(t,!0,a,o);let s={scrollLeft:0,scrollTop:0};const c=Ie(0);function p(){c.x=$o(r)}if(l||!l&&!a)if((Ot(o)!=="body"||oo(r))&&(s=Ao(o)),l){const m=ft(o,!0,a,o);c.x=m.x+o.clientLeft,c.y=m.y+o.clientTop}else r&&p();a&&!l&&r&&p();const d=r&&!l&&!a?kr(r,s):Ie(0),f=i.left+s.scrollLeft-c.x-d.x,u=i.top+s.scrollTop-c.y-d.y;return{x:f,y:u,width:i.width,height:i.height}}function Bn(t){return Te(t).position==="static"}function xr(t,o){if(!Fe(t)||Te(t).position==="fixed")return null;if(o)return o(t);let n=t.offsetParent;return je(t)===n&&(n=n.ownerDocument.body),n}function _r(t,o){const n=xe(t);if(Oo(t))return n;if(!Fe(t)){let r=Qe(t);for(;r&&!At(r);){if($e(r)&&!Bn(r))return r;r=Qe(r)}return n}let l=xr(t,o);for(;l&&td(l)&&Bn(l);)l=xr(l,o);return l&&At(l)&&Bn(l)&&!wn(l)?n:l||ad(t)||n}const wd=async function(t){const o=this.getOffsetParent||_r,n=this.getDimensions,l=await n(t.floating);return{reference:yd(t.reference,await o(t.floating),t.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function Cd(t){return Te(t).direction==="rtl"}const xd={convertOffsetParentRelativeRectToViewportRelativeRect:dd,getDocumentElement:je,getClippingRect:hd,getOffsetParent:_r,getElementRects:wd,getClientRects:pd,getDimensions:kd,getScale:$t,isElement:$e,isRTL:Cd};function Br(t,o){return t.x===o.x&&t.y===o.y&&t.width===o.width&&t.height===o.height}function _d(t,o){let n=null,l;const r=je(t);function a(){var s;clearTimeout(l),(s=n)==null||s.disconnect(),n=null}function i(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();const p=t.getBoundingClientRect(),{left:d,top:f,width:u,height:m}=p;if(s||o(),!u||!m)return;const h=Vo(f),b=Vo(r.clientWidth-(d+u)),y=Vo(r.clientHeight-(f+m)),x=Vo(d),_={rootMargin:-h+"px "+-b+"px "+-y+"px "+-x+"px",threshold:dt(0,_o(1,c))||1};let g=!0;function V(B){const $=B[0].intersectionRatio;if($!==c){if(!g)return i();$?i(!1,$):l=setTimeout(()=>{i(!1,1e-7)},1e3)}$===1&&!Br(p,t.getBoundingClientRect())&&i(),g=!1}try{n=new IntersectionObserver(V,{..._,root:r.ownerDocument})}catch{n=new IntersectionObserver(V,_)}n.observe(t)}return i(!0),a}function Bd(t,o,n,l){l===void 0&&(l={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=l,p=_n(t),d=r||a?[...p?no(p):[],...no(o)]:[];d.forEach(x=>{r&&x.addEventListener("scroll",n,{passive:!0}),a&&x.addEventListener("resize",n)});const f=p&&s?_d(p,n):null;let u=-1,m=null;i&&(m=new ResizeObserver(x=>{let[k]=x;k&&k.target===p&&m&&(m.unobserve(o),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var _;(_=m)==null||_.observe(o)})),n()}),p&&!c&&m.observe(p),m.observe(o));let h,b=c?ft(t):null;c&&y();function y(){const x=ft(t);b&&!Br(b,x)&&n(),b=x,h=requestAnimationFrame(y)}return n(),()=>{var x;d.forEach(k=>{r&&k.removeEventListener("scroll",n),a&&k.removeEventListener("resize",n)}),f==null||f(),(x=m)==null||x.disconnect(),m=null,c&&cancelAnimationFrame(h)}}const Vd=Zs,Ed=Js,Vr=(t,o,n)=>{const l=new Map,r={platform:xd,...n},a={...r.platform,_c:l};return Xs(t,o,{...r,platform:a})};class Nd{constructor(){ne(this,"instances",[]);ne(this,"gap",12);ne(this,"topMargin",20)}error(o,n=3e3){this.show(o,"error",n)}info(o,n=3e3){this.show(o,"info",n)}success(o,n=3e3){this.show(o,"success",n)}warning(o,n=3e3){this.show(o,"warning",n)}show(o,n="info",l=3e3){const r=document.createElement("div");r.className=`o-toast ${n}`,Object.assign(r.style,{position:"fixed",left:"0",top:"0",zIndex:"9999",transition:"transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease",opacity:"0",pointerEvents:"none"}),r.innerHTML=`
26
+ <i class="yiitip-icon icon-${n}"></i>
27
+ <span class="message">${o}</span>
28
+ `,document.body.appendChild(r);const a={el:r,cleanup:()=>{},x:0};let i=!0;a.cleanup=Bd(document.body,r,()=>{Vr(document.body,r,{placement:"top",middleware:[Vd(),Ed()]}).then(({x:s})=>{if(a.x=s,i){const c=-r.offsetHeight;r.style.transition="none",r.style.transform=`translate3d(${s}px, ${c}px, 0)`,r.offsetHeight,r.style.transition="transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease",i=!1,this.instances.push(a),this.repositionToasts(),r.style.opacity="1"}else this.repositionToasts()})}),l>0&&setTimeout(()=>this.destroy(a),l)}repositionToasts(){let o=this.topMargin;this.instances.forEach(n=>{n.el.style.transform=`translate3d(${n.x}px, ${o}px, 0)`,o+=n.el.offsetHeight+this.gap})}destroy(o){o.el.style.opacity="0";const n=o.el.style.transform;o.el.style.transform=`${n} translateY(-20px) scale(0.9)`;const l=r=>{r.propertyName==="opacity"&&(o.cleanup(),o.el.parentNode&&document.body.removeChild(o.el),this.instances=this.instances.filter(a=>a!==o),this.repositionToasts(),o.el.removeEventListener("transitionend",l))};o.el.addEventListener("transitionend",l)}}const lo=new Nd,_e=e.defineComponent({__name:"ONodeView",props:P.nodeViewProps,setup(t){return(o,n)=>(e.openBlock(),e.createBlock(e.unref(P.NodeViewWrapper),{class:"o-node-view","data-id":o.node.attrs.id},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},8,["data-id"]))}}),Sd={class:"o-add-node-view"},Od={key:0,class:"view-main"},Ad={class:"group o-tips"},$d={class:"panel"},Td={class:"group o-tips"},Dd={key:1,class:"item"},Md=e.defineComponent({__name:"AddNodeView",props:P.nodeViewProps,emits:["action"],setup(t,{emit:o}){const n=t,l=o,{locale:r,tr:a}=I(),{run:i}=W(),s=e.ref("main");function c(f){let u=null;switch(f.value){case"aiBlock":u=uc;break;case"audio":u=mc;break;case"blockquote":u=gc;break;case"callout":u=bc;break;case"codeBlock":u=hc;break;case"details":u=kc;break;case"diagram":u=Yl;break;case"emoji":u=yc;break;case"heading":u={attrs:f.options};break;case"horizontalRule":u={};break;case"paragraph":u={type:"paragraph",content:[]};break;case"bulletList":case"orderedList":u={content:Cc};break;case"taskList":u={content:_c};break;case"table":u=xc;break;case"image":u=wc;break;case"model-viewer":u={attrs:{src:"init"}};break;case"video":u=Bc;break}if(u){u.type=u.type||f.value;const m=p.value?d.value+1:d.value,h=f.value==="emoji"?m+2:m+1;requestAnimationFrame(()=>{n.editor.chain().insertContentAt(m,u).focus(h).scrollIntoView().run()})}l("action",f)}const p=e.computed(()=>{var f;return((f=n.node)==null?void 0:f.content.size)===0}),d=e.computed(()=>p.value?n.getPos():n.getPos()+n.node.nodeSize);return(f,u)=>(e.openBlock(),e.createElementBlock("section",Sd,[s.value==="main"?(e.openBlock(),e.createElementBlock("section",Od,[e.createElementVNode("section",null,[e.createElementVNode("div",Ad,e.toDisplayString(e.unref(a)("label.basic")),1),e.createElementVNode("section",$d,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Zt),(m,h)=>(e.openBlock(),e.createBlock(e.unref(X),{key:h,icon:m.icon,tooltip:e.unref(a)(m.label),quaternary:"",onClick:b=>c(m)},null,8,["icon","tooltip","onClick"]))),128))])]),e.createVNode(e.unref(fe)),e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[e.unref(ho).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(ho),(m,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:h},[m.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[h>0?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",Td,e.toDisplayString(e.unref(a)(m.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(ce),{class:"item",clickable:"",onClick:b=>c(m)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:m.icon,color:m.color},null,8,["name","color"])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(a)(m.label)),1)]),_:2},1032,["onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",Dd,"No result"))]),_:1})])):e.createCommentVNode("",!0)]))}}),Er=e.defineComponent({__name:"AddNode",props:{...P.nodeViewProps,add:{type:String,default:"menu"}},setup(t){const o=t,n=e.ref(),l=e.ref(!1),r=e.computed(()=>{var d;return((d=o.node)==null?void 0:d.content.size)===0}),a=e.computed(()=>r.value?o.getPos():o.getPos()+o.node.nodeSize);function i(d){l.value=d}function s(){var d;o.add==="menu"?(d=n.value)==null||d.setShow(!0):c()}function c(){const d={type:"paragraph",content:[{type:"text",text:"/"}]},f=r.value?a.value+1:a.value,u=f+2;requestAnimationFrame(()=>{o.editor.chain().insertContentAt(f,d).focus(u).scrollIntoView().run()})}function p(){var d;(d=n.value)==null||d.setShow(!1),l.value=!1}return(d,f)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:n,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":i},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-add-btn",{"is-selected":l.value}])},[e.createVNode(e.unref(te),{type:"tertiary",class:"o-node-btn",onClick:s},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"add",small:""})]),_:1})],2)]),default:e.withCtx(()=>[e.createVNode(Md,e.mergeProps(o,{onAction:p}),null,16)]),_:1},512))}}),Ld={class:"o-drag-node-view"},Pd={key:0,class:"view-main"},Rd={key:0},vd={class:"group o-tips"},Id={class:"panel"},jd=e.defineComponent({__name:"DragNodeView",props:P.nodeViewProps,emits:["action"],setup(t,{emit:o}){const n=t,l=o,{locale:r,tr:a}=I(),{run:i,onCommand:s}=W(),c=e.ref("main"),p=e.ref(["heading","codeBlock","paragraph"]),d=e.computed(()=>{var y,x;const b=(y=n.node)==null?void 0:y.content.content;if(b.length>0){const k=b[0];if(k.type.name==="image")return k.type.name}return(x=n.node)==null?void 0:x.type.name}),f=e.computed(()=>bo.find(b=>b.value===d.value));function u(b){var y;return b.value===d.value&&((y=n.editor)==null?void 0:y.isActive(d.value,b.options))}function m(b){switch(b.value){case"copy":case"delete":case"duplicate":break;default:h(b);break}l("action",b)}function h(b){var _,g,V,B,$;const y=n.getPos();if(b.value===d.value&&p.value.indexOf(d.value)<0){const R=(_=n.editor)==null?void 0:_.isActive(d.value),D=(g=n.editor)==null?void 0:g.commands.lift(d.value);console.log("lift",d.value,R,D);return}const x=(V=n.editor)==null?void 0:V.commands,k=(B=n.editor)==null?void 0:B.chain().focus(y+1);console.log("runCommand",b),s(x,k,b.value,b.options),($=n.editor)==null||$.commands.focus()}return(b,y)=>(e.openBlock(),e.createElementBlock("section",Ld,[c.value==="main"?(e.openBlock(),e.createElementBlock("section",Pd,[f.value?(e.openBlock(),e.createElementBlock("section",Rd,[e.createElementVNode("div",vd,e.toDisplayString(e.unref(a)("label.turnInto")),1),e.createElementVNode("section",Id,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(bo),(x,k)=>(e.openBlock(),e.createBlock(e.unref(X),{key:k,icon:x.icon,tooltip:e.unref(a)(x.label),"content-class":{"is-active":u(x)},quaternary:"",onClick:_=>m(x)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ke),e.mergeProps(n,{colorful:"","show-group":"",onAction:m}),null,16)])):e.createCommentVNode("",!0)]))}}),Nr=e.defineComponent({__name:"DragNode",props:P.nodeViewProps,emits:["dragstart","dragend"],setup(t,{emit:o}){const n=t,l=o,{run:r}=W(),a=e.ref(null),i=e.ref(!1),s=e.ref(["heading","codeBlock","paragraph"]),c=e.computed(()=>{var y,x,k;const b=(x=(y=n.node)==null?void 0:y.content)==null?void 0:x.content;if((b==null?void 0:b.length)>0){const _=b[0];if(_.type.name==="image")return _.type.name}return(k=n.node)==null?void 0:k.type.name}),p=e.computed(()=>{var y;let b=c.value;return b==="heading"?{icon:`format_h${((y=n.node.attrs)==null?void 0:y.level)||1}`,color:q.blue}:(b==="table-wrapper"&&(b="table"),ko.find(x=>x.value===b)||ko.find(x=>{var k;return(k=x.keywords)==null?void 0:k.split(",").includes(b)})||{icon:"title"})});function d(b){l("dragstart",b)}function f(b){l("dragend",b)}function u(b){var y;(y=a.value)==null||y.setShow(!1)}function m(b){i.value=b,b&&h()}function h(){var y;let b=n.getPos();s.value.includes(c.value),(y=n.editor)==null||y.commands.setNodeSelection(b)}return e.watch(()=>n.getPos(),b=>{var y;(y=a.value)==null||y.setShow(!1)}),(b,y)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:a,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":m},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-drag-btn",{selected:i.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:d,onDragend:f},[e.createVNode(e.unref(te),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),e.createVNode(e.unref(O),{name:"drag_indicator",small:""})]),_:1})],34)]),default:e.withCtx(()=>[e.createVNode(jd,e.mergeProps(n,{onAction:u}),null,16)]),_:1},512))}}),Fd={key:0,class:"spinner"},zd={key:2,class:"o-btn__label"},te=e.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:o}){const n=o;return(l,r)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["o-btn",t.type?`type-${t.type}`:""]),onClick:r[0]||(r[0]=a=>n("click",a))},[t.loading?(e.openBlock(),e.createElementBlock("div",Fd)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.icon?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:t.icon,class:e.normalizeClass(t.iconClass)},null,8,["name","class"])):e.createCommentVNode("",!0)],64)),t.label?(e.openBlock(),e.createElementBlock("span",zd,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default")],2))}}),Hd={class:"o-btn-group"},Sr=e.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(t,{emit:o}){return(n,l)=>(e.openBlock(),e.createElementBlock("div",Hd,[e.renderSlot(n.$slots,"default")]))}}),Ud={class:"o-checkbox"},qd={class:"o-checkbox__main"},Wd={class:"o-checkbox__suffix"},Vn=e.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,l=o,r=e.computed({get(){return n.modelValue},set(a){l("update:modelValue",a)}});return(a,i)=>(e.openBlock(),e.createElementBlock("div",Ud,[e.createElementVNode("div",qd,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=s=>r.value=s),type:"checkbox"},null,512),[[e.vModelCheckbox,r.value]])]),e.createElementVNode("div",Wd,e.toDisplayString(t.label),1)]))}}),Yd={class:"dialog-header"},Gd={class:"dialog-body"},Kd={class:"dialog-footer"},En=e.defineComponent({name:"ODialog",__name:"ODialog",props:{show:{type:Boolean},icon:{},title:{},dialogClass:{},fullscreen:{type:Boolean}},emits:["close","update:show"],setup(t,{emit:o}){const n=o,l=()=>{n("update:show",!1),n("close")};return(r,a)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["dialog-overlay o-dialog",t.dialogClass]),onClick:e.withModifiers(l,["self"])},[e.createElementVNode("div",{class:e.normalizeClass(["dialog-box",{fullscreen:t.fullscreen}])},[e.createElementVNode("div",Yd,[e.renderSlot(r.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),e.createVNode(e.unref(te),{icon:"close",class:"close",onClick:l})]),e.createElementVNode("div",Gd,[e.renderSlot(r.$slots,"default")]),e.createElementVNode("div",Kd,[e.renderSlot(r.$slots,"footer")])],2)],2)):e.createCommentVNode("",!0)]))}}),fe=e.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-divider",{"o-divider-vertical":t.vertical}])},null,2))}}),Xd={key:0,class:"dialog-overlay o-image-viewer"},Jd={class:"dialog-box"},Zd={class:"dialog-body"},Qd=["src"],ep={class:"action-group"},tp={class:"action-group"},op={class:"o-btn scale"},Or=e.defineComponent({name:"ODialog",__name:"OImageViewer",props:{show:{type:Boolean,default:!1},title:{type:String,default:""},images:{type:Array,default:()=>[]},current:{type:Number,default:0}},emits:["update:show"],setup(t,{emit:o}){const n=t,l=o,{downloadImage:r}=uo(),a=e.ref(0),i=e.ref(1),s=e.ref({x:0,y:0}),c=e.ref(!1),p=e.ref({x:0,y:0}),d=e.ref(null),f=e.ref(null),u={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},m=e.computed(()=>{const N=n.images.length;let S={};return N>0&&(S=a.value>=0&&a.value<N?n.images.at(a.value):n.images.at(0)),S}),h=e.computed(()=>({transform:`translate(${s.value.x}px, ${s.value.y}px) scale(${i.value})`,transformOrigin:"center center",cursor:c.value?"grabbing":i.value>1?"grab":"default"})),b=e.computed(()=>parseInt(`${i.value*100}`)),y=N=>{N.preventDefault();const S=-N.deltaY*u.WHEEL_SENSITIVITY;let T=i.value+S;if(T=Math.max(u.MIN_SCALE,Math.min(u.MAX_SCALE,T)),f.value&&d.value){const v=f.value.getBoundingClientRect(),U=N.clientX-v.left-v.width/2,K=N.clientY-v.top-v.height/2,j=T-i.value;s.value.x-=U*j,s.value.y-=K*j}i.value=T},x=N=>{i.value<=1||(N.preventDefault(),c.value=!0,p.value={x:N.clientX-s.value.x,y:N.clientY-s.value.y},document.addEventListener("mousemove",k),document.addEventListener("mouseup",_))},k=N=>{c.value&&(s.value.x=N.clientX-p.value.x,s.value.y=N.clientY-p.value.y)},_=()=>{c.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",_)},g=()=>{i.value=Math.min(u.MAX_SCALE,i.value+u.STEP)},V=()=>{i.value=Math.max(u.MIN_SCALE,i.value-u.STEP)},B=()=>{i.value=1,s.value={x:0,y:0}},$=()=>{a.value>0&&(a.value-=1,B())},R=()=>{a.value<n.images.length-1&&(a.value+=1,B())},D=()=>{B(),l("update:show",!1)},M=()=>{var N;r((N=m.value.attrs)==null?void 0:N.src)},H=N=>{if(n.show)switch(N.preventDefault(),N.stopPropagation(),N.key){case"+":case"=":N.preventDefault(),g();break;case"-":N.preventDefault(),V();break;case"0":N.preventDefault(),B();break;case"ArrowLeft":(N.ctrlKey||N.metaKey)&&(N.preventDefault(),$());break;case"ArrowRight":(N.ctrlKey||N.metaKey)&&(N.preventDefault(),R());break;case"Escape":D();break}};return e.watch(()=>n.current,N=>{a.value=N,B()}),e.onMounted(()=>{a.value=n.current,document.addEventListener("keydown",H)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",H),document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",_)}),(N,S)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.show?(e.openBlock(),e.createElementBlock("div",Xd,[e.createElementVNode("header",null,[e.createVNode(e.unref(te),{icon:"close",onClick:D})]),e.createElementVNode("div",Jd,[e.createElementVNode("div",Zd,[e.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:f,onWheel:e.withModifiers(y,["prevent"]),onDblclick:B},[e.createElementVNode("img",{ref_key:"imageRef",ref:d,src:m.value.attrs.src,alt:"image",style:e.normalizeStyle(h.value),onMousedown:x},null,44,Qd)],544)])]),e.createElementVNode("footer",null,[e.createElementVNode("div",ep,[e.createVNode(e.unref(te),{icon:"arrow_back",class:e.normalizeClass({disabled:a.value<=0}),onClick:$},null,8,["class"]),e.createVNode(e.unref(te),{icon:"arrow_back","icon-class":"rotate-180",class:e.normalizeClass({disabled:a.value>=n.images.length-1}),onClick:R},null,8,["class"])]),e.createElementVNode("div",tp,[e.createVNode(e.unref(te),{icon:"horizontal_rule",onClick:V}),e.createElementVNode("div",op,e.toDisplayString(b.value)+"%",1),e.createVNode(e.unref(te),{icon:"add",onClick:g}),e.createVNode(e.unref(te),{icon:"download",onClick:M}),e.createVNode(e.unref(te),{icon:"close",onClick:D})])])])):e.createCommentVNode("",!0)]))}}),np={class:"o-input__prefix"},lp={class:"o-input__main"},rp=["placeholder"],ap={class:"o-input__suffix"},Se=e.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","enter","focus","update:modelValue"],setup(t,{expose:o,emit:n}){const l=t,r=n,a=e.ref(null),i=e.computed({get(){return l.modelValue},set(p){r("update:modelValue",p)}});function s(){var p;(p=a.value)==null||p.focus()}function c(){i.value="",s()}return o({clear:c,focus:s}),(p,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-input",`type-${t.type}`])},[e.createElementVNode("div",np,[e.renderSlot(p.$slots,"prefix")]),e.createElementVNode("div",lp,[e.withDirectives(e.createElementVNode("input",{ref_key:"input",ref:a,"onUpdate:modelValue":d[0]||(d[0]=f=>i.value=f),placeholder:t.placeholder,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur")),onKeyup:d[3]||(d[3]=e.withKeys(f=>r("enter"),["enter"]))},null,40,rp),[[e.vModelText,i.value]])]),e.createElementVNode("div",ap,[e.renderSlot(p.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock(O,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),se=e.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(["o-list",{clickable:t.clickable,hoverable:t.hoverable}])},[e.renderSlot(o.$slots,"default")],2))}}),ip={class:"o-list-item"},cp={class:"o-list-item__prefix"},sp={class:"o-list-item__main"},dp={class:"o-list-item__suffix"},ce=e.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("li",ip,[e.createElementVNode("div",cp,[e.renderSlot(o.$slots,"prefix")]),e.createElementVNode("div",sp,[e.renderSlot(o.$slots,"default")]),e.createElementVNode("div",dp,[e.renderSlot(o.$slots,"suffix")])]))}}),Z=e.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(t,{expose:o,emit:n}){const l=t,r=n,{theme:a}=it(),i=e.ref(null),s=e.ref(),c=e.ref();function p(m){var h,b,y,x;m?((b=c.value)==null||b.setProps({getReferenceClientRect:(h=l.event)!=null&&h.clientX?d:null}),(y=c.value)==null||y.show()):(x=c.value)==null||x.hide()}function d(){var m,h;return{width:0,height:0,left:l.event.clientX,right:l.event.clientX,top:l.event.clientY,bottom:l.event.clientY,x:((m=l.event)==null?void 0:m.clientX)||0,y:((h=l.event)==null?void 0:h.clientY)||0,toJSON:()=>{var b,y;return{width:100,height:100,left:((b=l.event)==null?void 0:b.clientX)||0,top:((y=l.event)==null?void 0:y.clientY)||0}}}}function f(){c.value=Ge(i.value,{appendTo:()=>document.body,animation:"shift-away",arrow:l.arrow,content:s.value,duration:l.duration,delay:l.delay,interactive:!0,offset:l.offset,placement:l.placement,trigger:l.trigger,theme:a.value,onShow:m=>{m.popper.classList.add(l.tippyClass||"tippy"),r("update:show",!0)},onHide:m=>{r("update:show",!1)}})}function u(){c.value.setProps({theme:a.value})}return e.watch(a,m=>{u()}),o({setShow:p}),e.onMounted(()=>{f()}),e.onUnmounted(()=>{c.value&&c.value.destroy()}),(m,h)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"triggerRef",ref:i,"data-tippy-role":"popover",class:"o-popover"},[e.renderSlot(m.$slots,"trigger"),t.disable?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contentRef",ref:s,class:e.normalizeClass(["popover-content",t.contentClass])},[e.renderSlot(m.$slots,"default")],2))],512))}}),pp={class:"o-textarea__prefix"},fp={class:"o-textarea__main"},up=["placeholder","rows"],mp={class:"o-textarea__suffix"},Ar=e.defineComponent({__name:"OTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""},rows:{type:Number,default:3}},emits:["blur","focus","update:modelValue"],setup(t,{expose:o,emit:n}){const l=t,r=n,a=e.ref(null),i=e.computed({get(){return l.modelValue},set(p){r("update:modelValue",p)}});function s(){var p;(p=a.value)==null||p.focus()}function c(){i.value="",s()}return o({clear:c,focus:s}),(p,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-textarea",`type-${t.type}`])},[e.createElementVNode("div",pp,[e.renderSlot(p.$slots,"prefix")]),e.createElementVNode("div",fp,[e.withDirectives(e.createElementVNode("textarea",{ref_key:"input",ref:a,"onUpdate:modelValue":d[0]||(d[0]=f=>i.value=f),placeholder:t.placeholder,rows:t.rows,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur"))},null,40,up),[[e.vModelText,i.value]])]),e.createElementVNode("div",mp,[e.renderSlot(p.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock(O,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),$r={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},gp=(t,o)=>{const n=$r[t];return n?n[o]:null},Nn={writing:`
173
29
  # Role
174
30
  World-class Writing Expert and Editor.
175
31
 
@@ -180,7 +36,7 @@ Rewrite and optimize the user's input for clarity, flow, and impact while strict
180
36
  - Language: Respond ONLY in the language specified by: [LANG_CODE].
181
37
  - Formatting: Use Markdown for structure.
182
38
  - Output: Provide the optimized text directly. Do not include any meta-talk, explanations, suggestions, or introductory/concluding remarks.
183
- `},tC=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","color","highlight","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","table","callout","emoji","aiBlock","separator","extension-dropdown"],nC=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","details","list-dropdown","link","image"],oC=["bold","strike","text-color-dropdown","highlight","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],rC=["inline-math-edit","inlineMathDelete"],iC=["link-open","link-edit","linkUnset"],sC=["align-group","separator","link"],lC=["align-group","separator","link-open","link-edit","linkUnset"],aC=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],cC=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],dC=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],g2={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},uC=[`
39
+ `},Tr=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","color","highlight","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","table","callout","emoji","aiBlock","separator","extension-dropdown"],Dr=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","details","list-dropdown","link","image"],Mr=["bold","strike","text-color-dropdown","highlight","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],Lr=["inline-math-edit","inlineMathDelete"],Pr=["link-open","link-edit","linkUnset"],Rr=["align-group","separator","link"],vr=["align-group","separator","link-open","link-edit","linkUnset"],Ir=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],jr=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],Fr=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],bp={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},zr=[`
184
40
  Certainly! Here's a detailed prompt you can use to instruct a Large Language Model (LLM) to act as a writing expert:
185
41
 
186
42
  ---
@@ -206,130 +62,10 @@ Let’s begin! What type of writing assistance do you need today?"
206
62
  ---
207
63
 
208
64
  This prompt ensures the LLM acts as a professional writing assistant, capable of handling diverse writing tasks with precision and creativity. Let me know if you'd like further customization!
209
- `],y2={key:0,class:"o-ai-menu tiptap-toolbar"},b2={key:0,class:"o-scroll"},k2={class:"view-main"},w2={key:1,class:"view-output"},x2={class:"action-container"},C2={style:{display:"flex"}},S2={style:{padding:"0 4px"}},v2={key:0},E2={class:"actions"},M2={key:0,class:"o-scroll"},T2=["innerHTML"],N2={class:"ai-io-panel"},A2={class:"o-flex o-item-center actions"},fC=c.defineComponent({__name:"OAiMenu",props:{editor:{type:St,required:!0},menuClass:{type:String,default:""},aiOptions:{type:Object,default:()=>{}}},emits:["confirm"],setup(n,{emit:e}){const t=n,o=e,{onStreamingChatCompletion:r}=t.aiOptions,{md:i}=Kh(),{locale:s,tr:l}=de(),a=c.ref(),d=c.ref(!1),u=c.ref(""),f=c.ref(""),p=c.ref("main"),h=c.ref(""),m=c.ref(!1),g=c.ref(!1),y=c.ref({}),b=c.computed(()=>({role:"system",content:xm.writing.replace("[LANG_CODE]",s.value)})),k=c.ref([{role:"system",content:""}]),x=c.computed(()=>{const _=u.value.toLowerCase();return mx.filter(D=>{var P;return D.value.toLowerCase().indexOf(_)>=0||((P=D.tips)==null?void 0:P.indexOf(_))>=0})});function w(){const{from:_,to:D}=t.editor.state.selection;return t.editor.state.doc.textBetween(_,D,"")}function C(){setTimeout(()=>{d.value=!0},0)}function v(_,D){switch(D&&(d.value=!0),h.value=_.options.prompt.replaceAll("[CONTENT]",w()),_.value){case"translate":h.value=h.value.replace("[LANGUAGE]",D.value);break;case"changeTone":h.value=h.value.replace("[TONE]",D.value);break}return u.value=l(_.label),y.value={..._,child:D},A(),!0}function E(){var _;B(),(_=a.value)==null||_.focus()}function T(){const _=im(t.editor,f.value),{from:D}=t.editor.state.selection,R=L.fromJSON(t.editor.schema,_.content).size;t.editor.chain().focus().deleteSelection().insertContent(f.value,{updateSelection:!0}).setTextSelection({from:D,to:D+R}).run(),B(),d.value=!1,setTimeout(()=>{o("confirm")},0)}function A(){p.value="output",m.value=!0,g.value?O():$()}async function $(){let _="";if(k.value.push({role:"user",content:h.value}),k.value[0].role==="system"&&(k.value.shift(),k.value.unshift(b.value)),!r){Ql.error("AI Completion method not implemented."),m.value=!1;return}try{const D=await r({messages:k.value,onChunk:P=>{_+=P,k.value=[...k.value.slice(0,-1),{role:"assistant",content:_}],f.value=i.render(_)}})}catch(D){k.value.pop(),console.error(D),Ql.error(l("ai.error"))}finally{m.value=!1}}async function O(){let _="";for(const D of uC)await new Promise(P=>setTimeout(P,500)),_+=D,f.value=i.render(_);m.value=!1}function B(){p.value="main",f.value="",u.value=""}return c.onMounted(()=>{setTimeout(()=>{var _;(_=a.value)==null||_.focus(),d.value=!0},300)}),(_,D)=>n.editor?(c.openBlock(),c.createElementBlock("section",y2,[c.createVNode(c.unref(wo),{modelValue:d.value,"onUpdate:modelValue":D[1]||(D[1]=P=>d.value=P),offset:[-4,10],placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":c.withCtx(()=>{var P;return[p.value==="main"?(c.openBlock(),c.createElementBlock("div",b2,[c.createElementVNode("section",k2,[c.createVNode(c.unref(_d),{items:x.value,onSelect:v,"use-keyboard":d.value},null,8,["items","use-keyboard"])])])):c.createCommentVNode("",!0),p.value==="output"?(c.openBlock(),c.createElementBlock("section",w2,[c.createElementVNode("div",x2,[c.createElementVNode("div",C2,[c.createVNode(c.unref(X),{name:"auto_awesome",class:"o-tips"}),c.createElementVNode("div",S2,[c.createTextVNode(c.toDisplayString(c.unref(l)(y.value.label))+" ",1),(P=y.value.child)!=null&&P.label?(c.openBlock(),c.createElementBlock("span",v2,": "+c.toDisplayString(c.unref(l)(y.value.child.label)),1)):c.createCommentVNode("",!0)])]),c.createElementVNode("div",E2,[c.createVNode(c.unref(Rr),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(l)("label.confirm"),loading:m.value,onClick:T},null,8,["tooltip","loading"]),m.value?c.createCommentVNode("",!0):(c.openBlock(),c.createBlock(c.unref(Rr),{key:0,icon:"close",tooltip:c.unref(l)("label.cancel"),onClick:E},null,8,["tooltip"]))])]),f.value?(c.openBlock(),c.createElementBlock("div",M2,[c.createElementVNode("div",{class:"tiptap output",innerHTML:f.value},null,8,T2)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createElementVNode("section",N2,[c.createVNode(c.unref(jn),{ref_key:"inputRef",ref:a,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":D[0]||(D[0]=P=>u.value=P),type:"text",placeholder:c.unref(l)("ai.askAi"),autofocus:"",onFocus:C},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome",class:"o-tips"})]),suffix:c.withCtx(()=>[c.createElementVNode("div",A2,[c.createVNode(c.unref(Rr),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0)}}),O2={key:0,class:"o-inline-math-menu tiptap-toolbar"},pC=c.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:St,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(n,{emit:e}){const t=n,o=e,{run:r}=xe(),i=c.ref(null),s=c.ref(""),l=c.ref(null);c.computed(()=>{const f=Xo.getState(t.editor.state);return!!(f!=null&&f.active)});function a(){if(s.value="",l.value=null,t.editor.isActive("inlineMath")){const{state:f}=t.editor,{selection:p,schema:h}=f;if(p instanceof Q){const m=p.node;l.value=p.from,m.type.name==="inlineMath"&&(s.value=m.attrs.latex)}}setTimeout(()=>{var f;(f=i.value)==null||f.focus()},300)}function d(){console.log("latex",s.value,l.value),l.value?s.value?r(t.editor,"inlineMathUpdate",{latex:s.value}):r(t.editor,"inlineMathDelete",{pos:l.value}):s.value&&r(t.editor,"inlineMathInsert",{latex:s.value}),setTimeout(()=>{o("confirm")},0)}const u=()=>{t.editor.view.dispatch(t.editor.state.tr.setMeta(Xo,{type:"hide"}))};return c.onMounted(()=>{a(),t.editor.on("focus",u)}),c.onUnmounted(()=>{t.editor.off("focus",u)}),(f,p)=>n.editor?(c.openBlock(),c.createElementBlock("section",O2,[c.createVNode(c.unref(jn),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=h=>s.value=h),type:"text",autofocus:"",clearable:"",onKeydown:c.withKeys(c.withModifiers(d,["prevent"]),["enter"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"function",class:"o-tips"})]),suffix:c.withCtx(()=>[s.value?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:d})):c.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):c.createCommentVNode("",!0)}}),$2={key:0,class:"spinner"},Rr=c.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=n,o=e;function r(i){t.loading||o("click",i)}return(i,s)=>(c.openBlock(),c.createBlock(c.unref(xn),{placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:c.withModifiers(r,["stop"])},[n.loading?(c.openBlock(),c.createElementBlock("div",$2)):(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"])),c.renderSlot(i.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),B2=c.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const{tr:e}=de();return(t,o)=>(c.openBlock(),c.createBlock(Rr,{"content-class":"o-ai-btn",icon:"auto_awesome",color:c.unref(ke).purple,tooltip:c.unref(e)("ai.askAi")},null,8,["color","tooltip"]))}}),R2={class:"o-align-group"},D2=c.defineComponent({__name:"OAlignGroup",props:{editor:{type:St}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_left"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"}]);function i(s){o(e.editor,"textAlign",{textAlign:s.value})}return(s,l)=>(c.openBlock(),c.createElementBlock("div",R2,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,d)=>{var u;return c.openBlock(),c.createBlock($e,{key:d,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(u=n.editor)==null?void 0:u.isActive({textAlign:a.value})},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),_2={class:"o-background-color-dropdown o-button-group"},I2=c.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"backgroundColor",{color:a})}return(a,d)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(xn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",_2,[c.createVNode(c.unref(Ke),{icon:"background_color",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(Ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>{var u;return[c.createVNode(c.unref(Si),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(u=n.editor)==null?void 0:u.getAttributes("textStyle").backgroundColor,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),L2={class:"o-highlight-dropdown o-button-group"},P2=c.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"highlight",{color:a})}return(a,d)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(xn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",L2,[c.createVNode(c.unref(Ke),{icon:"ink_highlighter",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(Ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>{var u;return[c.createVNode(c.unref(Si),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(u=n.editor)==null?void 0:u.getAttributes("highlight").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),V2=c.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(n){const e=n,{run:t}=xe(),{tr:o}=de();function r(){const{state:i}=e.editor,{selection:s}=i,{$from:l}=s,d=l.node().type.name;t(e.editor,"details",{type:d})}return(i,s)=>{var l;return c.openBlock(),c.createBlock($e,{class:"o-details-btn",icon:"toggle_list",tooltip:c.unref(o)("editor.toggleList"),"content-class":{"is-active":(l=n.editor)==null?void 0:l.isActive("details")},onClick:r},null,8,["tooltip","content-class"])}}}),z2=c.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"content",{content:s.emoji})}return(s,l)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:c.unref(t)("editor.emoji")},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(zd),{items:c.unref(qs.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),H2=c.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"fontFamily",{fontFamily:l})}return(l,a)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:c.unref(t)("editor.fontFamily")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,u)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:u},[d.separator?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(kt),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive("textStyle",{fontFamily:d.value})}),onClick:p=>s(d.value)},{suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive("textStyle",{fontFamily:d.value})?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createElementVNode("span",{style:c.normalizeStyle(`font-family: ${d.value}`)},c.toDisplayString(d.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),F2={class:"o-fore-color-dropdown o-button-group"},j2=c.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref("#ff4d4f");function s(){l(i.value)}function l(a){var d;(d=r.value)==null||d.setShow(!1),i.value=a,o(e.editor,"color",{color:a})}return(a,d)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(xn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",F2,[c.createVNode(c.unref(Ke),{icon:"format_color_text",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(Ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.textColor")),1)]),_:1})]),default:c.withCtx(()=>{var u;return[c.createVNode(c.unref(Si),{"default-color":"","default-label":c.unref(t)("editor.defaultColor"),"active-color":(u=n.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),U2=c.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:t("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:t("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:t("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:t("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:t("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function s(a){var d,u;return a.value==="heading"?(d=e.editor)==null?void 0:d.isActive(a.value,{level:a.valueAlt}):(u=e.editor)==null?void 0:u.isActive(a.value)}function l(a){var d;(d=r.value)==null||d.setShow(!1),o(e.editor,a.value,{level:a.valueAlt})}return(a,d)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:c.unref(t)("editor.heading")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[u.separator?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(kt),{class:c.normalizeClass({"is-active":s(u)}),onClick:p=>l(u)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(u)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),W2=c.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:St,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(null);function a(){if(e.editor.isActive("inlineMath")){const{state:p}=e.editor,{selection:h,schema:m}=p;if(h instanceof Q){const g=h.node;l.value=h.from,g.type.name==="inlineMath"&&(s.value=g.attrs.latex)}}}function d(){var p;(p=r.value)==null||p.setShow(!1)}function u(p){var h;console.log("confirm",p),p?o(e.editor,"inlineMathUpdate",{latex:p,pos:l.value}):o(e.editor,"inlineMathDelete",{pos:l.value}),(h=r.value)==null||h.setShow(!1)}function f(){window.open("https://katex.org/docs/supported.html","target")}return(p,h)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[h[0]||(h[0]=m=>i.value=m),a]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"edit",tooltip:c.unref(t)("label.edit")},null,8,["tooltip"])]),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Hd),{key:0,title:c.unref(t)("label.edit"),val:s.value,icon:"function",onCancel:d,onConfirm:u},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"help",tooltip:c.unref(t)("label.help"),onClick:f},null,8,["tooltip"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),q2={class:"o-list-dropdown o-button-group"},K2=c.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref();function s(){o(e.editor,i.value.value)}function l(d){r.value.setShow(!1),i.value=d,o(e.editor,d.value)}const a=c.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);return c.onMounted(()=>{i.value=a.value[0]}),(d,u)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(xn),null,{trigger:c.withCtx(()=>{var f;return[c.createElementVNode("div",q2,[c.createVNode(c.unref(Ke),{icon:(f=i.value)==null?void 0:f.icon,class:"o-command-btn",onClick:c.withModifiers(s,["stop"])},null,8,["icon"]),c.createVNode(c.unref(Ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:c.withCtx(()=>{var f;return[c.createTextVNode(" "+c.toDisplayString((f=i.value)==null?void 0:f.label),1)]}),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,(f,p)=>{var h;return c.openBlock(),c.createBlock(c.unref(kt),{key:p,class:c.normalizeClass({"is-active":(h=n.editor)==null?void 0:h.isActive(f.value)}),onClick:m=>l(f)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:f.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var m;return[(m=n.editor)!=null&&m.isActive(f.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(f.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),J2={class:"o-list-group"},G2=c.defineComponent({__name:"OListGroup",props:{editor:{type:St,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);function i(s){o(e.editor,s.value)}return(s,l)=>(c.openBlock(),c.createElementBlock("div",J2,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,d)=>{var u;return c.openBlock(),c.createBlock($e,{key:d,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(u=n.editor)==null?void 0:u.isActive(a.value)},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),X2=c.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:St,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(!0);function a(){var p;s.value="",l.value=!0;const f=(p=e.editor)==null?void 0:p.getAttributes("link");f!=null&&f.href&&(s.value=f.href,l.value=f.target==="_blank")}function d(){var f;(f=r.value)==null||f.setShow(!1)}function u(f){var p;f?o(e.editor,"linkSet",{href:f,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(p=r.value)==null||p.setShow(!1)}return(f,p)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[p[1]||(p[1]=h=>i.value=h),a]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"edit",tooltip:c.unref(t)("link.edit")},null,8,["tooltip"])]),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Hd),{key:0,title:c.unref(t)("link.edit"),val:s.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(km),{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=h=>l.value=h),label:c.unref(t)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Y2=c.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de();function o(){var i;const r=(i=e.editor)==null?void 0:i.getAttributes("link");r!=null&&r.href&&window.open(r.href,"target")}return(r,i)=>(c.openBlock(),c.createBlock($e,{icon:"open_in_new",tooltip:c.unref(t)("link.open"),"content-class":"o-link-open-btn",onClick:o},null,8,["tooltip"]))}}),Q2={class:"o-command-btn"},Z2={class:"o-more-bubble"},ez=c.defineComponent({__name:"OMoreBubble",props:{editor:{type:St,required:!0}},setup(n){const e=c.ref();return(t,o)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:e,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:c.withCtx(()=>[c.createElementVNode("div",Q2,[c.createVNode(c.unref(X),{name:"more_horiz"})])]),default:c.withCtx(()=>[c.createElementVNode("section",Z2,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(aC),(r,i)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:i},[r==="separator"?(c.openBlock(),c.createBlock(c.unref(_t),{key:0,vertical:""})):typeof r=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Qd)(r)),{key:1,name:r,editor:n.editor},null,8,["name","editor"])):c.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),tz=c.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",icon:"title"},{label:t("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:t("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:t("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:t("editor.todoList"),value:"taskList",icon:"check_box"},{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:t("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function s(a){var d;return(d=e.editor)==null?void 0:d.isActive(a.value,a.options)}function l(a){r.value.setShow(!1),o(e.editor,a.value,a.options)}return(a,d)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:c.unref(t)("label.styles")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[u.separator?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(kt),{class:c.normalizeClass({"is-active":s(u)}),onClick:p=>l(u)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(u)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),nz=c.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"tableInsert",s)}return(s,l)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"window","content-class":"o-table-btn",tooltip:c.unref(t)("table.insert")},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(bx),{onSelect:i})]),_:1},512))}}),oz={class:"o-table-group"},rz={ai:B2,"align-dropdown":nm,"align-group":D2,"background-color":I2,color:j2,details:V2,"extension-dropdown":dx,"font-family":H2,heading:U2,highlight:P2,"inline-math-edit":W2,"list-dropdown":K2,"list-group":G2,link:om,"link-edit":X2,"link-open":Y2,emoji:z2,more:ez,"style-dropdown":tz,table:nz,"table-group":c.defineComponent({__name:"OTableGroup",props:{editor:{type:St,required:!0}},setup(n){const{tr:e}=de(),{run:t}=xe();return(o,r)=>{var i,s;return c.openBlock(),c.createElementBlock("section",oz,[(i=n.editor)!=null&&i.can().mergeCells()?(c.openBlock(),c.createBlock(c.unref($e),{key:0,icon:"cell_merge",tooltip:c.unref(e)("table.merge"),onClick:r[0]||(r[0]=l=>c.unref(t)(n.editor,"tableMergeCells"))},null,8,["tooltip"])):c.createCommentVNode("",!0),(s=n.editor)!=null&&s.can().splitCell()?(c.openBlock(),c.createBlock(c.unref($e),{key:1,icon:"splitscreen_left",tooltip:c.unref(e)("table.split"),onClick:r[1]||(r[1]=l=>c.unref(t)(n.editor,"tableSplitCell"))},null,8,["tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref(kx),{editor:n.editor},null,8,["editor"])])}}}),"text-color-dropdown":c.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:St}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(null),i=c.ref(""),s=c.ref("");function l(a){a.name==="color"?(i.value=a.value,localStorage.setItem("yiitap.text-color.fore",a.value)):a.name==="backColor"&&(s.value=a.value,localStorage.setItem("yiitap.text-color.back",a.value)),r.value.setShow(!1),o(e.editor,a.name,{color:a.value})}return c.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(a,d)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:c.unref(t)("editor.textColor")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var u;return[c.createVNode(c.unref(lm),{"fore-color":i.value,"back-color":s.value,"default-label":c.unref(t)("editor.defaultColor"),"active-color":(u=n.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:l},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),"text-format-dropdown":c.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:St}},setup(n){const e=n,{tr:t}=de(),{run:o}=xe(),r=c.ref(),i=c.computed(()=>[{label:t("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:t("editor.underline"),value:"underline",icon:"format_underlined"},{label:t("editor.code"),value:"code",icon:"code",separator:!0},{label:t("editor.subscript"),value:"subscript",icon:"subscript",separator:!0},{label:t("editor.superscript"),value:"superscript",icon:"superscript"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,l)}return(l,a)=>(c.openBlock(),c.createBlock(c.unref(De),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(bt),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:c.unref(t)("editor.textFormat")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,u)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:u},[d.separator?(c.openBlock(),c.createBlock(c.unref(_t),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(kt),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive(d.value)}),onClick:p=>s(d.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive(d.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}})},Qd=n=>rz[n]||kL,iz={key:0,class:"o-main-menu"},sz={class:"left"},lz={class:"right"},hC=c.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(n){const e=n,t=c.computed(()=>{var r;let o=e.menu;return(r=e.editor)!=null&&r.isActive("table")&&(o=nC),o.length>0?o:tC});return(o,r)=>n.editor?(c.openBlock(),c.createElementBlock("section",iz,[c.createElementVNode("section",sz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.value,(i,s)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:s},[i==="separator"?(c.openBlock(),c.createBlock(c.unref(_t),{key:0,vertical:""})):typeof i=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Qd)(i)),{key:1,name:i,editor:n.editor},null,8,["name","editor"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i),{key:2,editor:n.editor},null,8,["editor"]))],64))),128)),c.renderSlot(o.$slots,"left")]),c.createElementVNode("section",lz,[c.renderSlot(o.$slots,"right")])])):c.createCommentVNode("",!0)}});function az(n,e){const t=Math.min(n.top,e.top),o=Math.max(n.bottom,e.bottom),r=Math.min(n.left,e.left),s=Math.max(n.right,e.right)-r,l=o-t,a=r,d=t;return new DOMRect(a,d,s,l)}var cz=class{constructor({editor:n,element:e,view:t,pluginKey:o="bubbleMenu",updateDelay:r=250,resizeDelay:i=60,shouldShow:s,appendTo:l,getReferencedVirtualElement:a,options:d}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:f,state:p,from:h,to:m})=>{const{doc:g,selection:y}=p,{empty:b}=y,k=!g.textBetween(h,m).length&&ml(p.selection),x=this.element.contains(document.activeElement);return!(!(f.hasFocus()||x)||b||k||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:f})=>{var p;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}f!=null&&f.relatedTarget&&((p=this.element.parentNode)!=null&&p.contains(f.relatedTarget))||(f==null?void 0:f.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(f,p)=>{const h=!(p!=null&&p.selection.eq(f.state.selection)),m=!(p!=null&&p.doc.eq(f.state.doc));!h&&!m||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(f,h,m,p)},this.updateDelay))},this.updateHandler=(f,p,h,m)=>{const{composing:g}=f;if(g||!p&&!h)return;if(!this.getShouldShow(m)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:f})=>{const p=f.getMeta(this.pluginKey);p==="updatePosition"?this.updatePosition():p&&typeof p=="object"&&p.type==="updateOptions"&&this.updateOptions(p.options)};var u;this.editor=n,this.element=e,this.view=t,this.pluginKey=o,this.updateDelay=r,this.resizeDelay=i,this.appendTo=l,this.scrollTarget=(u=d==null?void 0:d.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...d},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(bm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ym(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(jx(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(Kx(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wx(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Ux(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(qx(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Jx(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n,e,t;const{selection:o}=this.editor.state,r=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(r)return r;if(!((t=(e=this.view)==null?void 0:e.dom)!=null&&t.parentNode))return;const i=jp(this.view,o.from,o.to);let s={getBoundingClientRect:()=>i,getClientRects:()=>[i]};if(o instanceof Q){let l=this.view.nodeDOM(o.from);const a=l.dataset.nodeViewWrapper?l:l.querySelector("[data-node-view-wrapper]");a&&(l=a),l&&(s={getBoundingClientRect:()=>l.getBoundingClientRect(),getClientRects:()=>[l.getBoundingClientRect()]})}if(o instanceof Pe){const{$anchorCell:l,$headCell:a}=o,d=l?l.pos:a.pos,u=a?a.pos:l.pos,f=this.view.nodeDOM(d),p=this.view.nodeDOM(u);if(!f||!p)return;const h=f===p?f.getBoundingClientRect():az(f.getBoundingClientRect(),p.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}updatePosition(){const n=this.virtualElement;n&&Yd(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:o,middlewareData:r})=>{var i,s;if((i=r.hide)!=null&&i.referenceHidden||(s=r.hide)!=null&&s.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,o=t.selection.from!==t.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(n,e);return}const r=!(e!=null&&e.selection.eq(n.state.selection)),i=!(e!=null&&e.doc.eq(n.state.doc));this.updateHandler(n,r,i,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:o}=t,{ranges:r}=o,i=Math.min(...r.map(a=>a.$from.pos)),s=Math.max(...r.map(a=>a.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:i,to:s}))||!1}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(n){var e;if(n.updateDelay!==void 0&&(this.updateDelay=n.updateDelay),n.resizeDelay!==void 0&&(this.resizeDelay=n.resizeDelay),n.appendTo!==void 0&&(this.appendTo=n.appendTo),n.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=n.getReferencedVirtualElement),n.shouldShow!==void 0&&n.shouldShow&&(this.shouldShow=n.shouldShow),n.options!==void 0){const t=(e=n.options.scrollTarget)!=null?e:window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...n.options}}}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},dz=n=>new ce({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new cz({view:e,...n})}),uz=c.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const o=c.ref(null);return c.onMounted(()=>{const{editor:r,options:i,pluginKey:s,resizeDelay:l,appendTo:a,shouldShow:d,getReferencedVirtualElement:u,updateDelay:f}=n,p=o.value;p&&(p.style.visibility="hidden",p.style.position="absolute",p.remove(),c.nextTick(()=>{r.registerPlugin(dz({editor:r,element:p,options:i,pluginKey:s,resizeDelay:l,appendTo:a,shouldShow:d,getReferencedVirtualElement:u,updateDelay:f}))}))}),c.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=n;i.unregisterPlugin(r)}),()=>{var r;return c.h("div",{ref:o,...t},(r=e.default)==null?void 0:r.call(e))}}}),fz=class{constructor({editor:n,element:e,view:t,pluginKey:o="floatingMenu",updateDelay:r=250,resizeDelay:i=60,options:s,appendTo:l,shouldShow:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:f})=>{const{selection:p}=f,{$anchor:h,empty:m}=p,g=h.depth===1,y=h.parent.isTextblock&&!h.parent.type.spec.code&&!h.parent.textContent&&h.parent.childCount===0&&!this.getTextContent(h.parent);return!(!u.hasFocus()||!m||!g||!y||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,f,p,h)=>{const{composing:m}=u;if(m||!f&&!p)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var f;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{const f=u.getMeta(this.pluginKey);f==="updatePosition"?this.updatePosition():f&&typeof f=="object"&&f.type==="updateOptions"&&this.updateOptions(f.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var d;this.editor=n,this.element=e,this.view=t,this.pluginKey=o,this.updateDelay=r,this.resizeDelay=i,this.appendTo=l,this.scrollTarget=(d=s==null?void 0:s.scrollTarget)!=null?d:window,this.floatingUIOptions={...this.floatingUIOptions,...s},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(n){return Sc(n,{textSerializers:kl(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(bm(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(ym(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(jx(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(Kx(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(Wx(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(Ux(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(qx(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(Jx(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:o}=t,{ranges:r}=o,i=Math.min(...r.map(a=>a.$from.pos)),s=Math.max(...r.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:i,to:s})}updateOptions(n){var e;if(n.updateDelay!==void 0&&(this.updateDelay=n.updateDelay),n.resizeDelay!==void 0&&(this.resizeDelay=n.resizeDelay),n.appendTo!==void 0&&(this.appendTo=n.appendTo),n.shouldShow!==void 0&&n.shouldShow&&(this.shouldShow=n.shouldShow),n.options!==void 0){const t=(e=n.options.scrollTarget)!=null?e:window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener("scroll",this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...n.options}}}updatePosition(){const{selection:n}=this.editor.state,e=jp(this.view,n.from,n.to);Yd({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:r,strategy:i,middlewareData:s})=>{var l,a;if((l=s.hide)!=null&&l.referenceHidden||(a=s.hide)!=null&&a.escaped){this.element.style.visibility="hidden";return}this.element.style.visibility="visible",this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${o}px`,this.element.style.top=`${r}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!(e!=null&&e.selection.eq(n.state.selection)),o=!(e!=null&&e.doc.eq(n.state.doc));this.updateHandler(n,t,o,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},pz=n=>new ce({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new fz({view:e,...n})}),hz=c.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const o=c.ref(null);return c.onMounted(()=>{const{pluginKey:r,editor:i,updateDelay:s,resizeDelay:l,options:a,appendTo:d,shouldShow:u}=n,f=o.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),i.registerPlugin(pz({pluginKey:r,editor:i,element:f,updateDelay:s,resizeDelay:l,options:a,appendTo:d,shouldShow:u})))}),c.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=n;i.unregisterPlugin(r)}),()=>{var r;return c.h("div",{ref:o,...t},(r=e.default)==null?void 0:r.call(e))}}});const mz={key:0},gz=c.defineComponent({__name:"OBubbleMenu",props:{editor:{type:St},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""},aiOptions:{type:Object,default:()=>{}}},setup(n){const e=n,{tr:t}=de(),{theme:o}=xi(),r=c.ref(!1),i=c.ref(!1),s=c.ref(!1),l=c.ref(!1),a=c.ref({offset:10,placement:"bottom-start",onShow:()=>{r.value=!1,i.value=!1,s.value=!1},onHide:()=>{s.value=!1}});function d(){r.value=!0}function u(x){x==="ai"&&(i.value=!0)}function f(){s.value=!0}function p(x){const{schema:w}=e.editor,C=w.marks.link;if(!C||!x)return!1;const{$from:v,$to:E}=x;return!!di(v,C)}function h({editor:x,element:w,view:C,state:v,oldState:E,from:T,to:A}){var H;const{doc:$,selection:O}=v,{empty:B}=O,_=!$.textBetween(T,A).length&&ml(v.selection);if(l.value=e.editor.isActive("inlineMath"),k.value||e.editor.isActive("inlineMath"))return!0;if(!C.hasFocus()||B||s.value||_&&x.isActive("link")&&!x.isActive("image"))return!1;const D=["image"],P=["image","toc","video","model-viewer"],R=O.node,K=(H=R==null?void 0:R.type)==null?void 0:H.name;return!(x.isActive("codeBlock")||P.indexOf(K)>=0||K&&!D.includes(K))}const m=c.computed(()=>{if(e.editor){const{state:x}=e.editor,{tr:w}=x,{selection:C}=w;return p(C)}else return!1}),g=c.computed(()=>{var x,w;return!r.value&&!((x=e.editor)!=null&&x.isActive("image"))&&(m.value||((w=e.editor)==null?void 0:w.isActive("inlineMath")))}),y=c.computed(()=>k.value||l.value),b=c.computed(()=>{var w,C,v;let x=e.menu;return r.value||((w=e.editor)!=null&&w.isActive("image")?x=m.value?lC:sC:(C=e.editor)!=null&&C.isActive("table")?x=cC:m.value?x=iC:(v=e.editor)!=null&&v.isActive("inlineMath")&&(x=rC)),x.length>0?x:oC}),k=c.computed(()=>{const x=Xo.getState(e.editor.state);return!!(x!=null&&x.active)});return c.onMounted(()=>{r.value=!1}),(x,w)=>n.editor?(c.openBlock(),c.createElementBlock("section",mz,[c.createVNode(c.unref(uz),{editor:n.editor,"should-show":h,options:a.value},{default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(fC),{key:0,editor:n.editor,"ai-options":n.aiOptions,onConfirm:f},null,8,["editor","ai-options"])):y.value?(c.openBlock(),c.createBlock(c.unref(pC),{key:1,editor:n.editor},null,8,["editor"])):(c.openBlock(),c.createElementBlock("section",{key:2,class:c.normalizeClass(["tiptap-toolbar",n.menuClass])},[g.value?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createVNode(c.unref($e),{icon:"arrow_back",tooltip:c.unref(t)("link.back"),onClick:d},null,8,["tooltip"]),c.createVNode(c.unref(_t),{vertical:""})],64)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(b.value,(C,v)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:v},[C==="separator"?(c.openBlock(),c.createBlock(c.unref(_t),{key:0,vertical:""})):typeof C=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Qd)(C)),{key:1,name:C,editor:n.editor,onClick:E=>u(C)},null,8,["name","editor","onClick"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(C),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):c.createCommentVNode("",!0)}}),yz={key:0},bz=c.defineComponent({__name:"OFloatingMenu",props:{editor:{type:o0},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(n){const e=n,t=c.ref(!1),o=c.ref({placement:"right",offset:168});function r(){t.value=!0}function i(u){const{schema:f}=e.editor,p=f.marks.link;if(!p||!u)return!1;const{$from:h,$to:m}=u;return!!di(h,p)}const s=c.computed(()=>{if(e.editor){const{state:u}=e.editor,{tr:f}=u,{selection:p}=f;return i(p)}else return!1}),l=c.computed(()=>!t.value&&s.value),a=c.computed(()=>{const u=e.menu;return u.length>0?u:dC}),d=c.computed(()=>{const u=Xo.getState(e.editor.state);return!!(u!=null&&u.active)});return(u,f)=>n.editor&&!d.value?(c.openBlock(),c.createElementBlock("section",yz,[c.createVNode(c.unref(hz),{editor:n.editor,options:o.value},{default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["tiptap-toolbar",n.menuClass])},[l.value?(c.openBlock(),c.createBlock(c.unref($e),{key:0,icon:"arrow_back",onClick:r})):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,(p,h)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:h},[p==="separator"?(c.openBlock(),c.createBlock(c.unref(_t),{key:0,vertical:""})):typeof p=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Qd)(p)),{key:1,name:p,editor:n.editor},null,8,["name","editor"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(p),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))],2)]),_:1},8,["editor","options"])])):c.createCommentVNode("",!0)}});function Cm(n,e){const t=e==null?void 0:e.posAtCoords(n);if(!t)return;let o=Zd(t.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function Zd(n,e){return e.nodeDOM(n)||e.domAtPos(n).node}function Sm(n,e){const t=Cm(n,e);if(t&&t.nodeType===1){const o=e.docView,r=o.nearestDesc(t,!0);return!r||r===o?null:r.posBefore}return null}function kz(n,e){let t,o;const r=e.resolve(n.from).node().type.spec.group==="blockContent",i=e.resolve(n.to).node().type.spec.group==="blockContent",s=Math.min(n.$anchor.depth,n.$head.depth);if(r&&i){const l=n.$from.start(s-1),a=n.$to.end(s-1);t=e.resolve(l-1).pos,o=e.resolve(a+1).pos}else t=n.from,o=n.to;return{from:t,to:o}}function wz(n,e){const t=Sm(n,e.view);return typeof t=="number"&&t>=0?{node:e.state.doc.nodeAt(t),pos:t}:{node:null,pos:t}}const Zl=new le("sideMenu");class xz{constructor(){qe(this,"hovered",!1);qe(this,"coords",{left:0,top:0});qe(this,"className","")}init(e){return this}apply({tr:e,oldState:t,newState:o}){return e.docChanged?this:this}setHover(e,t,o=""){this.hovered=e,this.coords=t,this.className=o}}class Cz{constructor({editor:e,element:t,view:o,tippyOptions:r={},updateDelay:i=250}){qe(this,"editor");qe(this,"element");qe(this,"view");qe(this,"preventHide",!1);qe(this,"tippy");qe(this,"tippyOptions");qe(this,"updateDelay");qe(this,"updateDebounceTimer");qe(this,"mousedownHandler",()=>{this.preventHide=!0});qe(this,"onDragStart",e=>{this.hide()});qe(this,"blurHandler",({event:e})=>{var t;e!=null&&e.relatedTarget&&((t=this.element.parentNode)!=null&&t.contains(e.relatedTarget))||this.hide()});qe(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});qe(this,"handleDebouncedUpdate",(e,t)=>{const o=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));!o&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,o,r,t)},this.updateDelay))});qe(this,"updateHandler",(e,t,o,r)=>{var d,u;const{state:i,composing:s}=e,{coords:l}=Zl.getState(i),a=Cm(l,e);Sm(l,e),a&&(this.createTooltip(),(u=this.tippy)==null||u.setProps({getReferenceClientRect:((d=this.tippyOptions)==null?void 0:d.getReferenceClientRect)||(()=>a.getBoundingClientRect())}),this.show())});this.editor=e,this.element=t,this.view=o,this.updateDelay=i,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=e instanceof Element?e:"mount"in e?e.mount:null,o=!!(t!=null&&t.parentElement);this.tippy||!o||(this.tippy=Go(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:o}=e,r=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,r,i,t)}show(){var e;(e=this.tippy)==null||e.show()}hide(){var e;(e=this.tippy)==null||e.hide()}destroy(){var e,t;(e=this.tippy)!=null&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)==null||t.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const Sz=(n,e)=>{if(!n.dataTransfer)return;const{view:t}=e;t.dom.getBoundingClientRect();const o=Zl.getState(t.state),r={left:o.coords.left,top:o.coords.top},i=Sm(r,t);if(i===null)return;const s=t.state.selection,l=t.state.doc;kz(s,l),t.dispatch(t.state.tr.setSelection(Q.create(t.state.doc,i))),t.dom.classList.add("is-dragging"),Ez(t,i);const a=t.state.selection.content(),{dom:d,text:u}=t.serializeForClipboard(a);n.dataTransfer.clearData(),n.dataTransfer.setData("text/html",d.innerHTML),n.dataTransfer.setData("text/plain",u),n.dataTransfer.effectAllowed="move",n.dataTransfer.setDragImage(Ei,0,0),t.dragging={slice:a,move:!0}},vz=(n,e)=>{const{view:t}=e;t.dom.classList.remove("is-dragging"),mC()};let Ei;function Ez(n,e,t=e){const o=n.domAtPos(e).node.cloneNode(!0),r=n.domAtPos(e).node,i=(f,p)=>Array.prototype.indexOf.call(f.children,p),s=f=>{let p=f,h=p.parentElement;for(;h;){if(h===n.dom)return p;p=h,h=p.parentElement}return p};let l=-1,a=-1;e===t?(l=i(r,s(Zd(e,n))),a=l):(l=i(r,s(Zd(e+1,n))),a=i(r,s(Zd(t-1,n))));for(let f=r.childElementCount-1;f>=0;f--)(f>l||f<a)&&o.removeChild(o.children[f]);mC(),Ei=o;const u=n.dom.className.split(" ").filter(f=>f!=="ProseMirror"&&f!=="yiitap-root"&&f!=="yiitap-editor").join(" ");Ei.className+=" yiitap-dragging-preview "+u,document.body.appendChild(Ei)}function mC(){Ei!==void 0&&(document.body.removeChild(Ei),Ei=void 0)}class Mz{constructor(e){qe(this,"options");qe(this,"plugin");qe(this,"sideMenuView");const t=new xz;this.options=e,this.plugin=new ce({key:Zl,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=Cm(i,o),l=(s==null?void 0:s.className)||"",a=t.className;l.indexOf("o-table-wrapper-view")>=0&&a.indexOf("o-table-wrapper-view")>=0||(t.setHover(!0,i,l),o.dispatch(o.state.tr.setMeta(Zl,t)))}}},state:{init(o,r){return t.init(r)},apply(o,r,i,s){return t.apply({tr:o,oldState:i,newState:s})}},view:o=>(this.sideMenuView=new Cz({view:o,...e}),this.sideMenuView)})}dragstart(e){Sz(e,this.options.editor)}dragend(e){vz(e,this.options.editor)}}const Tz=c.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(n,{expose:e,slots:t}){const o=c.ref(null),r=c.ref(),i=l=>{var a;(a=r.value)==null||a.dragstart(l)},s=l=>{var a;(a=r.value)==null||a.dragend(l)};return c.onMounted(()=>{const{pluginKey:l,editor:a,updateDelay:d,tippyOptions:u}=n;r.value=new Mz({updateDelay:d,editor:a,element:o.value,pluginKey:l,tippyOptions:u}),a.registerPlugin(r.value.plugin)}),c.onBeforeUnmount(()=>{const{pluginKey:l,editor:a}=n;a.unregisterPlugin(l)}),e({...n,dragstart:i,dragend:s}),()=>{var l;return c.h("div",{ref:o},(l=t.default)==null?void 0:l.call(t))}}}),Nz={key:0,class:"o-side-menu"},Az={class:"container"},Oz=c.defineComponent({__name:"OSideMenu",props:{editor:{type:St,required:!0},menuClass:{type:String,default:""},add:{type:String,default:"menu"},title:{type:Boolean,default:!1}},setup(n){const e=n,t=c.ref(null),o=c.ref(null),r=c.ref(0),i=c.computed(()=>({arrow:!1,duration:100,placement:"left"})),s=c.computed(()=>({editor:e.editor,node:o.value,decorations:[],selected:!1,extension:{},getPos:()=>r.value,pos:r.value,updateAttributes:a,deleteNode:l,view:{},innerDecorations:[],HTMLAttributes:{},add:e.add}));function l(){var m,g;const p=r.value,h=p+((m=o.value)==null?void 0:m.nodeSize);(g=e.editor)==null||g.commands.deleteRange({from:p,to:h})}function a(p){var h;(h=e.editor)==null||h.commands.command(({tr:m})=>{var g;return m.setNodeMarkup(r.value,void 0,{...(g=o.value)==null?void 0:g.attrs,...p}),!0})}function d({editor:p,transaction:h}){let m={left:0,top:0};const g=Zl.getState(e.editor.view.state);if(g){m=g.coords;const y=wz(m,p);y.node&&(e.title&&y.pos===0?o.value=null:(!e.title||y.pos>0)&&(o.value=y.node,r.value=y.pos))}}function u(p){var h;(h=t.value)==null||h.dragstart(p)}function f(p){var h;(h=t.value)==null||h.dragend(p)}return c.onMounted(()=>{var p;(p=e.editor)==null||p.on("transaction",d)}),(p,h)=>n.editor?(c.openBlock(),c.createElementBlock("section",Nz,[c.createVNode(c.unref(Tz),{ref_key:"menu",ref:t,class:c.normalizeClass(["side-menu",n.menuClass]),editor:n.editor,"tippy-options":i.value},{default:c.withCtx(()=>[c.createElementVNode("section",Az,[o.value?(c.openBlock(),c.createBlock(c.unref(Gx),c.normalizeProps(c.mergeProps({key:0},s.value)),null,16)):c.createCommentVNode("",!0),o.value?(c.openBlock(),c.createBlock(c.unref(Xx),c.mergeProps({key:1},s.value,{onDragstart:u,onDragend:f}),null,16)):c.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):c.createCommentVNode("",!0)}});var eu=(n,e)=>e.view.domAtPos(n).node.offsetParent!==null,$z=(n,e,t)=>{for(let o=n.depth;o>0;o-=1){const r=n.node(o),i=e(r),s=eu(n.start(o),t);if(i&&s)return{pos:o>0?n.before(o):0,start:n.start(o),depth:o,node:r}}},gC=(n,e)=>{const{state:t,view:o,extensionManager:r}=n,{schema:i,selection:s}=t,{empty:l,$anchor:a}=s,d=!!r.extensions.find(b=>b.name==="gapCursor");if(!l||a.parent.type!==i.nodes.detailsSummary||!d||e==="right"&&a.parentOffset!==a.parent.nodeSize-2)return!1;const u=Sr(b=>b.type===i.nodes.details)(s);if(!u)return!1;const f=zo(u.node,b=>b.type===i.nodes.detailsContent);if(!f.length||eu(u.start+f[0].pos+1,n))return!1;const h=t.doc.resolve(u.pos+u.node.nodeSize),m=tt.findFrom(h,1,!1);if(!m)return!1;const{tr:g}=t,y=new tt(m);return g.setSelection(y),g.scrollIntoView(),o.dispatch(g),!0},yC=Oe.create({name:"details",content:"detailsSummary detailsContent",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,addOptions(){return{persist:!1,openClassName:"is-open",HTMLAttributes:{}}},addAttributes(){return this.options.persist?{open:{default:!1,parseHTML:n=>n.hasAttribute("open"),renderHTML:({open:n})=>n?{open:""}:{}}}:[]},parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:n}){return["details",fe(this.options.HTMLAttributes,n),0]},...Sl({nodeName:"details",content:"block"}),addNodeView(){return({editor:n,getPos:e,node:t,HTMLAttributes:o})=>{const r=document.createElement("div"),i=fe(this.options.HTMLAttributes,o,{"data-type":this.name});Object.entries(i).forEach(([d,u])=>r.setAttribute(d,u));const s=document.createElement("button");s.type="button",r.append(s);const l=document.createElement("div");r.append(l);const a=d=>{if(d!==void 0)if(d){if(r.classList.contains(this.options.openClassName))return;r.classList.add(this.options.openClassName)}else{if(!r.classList.contains(this.options.openClassName))return;r.classList.remove(this.options.openClassName)}else r.classList.toggle(this.options.openClassName);const u=new Event("toggleDetailsContent"),f=l.querySelector(':scope > div[data-type="detailsContent"]');f==null||f.dispatchEvent(u)};return t.attrs.open&&setTimeout(()=>a()),s.addEventListener("click",()=>{if(a(),!this.options.persist){n.commands.focus(void 0,{scrollIntoView:!1});return}if(n.isEditable&&typeof e=="function"){const{from:d,to:u}=n.state.selection;n.chain().command(({tr:f})=>{const p=e();if(!p)return!1;const h=f.doc.nodeAt(p);return(h==null?void 0:h.type)!==this.type?!1:(f.setNodeMarkup(p,void 0,{open:!h.attrs.open}),!0)}).setTextSelection({from:d,to:u}).focus(void 0,{scrollIntoView:!1}).run()}}),{dom:r,contentDOM:l,ignoreMutation(d){return d.type==="selection"?!1:!r.contains(d.target)||r===d.target},update:d=>d.type!==this.type?!1:(d.attrs.open!==void 0&&a(d.attrs.open),!0)}}},addCommands(){return{setDetails:()=>({state:n,chain:e})=>{var t;const{schema:o,selection:r}=n,{$from:i,$to:s}=r,l=i.blockRange(s);if(!l)return!1;const a=n.doc.slice(l.start,l.end);if(!o.nodes.detailsContent.contentMatch.matchFragment(a.content))return!1;const u=((t=a.toJSON())==null?void 0:t.content)||[];return e().insertContentAt({from:l.start,to:l.end},{type:this.name,content:[{type:"detailsSummary"},{type:"detailsContent",content:u}]}).setTextSelection(l.start+2).run()},unsetDetails:()=>({state:n,chain:e})=>{const{selection:t,schema:o}=n,r=Sr(b=>b.type===this.type)(t);if(!r)return!1;const i=zo(r.node,b=>b.type===o.nodes.detailsSummary),s=zo(r.node,b=>b.type===o.nodes.detailsContent);if(!i.length||!s.length)return!1;const l=i[0],a=s[0],d=r.pos,u=n.doc.resolve(d),f=d+r.node.nodeSize,p={from:d,to:f},h=a.node.content.toJSON()||[],m=u.parent.type.contentMatch.defaultType,y=[m==null?void 0:m.create(null,l.node.content).toJSON(),...h];return e().insertContentAt(p,y).setTextSelection(d+1).run()}}},addKeyboardShortcuts(){return{Backspace:()=>{const{schema:n,selection:e}=this.editor.state,{empty:t,$anchor:o}=e;return!t||o.parent.type!==n.nodes.detailsSummary?!1:o.parentOffset!==0?this.editor.commands.command(({tr:r})=>{const i=o.pos-1,s=o.pos;return r.delete(i,s),!0}):this.editor.commands.unsetDetails()},Enter:({editor:n})=>{const{state:e,view:t}=n,{schema:o,selection:r}=e,{$head:i}=r;if(i.parent.type!==o.nodes.detailsSummary)return!1;const s=eu(i.after()+1,n),l=s?e.doc.nodeAt(i.after()):i.node(-2);if(!l)return!1;const a=s?0:i.indexAfter(-1),d=bc(l.contentMatchAt(a));if(!d||!l.canReplaceWith(a,a,d))return!1;const u=d.createAndFill();if(!u)return!1;const f=s?i.after()+1:i.after(-1),p=e.tr.replaceWith(f,f,u),h=p.doc.resolve(f),m=ie.near(h,1);return p.setSelection(m),p.scrollIntoView(),t.dispatch(p),!0},ArrowRight:({editor:n})=>gC(n,"right"),ArrowDown:({editor:n})=>gC(n,"down")}},addProseMirrorPlugins(){return[new ce({key:new le("detailsSelection"),appendTransaction:(n,e,t)=>{const{editor:o,type:r}=this;if(o.view.composing||!n.some(b=>b.selectionSet)||!e.selection.empty||!t.selection.empty||!Pp(t,r.name))return;const{$from:a}=t.selection;if(eu(a.pos,o))return;const u=$z(a,b=>b.type===r,o);if(!u)return;const f=zo(u.node,b=>b.type===t.schema.nodes.detailsSummary);if(!f.length)return;const p=f[0],m=(e.selection.from<t.selection.from?"forward":"backward")==="forward"?u.start+p.pos:u.pos+p.pos+p.node.nodeSize,g=q.create(t.doc,m);return t.tr.setSelection(g)}})]}}),bC=Oe.create({name:"detailsContent",content:"block+",defining:!0,selectable:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:n}){return["div",fe(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addNodeView(){return({HTMLAttributes:n})=>{const e=document.createElement("div"),t=fe(this.options.HTMLAttributes,n,{"data-type":this.name,hidden:"hidden"});return Object.entries(t).forEach(([o,r])=>e.setAttribute(o,r)),e.addEventListener("toggleDetailsContent",()=>{e.toggleAttribute("hidden")}),{dom:e,contentDOM:e,ignoreMutation(o){return o.type==="selection"?!1:!e.contains(o.target)||e===o.target},update:o=>o.type===this.type}}},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{state:e,view:t}=n,{selection:o}=e,{$from:r,empty:i}=o,s=Sr(O=>O.type===this.type)(o);if(!i||!s||!s.node.childCount)return!1;const l=r.index(s.depth),{childCount:a}=s.node;if(!(a===l+1))return!1;const u=s.node.type.contentMatch.defaultType,f=u==null?void 0:u.createAndFill();if(!f)return!1;const p=e.doc.resolve(s.pos+1),h=a-1,m=s.node.child(h),g=p.posAtIndex(h,s.depth);if(!m.eq(f))return!1;const b=r.node(-3);if(!b)return!1;const k=r.indexAfter(-3),x=bc(b.contentMatchAt(k));if(!x||!b.canReplaceWith(k,k,x))return!1;const w=x.createAndFill();if(!w)return!1;const{tr:C}=e,v=r.after(-2);C.replaceWith(v,v,w);const E=C.doc.resolve(v),T=ie.near(E,1);C.setSelection(T);const A=g,$=g+m.nodeSize;return C.delete(A,$),C.scrollIntoView(),t.dispatch(C),!0}}},...Sl({nodeName:"detailsContent"})}),kC=Oe.create({name:"detailsSummary",content:"text*",defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:n}){return["summary",fe(this.options.HTMLAttributes,n),0]},...Sl({nodeName:"detailsSummary",content:"inline"})}),tu=Oe.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const o=n.getAttribute("colwidth"),r=o?o.split(",").map(i=>parseInt(i,10)):null;if(!r){const i=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(s&&s>-1&&i&&i[s]){const l=i[s].getAttribute("width");return l?[parseInt(l,10)]:null}}return r}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",fe(this.options.HTMLAttributes,n),0]}}),nu=Oe.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",fe(this.options.HTMLAttributes,n),0]}}),ou=Oe.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",fe(this.options.HTMLAttributes,n),0]}});function vm(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function wC(n,e,t,o,r,i){var s;let l=0,a=!0,d=e.firstChild;const u=n.firstChild;if(u!==null)for(let p=0,h=0;p<u.childCount;p+=1){const{colspan:m,colwidth:g}=u.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],k=b?`${b}px`:"";if(l+=b||o,b||(a=!1),d){if(d.style.width!==k){const[x,w]=vm(o,b);d.style.setProperty(x,w)}d=d.nextSibling}else{const x=document.createElement("col"),[w,C]=vm(o,b);x.style.setProperty(w,C),e.appendChild(x)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)==null||s.removeChild(d),d=p}const f=n.attrs.style&&typeof n.attrs.style=="string"&&/\bwidth\s*:/i.test(n.attrs.style);a&&!f?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}var Bz=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),n.attrs.style&&(this.table.style.cssText=n.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),wC(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,wC(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(t&&!o&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function Rz(n,e,t,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let f=0,p=0;f<l.childCount;f+=1){const{colspan:h,colwidth:m}=l.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=t===p?o:m&&m[g];r+=y||e,y||(i=!1);const[b,k]=vm(e,y);s.push(["col",{style:`${b}: ${k}`}])}}const a=i?`${r}px`:"",d=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:d}}function xC(n,e){return n.createAndFill()}function Dz(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const o=n.nodes[t];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),n.cached.tableNodeTypes=e,e}function CC(n,e,t,o,r){const i=Dz(n),s=[],l=[];for(let d=0;d<t;d+=1){const u=xC(i.cell);if(u&&l.push(u),o){const f=xC(i.header_cell);f&&s.push(f)}}const a=[];for(let d=0;d<e;d+=1)a.push(i.row.createChecked(null,o&&d===0?s:l));return i.table.createChecked(null,a)}function _z(n){return n instanceof Pe}var ru=({editor:n})=>{const{selection:e}=n.state;if(!_z(e))return!1;let t=0;const o=kc(e.ranges[0].$from,i=>i.type.name==="table");return o==null||o.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},Iz="";function Lz(n){return(n||"").replace(/\s+/g," ").trim()}function Pz(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:Iz;if(!n||!n.content||n.content.length===0)return"";const i=[];n.content.forEach(m=>{const g=[];m.content&&m.content.forEach(y=>{let b="";y.content&&Array.isArray(y.content)&&y.content.length>1?b=y.content.map(C=>e.renderChildren(C)).join(r):b=y.content?e.renderChildren(y.content):"";const k=Lz(b),x=y.type==="tableHeader";g.push({text:k,isHeader:x})}),i.push(g)});const s=i.reduce((m,g)=>Math.max(m,g.length),0);if(s===0)return"";const l=new Array(s).fill(0);i.forEach(m=>{var g;for(let y=0;y<s;y+=1){const k=(((g=m[y])==null?void 0:g.text)||"").length;k>l[y]&&(l[y]=k),l[y]<3&&(l[y]=3)}});const a=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),d=i[0],u=d.some(m=>m.isHeader);let f=`
210
- `;const p=new Array(s).fill(0).map((m,g)=>u&&d[g]&&d[g].text||"");return f+=`| ${p.map((m,g)=>a(m,l[g])).join(" | ")} |
211
- `,f+=`| ${l.map(m=>"-".repeat(Math.max(3,m))).join(" | ")} |
212
- `,(u?i.slice(1):i).forEach(m=>{f+=`| ${new Array(s).fill(0).map((g,y)=>a(m[y]&&m[y].text||"",l[y])).join(" | ")} |
213
- `}),f}var Vz=Pz,iu=Oe.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Bz,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:o,tableMinWidth:r}=Rz(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",fe(this.options.HTMLAttributes,e,{style:s()}),t,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(n,e)=>{const t=[];if(n.header){const o=[];n.header.forEach(r=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),t.push(e.createNode("tableRow",{},o))}return n.rows&&n.rows.forEach(o=>{const r=[];o.forEach(i=>{r.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}),e.createNode("table",void 0,t)},renderMarkdown:(n,e)=>Vz(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=CC(i.schema,n,e,t);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(q.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>EI(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>MI(n,e),deleteColumn:()=>({state:n,dispatch:e})=>NI(n,e),addRowBefore:()=>({state:n,dispatch:e})=>OI(n,e),addRowAfter:()=>({state:n,dispatch:e})=>$I(n,e),deleteRow:()=>({state:n,dispatch:e})=>RI(n,e),deleteTable:()=>({state:n,dispatch:e})=>zI(n,e),mergeCells:()=>({state:n,dispatch:e})=>K1(n,e),splitCell:()=>({state:n,dispatch:e})=>J1(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Wl("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Wl("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>PI(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>K1(n,e)?!0:J1(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>II(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>X1(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>X1(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&j1(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const o=Pe.create(e.doc,n.anchorCell,n.headCell);e.setSelection(o)}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:ru,"Mod-Backspace":ru,Delete:ru,"Mod-Delete":ru}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[XI({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],sL({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Re(ne(n,"tableRole",e))}}});me.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(iu.configure(this.options.table)),this.options.tableCell!==!1&&n.push(tu.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(nu.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(ou.configure(this.options.tableRow)),n}});var zz=20,SC=(n,e=0)=>{const t=[];return!n.children.length||e>zz||Array.from(n.children).forEach(o=>{o.tagName==="SPAN"?t.push(o):o.children.length&&t.push(...SC(o,e+1))}),t},Hz=n=>{if(!n.children.length)return;const e=SC(n);e&&e.forEach(t=>{var o,r;const i=t.getAttribute("style"),s=(r=(o=t.parentElement)==null?void 0:o.closest("span"))==null?void 0:r.getAttribute("style");t.setAttribute("style",`${s};${i}`)})},Em=In.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Hz(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,o)=>{if(t.isTextblock)return!0;t.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(i=>!!i))||n.removeMark(o,o+t.nodeSize,this.type)}),!0}}}}),Mm=me.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const o=t.split(";").map(r=>r.trim()).filter(Boolean);for(let r=o.length-1;r>=0;r-=1){const i=o[r].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="background-color")return l.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),Tm=me.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const o=t.split(";").map(r=>r.trim()).filter(Boolean);for(let r=o.length-1;r>=0;r-=1){const i=o[r].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="color")return l.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),Nm=me.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Fz=me.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),jz=me.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});me.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(Mm.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(Tm.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(Nm.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(Fz.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(jz.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(Em.configure(this.options.textStyle)),n}});const Mi=Math.floor,Uz=Math.abs,Dr=(n,e)=>n<e?n:e,Cs=(n,e)=>n>e?n:e,Wz=n=>n!==0?n<0:1/n<0,qz=64,ea=128,Kz=1<<29,vC=63,ta=127,Jz=2147483647,EC=Number.MAX_SAFE_INTEGER,MC=Number.MIN_SAFE_INTEGER,Gz=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&Mi(n)===n),Xz=()=>new Set,Am=(n,e)=>{for(let t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0},TC=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},Yz=(n,e)=>{const t=new Array(n);for(let o=0;o<n;o++)t[o]=e(o,t);return t},su=Array.isArray,NC=String.fromCharCode,Qz=n=>n.toLowerCase(),Zz=/^\s*/g,eH=n=>n.replace(Zz,""),tH=/([A-Z])/g,AC=(n,e)=>eH(n.replace(tH,t=>`${e}${Qz(t)}`)),nH=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,o=new Uint8Array(t);for(let r=0;r<t;r++)o[r]=e.codePointAt(r);return o},na=typeof TextEncoder<"u"?new TextEncoder:null,oH=na?n=>na.encode(n):nH;let Om=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Om&&Om.decode(new Uint8Array).length===1&&(Om=null);const rH=(n,e)=>Yz(e,()=>n).join("");class iH{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const sH=()=>new iH,lH=n=>{const e=sH();return n(e),cH(e)},aH=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},cH=n=>{const e=new Uint8Array(aH(n));let t=0;for(let o=0;o<n.bufs.length;o++){const r=n.bufs[o];e.set(r,t),t+=r.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},dH=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(Cs(t,e)*2),n.cpos=0)},It=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},oa=(n,e)=>{for(;e>ta;)It(n,ea|ta&e),e=Mi(e/128);It(n,ta&e)},uH=(n,e)=>{const t=Wz(e);for(t&&(e=-e),It(n,(e>vC?ea:0)|(t?qz:0)|vC&e),e=Mi(e/64);e>0;)It(n,(e>ta?ea:0)|ta&e),e=Mi(e/128)},$m=new Uint8Array(3e4),fH=$m.length/3,pH=(n,e)=>{if(e.length<fH){const t=na.encodeInto(e,$m).written||0;oa(n,t);for(let o=0;o<t;o++)It(n,$m[o])}else $C(n,oH(e))},hH=(n,e)=>{const t=unescape(encodeURIComponent(e)),o=t.length;oa(n,o);for(let r=0;r<o;r++)It(n,t.codePointAt(r))},OC=na&&na.encodeInto?pH:hH,mH=(n,e)=>{const t=n.cbuf.length,o=n.cpos,r=Dr(t-o,e.length),i=e.length-r;n.cbuf.set(e.subarray(0,r),o),n.cpos+=r,i>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(Cs(t*2,i)),n.cbuf.set(e.subarray(r)),n.cpos=i)},$C=(n,e)=>{oa(n,e.byteLength),mH(n,e)},Bm=(n,e)=>{dH(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},gH=(n,e)=>Bm(n,4).setFloat32(0,e,!1),yH=(n,e)=>Bm(n,8).setFloat64(0,e,!1),bH=(n,e)=>Bm(n,8).setBigInt64(0,e,!1),BC=new DataView(new ArrayBuffer(4)),kH=n=>(BC.setFloat32(0,n),BC.getFloat32(0)===n),Rm=(n,e)=>{switch(typeof e){case"string":It(n,119),OC(n,e);break;case"number":Gz(e)&&Uz(e)<=Jz?(It(n,125),uH(n,e)):kH(e)?(It(n,124),gH(n,e)):(It(n,123),yH(n,e));break;case"bigint":It(n,122),bH(n,e);break;case"object":if(e===null)It(n,126);else if(su(e)){It(n,117),oa(n,e.length);for(let t=0;t<e.length;t++)Rm(n,e[t])}else if(e instanceof Uint8Array)It(n,116),$C(n,e);else{It(n,118);const t=Object.keys(e);oa(n,t.length);for(let o=0;o<t.length;o++){const r=t[o];OC(n,r),Rm(n,e[r])}}break;case"boolean":It(n,e?120:121);break;default:It(n,127)}},lu=n=>new Error(n),RC=()=>{throw lu("Method unimplemented")},ra=()=>{throw lu("Unexpected case")},au=()=>new Map,DC=(n,e,t)=>{let o=n.get(e);return o===void 0&&n.set(e,o=t()),o},ia=Symbol("Equality"),wH=(n,e)=>{var t;return n===e||!!((t=n==null?void 0:n[ia])!=null&&t.call(n,e))||!1},xH=n=>typeof n=="object",_C=Object.keys,IC=n=>_C(n).length,sa=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},LC=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),cu=(n,e)=>{if(n===e)return!0;if(n==null||e==null||n.constructor!==e.constructor&&(n.constructor||Object)!==(e.constructor||Object))return!1;if(n[ia]!=null)return n[ia](e);switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!cu(n.get(t),e.get(t)))return!1;break}case void 0:case Object:if(IC(n)!==IC(e))return!1;for(const t in n)if(!LC(n,t)||!cu(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!cu(n[t],e[t]))return!1;break;default:return!1}return!0},CH=(n,e)=>e.includes(n),SH=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},vH=/[\uD800-\uDBFF]/,EH=/[\uDC00-\uDFFF]/,MH=(n,e)=>{let t=0,o=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t++;for(t>0&&vH.test(n[t-1])&&t--;o+t<n.length&&o+t<e.length&&n[n.length-o-1]===e[e.length-o-1];)o++;return o>0&&EH.test(n[n.length-o])&&o--,{index:t,remove:n.length-t-o,insert:e.slice(t,e.length-o)}},TH=Math.random,NH=n=>n[Mi(TH()*n.length)],PC=n=>n===void 0?null:n;class AH{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let VC=new AH,OH=!0;try{typeof localStorage<"u"&&localStorage&&(VC=localStorage,OH=!1)}catch{}const $H=VC,Ss=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",zC=typeof window<"u"&&typeof document<"u"&&!Ss;let Eo;const BH=()=>{if(Eo===void 0)if(Ss){Eo=au();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const o=n[t];o[0]==="-"?(e!==null&&Eo.set(e,""),e=o):e!==null&&(Eo.set(e,o),e=null)}e!==null&&Eo.set(e,"")}else typeof location=="object"?(Eo=au(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");Eo.set(`--${AC(e,"-")}`,t),Eo.set(`-${AC(e,"-")}`,t)}})):Eo=au();return Eo},Dm=n=>BH().has(n),_m=n=>PC(Ss?process.env[n.toUpperCase().replaceAll("-","_")]:$H.getItem(n)),HC=n=>Dm("--"+n)||_m(n)!==null,RH=HC("production");Ss&&CH(process.env.FORCE_COLOR,["true","1","2"])||!Dm("--no-colors")&&!HC("no-color")&&(!Ss||process.stdout.isTTY)&&(!Ss||Dm("--color")||_m("COLORTERM")!==null||(_m("TERM")||"").includes("color"));const DH=zC?n=>{let e="";for(let t=0;t<n.byteLength;t++)e+=NC(n[t]);return btoa(e)}:n=>Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),_H=n=>lH(e=>Rm(e,n)),FC=n=>n.next()>=.5,Im=(n,e,t)=>Mi(n.next()*(t+1-e)+e),jC=(n,e,t)=>Mi(n.next()*(t+1-e)+e),Lm=(n,e,t)=>jC(n,e,t),IH=n=>NC(Lm(n,97,122)),LH=(n,e=0,t=20)=>{const o=Lm(n,e,t);let r="";for(let i=0;i<o;i++)r+=IH(n);return r},Pm=(n,e)=>e[Lm(n,0,e.length-1)],PH=Symbol("0schema");class VH{constructor(){this._rerrs=[]}extend(e,t,o,r=null){this._rerrs.push({path:e,expected:t,has:o,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const o=this._rerrs[t];e.push(rH(" ",(this._rerrs.length-t)*2)+`${o.path!=null?`[${o.path}] `:""}${o.has} doesn't match ${o.expected}. ${o.message}`)}return e.join(`
214
- `)}}const Vm=(n,e)=>n===e?!0:n==null||e==null||n.constructor!==e.constructor?!1:n[ia]?wH(n,e):su(n)?Am(n,t=>TC(e,o=>Vm(t,o))):xH(n)?sa(n,(t,o)=>Vm(t,e[o])):!1;class Kt{extends(e){let[t,o]=[this.shape,e.shape];return this.constructor._dilutes&&([o,t]=[t,o]),Vm(t,o)}equals(e){return this.constructor===e.constructor&&cu(this.shape,e.shape)}[PH](){return!0}[ia](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){RC()}get nullable(){return vs(this,yu)}get optional(){return new qC(this)}cast(e){return rS(e,this),e}expect(e){return rS(e,this),e}}qe(Kt,"_dilutes",!1);class zm extends Kt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const o=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!o&&(t==null||t.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),o}}const ht=(n,e=null)=>new zm(n,e);ht(zm);class Hm extends Kt{constructor(e){super(),this.shape=e}check(e,t){const o=this.shape(e);return!o&&(t==null||t.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),o}}const Mt=n=>new Hm(n);ht(Hm);class du extends Kt{constructor(e){super(),this.shape=e}check(e,t){const o=this.shape.some(r=>r===e);return!o&&(t==null||t.extend(null,this.shape.join(" | "),e.toString())),o}}const uu=(...n)=>new du(n),UC=ht(du),zH=RegExp.escape||(n=>n.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),WC=n=>{if(Ms.check(n))return[zH(n)];if(UC.check(n))return n.shape.map(e=>e+"");if(tS.check(n))return["[+-]?\\d+.?\\d*"];if(nS.check(n))return[".*"];if(hu.check(n))return n.shape.map(WC).flat(1);ra()};class HH extends Kt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(WC).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const o=this._r.exec(e)!=null;return!o&&(t==null||t.extend(null,this._r.toString(),e.toString(),"String doesn't match string template.")),o}}ht(HH);const FH=Symbol("optional");class qC extends Kt{constructor(e){super(),this.shape=e}check(e,t){const o=e===void 0||this.shape.check(e);return!o&&(t==null||t.extend(null,"undefined (optional)","()")),o}get[FH](){return!0}}const jH=ht(qC);class UH extends Kt{check(e,t){return t==null||t.extend(null,"never",typeof e),!1}}ht(UH);const gf=class gf extends Kt{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}get partial(){return new gf(this.shape,!0)}check(e,t){return e==null?(t==null||t.extend(null,"object","null"),!1):sa(this.shape,(o,r)=>{const i=this._isPartial&&!LC(e,r)||o.check(e[r],t);return!i&&(t==null||t.extend(r.toString(),o.toString(),typeof e[r],"Object property does not match")),i})}};qe(gf,"_dilutes",!0);let fu=gf;const WH=n=>new fu(n),qH=ht(fu),KH=Mt(n=>n!=null&&(n.constructor===Object||n.constructor==null));class KC extends Kt{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&sa(e,(o,r)=>{const i=this.shape.keys.check(r,t);return!i&&(t==null||t.extend(r+"","Record",typeof e,i?"Key doesn't match schema":"Value doesn't match value")),i&&this.shape.values.check(o,t)})}}const JC=(n,e)=>new KC(n,e),JH=ht(KC);class GC extends Kt{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&sa(this.shape,(o,r)=>{const i=o.check(e[r],t);return!i&&(t==null||t.extend(r.toString(),"Tuple",typeof o)),i})}}const GH=(...n)=>new GC(n);ht(GC);class XC extends Kt{constructor(e){super(),this.shape=e.length===1?e[0]:new pu(e)}check(e,t){const o=su(e)&&Am(e,r=>this.shape.check(r));return!o&&(t==null||t.extend(null,"Array","")),o}}const YC=(...n)=>new XC(n),XH=ht(XC),YH=Mt(n=>su(n));class QC extends Kt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const o=e instanceof this.shape&&(this._c==null||this._c(e));return!o&&(t==null||t.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),o}}const QH=(n,e=null)=>new QC(n,e);ht(QC);const ZH=QH(Kt);class eF extends Kt{constructor(e){super(),this.len=e.length-1,this.args=GH(...e.slice(-1)),this.res=e[this.len]}check(e,t){const o=e.constructor===Function&&e.length<=this.len;return!o&&(t==null||t.extend(null,"function",typeof e)),o}}const tF=ht(eF),nF=Mt(n=>typeof n=="function");class oF extends Kt{constructor(e){super(),this.shape=e}check(e,t){const o=Am(this.shape,r=>r.check(e,t));return!o&&(t==null||t.extend(null,"Intersectinon",typeof e)),o}}ht(oF,n=>n.shape.length>0);class pu extends Kt{constructor(e){super(),this.shape=e}check(e,t){const o=TC(this.shape,r=>r.check(e,t));return t==null||t.extend(null,"Union",typeof e),o}}qe(pu,"_dilutes",!0);const vs=(...n)=>n.findIndex(e=>hu.check(e))>=0?vs(...n.map(e=>la(e)).map(e=>hu.check(e)?e.shape:[e]).flat(1)):n.length===1?n[0]:new pu(n),hu=ht(pu),ZC=()=>!0,mu=Mt(ZC),rF=ht(Hm,n=>n.shape===ZC),Fm=Mt(n=>typeof n=="bigint"),iF=Mt(n=>n===Fm),eS=Mt(n=>typeof n=="symbol");Mt(n=>n===eS);const Es=Mt(n=>typeof n=="number"),tS=Mt(n=>n===Es),Ms=Mt(n=>typeof n=="string"),nS=Mt(n=>n===Ms),gu=Mt(n=>typeof n=="boolean"),sF=Mt(n=>n===gu),oS=uu(void 0);ht(du,n=>n.shape.length===1&&n.shape[0]===void 0),uu(void 0);const yu=uu(null),lF=ht(du,n=>n.shape.length===1&&n.shape[0]===null);ht(Uint8Array),ht(zm,n=>n.shape===Uint8Array);const aF=vs(Es,Ms,yu,oS,Fm,gu,eS);(()=>{const n=YC(mu),e=JC(Ms,mu),t=vs(Es,Ms,yu,gu,n,e);return n.shape=t,e.shape.values=t,t})();const la=n=>{if(ZH.check(n))return n;if(KH.check(n)){const e={};for(const t in n)e[t]=la(n[t]);return WH(e)}else{if(YH.check(n))return vs(...n.map(la));if(aF.check(n))return uu(n);if(nF.check(n))return ht(n)}ra()},rS=RH?()=>{}:(n,e)=>{const t=new VH;if(!e.check(n,t))throw lu(`Expected value to be of type ${e.constructor.name}.
215
- ${t.toString()}`)};class cF{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:la(e),h:t}),this}else(e){return this.if(mu,e)}done(){return(e,t)=>{for(let o=0;o<this.patterns.length;o++){const r=this.patterns[o];if(r.if.check(e))return r.h(e,t)}throw lu("Unhandled pattern")}}}const iS=(n=>new cF(n))(mu).if(tS,(n,e)=>Im(e,MC,EC)).if(nS,(n,e)=>LH(e)).if(sF,(n,e)=>FC(e)).if(iF,(n,e)=>BigInt(Im(e,MC,EC))).if(hu,(n,e)=>Ts(e,Pm(e,n.shape))).if(qH,(n,e)=>{const t={};for(const o in n.shape){let r=n.shape[o];if(jH.check(r)){if(FC(e))continue;r=r.shape}t[o]=iS(r,e)}return t}).if(XH,(n,e)=>{const t=[],o=jC(e,0,42);for(let r=0;r<o;r++)t.push(Ts(e,n.shape));return t}).if(UC,(n,e)=>Pm(e,n.shape)).if(lF,(n,e)=>null).if(tF,(n,e)=>{const t=Ts(e,n.res);return()=>t}).if(rF,(n,e)=>Ts(e,Pm(e,[Es,Ms,yu,oS,Fm,gu,YC(Es),JC(vs("a","b","c"),Es)]))).if(JH,(n,e)=>{const t={},o=Im(e,0,3);for(let r=0;r<o;r++){const i=Ts(e,n.shape.keys),s=Ts(e,n.shape.values);t[i]=s}return t}).done(),Ts=(n,e)=>iS(la(e),n),aa=typeof document<"u"?document:{};Mt(n=>n.nodeType===pF),typeof DOMParser<"u"&&new DOMParser,Mt(n=>n.nodeType===dF),Mt(n=>n.nodeType===uF);const dF=aa.ELEMENT_NODE,uF=aa.TEXT_NODE,fF=aa.DOCUMENT_NODE,pF=aa.DOCUMENT_FRAGMENT_NODE;Mt(n=>n.nodeType===fF);const hF=(n=>class{constructor(t){this._=t}destroy(){n(this._)}})(clearTimeout),jm=(n,e)=>new hF(setTimeout(e,n)),Mo=(n,e)=>n>>>e|n<<32-e,mF=n=>Mo(n,2)^Mo(n,13)^Mo(n,22),gF=n=>Mo(n,6)^Mo(n,11)^Mo(n,25),yF=n=>Mo(n,7)^Mo(n,18)^n>>>3,bF=n=>Mo(n,17)^Mo(n,19)^n>>>10,kF=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wF=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class xF{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(wF),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,t=this._W;for(let f=16;f<64;f++)t[f]=bF(t[f-2])+t[f-7]+yF(t[f-15])+t[f-16];let o=e[0],r=e[1],i=e[2],s=e[3],l=e[4],a=e[5],d=e[6],u=e[7];for(let f=0,p,h;f<64;f++)p=u+gF(l)+(l&a^~l&d)+kF[f]+t[f]>>>0,h=mF(o)+(o&r^o&i^r&i)>>>0,u=d,d=a,a=l,l=s+p>>>0,s=i,i=r,r=o,o=p+h>>>0;e[0]+=o,e[1]+=r,e[2]+=i,e[3]+=s,e[4]+=l,e[5]+=a,e[6]+=d,e[7]+=u}digest(e){let t=0;for(;t+56<=e.length;){let s=0;for(;s<16&&t+3<e.length;s++)this._W[s]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!==0){for(this._W.fill(0,s,16);t<e.length;)this._W[s]|=e[t]<<(3-t%4)*8,t++;this._W[s]|=ea<<(3-t%4)*8}this._updateHash()}const o=t%64!==0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let s=3;s>=0&&t<e.length;s--)this._W[r]|=e[t++]<<s*8;o||(this._W[r-(t%4===0?0:1)]|=ea<<(3-t%4)*8),this._W[14]=e.byteLength/Kz,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let l=0;l<4;l++)i[s*4+l]=this._H[s]>>>(3-l)*8;return i}}const CF=n=>new xF().digest(n),Je=new le("y-sync"),Zo=new le("y-undo"),bu=new le("yjs-cursor"),SF=n=>{for(let t=6;t<n.length;t++)n[t%6]=n[t%6]^n[t];return n.slice(0,6)},vF=n=>DH(SF(CF(_H(n)))),ku=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!re.isDeleted(e.ds,n.id),EF=[{light:"#ecd44433",dark:"#ecd444"}],MF=(n,e,t)=>{if(!n.has(t)){if(n.size<e.length){const o=Xz();n.forEach(r=>o.add(r)),e=e.filter(r=>!o.has(r))}n.set(t,NH(e))}return n.get(t)},TF=(n,{colors:e=EF,colorMapping:t=new Map,permanentUserData:o=null,onFirstRender:r=()=>{},mapping:i}={})=>{let s=!1;const l=new OF(n,i),a=new ce({props:{editable:d=>{const u=Je.getState(d);return u.snapshot==null&&u.prevSnapshot==null}},key:Je,state:{init:(d,u)=>({type:n,doc:n.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:t,permanentUserData:o}),apply:(d,u)=>{const f=d.getMeta(Je);if(f!==void 0){u=Object.assign({},u);for(const p in f)u[p]=f[p]}return u.addToHistory=d.getMeta("addToHistory")!==!1,u.isChangeOrigin=f!==void 0&&!!f.isChangeOrigin,u.isUndoRedoOperation=f!==void 0&&!!f.isChangeOrigin&&!!f.isUndoRedoOperation,l.prosemirrorView!==null&&f!==void 0&&(f.snapshot!=null||f.prevSnapshot!=null)&&jm(0,()=>{l.prosemirrorView!=null&&(f.restore==null?l._renderSnapshot(f.snapshot,f.prevSnapshot,u):(l._renderSnapshot(f.snapshot,f.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),u}},view:d=>(l.initView(d),i==null&&l._forceRerender(),r(),{update:()=>{const u=a.getState(d.state);if(u.snapshot==null&&u.prevSnapshot==null&&(s||d.state.doc.content.findDiffStart(d.state.doc.type.createAndFill().content)!==null)){if(s=!0,u.addToHistory===!1&&!u.isChangeOrigin){const f=Zo.getState(d.state),p=f&&f.undoManager;p&&p.stopCapturing()}l.mux(()=>{u.doc.transact(f=>{f.meta.set("addToHistory",u.addToHistory),l._prosemirrorChanged(d.state.doc)},Je)})}},destroy:()=>{l.destroy()}})});return a},NF=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")n.setSelection(new tn(n.doc));else if(e.type==="node"){const o=Ti(t.doc,t.type,e.anchor,t.mapping);n.setSelection(AF(n,o))}else{const o=Ti(t.doc,t.type,e.anchor,t.mapping),r=Ti(t.doc,t.type,e.head,t.mapping);o!==null&&r!==null&&n.setSelection(q.between(n.doc.resolve(o),n.doc.resolve(r)))}},AF=(n,e)=>{const t=n.doc.resolve(e);return t.nodeAfter?Q.create(n.doc,e):q.near(t)},Um=(n,e)=>({type:e.selection.jsonID,anchor:ua(e.selection.anchor,n.type,n.mapping),head:ua(e.selection.head,n.type,n.mapping)});class OF{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=SH(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Um(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(zC&&this._domSelectionInView===null&&(jm(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);const r=t.getBoundingClientRect(),i=aa.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||i.clientWidth||0)&&r.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(e,t){t||(t=re.createSnapshot(re.createDeleteSet(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Je,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(o=>wu(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new j(L.from(e),0,0));t.setMeta(Je,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,t=this.type.toArray().map(r=>wu(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new j(L.from(t),0,0));if(e){const r=Dr(Cs(e.anchor,0),o.doc.content.size),i=Dr(Cs(e.head,0),o.doc.content.size);o.setSelection(q.create(o.doc,r,i))}this.prosemirrorView.dispatch(o.setMeta(Je,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,o){let r=this.doc,i=this.type;if(e||(e=re.snapshot(this.doc)),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&ra(),r=new re.Doc({gc:!1}),re.applyUpdateV2(r,t),t=re.snapshot(r),re.applyUpdateV2(r,e),e=re.snapshot(r),i._item===null){const s=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);i=r.getXmlFragment(s)}else{const s=r.store.clients.get(i._item.id.client)??[],l=re.findIndexSS(s,i._item.id.clock);i=s[l].content.type}this.mapping.clear(),this.mux(()=>{r.transact(s=>{const l=o.permanentUserData;l&&l.dss.forEach(f=>{re.iterateDeletedStructs(s,f,p=>{})});const a=(f,p)=>{const h=f==="added"?l.getUserByClientId(p.client):l.getUserByDeletedId(p);return{user:h,type:f,color:MF(o.colorMapping,o.colors,h)}},d=re.typeListToArraySnapshot(i,new re.Snapshot(t.ds,e.sv)).map(f=>!f._item.deleted||ku(f._item,e)||ku(f._item,t)?wu(f,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,a):null).filter(f=>f!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new j(L.from(d),0,0));this.prosemirrorView.dispatch(u.setMeta(Je,{isChangeOrigin:!0}))},Je)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;const o=Je.getState(this.prosemirrorView.state);if(e.length===0||o.snapshot!=null||o.prevSnapshot!=null){this.renderSnapshot(o.snapshot,o.prevSnapshot);return}this.mux(()=>{const r=(l,a)=>this.mapping.delete(a);re.iterateDeletedStructs(t,t.deleteSet,l=>{if(l.constructor===re.Item){const a=l.content.type;a&&this.mapping.delete(a)}}),t.changed.forEach(r),t.changedParentTypes.forEach(r);const i=this.type.toArray().map(l=>sS(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new j(L.from(i),0,0));NF(s,this.beforeTransactionSelection,this),s=s.setMeta(Je,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof re.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{Jm(this.doc,this.type,e,this),this.beforeTransactionSelection=Um(this,this.prosemirrorView.state)},Je)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const sS=(n,e,t,o,r,i)=>{const s=t.mapping.get(n);if(s===void 0){if(n instanceof re.XmlElement)return wu(n,e,t,o,r,i);throw RC()}return s},wu=(n,e,t,o,r,i)=>{const s=[],l=a=>{var d,u;if(a instanceof re.XmlElement){const f=sS(a,e,t,o,r,i);f!==null&&s.push(f)}else{const f=(u=(d=a._item.right)==null?void 0:d.content)==null?void 0:u.type;f instanceof re.Text&&!f._item.deleted&&f._item.id.client===f.doc.clientID&&(a.applyDelta([{retain:a.length},...f.toDelta()]),f.doc.transact(h=>{f._item.delete(h)}));const p=$F(a,e,t,o,r,i);p!==null&&p.forEach(h=>{h!==null&&s.push(h)})}};o===void 0||r===void 0?n.toArray().forEach(l):re.typeListToArraySnapshot(n,new re.Snapshot(r.ds,o.sv)).forEach(l);try{const a=n.getAttributes(o);o!==void 0&&(ku(n._item,o)?ku(n._item,r)||(a.ychange=i?i("added",n._item.id):{type:"added"}):a.ychange=i?i("removed",n._item.id):{type:"removed"});const d=e.node(n.nodeName,a,s);return t.mapping.set(n,d),d}catch{return n.doc.transact(d=>{n._item.delete(d)},Je),t.mapping.delete(n),null}},$F=(n,e,t,o,r,i)=>{const s=[],l=n.toDelta(o,r,i);try{for(let a=0;a<l.length;a++){const d=l[a];s.push(e.text(d.insert,LF(d.attributes,e)))}}catch{return n.doc.transact(d=>{n._item.delete(d)},Je),null}return s},BF=(n,e)=>{const t=new re.XmlText,o=n.map(r=>({insert:r.text,attributes:dS(r.marks,e)}));return t.applyDelta(o),e.mapping.set(t,n),t},RF=(n,e)=>{const t=new re.XmlElement(n.type.name);for(const o in n.attrs){const r=n.attrs[o];r!==null&&o!=="ychange"&&t.setAttribute(o,r)}return t.insert(0,xu(n).map(o=>Wm(o,e))),e.mapping.set(t,n),t},Wm=(n,e)=>n instanceof Array?BF(n,e):RF(n,e),lS=n=>typeof n=="object"&&n!==null,qm=(n,e)=>{const t=Object.keys(n).filter(r=>n[r]!==null);let o=t.length===Object.keys(e).filter(r=>e[r]!==null).length;for(let r=0;r<t.length&&o;r++){const i=t[r],s=n[i],l=e[i];o=i==="ychange"||s===l||lS(s)&&lS(l)&&qm(s,l)}return o},xu=n=>{const e=n.content.content,t=[];for(let o=0;o<e.length;o++){const r=e[o];if(r.isText){const i=[];for(let s=e[o];o<e.length&&s.isText;s=e[++o])i.push(s);o--,t.push(i)}else t.push(r)}return t},aS=(n,e)=>{const t=n.toDelta();return t.length===e.length&&t.every((o,r)=>o.insert===e[r].text&&_C(o.attributes||{}).length===e[r].marks.length&&sa(o.attributes,(i,s)=>{var u;const l=Km(s),a=e[r].marks;return a.find(f=>f.type.name===l)?qm(i,(u=a.find(f=>f.type.name===l))==null?void 0:u.attrs):!1}))},ca=(n,e)=>{if(n instanceof re.XmlElement&&!(e instanceof Array)&&Gm(n,e)){const t=xu(e);return n._length===t.length&&qm(n.getAttributes(),e.attrs)&&n.toArray().every((o,r)=>ca(o,t[r]))}return n instanceof re.XmlText&&e instanceof Array&&aS(n,e)},Cu=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,o)=>e[o]===t),cS=(n,e,t)=>{const o=n.toArray(),r=xu(e),i=r.length,s=o.length,l=Dr(s,i);let a=0,d=0,u=!1;for(;a<l;a++){const f=o[a],p=r[a];if(Cu(t.mapping.get(f),p))u=!0;else if(!ca(f,p))break}for(;a+d<l;d++){const f=o[s-d-1],p=r[i-d-1];if(Cu(t.mapping.get(f),p))u=!0;else if(!ca(f,p))break}return{equalityFactor:a+d,foundMappedChild:u}},DF=n=>{let e="",t=n._start;const o={};for(;t!==null;)t.deleted||(t.countable&&t.content instanceof re.ContentString?e+=t.content.str:t.content instanceof re.ContentFormat&&(o[t.content.key]=null)),t=t.right;return{str:e,nAttrs:o}},_F=(n,e,t)=>{t.mapping.set(n,e);const{nAttrs:o,str:r}=DF(n),i=e.map(d=>({insert:d.text,attributes:Object.assign({},o,dS(d.marks,t))})),{insert:s,remove:l,index:a}=MH(r,i.map(d=>d.insert).join(""));n.delete(a,l),n.insert(a,s),n.applyDelta(i.map(d=>({retain:d.insert.length,attributes:d.attributes})))},IF=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Km=n=>{var e;return((e=IF.exec(n))==null?void 0:e[1])??n},LF=(n,e)=>{const t=[];for(const o in n)t.push(e.mark(Km(o),n[o]));return t},dS=(n,e)=>{const t={};return n.forEach(o=>{if(o.type.name!=="ychange"){const r=DC(e.isOMark,o.type,()=>!o.type.excludes(o.type));t[r?`${o.type.name}--${vF(o.toJSON())}`:o.type.name]=o.attrs}}),t},Jm=(n,e,t,o)=>{if(e instanceof re.XmlElement&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(o.mapping.set(e,t),e instanceof re.XmlElement){const f=e.getAttributes(),p=t.attrs;for(const h in p)p[h]!==null?f[h]!==p[h]&&h!=="ychange"&&e.setAttribute(h,p[h]):e.removeAttribute(h);for(const h in f)p[h]===void 0&&e.removeAttribute(h)}const r=xu(t),i=r.length,s=e.toArray(),l=s.length,a=Dr(i,l);let d=0,u=0;for(;d<a;d++){const f=s[d],p=r[d];if(!Cu(o.mapping.get(f),p))if(ca(f,p))o.mapping.set(f,p);else break}for(;u+d+1<a;u++){const f=s[l-u-1],p=r[i-u-1];if(!Cu(o.mapping.get(f),p))if(ca(f,p))o.mapping.set(f,p);else break}n.transact(()=>{for(;l-d-u>0&&i-d-u>0;){const p=s[d],h=r[d],m=s[l-u-1],g=r[i-u-1];if(p instanceof re.XmlText&&h instanceof Array)aS(p,h)||_F(p,h,o),d+=1;else{let y=p instanceof re.XmlElement&&Gm(p,h),b=m instanceof re.XmlElement&&Gm(m,g);if(y&&b){const k=cS(p,h,o),x=cS(m,g,o);k.foundMappedChild&&!x.foundMappedChild?b=!1:!k.foundMappedChild&&x.foundMappedChild||k.equalityFactor<x.equalityFactor?y=!1:b=!1}y?(Jm(n,p,h,o),d+=1):b?(Jm(n,m,g,o),u+=1):(o.mapping.delete(e.get(d)),e.delete(d,1),e.insert(d,[Wm(h,o)]),d+=1)}}const f=l-d-u;if(l===1&&i===0&&s[0]instanceof re.XmlText?(o.mapping.delete(s[0]),s[0].delete(0,s[0].length)):f>0&&(e.slice(d,d+f).forEach(p=>o.mapping.delete(p)),e.delete(d,f)),d+u<i){const p=[];for(let h=d;h<i-u;h++)p.push(Wm(r[h],o));e.insert(d,p)}},Je)},Gm=(n,e)=>!(e instanceof Array)&&n.nodeName===e.type.name;let da=null;const PF=()=>{const n=da;da=null,n.forEach((e,t)=>{const o=t.state.tr,r=Je.getState(t.state);r&&r.binding&&!r.binding.isDestroyed&&(e.forEach((i,s)=>{o.setMeta(s,i)}),t.dispatch(o))})},VF=(n,e,t)=>{da||(da=new Map,jm(0,PF)),DC(da,n,au).set(e,t)},ua=(n,e,t)=>{if(n===0)return re.createRelativePositionFromTypeIndex(e,0,-1);let o=e._first===null?null:e._first.content.type;for(;o!==null&&e!==o;){if(o instanceof re.XmlText){if(o._length>=n)return re.createRelativePositionFromTypeIndex(o,n,-1);if(n-=o._length,o._item!==null&&o._item.next!==null)o=o._item.next.content.type;else{do o=o._item===null?null:o._item.parent,n--;while(o!==e&&o!==null&&o._item!==null&&o._item.next===null);o!==null&&o!==e&&(o=o._item===null?null:o._item.next.content.type)}}else{const r=(t.get(o)||{nodeSize:0}).nodeSize;if(o._first!==null&&n<r)o=o._first.content.type,n--;else{if(n===1&&o._length===0&&r>1)return new re.RelativePosition(o._item===null?null:o._item.id,o._item===null?re.findRootTypeKey(o):null,null);if(n-=r,o._item!==null&&o._item.next!==null)o=o._item.next.content.type;else{if(n===0)return o=o._item===null?o:o._item.parent,new re.RelativePosition(o._item===null?null:o._item.id,o._item===null?re.findRootTypeKey(o):null,null);do o=o._item.parent,n--;while(o!==e&&o._item.next===null);o!==e&&(o=o._item.next.content.type)}}}if(o===null)throw ra();if(n===0&&o.constructor!==re.XmlText&&o!==e)return zF(o._item.parent,o._item)}return re.createRelativePositionFromTypeIndex(e,e._length,-1)},zF=(n,e)=>{let t=null,o=null;return n._item===null?o=re.findRootTypeKey(n):t=re.createID(n._item.id.client,n._item.id.clock),new re.RelativePosition(t,o,e.id)},Ti=(n,e,t,o)=>{const r=re.createAbsolutePositionFromRelativePosition(t,n);if(r===null||r.type!==e&&!re.isParentOf(e,r.type._item))return null;let i=r.type,s=0;if(i.constructor===re.XmlText)s=r.index;else if(i._item===null||!i._item.deleted){let l=i._first,a=0;for(;a<i._length&&a<r.index&&l!==null;){if(!l.deleted){const d=l.content.type;a++,d instanceof re.XmlText?s+=d._length:s+=o.get(d).nodeSize}l=l.right}s+=1}for(;i!==e&&i._item!==null;){const l=i._item.parent;if(l._item===null||!l._item.deleted){s+=1;let a=l._first;for(;a!==null;){const d=a.content.type;if(d===i)break;a.deleted||(d instanceof re.XmlText?s+=d._length:s+=o.get(d).nodeSize),a=a.right}}i=l}return s-1};function HF(n){const e=n.toArray(),t=o=>{let r;if(o instanceof re.XmlText)r=o.toDelta().map(s=>{const l={type:"text",text:s.insert};return s.attributes&&(l.marks=Object.keys(s.attributes).map(a=>{const d=s.attributes[a],f={type:Km(a)};return Object.keys(d)&&(f.attrs=d),f})),l});else if(o instanceof re.XmlElement){r={type:o.nodeName};const i=o.getAttributes();Object.keys(i).length&&(r.attrs=i);const s=o.toArray();s.length&&(r.content=s.map(t).flat())}else ra();return r};return{type:"doc",content:e.map(t)}}const FF=(n,e,t)=>n!==e,jF=n=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null);const o=document.createTextNode("⁠"),r=document.createTextNode("⁠");return e.insertBefore(o,null),e.insertBefore(t,null),e.insertBefore(r,null),e},uS=n=>({style:`background-color: ${n.color}70`,class:"ProseMirror-yjs-selection"}),UF=/^#[0-9a-fA-F]{6}$/,fS=(n,e,t,o,r)=>{const i=Je.getState(n);if(i==null||i.doc==null||i.binding==null)return Se.create(n.doc,[]);const s=i.doc,l=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?Se.create(n.doc,[]):(e.getStates().forEach((a,d)=>{if(t(s.clientID,d,a)&&a.cursor!=null){const u=a.user||{};u.color==null?u.color="#ffa500":UF.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${d}`);let f=Ti(s,i.type,re.createRelativePositionFromJSON(a.cursor.anchor),i.binding.mapping),p=Ti(s,i.type,re.createRelativePositionFromJSON(a.cursor.head),i.binding.mapping);if(f!==null&&p!==null){const h=Cs(n.doc.content.size-1,0);f=Dr(f,h),p=Dr(p,h),l.push(ze.widget(p,()=>o(u,d),{key:d+"",side:10}));const m=Dr(f,p),g=Cs(f,p);l.push(ze.inline(m,g,r(u,d),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Se.create(n.doc,l))},WF=(n,{awarenessStateFilter:e=FF,cursorBuilder:t=jF,selectionBuilder:o=uS,getSelection:r=s=>s.selection}={},i="cursor")=>new ce({key:bu,state:{init(s,l){return fS(l,n,e,t,o)},apply(s,l,a,d){const u=Je.getState(d),f=s.getMeta(bu);return u&&u.isChangeOrigin||f&&f.awarenessUpdated?fS(d,n,e,t,o):l.map(s.mapping,s.doc)}},props:{decorations:s=>bu.getState(s)},view:s=>{const l=()=>{s.docView&&VF(s,bu,{awarenessUpdated:!0})},a=()=>{const d=Je.getState(s.state),u=n.getLocalState()||{};if(s.hasFocus()){const f=r(s.state),p=ua(f.anchor,d.type,d.binding.mapping),h=ua(f.head,d.type,d.binding.mapping);(u.cursor==null||!re.compareRelativePositions(re.createRelativePositionFromJSON(u.cursor.anchor),p)||!re.compareRelativePositions(re.createRelativePositionFromJSON(u.cursor.head),h))&&n.setLocalStateField(i,{anchor:p,head:h})}else u.cursor!=null&&Ti(d.doc,d.type,re.createRelativePositionFromJSON(u.cursor.anchor),d.binding.mapping)!==null&&n.setLocalStateField(i,null)};return n.on("change",l),s.dom.addEventListener("focusin",a),s.dom.addEventListener("focusout",a),{update:a,destroy:()=>{s.dom.removeEventListener("focusin",a),s.dom.removeEventListener("focusout",a),n.off("change",l),n.setLocalStateField(i,null)}}}}),qF=n=>{const e=Zo.getState(n).undoManager;if(e!=null)return e.undo(),!0},KF=n=>{const e=Zo.getState(n).undoManager;if(e!=null)return e.redo(),!0},JF=new Set(["paragraph"]),GF=(n,e)=>!(n instanceof Wi.Item)||!(n.content instanceof Wi.ContentType)||!(n.content.type instanceof Wi.Text||n.content.type instanceof Wi.XmlElement&&e.has(n.content.type.nodeName))||n.content.type._length===0,XF=({protectedNodes:n=JF,trackedOrigins:e=[],undoManager:t=null}={})=>new ce({key:Zo,state:{init:(o,r)=>{const i=Je.getState(r),s=t||new Wi.UndoManager(i.type,{trackedOrigins:new Set([Je].concat(e)),deleteFilter:l=>GF(l,n),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(o,r,i,s)=>{const l=Je.getState(s).binding,a=r.undoManager,d=a.undoStack.length>0,u=a.redoStack.length>0;return l?{undoManager:a,prevSel:Um(l,i),hasUndoOps:d,hasRedoOps:u}:d!==r.hasUndoOps||u!==r.hasRedoOps?Object.assign({},r,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):r}},view:o=>{const r=Je.getState(o.state),i=Zo.getState(o.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const l=r.binding;l&&s.meta.set(l,Zo.getState(o.state).prevSel)}),i.on("stack-item-popped",({stackItem:s})=>{const l=r.binding;l&&(l.beforeTransactionSelection=s.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});function YF(n){return!!n.getMeta(Je)}function QF(n,e){const t=Je.getState(n);return Ti(t.doc,t.type,e,t.binding.mapping)||0}function pS(n,e){const t=Je.getState(n);return ua(e,t.type,t.binding.mapping)}var Su=class oN extends Tc{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(e){return new oN(e.position,e.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function ZF(n,e){const t=pS(e,n);return new Su(n,t)}function ej(n,e,t){const o=n instanceof Su?n.yRelativePosition:null;if(YF(e)&&o){const s=QF(t,o);return{position:new Su(s,o),mapResult:null}}const r=Fp(n,e),i=r.position.position;return{position:new Su(i,o??pS(t,i)),mapResult:r.mapResult}}var tj=me.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(n=>n.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(n,e)=>ej(n,e,this.editor.state),this.editor.utils.createMappablePosition=n=>ZF(n,this.editor.state)},addCommands(){return{undo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Zo.getState(e).undoManager.undoStack.length===0?!1:t?qF(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Zo.getState(e).undoManager.redoStack.length===0?!1:t?KF(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var n;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=XF(this.options.yUndoOptions),o=t.spec.view;t.spec.view=s=>{const{undoManager:l}=Zo.getState(s.state);l.restore&&(l.restore(),l.restore=()=>{});const a=o?o(s):void 0;return{destroy:()=>{const d=l.trackedOrigins.has(l),u=l._observers;l.restore=()=>{d&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=u},a!=null&&a.destroy&&a.destroy()}}};const r={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},i=TF(e,r);return this.editor.options.enableContentCheck&&((n=e.doc)==null||n.on("beforeTransaction",()=>{try{const s=HF(e);if(s.content.length===0)return;this.editor.schema.nodeFromJSON(s).check()}catch(s){return this.editor.emit("contentError",{error:s,editor:this.editor,disableCollaboration:()=>{var l;(l=e.doc)==null||l.destroy(),this.storage.isDisabled=!0}}),!1}})),[i,t,this.editor.options.enableContentCheck&&new ce({key:new le("filterInvalidContent"),filterTransaction:()=>{var s;return this.storage.isDisabled!==!1&&((s=e.doc)==null||s.destroy()),!0}})].filter(Boolean)}}),hS=tj,mS=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t.user})),gS=()=>null,nj=me.create({name:"collaborationCaret",priority:999,addOptions(){return{provider:null,user:{name:null,color:null},render:n=>{const e=document.createElement("span");e.classList.add("collaboration-carets__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");return t.classList.add("collaboration-carets__label"),t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null),e.insertBefore(t,null),e},selectionRender:uS,onUpdate:gS}},onCreate(){if(this.options.onUpdate!==gS&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCaret.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'),!this.options.provider)throw new Error('The "provider" option is required for the CollaborationCaret extension')},addStorage(){return{users:[]}},addCommands(){return{updateUser:n=>()=>(this.options.provider.awareness.setLocalStateField("user",n),!0),user:n=>({editor:e})=>(console.warn('[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'),e.commands.updateUser(n))}},addProseMirrorPlugins(){return[WF((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=mS(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=mS(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),yS=nj,oj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,rj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ij=In.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",fe(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){const r=/^(==)([^=]+)(==)/.exec(n);if(r){const i=r[2].trim(),s=t.inlineTokens(i);return{type:"highlight",raw:r[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Er({find:oj,type:this.type})]},addPasteRules(){return[Fo({find:rj,type:this.type})]}}),bS=ij,sj=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,lj=Oe.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",fe(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,o,r,i,s;const l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(r=(o=n.attrs)==null?void 0:o.alt)!=null?r:"",d=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return d?`![${a}](${l} "${d}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:o}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:s,editor:l})=>{const a=document.createElement("img");Object.entries(s).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,p);break}}),a.src=s.src;const d=new Dc({element:a,editor:l,node:r,getPos:i,onResize:(f,p)=>{a.style.width=`${f}px`,a.style.height=`${p}px`},onCommit:(f,p)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,h)=>f.type===r.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:o===!0}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",a.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[cs({find:sj,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),kS=lj;function aj(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,d=Kp(t),u=new RegExp(`\\s${d}$`),f=s?"^":"",p=r?"":d,h=a?new RegExp(`${f}${d}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${d}[^\\s${p}]*`,"gm"),m=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,y=Array.from(m.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!k)return null;const x=g+y.index;let w=x+y[0].length;return a&&u.test(m.slice(w-1,w+1))&&(y[0]+=" ",w+=1),x<l.pos&&w>=l.pos?{range:{from:x,to:w},query:y[0].slice(t.length),text:y[0]}:null}var cj=new le("suggestion");function dj({pluginKey:n=cj,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=aj,shouldShow:y}){let b;const k=h==null?void 0:h(),x=()=>{const E=e.state.selection.$anchor.pos,T=e.view.coordsAtPos(E),{top:A,right:$,bottom:O,left:B}=T;try{return new DOMRect(B,A,$-B,O-A)}catch{return null}},w=(E,T)=>T?()=>{const A=n.getState(e.state),$=A==null?void 0:A.decorationId,O=E.dom.querySelector(`[data-decoration-id="${$}"]`);return(O==null?void 0:O.getBoundingClientRect())||null}:x;function C(E,T){var A;try{const O=n.getState(E.state),B=O!=null&&O.decorationId?E.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`):null,_={editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},query:(O==null?void 0:O.query)||null,text:(O==null?void 0:O.text)||null,items:[],command:D=>f({editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},props:D}),decorationNode:B,clientRect:w(E,B)};(A=k==null?void 0:k.onExit)==null||A.call(k,_)}catch{}const $=E.state.tr.setMeta(T,{exit:!0});E.dispatch($)}const v=new ce({key:n,view(){return{update:async(E,T)=>{var A,$,O,B,_,D,P;const R=(A=this.key)==null?void 0:A.getState(T),K=($=this.key)==null?void 0:$.getState(E.state),H=R.active&&K.active&&R.range.from!==K.range.from,W=!R.active&&K.active,ge=R.active&&!K.active,Ee=!W&&!ge&&R.query!==K.query,Le=W||H&&Ee,We=Ee||H,Fe=ge||H&&Ee;if(!Le&&!We&&!Fe)return;const Ae=Fe&&!Le?R:K,je=E.dom.querySelector(`[data-decoration-id="${Ae.decorationId}"]`);b={editor:e,range:Ae.range,query:Ae.query,text:Ae.text,items:[],command:At=>f({editor:e,range:Ae.range,props:At}),decorationNode:je,clientRect:w(E,je)},Le&&((O=k==null?void 0:k.onBeforeStart)==null||O.call(k,b)),We&&((B=k==null?void 0:k.onBeforeUpdate)==null||B.call(k,b)),(We||Le)&&(b.items=await p({editor:e,query:Ae.query})),Fe&&((_=k==null?void 0:k.onExit)==null||_.call(k,b)),We&&((D=k==null?void 0:k.onUpdate)==null||D.call(k,b)),Le&&((P=k==null?void 0:k.onStart)==null||P.call(k,b))},destroy:()=>{var E;b&&((E=k==null?void 0:k.onExit)==null||E.call(k,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(E,T,A,$){const{isEditable:O}=e,{composing:B}=e.view,{selection:_}=E,{empty:D,from:P}=_,R={...T},K=E.getMeta(n);if(K&&K.exit)return R.active=!1,R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null,R;if(R.composing=B,O&&(D||e.view.composing)){(P<T.range.from||P>T.range.to)&&!B&&!T.composing&&(R.active=!1);const H=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:_.$from}),W=`id_${Math.floor(Math.random()*4294967295)}`;H&&m({editor:e,state:$,range:H.range,isActive:T.active})&&(!y||y({editor:e,range:H.range,query:H.query,text:H.text,transaction:E}))?(R.active=!0,R.decorationId=T.decorationId?T.decorationId:W,R.range=H.range,R.query=H.query,R.text=H.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(E,T){var A,$,O,B;const{active:_,range:D}=v.getState(E.state);if(!_)return!1;if(T.key==="Escape"||T.key==="Esc"){const R=v.getState(E.state),K=(A=b==null?void 0:b.decorationNode)!=null?A:null,H=K??(R!=null&&R.decorationId?E.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`):null);if((($=k==null?void 0:k.onKeyDown)==null?void 0:$.call(k,{view:E,event:T,range:R.range}))||!1)return!0;const ge={editor:e,range:R.range,query:R.query,text:R.text,items:[],command:Ee=>f({editor:e,range:R.range,props:Ee}),decorationNode:H,clientRect:H?()=>H.getBoundingClientRect()||null:null};return(O=k==null?void 0:k.onExit)==null||O.call(k,ge),C(E,n),!0}return((B=k==null?void 0:k.onKeyDown)==null?void 0:B.call(k,{view:E,event:T,range:D}))||!1},decorations(E){const{active:T,range:A,decorationId:$,query:O}=v.getState(E);if(!T)return null;const B=!(O!=null&&O.length),_=[a];return B&&_.push(u),Se.create(E.doc,[ze.inline(A.from,A.to,{nodeName:l,class:_.join(" "),"data-decoration-id":$,"data-decoration-content":d})])}}});return v}function uj({editor:n,overrideSuggestionOptions:e,extensionName:t,char:o="@"}){const r=new le;return{editor:n,char:o,pluginKey:r,command:({editor:i,range:s,props:l})=>{var a,d,u;const f=i.view.state.selection.$to.nodeAfter;((a=f==null?void 0:f.text)==null?void 0:a.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:t,attrs:{...l,mentionSuggestionChar:o}},{type:"text",text:" "}]).run(),(u=(d=i.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:i,range:s})=>{const l=i.doc.resolve(s.from),a=i.schema.nodes[t];return!!l.parent.type.contentMatch.matchType(a)},...e}}function wS(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>uj({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function xS(n,e){const t=wS(n),o=t.find(r=>r.char===e);return o||(t.length?t[0]:null)}for(var fj=Oe.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,o;return`${(t=e==null?void 0:e.char)!=null?t:"@"}${(o=n.attrs.label)!=null?o:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var o,r;return["span",fe(this.HTMLAttributes,n.HTMLAttributes),`${(o=t==null?void 0:t.char)!=null?o:"@"}${(r=e.attrs.label)!=null?r:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=xS(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",fe({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const o={...this.options};o.HTMLAttributes=fe({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:o,node:n,suggestion:t});return typeof r=="string"?["span",fe({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},...Jp({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o,l=i??s;e[r==="char"?"mentionSuggestionChar":r]=l,o=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:xS(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:o}=e,{empty:r,anchor:i}=o;if(!r)return!1;let s=new $n,l=0;return e.doc.nodesBetween(i-1,i,(a,d)=>{if(a.type.name===this.name)return t=!0,s=a,l=d,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,l,l+s.nodeSize),t})}},addProseMirrorPlugins(){return wS(this).map(dj)}}),pj=fj,hj=In.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),CS=hj,mj=In.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",fe(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),SS=mj,gj=me.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:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),vS=gj,yj=n=>rt({find:/--$/,replace:n??"—"}),bj=n=>rt({find:/\.\.\.$/,replace:n??"…"}),kj=n=>rt({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:n??"“"}),wj=n=>rt({find:/"$/,replace:n??"”"}),xj=n=>rt({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:n??"‘"}),Cj=n=>rt({find:/'$/,replace:n??"’"}),Sj=n=>rt({find:/<-$/,replace:n??"←"}),vj=n=>rt({find:/->$/,replace:n??"→"}),Ej=n=>rt({find:/\(c\)$/,replace:n??"©"}),Mj=n=>rt({find:/\(tm\)$/,replace:n??"™"}),Tj=n=>rt({find:/\(sm\)$/,replace:n??"℠"}),Nj=n=>rt({find:/\(r\)$/,replace:n??"®"}),Aj=n=>rt({find:/(?:^|\s)(1\/2)\s$/,replace:n??"½"}),Oj=n=>rt({find:/\+\/-$/,replace:n??"±"}),$j=n=>rt({find:/!=$/,replace:n??"≠"}),Bj=n=>rt({find:/<<$/,replace:n??"«"}),Rj=n=>rt({find:/>>$/,replace:n??"»"}),Dj=n=>rt({find:/\d+\s?([*x])\s?\d+$/,replace:n??"×"}),_j=n=>rt({find:/\^2$/,replace:n??"²"}),Ij=n=>rt({find:/\^3$/,replace:n??"³"}),Lj=n=>rt({find:/(?:^|\s)(1\/4)\s$/,replace:n??"¼"}),Pj=n=>rt({find:/(?:^|\s)(3\/4)\s$/,replace:n??"¾"}),Vj=me.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const n=[];return this.options.emDash!==!1&&n.push(yj(this.options.emDash)),this.options.ellipsis!==!1&&n.push(bj(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&n.push(kj(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(wj(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&n.push(xj(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(Cj(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&n.push(Sj(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(vj(this.options.rightArrow)),this.options.copyright!==!1&&n.push(Ej(this.options.copyright)),this.options.trademark!==!1&&n.push(Mj(this.options.trademark)),this.options.servicemark!==!1&&n.push(Tj(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(Nj(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(Aj(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(Oj(this.options.plusMinus)),this.options.notEqual!==!1&&n.push($j(this.options.notEqual)),this.options.laquo!==!1&&n.push(Bj(this.options.laquo)),this.options.raquo!==!1&&n.push(Rj(this.options.raquo)),this.options.multiplication!==!1&&n.push(Dj(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(_j(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(Ij(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(Lj(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(Pj(this.options.threeQuarters)),n}}),ES=Vj,Lt=[],Xm=0;Xm<256;++Xm)Lt.push((Xm+256).toString(16).slice(1));function zj(n,e=0){return(Lt[n[e+0]]+Lt[n[e+1]]+Lt[n[e+2]]+Lt[n[e+3]]+"-"+Lt[n[e+4]]+Lt[n[e+5]]+"-"+Lt[n[e+6]]+Lt[n[e+7]]+"-"+Lt[n[e+8]]+Lt[n[e+9]]+"-"+Lt[n[e+10]]+Lt[n[e+11]]+Lt[n[e+12]]+Lt[n[e+13]]+Lt[n[e+14]]+Lt[n[e+15]]).toLowerCase()}var vu,Hj=new Uint8Array(16);function Fj(){if(!vu&&(vu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vu))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vu(Hj)}var jj=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const MS={randomUUID:jj};function TS(n,e,t){if(MS.randomUUID&&!n)return MS.randomUUID();n=n||{};var o=n.random||(n.rng||Fj)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,zj(o)}function Uj(n){const e=new Set,t=new Set;return n.forEach(o=>{e.has(o)?t.add(o):e.add(o)}),Array.from(t)}var Wj=me.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>TS(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:n=>n.getAttribute(`data-${this.options.attributeName}`),renderHTML:n=>n[this.options.attributeName]?{[`data-${this.options.attributeName}`]:n[this.options.attributeName]}:{}}}}]},onCreate(){var n;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),t=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),r=[e,t].filter(Boolean).find(l=>{var a;return(a=l==null?void 0:l.options)==null?void 0:a.provider}),i=(n=r==null?void 0:r.options)==null?void 0:n.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:d,doc:u}=a,{types:f,attributeName:p,generateID:h}=this.options;zo(u,g=>f.includes(g.type.name)&&g.attrs[p]===null).forEach(({node:g,pos:y})=>{d.setNodeMarkup(y,void 0,{...g.attrs,[p]:h({node:g,pos:y})})}),d.setMeta("addToHistory",!1),l.dispatch(d),i&&i.off("synced",s)};if(r){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let n=null,e=!1;return[new ce({key:new le("uniqueID"),appendTransaction:(t,o,r)=>{const i=t.some(g=>g.docChanged)&&!o.doc.eq(r.doc),s=this.options.filterTransaction&&t.some(g=>{var y,b;return!((b=(y=this.options).filterTransaction)!=null&&b.call(y,g))});if(t.find(g=>g.getMeta("y-sync$"))||!i||s)return;const{tr:a}=r,{types:d,attributeName:u,generateID:f}=this.options,p=yc(o.doc,t),{mapping:h}=p;if(vc(p).forEach(({newRange:g})=>{const y=Op(r.doc,g,k=>d.includes(k.type.name)),b=y.map(({node:k})=>k.attrs[u]).filter(k=>k!==null);y.forEach(({node:k,pos:x},w)=>{var C;const v=(C=a.doc.nodeAt(x))==null?void 0:C.attrs[u];if(v===null){a.setNodeMarkup(x,void 0,{...k.attrs,[u]:f({node:k,pos:x})});return}const E=y[w+1];if(E&&k.content.size===0){const O=a.doc.nodeAt(E.pos);if(O!=null&&O.attrs[u]&&O.attrs[u]!==v)return;a.setNodeMarkup(E.pos,void 0,{...E.node.attrs,[u]:v}),b[w+1]=v;const B=f({node:k,pos:x});return a.setNodeMarkup(x,void 0,{...k.attrs,[u]:B}),b[w]=B,a}const T=Uj(b),{deleted:A}=h.invert().mapResult(x);A&&T.includes(v)&&a.setNodeMarkup(x,void 0,{...k.attrs,[u]:f({node:k,pos:x})})})}),!!a.steps.length)return a.setStoredMarks(r.tr.storedMarks),a.setMeta("__uniqueIDTransaction",!0),a},view(t){const o=r=>{var i;n=(i=t.dom.parentElement)!=null&&i.contains(r.target)?t.dom.parentElement:null};return window.addEventListener("dragstart",o),{destroy(){window.removeEventListener("dragstart",o)}}},props:{handleDOMEvents:{drop:(t,o)=>{var r,i;return(n!==t.dom.parentElement||((r=o.dataTransfer)==null?void 0:r.effectAllowed)==="copyMove"||((i=o.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(n=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:t=>{if(!e)return t;const{types:o,attributeName:r}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!o.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const d=a.type.create({...a.attrs,[r]:null},i(a.content),a.marks);l.push(d)}),L.from(l)};return e=!1,new j(i(t.content),t.openStart,t.openEnd)}}})]}}),NS=Wj;/**
216
- * Copyright 2026 Yiitap
217
- * @license MIT
218
- **/const AS=n=>{const e=/(#[0-9a-f]{3,6})\b/gi,t=[];return n.descendants((o,r)=>{o.text&&Array.from(o.text.matchAll(e)).forEach(i=>{const s=i[0],l=i.index||0,a=r+l,d=a+s.length,u=ze.inline(a,d,{class:"color-highlighter",style:`--color: ${s}`});t.push(u)})}),Se.create(n,t)},OS=me.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new ce({key:new le("colorHighlighter"),state:{init(n,{doc:e}){return AS(e)},apply(n,e){return n.docChanged?AS(n.doc):e}},props:{decorations(n){return this.getState(n)}}})]}});/**
219
- * Copyright 2026 Yiitap
220
- * @license MIT
221
- **/const Ym=new le("inlinePlaceholderPlugin"),$S=me.create({name:"inlinePlaceholder",addOptions(){return{onShow:n=>{},onHide:()=>{}}},addProseMirrorPlugins(){return[new ce({key:Ym,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(Ym);return t&&console.log("apply",t),(t==null?void 0:t.type)==="show"?{active:t.payload}:(t==null?void 0:t.type)==="hide"?{active:null}:e}},props:{decorations:n=>{var o;const e=(o=Ym.getState(n))==null?void 0:o.active;if(!e)return null;const t=ze.widget(e.pos,()=>{const r=document.createElement("span");return r.className="inline-placeholder bg-gray-100 border border-gray-300 text-gray-500 px-1 rounded cursor-text",r.textContent=e.label||"Type...",r.addEventListener("click",()=>{this.options.onShow(e)}),r});return Se.create(n.doc,[t])}},view:()=>({destroy:this.options.onHide})})]}});/**
222
- * Copyright 2026 Yiitap
223
- * @license MIT
224
- **/const BS=Oe.create({name:"column",group:"block",content:"block+",defining:!0,selectable:!0,addAttributes(){return{flexGrow:{default:1,parseHTML:n=>parseFloat(n.style.flexGrow)||1,renderHTML:n=>n.flexGrow?{style:`flex-grow: ${n.flexGrow};`}:{}}}},parseHTML(){return[{tag:'div[data-type="column"]'}]},renderHTML({HTMLAttributes:n}){return["div",fe(n,{"data-type":"column"}),0]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
225
- `)+`
226
-
227
- `:""}),RS=Oe.create({name:"columns",group:"block",content:"column*",selectable:!0,inline:!1,parseHTML(){return[{tag:'div[data-type="column-container"]'}]},renderHTML({HTMLAttributes:n}){return["div",fe(n,{"data-type":"column-container"}),0]},renderMarkdown:(n,e)=>{if(n.content){const t=[];return n.content.forEach(o=>{if(o.content){const r=e.renderChildren(o.content,`
228
- `);t.push(r)}}),t.join(`
229
-
230
- `)+`
231
-
232
- `}else return""}}),Qm=me.create({name:"columnDropCursor",addProseMirrorPlugins(){let n=null;const e=t=>{n&&(n.style.display="none"),t.dom.classList.remove("hide-native-dropcursor")};return[new ce({key:new le("columnDropCursor"),view(t){var r;n=document.createElement("div"),n.className="column-dropcursor",Object.assign(n.style,{position:"absolute",display:"none",pointerEvents:"none",backgroundColor:"skyblue",zIndex:"1000",width:"4px",transition:"top 0.1s ease, left 0.05s ease, height 0.1s ease"}),(r=t.dom.parentElement)==null||r.appendChild(n);const o=()=>e(t);return window.addEventListener("dragend",o),{destroy(){window.removeEventListener("dragend",o),n==null||n.remove(),n=null}}},props:{handleDOMEvents:{dragover:(t,o)=>{var a,d;const r=t.dom.getBoundingClientRect(),i=(a=document.elementFromPoint(o.clientX,o.clientY))==null?void 0:a.closest('[data-type="column"]');if(i){const u=i.getBoundingClientRect();if(o.clientX>u.right-u.width*.4)return o.preventDefault(),o.dataTransfer.dropEffect="move",n&&(n.style.display="block",n.style.height=`${u.height}px`,n.style.top=`${t.dom.offsetTop+(u.top-r.top)}px`,n.style.left=`${t.dom.offsetLeft+(u.left-r.left)+u.width+4}px`),t.dom.classList.add("hide-native-dropcursor"),!0}const s=r.left+r.width/2,l=(d=document.elementFromPoint(s,o.clientY))==null?void 0:d.closest(".tiptap > *");if(l&&!l.matches('[data-type="column-container"]')){const u=l.getBoundingClientRect();if(o.clientX>u.right-40&&o.clientX<u.right)return o.preventDefault(),o.dataTransfer.dropEffect="move",n&&(n.style.display="block",n.style.height=`${u.height}px`,n.style.top=`${t.dom.offsetTop+(u.top-r.top)}px`,n.style.left=`${t.dom.offsetLeft+(u.left-r.left)+u.width+4}px`),t.dom.classList.add("hide-native-dropcursor"),!0}return e(t),!1},drop:(t,o)=>{var k;t.dom.getBoundingClientRect();const r=document.elementFromPoint(o.clientX,o.clientY),i=r==null?void 0:r.closest('[data-type="column"]'),s=i||(r==null?void 0:r.closest(".tiptap > *"));if(!s)return!1;const l=s.getBoundingClientRect();if(!(o.clientX>l.left+l.width*.5))return!1;o.preventDefault(),o.stopPropagation(),e(t);const a=t.dragging,d=a==null?void 0:a.slice;if(!d)return!1;const{state:u,dispatch:f}=t,{column:p,columns:h}=u.schema.nodes;let m=u.tr;if(a.move){const{from:x,to:w}=u.selection;m.delete(x,w)}const g=((k=d.content.firstChild)==null?void 0:k.type.name)==="columns",y=t.posAtDOM(s,0),b=u.doc.resolve(y);try{if(i){const x=m.mapping.map(b.after(b.depth)),w=[];g?d.content.firstChild.content.forEach(C=>w.push(C)):w.push(p.create({flexGrow:1},d.content)),m.insert(x,w)}else{const x=m.mapping.map(b.before(1)),w=m.doc.nodeAt(x);if(!w)return!1;if(g){const C=d.content.firstChild,v=[p.create({flexGrow:1},w)];C.content.forEach(E=>v.push(E)),m.replaceWith(x,x+w.nodeSize,h.create(null,v))}else{const C=h.create(null,[p.create({flexGrow:1},w),p.create({flexGrow:1},d.content)]);m.replaceWith(x,x+w.nodeSize,C)}}return t.dragging=null,f&&f(m),!0}catch(x){return console.error("Column drop error:",x),!1}}},handleDragLeave:t=>e(t)}})]}});function qj(n){for(let e=n.depth;e>0;e--){const t=n.node(e);if(t.type.name==="column")return{node:t,depth:e}}return null}const Kj=()=>!!document.querySelector(".slash-tippy"),Jj=(n,e)=>{const{$cursor:t}=n.selection;if(!t||t.parent.content.size||t.node(t.depth-1).type.name==="column")return!1;if(t.depth>1&&t.after()!=t.end(-1)){const i=t.before();if(lo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}const o=t.blockRange(),r=o&&ni(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)},Gj=fw({Enter:(n,e,t)=>Kj()?!1:ic(Jf,Xf,Jj,Jb)(n,e,t),"Mod-a":(n,e,t)=>{const{selection:o}=n,{$from:r}=o,i=qj(r);if(i){const{depth:s}=i,l=r.start(s),a=r.end(s),d=n.tr.setSelection(q.create(n.doc,l,a));return e&&e(d),!0}return!1}}),to=new le("gridResizingPlugin");let Xj=class $y{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=e.getMeta(to);return(t==null?void 0:t.setHandle)!==void 0?new $y(t.setHandle,this.dragging):(t==null?void 0:t.setDragging)!==void 0?new $y(this.activeHandle,t.setDragging):this}};function Yj(n,e,t){const o=e.composedPath().find(i=>i instanceof Element&&i.matches('[data-type="column-container"]'));if(!o)return-1;const r=Array.from(o.children).filter(i=>i==null?void 0:i.matches('[data-type="column"]'));for(let i=0;i<r.length;i++){const s=r[i],l=s.getBoundingClientRect();if(e.clientX>=l.right-t-2&&e.clientX<=l.right+10+t){const a=n.posAtDOM(s,0);if(a!=null)return a}}return-1}function Qj(n,e){const t=n.state.doc.resolve(e),o=t.parent;if(!o||o.type.name!=="column")return null;const r=n.domAtPos(t.pos);if(!r.node)return null;const i=r.node instanceof HTMLElement?r.node:r.node.childNodes[r.offset],s=i.offsetWidth;return{$pos:t,node:o,columnEl:i,domWidth:s}}function DS(n,e){n.dispatch(n.state.tr.setMeta(to,{setHandle:e}))}function Zj(n,e,t){const o=to.getState(n.state);if(!o||o.dragging)return!1;const r=Yj(n,e,t);return r!==o.activeHandle&&DS(n,r),!1}function e3(n){const e=to.getState(n.state);return e&&e.activeHandle>-1&&!e.dragging&&DS(n,-1),!1}function t3(n,e,t=.1){const o=to.getState(n.state);if(!o||o.activeHandle===-1||o.dragging)return!1;const r=Qj(n,o.activeHandle);if(!r)return!1;const{$pos:i,node:s,columnEl:l}=r,a=i.before(),d=l.parentElement;if(!d)return!1;const u=a+s.nodeSize,f=n.state.doc.nodeAt(u),p=f&&f.type.name==="column";let h=0;i.parent.forEach(k=>{h+=k.attrs.flexGrow||1});const m=d.offsetWidth;n.dispatch(n.state.tr.setMeta(to,{setDragging:{startX:e.clientX,startFlex:s.attrs.flexGrow||1,nextColFlex:p?f.attrs.flexGrow||1:null,nextColPos:p?u:null,totalFlex:h,containerWidth:m}}));const g=n.dom.ownerDocument.defaultView||window,y=k=>{var _;if(!k.buttons){b();return}const x=(_=to.getState(n.state))==null?void 0:_.dragging;if(!x)return;const{startX:w,startFlex:C,nextColFlex:v,nextColPos:E,totalFlex:T,containerWidth:A}=x,$=(k.clientX-w)/A*T,O=n.state.tr;let B=Math.max(t,C+$);if(E!==null&&v!==null){const D=C+v;let P=Math.max(t,D-B);B=D-P,O.setNodeMarkup(a,void 0,{...s.attrs,flexGrow:B});const R=n.state.doc.nodeAt(E);R&&R.type.name==="column"&&O.setNodeMarkup(E,void 0,{...R.attrs,flexGrow:P})}else O.setNodeMarkup(a,void 0,{...s.attrs,flexGrow:B});n.dispatch(O.setMeta("addToHistory",!1))},b=()=>{g.removeEventListener("mouseup",b),g.removeEventListener("mousemove",y),n.dispatch(n.state.tr.setMeta(to,{setDragging:null}))};return g.addEventListener("mouseup",b),g.addEventListener("mousemove",y),e.preventDefault(),!0}function n3(n,e){if(n.doc.resolve(e).nodeAfter===null)return Se.empty;const t=ze.widget(e,()=>{const o=document.createElement("div");o.className="grid-resize-handle";const r=document.createElement("div");r.className="circle-button";const i=document.createElement("div");return i.className="plus",r.appendChild(i),o.appendChild(r),o},{key:`grid-handle-${e}`,side:0});return Se.create(n.doc,[t])}function o3(n,e){const t=e.target;if(!t||t.className!=="circle-button"&&t.className!=="plus")return!1;const o=t.closest('[data-type="column"]');if(!o)return!1;const r=n.posAtDOM(o,0);if(!r)return!1;const{state:i}=n,s=i.doc.resolve(r),{column:l,paragraph:a}=i.schema.nodes,d=s.after(s.depth),u=l.create({flexGrow:1},a.create()),f=i.tr.insert(d,u),p=f.doc.resolve(d+2),h=q.near(p);return n.dispatch(f.setSelection(h).scrollIntoView()),n.focus(),!0}function r3(n){const e=n==null?void 0:n.handleWidth,t=n==null?void 0:n.minColumnFlex;return new ce({key:to,state:{init:()=>new Xj(-1,null),apply:(o,r)=>r.apply(o)},props:{attributes:o=>{const r=to.getState(o);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,r)=>Zj(o,r,e),mouseleave:o=>e3(o),mousedown:(o,r)=>t3(o,r,t),mouseup:(o,r)=>o3(o,r)},decorations:o=>{const r=to.getState(o);return!r||r.activeHandle===-1?null:n3(o,r.activeHandle)}}})}const _S=me.create({name:"multiColumn",addProseMirrorPlugins(){return[r3({handleWidth:2,minColumnFlex:.5}),Gj]},addCommands(){return{insertMultiColumn:(n=2)=>({tr:e,dispatch:t,editor:o})=>{const{schema:r}=o,{column:i,columns:s,paragraph:l}=r.nodes;if(!i||!s||!l)return!1;const a=[];for(let u=0;u<n;u++)a.push(i.create({flexGrow:1},l.create()));const d=s.create(null,a);if(t){const u=e.selection.from;e.replaceSelectionWith(d);const f=e.doc.resolve(u),p=q.near(f);e.setSelection(p).scrollIntoView()}return!0}}}});/**
233
- * Copyright 2026 Yiitap
234
- * @license MIT
235
- **/const fa="selection-decoration",Eu={BLUR:"blur",FOCUS:"focus"},IS=me.create({name:fa,addProseMirrorPlugins(){return[new ce({key:new le(fa),state:{init(n){return Se.empty},apply:(n,e)=>{const{selection:t,doc:o}=n,r=n.getMeta(fa),i=t&&t.from!==t.to;if(!i||(r==null?void 0:r.action)===Eu.FOCUS)return Se.empty;if(i&&(r==null?void 0:r.action)===Eu.BLUR){const s=ze.inline(t.from,t.to,{class:"selection-decoration-blur"});return Se.create(o,[s])}return e}},props:{decorations(n){return this.getState(n)},handleDOMEvents:{blur:n=>{const{tr:e}=n.state,t=e.setMeta(fa,{from:e.selection.from,to:e.selection.to,action:Eu.BLUR});n.dispatch(t)},focus:n=>{const{tr:e}=n.state,t=e.setMeta(fa,{from:e.selection.from,to:e.selection.to,action:Eu.FOCUS});n.dispatch(t)}}}})]}});/**
236
- * Copyright 2026 Yiitap
237
- * @license MIT
238
- **/const i3=n=>n?n.split(/\r?\n/).filter(e=>e.trim().length>0).length>1:!1,s3=(n,e=.2)=>{if(!n||n.trim().length<2)return!1;const t=n.split(/\r?\n/).filter(a=>a.trim().length>0);if(t.length===0)return!1;if(/```[\s\S]*?```/.test(n)||/\$\$[\s\S]+?\$\$/.test(n))return console.log("Markdown: With code or math block"),!0;const o=[/^#{1,6}\s/,/^[-*+]\s+/,/^\d+\.\s+/,/^>\s+/,/^```/,/`[^`]+`/,/\*\*[^*]+\*\*/,/_[^_]+_/,/\[([^\]]+)\]\([^)]+\)/,/!\[([^\]]*)\]\([^)]+\)/,/^(\|?[\s-:|]+\|[\s-:|]+)$/,/\$\$[\s\S]+?\$\$/,/\$[^$]+\$/,/\\\([^)]+\\\)/,/\\\[[\s\S]+?\\\]/,/^\|.*?\|.*?\|/,/^:::\s*\w+/,/<[a-z][\s\S]*?>/i,/^[ \t]*[-*_]{3,}[ \t]*$/];let r=0,i=!1;for(const a of t){const d=a.trim();if(d.startsWith("```")){i=!i,r++;continue}if(i){r++;continue}o.some(u=>u.test(d))&&r++}const s=r/t.length,l=(n.match(/[*_`#>[\]]/g)||[]).length/n.length;return console.log("isMarkdown: ",s,l),s>=e||l>.05},LS=(n,e)=>{var r;const t=[],o=Array.isArray(n)?n:[n];for(const i of o)try{const s=(r=e.markdown)==null?void 0:r.serialize(i);s?t.push(s.trim()):console.warn("Failed to serialize: ",i)}catch(s){console.error("Failed to serialize.",s)}return t.join(`
239
-
240
- `)},PS=["Mathematics","starterKit"],VS=(n,e)=>{const t=Array.isArray(n)?{type:"doc",content:n}:n,o=e.extensionManager.extensions.filter(r=>!PS.includes(r.name));return Sw(t,o)},l3=(n,e)=>{const t=e.extensionManager.extensions,o=[...PS,"doc"],r=t.filter(i=>!o.includes(i.name));return r.push(Qp),_p(n,r)},zS=me.create({name:"shortcut",addOptions(){return{copy:{enabled:!0,keys:["Mod-c"]},duplicate:{enabled:!0,keys:["Mod-d"]},delete:{enabled:!0,keys:["Mod-x"]},markdown:{enabled:!0},selectableNodes:["aiBlock","blockquote","callout","codeBlock","heading","listItem","paragraph","tableCell","tableHeader","taskItem"]}},addCommands(){return{copySelected:()=>({tr:n,state:e,dispatch:t})=>this.editor.commands.deleteSelected({delete:!1}),duplicateSelected:()=>({tr:n,state:e,dispatch:t})=>{const{selection:o}=e,{$from:r,$to:i}=o;if(o instanceof Q){const u=o.node,f=o.to,p=u.type.create(u.attrs,u.content,u.marks);if(t){const h=e.tr.insert(f,p);t(h.scrollIntoView()),setTimeout(()=>{this.editor.commands.setNodeSelection(f)},100)}return!0}if(!o.empty){const{from:u,to:f}=o,p=e.doc.slice(u,f),h=f;if(t){let m=e.tr.insert(h,p.content);const g=p.content.size;m=m.setSelection(q.create(m.doc,h,h+g)),t(m.scrollIntoView())}return!0}const s=r.depth,l=r.before(s),a=r.node(s);if(!a)return!1;const d=a.type.create(a.attrs,a.content,a.marks);if(t){const u=l+a.nodeSize;let f=e.tr.insert(u,d);const p=u+a.nodeSize-1;f=f.setSelection(q.create(f.doc,p)),t(f.scrollIntoView())}return!0},deleteSelected:(n={delete:!0})=>({tr:e,state:t,dispatch:o})=>{var h,m;const{selection:r}=t,{$from:i,from:s,to:l}=r;if(s!==l){try{const g=t.doc.slice(s,l).content.toJSON(),y=VS(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((h=this.options.markdown)!=null&&h.enabled){const x=LS(g,this.editor)||"";b["text/plain"]=new Blob([x],{type:"text/plain"})}const k=new ClipboardItem(b);navigator.clipboard.write([k])}catch(g){console.error("Clipboard write failed.",g)}return n.delete&&o&&(e.deleteRange(s,l),o(e.scrollIntoView())),!0}let a=i.depth,d=a;for(;a>0;a--)if(i.node(a).isBlock){d=a;break}const u=i.node(d);if(!u)return!1;const f=i.before(d),p=f+u.nodeSize;try{const g=u.toJSON(),y=VS(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((m=this.options.markdown)!=null&&m.enabled){const x=LS(g,this.editor)||"";b["text/plain"]=new Blob([x],{type:"text/plain"})}const k=new ClipboardItem(b);navigator.clipboard.write([k])}catch(g){console.error("Clipboard write failed.",g)}return n.delete&&o&&(e.delete(f,p),o(e.scrollIntoView())),!0}}},addKeyboardShortcuts(){var t,o,r;const n={},e=i=>i instanceof Pe||i.cells&&i.cells.length>0;if((t=this.options.copy)!=null&&t.enabled){const i=this.options.copy.keys??["Mod-c"];for(const s of i)n[s]=({editor:l})=>e(l.state.selection)?!1:l.commands.copySelected()}if((o=this.options.duplicate)!=null&&o.enabled){const i=this.options.duplicate.keys??["Mod-d"];for(const s of i)n[s]=({editor:l})=>l.commands.duplicateSelected()}if((r=this.options.delete)!=null&&r.enabled){const i=this.options.delete.keys??["Mod-x"];for(const s of i)n[s]=({editor:l})=>l.commands.deleteSelected()}return n["Mod-a"]=({editor:i})=>{const{state:s,view:l}=i,{selection:a,tr:d}=s,{$from:u}=a,f=u.node(-1);let p=-1,h=-1;if(this.options.selectableNodes.includes(f==null?void 0:f.type.name))p=u.start(-1)+1,h=u.end(-1)-1;else if((f==null?void 0:f.type.name)==="doc"){let m=u.depth,g=null,y=0;for(;m>0;){const b=u.node(m);if(b.isBlock){g=b,y=u.before(m);break}m--}this.options.selectableNodes.includes(g==null?void 0:g.type.name)&&(p=y+1,h=y+(g==null?void 0:g.nodeSize)-1)}if(p>-1&&h>-1){const{from:m,to:g}=a;if(m!==p||g!==h){const y=q.create(d.doc,p,h);return d.setSelection(y),l.dispatch(d),!0}}return!1},n},addProseMirrorPlugins(){return[new ce({props:{handlePaste:(n,e,t)=>{var u,f,p;const o=e.clipboardData;if(!o)return!1;const r=o.getData("text/html"),i=o.getData("text/plain");if(!r&&!i)return!1;const{state:s}=n,{selection:l}=s,{$from:a}=l;if(a.parent.type.name==="codeBlock"){const h=s.tr.insertText(i,l.from,l.to);return n.dispatch(h.scrollIntoView()),!0}const d=a.node(a.depth).content.size===0;if(r)try{let h=!0;const m=/<html[\s\S]*>/i.test(r);let g;if(m){let b=l3(r,this.editor).content;b.length===1&&b[0].type==="paragraph"&&(h=!1,b=b[0].content),g=L.fromJSON(n.state.schema,b)}else{if(i3(i))return!1;{const b=s.tr.insertText(i,l.to);return n.dispatch(b.scrollIntoView()),!0}}const y=new j(g,0,0);if(h&&!d){const b=a.end(),k=n.state.tr.insert(b,g);n.dispatch(k.scrollIntoView())}else{const b=n.state.tr.replaceSelection(y);n.dispatch(b.scrollIntoView())}return!0}catch(h){console.error("Parse html failed.",h)}if((u=this.options.markdown)!=null&&u.enabled&&s3(i))try{const h=(p=((f=this.editor.markdown)==null?void 0:f.parse(i))||{})==null?void 0:p.content,m=L.fromJSON(n.state.schema,h),g=new j(m,0,0),y=n.state.tr.replaceSelection(g);return n.dispatch(y.scrollIntoView()),!0}catch(h){console.error("Parse Markdown failed.",h)}return!1}}})]}});/**
241
- * Copyright 2026 Yiitap
242
- * @license MIT
243
- **/function HS(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const d=n.firstChild;for(let u=0,f=0;u<d.childCount;u+=1){const{colspan:p,colwidth:h}=d.child(u).attrs;for(let m=0;m<p;m+=1,f+=1){const g=r===f?i:h&&h[m],y=g?`${g}px`:"";if(s+=g||o,g||(l=!1),a)a.style.width!==y&&(a.style.width=y),a=a.nextSibling;else{const b=document.createElement("col");b.className=`col-${f}`,e.appendChild(b).style.width=y}}}for(;a;){const u=a.nextSibling;a.parentNode.removeChild(a),a=u}l?(t.style.width=`${s}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${s}px`)}let a3=class{constructor(e,t,o){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),HS(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,HS(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}};const FS=iu.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:a3,lastColumnResizable:!0,allowTableNodeSelection:!1}},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),insertTable:e=>({editor:t,commands:o,tr:r,dispatch:i})=>{const{rows:s=3,cols:l=3,withHeaderRow:a=!0}=e||{},d=CC(t.schema,s,l,a);if(i){const u=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[d.toJSON()]}),r.scrollIntoView().setSelection(q.near(r.doc.resolve(u)))}return!0},deleteTable:()=>({state:e,dispatch:t})=>{const o=e.selection.$anchor;for(let r=o.depth;r>0;r--)if(o.node(r).type.name==="table-wrapper")return t&&t(e.tr.delete(o.before(r),o.after(r)).scrollIntoView()),!0;return!1},selectRow:e=>({tr:t,dispatch:o})=>{if(o){const r=t.doc.resolve(e),i=Pe.rowSelection(r);t.setSelection(i)}return!0},selectColumn:e=>({tr:t,dispatch:o})=>{if(o){const r=t.doc.resolve(e),i=Pe.colSelection(r);t.setSelection(i)}return!0}}},parseMarkdown:(n,e)=>{const t=[];if(n.header){const r=[];n.header.forEach(i=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}n.rows&&n.rows.forEach(r=>{const i=[];r.forEach(s=>{i.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),t.push(e.createNode("tableRow",{},i))});const o=e.createNode("table",void 0,t);return e.createNode("table-wrapper",void 0,[o])}});/**
244
- * Copyright 2026 Yiitap
245
- * @license MIT
246
- **/function Pt(n){this.content=n}Pt.prototype={constructor:Pt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new Pt(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Pt(t)},addToStart:function(n,e){return new Pt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Pt(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new Pt(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Pt.from(n),n.size?new Pt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Pt.from(n),n.size?new Pt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Pt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Pt.from=function(n){if(n instanceof Pt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Pt(e)};function jS(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=jS(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function US(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let d=US(s.content,l.content,t-1,o-1);if(d)return d}t-=a,o-=a}}let G=class cn{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],d=l+a.nodeSize;if(d>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let d=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new cn(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new cn(o,r)}cutByIndex(e,t){return e==t?cn.empty:e==0&&t==this.content.length?this:new cn(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new cn(r,i)}addToStart(e){return new cn([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new cn(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return jS(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return US(this,e,t,o)}findIndex(e){if(e==0)return Mu(0,e);if(e==this.size)return Mu(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?Mu(t+1,i):Mu(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return cn.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new cn(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return cn.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new cn(t||e,o)}static from(e){if(!e)return cn.empty;if(e instanceof cn)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new cn([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};G.empty=new G([],0);const Zm={index:0,offset:0};function Mu(n,e){return Zm.index=n,Zm.offset=e,Zm}function Tu(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!Tu(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Tu(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let nt=class By{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Tu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return By.none;if(e instanceof By)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};nt.none=[];let Nu=class extends Error{},ae=class Us{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=qS(this.content,e+this.openStart,t);return o&&new Us(o,this.openStart,this.openEnd)}removeBetween(e,t){return new Us(WS(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Us.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Us(G.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new Us(e,o,r)}};ae.empty=new ae(G.empty,0,0);function WS(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(WS(i.content,e-r-1,t-r-1)))}function qS(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=qS(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function c3(n,e,t){if(t.openStart>n.depth)throw new Nu("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Nu("Inconsistent open depths");return KS(n,e,t,0)}function KS(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let s=KS(n,e,t,o+1);return i.copy(i.content.replaceChild(r,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return Ai(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=d3(t,n);return Ai(i,GS(n,s,l,e,o))}else return Ai(i,Au(n,e,o))}function JS(n,e){if(!e.type.compatibleContent(n.type))throw new Nu("Cannot join "+e.type.name+" onto "+n.type.name)}function eg(n,e,t){let o=n.node(t);return JS(o,e.node(t)),o}function Ni(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function pa(n,e,t,o){let r=(e||n).node(t),i=0,s=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Ni(n.nodeAfter,o),i++));for(let l=i;l<s;l++)Ni(r.child(l),o);e&&e.depth==t&&e.textOffset&&Ni(e.nodeBefore,o)}function Ai(n,e){return n.type.checkContent(e),n.copy(e)}function GS(n,e,t,o,r){let i=n.depth>r&&eg(n,e,r+1),s=o.depth>r&&eg(t,o,r+1),l=[];return pa(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(JS(i,s),Ni(Ai(i,GS(n,e,t,o,r+1)),l)):(i&&Ni(Ai(i,Au(n,e,r+1)),l),pa(e,t,r,l),s&&Ni(Ai(s,Au(t,o,r+1)),l)),pa(o,null,r,l),new G(l)}function Au(n,e,t){let o=[];if(pa(null,n,t,o),n.depth>t){let r=eg(n,e,t+1);Ni(Ai(r,Au(n,e,t+1)),o)}return pa(e,null,t,o),new G(o)}function d3(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)o=e.node(r).copy(G.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}let XS=class Ry{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return nt.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new Ou(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),d=i-a;if(o.push(s,l,r+a),!d||(s=s.child(l),s.isText))break;i=d-1,r+=a+1}return new Ry(t,o,i)}static resolveCached(e,t){let o=YS.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==t)return s}else YS.set(e,o=new u3);let r=o.elts[o.i]=Ry.resolve(e,t);return o.i=(o.i+1)%f3,r}},u3=class{constructor(){this.elts=[],this.i=0}};const f3=12,YS=new WeakMap;let Ou=class{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const p3=Object.create(null);let Oi=class Dy{constructor(e,t,o,r=nt.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||G.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&Tu(this.attrs,t||e.defaultAttrs||p3)&&nt.sameSet(this.marks,o||nt.none)}copy(e=null){return e==this.content?this:new Dy(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Dy(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return ae.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),a=r.node(s).content.cut(r.pos-l,i.pos-l);return new ae(a,r.depth-s,i.depth-s)}replace(e,t,o){return c3(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return XS.resolveCached(this,e)}resolveNoCache(e){return XS.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),QS(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=G.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=nt.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!nt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=G.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Oi.prototype.text=void 0;let h3=class _y extends Oi{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):QS(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new _y(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new _y(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function QS(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}let ha=class rN{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new m3(e,t);if(o.next==null)return rN.empty;let r=ZS(o);o.next&&o.err("Unexpected trailing text");let i=C3(x3(r));return S3(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(s,l){let a=s.matchFragment(e,o);if(a&&(!t||a.validEnd))return G.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
247
- `)}};ha.empty=new ha(!0);let m3=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function ZS(n){let e=[];do e.push(g3(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function g3(n){let e=[];do e.push(y3(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function y3(n){let e=w3(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=b3(n,e);else break;return e}function ev(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function b3(n,e){let t=ev(n),o=t;return n.eat(",")&&(n.next!="}"?o=ev(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function k3(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let s=t[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function w3(n){if(n.eat("(")){let e=ZS(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=k3(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function x3(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let d={term:a,to:l};return e[s].push(d),d}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,d)=>a.concat(i(d,l)),[]);if(s.type=="seq")for(let a=0;;a++){let d=i(s.exprs[a],l);if(a==s.exprs.length-1)return d;r(d,l=t())}else if(s.type=="star"){let a=t();return o(l,a),r(i(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=t();return r(i(s.expr,l),a),r(i(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let d=0;d<s.min;d++){let u=t();r(i(s.expr,a),u),a=u}if(s.max==-1)r(i(s.expr,a),a);else for(let d=s.min;d<s.max;d++){let u=t();o(a,u),r(i(s.expr,a),u),a=u}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function tv(n,e){return e-n}function nv(n,e){let t=[];return o(e),t.sort(tv);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&o(a)}}}function C3(n){let e=Object.create(null);return t(nv(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);nv(n,a).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new ha(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(tv);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function S3(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:a,next:d}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ov(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function rv(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function iv(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function sv(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new E3(n,o,e[o]);return t}let lv=class iN{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=sv(e,o.attrs),this.defaultAttrs=ov(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ha.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:rv(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Oi(this,this.computeAttrs(e),G.from(t),nt.setFrom(o))}createChecked(e=null,t,o){return t=G.from(t),this.checkContent(t),new Oi(this,this.computeAttrs(e),t,nt.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=G.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(G.empty,!0);return i?new Oi(this,e,t.append(i),nt.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){iv(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:nt.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new iN(i,t,s));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function v3(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}let E3=class{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?v3(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}},av=class sN{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=sv(e,r.attrs),this.excluded=null;let i=ov(this.attrs);this.instance=i?new nt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new nt(this,rv(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new sN(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){iv(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},M3=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Pt.from(e.nodes),t.marks=Pt.from(e.marks||{}),this.nodes=lv.compile(this.spec.nodes,this),this.marks=av.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=ha.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?cv(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:cv(this,s.split(" "))}this.nodeFromJSON=r=>Oi.fromJSON(this,r),this.markFromJSON=r=>nt.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof lv){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new h3(o,o.defaultAttrs,e,nt.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function cv(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function T3(n){return n.tag!=null}function N3(n){return n.style!=null}let tg=class Iy{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(T3(r))this.tags.push(r);else if(N3(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new pv(this,t,!1);return o.addAll(e,nt.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new pv(this,t,!0);return o.addAll(e,nt.none,t.from,t.to),ae.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if($3(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=hv(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=hv(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Iy(e,Iy.schemaRules(e)))}};const dv={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},A3={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},uv={ol:!0,ul:!0},ma=1,ng=2,ga=4;function fv(n,e,t){return e!=null?(e?ma:0)|(e==="full"?ng:0):n&&n.whitespace=="pre"?ma|ng:t&~ga}class $u{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=nt.none,this.match=i||(s&ga?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(G.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ma)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=G.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!dv.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}let pv=class{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=fv(null,t.preserveWhitespace,0)|(o?ga:0);r?i=new $u(r.type,r.attrs,nt.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new $u(null,null,nt.none,!0,null,s):i=new $u(e.schema.topNodeType,null,nt.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&ng?"full":this.localPreserveWS||(r.options&ma)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
248
- `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;uv.hasOwnProperty(s)&&this.parser.normalizeLists&&O3(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:A3.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);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 d,u=this.needsBlock;if(dv.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,a,d,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
249
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.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?t=t.filter(d=>!a.clearMark(d)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],d=a.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=a,!d.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=nt.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):mv(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=fv(e,i,s.options);s.options&ga&&s.content.length==0&&(l|=ga);let a=nt.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):mv(d.type,e))?(a=d.addToSet(a),!1):!0),this.nodes.push(new $u(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ma)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}};function O3(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&uv.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function $3(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function hv(n){let e={};for(let t in n)e[t]=n[t];return e}function mv(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:d,next:u}=l.edge(a);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}const gv=65535,yv=Math.pow(2,16);function B3(n,e){return n+e*yv}function bv(n){return n&gv}function R3(n){return(n-(n&gv))/yv}const kv=1,wv=2,Bu=4,xv=8;let og=class{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&xv)>0}get deletedBefore(){return(this.delInfo&(kv|Bu))>0}get deletedAfter(){return(this.delInfo&(wv|Bu))>0}get deletedAcross(){return(this.delInfo&Bu)>0}},$i=class Ws{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ws.empty)return Ws.empty}recover(e){let t=0,o=bv(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+R3(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=a+d;if(e<=f){let p=d?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:u);if(o)return h;let m=e==(t<0?a:f)?null:B3(l/3,e-a),g=e==a?wv:e==f?kv:Bu;return(t<0?e!=a:e!=f)&&(g|=xv),new og(h,g,m)}r+=u-d}return o?e+r:new og(e+r,0,null)}touches(e,t){let o=0,r=bv(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let d=this.ranges[l+i],u=a+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),d=this.ranges[r+t],u=this.ranges[r+o];e(l,l+d,a,a+u),i+=u-d}}invert(){return new Ws(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ws.empty:new Ws(e<0?[0,-e,0]:[0,0,e])}};$i.empty=new $i([]);let D3=class Ly{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Ly(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new Ly;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new og(e,r,null)}};const rg=Object.create(null);let Jt=class{getMap(){return $i.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=rg[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in rg)throw new RangeError("Duplicate use of step JSON ID "+e);return rg[e]=t,t.prototype.jsonID=e,t}},rn=class za{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new za(e,null)}static fail(e){return new za(null,e)}static fromReplace(e,t,o,r){try{return za.ok(e.replace(t,o,r))}catch(i){if(i instanceof Nu)return za.fail(i.message);throw i}}};function ig(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(ig(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return G.fromArray(o)}let sg=class Ha extends Jt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new ae(ig(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return rn.fromReplace(e,this.from,this.to,i)}invert(){return new Ns(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Ha(t.pos,o.pos,this.mark)}merge(e){return e instanceof Ha&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ha(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ha(t.from,t.to,e.markFromJSON(t.mark))}};Jt.jsonID("addMark",sg);let Ns=class Fa extends Jt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new ae(ig(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return rn.fromReplace(e,this.from,this.to,o)}invert(){return new sg(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Fa(t.pos,o.pos,this.mark)}merge(e){return e instanceof Fa&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fa(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Fa(t.from,t.to,e.markFromJSON(t.mark))}};Jt.jsonID("removeMark",Ns);let lg=class ja extends Jt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return rn.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return rn.fromReplace(e,this.pos,this.pos+1,new ae(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new ja(this.pos,t.marks[r]);return new ja(this.pos,this.mark)}}return new Ru(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ja(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new ja(t.pos,e.markFromJSON(t.mark))}};Jt.jsonID("addNodeMark",lg);let Ru=class Py extends Jt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return rn.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return rn.fromReplace(e,this.pos,this.pos+1,new ae(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new lg(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Py(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Py(t.pos,e.markFromJSON(t.mark))}};Jt.jsonID("removeNodeMark",Ru);class Tt extends Jt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&ag(e,this.from,this.to)?rn.fail("Structure replace would overwrite content"):rn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new $i([this.from,this.to-this.from,this.slice.size])}invert(e){return new Tt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new Tt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Tt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?ae.empty:new ae(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Tt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?ae.empty:new ae(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Tt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Tt(t.from,t.to,ae.fromJSON(e,t.slice),!!t.structure)}}Jt.jsonID("replace",Tt);let mn=class Sf extends Jt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(ag(e,this.from,this.gapFrom)||ag(e,this.gapTo,this.to)))return rn.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return rn.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?rn.fromReplace(e,this.from,this.to,o):rn.fail("Content does not fit in gap")}getMap(){return new $i([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Sf(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new Sf(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Sf(t.from,t.to,t.gapFrom,t.gapTo,ae.fromJSON(e,t.slice),t.insert,!!t.structure)}};Jt.jsonID("replaceAround",mn);function ag(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function _3(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,d,u)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new Ns(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new sg(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function I3(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof av){let d=s.marks,u;for(;u=o.isInSet(d);)(a||(a=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let d=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let f=a[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>n.step(new Ns(s.from,s.to,s.style)))}function cg(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let d=i.child(a),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new Tt(l,u,ae.empty));else{o=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new Ns(l,u,d.marks[p]));if(r&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new ae(G.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new Tt(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let a=o.fillBefore(G.empty,!0);n.replace(l,l,new ae(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function L3(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function As(n){let e=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let t=n.depth,o=0,r=0;;--t){let i=n.$from.node(t),s=n.$from.index(t)+o,l=n.$to.indexAfter(t)-r;if(t<n.depth&&i.canReplace(s,l,e))return t;if(t==0||i.type.spec.isolating||!L3(i,s,l))break;s&&(o=1),l<i.childCount&&(r=1)}return null}function P3(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,d=l,u=G.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,u=G.from(o.node(m).copy(u)),f++):a--;let p=G.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=G.from(r.node(m).copy(p)),h++):d++;n.step(new mn(a,d,s,l,new ae(u.append(p),f,h),u.size-f,!0))}function dg(n,e,t=null,o=n){let r=V3(n,e),i=r&&z3(o,e);return i?r.map(Cv).concat({type:e,attrs:t}).concat(i.map(Cv)):null}function Cv(n){return{type:n,attrs:null}}function V3(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(o,r,s)?i:null}function z3(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let a=o;l&&a<r;a++)l=l.matchType(t.child(a).type);return!l||!l.validEnd?null:s}function H3(n,e,t){let o=G.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=G.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new mn(r,i,r,i,new ae(o,0,0),t.length,!0))}function F3(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&j3(n.doc,n.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&vv(n,s,l,i),cg(n,n.mapping.slice(i).map(l,1),o,void 0,d===null);let u=n.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return n.step(new mn(f,p,f+1,p-1,new ae(G.from(o.create(a,null,s.marks)),0,0),1,!0)),d===!0&&Sv(n,s,l,i),!1}})}function Sv(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function vv(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
250
- `))}})}function j3(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function U3(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new mn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ae(G.from(s),0,0),1,!0))}function er(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=t-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function W3(n,e,t=1,o){let r=n.doc.resolve(e),i=G.empty,s=G.empty;for(let l=r.depth,a=r.depth-t,d=t-1;l>a;l--,d--){i=G.from(r.node(l).copy(i));let u=o&&o[d];s=G.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}n.step(new Tt(e,e,new ae(i.append(s),t,t),!0))}function _r(n,e){let t=n.resolve(e),o=t.index();return Ev(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function q3(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Ev(n,e){return!!(n&&e&&!n.isLeaf&&q3(n,e))}function Du(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):t>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&Ev(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function K3(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let u=n.doc.resolve(e+t);vv(n,u.node(),u.before(),l)}s.inlineContent&&cg(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),d=a.map(e-t);if(n.step(new Tt(d,a.map(e+t,-1),ae.empty,!0)),o===!0){let u=n.doc.resolve(d);Sv(n,u.node(),u.before(),n.steps.length)}return n}function J3(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function _u(n,e,t=e,o=ae.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return Mv(r,i,o)?new Tt(e,t,o):new G3(r,i,o).fit()}function Mv(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let G3=class{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=G.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=G.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new ae(i,s,l);return e>-1?new mn(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new Tt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=ug(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(G.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=ug(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ae(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=ug(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new ae(ya(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new ae(ya(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||a==0||g.content.size)&&(f=y,u.push(Tv(g.mark(p.allowedMarks(g.marks)),d==1?a:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=ba(this.placed,t,G.from(u)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?ae.empty:new ae(ya(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new ae(ya(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!fg(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=fg(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:d}=this.frontier[l],u=fg(e,l,d,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ba(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=ba(this.placed,this.depth,G.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(G.empty,!0);e.childCount&&(this.placed=ba(this.placed,this.frontier.length,e))}};function ya(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ya(n.firstChild.content,e-1,t)))}function ba(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ba(n.lastChild.content,e-1,t)))}function ug(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Tv(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Tv(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(G.empty,!0)))),n.copy(o)}function fg(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!X3(t,i.content,s)?l:null}function X3(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function Y3(n){return n.spec.defining||n.spec.definingForContent}function Q3(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(Mv(r,i,o))return n.step(new Tt(e,t,o));let s=Av(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=Y3(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let k=r.node(y-1),x=r.index(y-1);if(k.canReplaceWith(x,x,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new ae(Nv(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function Nv(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(Nv(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(G.empty,!0))}return n}function Z3(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=J3(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new ae(G.from(o),0,0))}function eU(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Av(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function Av(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}let Ov=class vf extends Jt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return rn.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return rn.fromReplace(e,this.pos,this.pos+1,new ae(G.from(r),0,t.isLeaf?0:1))}getMap(){return $i.empty}invert(e){return new vf(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new vf(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new vf(t.pos,t.attr,t.value)}};Jt.jsonID("attr",Ov);let $v=class Vy extends Jt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return rn.ok(o)}getMap(){return $i.empty}invert(e){return new Vy(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Vy(t.attr,t.value)}};Jt.jsonID("docAttr",$v);let Os=class extends Error{};Os=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Os.prototype=Object.create(Error.prototype),Os.prototype.constructor=Os,Os.prototype.name="TransformError";let tU=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new D3}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Os(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=ae.empty){let r=_u(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new ae(G.from(o),0,0))}delete(e,t){return this.replace(e,t,ae.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return Q3(this,e,t,o),this}replaceRangeWith(e,t,o){return Z3(this,e,t,o),this}deleteRange(e,t){return eU(this,e,t),this}lift(e,t){return P3(this,e,t),this}join(e,t=1){return K3(this,e,t),this}wrap(e,t){return H3(this,e,t),this}setBlockType(e,t=e,o,r=null){return F3(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return U3(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new Ov(e,t,o)),this}setDocAttribute(e,t){return this.step(new $v(e,t)),this}addNodeMark(e,t){return this.step(new lg(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof nt)t.isInSet(o.marks)&&this.step(new Ru(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new Ru(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return W3(this,e,t,o),this}addMark(e,t,o){return _3(this,e,t,o),this}removeMark(e,t,o){return I3(this,e,t,o),this}clearIncompatible(e,t,o){return cg(this,e,t,o),this}};const pg=Object.create(null);let lt=class{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new nU(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=ae.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(d.pos),l?ae.empty:t),l==0&&_v(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),d=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),_v(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new tr(e):$s(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?$s(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):$s(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Bi(e.node(0))}static atStart(e){return $s(e,e,0,0,1)||new Bi(e)}static atEnd(e){return $s(e,e,e.content.size,e.childCount,-1)||new Bi(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=pg[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in pg)throw new RangeError("Duplicate use of selection JSON ID "+e);return pg[e]=t,t.prototype.jsonID=e,t}getBookmark(){return tr.between(this.$anchor,this.$head).getBookmark()}};lt.prototype.visible=!0;let nU=class{constructor(e,t){this.$from=e,this.$to=t}},Bv=!1;function Rv(n){!Bv&&!n.parent.inlineContent&&(Bv=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}let tr=class Ua extends lt{constructor(e,t=e){Rv(e),Rv(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return lt.near(o);let r=e.resolve(t.map(this.anchor));return new Ua(r.parent.inlineContent?r:o,o)}replace(e,t=ae.empty){if(super.replace(e,t),t==ae.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Ua&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Dv(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ua(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=lt.findFrom(t,o,!0)||lt.findFrom(t,-o,!0);if(i)t=i.$head;else return lt.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(lt.findFrom(e,-o,!0)||lt.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new Ua(e,t)}};lt.jsonID("text",tr);let Dv=class lN{constructor(e,t){this.anchor=e,this.head=t}map(e){return new lN(e.map(this.anchor),e.map(this.head))}resolve(e){return tr.between(e.resolve(this.anchor),e.resolve(this.head))}};class ot extends lt{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?lt.near(i):new ot(i)}content(){return new ae(G.from(this.node),0,0)}eq(e){return e instanceof ot&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new oU(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ot(e.resolve(t.anchor))}static create(e,t){return new ot(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ot.prototype.visible=!1,lt.jsonID("node",ot);let oU=class aN{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Dv(o,o):new aN(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&ot.isSelectable(o)?new ot(t):lt.near(t)}},Bi=class Ef extends lt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ae.empty){if(t==ae.empty){e.delete(0,e.doc.content.size);let o=lt.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ef(e)}map(e){return new Ef(e)}eq(e){return e instanceof Ef}getBookmark(){return rU}};lt.jsonID("all",Bi);const rU={map(){return this},resolve(n){return new Bi(n)}};function $s(n,e,t,o,r,i=!1){if(e.inlineContent)return tr.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&ot.isSelectable(l))return ot.create(n,t-(r<0?l.nodeSize:0))}else{let a=$s(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function _v(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof Tt||r instanceof mn))return;let i=n.mapping.maps[o],s;i.forEach((l,a,d,u)=>{s==null&&(s=u)}),n.setSelection(lt.near(n.doc.resolve(s),t))}function Iv(n,e){return!e||!n?n:n.bind(e)}let Iu=class{constructor(e,t,o){this.name=e,this.init=Iv(t.init,o),this.apply=Iv(t.apply,o)}};new Iu("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Iu("selection",{init(n,e){return n.selection||lt.atStart(e.doc)},apply(n){return n.selection}}),new Iu("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new Iu("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});const hg=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Lv(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Pv=(n,e,t)=>{let o=Lv(n,t);if(!o)return!1;let r=mg(o);if(!r){let s=o.blockRange(),l=s&&As(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(Kv(n,r,e,-1))return!0;if(o.parent.content.size==0&&(Bs(i,"end")||ot.isSelectable(i)))for(let s=o.depth;;s--){let l=_u(n.doc,o.before(s),o.after(s),ae.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Bs(i,"end")?lt.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):ot.create(a.doc,r.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},iU=(n,e,t)=>{let o=Lv(n,t);if(!o)return!1;let r=mg(o);return r?Vv(n,r,e):!1},sU=(n,e,t)=>{let o=Hv(n,t);if(!o)return!1;let r=gg(o);return r?Vv(n,r,e):!1};function Vv(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=_u(n.doc,i,a,ae.empty);if(!d||d.from!=i||d instanceof Tt&&d.slice.size>=a-i)return!1;if(t){let u=n.tr.step(d);u.setSelection(tr.create(u.doc,i)),t(u.scrollIntoView())}return!0}function Bs(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const zv=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=mg(o)}let s=i&&i.nodeBefore;return!s||!ot.isSelectable(s)?!1:(e&&e(n.tr.setSelection(ot.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function mg(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Hv(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Fv=(n,e,t)=>{let o=Hv(n,t);if(!o)return!1;let r=gg(o);if(!r)return!1;let i=r.nodeAfter;if(Kv(n,r,e,1))return!0;if(o.parent.content.size==0&&(Bs(i,"start")||ot.isSelectable(i))){let s=_u(n.doc,o.before(),o.after(),ae.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(Bs(i,"start")?lt.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):ot.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},jv=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=gg(o)}let s=i&&i.nodeAfter;return!s||!ot.isSelectable(s)?!1:(e&&e(n.tr.setSelection(ot.create(n.doc,i.pos)).scrollIntoView()),!0)};function gg(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const lU=(n,e)=>{let t=n.selection,o=t instanceof ot,r;if(o){if(t.node.isTextblock||!_r(n.doc,t.from))return!1;r=t.from}else if(r=Du(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(ot.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},aU=(n,e)=>{let t=n.selection,o;if(t instanceof ot){if(t.node.isTextblock||!_r(n.doc,t.to))return!1;o=t.to}else if(o=Du(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},cU=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&As(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Uv=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
251
- `).scrollIntoView()),!0)};function yg(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const dU=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),s=yg(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(lt.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Wv=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof Bi||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=yg(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(tr.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},qv=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(er(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&As(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function uU(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof ot&&e.selection.node.isBlock)return!o.parentOffset||!er(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,a=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=yg(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof tr||e.selection instanceof Bi)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=er(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=er(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!a&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return t&&t(u.scrollIntoView()),!0}}const fU=uU(),pU=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(ot.create(n.doc,r))),!0)};function hU(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||_r(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Kv(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&hU(n,e,t))return!0;let d=!a&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=G.empty;for(let b=s.length-1;b>=0;b--)m=G.from(s[b].create(null,m));m=G.from(r.copy(m));let g=n.tr.step(new mn(e.pos-1,h,e.pos,h,new ae(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&_r(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&a?null:lt.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&As(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&Bs(i,"start",!0)&&Bs(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=G.empty;for(let x=m.length-1;x>=0;x--)b=G.from(m[x].copy(b));let k=n.tr.step(new mn(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new ae(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Jv(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(tr.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const mU=Jv(-1),gU=Jv(1);function yU(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&dg(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Gv(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,d)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let u=t.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}o(i.scrollIntoView())}return!0}}function bg(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}bg(hg,Pv,zv),bg(hg,Fv,jv),bg(Uv,Wv,qv,fU),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function bU(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i);if(!s)return!1;let l=o?t.tr:null;return kU(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function kU(n,e,t,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Ou(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ou(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=dg(i,t,o,e);return l?(n&&wU(n,e,l,r,t),!0):!1}function wU(n,e,t,o,r){let i=G.empty;for(let u=t.length-1;u>=0;u--)i=G.from(t[u].type.create(t[u].attrs,i));n.step(new mn(e.start-(o?2:0),e.end,e.start,e.end,new ae(i,0,0),t.length,!0));let s=0;for(let u=0;u<t.length;u++)t[u].type==r&&(s=u+1);let l=t.length-s,a=e.start+t.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&er(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=d.child(u).nodeSize;return n}function xU(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?CU(e,t,n,i):SU(e,t,i):!0:!1}}function CU(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new mn(i-1,s,i,s,new ae(G.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Ou(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=As(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return _r(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function SU(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),s=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(a?G.empty:G.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new mn(f-(l?1:0),p+(a?1:0),f+1,p-1,new ae((l?G.empty:G.from(r.copy(G.empty))).append(a?G.empty:G.from(r.copy(G.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function vU(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let d=a.lastChild&&a.lastChild.type==l.type,u=G.from(d?n.create():null),f=new ae(G.from(n.create(null,G.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;t(e.tr.step(new mn(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}var EU=Object.defineProperty,kg=(n,e)=>{for(var t in e)EU(n,t,{get:e[t],enumerable:!0})};function Xv(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var MU=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:o}=this,{view:r}=t,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...d)=>{const u=a(...d)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l=[],a=!!e,d=e||i.tr,u=()=>(!a&&t&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(d),l.every(p=>p===!0)),f={...Object.fromEntries(Object.entries(o).map(([p,h])=>[p,(...m)=>{const g=this.buildProps(d,t),y=h(...m)(g);return l.push(y),f}])),run:u};return f}createCan(e){const{rawCommands:t,state:o}=this,r=!1,i=e||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...d)=>a(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,t=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l={tr:e,editor:r,view:s,state:Xv({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([a,d])=>[a,(...u)=>d(...u)(l)]))}};return l}},Yv={};kg(Yv,{blur:()=>TU,clearContent:()=>NU,clearNodes:()=>AU,command:()=>OU,createParagraphNear:()=>$U,cut:()=>BU,deleteCurrentNode:()=>RU,deleteNode:()=>DU,deleteRange:()=>_U,deleteSelection:()=>IU,enter:()=>LU,exitCode:()=>PU,extendMarkRange:()=>zU,first:()=>HU,focus:()=>UU,forEach:()=>WU,insertContent:()=>qU,insertContentAt:()=>GU,joinBackward:()=>QU,joinDown:()=>YU,joinForward:()=>ZU,joinItemBackward:()=>eW,joinItemForward:()=>tW,joinTextblockBackward:()=>nW,joinTextblockForward:()=>oW,joinUp:()=>XU,keyboardShortcut:()=>iW,lift:()=>sW,liftEmptyBlock:()=>lW,liftListItem:()=>aW,newlineInCode:()=>cW,resetAttributes:()=>dW,scrollIntoView:()=>uW,selectAll:()=>fW,selectNodeBackward:()=>pW,selectNodeForward:()=>hW,selectParentNode:()=>mW,selectTextblockEnd:()=>gW,selectTextblockStart:()=>yW,setContent:()=>kW,setMark:()=>IW,setMeta:()=>LW,setNode:()=>PW,setNodeSelection:()=>VW,setTextDirection:()=>zW,setTextSelection:()=>HW,sinkListItem:()=>FW,splitBlock:()=>jW,splitListItem:()=>UW,toggleList:()=>WW,toggleMark:()=>qW,toggleNode:()=>KW,toggleWrap:()=>JW,undoInputRule:()=>GW,unsetAllMarks:()=>XW,unsetMark:()=>YW,unsetTextDirection:()=>QW,updateAttributes:()=>ZW,wrapIn:()=>e4,wrapInList:()=>t4});var TU=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),NU=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),AU=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(a)),p=d.resolve(u.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=As(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},OU=n=>e=>n(e),$U=()=>({state:n,dispatch:e})=>Wv(n,e),BU=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new q(o.doc.resolve(Math.max(s-1,0)))),!0},RU=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const s=r.before(i),l=r.after(i);n.delete(s,l).scrollIntoView()}return!0}return!1};function Nt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var DU=n=>({tr:e,state:t,dispatch:o})=>{const r=Nt(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const l=i.before(s),a=i.after(s);e.delete(l,a).scrollIntoView()}return!0}return!1},_U=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},IU=()=>({state:n,dispatch:e})=>hg(n,e),LU=()=>({commands:n})=>n.keyboardShortcut("Enter"),PU=()=>({state:n,dispatch:e})=>dU(n,e);function VU(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Lu(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:VU(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function Qv(n,e,t={}){return n.find(o=>o.type===e&&Lu(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function Zv(n,e,t={}){return!!Qv(n,e,t)}function eE(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!Qv([...r.node.marks],e,t)))return;let i=r.index,s=n.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(;i>0&&Zv([...n.parent.child(i-1).marks],e,t);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&Zv([...n.parent.child(l).marks],e,t);)a+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function Ir(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var zU=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=Ir(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:d,to:u}=l;if(r){const f=eE(a,i,e);if(f&&f.from<=d&&f.to>=u){const p=q.create(s,f.from,f.to);t.setSelection(p)}}return!0},HU=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function tE(n){return n instanceof q}function Ri(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function FU(n,e=null){if(!e)return null;const t=ie.atStart(n),o=ie.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?q.create(n,Ri(0,r,i),Ri(n.content.size,r,i)):q.create(n,Ri(e,r,i),Ri(e,r,i))}function nE(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Pu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function jU(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var UU=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Pu()||nE())&&o.dom.focus(),jU()&&!Pu()&&!nE()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};try{if(o.hasFocus()&&n===null||n===!1)return!0}catch{return!1}if(i&&n===null&&!tE(t.state.selection))return s(),!0;const l=FU(r.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},WU=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),qU=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),oE=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&oE(o)}return n};function Vu(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return oE(t)}function ka(n,e,t){if(n instanceof Oi||n instanceof G)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return G.fromArray(n.map(s=>e.nodeFromJSON(s)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),ka("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new M3({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?tg.fromSchema(a).parseSlice(Vu(n),t.parseOptions):tg.fromSchema(a).parse(Vu(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=tg.fromSchema(e);return t.slice?i.parseSlice(Vu(n),t.parseOptions).content:i.parse(Vu(n),t.parseOptions)}return ka("",e,t)}function KU(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof Tt||r instanceof mn))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,d,u)=>{s===0&&(s=u)}),n.setSelection(ie.near(n.doc.resolve(s),t))}var JU=n=>!("type"in n),GU=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ka(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=ka(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return a(g),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((JU(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===f&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,f+=1)}let m;if(p){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof G){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;o.insertText(m,u,f)}else{m=l;const g=o.doc.resolve(u),y=g.node(),b=g.parentOffset===0,k=y.isText||y.isTextblock,x=y.content.size>0;b&&k&&x&&(u=Math.max(0,u-1)),o.replaceWith(u,f,m)}t.updateSelection&&KU(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:m}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:m})}return!0},XU=()=>({state:n,dispatch:e})=>lU(n,e),YU=()=>({state:n,dispatch:e})=>aU(n,e),QU=()=>({state:n,dispatch:e})=>Pv(n,e),ZU=()=>({state:n,dispatch:e})=>Fv(n,e),eW=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Du(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},tW=()=>({state:n,dispatch:e,tr:t})=>{try{const o=Du(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},nW=()=>({state:n,dispatch:e})=>iU(n,e),oW=()=>({state:n,dispatch:e})=>sU(n,e);function rE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function rW(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Pu()||rE()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var iW=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=rW(n).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,l))});return a==null||a.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function Rs(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?Nt(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(u,f)=>{if(u.isText)return;const p=Math.max(o,f),h=Math.min(r,f+u.nodeSize);l.push({node:u,from:p,to:h})});const a=r-o,d=l.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Lu(u.node.attrs,t,{strict:!1}));return i?!!d.length:d.reduce((u,f)=>u+f.to-f.from,0)>=a}var sW=(n,e={})=>({state:t,dispatch:o})=>{const r=Nt(n,t.schema);return Rs(t,r,e)?cU(t,o):!1},lW=()=>({state:n,dispatch:e})=>qv(n,e),aW=n=>({state:e,dispatch:t})=>{const o=Nt(n,e.schema);return xU(o)(e,t)},cW=()=>({state:n,dispatch:e})=>Uv(n,e);function iE(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function sE(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var dW=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=iE(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=Nt(n,o.schema)),l==="mark"&&(s=Ir(n,o.schema));let a=!1;return t.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,sE(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+u.nodeSize,s.create(sE(p.attrs,e))))})})}),a},uW=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),fW=()=>({tr:n,dispatch:e})=>{if(e){const t=new tn(n.doc);n.setSelection(t)}return!0},pW=()=>({state:n,dispatch:e})=>zv(n,e),hW=()=>({state:n,dispatch:e})=>jv(n,e),mW=()=>({state:n,dispatch:e})=>pU(n,e),gW=()=>({state:n,dispatch:e})=>gU(n,e),yW=()=>({state:n,dispatch:e})=>mU(n,e);function bW(n,e,t={},o={}){return ka(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var kW=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(o.preserveWhitespace!=="full"){const d=bW(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,d).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function wW(n,e){const t=Ir(e,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function xW(n,e){const t=new tU(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function CW(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function SW(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function zu(n){return e=>SW(e.$from,n)}function wa(n,e,t){return n.config[e]===void 0&&n.parent?wa(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?wa(n.parent,e,t):null}):n.config[e]}function vW(n){return typeof n=="function"}function Hu(n,e=void 0,...t){return vW(n)?e?n.bind(e)(...t):n(...t):n}function lE(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function Di(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const s=i?String(i).split(" "):[],l=o[r]?o[r].split(" "):[],a=s.filter(d=>!l.includes(d));o[r]=[...l,...a].join(" ")}else if(r==="style"){const s=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],l=o[r]?o[r].split(";").map(d=>d.trim()).filter(Boolean):[],a=new Map;l.forEach(d=>{const[u,f]=d.split(":").map(p=>p.trim());a.set(u,f)}),s.forEach(d=>{const[u,f]=d.split(":").map(p=>p.trim());a.set(u,f)}),o[r]=Array.from(a.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else o[r]=i}),o},{})}function EW(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>Di(t,o),{})}function MW(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
252
-
253
- `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,d,u,f)=>{var p;a.isBlock&&d>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return u&&(l+=h({node:a,pos:d,parent:u,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function TW(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function NW(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function AW(n){const e=NW(n);return e.length===1?e:e.filter((t,o)=>!e.filter((r,i)=>i!==o).some(r=>t.oldRange.from>=r.oldRange.from&&t.oldRange.to<=r.oldRange.to&&t.newRange.from>=r.newRange.from&&t.newRange.to<=r.newRange.to))}function OW(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(a),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),AW(o)}var $W=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function Fu(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function BW(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?Ir(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Lu(u.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:u,$to:f})=>{const p=u.pos,h=f.pos;n.doc.nodesBetween(p,h,(m,g)=>{if(i&&m.inlineContent&&!m.type.allowsMarkType(i))return!1;if(!m.isText&&!m.marks.length)return;const y=Math.max(p,g),b=Math.min(h,g+m.nodeSize),k=b-y;s+=k,l.push(...m.marks.map(x=>({mark:x,from:y,to:b})))})}),s===0)return!1;const a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Lu(u.mark.attrs,t,{strict:!1})).reduce((u,f)=>u+f.to-f.from,0),d=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+d:a)>=s}var RW=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=zu(l=>l.type.name===e)(n.selection);if(!i)return!1;const s=n.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},DW=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function aE(n,e){const{nodeExtensions:t}=lE(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Hu(wa(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function cE(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(cE(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function _W(n,e,t){var o;const{selection:r}=e;let i=null;if(tE(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(a=>a.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let d=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var IW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=Ir(n,o.schema);if(r)if(s){const d=wW(o,a);t.addStoredMark(a.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),g=Math.min(h+p.nodeSize,f);p.marks.find(y=>y.type===a)?p.marks.forEach(y=>{a===y.type&&t.addMark(m,g,a.create({...y.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return _W(o,t,a)},LW=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),PW=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=Nt(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Gv(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Gv(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},VW=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=Ri(n,0,o.content.size),i=Q.create(o,r);e.setSelection(i)}return!0},zW=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(a,d)=>{a.isText||t.setNodeMarkup(d,void 0,{...a.attrs,dir:n})}),!0},HW=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=q.atStart(o).from,l=q.atEnd(o).to,a=Ri(r,s,l),d=Ri(i,s,l),u=q.create(o,a,d);e.setSelection(u)}return!0},FW=n=>({state:e,dispatch:t})=>{const o=Nt(n,e.schema);return vU(o)(e,t)};function dE(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e==null?void 0:e.includes(r.type.name));n.tr.ensureMarks(o)}}var jW=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,d=r.extensionManager.attributes,u=Fu(d,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!er(s,l.pos)?!1:(o&&(n&&dE(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,p=l.depth===0?void 0:CW(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=er(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&er(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof q&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&dE(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},UW=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=Nt(n,o.schema),{$from:a,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(d))return!1;const f=a.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let b=G.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-k;T>=a.depth-3;T-=1)b=G.from(a.node(T).copy(b));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,w={...Fu(p,a.node().type.name,a.node().attrs),...e},C=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(w))||void 0;b=b.append(G.from(l.createAndFill(null,C)||void 0));const v=a.before(a.depth-(k-1));t.replace(v,a.after(-x),new ae(b,4-k,0));let E=-1;t.doc.nodesBetween(v,t.doc.content.size,(T,A)=>{if(E>-1)return!1;T.isTextblock&&T.content.size===0&&(E=A+1)}),E>-1&&t.setSelection(q.near(t.doc.resolve(E))),t.scrollIntoView()}return!0}const h=d.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...Fu(p,f.type.name,f.attrs),...e},g={...Fu(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,d.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!er(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:k}=o,{splittableMarks:x}=i.extensionManager,w=k||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!w||!r)return!0;const C=w.filter(v=>x.includes(v.type.name));t.ensureMarks(C)}return!0},wg=(n,e)=>{const t=zu(i=>i.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&_r(n.doc,t.pos)&&n.join(t.pos),!0},xg=(n,e)=>{const t=zu(i=>i.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&_r(n.doc,o)&&n.join(o),!0},WW=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=Nt(n,s.schema),m=Nt(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:k}=g,x=b.blockRange(k),w=y||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const C=zu(v=>aE(v.type.name,f))(g);if(x.depth>=1&&C&&x.depth-C.depth<=1){if(C.node.type===h)return d.liftListItem(m);if(aE(C.node.type.name,f)&&h.validContent(C.node.content)&&l)return a().command(()=>(i.setNodeMarkup(C.pos,h),!0)).command(()=>wg(i,h)).command(()=>xg(i,h)).run()}return!t||!w||!l?a().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>wg(i,h)).command(()=>xg(i,h)).run():a().command(()=>{const v=u().wrapInList(h,o),E=w.filter(T=>p.includes(T.type.name));return i.ensureMarks(E),v?!0:d.clearNodes()}).wrapInList(h,o).command(()=>wg(i,h)).command(()=>xg(i,h)).run()},qW=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=Ir(n,o.schema);return BW(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},KW=(n,e,t={})=>({state:o,commands:r})=>{const i=Nt(n,o.schema),s=Nt(e,o.schema),l=Rs(o,i,t);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...t})},JW=(n,e={})=>({state:t,commands:o})=>{const r=Nt(n,t.schema);return Rs(t,r,e)?o.lift(r):o.wrapIn(r,e)},GW=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},XW=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},YW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Ir(n,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=eE(d,a,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,a)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,a)});return t.removeStoredMark(a),!0},QW=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,s;return typeof n=="number"?(i=n,s=n):n&&"from"in n&&"to"in n?(i=n.from,s=n.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(a,void 0,d)}),!0},ZW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=iE(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=Nt(n,o.schema)),l==="mark"&&(s=Ir(n,o.schema));let a=!1;return t.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(u,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(u,f,(y,b)=>{b<u&&i&&i===y.type&&(a=!0,m=Math.max(b,u),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=u&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(k=>{if(s===k.type&&(a=!0,r)){const x=Math.max(b,u),w=Math.min(b+y.nodeSize,f);t.addMark(x,w,s.create({...k.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&r&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),a},e4=(n,e={})=>({state:t,dispatch:o})=>{const r=Nt(n,t.schema);return yU(r,e)(t,o)},t4=(n,e={})=>({state:t,dispatch:o})=>{const r=Nt(n,t.schema);return bU(r,e)(t,o)},n4=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}};function o4(n){return Object.prototype.toString.call(n).slice(8,-1)}function ju(n){return o4(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function uE(n,e){const t={...n};return ju(n)&&ju(e)&&Object.keys(e).forEach(o=>{ju(e[o])&&ju(n[o])?t[o]=uE(n[o],e[o]):t[o]=e[o]}),t}var fE=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...Hu(wa(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Hu(wa(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>uE(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},r4={};kg(r4,{ClipboardTextSerializer:()=>i4,Commands:()=>s4,Delete:()=>l4,Drop:()=>a4,Editable:()=>c4,FocusEvents:()=>d4,Keymap:()=>u4,Paste:()=>f4,Tabindex:()=>p4,TextDirection:()=>h4,focusEventsPluginKey:()=>pE});var Un=class cN extends fE{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new cN(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},i4=Un.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ce({key:new le("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(d=>d.$from.pos)),l=Math.max(...i.map(d=>d.$to.pos)),a=TW(t);return MW(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),s4=Un.create({name:"commands",addCommands(){return{...Yv}}}),l4=Un.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,d;if((d=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?d:n.getMeta("y-sync$"))return;const u=xW(n.before,[n,...e]);OW(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{const g=m+h.nodeSize-2,y=p.oldRange.from<=m&&g<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((p,h)=>{var m,g;if(p instanceof Ns){const y=f.slice(h).map(p.from,-1),b=f.slice(h).map(p.to),k=f.invert().map(y,-1),x=f.invert().map(b),w=(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(v=>v.eq(p.mark)),C=(g=u.doc.nodeAt(b))==null?void 0:g.marks.some(v=>v.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:k,to:x},newRange:{from:y,to:b},partial:!!(C||w),editor:this.editor,transaction:n,combinedTransform:u})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),a4=Un.create({name:"drop",addProseMirrorPlugins(){return[new ce({key:new le("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),c4=Un.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),pE=new le("focusEvents"),d4=Un.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ce({key:pE,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),u4=Un.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{const{selection:l,doc:a}=s,{empty:d,$anchor:u}=l,{pos:f,parent:p}=u,h=u.parent.isTextblock&&f>0?s.doc.resolve(f-1):u,m=h.parent.type.spec.isolating,g=u.pos-u.parentOffset,y=m&&h.parent.childCount===1?g===u.pos:ie.atStart(a).from===f;return!d||!p.type.isTextblock||p.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),t={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...t},r={...t,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Pu()||rE()?r:o},addProseMirrorPlugins(){return[new ce({key:new le("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(h=>h.getMeta("composition")))return;const o=n.some(h=>h.docChanged)&&!e.doc.eq(t.doc),r=n.some(h=>h.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,a=ie.atStart(e.doc).from,d=ie.atEnd(e.doc).to;if(i||!(s===a&&l===d)||!cE(t.doc))return;const u=t.tr,f=Xv({state:t,transaction:u}),{commands:p}=new MU({editor:this.editor,state:f});if(p.clearNodes(),!!u.steps.length)return u}})]}}),f4=Un.create({name:"paste",addProseMirrorPlugins(){return[new ce({key:new le("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),p4=Un.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),h4=Un.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=lE(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ce({key:new le("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});function xa(n){return new n4({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=Hu(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),l=s.doc.resolve(t.from).blockRange(),a=l&&dg(l,n.type,i);if(!a)return null;if(s.wrap(l,a),n.keepMarks&&n.editor){const{selection:u,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,h=f||u.$to.parentOffset&&u.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(u,i).run()}const d=s.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&_r(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,d))&&s.join(t.from-1)},undoable:n.undoable})}var m4={};kg(m4,{createAtomBlockMarkdownSpec:()=>g4,createBlockMarkdownSpec:()=>y4,createInlineMarkdownSpec:()=>w4,parseAttributes:()=>Cg,parseIndentedBlocks:()=>vg,renderNestedMarkdownContent:()=>Eg,serializeAttributes:()=>Sg});function Cg(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,a=>(t.push(a),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const a=r.map(d=>d.trim().slice(1));e.class=a.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,a,d])=>{var u;const f=parseInt(((u=d.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),p=t[f];p&&(e[a]=p.slice(1,-1))});const l=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(a=>{a.match(/^[a-zA-Z][\w-]*$/)&&(e[a]=!0)}),e}function Sg(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(t=>e.push(`.${t}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function g4(n){const{nodeName:e,name:t,parseAttributes:o=Cg,serializeAttributes:r=Sg,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...i,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!s.find(b=>!(b in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function y4(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Cg,serializeAttributes:i=Sg,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,d=t||e,u=f=>{if(!a)return f;const p={};return a.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,k=""]=y,x=r(k);let w=1;const C=b.length;let v="";const E=/^:::([\w-]*)(\s.*)?/gm,T=f.slice(C);for(E.lastIndex=0;;){const A=E.exec(T);if(A===null)break;const $=A.index,O=A[1];if(!((m=A[2])!=null&&m.endsWith(":::"))){if(O)w+=1;else if(w-=1,w===0){const B=T.slice(0,$);v=B.trim();const _=f.slice(0,C+$+A[0].length);let D=[];if(v)if(l==="block")for(D=h.blockTokens(B),D.forEach(P=>{P.text&&(!P.tokens||P.tokens.length===0)&&(P.tokens=h.inlineTokens(P.text))});D.length>0;){const P=D[D.length-1];if(P.type==="paragraph"&&(!P.text||P.text.trim()===""))D.pop();else break}else D=h.inlineTokens(v);return{type:e,raw:_,attributes:x,content:v,tokens:D}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
254
-
255
- `);return`:::${d}${g}
256
-
257
- ${y}
258
-
259
- :::`}}}function b4(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=t.exec(n)}return e}function k4(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function w4(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=b4,serializeAttributes:i=k4,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,d=t||e,u=p=>{if(!a)return p;const h={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const b=p[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",k="";if(l){const[,w]=y;k=w}else{const[,w,C]=y;k=w,b=C||""}const x=r(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:x}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=u(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function vg(n,e,t){var o,r,i,s;const l=n.split(`
260
- `),a=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<l.length;){const p=l[u],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){u+=1,d=`${d}${p}
261
- `;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;d=`${d}${p}
262
- `;const b=[y];for(u+=1;u<l.length;){const C=l[u];if(C.trim()===""){const v=l.slice(u+1).findIndex(E=>E.trim()!=="");if(v===-1)break;if((((r=(o=l[u+1+v].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(C),d=`${d}${C}
263
- `,u+=1;continue}else break}if((((s=(i=C.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(C),d=`${d}${C}
264
- `,u+=1;else break}let k;const x=b.slice(1);if(x.length>0){const C=x.map(v=>v.slice(g+f)).join(`
265
- `);C.trim()&&(e.customNestedParser?k=e.customNestedParser(C):k=t.blockTokens(C))}const w=e.createToken(m,k);a.push(w)}if(a.length!==0)return{items:a,raw:d}}function Eg(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...s]=n.content,l=e.renderChildren([i]),a=[`${r}${l}`];return s&&s.length>0&&s.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
266
- `).map(p=>p?e.indent(p):"").join(`
267
- `);a.push(f)}}),a.join(`
268
- `)}var Ca=class dN extends fE{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new dN(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},x4=Object.defineProperty,C4=(n,e)=>{for(var t in e)x4(n,t,{get:e[t],enumerable:!0})},S4="listItem",hE="textStyle",mE=/^\s*([-+*])\s$/,v4=Ca.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Di(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
269
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(S4,this.editor.getAttributes(hE)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=xa({find:mE,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=xa({find:mE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(hE),editor:this.editor})),[n]}}),E4=Ca.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Di(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(o=>o.type==="paragraph"))t=e.parseChildren(n.tokens);else{const o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const r=n.tokens.slice(1),i=e.parseChildren(r);t.push(...i)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Eg(n,e,o=>{var r,i;return o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${(((i=(r=o.meta)==null?void 0:r.parentAttrs)==null?void 0:i.start)||1)+o.index}. `:"- "},t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),M4={};C4(M4,{findListItemPos:()=>Sa,getNextListDepth:()=>Mg,handleBackspace:()=>Tg,handleDelete:()=>Ng,hasListBefore:()=>gE,hasListItemAfter:()=>T4,hasListItemBefore:()=>yE,listItemHasSubList:()=>bE,nextListIsDeeper:()=>kE,nextListIsHigher:()=>wE});var Sa=(n,e)=>{const{$from:t}=e.selection,o=Nt(n,e.schema);let r=null,i=t.depth,s=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Mg=(n,e)=>{const t=Sa(n,e);if(!t)return!1;const[,o]=$W(e,n,t.$pos.pos+4);return o},gE=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},yE=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},bE=(n,e,t)=>{if(!t)return!1;const o=Nt(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Tg=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Rs(n.state,e)&&gE(n.state,e,t)){const{$anchor:s}=n.state.selection,l=n.state.doc.resolve(s.before()-1),a=[];l.node().descendants((f,p)=>{f.type.name===e&&a.push({node:f,pos:p})});const d=a.at(-1);if(!d)return!1;const u=n.state.doc.resolve(l.start()+d.pos+1);return n.chain().cut({from:s.start()-1,to:s.end()+1},u.end()).joinForward().run()}if(!Rs(n.state,e)||!DW(n.state))return!1;const o=Sa(e,n.state);if(!o)return!1;const r=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),i=bE(e,n.state,r);return yE(e,n.state)&&!i?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},kE=(n,e)=>{const t=Mg(n,e),o=Sa(n,e);return!o||!t?!1:t>o.depth},wE=(n,e)=>{const t=Mg(n,e),o=Sa(n,e);return!o||!t?!1:t<o.depth},Ng=(n,e)=>{if(!Rs(n.state,e)||!RW(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:kE(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():wE(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},T4=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},N4=Un.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ng(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ng(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Tg(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Tg(n,t,o)&&(e=!0)}),e}}}}),xE=/^(\s*)(\d+)\.\s+(.*)$/,A4=/^\s/;function O4(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(xE);if(!i)break;const[,s,l,a]=i,d=s.length;let u=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(xE))break;if(h.trim()==="")p.push(h),u+=`
270
- `,f+=1;else if(h.match(A4))p.push(h),u+=`
271
- ${h.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:u.trim(),raw:p.join(`
272
- `)}),o=f,t=f}return[e,o]}function CE(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const l=s.content.split(`
273
- `),a=((o=l[0])==null?void 0:o.trim())||"",d=[];a&&d.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const u=l.slice(1).join(`
274
- `).trim();if(u){const h=t.blockTokens(u);d.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(g=>g.indent)),m=CE(p,h,t);d.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(g=>g.raw).join(`
275
- `)})}r.push({type:"list_item",raw:s.raw,tokens:d}),i=f}else i+=1}return r}function $4(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var B4="listItem",SE="textStyle",vE=/^(\d+)\.\s$/,R4=Ca.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:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Di(this.options.HTMLAttributes,t),0]:["ol",Di(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?$4(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
276
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
277
- `),[i,s]=O4(r);if(i.length===0)return;const l=CE(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
278
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(B4,this.editor.getAttributes(SE)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=xa({find:vE,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=xa({find:vE,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(SE)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),D4=/^\s*(\[([( |x])?\])\s$/,EE=Ca.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:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Di(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const o=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Eg(n,e,o)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),d=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,s),r.append(i,a),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const p=o.extensionManager.attributes,h=EW(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return u.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,b])=>{b==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,b)}),u=m,!0}}}},addInputRules(){return[xa({find:D4,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),_4=Ca.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:n}){return["ul",Di(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
279
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const s=vg(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:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:o},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(i)},r=vg(n,{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:t.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Un.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(v4.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(E4.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(N4.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(R4.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(EE.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(_4.configure(this.options.taskList)),n}});var I4=EE;const ME=I4.extend({content:"paragraph block* taskList?",addKeyboardShortcuts(){return{Tab:()=>this.editor.can().sinkListItem(this.type)?this.editor.commands.sinkListItem(this.type):!1,"Shift-Tab":()=>this.editor.can().liftListItem(this.type)?this.editor.commands.liftListItem(this.type):!1,Enter:()=>{const{$from:n}=this.editor.state.selection;return n.parent.textContent.length===0?this.editor.can().liftListItem(this.type)?this.editor.commands.liftListItem(this.type):!1:this.editor.can().splitListItem(this.type)?this.editor.commands.splitListItem(this.type):!1}}}});/**
280
- * Copyright 2026 Yiitap
281
- * @license MIT
282
- **/function L4(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,d=Kp(t),u=new RegExp(`\\s${d}$`),f=s?"^":"",p=r?"":d,h=a?new RegExp(`${f}${d}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${d}[^\\s${p}]*`,"gm"),m=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,y=Array.from(m.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!k)return null;const x=g+y.index;let w=x+y[0].length;return a&&u.test(m.slice(w-1,w+1))&&(y[0]+=" ",w+=1),x<l.pos&&w>=l.pos?{range:{from:x,to:w},query:y[0].slice(t.length),text:y[0]}:null}var P4=new le("suggestion");function V4({pluginKey:n=P4,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=L4,shouldShow:y}){let b;const k=h==null?void 0:h(),x=()=>{const E=e.state.selection.$anchor.pos,T=e.view.coordsAtPos(E),{top:A,right:$,bottom:O,left:B}=T;try{return new DOMRect(B,A,$-B,O-A)}catch{return null}},w=(E,T)=>T?()=>{const A=n.getState(e.state),$=A==null?void 0:A.decorationId,O=E.dom.querySelector(`[data-decoration-id="${$}"]`);return(O==null?void 0:O.getBoundingClientRect())||null}:x;function C(E,T){var A;try{const O=n.getState(E.state),B=O!=null&&O.decorationId?E.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`):null,_={editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},query:(O==null?void 0:O.query)||null,text:(O==null?void 0:O.text)||null,items:[],command:D=>f({editor:e,range:(O==null?void 0:O.range)||{from:0,to:0},props:D}),decorationNode:B,clientRect:w(E,B)};(A=k==null?void 0:k.onExit)==null||A.call(k,_)}catch{}const $=E.state.tr.setMeta(T,{exit:!0});E.dispatch($)}const v=new ce({key:n,view(){return{update:async(E,T)=>{var A,$,O,B,_,D,P;const R=(A=this.key)==null?void 0:A.getState(T),K=($=this.key)==null?void 0:$.getState(E.state),H=R.active&&K.active&&R.range.from!==K.range.from,W=!R.active&&K.active,ge=R.active&&!K.active,Ee=!W&&!ge&&R.query!==K.query,Le=W||H&&Ee,We=Ee||H,Fe=ge||H&&Ee;if(!Le&&!We&&!Fe)return;const Ae=Fe&&!Le?R:K,je=E.dom.querySelector(`[data-decoration-id="${Ae.decorationId}"]`);b={editor:e,range:Ae.range,query:Ae.query,text:Ae.text,items:[],command:At=>f({editor:e,range:Ae.range,props:At}),decorationNode:je,clientRect:w(E,je)},Le&&((O=k==null?void 0:k.onBeforeStart)==null||O.call(k,b)),We&&((B=k==null?void 0:k.onBeforeUpdate)==null||B.call(k,b)),(We||Le)&&(b.items=await p({editor:e,query:Ae.query})),Fe&&((_=k==null?void 0:k.onExit)==null||_.call(k,b)),We&&((D=k==null?void 0:k.onUpdate)==null||D.call(k,b)),Le&&((P=k==null?void 0:k.onStart)==null||P.call(k,b))},destroy:()=>{var E;b&&((E=k==null?void 0:k.onExit)==null||E.call(k,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(E,T,A,$){const{isEditable:O}=e,{composing:B}=e.view,{selection:_}=E,{empty:D,from:P}=_,R={...T},K=E.getMeta(n);if(K&&K.exit)return R.active=!1,R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null,R;if(R.composing=B,O&&(D||e.view.composing)){(P<T.range.from||P>T.range.to)&&!B&&!T.composing&&(R.active=!1);const H=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:_.$from}),W=`id_${Math.floor(Math.random()*4294967295)}`;H&&m({editor:e,state:$,range:H.range,isActive:T.active})&&(!y||y({editor:e,range:H.range,query:H.query,text:H.text,transaction:E}))?(R.active=!0,R.decorationId=T.decorationId?T.decorationId:W,R.range=H.range,R.query=H.query,R.text=H.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(E,T){var A,$,O,B;const{active:_,range:D}=v.getState(E.state);if(!_)return!1;if(T.key==="Escape"||T.key==="Esc"){const P=v.getState(E.state),R=(A=b==null?void 0:b.decorationNode)!=null?A:null,K=R??(P!=null&&P.decorationId?E.dom.querySelector(`[data-decoration-id="${P.decorationId}"]`):null);if(($=k==null?void 0:k.onKeyDown)!=null&&$.call(k,{view:E,event:T,range:P.range}))return!0;const H={editor:e,range:P.range,query:P.query,text:P.text,items:[],command:W=>f({editor:e,range:P.range,props:W}),decorationNode:K,clientRect:K?()=>K.getBoundingClientRect()||null:null};return(O=k==null?void 0:k.onExit)==null||O.call(k,H),C(E,n),!0}return((B=k==null?void 0:k.onKeyDown)==null?void 0:B.call(k,{view:E,event:T,range:D}))||!1},decorations(E){const{active:T,range:A,decorationId:$,query:O}=v.getState(E);if(!T)return null;const B=!(O!=null&&O.length),_=[a];return B&&_.push(u),Se.create(E.doc,[ze.inline(A.from,A.to,{nodeName:l,class:_.join(" "),"data-decoration-id":$,"data-decoration-content":d})])}}});return v}var Uu=V4;const z4=me.create({name:"char-command",addOptions(){return{pluginKey:"char-command",suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Uu({pluginKey:new le(this.options.pluginKey),editor:this.editor,...this.options.suggestion})]}}),TE=me.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Uu({pluginKey:new le("colon-command"),editor:this.editor,...this.options.suggestion})]}}),NE=me.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Uu({pluginKey:new le("slash-command"),editor:this.editor,...this.options.suggestion})]}}),AE=me.create({name:"slash-zh-command",addOptions(){return{suggestion:{char:"、",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[Uu({pluginKey:new le("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}}),H4={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:n,tr:e}=de(),{run:t}=xe();return{locale:n,tr:e,run:t}},data(){return{view:"main"}},components:{OEmojiSelect:zd},methods:{onSelect(n){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(n.emoji),this.editor.chain().focus()},onKeyDown({event:n}){return!1}}},Ag=(n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t},F4={class:"o-colon-view"};function j4(n,e,t,o,r,i){const s=c.resolveComponent("o-emoji-select");return c.openBlock(),c.createElementBlock("section",F4,[c.createVNode(s,{items:t.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const U4=Ag(H4,[["render",j4]]),OE={items:({query:n})=>qs.filterEmojiGroups(n),render:()=>{let n,e;return{onStart:t=>{n=new Vc(U4,{props:t,editor:t.editor}),t.clientRect&&(e=Go("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(o){o.popper.classList.add("emoji-tippy")}}))},onUpdate(t){n.updateProps(t),e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var o;return t.event.key==="Escape"?(e[0].hide(),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},W4={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:St},range:{type:Object}},setup(){const{locale:n,tr:e}=de(),{onCommand:t,run:o}=xe();return{locale:n,tr:e,onCommand:t,run:o}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:_t,OIcon:X,OList:Et,OListItem:kt},watch:{items(){this.selectedIndex=0}},methods:{onClick(n){switch(n.value){default:this.runCommand(n);break}return!0},runCommand(n){const e=this.editor.chain().focus().deleteRange(this.range),t=this.editor.commands;["blockMath","codeBlock","content","details","diagram","emoji","inlineMath","multiColumn","taskList"].includes(n.value)?(t.deleteRange(this.range),this.run(this.editor,n.value,n.options)):this.onCommand(t,e,n.value,n.options)},onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];e&&this.onClick(e)},setEmoji(n){this.onClick({value:"content",options:{content:n}})}},computed:{basicBlocks(){return ql.slice(1)}},mounted(){this.selectedIndex=0}},q4={key:0,class:"view-main"},K4={class:"group o-tips"},J4={class:"o-tips"},G4={key:1,class:"item"},X4={key:1,class:"view-emoji"},Y4={key:2,class:"view-emoji"};function Q4(n,e,t,o,r,i){const s=c.resolveComponent("o-divider"),l=c.resolveComponent("o-icon"),a=c.resolveComponent("o-list-item"),d=c.resolveComponent("o-list");return c.openBlock(),c.createElementBlock("section",{class:c.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${r.view}`])},[r.view==="main"?(c.openBlock(),c.createElementBlock("section",q4,[c.createVNode(d,{hoverable:"",clickable:""},{default:c.withCtx(()=>[t.items.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(t.items,(u,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[u.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[f>0?(c.openBlock(),c.createBlock(s,{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",K4,c.toDisplayString(o.tr(u.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(a,{class:c.normalizeClass(["item",{"is-active":f===r.selectedIndex}]),clickable:"",onClick:p=>i.onClick(u)},{prefix:c.withCtx(()=>[c.createVNode(l,{name:u.icon,color:u.color},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("span",J4,c.toDisplayString(u.tips),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(o.tr(u.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",G4,"No result"))]),_:1})])):r.view==="emoji"?(c.openBlock(),c.createElementBlock("section",X4)):r.view==="ai"?(c.openBlock(),c.createElementBlock("section",Y4)):c.createCommentVNode("",!0)],2)}const Z4=Ag(W4,[["render",Q4]]),Og={items:({query:n})=>Pd.filter(e=>{var t;return e.value.toLowerCase().includes(n.toLowerCase())||((t=e.keywords)==null?void 0:t.toLowerCase().includes(n.toLowerCase()))}),render:()=>{let n,e;return{onStart:t=>{n=new Vc(Z4,{props:t,editor:t.editor}),t.clientRect&&(e=Go("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:o=>{o.popper.classList.add("slash-tippy")}}))},onUpdate(t){n.updateProps(t),e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var o;return t.event.key==="Escape"?(e[0].hide(),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},e5={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];e&&this.command({name:e.name})}}},t5={class:"dropdown-menu"},n5=["onClick"],o5=["src"];function r5(n,e,t,o,r,i){return c.openBlock(),c.createElementBlock("div",t5,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.items,(s,l)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass({"is-selected":l===r.selectedIndex}),key:l,onClick:a=>i.selectItem(l)},[s.fallbackImage?(c.openBlock(),c.createElementBlock("img",{key:0,src:s.fallbackImage,align:"middle"},null,8,o5)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(s.emoji),1)],64)),c.createTextVNode(" :"+c.toDisplayString(s.name)+": ",1)],10,n5))),128))])}const i5=Ag(e5,[["render",r5]]),s5={items:({editor:n,query:e})=>n.storage.emoji.emojis.filter(({shortcodes:t,tags:o})=>t.find(r=>r.startsWith(e.toLowerCase()))||o.find(r=>r.startsWith(e.toLowerCase()))).slice(0,10),render:()=>{let n;function e(t){if(!n||!n.element)return;Yd({getBoundingClientRect(){return t}},n.element,{placement:"bottom-start"}).then(r=>{Object.assign(n.element.style,{left:`${r.x}px`,top:`${r.y}px`,position:r.strategy==="fixed"?"fixed":"absolute"})})}return{onStart:t=>{n=new Vc(i5,{props:t,editor:t.editor}),document.body.appendChild(n.element),e(t.clientRect())},onUpdate(t){n.updateProps(t),e(t.clientRect())},onKeyDown(t){var o;return t.event.key==="Escape"?(document.body.removeChild(n.element),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){document.body.contains(n.element)&&document.body.removeChild(n.element),n.destroy()}}}};/**
283
- * Copyright 2026 Yiitap
284
- * @license MIT
285
- **/const l5=Oe.create({name:"aiBlock",group:"block",content:"block+",draggable:!0,addOptions(){return{provider:{provider:""},onStreamingChatCompletion:void 0,HTMLAttributes:{}}},addAttributes(){return{provider:{default:""},prompt:{default:""},time:{default:0}}},parseHTML(){return[{tag:'div[data-type="aiBlock"]'}]},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=[];return n.content.forEach(o=>{const r=e.renderChildren(o);t.push(r)}),t.join(`
286
- `)},renderHTML({HTMLAttributes:n}){return["div",fe(n,{"data-type":"aiBlock"}),0]},addCommands(){return{setAiBlock:()=>({commands:n})=>n.wrapIn(this.name),toggleAiBlock:()=>({commands:n})=>n.toggleWrap(this.name),unsetAiBlock:()=>({commands:n})=>n.lift(this.name),updateAiBlock:(n,e)=>({editor:t,tr:o,dispatch:r})=>{const i=o.doc.nodeAt(n);if(!i||i.type.name!==this.name)return console.error("Invalid node type."),!1;try{const s=$n.fromJSON(t.schema,e),l=i.copy(s.content);return o.replaceWith(n,n+i.nodeSize,l),r==null?void 0:r(o)}catch(s){return console.error("Invalid content structure:",s),!1}}}}}),a5={class:"o-scroll"},c5={class:"view-main"},d5={class:"block-container"},u5={class:"block-content"},f5={key:0,class:"edit-prompt"},p5={key:1},h5={"data-tippy-role":"tooltip"},m5={class:"label"},g5={class:"block-container"},y5={class:"block-content"},b5=100,k5=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{md:t}=Kh(),{languageName:o,tr:r}=de(),{isFocused:i,bind:s,unbind:l,checkFocus:a}=V1(),{theme:d}=xi(),{isEditable:u}=xe(),{getPos:f}=e,{provider:p,onStreamingChatCompletion:h}=e.extension.options,m=c.ref(null),g=c.ref(""),y=c.ref(!1),b=c.ref({}),k=c.ref(!1),x=c.ref(!1),w=c.ref(""),C=c.ref(null),v=c.ref(!1),E=c.ref(!1);let T=0;const A=c.computed(()=>({role:"system",content:xm.writing.replace("[LANGUAGE]",o.value)})),$=c.ref([A.value]),O=c.computed(()=>!e.node.textContent),B=c.computed(()=>gx),_=c.computed({get(){return e.node.attrs.provider},set(pe){e.updateAttributes({provider:pe})}}),D=c.computed({get(){return e.node.attrs.prompt},set(pe){e.updateAttributes({prompt:pe})}}),P=c.computed({get(){return e.node.attrs.time},set(pe){e.updateAttributes({time:pe})}});function R(){g.value=D.value,O.value&&!D.value&&setTimeout(()=>{var pe;(pe=m.value)==null||pe.focus()},0)}function K(){setTimeout(()=>{},0)}function H(){w.value="edit",setTimeout(()=>{var pe;(pe=C.value)==null||pe.focus()},0)}function W(){_.value=p.provider,D.value=g.value,P.value=Date.now(),v.value=!0,w.value&&(w.value=""),E.value?Le():ge()}async function ge(){const pe=f();let Me="";if($.value.push({role:"user",content:D.value}),$.value[0].role==="system"&&($.value.shift(),$.value.unshift(A.value)),!h){Ql.error("AI Completion method not implemented."),v.value=!1;return}try{const Te=await h({messages:$.value,options:{id:e.node.attrs.id,type:"ai-block"},onChunk:ct=>{Me+=ct,$.value=[...$.value.slice(0,-1),{role:"assistant",content:Me}];const Tn=Date.now();Tn-T>b5&&(Ee(pe,Me),T=Tn)}});Ee(pe,Me)}catch(Te){$.value.pop(),console.error(Te),Ql.error(r("ai.error"))}finally{v.value=!1}}function Ee(pe,Me){const Te=t.render(Me),ct=im(e.editor,Te);We(pe,ct)}async function Le(){const pe=f();let Me="";try{for(const Te of uC){await new Promise(Tn=>setTimeout(Tn,500)),Me+=Te;const ct=ux(e.editor,t.render(Me));We(pe,ct)}}catch(Te){console.error(Te)}v.value=!1}function We(pe,Me){var ct;const Te=e.node.toJSON();Te.content=Me.content,(ct=e.editor)==null||ct.commands.updateAiBlock(pe,Te),e.editor.commands.setNodeSelection(pe),e.editor.view.focus(),Fe()}function Fe(){const Me=e.node.content.lastChild;if(Me&&Me.attrs.id){const Te=Me.attrs.id,ct=document.querySelector(`[data-id="${Te}"]`);ct&&ct.scrollIntoView({behavior:"smooth",block:"center"})}}function Ae(pe){y.value=!1,pe.value}function je(pe,Me){Me?g.value=r(Me.label):g.value=r(pe.label),k.value=!1}function At(pe){y.value=!0,b.value=pe}return c.watch(()=>e.node.content,pe=>{a()}),c.watch(O,pe=>{pe&&(x.value=!1)}),c.watch(i,pe=>{pe&&!O.value&&setTimeout(()=>{g.value=D.value,w.value="",x.value=pe},100)}),c.onMounted(()=>{R(),s(e)}),c.onBeforeUnmount(()=>{l()}),(pe,Me)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:["o-ai-block-view",{"is-empty":O.value,"has-focus":c.unref(i)}],onContextmenu:c.withModifiers(At,["prevent"])}),{default:c.withCtx(()=>[O.value?(c.openBlock(),c.createBlock(c.unref(wo),{key:0,modelValue:k.value,"onUpdate:modelValue":Me[1]||(Me[1]=Te=>k.value=Te),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":c.withCtx(()=>[c.createElementVNode("section",a5,[c.createElementVNode("section",c5,[c.createVNode(c.unref(_d),{items:B.value,onSelect:je,"use-keyboard":k.value},null,8,["items","use-keyboard"])])])]),default:c.withCtx(()=>[c.createElementVNode("div",d5,[c.createElementVNode("div",u5,[c.createVNode(c.unref(jn),{ref_key:"inputRef",ref:m,modelValue:g.value,"onUpdate:modelValue":Me[0]||(Me[0]=Te=>g.value=Te),placeholder:c.unref(r)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:K},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(Rr),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(r)("label.generate"),loading:v.value,onClick:W},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):c.createCommentVNode("",!0),c.withDirectives(c.createVNode(c.unref(wo),{modelValue:x.value,"onUpdate:modelValue":Me[4]||(Me[4]=Te=>x.value=Te),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":c.withCtx(()=>[w.value==="edit"?(c.openBlock(),c.createElementBlock("section",f5,[c.createVNode(c.unref(jn),{ref_key:"updateInputRef",ref:C,modelValue:g.value,"onUpdate:modelValue":Me[2]||(Me[2]=Te=>g.value=Te),placeholder:c.unref(r)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(Rr),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(r)("label.generate"),loading:v.value,onClick:W},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(c.openBlock(),c.createElementBlock("section",p5,[c.createVNode(c.unref(Yx),null,{default:c.withCtx(()=>[c.createElementVNode("div",h5,[c.createVNode(c.unref(Ke),{icon:"auto_awesome",onClick:H},{default:c.withCtx(()=>[c.createElementVNode("span",m5,c.toDisplayString(c.unref(r)("label.generatedBy"))+" "+c.toDisplayString(_.value||"AI"),1)]),_:1})]),c.createVNode(c.unref(Rr),{icon:"autorenew",tooltip:c.unref(r)("label.update"),loading:v.value,onClick:W},null,8,["tooltip","loading"])]),_:1})]))]),default:c.withCtx(()=>[c.createElementVNode("div",g5,[c.createElementVNode("div",y5,[c.createVNode(c.unref(jo))]),c.unref(u)?(c.openBlock(),c.createBlock(c.unref(Ci),{key:0,modelValue:y.value,"onUpdate:modelValue":Me[3]||(Me[3]=Te=>y.value=Te),event:b.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Yo),c.mergeProps(e,{onAction:Ae}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[c.vShow,!O.value]])]),_:1},16,["class"]))}}),$E=l5.extend({addNodeView(){return un(k5)}}),w5={key:1,class:"audio-container"},Ds="//init.mp3",x5=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref({});c.ref(null),c.ref(!1);const s=c.ref(!1);c.computed({get(){return e.node.attrs.caption},set(h){e.updateAttributes({caption:h})}});const l=c.computed({get(){return e.node.attrs.src},set(h){e.updateAttributes({src:h})}});function a(h){switch(r.value=!1,h.value){case"replace":p(!0);break}}function d(){l.value===Ds&&p(!0)}function u(h){r.value=!0,i.value=h}function f(h){l.value=h,p(!1)}function p(h){s.value=h}return c.onMounted(()=>{p(l.value===Ds)}),(h,m)=>{var g;return c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:["o-audio-view",{readonly:!((g=h.editor)!=null&&g.isEditable),init:l.value===Ds}],as:"div",onContextmenu:c.withModifiers(u,["prevent"]),onClick:d}),{default:c.withCtx(()=>[c.createVNode(c.unref(wo),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=y=>s.value=y),placement:l.value===Ds?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Gl),{val:l.value===Ds?"":l.value,type:"audio",onInput:f},null,8,["val"])]),default:c.withCtx(()=>[l.value===Ds?(c.openBlock(),c.createBlock(c.unref(ys),{key:0,icon:"graphic_eq",placeholder:c.unref(t)("label.audioAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",w5,[c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Kl),c.mergeProps({key:0},e,{onAction:a}),{default:c.withCtx(()=>[c.createCommentVNode("",!0)]),_:1},16)):c.createCommentVNode("",!0),c.createElementVNode("audio",c.mergeProps(h.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[c.createElementVNode("source",c.normalizeProps(c.guardReactiveProps(h.node.attrs)),null,16)],16)]))]),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(Ci),{modelValue:r.value,"onUpdate:modelValue":m[1]||(m[1]=y=>r.value=y),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Yo),c.mergeProps(e,{onAction:a}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),BE=pN.extend({addNodeView(){return un(x5)}}),C5={class:"header o-tips"},S5={style:{display:"flex"}},v5=["innerHTML"],E5=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref(null),s=c.computed({get(){return e.node.attrs.latex},set(u){e.updateAttributes({latex:u||""})}}),l=c.computed(()=>hN.renderToString(s.value,{throwOnError:!1}));function a(u){r.value=u,u&&setTimeout(()=>{var f;(f=i.value)==null||f.focus()},100)}function d(){window.open("https://katex.org/docs/supported.html","target")}return c.onMounted(()=>{a(!s.value)}),(u,f)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:["o-block-math-view",{init:!s.value}],as:"div",onClick:f[3]||(f[3]=p=>a(!0))}),{default:c.withCtx(()=>[c.createVNode(c.unref(wo),{modelValue:r.value,"onUpdate:modelValue":f[2]||(f[2]=p=>r.value=p),"content-class":"o-block-math-editor",placement:s.value==="init"?"bottom":"top",readonly:!c.unref(o),"show-arrow":""},{"popover-content":c.withCtx(()=>[c.createElementVNode("header",C5,[c.createElementVNode("div",S5,[c.createVNode(c.unref(X),{name:"functions"}),c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.blockMath")),1)]),c.createElementVNode("div",null,[c.createVNode(c.unref(bt),{icon:"help",tooltip:c.unref(t)("label.help"),onClick:d},null,8,["tooltip"])])]),c.createVNode(c.unref(Zx),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=p=>s.value=p),placeholder:"Input block math ...",autofocus:"",clearable:""},null,8,["modelValue"])]),default:c.withCtx(()=>[s.value?(c.openBlock(),c.createElementBlock("div",{key:1,class:"block-math-container",onClick:f[1]||(f[1]=p=>a(!0))},[c.createElementVNode("div",{class:"katex-container",innerHTML:l.value},null,8,v5)])):(c.openBlock(),c.createBlock(c.unref(ys),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),RE=Ks.BlockMath.extend({addCommands(){return{insertBlockMath:(n={})=>({tr:e,dispatch:t,state:o})=>{const r=o.schema.nodes.blockMath.create({latex:n.latex??""});return t&&(e.replaceSelectionWith(r),e.scrollIntoView()),!0}}},addNodeView(){return un(E5)}});/**
287
- * Copyright 2026 Yiitap
288
- * @license MIT
289
- **/var DE=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},M5=/^\s*>\s$/,T5=Oe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return DE("blockquote",{...fe(this.options.HTMLAttributes,n),children:DE("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",o=[];return n.content.forEach(r=>{const i=e.renderChildren([r]).split(`
290
- `).map(s=>s.trim()===""?t:`${t} ${s}`);o.push(i.join(`
291
- `))}),o.join(`
292
- ${t}
293
- `)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ho({find:M5,type:this.type})]}});const N5=T5.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[Ho({find:t,type:this.type})]}}),A5=c.defineComponent({__name:"view",props:ut,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:"o-blockquote-view"}),{default:c.withCtx(()=>[c.createElementVNode("blockquote",null,[c.createVNode(c.unref(jo))])]),_:1},16))}}),_E=N5.extend({addNodeView(){return un(A5)}});/**
294
- * Copyright 2026 Yiitap
295
- * @license MIT
296
- **/const O5=Oe.create({name:"callout",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{},triggerCharacters:["?","?"]}},addAttributes(){return{icon:{default:"🌾"},borderColor:{default:"#dddddd"},borderColorDark:{default:"#333333"},backColor:{default:"#eeeeee"},backColorDark:{default:"rgba(101, 117, 133, 0.16)"}}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new vr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),d=l.after(l.depth);i.delete(r.from,r.to);const u=s.nodes.callout.create(null,s.nodes.paragraph.create());i.replaceRangeWith(a,d,u);const f=q.near(i.doc.resolve(a+2));i.setSelection(f)}})]},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:n}){return["div",fe(n,{"data-type":"callout"}),0]},markdownTokenName:"callout",parseMarkdown:(n,e)=>{const t=n.info.replace("info","").trim()||"🌾",o=e.parseChildren(n.tokens??[]);return console.log("callout parseMarkdown",n.info),console.log("callout parseMarkdown",n,o,t),e.createNode("callout",{icon:t},o)},renderMarkdown:(n,e)=>{var i;if(!n.content)return"";const t=`::: info ${((i=n.attrs)==null?void 0:i.icon)||"🌾"}`,o=":::",r=[];return n.content.forEach(s=>{const l=e.renderChildren(s);r.push(l)}),t+`
297
- `+r.join(`
298
-
299
- `)+`
300
- `+o},markdownTokenizer:{name:"callout",level:"block",start:n=>{var e;return((e=n.match(/^:::/))==null?void 0:e.index)??-1},tokenize(n,e,t){const o=/^:::([^\n]+)\n([\s\S]*?)\n:::\s*(?:\n|$)/.exec(n);if(!o)return;const[,r,i]=o;console.log("markdownTokenizer",n,o,r,i);const s=t.blockTokens(i);return{type:"callout",raw:o[0],info:r,tokens:s}}},addCommands(){return{setCallout:()=>({commands:n})=>n.wrapIn(this.name),toggleCallout:()=>({commands:n})=>n.toggleWrap(this.name),unsetCallout:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>this.editor.commands.toggleCallout()}}}),$5={class:"callout-container"},B5={class:"callout-icon"},R5={class:"callout-content"},D5=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{theme:t}=xi(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref(!1),s=c.ref({}),l=c.ref(null),a=c.computed(()=>{const{selection:w}=e.editor.view.state,C=w.from,v=e.getPos(),E=v+e.node.nodeSize;return C>=v&&C<=E}),d=c.computed({get(){return e.node.attrs.backColor},set(w){e.updateAttributes({backColor:w})}}),u=c.computed({get(){return e.node.attrs.backColorDark},set(w){e.updateAttributes({backColorDark:w})}}),f=c.computed({get(){return e.node.attrs.borderColor},set(w){e.updateAttributes({borderColor:w})}}),p=c.computed({get(){return e.node.attrs.borderColorDark},set(w){e.updateAttributes({borderColorDark:w})}}),h=c.computed(()=>t.value==="dark"?u.value:d.value),m=c.computed(()=>t.value==="dark"?p.value:f.value);function g(w){e.updateAttributes({icon:w})}function y(w){switch(r.value=!1,w.value){case"palette":k(!0);break}}function b(w){r.value=!0,s.value=w}function k(w){i.value=w}function x(w,C){var v;switch(w){case"backColor":d.value=C;break;case"foreColor":f.value=C;break;case"icon":g(C.emoji),(v=l.value)==null||v.setShow(!1);break}}return c.watch(a,w=>{k(w)}),(w,C)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:"o-callout-view",style:`--callout-border-color: ${m.value}; --callout-back-color: ${h.value}`,onContextmenu:c.withModifiers(b,["prevent"])}),{default:c.withCtx(()=>[c.createElementVNode("div",$5,[c.createVNode(c.unref(De),{ref_key:"iconPopover",ref:l,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!c.unref(o)},{trigger:c.withCtx(()=>[c.createElementVNode("div",B5,c.toDisplayString(w.node.attrs.icon),1)]),default:c.withCtx(()=>[c.createVNode(c.unref(zd),{items:c.unref(qs.emojiGroups),onSelect:C[0]||(C[0]=v=>x("icon",v)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),c.createElementVNode("div",R5,[c.createVNode(c.unref(jo))]),c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Ci),{key:0,modelValue:r.value,"onUpdate:modelValue":C[1]||(C[1]=v=>r.value=v),event:s.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Yo),c.mergeProps(e,{onAction:y}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),IE=O5.extend({addNodeView(){return un(D5)}});function _5(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var $g,LE;function I5(){if(LE)return $g;LE=1;function n(M){return M instanceof Map?M.clear=M.delete=M.set=function(){throw new Error("map is read-only")}:M instanceof Set&&(M.add=M.clear=M.delete=function(){throw new Error("set is read-only")}),Object.freeze(M),Object.getOwnPropertyNames(M).forEach(I=>{const U=M[I],ye=typeof U;(ye==="object"||ye==="function")&&!Object.isFrozen(U)&&n(U)}),M}class e{constructor(I){I.data===void 0&&(I.data={}),this.data=I.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(M){return M.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function o(M,...I){const U=Object.create(null);for(const ye in M)U[ye]=M[ye];return I.forEach(function(ye){for(const et in ye)U[et]=ye[et]}),U}const r="</span>",i=M=>!!M.scope,s=(M,{prefix:I})=>{if(M.startsWith("language:"))return M.replace("language:","language-");if(M.includes(".")){const U=M.split(".");return[`${I}${U.shift()}`,...U.map((ye,et)=>`${ye}${"_".repeat(et+1)}`)].join(" ")}return`${I}${M}`};class l{constructor(I,U){this.buffer="",this.classPrefix=U.classPrefix,I.walk(this)}addText(I){this.buffer+=t(I)}openNode(I){if(!i(I))return;const U=s(I.scope,{prefix:this.classPrefix});this.span(U)}closeNode(I){i(I)&&(this.buffer+=r)}value(){return this.buffer}span(I){this.buffer+=`<span class="${I}">`}}const a=(M={})=>{const I={children:[]};return Object.assign(I,M),I};class d{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(I){this.top.children.push(I)}openNode(I){const U=a({scope:I});this.add(U),this.stack.push(U)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(I){return this.constructor._walk(I,this.rootNode)}static _walk(I,U){return typeof U=="string"?I.addText(U):U.children&&(I.openNode(U),U.children.forEach(ye=>this._walk(I,ye)),I.closeNode(U)),I}static _collapse(I){typeof I!="string"&&I.children&&(I.children.every(U=>typeof U=="string")?I.children=[I.children.join("")]:I.children.forEach(U=>{d._collapse(U)}))}}class u extends d{constructor(I){super(),this.options=I}addText(I){I!==""&&this.add(I)}startScope(I){this.openNode(I)}endScope(){this.closeNode()}__addSublanguage(I,U){const ye=I.root;U&&(ye.scope=`language:${U}`),this.add(ye)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(M){return M?typeof M=="string"?M:M.source:null}function p(M){return g("(?=",M,")")}function h(M){return g("(?:",M,")*")}function m(M){return g("(?:",M,")?")}function g(...M){return M.map(U=>f(U)).join("")}function y(M){const I=M[M.length-1];return typeof I=="object"&&I.constructor===Object?(M.splice(M.length-1,1),I):{}}function b(...M){return"("+(y(M).capture?"":"?:")+M.map(ye=>f(ye)).join("|")+")"}function k(M){return new RegExp(M.toString()+"|").exec("").length-1}function x(M,I){const U=M&&M.exec(I);return U&&U.index===0}const w=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(M,{joinWith:I}){let U=0;return M.map(ye=>{U+=1;const et=U;let Xe=f(ye),oe="";for(;Xe.length>0;){const Z=w.exec(Xe);if(!Z){oe+=Xe;break}oe+=Xe.substring(0,Z.index),Xe=Xe.substring(Z.index+Z[0].length),Z[0][0]==="\\"&&Z[1]?oe+="\\"+String(Number(Z[1])+et):(oe+=Z[0],Z[0]==="("&&U++)}return oe}).map(ye=>`(${ye})`).join(I)}const v=/\b\B/,E="[a-zA-Z]\\w*",T="[a-zA-Z_]\\w*",A="\\b\\d+(\\.\\d+)?",$="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",O="\\b(0b[01]+)",B="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",_=(M={})=>{const I=/^#![ ]*\//;return M.binary&&(M.begin=g(I,/.*\b/,M.binary,/\b.*/)),o({scope:"meta",begin:I,end:/$/,relevance:0,"on:begin":(U,ye)=>{U.index!==0&&ye.ignoreMatch()}},M)},D={begin:"\\\\[\\s\\S]",relevance:0},P={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[D]},R={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[D]},K={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},H=function(M,I,U={}){const ye=o({scope:"comment",begin:M,end:I,contains:[]},U);ye.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const et=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ye.contains.push({begin:g(/[ ]+/,"(",et,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ye},W=H("//","$"),ge=H("/\\*","\\*/"),Ee=H("#","$"),Le={scope:"number",begin:A,relevance:0},We={scope:"number",begin:$,relevance:0},Fe={scope:"number",begin:O,relevance:0},Ae={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[D,{begin:/\[/,end:/\]/,relevance:0,contains:[D]}]},je={scope:"title",begin:E,relevance:0},At={scope:"title",begin:T,relevance:0},pe={begin:"\\.\\s*"+T,relevance:0};var Te=Object.freeze({__proto__:null,APOS_STRING_MODE:P,BACKSLASH_ESCAPE:D,BINARY_NUMBER_MODE:Fe,BINARY_NUMBER_RE:O,COMMENT:H,C_BLOCK_COMMENT_MODE:ge,C_LINE_COMMENT_MODE:W,C_NUMBER_MODE:We,C_NUMBER_RE:$,END_SAME_AS_BEGIN:function(M){return Object.assign(M,{"on:begin":(I,U)=>{U.data._beginMatch=I[1]},"on:end":(I,U)=>{U.data._beginMatch!==I[1]&&U.ignoreMatch()}})},HASH_COMMENT_MODE:Ee,IDENT_RE:E,MATCH_NOTHING_RE:v,METHOD_GUARD:pe,NUMBER_MODE:Le,NUMBER_RE:A,PHRASAL_WORDS_MODE:K,QUOTE_STRING_MODE:R,REGEXP_MODE:Ae,RE_STARTERS_RE:B,SHEBANG:_,TITLE_MODE:je,UNDERSCORE_IDENT_RE:T,UNDERSCORE_TITLE_MODE:At});function ct(M,I){M.input[M.index-1]==="."&&I.ignoreMatch()}function Tn(M,I){M.className!==void 0&&(M.scope=M.className,delete M.className)}function or(M,I){I&&M.beginKeywords&&(M.begin="\\b("+M.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",M.__beforeBegin=ct,M.keywords=M.keywords||M.beginKeywords,delete M.beginKeywords,M.relevance===void 0&&(M.relevance=0))}function rr(M,I){Array.isArray(M.illegal)&&(M.illegal=b(...M.illegal))}function Wr(M,I){if(M.match){if(M.begin||M.end)throw new Error("begin & end are not supported with match");M.begin=M.match,delete M.match}}function Kn(M,I){M.relevance===void 0&&(M.relevance=1)}const ir=(M,I)=>{if(!M.beforeMatch)return;if(M.starts)throw new Error("beforeMatch cannot be used with starts");const U=Object.assign({},M);Object.keys(M).forEach(ye=>{delete M[ye]}),M.keywords=U.keywords,M.begin=g(U.beforeMatch,p(U.begin)),M.starts={relevance:0,contains:[Object.assign(U,{endsParent:!0})]},M.relevance=0,delete U.beforeMatch},qr=["of","and","for","in","not","or","if","then","parent","list","value"],Kr="keyword";function Qt(M,I,U=Kr){const ye=Object.create(null);return typeof M=="string"?et(U,M.split(" ")):Array.isArray(M)?et(U,M):Object.keys(M).forEach(function(Xe){Object.assign(ye,Qt(M[Xe],I,Xe))}),ye;function et(Xe,oe){I&&(oe=oe.map(Z=>Z.toLowerCase())),oe.forEach(function(Z){const be=Z.split("|");ye[be[0]]=[Xe,Nn(be[0],be[1])]})}}function Nn(M,I){return I?Number(I):$o(M)?0:1}function $o(M){return qr.includes(M.toLowerCase())}const An={},an=M=>{console.error(M)},sr=(M,...I)=>{console.log(`WARN: ${M}`,...I)},Zt=(M,I)=>{An[`${M}/${I}`]||(console.log(`Deprecated as of ${M}. ${I}`),An[`${M}/${I}`]=!0)},io=new Error;function Bo(M,I,{key:U}){let ye=0;const et=M[U],Xe={},oe={};for(let Z=1;Z<=I.length;Z++)oe[Z+ye]=et[Z],Xe[Z+ye]=!0,ye+=k(I[Z-1]);M[U]=oe,M[U]._emit=Xe,M[U]._multi=!0}function _a(M){if(Array.isArray(M.begin)){if(M.skip||M.excludeBegin||M.returnBegin)throw an("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),io;if(typeof M.beginScope!="object"||M.beginScope===null)throw an("beginScope must be object"),io;Bo(M,M.begin,{key:"beginScope"}),M.begin=C(M.begin,{joinWith:""})}}function Ia(M){if(Array.isArray(M.end)){if(M.skip||M.excludeEnd||M.returnEnd)throw an("skip, excludeEnd, returnEnd not compatible with endScope: {}"),io;if(typeof M.endScope!="object"||M.endScope===null)throw an("endScope must be object"),io;Bo(M,M.end,{key:"endScope"}),M.end=C(M.end,{joinWith:""})}}function Hs(M){M.scope&&typeof M.scope=="object"&&M.scope!==null&&(M.beginScope=M.scope,delete M.scope)}function Fs(M){Hs(M),typeof M.beginScope=="string"&&(M.beginScope={_wrap:M.beginScope}),typeof M.endScope=="string"&&(M.endScope={_wrap:M.endScope}),_a(M),Ia(M)}function js(M){function I(oe,Z){return new RegExp(f(oe),"m"+(M.case_insensitive?"i":"")+(M.unicodeRegex?"u":"")+(Z?"g":""))}class U{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Z,be){be.position=this.position++,this.matchIndexes[this.matchAt]=be,this.regexes.push([be,Z]),this.matchAt+=k(Z)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Z=this.regexes.map(be=>be[1]);this.matcherRe=I(C(Z,{joinWith:"|"}),!0),this.lastIndex=0}exec(Z){this.matcherRe.lastIndex=this.lastIndex;const be=this.matcherRe.exec(Z);if(!be)return null;const Ot=be.findIndex((Pa,Cy)=>Cy>0&&Pa!==void 0),yt=this.matchIndexes[Ot];return be.splice(0,Ot),Object.assign(be,yt)}}class ye{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Z){if(this.multiRegexes[Z])return this.multiRegexes[Z];const be=new U;return this.rules.slice(Z).forEach(([Ot,yt])=>be.addRule(Ot,yt)),be.compile(),this.multiRegexes[Z]=be,be}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Z,be){this.rules.push([Z,be]),be.type==="begin"&&this.count++}exec(Z){const be=this.getMatcher(this.regexIndex);be.lastIndex=this.lastIndex;let Ot=be.exec(Z);if(this.resumingScanAtSamePosition()&&!(Ot&&Ot.index===this.lastIndex)){const yt=this.getMatcher(0);yt.lastIndex=this.lastIndex+1,Ot=yt.exec(Z)}return Ot&&(this.regexIndex+=Ot.position+1,this.regexIndex===this.count&&this.considerAll()),Ot}}function et(oe){const Z=new ye;return oe.contains.forEach(be=>Z.addRule(be.begin,{rule:be,type:"begin"})),oe.terminatorEnd&&Z.addRule(oe.terminatorEnd,{type:"end"}),oe.illegal&&Z.addRule(oe.illegal,{type:"illegal"}),Z}function Xe(oe,Z){const be=oe;if(oe.isCompiled)return be;[Tn,Wr,Fs,ir].forEach(yt=>yt(oe,Z)),M.compilerExtensions.forEach(yt=>yt(oe,Z)),oe.__beforeBegin=null,[or,rr,Kn].forEach(yt=>yt(oe,Z)),oe.isCompiled=!0;let Ot=null;return typeof oe.keywords=="object"&&oe.keywords.$pattern&&(oe.keywords=Object.assign({},oe.keywords),Ot=oe.keywords.$pattern,delete oe.keywords.$pattern),Ot=Ot||/\w+/,oe.keywords&&(oe.keywords=Qt(oe.keywords,M.case_insensitive)),be.keywordPatternRe=I(Ot,!0),Z&&(oe.begin||(oe.begin=/\B|\b/),be.beginRe=I(be.begin),!oe.end&&!oe.endsWithParent&&(oe.end=/\B|\b/),oe.end&&(be.endRe=I(be.end)),be.terminatorEnd=f(be.end)||"",oe.endsWithParent&&Z.terminatorEnd&&(be.terminatorEnd+=(oe.end?"|":"")+Z.terminatorEnd)),oe.illegal&&(be.illegalRe=I(oe.illegal)),oe.contains||(oe.contains=[]),oe.contains=[].concat(...oe.contains.map(function(yt){return V(yt==="self"?oe:yt)})),oe.contains.forEach(function(yt){Xe(yt,be)}),oe.starts&&Xe(oe.starts,Z),be.matcher=et(be),be}if(M.compilerExtensions||(M.compilerExtensions=[]),M.contains&&M.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return M.classNameAliases=o(M.classNameAliases||{}),Xe(M)}function N(M){return M?M.endsWithParent||N(M.starts):!1}function V(M){return M.variants&&!M.cachedVariants&&(M.cachedVariants=M.variants.map(function(I){return o(M,{variants:null},I)})),M.cachedVariants?M.cachedVariants:N(M)?o(M,{starts:M.starts?o(M.starts):null}):Object.isFrozen(M)?o(M):M}var te="11.11.1";class we extends Error{constructor(I,U){super(I),this.name="HTMLInjectionError",this.html=U}}const he=t,ft=o,zt=Symbol("nomatch"),Jr=7,La=function(M){const I=Object.create(null),U=Object.create(null),ye=[];let et=!0;const Xe="Could not find the language '{}', did you forget to load/include a language module?",oe={disableAutodetect:!0,name:"Plain text",contains:[]};let Z={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function be(F){return Z.noHighlightRe.test(F)}function Ot(F){let ue=F.className+" ";ue+=F.parentNode?F.parentNode.className:"";const Be=Z.languageDetectRe.exec(ue);if(Be){const Ye=Gr(Be[1]);return Ye||(sr(Xe.replace("{}",Be[1])),sr("Falling back to no-highlight mode for this block.",F)),Ye?Be[1]:"no-highlight"}return ue.split(/\s+/).find(Ye=>be(Ye)||Gr(Ye))}function yt(F,ue,Be){let Ye="",wt="";typeof ue=="object"?(Ye=F,Be=ue.ignoreIllegals,wt=ue.language):(Zt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Zt("10.7.0",`Please use highlight(code, options) instead.
301
- https://github.com/highlightjs/highlight.js/issues/2277`),wt=F,Ye=ue),Be===void 0&&(Be=!0);const so={code:Ye,language:wt};bf("before:highlight",so);const Xr=so.result?so.result:Pa(so.language,so.code,Be);return Xr.code=so.code,bf("after:highlight",Xr),Xr}function Pa(F,ue,Be,Ye){const wt=Object.create(null);function so(J,se){return J.keywords[se]}function Xr(){if(!Ce.keywords){Ht.addText(Qe);return}let J=0;Ce.keywordPatternRe.lastIndex=0;let se=Ce.keywordPatternRe.exec(Qe),Ne="";for(;se;){Ne+=Qe.substring(J,se.index);const He=Do.case_insensitive?se[0].toLowerCase():se[0],en=so(Ce,He);if(en){const[lr,VK]=en;if(Ht.addText(Ne),Ne="",wt[He]=(wt[He]||0)+1,wt[He]<=Jr&&(xf+=VK),lr.startsWith("_"))Ne+=se[0];else{const zK=Do.classNameAliases[lr]||lr;Ro(se[0],zK)}}else Ne+=se[0];J=Ce.keywordPatternRe.lastIndex,se=Ce.keywordPatternRe.exec(Qe)}Ne+=Qe.substring(J),Ht.addText(Ne)}function kf(){if(Qe==="")return;let J=null;if(typeof Ce.subLanguage=="string"){if(!I[Ce.subLanguage]){Ht.addText(Qe);return}J=Pa(Ce.subLanguage,Qe,!0,XT[Ce.subLanguage]),XT[Ce.subLanguage]=J._top}else J=Sy(Qe,Ce.subLanguage.length?Ce.subLanguage:null);Ce.relevance>0&&(xf+=J.relevance),Ht.__addSublanguage(J._emitter,J.language)}function On(){Ce.subLanguage!=null?kf():Xr(),Qe=""}function Ro(J,se){J!==""&&(Ht.startScope(se),Ht.addText(J),Ht.endScope())}function qT(J,se){let Ne=1;const He=se.length-1;for(;Ne<=He;){if(!J._emit[Ne]){Ne++;continue}const en=Do.classNameAliases[J[Ne]]||J[Ne],lr=se[Ne];en?Ro(lr,en):(Qe=lr,Xr(),Qe=""),Ne++}}function KT(J,se){return J.scope&&typeof J.scope=="string"&&Ht.openNode(Do.classNameAliases[J.scope]||J.scope),J.beginScope&&(J.beginScope._wrap?(Ro(Qe,Do.classNameAliases[J.beginScope._wrap]||J.beginScope._wrap),Qe=""):J.beginScope._multi&&(qT(J.beginScope,se),Qe="")),Ce=Object.create(J,{parent:{value:Ce}}),Ce}function JT(J,se,Ne){let He=x(J.endRe,Ne);if(He){if(J["on:end"]){const en=new e(J);J["on:end"](se,en),en.isMatchIgnored&&(He=!1)}if(He){for(;J.endsParent&&J.parent;)J=J.parent;return J}}if(J.endsWithParent)return JT(J.parent,se,Ne)}function DK(J){return Ce.matcher.regexIndex===0?(Qe+=J[0],1):(Ty=!0,0)}function _K(J){const se=J[0],Ne=J.rule,He=new e(Ne),en=[Ne.__beforeBegin,Ne["on:begin"]];for(const lr of en)if(lr&&(lr(J,He),He.isMatchIgnored))return DK(se);return Ne.skip?Qe+=se:(Ne.excludeBegin&&(Qe+=se),On(),!Ne.returnBegin&&!Ne.excludeBegin&&(Qe=se)),KT(Ne,J),Ne.returnBegin?0:se.length}function IK(J){const se=J[0],Ne=ue.substring(J.index),He=JT(Ce,J,Ne);if(!He)return zt;const en=Ce;Ce.endScope&&Ce.endScope._wrap?(On(),Ro(se,Ce.endScope._wrap)):Ce.endScope&&Ce.endScope._multi?(On(),qT(Ce.endScope,J)):en.skip?Qe+=se:(en.returnEnd||en.excludeEnd||(Qe+=se),On(),en.excludeEnd&&(Qe=se));do Ce.scope&&Ht.closeNode(),!Ce.skip&&!Ce.subLanguage&&(xf+=Ce.relevance),Ce=Ce.parent;while(Ce!==He.parent);return He.starts&&KT(He.starts,J),en.returnEnd?0:se.length}function LK(){const J=[];for(let se=Ce;se!==Do;se=se.parent)se.scope&&J.unshift(se.scope);J.forEach(se=>Ht.openNode(se))}let wf={};function GT(J,se){const Ne=se&&se[0];if(Qe+=J,Ne==null)return On(),0;if(wf.type==="begin"&&se.type==="end"&&wf.index===se.index&&Ne===""){if(Qe+=ue.slice(se.index,se.index+1),!et){const He=new Error(`0 width match regex (${F})`);throw He.languageName=F,He.badRule=wf.rule,He}return 1}if(wf=se,se.type==="begin")return _K(se);if(se.type==="illegal"&&!Be){const He=new Error('Illegal lexeme "'+Ne+'" for mode "'+(Ce.scope||"<unnamed>")+'"');throw He.mode=Ce,He}else if(se.type==="end"){const He=IK(se);if(He!==zt)return He}if(se.type==="illegal"&&Ne==="")return Qe+=`
302
- `,1;if(My>1e5&&My>se.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Qe+=Ne,Ne.length}const Do=Gr(F);if(!Do)throw an(Xe.replace("{}",F)),new Error('Unknown language: "'+F+'"');const PK=js(Do);let Ey="",Ce=Ye||PK;const XT={},Ht=new Z.__emitter(Z);LK();let Qe="",xf=0,ji=0,My=0,Ty=!1;try{if(Do.__emitTokens)Do.__emitTokens(ue,Ht);else{for(Ce.matcher.considerAll();;){My++,Ty?Ty=!1:Ce.matcher.considerAll(),Ce.matcher.lastIndex=ji;const J=Ce.matcher.exec(ue);if(!J)break;const se=ue.substring(ji,J.index),Ne=GT(se,J);ji=J.index+Ne}GT(ue.substring(ji))}return Ht.finalize(),Ey=Ht.toHTML(),{language:F,value:Ey,relevance:xf,illegal:!1,_emitter:Ht,_top:Ce}}catch(J){if(J.message&&J.message.includes("Illegal"))return{language:F,value:he(ue),illegal:!0,relevance:0,_illegalBy:{message:J.message,index:ji,context:ue.slice(ji-100,ji+100),mode:J.mode,resultSoFar:Ey},_emitter:Ht};if(et)return{language:F,value:he(ue),illegal:!1,relevance:0,errorRaised:J,_emitter:Ht,_top:Ce};throw J}}function Cy(F){const ue={value:he(F),illegal:!1,relevance:0,_top:oe,_emitter:new Z.__emitter(Z)};return ue._emitter.addText(F),ue}function Sy(F,ue){ue=ue||Z.languages||Object.keys(I);const Be=Cy(F),Ye=ue.filter(Gr).filter(WT).map(On=>Pa(On,F,!1));Ye.unshift(Be);const wt=Ye.sort((On,Ro)=>{if(On.relevance!==Ro.relevance)return Ro.relevance-On.relevance;if(On.language&&Ro.language){if(Gr(On.language).supersetOf===Ro.language)return 1;if(Gr(Ro.language).supersetOf===On.language)return-1}return 0}),[so,Xr]=wt,kf=so;return kf.secondBest=Xr,kf}function SK(F,ue,Be){const Ye=ue&&U[ue]||Be;F.classList.add("hljs"),F.classList.add(`language-${Ye}`)}function vy(F){let ue=null;const Be=Ot(F);if(be(Be))return;if(bf("before:highlightElement",{el:F,language:Be}),F.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",F);return}if(F.children.length>0&&(Z.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(F)),Z.throwUnescapedHTML))throw new we("One of your code blocks includes unescaped HTML.",F.innerHTML);ue=F;const Ye=ue.textContent,wt=Be?yt(Ye,{language:Be,ignoreIllegals:!0}):Sy(Ye);F.innerHTML=wt.value,F.dataset.highlighted="yes",SK(F,Be,wt.language),F.result={language:wt.language,re:wt.relevance,relevance:wt.relevance},wt.secondBest&&(F.secondBest={language:wt.secondBest.language,relevance:wt.secondBest.relevance}),bf("after:highlightElement",{el:F,result:wt,text:Ye})}function vK(F){Z=ft(Z,F)}const EK=()=>{yf(),Zt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function MK(){yf(),Zt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let jT=!1;function yf(){function F(){yf()}if(document.readyState==="loading"){jT||window.addEventListener("DOMContentLoaded",F,!1),jT=!0;return}document.querySelectorAll(Z.cssSelector).forEach(vy)}function TK(F,ue){let Be=null;try{Be=ue(M)}catch(Ye){if(an("Language definition for '{}' could not be registered.".replace("{}",F)),et)an(Ye);else throw Ye;Be=oe}Be.name||(Be.name=F),I[F]=Be,Be.rawDefinition=ue.bind(null,M),Be.aliases&&UT(Be.aliases,{languageName:F})}function NK(F){delete I[F];for(const ue of Object.keys(U))U[ue]===F&&delete U[ue]}function AK(){return Object.keys(I)}function Gr(F){return F=(F||"").toLowerCase(),I[F]||I[U[F]]}function UT(F,{languageName:ue}){typeof F=="string"&&(F=[F]),F.forEach(Be=>{U[Be.toLowerCase()]=ue})}function WT(F){const ue=Gr(F);return ue&&!ue.disableAutodetect}function OK(F){F["before:highlightBlock"]&&!F["before:highlightElement"]&&(F["before:highlightElement"]=ue=>{F["before:highlightBlock"](Object.assign({block:ue.el},ue))}),F["after:highlightBlock"]&&!F["after:highlightElement"]&&(F["after:highlightElement"]=ue=>{F["after:highlightBlock"](Object.assign({block:ue.el},ue))})}function $K(F){OK(F),ye.push(F)}function BK(F){const ue=ye.indexOf(F);ue!==-1&&ye.splice(ue,1)}function bf(F,ue){const Be=F;ye.forEach(function(Ye){Ye[Be]&&Ye[Be](ue)})}function RK(F){return Zt("10.7.0","highlightBlock will be removed entirely in v12.0"),Zt("10.7.0","Please use highlightElement now."),vy(F)}Object.assign(M,{highlight:yt,highlightAuto:Sy,highlightAll:yf,highlightElement:vy,highlightBlock:RK,configure:vK,initHighlighting:EK,initHighlightingOnLoad:MK,registerLanguage:TK,unregisterLanguage:NK,listLanguages:AK,getLanguage:Gr,registerAliases:UT,autoDetection:WT,inherit:ft,addPlugin:$K,removePlugin:BK}),M.debugMode=function(){et=!1},M.safeMode=function(){et=!0},M.versionString=te,M.regex={concat:g,lookahead:p,either:b,optional:m,anyNumberOfTimes:h};for(const F in Te)typeof Te[F]=="object"&&n(Te[F]);return Object.assign(M,Te),M},gn=La({});return gn.newInstance=()=>La({}),$g=gn,gn.HighlightJS=gn,gn.default=gn,$g}var L5=I5();const P5=_5(L5);function PE(n,e=[]){return n.flatMap(t=>{const o=[...e,...t.properties?t.properties.className:[]];return t.children?PE(t.children,o):{text:t.value,classes:o}})}function VE(n){return n.value||n.children||[]}function V5(n){return!!P5.getLanguage(n)}function zE({doc:n,name:e,lowlight:t,defaultLanguage:o}){const r=[];return zo(n,i=>i.type.name===e).forEach(i=>{var s;let l=i.pos+1;const a=i.node.attrs.language||o,d=t.listLanguages(),u=a&&(d.includes(a)||V5(a)||(s=t.registered)!=null&&s.call(t,a))?VE(t.highlight(a,i.node.textContent)):VE(t.highlightAuto(i.node.textContent));PE(u).forEach(f=>{const p=l+f.text.length;if(f.classes.length){const h=ze.inline(l,p,{class:f.classes.join(" ")});r.push(h)}l=p})}),Se.create(n,r)}function z5(n){return typeof n=="function"}function H5({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(r=>z5(e[r])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const o=new ce({key:new le("lowlight"),state:{init:(r,{doc:i})=>zE({doc:i,name:n,lowlight:e,defaultLanguage:t}),apply:(r,i,s,l)=>{const a=s.selection.$head.parent.type.name,d=l.selection.$head.parent.type.name,u=zo(s.doc,p=>p.type.name===n),f=zo(l.doc,p=>p.type.name===n);return r.docChanged&&([a,d].includes(n)||f.length!==u.length||r.steps.some(p=>p.from!==void 0&&p.to!==void 0&&u.some(h=>h.pos>=p.from&&h.pos+h.node.nodeSize<=p.to)))?zE({doc:r.doc,name:n,lowlight:e,defaultLanguage:t}):i.map(r.mapping,r.doc)}},props:{decorations(r){return o.getState(r)}}});return o}var F5=r0.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],H5({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),j5=F5;const U5=n=>({name:"Mermaid",aliases:["mermaid"],case_insensitive:!0,contains:[n.COMMENT(/%%(?!\{)/,/$/),{className:"meta",begin:/%%\{/,end:/\}%%/,contains:[{className:"attr",begin:/[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/(?=(,\s*[A-Za-z]|$))/,excludeBegin:!0}]},{className:"meta",begin:/^---$/,end:/^---$/,contains:[{className:"attr",begin:/\b[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"keyword",begin:/(^|\s)(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|pie|gantt|requirement|sankey|timeline|quadrant|gitGraph|mindmap|xychart|block|packet|kanban|architecture|radar|treemap|C4Context)(?:\s+(?:LR|TB|RL|BT))?\b/},{className:"built_in",begin:/^(?:\s*)(participant|loop|end|Note right of|note|class|title|section|dateFormat|x-axis|y-axis|bar|line)\b/},{className:"symbol",begin:/(<<?-+>?|--+>|==+>|->|-\.-|==|->>|-->>|<\|--|--\|>|<\|>|:>|o--o|x--x|\*--|o\{--|\}o--)/,relevance:20},{className:"literal",begin:/\b[A-Za-z0-9_]+\s*-[->]+[A-Za-z0-9_]+\s*:/,end:/$/,contains:[{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"regexp",variants:[{begin:/\[[^\]]+\]/},{begin:/\([^)]+\)/},{begin:/\(\([^)]+\)\)/},{begin:/\{[^}]+\}/},{begin:/>[^<]+</},{begin:/\[\[[^\]]+\]\]/}]},{className:"string",begin:/note\s+(?:left|right|top|bottom)\s+of\s+[A-Za-z0-9_]+/i},{className:"string",variants:[{begin:/'.*?'/},{begin:/".*?"/}]},{className:"number",begin:/\b\d+([:.]\d+)?\b/}]});/**
303
- * Copyright 2026 Yiitap
304
- * @license MIT
305
- **/function W5(n){const e=document.createElement("textarea");e.value=n,e.contentEditable="true",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");return e.remove(),t}function HE(n){return navigator.clipboard!==void 0?navigator.clipboard.writeText(n):new Promise((e,t)=>{const o=W5(n);o?e(!0):t(o)})}const q5=()=>TS(),K5={class:"code-block-toolbar"},J5={class:"wrap"},G5={class:"language readonly"},X5={class:"wrap"},Y5=["srcdoc"],Q5={key:1,ref:"mermaidMount",class:"tiptap ProseMirror mermaid-split-horizontal"},Z5={key:0,class:"preview"},e8={key:0,class:"error"},t8=["innerHTML"],n8=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{commonDownload:t}=Nd(),{tr:o}=de(),{darkMode:r}=xi(),{isEditable:i}=xe(),s=c.ref("content_copy"),l=c.ref({show:!1,fullscreen:!1}),a=c.ref(""),d=c.ref(""),u=c.ref(""),f=c.ref(""),p=c.ref("splitVertical"),h=c.ref(""),m=c.ref("default");Tf.registerLayoutLoaders(mN);const g={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},y=c.computed({get(){return e.node.attrs.language},set(W){e.updateAttributes({language:W})}}),b=c.computed(()=>{var W;return((W=e.node.content.content[0])==null?void 0:W.text)||""}),k=c.computed({get(){return e.node.attrs.wrap},set(W){e.updateAttributes({wrap:W})}}),x=c.computed(()=>["html","svg"].includes(y.value)),w=c.computed(()=>k.value?"text_select_move_down":"format_text_wrap"),C=c.computed(()=>y.value==="mermaid"),v=c.computed(()=>y.value==="mermaid"?i.value?p.value:"preview":"");function E(W){y.value=W}function T(){const W=e.node.content.content[0].text;HE(W).then(()=>{s.value="done",setTimeout(()=>{s.value="content_copy"},2e3)})}function A(W="code"){switch(W){case"svg":O();break;default:$();break}}function $(){const W=y.value;let ge=W;const Ee=Jl.find(Fe=>Fe.value===W);Ee&&(ge=Ee.ext.at(0));const Le=`${W}-${Date.now()}.${ge}`,We=e.node.content.content[0].text;t("code",Le,We)}function O(){if(!u.value)return;const W=`mermaid-${Date.now()}.svg`,ge=u.value;t("svg",W,ge)}function B(){const W=e.node.content.content[0].text;d.value=D(W),a.value="run",l.value={show:!0,fullscreen:!1}}function _(){a.value==="mermaid"&&(p.value=h.value)}function D(W){return`
65
+ `],hp={key:0,class:"o-ai-menu tiptap-toolbar"},kp={key:0,class:"o-scroll"},yp={class:"view-main"},wp={key:1,class:"view-output"},Cp={class:"action-container"},xp={style:{display:"flex"}},_p={style:{padding:"0 4px"}},Bp={key:0},Vp={class:"actions"},Ep={key:0,class:"o-scroll"},Np=["innerHTML"],Sp={class:"ai-io-panel"},Op={class:"o-flex o-item-center actions"},Hr=e.defineComponent({__name:"OAiMenu",props:{editor:{type:oe.Editor,required:!0},menuClass:{type:String,default:""},aiOptions:{type:Object,default:()=>{}}},emits:["confirm"],setup(t,{emit:o}){const n=t,l=o,{onStreamingChatCompletion:r}=n.aiOptions,{md:a}=sn(),{locale:i,tr:s}=I(),c=e.ref(),p=e.ref(!1),d=e.ref(""),f=e.ref(""),u=e.ref("main"),m=e.ref(""),h=e.ref(!1),b=e.ref(!1),y=e.ref({}),x=e.computed(()=>({role:"system",content:Nn.writing.replace("[LANG_CODE]",i.value)})),k=e.ref([{role:"system",content:""}]),_=e.computed(()=>{const S=d.value.toLowerCase();return tr.filter(T=>{var v;return T.value.toLowerCase().indexOf(S)>=0||((v=T.tips)==null?void 0:v.indexOf(S))>=0})});function g(){const{from:S,to:T}=n.editor.state.selection;return n.editor.state.doc.textBetween(S,T,"")}function V(){setTimeout(()=>{p.value=!0},0)}function B(S,T){switch(T&&(p.value=!0),m.value=S.options.prompt.replaceAll("[CONTENT]",g()),S.value){case"translate":m.value=m.value.replace("[LANGUAGE]",T.value);break;case"changeTone":m.value=m.value.replace("[TONE]",T.value);break}return d.value=s(S.label),y.value={...S,child:T},D(),!0}function $(){var S;N(),(S=c.value)==null||S.focus()}function R(){const S=JSON.parse(JSON.stringify(mn(n.editor,f.value))),T=n.editor.schema.nodeFromJSON(S),{from:v}=n.editor.state.selection,U=T.content.size;n.editor.chain().focus().deleteSelection().insertContent(S,{updateSelection:!0}).setTextSelection({from:v,to:v+U}).run(),N(),p.value=!1,setTimeout(()=>{l("confirm")},0)}function D(){u.value="output",h.value=!0,b.value?H():M()}async function M(){let S="";if(k.value.push({role:"user",content:m.value}),k.value[0].role==="system"&&(k.value.shift(),k.value.unshift(x.value)),!r){lo.error("AI Completion method not implemented."),h.value=!1;return}try{const T=await r({messages:k.value,onChunk:v=>{S+=v,k.value=[...k.value.slice(0,-1),{role:"assistant",content:S}],f.value=a.render(S)}})}catch(T){k.value.pop(),console.error(T),lo.error(s("ai.error"))}finally{h.value=!1}}async function H(){let S="";for(const T of zr)await new Promise(v=>setTimeout(v,500)),S+=T,f.value=a.render(S);h.value=!1}function N(){u.value="main",f.value="",d.value=""}return e.onMounted(()=>{setTimeout(()=>{var S;(S=c.value)==null||S.focus(),p.value=!0},300)}),(S,T)=>t.editor?(e.openBlock(),e.createElementBlock("section",hp,[e.createVNode(e.unref(ve),{modelValue:p.value,"onUpdate:modelValue":T[1]||(T[1]=v=>p.value=v),offset:[-4,10],placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":e.withCtx(()=>{var v;return[u.value==="main"?(e.openBlock(),e.createElementBlock("div",kp,[e.createElementVNode("section",yp,[e.createVNode(e.unref(go),{items:_.value,onSelect:B,"use-keyboard":p.value},null,8,["items","use-keyboard"])])])):e.createCommentVNode("",!0),u.value==="output"?(e.openBlock(),e.createElementBlock("section",wp,[e.createElementVNode("div",Cp,[e.createElementVNode("div",xp,[e.createVNode(e.unref(O),{name:"auto_awesome",class:"o-tips"}),e.createElementVNode("div",_p,[e.createTextVNode(e.toDisplayString(e.unref(s)(y.value.label))+" ",1),(v=y.value.child)!=null&&v.label?(e.openBlock(),e.createElementBlock("span",Bp,": "+e.toDisplayString(e.unref(s)(y.value.child.label)),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Vp,[e.createVNode(e.unref(et),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(s)("label.confirm"),loading:h.value,onClick:R},null,8,["tooltip","loading"]),h.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(et),{key:0,icon:"close",tooltip:e.unref(s)("label.cancel"),onClick:$},null,8,["tooltip"]))])]),f.value?(e.openBlock(),e.createElementBlock("div",Ep,[e.createElementVNode("div",{class:"tiptap output",innerHTML:f.value},null,8,Np)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createElementVNode("section",Sp,[e.createVNode(e.unref(Se),{ref_key:"inputRef",ref:c,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":T[0]||(T[0]=v=>d.value=v),type:"text",placeholder:e.unref(s)("ai.askAi"),autofocus:"",onFocus:V},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"auto_awesome",class:"o-tips"})]),suffix:e.withCtx(()=>[e.createElementVNode("div",Op,[e.createVNode(e.unref(et),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0)}}),Ap={key:0,class:"o-inline-math-menu tiptap-toolbar"},Ur=e.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:oe.Editor,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:o}){const n=t,l=o,{run:r}=W(),a=e.ref(null),i=e.ref(""),s=e.ref(null);e.computed(()=>{const f=ot.InlinePlaceholderKey.getState(n.editor.state);return!!(f!=null&&f.active)});function c(){if(i.value="",s.value=null,n.editor.isActive("inlineMath")){const{state:f}=n.editor,{selection:u,schema:m}=f;if(u instanceof Ue.NodeSelection){const h=u.node;s.value=u.from,h.type.name==="inlineMath"&&(i.value=h.attrs.latex)}}setTimeout(()=>{var f;(f=a.value)==null||f.focus()},300)}function p(){console.log("latex",i.value,s.value),s.value?i.value?r(n.editor,"inlineMathUpdate",{latex:i.value}):r(n.editor,"inlineMathDelete",{pos:s.value}):i.value&&r(n.editor,"inlineMathInsert",{latex:i.value}),setTimeout(()=>{l("confirm")},0)}const d=()=>{n.editor.view.dispatch(n.editor.state.tr.setMeta(ot.InlinePlaceholderKey,{type:"hide"}))};return e.onMounted(()=>{c(),n.editor.on("focus",d)}),e.onUnmounted(()=>{n.editor.off("focus",d)}),(f,u)=>t.editor?(e.openBlock(),e.createElementBlock("section",Ap,[e.createVNode(e.unref(Se),{ref_key:"input",ref:a,modelValue:i.value,"onUpdate:modelValue":u[0]||(u[0]=m=>i.value=m),type:"text",autofocus:"",clearable:"",onKeydown:e.withKeys(e.withModifiers(p,["prevent"]),["enter"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"function",class:"o-tips"})]),suffix:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:p})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):e.createCommentVNode("",!0)}}),$p={key:0,class:"spinner"},et=e.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:o}){const n=t,l=o;function r(a){n.loading||l("click",a)}return(a,i)=>(e.openBlock(),e.createBlock(e.unref(Ce),{placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:e.withModifiers(r,["stop"])},[t.loading?(e.openBlock(),e.createElementBlock("div",$p)):(e.openBlock(),e.createBlock(e.unref(O),{key:1,name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"])),e.renderSlot(a.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Tp=e.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const{tr:o}=I();return(n,l)=>(e.openBlock(),e.createBlock(et,{"content-class":"o-ai-btn",icon:"auto_awesome",color:e.unref(q).purple,tooltip:e.unref(o)("ai.askAi")},null,8,["color","tooltip"]))}}),Dp={class:"o-align-group"},Mp=e.defineComponent({__name:"OAlignGroup",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.computed(()=>[{label:n("editor.left"),value:"left",icon:"format_align_left"},{label:n("editor.center"),value:"center",icon:"format_align_center"},{label:n("editor.right"),value:"right",icon:"format_align_right"}]);function a(i){l(o.editor,"textAlign",{textAlign:i.value})}return(i,s)=>(e.openBlock(),e.createElementBlock("div",Dp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(c,p)=>{var d;return e.openBlock(),e.createBlock(X,{key:p,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive({textAlign:c.value})},onClick:f=>a(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),Lp={class:"o-background-color-dropdown o-button-group"},Pp=e.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.ref("#ffec3d");function i(){s(a.value)}function s(c){r.value.setShow(!1),a.value=c,l(o.editor,"backgroundColor",{color:c})}return(c,p)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ce),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",Lp,[e.createVNode(e.unref(te),{icon:"background_color",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${a.value}`)},null,4)]),_:1}),e.createVNode(e.unref(te),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(n)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>{var d;return[e.createVNode(e.unref(st),{"default-color":"","default-label":e.unref(n)("editor.noColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("textStyle").backgroundColor,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),Rp={class:"o-highlight-dropdown o-button-group"},vp=e.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.ref("#ffec3d");function i(){s(a.value)}function s(c){r.value.setShow(!1),a.value=c,l(o.editor,"highlight",{color:c})}return(c,p)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ce),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",Rp,[e.createVNode(e.unref(te),{icon:"ink_highlighter",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${a.value}`)},null,4)]),_:1}),e.createVNode(e.unref(te),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(n)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>{var d;return[e.createVNode(e.unref(st),{"default-color":"","default-label":e.unref(n)("editor.noColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("highlight").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),Ip=e.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(t){const o=t,{run:n}=W(),{tr:l}=I();function r(){const{state:a}=o.editor,{selection:i}=a,{$from:s}=i,p=s.node().type.name;n(o.editor,"details",{type:p})}return(a,i)=>{var s;return e.openBlock(),e.createBlock(X,{class:"o-details-btn",icon:"toggle_list",tooltip:e.unref(l)("editor.toggleList"),"content-class":{"is-active":(s=t.editor)==null?void 0:s.isActive("details")},onClick:r},null,8,["tooltip","content-class"])}}}),jp=e.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null);function a(i){var s;(s=r.value)==null||s.setShow(!1),l(o.editor,"content",{content:i.emoji})}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:e.unref(n)("editor.emoji")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(wo),{items:e.unref(jt.emojiGroups),onSelect:a,"enable-search":""},null,8,["items"])]),_:1},512))}}),Fp=e.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.computed(()=>[{label:n("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function i(s){var c;(c=r.value)==null||c.setShow(!1),l(o.editor,"fontFamily",{fontFamily:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:e.unref(n)("editor.fontFamily")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(p,d)=>{var f;return e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[p.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ce),{class:e.normalizeClass({"is-active":(f=t.editor)==null?void 0:f.isActive("textStyle",{fontFamily:p.value})}),onClick:u=>i(p.value)},{suffix:e.withCtx(()=>{var u;return[(u=t.editor)!=null&&u.isActive("textStyle",{fontFamily:p.value})?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createElementVNode("span",{style:e.normalizeStyle(`font-family: ${p.value}`)},e.toDisplayString(p.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),zp={class:"o-fore-color-dropdown o-button-group"},Hp=e.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.ref("#ff4d4f");function i(){s(a.value)}function s(c){var p;(p=r.value)==null||p.setShow(!1),a.value=c,l(o.editor,"color",{color:c})}return(c,p)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ce),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",zp,[e.createVNode(e.unref(te),{icon:"format_color_text",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${a.value}`)},null,4)]),_:1}),e.createVNode(e.unref(te),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(n)("editor.textColor")),1)]),_:1})]),default:e.withCtx(()=>{var d;return[e.createVNode(e.unref(st),{"default-color":"","default-label":e.unref(n)("editor.defaultColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),Up=e.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:n("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:n("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:n("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:n("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:n("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function i(c){var p,d;return c.value==="heading"?(p=o.editor)==null?void 0:p.isActive(c.value,{level:c.valueAlt}):(d=o.editor)==null?void 0:d.isActive(c.value)}function s(c){var p;(p=r.value)==null||p.setShow(!1),l(o.editor,c.value,{level:c.valueAlt})}return(c,p)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:e.unref(n)("editor.heading")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(d,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f},[d.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ce),{class:e.normalizeClass({"is-active":i(d)}),onClick:u=>s(d)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(d)?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),qp=e.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(),a=e.ref(!1),i=e.ref(""),s=e.ref(null);function c(){if(o.editor.isActive("inlineMath")){const{state:u}=o.editor,{selection:m,schema:h}=u;if(m instanceof Ue.NodeSelection){const b=m.node;s.value=m.from,b.type.name==="inlineMath"&&(i.value=b.attrs.latex)}}}function p(){var u;(u=r.value)==null||u.setShow(!1)}function d(u){var m;console.log("confirm",u),u?l(o.editor,"inlineMathUpdate",{latex:u,pos:s.value}):l(o.editor,"inlineMathDelete",{pos:s.value}),(m=r.value)==null||m.setShow(!1)}function f(){window.open("https://katex.org/docs/supported.html","target")}return(u,m)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:a.value,"onUpdate:show":[m[0]||(m[0]=h=>a.value=h),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"edit",tooltip:e.unref(n)("label.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[a.value?(e.openBlock(),e.createBlock(e.unref(Co),{key:0,title:e.unref(n)("label.edit"),val:i.value,icon:"function",onCancel:p,onConfirm:d},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"help",tooltip:e.unref(n)("label.help"),onClick:f},null,8,["tooltip"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Wp={class:"o-list-dropdown o-button-group"},Yp=e.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.ref();function i(){l(o.editor,a.value.value)}function s(p){r.value.setShow(!1),a.value=p,l(o.editor,p.value)}const c=e.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);return e.onMounted(()=>{a.value=c.value[0]}),(p,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Ce),null,{trigger:e.withCtx(()=>{var f;return[e.createElementVNode("div",Wp,[e.createVNode(e.unref(te),{icon:(f=a.value)==null?void 0:f.icon,class:"o-command-btn",onClick:e.withModifiers(i,["stop"])},null,8,["icon"]),e.createVNode(e.unref(te),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:e.withCtx(()=>{var f;return[e.createTextVNode(" "+e.toDisplayString((f=a.value)==null?void 0:f.label),1)]}),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(f,u)=>{var m;return e.openBlock(),e.createBlock(e.unref(ce),{key:u,class:e.normalizeClass({"is-active":(m=t.editor)==null?void 0:m.isActive(f.value)}),onClick:h=>s(f)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:f.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var h;return[(h=t.editor)!=null&&h.isActive(f.value)?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),Gp={class:"o-list-group"},Kp=e.defineComponent({__name:"OListGroup",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.computed(()=>[{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.todoList"),value:"taskList",icon:"check_box"}]);function a(i){l(o.editor,i.value)}return(i,s)=>(e.openBlock(),e.createElementBlock("div",Gp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(c,p)=>{var d;return e.openBlock(),e.createBlock(X,{key:p,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(c.value)},onClick:f=>a(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),Xp=e.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(),a=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var u;i.value="",s.value=!0;const f=(u=o.editor)==null?void 0:u.getAttributes("link");f!=null&&f.href&&(i.value=f.href,s.value=f.target==="_blank")}function p(){var f;(f=r.value)==null||f.setShow(!1)}function d(f){var u;f?l(o.editor,"linkSet",{href:f,target:s.value?"_blank":""}):l(o.editor,"linkUnset"),(u=r.value)==null||u.setShow(!1)}return(f,u)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:a.value,"onUpdate:show":[u[1]||(u[1]=m=>a.value=m),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"edit",tooltip:e.unref(n)("link.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[a.value?(e.openBlock(),e.createBlock(e.unref(Co),{key:0,title:e.unref(n)("link.edit"),val:i.value,icon:"link",onCancel:p,onConfirm:d},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Vn),{modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=m=>s.value=m),label:e.unref(n)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Jp=e.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I();function l(){var a;const r=(a=o.editor)==null?void 0:a.getAttributes("link");r!=null&&r.href&&window.open(r.href,"target")}return(r,a)=>(e.openBlock(),e.createBlock(X,{icon:"open_in_new",tooltip:e.unref(n)("link.open"),"content-class":"o-link-open-btn",onClick:l},null,8,["tooltip"]))}}),Zp={class:"o-command-btn"},Qp={class:"o-more-bubble"},ef=e.defineComponent({__name:"OMoreBubble",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=e.ref();return(n,l)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:o,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:e.withCtx(()=>[e.createElementVNode("div",Zp,[e.createVNode(e.unref(O),{name:"more_horiz"})])]),default:e.withCtx(()=>[e.createElementVNode("section",Qp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(Ir),(r,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a},[r==="separator"?(e.openBlock(),e.createBlock(e.unref(fe),{key:0,vertical:""})):typeof r=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(To)(r)),{key:1,name:r,editor:t.editor},null,8,["name","editor"])):e.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),tf=e.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.computed(()=>[{label:n("editor.paragraph"),value:"paragraph",icon:"title"},{label:n("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:n("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:n("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:n("editor.todoList"),value:"taskList",icon:"check_box"},{label:n("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:n("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:n("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:n("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function i(c){var p;return(p=o.editor)==null?void 0:p.isActive(c.value,c.options)}function s(c){r.value.setShow(!1),l(o.editor,c.value,c.options)}return(c,p)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:e.unref(n)("label.styles")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(d,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f},[d.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ce),{class:e.normalizeClass({"is-active":i(d)}),onClick:u=>s(d)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(d)?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),of=e.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null);function a(i){var s;(s=r.value)==null||s.setShow(!1),l(o.editor,"tableInsert",i)}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"window","content-class":"o-table-btn",tooltip:e.unref(n)("table.insert")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(lr),{onSelect:a})]),_:1},512))}}),nf={class:"o-table-group"},lf=e.defineComponent({__name:"OTableGroup",props:{editor:{type:oe.Editor,required:!0}},setup(t){const{tr:o}=I(),{run:n}=W();return(l,r)=>{var a,i;return e.openBlock(),e.createElementBlock("section",nf,[(a=t.editor)!=null&&a.can().mergeCells()?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:"cell_merge",tooltip:e.unref(o)("table.merge"),onClick:r[0]||(r[0]=s=>e.unref(n)(t.editor,"tableMergeCells"))},null,8,["tooltip"])):e.createCommentVNode("",!0),(i=t.editor)!=null&&i.can().splitCell()?(e.openBlock(),e.createBlock(e.unref(X),{key:1,icon:"splitscreen_left",tooltip:e.unref(o)("table.split"),onClick:r[1]||(r[1]=s=>e.unref(n)(t.editor,"tableSplitCell"))},null,8,["tooltip"])):e.createCommentVNode("",!0),e.createVNode(e.unref(rr),{editor:t.editor},null,8,["editor"])])}}}),rf=e.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(null),a=e.ref(""),i=e.ref("");function s(c){c.name==="color"?(a.value=c.value,localStorage.setItem("yiitap.text-color.fore",c.value)):c.name==="backColor"&&(i.value=c.value,localStorage.setItem("yiitap.text-color.back",c.value)),r.value.setShow(!1),l(o.editor,c.name,{color:c.value})}return e.onMounted(()=>{a.value=localStorage.getItem("yiitap.text-color.fore")||"",i.value=localStorage.getItem("yiitap.text-color.back")||""}),(c,p)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:e.unref(n)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var d;return[e.createVNode(e.unref(bn),{"fore-color":a.value,"back-color":i.value,"default-label":e.unref(n)("editor.defaultColor"),"active-color":(d=t.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:s},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),af=e.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=I(),{run:l}=W(),r=e.ref(),a=e.computed(()=>[{label:n("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:n("editor.underline"),value:"underline",icon:"format_underlined"},{label:n("editor.code"),value:"code",icon:"code",separator:!0},{label:n("editor.subscript"),value:"subscript",icon:"subscript",separator:!0},{label:n("editor.superscript"),value:"superscript",icon:"superscript"}]);function i(s){var c;(c=r.value)==null||c.setShow(!1),l(o.editor,s)}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:e.unref(n)("editor.textFormat")},{default:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(p,d)=>{var f;return e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[p.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ce),{class:e.normalizeClass({"is-active":(f=t.editor)==null?void 0:f.isActive(p.value)}),onClick:u=>i(p.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:p.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var u;return[(u=t.editor)!=null&&u.isActive(p.value)?(e.openBlock(),e.createBlock(e.unref(O),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),cf={ai:Tp,"align-dropdown":pn,"align-group":Mp,"background-color":Pp,color:Hp,details:Ip,"extension-dropdown":Xl,"font-family":Fp,heading:Up,highlight:vp,"inline-math-edit":qp,"list-dropdown":Yp,"list-group":Kp,link:fn,"link-edit":Xp,"link-open":Jp,emoji:jp,more:ef,"style-dropdown":tf,table:of,"table-group":lf,"text-color-dropdown":rf,"text-format-dropdown":af},To=t=>cf[t]||Vc,sf={key:0,class:"o-main-menu"},df={class:"left"},pf={class:"right"},qr=e.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(t){const o=t,n=e.computed(()=>{var r;let l=o.menu;return(r=o.editor)!=null&&r.isActive("table")&&(l=Dr),l.length>0?l:Tr});return(l,r)=>t.editor?(e.openBlock(),e.createElementBlock("section",sf,[e.createElementVNode("section",df,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[a==="separator"?(e.openBlock(),e.createBlock(e.unref(fe),{key:0,vertical:""})):typeof a=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(To)(a)),{key:1,name:a,editor:t.editor},null,8,["name","editor"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a),{key:2,editor:t.editor},null,8,["editor"]))],64))),128)),e.renderSlot(l.$slots,"left")]),e.createElementVNode("section",pf,[e.renderSlot(l.$slots,"right")])])):e.createCommentVNode("",!0)}}),ff={key:0},uf=e.defineComponent({__name:"OBubbleMenu",props:{editor:{type:oe.Editor},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""},aiOptions:{type:Object,default:()=>{}}},setup(t){const o=t,{tr:n}=I(),{theme:l}=it(),r=e.ref(!1),a=e.ref(!1),i=e.ref(!1),s=e.ref(!1),c=e.ref({offset:10,placement:"bottom-start",onShow:()=>{r.value=!1,a.value=!1,i.value=!1},onHide:()=>{i.value=!1}});function p(){r.value=!0}function d(_){_==="ai"&&(a.value=!0)}function f(){i.value=!0}function u(_){const{schema:g}=o.editor,V=g.marks.link;if(!V||!_)return!1;const{$from:B,$to:$}=_;return!!oe.getMarkRange(B,V)}function m({editor:_,element:g,view:V,state:B,oldState:$,from:R,to:D}){var j;const{doc:M,selection:H}=B,{empty:N}=H,S=!M.textBetween(R,D).length&&oe.isTextSelection(B.selection);if(s.value=o.editor.isActive("inlineMath"),k.value||o.editor.isActive("inlineMath"))return!0;if(!V.hasFocus()||N||i.value||S&&_.isActive("link")&&!_.isActive("image"))return!1;const T=["image"],v=["image","toc","video","model-viewer"],U=H.node,K=(j=U==null?void 0:U.type)==null?void 0:j.name;return!(_.isActive("codeBlock")||v.indexOf(K)>=0||K&&!T.includes(K))}const h=e.computed(()=>{if(o.editor){const{state:_}=o.editor,{tr:g}=_,{selection:V}=g;return u(V)}else return!1}),b=e.computed(()=>{var _,g;return!r.value&&!((_=o.editor)!=null&&_.isActive("image"))&&(h.value||((g=o.editor)==null?void 0:g.isActive("inlineMath")))}),y=e.computed(()=>k.value||s.value),x=e.computed(()=>{var g,V,B;let _=o.menu;return r.value||((g=o.editor)!=null&&g.isActive("image")?_=h.value?vr:Rr:(V=o.editor)!=null&&V.isActive("table")?_=jr:h.value?_=Pr:(B=o.editor)!=null&&B.isActive("inlineMath")&&(_=Lr)),_.length>0?_:Mr}),k=e.computed(()=>{const _=ot.InlinePlaceholderKey.getState(o.editor.state);return!!(_!=null&&_.active)});return e.onMounted(()=>{r.value=!1}),(_,g)=>t.editor?(e.openBlock(),e.createElementBlock("section",ff,[e.createVNode(e.unref(jn.BubbleMenu),{editor:t.editor,"should-show":m,options:c.value},{default:e.withCtx(()=>[a.value?(e.openBlock(),e.createBlock(e.unref(Hr),{key:0,editor:t.editor,"ai-options":t.aiOptions,onConfirm:f},null,8,["editor","ai-options"])):y.value?(e.openBlock(),e.createBlock(e.unref(Ur),{key:1,editor:t.editor},null,8,["editor"])):(e.openBlock(),e.createElementBlock("section",{key:2,class:e.normalizeClass(["tiptap-toolbar",t.menuClass])},[b.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(X),{icon:"arrow_back",tooltip:e.unref(n)("link.back"),onClick:p},null,8,["tooltip"]),e.createVNode(e.unref(fe),{vertical:""})],64)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,(V,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:B},[V==="separator"?(e.openBlock(),e.createBlock(e.unref(fe),{key:0,vertical:""})):typeof V=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(To)(V)),{key:1,name:V,editor:t.editor,onClick:$=>d(V)},null,8,["name","editor","onClick"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(V),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}}),mf={key:0},gf=e.defineComponent({__name:"OFloatingMenu",props:{editor:{type:P.Editor},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const o=t,n=e.ref(!1),l=e.ref({placement:"right",offset:168});function r(){n.value=!0}function a(d){const{schema:f}=o.editor,u=f.marks.link;if(!u||!d)return!1;const{$from:m,$to:h}=d;return!!oe.getMarkRange(m,u)}const i=e.computed(()=>{if(o.editor){const{state:d}=o.editor,{tr:f}=d,{selection:u}=f;return a(u)}else return!1}),s=e.computed(()=>!n.value&&i.value),c=e.computed(()=>{const d=o.menu;return d.length>0?d:Fr}),p=e.computed(()=>{const d=ot.InlinePlaceholderKey.getState(o.editor.state);return!!(d!=null&&d.active)});return(d,f)=>t.editor&&!p.value?(e.openBlock(),e.createElementBlock("section",mf,[e.createVNode(e.unref(jn.FloatingMenu),{editor:t.editor,options:l.value},{default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["tiptap-toolbar",t.menuClass])},[s.value?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:"arrow_back",onClick:r})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(u,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m},[u==="separator"?(e.openBlock(),e.createBlock(e.unref(fe),{key:0,vertical:""})):typeof u=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(To)(u)),{key:1,name:u,editor:t.editor},null,8,["name","editor"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2)]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}});function Sn(t,o){const n=o==null?void 0:o.posAtCoords(t);if(!n)return;let l=Do(n.pos,o);if(l!==o.dom){for(;l&&l.parentNode&&l.parentNode!==o.dom;)l=l.parentNode;if(l)return l}}function Do(t,o){return o.nodeDOM(t)||o.domAtPos(t).node}function On(t,o){const n=Sn(t,o);if(n&&n.nodeType===1){const l=o.docView,r=l.nearestDesc(n,!0);return!r||r===l?null:r.posBefore}return null}function bf(t,o){let n,l;const r=o.resolve(t.from).node().type.spec.group==="blockContent",a=o.resolve(t.to).node().type.spec.group==="blockContent",i=Math.min(t.$anchor.depth,t.$head.depth);if(r&&a){const s=t.$from.start(i-1),c=t.$to.end(i-1);n=o.resolve(s-1).pos,l=o.resolve(c+1).pos}else n=t.from,l=t.to;return{from:n,to:l}}function hf(t,o){const n=On(t,o.view);return typeof n=="number"&&n>=0?{node:o.state.doc.nodeAt(n),pos:n}:{node:null,pos:n}}const ro=new Ue.PluginKey("sideMenu");class kf{constructor(){ne(this,"hovered",!1);ne(this,"coords",{left:0,top:0});ne(this,"className","")}init(o){return this}apply({tr:o,oldState:n,newState:l}){return o.docChanged?this:this}setHover(o,n,l=""){this.hovered=o,this.coords=n,this.className=l}}class yf{constructor({editor:o,element:n,view:l,tippyOptions:r={},updateDelay:a=250}){ne(this,"editor");ne(this,"element");ne(this,"view");ne(this,"preventHide",!1);ne(this,"tippy");ne(this,"tippyOptions");ne(this,"updateDelay");ne(this,"updateDebounceTimer");ne(this,"mousedownHandler",()=>{this.preventHide=!0});ne(this,"onDragStart",o=>{this.hide()});ne(this,"blurHandler",({event:o})=>{var n;o!=null&&o.relatedTarget&&((n=this.element.parentNode)!=null&&n.contains(o.relatedTarget))||this.hide()});ne(this,"tippyBlurHandler",o=>{this.blurHandler({event:o})});ne(this,"handleDebouncedUpdate",(o,n)=>{const l=!(n!=null&&n.selection.eq(o.state.selection)),r=!(n!=null&&n.doc.eq(o.state.doc));!l&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(o,l,r,n)},this.updateDelay))});ne(this,"updateHandler",(o,n,l,r)=>{var p,d;const{state:a,composing:i}=o,{coords:s}=ro.getState(a),c=Sn(s,o);On(s,o),c&&(this.createTooltip(),(d=this.tippy)==null||d.setProps({getReferenceClientRect:((p=this.tippyOptions)==null?void 0:p.getReferenceClientRect)||(()=>c.getBoundingClientRect())}),this.show())});this.editor=o,this.element=n,this.view=l,this.updateDelay=a,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:o}=this.editor.options,n=o instanceof Element?o:"mount"in o?o.mount:null,l=!!(n!=null&&n.parentElement);this.tippy||!l||(this.tippy=Ge(n,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(o,n){const{state:l}=o,r=!(n!=null&&n.selection.eq(o.state.selection)),a=!(n!=null&&n.doc.eq(o.state.doc));this.updateHandler(o,r,a,n)}show(){var o;(o=this.tippy)==null||o.show()}hide(){var o;(o=this.tippy)==null||o.hide()}destroy(){var o,n;(o=this.tippy)!=null&&o.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)==null||n.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const wf=(t,o)=>{if(!t.dataTransfer)return;const{view:n}=o;n.dom.getBoundingClientRect();const l=ro.getState(n.state),r={left:l.coords.left,top:l.coords.top},a=On(r,n);if(a===null)return;const i=n.state.selection,s=n.state.doc;bf(i,s),n.dispatch(n.state.tr.setSelection(Ue.NodeSelection.create(n.state.doc,a))),n.dom.classList.add("is-dragging"),xf(n,a);const c=n.state.selection.content(),{dom:p,text:d}=n.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",p.innerHTML),t.dataTransfer.setData("text/plain",d),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(ut,0,0),n.dragging={slice:c,move:!0}},Cf=(t,o)=>{const{view:n}=o;n.dom.classList.remove("is-dragging"),Wr()};let ut;function xf(t,o,n=o){const l=t.domAtPos(o).node.cloneNode(!0),r=t.domAtPos(o).node,a=(f,u)=>Array.prototype.indexOf.call(f.children,u),i=f=>{let u=f,m=u.parentElement;for(;m;){if(m===t.dom)return u;u=m,m=u.parentElement}return u};let s=-1,c=-1;o===n?(s=a(r,i(Do(o,t))),c=s):(s=a(r,i(Do(o+1,t))),c=a(r,i(Do(n-1,t))));for(let f=r.childElementCount-1;f>=0;f--)(f>s||f<c)&&l.removeChild(l.children[f]);Wr(),ut=l;const d=t.dom.className.split(" ").filter(f=>f!=="ProseMirror"&&f!=="yiitap-root"&&f!=="yiitap-editor").join(" ");ut.className+=" yiitap-dragging-preview "+d,document.body.appendChild(ut)}function Wr(){ut!==void 0&&(document.body.removeChild(ut),ut=void 0)}class _f{constructor(o){ne(this,"options");ne(this,"plugin");ne(this,"sideMenuView");const n=new kf;this.options=o,this.plugin=new Ue.Plugin({key:ro,props:{handleDOMEvents:{mouseover(l,r){const a={left:r.clientX,top:r.clientY},i=Sn(a,l),s=(i==null?void 0:i.className)||"",c=n.className;s.indexOf("o-table-wrapper-view")>=0&&c.indexOf("o-table-wrapper-view")>=0||(n.setHover(!0,a,s),l.dispatch(l.state.tr.setMeta(ro,n)))}}},state:{init(l,r){return n.init(r)},apply(l,r,a,i){return n.apply({tr:l,oldState:a,newState:i})}},view:l=>(this.sideMenuView=new yf({view:l,...o}),this.sideMenuView)})}dragstart(o){wf(o,this.options.editor)}dragend(o){Cf(o,this.options.editor)}}const Bf=e.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(t,{expose:o,slots:n}){const l=e.ref(null),r=e.ref(),a=s=>{var c;(c=r.value)==null||c.dragstart(s)},i=s=>{var c;(c=r.value)==null||c.dragend(s)};return e.onMounted(()=>{const{pluginKey:s,editor:c,updateDelay:p,tippyOptions:d}=t;r.value=new _f({updateDelay:p,editor:c,element:l.value,pluginKey:s,tippyOptions:d}),c.registerPlugin(r.value.plugin)}),e.onBeforeUnmount(()=>{const{pluginKey:s,editor:c}=t;c.unregisterPlugin(s)}),o({...t,dragstart:a,dragend:i}),()=>{var s;return e.h("div",{ref:l},(s=n.default)==null?void 0:s.call(n))}}}),Vf={key:0,class:"o-side-menu"},Ef={class:"container"},Nf=e.defineComponent({__name:"OSideMenu",props:{editor:{type:oe.Editor,required:!0},menuClass:{type:String,default:""},add:{type:String,default:"menu"},title:{type:Boolean,default:!1}},setup(t){const o=t,n=e.ref(null),l=e.ref(null),r=e.ref(0),a=e.computed(()=>({arrow:!1,duration:100,placement:"left"})),i=e.computed(()=>({editor:o.editor,node:l.value,decorations:[],selected:!1,extension:{},getPos:()=>r.value,pos:r.value,updateAttributes:c,deleteNode:s,view:{},innerDecorations:[],HTMLAttributes:{},add:o.add}));function s(){var h,b;const u=r.value,m=u+((h=l.value)==null?void 0:h.nodeSize);(b=o.editor)==null||b.commands.deleteRange({from:u,to:m})}function c(u){var m;(m=o.editor)==null||m.commands.command(({tr:h})=>{var b;return h.setNodeMarkup(r.value,void 0,{...(b=l.value)==null?void 0:b.attrs,...u}),!0})}function p({editor:u,transaction:m}){let h={left:0,top:0};const b=ro.getState(o.editor.view.state);if(b){h=b.coords;const y=hf(h,u);y.node&&(o.title&&y.pos===0?l.value=null:(!o.title||y.pos>0)&&(l.value=y.node,r.value=y.pos))}}function d(u){var m;(m=n.value)==null||m.dragstart(u)}function f(u){var m;(m=n.value)==null||m.dragend(u)}return e.onMounted(()=>{var u;(u=o.editor)==null||u.on("transaction",p)}),(u,m)=>t.editor?(e.openBlock(),e.createElementBlock("section",Vf,[e.createVNode(e.unref(Bf),{ref_key:"menu",ref:n,class:e.normalizeClass(["side-menu",t.menuClass]),editor:t.editor,"tippy-options":a.value},{default:e.withCtx(()=>[e.createElementVNode("section",Ef,[l.value?(e.openBlock(),e.createBlock(e.unref(Er),e.normalizeProps(e.mergeProps({key:0},i.value)),null,16)):e.createCommentVNode("",!0),l.value?(e.openBlock(),e.createBlock(e.unref(Nr),e.mergeProps({key:1},i.value,{onDragstart:d,onDragend:f}),null,16)):e.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):e.createCommentVNode("",!0)}}),Sf={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:o}=I(),{run:n}=W();return{locale:t,tr:o,run:n}},data(){return{view:"main"}},components:{OEmojiSelect:wo},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},An=(t,o)=>{const n=t.__vccOpts||t;for(const[l,r]of o)n[l]=r;return n},Of={class:"o-colon-view"};function Af(t,o,n,l,r,a){const i=e.resolveComponent("o-emoji-select");return e.openBlock(),e.createElementBlock("section",Of,[e.createVNode(i,{items:n.items,onSelect:a.onSelect},null,8,["items","onSelect"])])}const $f=An(Sf,[["render",Af]]),Yr={items:({query:t})=>jt.filterEmojiGroups(t),render:()=>{let t,o;return{onStart:n=>{t=new P.VueRenderer($f,{props:n,editor:n.editor}),n.clientRect&&(o=Ge("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(l){l.popper.classList.add("emoji-tippy")}}))},onUpdate(n){t.updateProps(n),o[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var l;return n.event.key==="Escape"?(o[0].hide(),t.destroy(),!0):(l=t.ref)==null?void 0:l.onKeyDown(n)},onExit(){o[0].destroy(),t.destroy()}}}},Tf={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:oe.Editor},range:{type:Object}},setup(){const{locale:t,tr:o}=I(),{onCommand:n,run:l}=W();return{locale:t,tr:o,onCommand:n,run:l}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:fe,OIcon:O,OList:se,OListItem:ce},watch:{items(){this.selectedIndex=0}},methods:{onClick(t){switch(t.value){default:this.runCommand(t);break}return!0},runCommand(t){const o=this.editor.chain().focus().deleteRange(this.range),n=this.editor.commands;["blockMath","codeBlock","content","details","diagram","emoji","inlineMath","multiColumn","taskList"].includes(t.value)?(n.deleteRange(this.range),this.run(this.editor,t.value,t.options)):this.onCommand(n,o,t.value,t.options)},onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const o=this.items[t];o&&this.onClick(o)},setEmoji(t){this.onClick({value:"content",options:{content:t}})}},computed:{basicBlocks(){return Zt.slice(1)}},mounted(){this.selectedIndex=0}},Df={key:0,class:"view-main"},Mf={class:"group o-tips"},Lf={class:"o-tips"},Pf={key:1,class:"item"},Rf={key:1,class:"view-emoji"},vf={key:2,class:"view-emoji"};function If(t,o,n,l,r,a){const i=e.resolveComponent("o-divider"),s=e.resolveComponent("o-icon"),c=e.resolveComponent("o-list-item"),p=e.resolveComponent("o-list");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${r.view}`])},[r.view==="main"?(e.openBlock(),e.createElementBlock("section",Df,[e.createVNode(p,{hoverable:"",clickable:""},{default:e.withCtx(()=>[n.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.items,(d,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f},[d.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[f>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",Mf,e.toDisplayString(l.tr(d.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(c,{class:e.normalizeClass(["item",{"is-active":f===r.selectedIndex}]),clickable:"",onClick:u=>a.onClick(d)},{prefix:e.withCtx(()=>[e.createVNode(s,{name:d.icon,color:d.color},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("span",Lf,e.toDisplayString(d.tips),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(l.tr(d.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",Pf,"No result"))]),_:1})])):r.view==="emoji"?(e.openBlock(),e.createElementBlock("section",Rf)):r.view==="ai"?(e.openBlock(),e.createElementBlock("section",vf)):e.createCommentVNode("",!0)],2)}const jf=An(Tf,[["render",If]]),$n={items:({query:t})=>ko.filter(o=>{var n;return o.value.toLowerCase().includes(t.toLowerCase())||((n=o.keywords)==null?void 0:n.toLowerCase().includes(t.toLowerCase()))}),render:()=>{let t,o;return{onStart:n=>{t=new P.VueRenderer(jf,{props:n,editor:n.editor}),n.clientRect&&(o=Ge("body",{getReferenceClientRect:n.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:l=>{l.popper.classList.add("slash-tippy")}}))},onUpdate(n){t.updateProps(n),o[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var l;return n.event.key==="Escape"?(o[0].hide(),t.destroy(),!0):(l=t.ref)==null?void 0:l.onKeyDown(n)},onExit(){o[0].destroy(),t.destroy()}}}},Ff={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const o=this.items[t];o&&this.command({name:o.name})}}},zf={class:"dropdown-menu"},Hf=["onClick"],Uf=["src"];function qf(t,o,n,l,r,a){return e.openBlock(),e.createElementBlock("div",zf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.items,(i,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass({"is-selected":s===r.selectedIndex}),key:s,onClick:c=>a.selectItem(s)},[i.fallbackImage?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.fallbackImage,align:"middle"},null,8,Uf)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i.emoji),1)],64)),e.createTextVNode(" :"+e.toDisplayString(i.name)+": ",1)],10,Hf))),128))])}const Wf=An(Ff,[["render",qf]]),Yf={items:({editor:t,query:o})=>t.storage.emoji.emojis.filter(({shortcodes:n,tags:l})=>n.find(r=>r.startsWith(o.toLowerCase()))||l.find(r=>r.startsWith(o.toLowerCase()))).slice(0,10),render:()=>{let t;function o(n){if(!t||!t.element)return;Vr({getBoundingClientRect(){return n}},t.element,{placement:"bottom-start"}).then(r=>{Object.assign(t.element.style,{left:`${r.x}px`,top:`${r.y}px`,position:r.strategy==="fixed"?"fixed":"absolute"})})}return{onStart:n=>{t=new P.VueRenderer(Wf,{props:n,editor:n.editor}),document.body.appendChild(t.element),o(n.clientRect())},onUpdate(n){t.updateProps(n),o(n.clientRect())},onKeyDown(n){var l;return n.event.key==="Escape"?(document.body.removeChild(t.element),t.destroy(),!0):(l=t.ref)==null?void 0:l.onKeyDown(n)},onExit(){document.body.contains(t.element)&&document.body.removeChild(t.element),t.destroy()}}}},Gf={class:"o-scroll"},Kf={class:"view-main"},Xf={class:"block-container"},Jf={class:"block-content"},Zf={key:0,class:"edit-prompt"},Qf={key:1},eu={"data-tippy-role":"tooltip"},tu={class:"label"},ou={class:"block-container"},nu={class:"block-content"},lu=100,ru=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{md:n}=sn(),{languageName:l,tr:r}=I(),{isFocused:a,bind:i,unbind:s,checkFocus:c}=Wl(),{theme:p}=it(),{isEditable:d}=W(),{getPos:f}=o,{provider:u,onStreamingChatCompletion:m}=o.extension.options,h=e.ref(null),b=e.ref(""),y=e.ref(!1),x=e.ref({}),k=e.ref(!1),_=e.ref(!1),g=e.ref(""),V=e.ref(null),B=e.ref(!1),$=e.ref(!1);let R=0;const D=e.computed(()=>({role:"system",content:Nn.writing.replace("[LANGUAGE]",l.value)})),M=e.ref([D.value]),H=e.computed(()=>!o.node.textContent),N=e.computed(()=>or),S=e.computed({get(){return o.node.attrs.provider},set(F){o.updateAttributes({provider:F})}}),T=e.computed({get(){return o.node.attrs.prompt},set(F){o.updateAttributes({prompt:F})}}),v=e.computed({get(){return o.node.attrs.time},set(F){o.updateAttributes({time:F})}});function U(){b.value=T.value,H.value&&!T.value&&setTimeout(()=>{var F;(F=h.value)==null||F.focus()},0)}function K(){setTimeout(()=>{},0)}function j(){g.value="edit",setTimeout(()=>{var F;(F=V.value)==null||F.focus()},0)}function A(){S.value=u.provider,T.value=b.value,v.value=Date.now(),B.value=!0,g.value&&(g.value=""),$.value?me():J()}async function J(){const F=f();let G="";if(M.value.push({role:"user",content:T.value}),M.value[0].role==="system"&&(M.value.shift(),M.value.unshift(D.value)),!m){lo.error("AI Completion method not implemented."),B.value=!1;return}try{const Q=await m({messages:M.value,options:{id:o.node.attrs.id,type:"ai-block"},onChunk:ae=>{G+=ae,M.value=[...M.value.slice(0,-1),{role:"assistant",content:G}];const De=Date.now();De-R>lu&&(ee(F,G),R=De)}});ee(F,G)}catch(Q){M.value.pop(),console.error(Q),lo.error(r("ai.error"))}finally{B.value=!1}}function ee(F,G){const Q=n.render(G),ae=mn(o.editor,Q);ge(F,ae)}async function me(){const F=f();let G="";try{for(const Q of zr){await new Promise(De=>setTimeout(De,500)),G+=Q;const ae=Jl(o.editor,n.render(G));ge(F,ae)}}catch(Q){console.error(Q)}B.value=!1}function ge(F,G){var ae;const Q=o.node.toJSON();Q.content=G.content,(ae=o.editor)==null||ae.commands.updateAiBlock(F,Q),o.editor.commands.setNodeSelection(F),o.editor.view.focus(),de()}function de(){const G=o.node.content.lastChild;if(G&&G.attrs.id){const Q=G.attrs.id,ae=document.querySelector(`[data-id="${Q}"]`);ae&&ae.scrollIntoView({behavior:"smooth",block:"center"})}}function le(F){y.value=!1,F.value}function re(F,G){G?b.value=r(G.label):b.value=r(F.label),k.value=!1}function Oe(F){y.value=!0,x.value=F}return e.watch(()=>o.node.content,F=>{c()}),e.watch(H,F=>{F&&(_.value=!1)}),e.watch(a,F=>{F&&!H.value&&setTimeout(()=>{b.value=T.value,g.value="",_.value=F},100)}),e.onMounted(()=>{U(),i(o)}),e.onBeforeUnmount(()=>{s()}),(F,G)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:["o-ai-block-view",{"is-empty":H.value,"has-focus":e.unref(a)}],onContextmenu:e.withModifiers(Oe,["prevent"])}),{default:e.withCtx(()=>[H.value?(e.openBlock(),e.createBlock(e.unref(ve),{key:0,modelValue:k.value,"onUpdate:modelValue":G[1]||(G[1]=Q=>k.value=Q),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":e.withCtx(()=>[e.createElementVNode("section",Gf,[e.createElementVNode("section",Kf,[e.createVNode(e.unref(go),{items:N.value,onSelect:re,"use-keyboard":k.value},null,8,["items","use-keyboard"])])])]),default:e.withCtx(()=>[e.createElementVNode("div",Xf,[e.createElementVNode("div",Jf,[e.createVNode(e.unref(Se),{ref_key:"inputRef",ref:h,modelValue:b.value,"onUpdate:modelValue":G[0]||(G[0]=Q=>b.value=Q),placeholder:e.unref(r)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:K},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(et),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(r)("label.generate"),loading:B.value,onClick:A},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.withDirectives(e.createVNode(e.unref(ve),{modelValue:_.value,"onUpdate:modelValue":G[4]||(G[4]=Q=>_.value=Q),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":e.withCtx(()=>[g.value==="edit"?(e.openBlock(),e.createElementBlock("section",Zf,[e.createVNode(e.unref(Se),{ref_key:"updateInputRef",ref:V,modelValue:b.value,"onUpdate:modelValue":G[2]||(G[2]=Q=>b.value=Q),placeholder:e.unref(r)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(et),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(r)("label.generate"),loading:B.value,onClick:A},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(e.openBlock(),e.createElementBlock("section",Qf,[e.createVNode(e.unref(Sr),null,{default:e.withCtx(()=>[e.createElementVNode("div",eu,[e.createVNode(e.unref(te),{icon:"auto_awesome",onClick:j},{default:e.withCtx(()=>[e.createElementVNode("span",tu,e.toDisplayString(e.unref(r)("label.generatedBy"))+" "+e.toDisplayString(S.value||"AI"),1)]),_:1})]),e.createVNode(e.unref(et),{icon:"autorenew",tooltip:e.unref(r)("label.update"),loading:B.value,onClick:A},null,8,["tooltip","loading"])]),_:1})]))]),default:e.withCtx(()=>[e.createElementVNode("div",ou,[e.createElementVNode("div",nu,[e.createVNode(e.unref(P.NodeViewContent))]),e.unref(d)?(e.openBlock(),e.createBlock(e.unref(ct),{key:0,modelValue:y.value,"onUpdate:modelValue":G[3]||(G[3]=Q=>y.value=Q),event:x.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:le}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[e.vShow,!H.value]])]),_:1},16,["class"]))}}),Gr=xa.extend({addNodeView(){return P.VueNodeViewRenderer(ru)}}),au={key:1,class:"audio-container"},Tt="//init.mp3",iu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{tr:n}=I(),{isEditable:l}=W(),r=e.ref(!1),a=e.ref({});e.ref(null),e.ref(!1);const i=e.ref(!1);e.computed({get(){return o.node.attrs.caption},set(m){o.updateAttributes({caption:m})}});const s=e.computed({get(){return o.node.attrs.src},set(m){o.updateAttributes({src:m})}});function c(m){switch(r.value=!1,m.value){case"replace":u(!0);break}}function p(){s.value===Tt&&u(!0)}function d(m){r.value=!0,a.value=m}function f(m){s.value=m,u(!1)}function u(m){i.value=m}return e.onMounted(()=>{u(s.value===Tt)}),(m,h)=>{var b;return e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:["o-audio-view",{readonly:!((b=m.editor)!=null&&b.isEditable),init:s.value===Tt}],as:"div",onContextmenu:e.withModifiers(d,["prevent"]),onClick:p}),{default:e.withCtx(()=>[e.createVNode(e.unref(ve),{modelValue:i.value,"onUpdate:modelValue":h[0]||(h[0]=y=>i.value=y),placement:s.value===Tt?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(to),{val:s.value===Tt?"":s.value,type:"audio",onInput:f},null,8,["val"])]),default:e.withCtx(()=>[s.value===Tt?(e.openBlock(),e.createBlock(e.unref(Nt),{key:0,icon:"graphic_eq",placeholder:e.unref(n)("label.audioAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",au,[e.unref(l)?(e.openBlock(),e.createBlock(e.unref(Qt),e.mergeProps({key:0},o,{onAction:c}),{default:e.withCtx(()=>[e.createCommentVNode("",!0)]),_:1},16)):e.createCommentVNode("",!0),e.createElementVNode("audio",e.mergeProps(m.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[e.createElementVNode("source",e.normalizeProps(e.guardReactiveProps(m.node.attrs)),null,16)],16)]))]),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(ct),{modelValue:r.value,"onUpdate:modelValue":h[1]||(h[1]=y=>r.value=y),event:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:c}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),Kr=_a.extend({addNodeView(){return P.VueNodeViewRenderer(iu)}}),cu={class:"header o-tips"},su={style:{display:"flex"}},du=["innerHTML"],pu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{tr:n}=I(),{isEditable:l}=W(),r=e.ref(!1),a=e.ref(null),i=e.computed({get(){return o.node.attrs.latex},set(d){o.updateAttributes({latex:d||""})}}),s=e.computed(()=>Ba.renderToString(i.value,{throwOnError:!1}));function c(d){r.value=d,d&&setTimeout(()=>{var f;(f=a.value)==null||f.focus()},100)}function p(){window.open("https://katex.org/docs/supported.html","target")}return e.onMounted(()=>{c(!i.value)}),(d,f)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:["o-block-math-view",{init:!i.value}],as:"div",onClick:f[3]||(f[3]=u=>c(!0))}),{default:e.withCtx(()=>[e.createVNode(e.unref(ve),{modelValue:r.value,"onUpdate:modelValue":f[2]||(f[2]=u=>r.value=u),"content-class":"o-block-math-editor",placement:i.value==="init"?"bottom":"top",readonly:!e.unref(l),"show-arrow":""},{"popover-content":e.withCtx(()=>[e.createElementVNode("header",cu,[e.createElementVNode("div",su,[e.createVNode(e.unref(O),{name:"functions"}),e.createTextVNode(" "+e.toDisplayString(e.unref(n)("editor.blockMath")),1)]),e.createElementVNode("div",null,[e.createVNode(e.unref(ie),{icon:"help",tooltip:e.unref(n)("label.help"),onClick:p},null,8,["tooltip"])])]),e.createVNode(e.unref(Ar),{ref_key:"input",ref:a,modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=u=>i.value=u),placeholder:"Input block math ...",autofocus:"",clearable:""},null,8,["modelValue"])]),default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"block-math-container",onClick:f[1]||(f[1]=u=>c(!0))},[e.createElementVNode("div",{class:"katex-container",innerHTML:s.value},null,8,du)])):(e.openBlock(),e.createBlock(e.unref(Nt),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),Xr=Ft.BlockMath.extend({addCommands(){return{insertBlockMath:(t={})=>({tr:o,dispatch:n,state:l})=>{const r=l.schema.nodes.blockMath.create({latex:t.latex??""});return n&&(o.replaceSelectionWith(r),o.scrollIntoView()),!0}}},addNodeView(){return P.VueNodeViewRenderer(pu)}}),fu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t;return(n,l)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:"o-blockquote-view"}),{default:e.withCtx(()=>[e.createElementVNode("blockquote",null,[e.createVNode(e.unref(P.NodeViewContent))])]),_:1},16))}}),Jr=Va.extend({addNodeView(){return P.VueNodeViewRenderer(fu)}}),uu={class:"callout-container"},mu={class:"callout-icon"},gu={class:"callout-content"},bu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{theme:n}=it(),{isEditable:l}=W(),r=e.ref(!1),a=e.ref(!1),i=e.ref({}),s=e.ref(null),c=e.computed(()=>{const{selection:g}=o.editor.view.state,V=g.from,B=o.getPos(),$=B+o.node.nodeSize;return V>=B&&V<=$}),p=e.computed({get(){return o.node.attrs.backColor},set(g){o.updateAttributes({backColor:g})}}),d=e.computed({get(){return o.node.attrs.backColorDark},set(g){o.updateAttributes({backColorDark:g})}}),f=e.computed({get(){return o.node.attrs.borderColor},set(g){o.updateAttributes({borderColor:g})}}),u=e.computed({get(){return o.node.attrs.borderColorDark},set(g){o.updateAttributes({borderColorDark:g})}}),m=e.computed(()=>n.value==="dark"?d.value:p.value),h=e.computed(()=>n.value==="dark"?u.value:f.value);function b(g){o.updateAttributes({icon:g})}function y(g){switch(r.value=!1,g.value){case"palette":k(!0);break}}function x(g){r.value=!0,i.value=g}function k(g){a.value=g}function _(g,V){var B;switch(g){case"backColor":p.value=V;break;case"foreColor":f.value=V;break;case"icon":b(V.emoji),(B=s.value)==null||B.setShow(!1);break}}return e.watch(c,g=>{k(g)}),(g,V)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:"o-callout-view",style:`--callout-border-color: ${h.value}; --callout-back-color: ${m.value}`,onContextmenu:e.withModifiers(x,["prevent"])}),{default:e.withCtx(()=>[e.createElementVNode("div",uu,[e.createVNode(e.unref(Z),{ref_key:"iconPopover",ref:s,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!e.unref(l)},{trigger:e.withCtx(()=>[e.createElementVNode("div",mu,e.toDisplayString(g.node.attrs.icon),1)]),default:e.withCtx(()=>[e.createVNode(e.unref(wo),{items:e.unref(jt.emojiGroups),onSelect:V[0]||(V[0]=B=>_("icon",B)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),e.createElementVNode("div",gu,[e.createVNode(e.unref(P.NodeViewContent))]),e.unref(l)?(e.openBlock(),e.createBlock(e.unref(ct),{key:0,modelValue:r.value,"onUpdate:modelValue":V[1]||(V[1]=B=>r.value=B),event:i.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:y}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),Zr=Ea.extend({addNodeView(){return P.VueNodeViewRenderer(bu)}}),hu=t=>({name:"Mermaid",aliases:["mermaid"],case_insensitive:!0,contains:[t.COMMENT(/%%(?!\{)/,/$/),{className:"meta",begin:/%%\{/,end:/\}%%/,contains:[{className:"attr",begin:/[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/(?=(,\s*[A-Za-z]|$))/,excludeBegin:!0}]},{className:"meta",begin:/^---$/,end:/^---$/,contains:[{className:"attr",begin:/\b[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"keyword",begin:/(^|\s)(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|pie|gantt|requirement|sankey|timeline|quadrant|gitGraph|mindmap|xychart|block|packet|kanban|architecture|radar|treemap|C4Context)(?:\s+(?:LR|TB|RL|BT))?\b/},{className:"built_in",begin:/^(?:\s*)(participant|loop|end|Note right of|note|class|title|section|dateFormat|x-axis|y-axis|bar|line)\b/},{className:"symbol",begin:/(<<?-+>?|--+>|==+>|->|-\.-|==|->>|-->>|<\|--|--\|>|<\|>|:>|o--o|x--x|\*--|o\{--|\}o--)/,relevance:20},{className:"literal",begin:/\b[A-Za-z0-9_]+\s*-[->]+[A-Za-z0-9_]+\s*:/,end:/$/,contains:[{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"regexp",variants:[{begin:/\[[^\]]+\]/},{begin:/\([^)]+\)/},{begin:/\(\([^)]+\)\)/},{begin:/\{[^}]+\}/},{begin:/>[^<]+</},{begin:/\[\[[^\]]+\]\]/}]},{className:"string",begin:/note\s+(?:left|right|top|bottom)\s+of\s+[A-Za-z0-9_]+/i},{className:"string",variants:[{begin:/'.*?'/},{begin:/".*?"/}]},{className:"number",begin:/\b\d+([:.]\d+)?\b/}]});for(var ue=[],Tn=0;Tn<256;++Tn)ue.push((Tn+256).toString(16).slice(1));function ku(t,o=0){return(ue[t[o+0]]+ue[t[o+1]]+ue[t[o+2]]+ue[t[o+3]]+"-"+ue[t[o+4]]+ue[t[o+5]]+"-"+ue[t[o+6]]+ue[t[o+7]]+"-"+ue[t[o+8]]+ue[t[o+9]]+"-"+ue[t[o+10]]+ue[t[o+11]]+ue[t[o+12]]+ue[t[o+13]]+ue[t[o+14]]+ue[t[o+15]]).toLowerCase()}var Mo,yu=new Uint8Array(16);function wu(){if(!Mo&&(Mo=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Mo))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Mo(yu)}var Cu=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Qr={randomUUID:Cu};function xu(t,o,n){if(Qr.randomUUID&&!t)return Qr.randomUUID();t=t||{};var l=t.random||(t.rng||wu)();return l[6]=l[6]&15|64,l[8]=l[8]&63|128,ku(l)}const _u=()=>xu(),Bu={class:"code-block-toolbar"},Vu={class:"wrap"},Eu={class:"language readonly"},Nu={class:"wrap"},Su=["srcdoc"],Ou={key:1,ref:"mermaidMount",class:"tiptap ProseMirror mermaid-split-horizontal"},Au={key:0,class:"preview"},$u={key:0,class:"error"},Tu=["innerHTML"],Du=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{commonDownload:n}=uo(),{tr:l}=I(),{darkMode:r}=it(),{isEditable:a}=W(),i=e.ref("content_copy"),s=e.ref({show:!1,fullscreen:!1}),c=e.ref(""),p=e.ref(""),d=e.ref(""),f=e.ref(""),u=e.ref("splitVertical"),m=e.ref(""),h=e.ref("default");Ho.registerLayoutLoaders(Sa);const b={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},y=e.computed({get(){return o.node.attrs.language},set(A){o.updateAttributes({language:A})}}),x=e.computed(()=>{var A;return((A=o.node.content.content[0])==null?void 0:A.text)||""}),k=e.computed({get(){return o.node.attrs.wrap},set(A){o.updateAttributes({wrap:A})}}),_=e.computed(()=>["html","svg"].includes(y.value)),g=e.computed(()=>k.value?"text_select_move_down":"format_text_wrap"),V=e.computed(()=>y.value==="mermaid"),B=e.computed(()=>y.value==="mermaid"?a.value?u.value:"preview":"");function $(A){y.value=A}function R(){const A=o.node.content.content[0].text;Uo.copyToClipboard(A).then(()=>{i.value="done",setTimeout(()=>{i.value="content_copy"},2e3)})}function D(A="code"){switch(A){case"svg":H();break;default:M();break}}function M(){const A=y.value;let J=A;const ee=eo.find(de=>de.value===A);ee&&(J=ee.ext.at(0));const me=`${A}-${Date.now()}.${J}`,ge=o.node.content.content[0].text;n("code",me,ge)}function H(){if(!d.value)return;const A=`mermaid-${Date.now()}.svg`,J=d.value;n("svg",A,J)}function N(){const A=o.node.content.content[0].text;p.value=T(A),c.value="run",s.value={show:!0,fullscreen:!1}}function S(){c.value==="mermaid"&&(u.value=m.value)}function T(A){return`
306
66
  <style>
307
67
  body { margin: 0 !important; padding: 0; }
308
68
  </style>
309
- ${W}
310
- `}function P(){k.value=!k.value}function R(){switch(y.value){case"mermaid":H();break}}function K(){Tf.initialize({...g,theme:r.value?"dark":m.value}),R()}async function H(){try{f.value="";const W=`mermaid-${q5()}`,{svg:ge}=await Tf.render(W,b.value);u.value=ge}catch(W){console.error(W),f.value=W.message}}return c.watch(b,W=>{R()}),c.watch(y,W=>{R()}),c.watch(r,W=>{K()}),c.watch(v,(W,ge)=>{W==="splitHorizontal"&&(h.value=ge,a.value="mermaid")}),c.onMounted(()=>{var ge;const W=e.editor.extensionManager.extensions.find(Ee=>Ee.name==="codeBlock");m.value=((ge=W==null?void 0:W.options)==null?void 0:ge.diagramTheme)||"default",K()}),(W,ge)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:["o-code-block-view",`language-${y.value} ${v.value}`]}),{default:c.withCtx(()=>[c.createElementVNode("div",K5,[c.createElementVNode("div",J5,[c.createElementVNode("div",G5,c.toDisplayString(y.value),1),c.createVNode(c.unref(yx),{language:y.value,class:"editable",onSelect:E},null,8,["language"])]),c.createElementVNode("div",X5,[v.value?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[v.value==="splitHorizontal"?(c.openBlock(),c.createBlock(c.unref($e),{key:0,icon:"close",tooltip:c.unref(o)("label.close"),class:"editable",onClick:_},null,8,["tooltip"])):(c.openBlock(),c.createBlock(c.unref(cx),{key:1,modelValue:p.value,"onUpdate:modelValue":ge[0]||(ge[0]=Ee=>p.value=Ee),class:"editable"},null,8,["modelValue"]))],64)):c.createCommentVNode("",!0),c.createVNode(c.unref($e),{icon:w.value,"icon-class":{"rotate-270":k.value},tooltip:"Wrap",class:"editable",onClick:P},null,8,["icon","icon-class"]),C.value?(c.openBlock(),c.createBlock(c.unref(ax),{key:1,onDownload:A})):(c.openBlock(),c.createBlock(c.unref($e),{key:2,icon:"download",tooltip:c.unref(o)("label.download"),onClick:A},null,8,["tooltip"])),x.value?(c.openBlock(),c.createBlock(c.unref($e),{key:3,icon:"play_circle",tooltip:"Run",onClick:B})):c.createCommentVNode("",!0),c.createVNode(c.unref($e),{icon:s.value,tooltip:c.unref(o)("label.copy"),onClick:T},null,8,["icon","tooltip"])])]),c.createVNode(c.unref(wm),c.mergeProps({show:l.value.show,"onUpdate:show":ge[1]||(ge[1]=Ee=>l.value.show=Ee)},l.value,{onClose:_}),{title:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(a.value),1)]),default:c.withCtx(()=>[a.value==="run"?(c.openBlock(),c.createElementBlock("iframe",{key:0,sandbox:"allow-same-origin allow-scripts",srcdoc:d.value},null,8,Y5)):a.value==="mermaid"?(c.openBlock(),c.createElementBlock("div",Q5,null,512)):c.createCommentVNode("",!0)]),_:1},16,["show"]),c.createElementVNode("pre",null,[c.createVNode(c.unref(jo),{as:"code",class:c.normalizeClass({wrap:k.value})},null,8,["class"])]),C.value?(c.openBlock(),c.createElementBlock("section",Z5,[f.value?(c.openBlock(),c.createElementBlock("div",e8,c.toDisplayString(f.value),1)):(c.openBlock(),c.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:u.value},null,8,t8))])):c.createCommentVNode("",!0)]),_:1},16,["class"]))}}),FE=Hy.createLowlight(Hy.common);FE.register("mermaid",U5);const jE=j5.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),diagramTheme:"default"}},addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return un(n8)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:FE}),o8=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,t=c.ref(!!e.node.attrs.open);function o(){const r=!t.value;t.value=r,e.updateAttributes({open:r})}return(r,i)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:"o-details-view"}),{default:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["details",{"is-open":t.value}])},[c.createElementVNode("button",{type:"button",onClick:o},[c.createVNode(c.unref(X),{name:"details_arrow"})]),c.createVNode(c.unref(jo))],2)]),_:1},16))}}),UE=yC.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new vr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),d=l.after(l.depth);i.delete(r.from,r.to);const u=s.nodes.details.create(null,[s.nodes.detailsSummary.create(null),s.nodes.detailsContent.create(null,s.nodes.paragraph.create())]);i.replaceRangeWith(a,d-1,u);const f=q.near(i.doc.resolve(a+2));return i.setSelection(f),i}})]},addNodeView(){return un(o8)}}),r8={class:"horizontal"},i8=c.defineComponent({__name:"view",props:ut,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:"o-horizontal-view"}),{default:c.withCtx(()=>[c.createElementVNode("div",r8,[c.createVNode(c.unref(jo),{as:"div",class:"divider"})])]),_:1},16))}}),WE=pR.extend({draggable:!0,addNodeView(){return un(i8)}});/**
311
- * Copyright 2026 Yiitap
312
- * @license MIT
313
- **/var s8=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,l8=Oe.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",fe(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,o,r,i,s;const l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(r=(o=n.attrs)==null?void 0:o.alt)!=null?r:"",d=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return d?`![${a}](${l} "${d}")`:`![${a}](${l})`},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:o}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:s,editor:l})=>{const a=document.createElement("img");Object.entries(s).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,p);break}}),a.src=s.src;const d=new Dc({element:a,editor:l,node:r,getPos:i,onResize:(f,p)=>{a.style.width=`${f}px`,a.style.height=`${p}px`},onCommit:(f,p)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,h)=>f.type===r.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:o===!0}}),u=d.dom;return u.style.visibility="hidden",u.style.pointerEvents="none",a.onload=()=>{u.style.visibility="",u.style.pointerEvents=""},d}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[cs({find:s8,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),a8=l8;const c8=a8.extend({draggable:!0,addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),containerHeight:{default:0,rendered:!0},positionY:{default:0,rendered:!0},isDraggable:{default:!0,renderHTML:e=>({})}}},renderHTML({node:n,HTMLAttributes:e}){return e.containerHeight=n.attrs.containerHeight,e.positionY=n.attrs.positionY,["img",fe(this.options.HTMLAttributes,e)]}}),d8={key:1,class:"image-panel"},u8={class:"label"},f8={key:1,class:"resize-overlay"},p8={class:"resize-guide"},h8={class:"size-display"},m8={key:1},g8=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{tr:t}=de(),{downloadImage:o}=Nd(),{isEditable:r,getEditorImages:i}=xe(),s=c.ref(!1),l=c.ref(!1),a=c.ref({}),d=c.ref(null),u=c.ref(!1),f=c.ref(!1),p=c.ref(0),h=c.ref([]),m=c.ref(),g=c.ref(null),y=c.ref(null),b=c.ref(null),k=c.ref(!1),x=c.ref(""),w=c.ref(0),C=c.ref(0),v=c.ref(0),E=c.ref(0),T=c.ref(e.node.attrs.width||0),A=c.ref(e.node.attrs.height||0),$=c.ref(0),O=c.ref(0),B=c.ref(0),_=c.ref(1200),D=c.ref(0),P=c.ref(0),R=c.ref(800),K=c.ref(400),H=c.ref(!1),W=c.ref(!0),ge=c.ref(!1),Ee=c.ref(e.node.attrs.positionY||0),Le=c.ref(0),We=c.ref(0),Fe=c.ref(!1),Ae=c.computed(()=>e.node.attrs),je=c.computed({get(){return e.node.attrs.src},set(N){e.updateAttributes({src:N})}}),At=c.computed({get(){return e.node.attrs.title},set(N){e.updateAttributes({title:N})}});function pe(){u.value=!0,setTimeout(()=>{var N;(N=d.value)==null||N.focus()},0)}function Me(){o(e.node.attrs.src)}function Te(){h.value=i(e.editor),p.value=h.value.findIndex(N=>N.pos===e.getPos())||0,f.value=!0}function ct(){u.value=!1}function Tn(){je.value==="init"&&Kn(!0)}function or(N){s.value=!0,a.value=N}function rr(N){switch(s.value=!1,N.value){case"replace":Kn(!0);break}}function Wr(N){je.value=N,Kn(!1)}function Kn(N){l.value=N}const ir=c.computed(()=>({width:`${T.value}px`,maxWidth:`${_.value}px`,height:`${$.value}px`,maxHeight:H.value?`${D.value}px`:"auto",cursor:k.value?qr():"default"}));function qr(){switch(x.value){case"left":return"ew-resize";case"right":return"ew-resize";case"bottom":return"ew-resize";default:return"default"}}function Kr(){var N,V,te;if(b.value){O.value=b.value.naturalWidth,B.value=b.value.naturalHeight,R.value=((V=(N=m.value)==null?void 0:N.$el)==null?void 0:V.parentElement.getBoundingClientRect().width)??0,_.value=((te=document.querySelector(".layout"))==null?void 0:te.getBoundingClientRect().width)??1200;const we=O.value/B.value;R.value=Math.min(R.value,800),K.value=R.value/we,!T.value||!A.value?(H.value=O.value>R.value,H.value?(T.value=R.value,A.value=R.value/O.value*B.value):(T.value=O.value,A.value=B.value),An()):H.value=T.value>R.value,P.value>0?$.value=P.value:($.value=A.value,P.value=A.value),D.value=A.value,Bo()}}function Qt(N,V){k.value=!0,x.value=V,v.value=N.clientX,E.value=N.clientY,w.value=T.value,C.value=A.value,document.addEventListener("mousemove",Nn),document.addEventListener("mouseup",$o)}function Nn(N){if(!k.value)return;const V=N.clientX-v.value,te=N.clientY-E.value,we=O.value/B.value;let he=w.value,ft=P.value;switch(x.value){case"left":he=w.value-V;break;case"right":he=w.value+V;break;case"bottom":ft=P.value+te;break}const zt=he/we;T.value=Math.round(he),A.value=Math.round(zt),H.value=he>R.value,H.value?($.value=ft,D.value=A.value):($.value=A.value,_a())}function $o(){k.value=!1,x.value="",document.removeEventListener("mousemove",Nn),document.removeEventListener("mouseup",$o),P.value=$.value,An()}function An(){e.updateAttributes({width:T.value,height:A.value,containerHeight:P.value})}const an=c.computed(()=>!A.value||!$.value?0:Math.min(0,$.value-A.value)),sr=c.computed(()=>({transform:`translateY(${Ee.value}px)`,cursor:Zt.value?"grab":"default",transition:ge.value?"none":"transform 0.2s ease"})),Zt=c.computed(()=>W.value&&H.value&&$.value<A.value);function io(){W.value=!W.value}function Bo(){H.value&&$.value<A.value?Fe.value=!0:Fe.value=!1}function _a(){Ee.value!==0&&(Ee.value=0,js())}function Ia(N){!Zt.value||!Fe.value||k.value||N.target.closest(".block-resizer")||(N.preventDefault(),N.stopPropagation(),ge.value=!0,Le.value=N.clientY,We.value=Ee.value,document.addEventListener("mousemove",Hs),document.addEventListener("mouseup",Fs),document.body.style.userSelect="none",document.body.style.cursor="grabbing")}function Hs(N){if(!ge.value)return;const V=N.clientY-Le.value;let te=We.value+V;te=Math.max(an.value,Math.min(0,te)),Ee.value=te}function Fs(){ge.value=!1,document.removeEventListener("mousemove",Hs),document.removeEventListener("mouseup",Fs),document.body.style.userSelect="",document.body.style.cursor="",js()}function js(){e.updateAttributes({positionY:Ee.value})}return c.watch(()=>e.node.attrs.height,N=>{N&&(A.value=N)}),c.watch(()=>e.node.attrs.containerHeight,N=>{N&&(P.value=N,$.value=N,Bo())}),c.watch(()=>e.node.attrs.positionY,N=>{N!==void 0&&(Ee.value=N)}),c.onMounted(()=>{Kn(je.value==="init"),Ae.value.width&&(T.value=Ae.value.width),Ae.value.height&&(A.value=Ae.value.height),Ae.value.containerHeight&&(P.value=Ae.value.containerHeight)}),c.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(N,V)=>{var te;return c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps({ref_key:"imageView",ref:m},e,{class:["o-image-view",{max:H.value,"with-caption":Ae.value.alt,readonly:!((te=N.editor)!=null&&te.isEditable),init:je.value==="init"}],as:"div",onContextmenu:c.withModifiers(or,["prevent"]),onClick:Tn}),{default:c.withCtx(()=>[c.createVNode(c.unref(wo),{modelValue:l.value,"onUpdate:modelValue":V[4]||(V[4]=we=>l.value=we),placement:je.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Gl),{val:je.value==="init"?"":je.value,type:"image",onInput:Wr},null,8,["val"])]),default:c.withCtx(()=>{var we;return[je.value==="init"?(c.openBlock(),c.createBlock(c.unref(ys),{key:0,icon:"image",placeholder:c.unref(t)("label.imageAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",d8,[c.createVNode(c.unref(Kl),c.mergeProps(e,{onAction:rr}),{default:c.withCtx(()=>[c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[Fe.value?(c.openBlock(),c.createBlock(c.unref($e),{key:0,icon:Zt.value?"arrow_expand":"close","icon-class":Zt.value?"rotate-315":"","content-class":"with-label",tooltip:c.unref(t)("image.repositionTips"),onClick:c.withModifiers(io,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("span",u8,c.toDisplayString(c.unref(t)("image.reposition")),1)]),_:1},8,["icon","icon-class","tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref($e),{icon:"subtitles",tooltip:c.unref(t)("label.caption"),onClick:c.withModifiers(pe,["stop"])},null,8,["tooltip"]),c.createVNode(c.unref(om),{editor:N.editor},null,8,["editor"]),c.createVNode(c.unref(nm),{editor:N.editor,placement:"bottom-end"},null,8,["editor"])],64)):c.createCommentVNode("",!0),c.createVNode(c.unref($e),{icon:"download",tooltip:c.unref(t)("label.download"),onClick:Me},null,8,["tooltip"]),c.createVNode(c.unref($e),{icon:"zoom_in",tooltip:c.unref(t)("image.zoom"),onClick:Te},null,8,["tooltip"])]),_:1},16),c.createElementVNode("div",{ref_key:"imageContainer",ref:g,class:"image-container",style:c.normalizeStyle(ir.value),onMousedown:Ia},[c.createElementVNode("div",{ref_key:"imageWrapper",ref:y,class:"image-wrapper",style:c.normalizeStyle(sr.value)},[c.createElementVNode("img",c.mergeProps({ref_key:"imageElement",ref:b},Ae.value,{draggable:"true","data-drag-handle":"",onLoad:Kr}),null,16)],4),c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createElementVNode("div",{class:"block-resizer left",onMousedown:V[0]||(V[0]=c.withModifiers(he=>Qt(he,"left"),["stop","prevent"]))},[...V[7]||(V[7]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),c.createElementVNode("div",{class:"block-resizer right",onMousedown:V[1]||(V[1]=c.withModifiers(he=>Qt(he,"right"),["stop","prevent"]))},[...V[8]||(V[8]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),H.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:V[2]||(V[2]=c.withModifiers(he=>Qt(he,"bottom"),["stop","prevent"]))},[...V[9]||(V[9]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):c.createCommentVNode("",!0),k.value?(c.openBlock(),c.createElementBlock("div",f8,[c.createElementVNode("div",p8,[c.createElementVNode("div",h8,c.toDisplayString(T.value)+" × "+c.toDisplayString($.value),1)])])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0)],36),c.createElementVNode("div",{class:"caption",onClick:pe},[(we=N.editor)!=null&&we.isEditable&&u.value?(c.openBlock(),c.createBlock(c.unref(jn),{key:0,ref_key:"captionInput",ref:d,class:"caption-input",modelValue:At.value,"onUpdate:modelValue":V[3]||(V[3]=he=>At.value=he),type:"text",placeholder:"Input caption",autosize:"",onBlur:ct},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",m8,c.toDisplayString(At.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(Ci),{modelValue:s.value,"onUpdate:modelValue":V[5]||(V[5]=we=>s.value=we),event:a.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Yo),c.mergeProps(e,{onAction:rr}),null,16)]),_:1},8,["modelValue","event"]),c.createVNode(c.unref(Qx),{show:f.value,"onUpdate:show":V[6]||(V[6]=we=>f.value=we),images:h.value,current:p.value},{title:c.withCtx(()=>[...V[10]||(V[10]=[c.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class"])}}}),qE=c8.extend({addNodeView(){return un(g8)}}).configure({inline:!0});function y8(n){return new ce({key:new le("handleClickSelectLink"),props:{handleClick:(e,t,o)=>{const{schema:r,doc:i,tr:s}=e.state,l=di(i.resolve(t),r.marks.link);if(!l)return!1;const a=i.resolve(l.from),d=i.resolve(l.to),u=s.setSelection(new q(a,d));return e.dispatch(u),!0}}})}const KE=Ch.extend({addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],y8({type:this.type})]}}).configure({openOnClick:!1});/**
314
- * Copyright 2026 Yiitap
315
- * @license MIT
316
- **/const b8=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,k8=Oe.create({name:"modelViewer",group:"block",draggable:!0,addOptions(){return{inline:!1,HTMLAttributes:{}}},addAttributes(){return{caption:{default:"",parseHTML:n=>n.getAttribute("caption")},src:{default:null,parseHTML:n=>n.getAttribute("src")||""}}},parseHTML(){return[{tag:"model-viewer"}]},renderHTML({HTMLAttributes:n}){return["model-viewer",fe(this.options.HTMLAttributes,n)]},markdownTokenName:"modelViewer",parseMarkdown:(n,e)=>e.createNode("modelViewer",{src:n.src,caption:n.caption}),renderMarkdown:n=>{var o,r;const e=((o=n.attrs)==null?void 0:o.src)??"",t=((r=n.attrs)==null?void 0:r.caption)??"";return`<model-viewer src="${e}" caption="${t}"></model-viewer>`},markdownTokenizer:{name:"modelViewer",level:"block",start:n=>{var e;return((e=n.match(/<model-viewer/))==null?void 0:e.index)??-1},tokenize(n){const e=/^<model-viewer\b([^>]*)><\/model-viewer>\s*(?:\n|$)/i.exec(n);if(!e)return;const t=e[1],o=t.match(/src="([^"]*)"/i),r=t.match(/caption="([^"]*)"/i);return{type:"modelViewer",raw:e[0],src:o?o[1]:"",caption:r?r[1]:""}}},addCommands(){return{setModelViewer:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[cs({find:b8,type:this.type,getAttributes:n=>{const[e]=n;return{src:e}}})]}}),w8={key:1,class:"model-viewer-container"},x8={key:1},C8={class:"model-viewer-container"},S8=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref({}),s=c.ref(null),l=c.ref(!1),a=c.ref(!1),d=c.ref({show:!1,fullscreen:!0}),u=c.computed({get(){return e.node.attrs.caption},set(w){e.updateAttributes({caption:w})}}),f=c.computed({get(){return e.node.attrs.src},set(w){e.updateAttributes({src:w})}});function p(w){switch(r.value=!1,w.value){case"replace":x(!0);break}}function h(){l.value=!0,setTimeout(()=>{var w;(w=s.value)==null||w.focus()},0)}function m(){l.value=!1}function g(){d.value.show=!0}function y(){f.value==="init"&&x(!0)}function b(w){r.value=!0,i.value=w}function k(w){f.value=w,x(!1)}function x(w){a.value=w}return c.onMounted(()=>{x(f.value==="init")}),(w,C)=>{var v;return c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:["o-model-viewer-view",{readonly:!((v=w.editor)!=null&&v.isEditable),init:f.value==="init"}],as:"div",onContextmenu:c.withModifiers(b,["prevent"]),onClick:y}),{default:c.withCtx(()=>[c.createVNode(c.unref(wo),{modelValue:a.value,"onUpdate:modelValue":C[1]||(C[1]=E=>a.value=E),placement:f.value==="init"?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Gl),{val:f.value==="init"?"":f.value,type:"video",onInput:k},null,8,["val"])]),default:c.withCtx(()=>{var E;return[f.value==="init"?(c.openBlock(),c.createBlock(c.unref(ys),{key:0,icon:"3d_rotation",placeholder:c.unref(t)("label.model3dAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",w8,[c.createVNode(c.unref(Kl),c.mergeProps(e,{onAction:p}),{default:c.withCtx(()=>[c.unref(o)?(c.openBlock(),c.createBlock(c.unref($e),{key:0,icon:"subtitles",tooltip:c.unref(t)("label.caption"),onClick:h},null,8,["tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref($e),{icon:"zoom_in",tooltip:c.unref(t)("image.zoom"),onClick:g},null,8,["tooltip"])]),_:1},16),c.createElementVNode("model-viewer",c.mergeProps(w.node.attrs,{ar:"","ar-modes":"webxr scene-viewer quick-look","seamless-poster":"","shadow-intensity":"1","camera-controls":"","enable-pan":""}),null,16),c.createElementVNode("div",{class:"caption",onClick:h},[(E=w.editor)!=null&&E.isEditable&&l.value?(c.openBlock(),c.createBlock(c.unref(jn),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":C[0]||(C[0]=T=>u.value=T),type:"text",placeholder:"Input caption",autosize:"",onBlur:m},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",x8,c.toDisplayString(u.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(Ci),{modelValue:r.value,"onUpdate:modelValue":C[2]||(C[2]=E=>r.value=E),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Yo),c.mergeProps(e,{onAction:p}),null,16)]),_:1},8,["modelValue","event"]),c.createVNode(c.unref(wm),c.mergeProps({show:d.value.show,"onUpdate:show":C[3]||(C[3]=E=>d.value.show=E)},d.value,{title:c.unref(t)("label.model3d"),"dialog-class":"model-viewer-dialog"}),{default:c.withCtx(()=>[c.createElementVNode("div",C8,[c.createElementVNode("model-viewer",c.mergeProps(w.node.attrs,{ar:"","ar-modes":"webxr scene-viewer quick-look","seamless-poster":"","shadow-intensity":"1","camera-controls":"","enable-pan":""}),null,16)])]),_:1},16,["show","title"])]),_:1},16,["class"])}}}),JE=k8.extend({addNodeView(){return un(S8)}}),v8=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{tr:t}=de(),{showRowPopover:o,rowActions:r,isEditable:i,cellInfo:s,initProps:l,runCommand:a}=tm(),d=c.ref(!1);return c.onMounted(()=>{l({getPos:e.getPos,editor:e.editor}),d.value=s.value.colIndex===0}),(u,f)=>(c.openBlock(),c.createBlock(c.unref(Xp),c.mergeProps({class:"o-table-cell-view",as:"td"},u.node.attrs,{style:{background:u.node.attrs.background}}),{default:c.withCtx(()=>[c.unref(i)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[d.value?(c.openBlock(),c.createBlock(c.unref(Fd),{key:0,modelValue:c.unref(o),"onUpdate:modelValue":f[0]||(f[0]=p=>c.isRef(o)?o.value=p:null),offset:[0,10],tooltip:c.unref(t)("table.addRow"),placement:"right-start","tooltip-offset":[0,2],"tooltip-placement":"left",onAdd:f[1]||(f[1]=p=>c.unref(a)("tableAddRow")),row:""},{default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(r),(p,h)=>(c.openBlock(),c.createBlock(c.unref(kt),{key:h,onClick:m=>c.unref(a)(p.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:p.icon,class:c.normalizeClass(p.class)},null,8,["name","class"])]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(p.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(jo))]),_:1},16,["style"]))}}),GE=tu.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return un(v8,{stopEvent:()=>!1})}}),E8=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{tr:t}=de(),{showColPopover:o,showRowPopover:r,columnActions:i,rowActions:s,isEditable:l,cellInfo:a,initProps:d,runCommand:u}=tm(),f=c.ref(!1),p=c.ref(!1);return c.onMounted(()=>{d({getPos:e.getPos,editor:e.editor}),f.value=a.value.rowIndex===0,p.value=a.value.colIndex===0}),(h,m)=>(c.openBlock(),c.createBlock(c.unref(Xp),c.mergeProps({class:"o-table-header-view",as:"th"},h.node.attrs,{style:{background:h.node.attrs.background}}),{default:c.withCtx(()=>[c.unref(l)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[f.value?(c.openBlock(),c.createBlock(c.unref(Fd),{key:0,modelValue:c.unref(o),"onUpdate:modelValue":m[0]||(m[0]=g=>c.isRef(o)?o.value=g:null),offset:[0,8],tooltip:c.unref(t)("table.addColumn"),placement:"bottom",column:"",onAdd:m[1]||(m[1]=g=>c.unref(u)("tableAddColumn"))},{default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(i),(g,y)=>(c.openBlock(),c.createBlock(c.unref(kt),{key:y,onClick:b=>c.unref(u)(g.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:g.icon,class:c.normalizeClass(g.class)},null,8,["name","class"])]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(g.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):c.createCommentVNode("",!0),p.value?(c.openBlock(),c.createBlock(c.unref(Fd),{key:1,modelValue:c.unref(r),"onUpdate:modelValue":m[2]||(m[2]=g=>c.isRef(r)?r.value=g:null),offset:[0,10],tooltip:c.unref(t)("table.addRow"),placement:"right-start","tooltip-offset":[0,2],"tooltip-placement":"left",row:"",onAdd:m[3]||(m[3]=g=>c.unref(u)("tableAddRow"))},{default:c.withCtx(()=>[c.createVNode(c.unref(Et),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(s).filter(g=>g.value!=="tableAddRowBefore"),(g,y)=>(c.openBlock(),c.createBlock(c.unref(kt),{key:y,onClick:b=>c.unref(u)(g.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:g.icon,class:c.normalizeClass(g.class)},null,8,["name","class"])]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(g.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(jo))]),_:1},16,["style"]))}}),XE=nu.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return un(E8,{stopEvent:()=>!1})}});/**
317
- * Copyright 2026 Yiitap
318
- * @license MIT
319
- **/function YE(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=YE(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function QE(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let d=QE(s.content,l.content,t-1,o-1);if(d)return d}t-=a,o-=a}}class Y{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],d=l+a.nodeSize;if(d>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let d=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new Y(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new Y(o,r)}cutByIndex(e,t){return e==t?Y.empty:e==0&&t==this.content.length?this:new Y(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new Y(r,i)}addToStart(e){return new Y([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Y(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return YE(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return QE(this,e,t,o)}findIndex(e){if(e==0)return Wu(0,e);if(e==this.size)return Wu(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?Wu(t+1,i):Wu(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Y.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Y(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Y.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new Y(t||e,o)}static from(e){if(!e)return Y.empty;if(e instanceof Y)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Y([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Y.empty=new Y([],0);const Bg={index:0,offset:0};function Wu(n,e){return Bg.index=n,Bg.offset=e,Bg}function Rg(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!Rg(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Rg(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}class sn{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Rg(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return sn.none;if(e instanceof sn)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}}sn.none=[];class M8 extends Error{}class ee{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=eM(this.content,e+this.openStart,t);return o&&new ee(o,this.openStart,this.openEnd)}removeBetween(e,t){return new ee(ZE(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ee.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(Y.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new ee(e,o,r)}}ee.empty=new ee(Y.empty,0,0);function ZE(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(ZE(i.content,e-r-1,t-r-1)))}function eM(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=eM(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function T8(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function N8(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function A8(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function O8(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new B8(n,o,e[o]);return t}function $8(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class B8{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?$8(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Dg{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=O8(e,r.attrs),this.excluded=null;let i=T8(this.attrs);this.instance=i?new sn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new sn(this,N8(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Dg(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){A8(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}function R8(n){return n.tag!=null}function D8(n){return n.style!=null}class qu{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(R8(r))this.tags.push(r);else if(D8(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new rM(this,t,!1);return o.addAll(e,sn.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new rM(this,t,!0);return o.addAll(e,sn.none,t.from,t.to),ee.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(L8(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=iM(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=iM(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new qu(e,qu.schemaRules(e)))}}const tM={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},_8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nM={ol:!0,ul:!0},va=1,_g=2,Ea=4;function oM(n,e,t){return e!=null?(e?va:0)|(e==="full"?_g:0):n&&n.whitespace=="pre"?va|_g:t&~Ea}class Ku{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=sn.none,this.match=i||(s&Ea?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Y.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&va)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=Y.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Y.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!tM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class rM{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=oM(null,t.preserveWhitespace,0)|(o?Ea:0);r?i=new Ku(r.type,r.attrs,sn.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new Ku(null,null,sn.none,!0,null,s):i=new Ku(e.schema.topNodeType,null,sn.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&_g?"full":this.localPreserveWS||(r.options&va)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
320
- `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;nM.hasOwnProperty(s)&&this.parser.normalizeLists&&I8(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:_8.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);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 d,u=this.needsBlock;if(tM.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,a,d,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
321
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.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?t=t.filter(d=>!a.clearMark(d)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],d=a.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=a,!d.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=sn.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sM(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=oM(e,i,s.options);s.options&Ea&&s.content.length==0&&(l|=Ea);let a=sn.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):sM(d.type,e))?(a=d.addToSet(a),!1):!0),this.nodes.push(new Ku(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=va)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let d=t[l];if(d==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function I8(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&nM.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function L8(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function iM(n){let e={};for(let t in n)e[t]=n[t];return e}function sM(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:d,next:u}=l.edge(a);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class Ju{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Ig(t).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let d=s.marks[a];if(!this.marks[d.type.name]){a++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let d=s.marks[a++],u=this.serializeMark(d,s.isInline,t);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=Gu(Ig(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&Gu(Ig(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Gu(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ju(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=lM(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return lM(e.marks)}}function lM(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Ig(n){return n.document||window.document}const aM=new WeakMap;function P8(n){let e=aM.get(n);return e===void 0&&aM.set(n,e=V8(n)),e}function V8(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function Gu(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=P8(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(t=r.slice(0,s),r=r.slice(s+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&a.style?a.style.cssText=d[f]:a.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Gu(n,p,t,o);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const cM=65535,dM=Math.pow(2,16);function z8(n,e){return n+e*dM}function uM(n){return n&cM}function H8(n){return(n-(n&cM))/dM}const fM=1,pM=2,Xu=4,hM=8;class Lg{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&hM)>0}get deletedBefore(){return(this.delInfo&(fM|Xu))>0}get deletedAfter(){return(this.delInfo&(pM|Xu))>0}get deletedAcross(){return(this.delInfo&Xu)>0}}class vn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&vn.empty)return vn.empty}recover(e){let t=0,o=uM(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+H8(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=a+d;if(e<=f){let p=d?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:u);if(o)return h;let m=e==(t<0?a:f)?null:z8(l/3,e-a),g=e==a?pM:e==f?fM:Xu;return(t<0?e!=a:e!=f)&&(g|=hM),new Lg(h,g,m)}r+=u-d}return o?e+r:new Lg(e+r,0,null)}touches(e,t){let o=0,r=uM(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let d=this.ranges[l+i],u=a+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),d=this.ranges[r+t],u=this.ranges[r+o];e(l,l+d,a,a+u),i+=u-d}}invert(){return new vn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?vn.empty:new vn(e<0?[0,-e,0]:[0,0,e])}}vn.empty=new vn([]);class Yu{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Yu(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new Yu;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Lg(e,r,null)}}const Pg=Object.create(null);class Gt{getMap(){return vn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Pg[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Pg)throw new RangeError("Duplicate use of step JSON ID "+e);return Pg[e]=t,t.prototype.jsonID=e,t}}class mt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new mt(e,null)}static fail(e){return new mt(null,e)}static fromReplace(e,t,o,r){try{return mt.ok(e.replace(t,o,r))}catch(i){if(i instanceof M8)return mt.fail(i.message);throw i}}}function Vg(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Vg(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return Y.fromArray(o)}class Lr extends Gt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new ee(Vg(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return mt.fromReplace(e,this.from,this.to,i)}invert(){return new To(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Lr(t.pos,o.pos,this.mark)}merge(e){return e instanceof Lr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Lr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Lr(t.from,t.to,e.markFromJSON(t.mark))}}Gt.jsonID("addMark",Lr);class To extends Gt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new ee(Vg(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return mt.fromReplace(e,this.from,this.to,o)}invert(){return new Lr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new To(t.pos,o.pos,this.mark)}merge(e){return e instanceof To&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new To(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new To(t.from,t.to,e.markFromJSON(t.mark))}}Gt.jsonID("removeMark",To);class Pr extends Gt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return mt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return mt.fromReplace(e,this.pos,this.pos+1,new ee(Y.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new Pr(this.pos,t.marks[r]);return new Pr(this.pos,this.mark)}}return new _i(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Pr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Pr(t.pos,e.markFromJSON(t.mark))}}Gt.jsonID("addNodeMark",Pr);class _i extends Gt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return mt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return mt.fromReplace(e,this.pos,this.pos+1,new ee(Y.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Pr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new _i(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new _i(t.pos,e.markFromJSON(t.mark))}}Gt.jsonID("removeNodeMark",_i);class Xt extends Gt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&zg(e,this.from,this.to)?mt.fail("Structure replace would overwrite content"):mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new vn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Xt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new Xt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Xt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?ee.empty:new ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Xt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?ee.empty:new ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Xt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Xt(t.from,t.to,ee.fromJSON(e,t.slice),!!t.structure)}}Gt.jsonID("replace",Xt);class no extends Gt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(zg(e,this.from,this.gapFrom)||zg(e,this.gapTo,this.to)))return mt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return mt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?mt.fromReplace(e,this.from,this.to,o):mt.fail("Content does not fit in gap")}getMap(){return new vn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new no(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new no(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new no(t.from,t.to,t.gapFrom,t.gapTo,ee.fromJSON(e,t.slice),t.insert,!!t.structure)}}Gt.jsonID("replaceAround",no);function zg(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function F8(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,d,u)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new To(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Lr(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function j8(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof Dg){let d=s.marks,u;for(;u=o.isInSet(d);)(a||(a=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let d=Math.min(l+s.nodeSize,t);for(let u=0;u<a.length;u++){let f=a[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>n.step(new To(s.from,s.to,s.style)))}function Hg(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let d=i.child(a),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new Xt(l,u,ee.empty));else{o=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new To(l,u,d.marks[p]));if(r&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new ee(Y.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),s.push(new Xt(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let a=o.fillBefore(Y.empty,!0);n.replace(l,l,new ee(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function U8(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,d=l,u=Y.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,u=Y.from(o.node(m).copy(u)),f++):a--;let p=Y.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=Y.from(r.node(m).copy(p)),h++):d++;n.step(new no(a,d,s,l,new ee(u.append(p),f,h),u.size-f,!0))}function W8(n,e,t){let o=Y.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=Y.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new no(r,i,r,i,new ee(o,0,0),t.length,!0))}function q8(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&K8(n.doc,n.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&gM(n,s,l,i),Hg(n,n.mapping.slice(i).map(l,1),o,void 0,d===null);let u=n.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return n.step(new no(f,p,f+1,p-1,new ee(Y.from(o.create(a,null,s.marks)),0,0),1,!0)),d===!0&&mM(n,s,l,i),!1}})}function mM(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function gM(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
322
- `))}})}function K8(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function J8(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new no(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ee(Y.from(s),0,0),1,!0))}function G8(n,e,t=1,o){let r=n.doc.resolve(e),i=Y.empty,s=Y.empty;for(let l=r.depth,a=r.depth-t,d=t-1;l>a;l--,d--){i=Y.from(r.node(l).copy(i));let u=o&&o[d];s=Y.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}n.step(new Xt(e,e,new ee(i.append(s),t,t),!0))}function X8(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let u=n.doc.resolve(e+t);gM(n,u.node(),u.before(),l)}s.inlineContent&&Hg(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),d=a.map(e-t);if(n.step(new Xt(d,a.map(e+t,-1),ee.empty,!0)),o===!0){let u=n.doc.resolve(d);mM(n,u.node(),u.before(),n.steps.length)}return n}function Y8(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Q8(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(a,a,r);else{let f=d.contentMatchAt(a).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(a,a,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Z8(n,e,t=e,o=ee.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return yM(r,i,o)?new Xt(e,t,o):new eq(r,i,o).fit()}function yM(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class eq{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=Y.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=Y.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new ee(i,s,l);return e>-1?new no(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new Xt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Fg(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:d}=this.frontier[l],u,f=null;if(t==1&&(s?d.matchType(s.type)||(f=d.fillBefore(Y.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Fg(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ee(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Fg(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new ee(Ma(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new ee(Ma(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)u.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let g=l.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||a==0||g.content.size)&&(f=y,u.push(bM(g.mark(p.allowedMarks(g.marks)),d==1?a:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=Ta(this.placed,t,Y.from(u)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?ee.empty:new ee(Ma(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new ee(Ma(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!jg(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=jg(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:d}=this.frontier[l],u=jg(e,l,d,a,!0);if(!u||u.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ta(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Ta(this.placed,this.depth,Y.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Y.empty,!0);e.childCount&&(this.placed=Ta(this.placed,this.frontier.length,e))}}function Ma(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ma(n.firstChild.content,e-1,t)))}function Ta(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Ta(n.lastChild.content,e-1,t)))}function Fg(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function bM(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,bM(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(Y.empty,!0)))),n.copy(o)}function jg(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!tq(t,i.content,s)?l:null}function tq(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function nq(n){return n.spec.defining||n.spec.definingForContent}function oq(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(yM(r,i,o))return n.step(new Xt(e,t,o));let s=wM(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=nq(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let k=r.node(y-1),x=r.index(y-1);if(k.canReplaceWith(x,x,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new ee(kM(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function kM(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(kM(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(Y.empty,!0))}return n}function rq(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=Y8(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new ee(Y.from(o),0,0))}function iq(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=wM(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function wM(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class _s extends Gt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return mt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return mt.fromReplace(e,this.pos,this.pos+1,new ee(Y.from(r),0,t.isLeaf?0:1))}getMap(){return vn.empty}invert(e){return new _s(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new _s(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new _s(t.pos,t.attr,t.value)}}Gt.jsonID("attr",_s);class Na extends Gt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return mt.ok(o)}getMap(){return vn.empty}invert(e){return new Na(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Na(t.attr,t.value)}}Gt.jsonID("docAttr",Na);let Is=class extends Error{};Is=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Is.prototype=Object.create(Error.prototype),Is.prototype.constructor=Is,Is.prototype.name="TransformError";class sq{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Yu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Is(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=ee.empty){let r=Z8(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new ee(Y.from(o),0,0))}delete(e,t){return this.replace(e,t,ee.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return oq(this,e,t,o),this}replaceRangeWith(e,t,o){return rq(this,e,t,o),this}deleteRange(e,t){return iq(this,e,t),this}lift(e,t){return U8(this,e,t),this}join(e,t=1){return X8(this,e,t),this}wrap(e,t){return W8(this,e,t),this}setBlockType(e,t=e,o,r=null){return q8(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return J8(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new _s(e,t,o)),this}setDocAttribute(e,t){return this.step(new Na(e,t)),this}addNodeMark(e,t){return this.step(new Pr(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof sn)t.isInSet(o.marks)&&this.step(new _i(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new _i(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return G8(this,e,t,o),this}addMark(e,t,o){return F8(this,e,t,o),this}removeMark(e,t,o){return j8(this,e,t,o),this}clearIncompatible(e,t,o){return Hg(this,e,t,o),this}}const Ug=Object.create(null);class Ie{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new xM(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=ee.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(d.pos),l?ee.empty:t),l==0&&vM(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),d=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),vM(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Ve(e):Ls(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?Ls(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Ls(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new No(e.node(0))}static atStart(e){return Ls(e,e,0,0,1)||new No(e)}static atEnd(e){return Ls(e,e,e.content.size,e.childCount,-1)||new No(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Ug[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Ug)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ug[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Ve.between(this.$anchor,this.$head).getBookmark()}}Ie.prototype.visible=!0;class xM{constructor(e,t){this.$from=e,this.$to=t}}let CM=!1;function SM(n){!CM&&!n.parent.inlineContent&&(CM=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Ve extends Ie{constructor(e,t=e){SM(e),SM(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return Ie.near(o);let r=e.resolve(t.map(this.anchor));return new Ve(r.parent.inlineContent?r:o,o)}replace(e,t=ee.empty){if(super.replace(e,t),t==ee.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Ve&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Qu(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ve(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=Ie.findFrom(t,o,!0)||Ie.findFrom(t,-o,!0);if(i)t=i.$head;else return Ie.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(Ie.findFrom(e,-o,!0)||Ie.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new Ve(e,t)}}Ie.jsonID("text",Ve);class Qu{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Qu(e.map(this.anchor),e.map(this.head))}resolve(e){return Ve.between(e.resolve(this.anchor),e.resolve(this.head))}}class _e extends Ie{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?Ie.near(i):new _e(i)}content(){return new ee(Y.from(this.node),0,0)}eq(e){return e instanceof _e&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Wg(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new _e(e.resolve(t.anchor))}static create(e,t){return new _e(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}_e.prototype.visible=!1,Ie.jsonID("node",_e);class Wg{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Qu(o,o):new Wg(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&_e.isSelectable(o)?new _e(t):Ie.near(t)}}class No extends Ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=ee.empty){if(t==ee.empty){e.delete(0,e.doc.content.size);let o=Ie.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new No(e)}map(e){return new No(e)}eq(e){return e instanceof No}getBookmark(){return lq}}Ie.jsonID("all",No);const lq={map(){return this},resolve(n){return new No(n)}};function Ls(n,e,t,o,r,i=!1){if(e.inlineContent)return Ve.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&_e.isSelectable(l))return _e.create(n,t-(r<0?l.nodeSize:0))}else{let a=Ls(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function vM(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof Xt||r instanceof no))return;let i=n.mapping.maps[o],s;i.forEach((l,a,d,u)=>{s==null&&(s=u)}),n.setSelection(Ie.near(n.doc.resolve(s),t))}function EM(n,e){return!e||!n?n:n.bind(e)}class Zu{constructor(e,t,o){this.name=e,this.init=EM(t.init,o),this.apply=EM(t.apply,o)}}new Zu("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Zu("selection",{init(n,e){return n.selection||Ie.atStart(e.doc)},apply(n){return n.selection}}),new Zu("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new Zu("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function MM(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=MM(r,e,{})),t[o]=r}return t}class TM{constructor(e){this.spec=e,this.props={},e.props&&MM(e.props,this,this.props),this.key=e.key?e.key.key:NM("plugin")}getState(e){return e[this.key]}}const qg=Object.create(null);function NM(n){return n in qg?n+"$"+ ++qg[n]:(qg[n]=0,n+"$")}class Kg{constructor(e="key"){this.key=NM(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ii=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},AM=function(n,e,t,o){return t&&(OM(n,e,t,o,-1)||OM(n,e,t,o,1))},aq=/^(img|br|input|textarea|hr)$/i;function OM(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:ef(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Jg(n)||aq.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ii(n)+(r<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=s,e=r<0?ef(n):0}else return!1}}function ef(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function cq(n,e,t){for(let o=e==0,r=e==ef(n);o||r;){if(n==t)return!0;let i=Ii(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==ef(n)}}function Jg(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const $M=function(n){return n.focusNode&&AM(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function BM(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const Ao=typeof navigator<"u"?navigator:null,RM=typeof document<"u"?document:null,Vr=Ao&&Ao.userAgent||"",Gg=/Edge\/(\d+)/.exec(Vr),DM=/MSIE \d/.exec(Vr),Xg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Vr),Aa=!!(DM||Xg||Gg),_M=DM?document.documentMode:Xg?+Xg[1]:Gg?+Gg[1]:0,tf=!Aa&&/gecko\/(\d+)/i.test(Vr);tf&&+(/Firefox\/(\d+)/.exec(Vr)||[0,0])[1];const Yg=!Aa&&/Chrome\/(\d+)/.exec(Vr),nr=!!Yg,IM=Yg?+Yg[1]:0,Li=!Aa&&!!Ao&&/Apple Computer/.test(Ao.vendor),Qg=Li&&(/Mobile\/\w+/.test(Vr)||!!Ao&&Ao.maxTouchPoints>2),Wn=Qg||(Ao?/Mac/.test(Ao.platform):!1),LM=Ao?/Win/.test(Ao.platform):!1,Oa=/Android \d/.test(Vr),Zg=!!RM&&"webkitFontSmoothing"in RM.documentElement.style,dq=Zg?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function uq(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,d;if($M(t)){for(a=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&_e.isSelectable(f)&&r.parent&&!(f.isInline&&cq(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;d=new _e(s==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,p=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,s]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let u=o.resolve(a);if(!d){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;d=jM(n,u,l,f)}return d}function PM(n){return n.editable?n.hasFocus():mq(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function ey(n,e=!1){let t=n.state.selection;if(hq(n,t),!!PM(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&nr){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&AM(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)pq(n);else{let{anchor:o,head:r}=t,i,s;VM&&!(t instanceof Ve)&&(t.$from.parent.inlineContent||(i=zM(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=zM(n,t.to))),n.docView.setSelection(o,r,n,e),VM&&(i&&HM(i),s&&HM(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&fq(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const VM=Li||nr&&IM<63;function zM(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(Li&&r&&r.contentEditable=="false")return ty(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return ty(r);if(i)return ty(i)}}function ty(n){return n.contentEditable="true",Li&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function HM(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function fq(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!PM(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function pq(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,Ii(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&Aa&&_M<=11&&(t.disabled=!0,t.disabled=!1)}function hq(n,e){if(e instanceof _e){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(FM(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else FM(n)}function FM(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function jM(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||Ve.between(e,t,o)}function mq(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function ny(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Ie.findFrom(i,e)}function zr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function UM(n,e,t){let o=n.state.selection;if(o instanceof Ve)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return zr(n,new Ve(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=ny(n.state,e);return r&&r instanceof _e?zr(n,r):!1}else if(!(Wn&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?_e.isSelectable(i)?zr(n,new _e(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):Zg?zr(n,new Ve(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof _e&&o.node.isInline)return zr(n,new Ve(e>0?o.$to:o.$from));{let r=ny(n.state,e);return r?zr(n,r):!1}}}function nf(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function $a(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ps(n,e){return e<0?gq(n):yq(n)}function gq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(tf&&t.nodeType==1&&o<nf(t)&&$a(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if($a(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(WM(t))break;{let l=t.previousSibling;for(;l&&$a(l,-1);)r=t.parentNode,i=Ii(l),l=l.previousSibling;if(l)t=l,o=nf(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?oy(n,t,o):r&&oy(n,r,i)}function yq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=nf(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if($a(l,1))i=t,s=++o;else break}else{if(WM(t))break;{let l=t.nextSibling;for(;l&&$a(l,1);)i=l.parentNode,s=Ii(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=nf(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&oy(n,i,s)}function WM(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function bq(n,e){for(;n&&e==n.childNodes.length&&!Jg(n);)e=Ii(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function kq(n,e){for(;n&&!e&&!Jg(n);)e=Ii(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function oy(n,e,t){if(e.nodeType!=3){let i,s;(s=bq(e,t))?(e=s,t=0):(i=kq(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if($M(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&ey(n)},50)}function qM(n,e){let t=n.state.doc.resolve(e);if(!(nr||LM)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function KM(n,e,t){let o=n.state.selection;if(o instanceof Ve&&!o.empty||t.indexOf("s")>-1||Wn&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=ny(n.state,e);if(s&&s instanceof _e)return zr(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof No?Ie.near(s,e):Ie.findFrom(s,e);return l?zr(n,l):!1}return!1}function JM(n,e){if(!(n.state.selection instanceof Ve))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function GM(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function wq(n){if(!Li||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;GM(n,o,"true"),setTimeout(()=>GM(n,o,"false"),20)}return!1}function xq(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Cq(n,e){let t=e.keyCode,o=xq(e);if(t==8||Wn&&t==72&&o=="c")return JM(n,-1)||Ps(n,-1);if(t==46&&!e.shiftKey||Wn&&t==68&&o=="c")return JM(n,1)||Ps(n,1);if(t==13||t==27)return!0;if(t==37||Wn&&t==66&&o=="c"){let r=t==37?qM(n,n.state.selection.from)=="ltr"?-1:1:-1;return UM(n,r,o)||Ps(n,r)}else if(t==39||Wn&&t==70&&o=="c"){let r=t==39?qM(n,n.state.selection.from)=="ltr"?1:-1:1;return UM(n,r,o)||Ps(n,r)}else{if(t==38||Wn&&t==80&&o=="c")return KM(n,-1,o)||Ps(n,-1);if(t==40||Wn&&t==78&&o=="c")return wq(n)||KM(n,1,o)||Ps(n,1);if(o==(Wn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function XM(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=n.someProp("clipboardSerializer")||Ju.fromSchema(n.state.schema),l=rT(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let d=a.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=nT[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}d=a.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
323
-
324
- `);return{dom:a,text:p,slice:e}}function YM(n,e,t,o,r){let i=r.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(o||i||!t);if(a){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new ee(Y.from(n.state.schema.text(e.replace(/\r\n?/g,`
325
- `))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=Ju.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=Mq(t),Zg&&Tq(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||qu.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Sq.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=Nq(tT(l,+u[1],+u[2]),u[4]);else if(l=ee.maxOpen(vq(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=tT(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const Sq=/^(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 vq(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),r,i=[];if(n.forEach(s=>{if(!i)return;let l=o.findWrapping(s.type),a;if(!l)return i=null;if(a=i.length&&r.length&&ZM(l,r,s,i[i.length-1],0))i[i.length-1]=a;else{i.length&&(i[i.length-1]=eT(i[i.length-1],r.length));let d=QM(s,l);i.push(d),o=o.matchType(d.type),r=l}}),i)return Y.from(i)}return n}function QM(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,Y.from(n));return n}function ZM(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=ZM(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(Y.from(QM(t,n,r+1))))}}function eT(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,eT(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(Y.empty,!0);return n.copy(t.append(o))}function ry(n,e,t,o,r,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=ry(l,e,t,o,r+1,i)),r>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(Y.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function tT(n,e,t){return e<n.openStart&&(n=new ee(ry(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new ee(ry(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const nT={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let oT=null;function rT(){return oT||(oT=document.implementation.createHTMLDocument("title"))}let iy=null;function Eq(n){let e=window.trustedTypes;return e?(iy||(iy=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),iy.createHTML(n)):n}function Mq(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=rT().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&nT[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=Eq(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function Tq(n){let e=n.querySelectorAll(nr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function Nq(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;r=Y.from(a.create(o[l+1],r)),i++,s++}return new ee(r,i,s)}const oo={},En={};function Hr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}En.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!sT(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Oa&&nr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Qg&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,BM(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||Cq(n,t)?t.preventDefault():Hr(n,"key")},En.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},En.keypress=(n,e)=>{let t=e;if(sT(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Wn&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof Ve)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function of(n){return{left:n.clientX,top:n.clientY}}function Aq(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function sy(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),r,!0):l(n,t,i.node(s),i.before(s),r,!1)))return!0;return!1}function Vs(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function Oq(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&_e.isSelectable(o)?(Vs(n,new _e(t)),!0):!1}function $q(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof _e&&(o=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(_e.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(s);break}}return r!=null?(Vs(n,_e.create(n.state.doc,r)),!0):!1}function Bq(n,e,t,o,r){return sy(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?$q(n,t):Oq(n,t))}function Rq(n,e,t,o){return sy(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function Dq(n,e,t,o){return sy(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||_q(n,t,o)}function _q(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(Vs(n,Ve.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Vs(n,Ve.create(o,l+1,l+1+s.content.size));else if(_e.isSelectable(s))Vs(n,_e.create(o,l));else continue;return!0}}function ly(n){return rf(n)}const iT=Wn?"metaKey":"ctrlKey";oo.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=ly(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&Aq(t,n.input.lastClick)&&!t[iT]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(of(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Iq(n,s,t,!!o)):(i=="doubleClick"?Rq:Dq)(n,s.pos,s.inside,t)?t.preventDefault():Hr(n,"pointer"))};class Iq{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[iT],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let u=e.state.doc.resolve(t.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof _e&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&tf&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Hr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ey(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(of(e))),this.updateAllowDefault(e),this.allowDefault||!t?Hr(this.view,"pointer"):Bq(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Li&&this.mightDrag&&!this.mightDrag.node.isAtom||nr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Vs(this.view,Ie.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Hr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Hr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}oo.touchstart=n=>{n.input.lastTouch=Date.now(),ly(n),Hr(n,"pointer")},oo.touchmove=n=>{n.input.lastTouch=Date.now(),Hr(n,"pointer")},oo.contextmenu=n=>ly(n);function sT(n,e){return n.composing?!0:Li&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Lq=Oa?5e3:-1;En.compositionstart=En.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Ve&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||nr&&LM&&Pq(n)))n.markCursor=n.state.storedMarks||t.marks(),rf(n,!0),n.markCursor=null;else if(rf(n,!e.selection.empty),tf&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}lT(n,Lq)};function Pq(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}En.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,lT(n,20))};function lT(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>rf(n),e))}function Vq(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=zq());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function zq(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function rf(n,e=!1){if(!(Oa&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Vq(n),e||n.docView&&n.docView.dirty){let t=uq(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Hq(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Ba=Aa&&_M<15||Qg&&dq<604;oo.copy=En.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Ba?null:t.clipboardData,s=o.content(),{dom:l,text:a}=XM(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):Hq(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Fq(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function jq(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?ay(n,o.value,null,r,e):ay(n,o.textContent,o.innerHTML,r,e)},50)}function ay(n,e,t,o,r){let i=YM(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||ee.empty)))return!0;if(!i)return!1;let s=Fq(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function aT(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}En.paste=(n,e)=>{let t=e;if(n.composing&&!Oa)return;let o=Ba?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&ay(n,aT(o),o.getData("text/html"),r,t)?t.preventDefault():jq(n,t)};class Uq{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const Wq=Wn?"altKey":"ctrlKey";function cT(n,e){return n.someProp("dragCopies",o=>!o(e))??!e[Wq]}oo.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(of(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof _e?r.to-1:r.to))){if(o&&o.mightDrag)s=_e.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=_e.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:d,slice:u}=XM(n,l);(!t.dataTransfer.files.length||!nr||IM>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Ba?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Ba||t.dataTransfer.setData("text/plain",d),n.dragging=new Uq(u,cT(n,t),s)},oo.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},En.dragover=En.dragenter=(n,e)=>e.preventDefault(),En.drop=(n,e)=>{try{qq(n,e,n.dragging)}finally{n.dragging=null}};function qq(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(of(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=YM(n,aT(e.dataTransfer),Ba?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&cT(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||ee.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Q8(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let a=n.state.tr;if(s){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let d=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(u?a.replaceRangeWith(d,d,i.content.firstChild):a.replaceRange(d,d,i),a.doc.eq(f))return;let p=a.doc.resolve(d);if(u&&_e.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new _e(p));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),a.setSelection(jM(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}oo.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&ey(n)},20))},oo.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},oo.beforeinput=(n,e)=>{if(nr&&Oa&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:t}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=t||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,BM(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in En)oo[n]=En[n];function Ra(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class sf{constructor(e,t){this.toDOM=e,this.spec=t||Pi,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new qn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof sf&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ra(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Fr{constructor(e,t){this.attrs=e,this.spec=t||Pi}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new qn(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Fr&&Ra(this.attrs,e.attrs)&&Ra(this.spec,e.spec)}static is(e){return e.type instanceof Fr}destroy(){}}class cy{constructor(e,t){this.attrs=e,this.spec=t||Pi}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new qn(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof cy&&Ra(this.attrs,e.attrs)&&Ra(this.spec,e.spec)}destroy(){}}class qn{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new qn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new qn(e,e,new sf(t,o))}static inline(e,t,o,r){return new qn(e,t,new Fr(o,r))}static node(e,t,o,r){return new qn(e,t,new cy(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Fr}get widget(){return this.type instanceof sf}}const zs=[],Pi={};class gt{constructor(e,t){this.local=e.length?e:zs,this.children=t.length?t:zs}static create(e,t){return t.length?lf(t,e,0,Pi):ln}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==ln||e.maps.length==0?this:this.mapInner(e,t,0,0,o||Pi)}mapInner(e,t,o,r,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Kq(this.children,s||[],e,t,o,r,i):s?new gt(s.sort(zi),zs):ln}add(e,t){return t.length?this==ln?gt.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let d=a+o,u;if(u=uT(t,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,a,a+l.nodeSize,lf(u,l,d+1,Pi)),i+=3}});let s=dT(i?fT(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new gt(s.length?this.local.concat(s).sort(zi):this.local,r||this.children)}remove(e){return e.length==0||this==ln?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+t,a=o[i+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<a&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=ln?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new gt(r,o):ln}forChild(e,t){if(this==ln)return this;if(t.isLeaf)return gt.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof Fr){let d=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;d<u&&(r||(r=[])).push(a.copy(d,u))}}if(r){let l=new gt(r.sort(zi),zs);return o?new Vi([l,o]):l}return o||ln}eq(e){if(this==e)return!0;if(!(e instanceof gt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return dy(this.localsInner(e))}localsInner(e){if(this==ln)return zs;if(e.inlineContent||!this.local.some(Fr.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Fr||t.push(this.local[o]);return t}forEachSet(e){e(this)}}gt.empty=new gt([],[]),gt.removeOverlap=dy;const ln=gt.empty;class Vi{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,Pi));return Vi.from(o)}forChild(e,t){if(t.isLeaf)return gt.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=ln&&(i instanceof Vi?o=o.concat(i.members):o.push(i))}return Vi.from(o)}eq(e){if(!(e instanceof Vi)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?dy(o?t:t.sort(zi)):zs}static from(e){switch(e.length){case 0:return ln;case 1:return e[0];default:return new Vi(e.every(t=>t instanceof gt)?e:e.reduce((t,o)=>t.concat(o instanceof gt?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Kq(n,e,t,o,r,i,s){let l=n.slice();for(let d=0,u=i;d<t.maps.length;d++){let f=0;t.maps[d].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let k=l[b+1];if(k<0||p>k+u-f)continue;let x=l[b]+u-f;h>=x?l[b+1]=p<=x?-2:-1:p>=u&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let a=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){a=!0,l[d+1]=-1;continue}let u=t.map(n[d]+i),f=u-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[d+1]+i,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=l[d+2].mapInner(t,y,u+1,n[d]+i+1,s);b!=ln?(l[d]=f,l[d+1]=h,l[d+2]=b):(l[d+1]=-2,a=!0)}else a=!0}if(a){let d=Jq(l,n,e,t,r,i,s),u=lf(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new gt(e.sort(zi),l)}function dT(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new qn(r.from+e,r.to+e,r.type))}return t}function Jq(n,e,t,o,r,i,s){function l(a,d){for(let u=0;u<a.local.length;u++){let f=a.local[u].map(o,r,d);f?t.push(f):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+d+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function uT(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function fT(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function lf(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let d=uT(n,l,a+t);if(d){i=!0;let u=lf(d,l,t+a+1,o);u!=ln&&r.push(a,a+l.nodeSize,u)}});let s=dT(i?fT(n):n,-t).sort(zi);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new gt(s,r):ln}function zi(n,e){return n.from-e.from||n.to-e.to}function dy(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),pT(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),pT(e,r,o.copy(i.from,o.to)));break}}}return e}function pT(n,e,t){for(;e<n.length&&zi(t,n[e])>0;)e++;n.splice(e,0,t)}for(var jr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},af={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Gq=typeof navigator<"u"&&/Mac/.test(navigator.platform),Xq=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Vt=0;Vt<10;Vt++)jr[48+Vt]=jr[96+Vt]=String(Vt);for(var Vt=1;Vt<=24;Vt++)jr[Vt+111]="F"+Vt;for(var Vt=65;Vt<=90;Vt++)jr[Vt]=String.fromCharCode(Vt+32),af[Vt]=String.fromCharCode(Vt);for(var uy in jr)af.hasOwnProperty(uy)||(af[uy]=jr[uy]);function Yq(n){var e=Gq&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Xq&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?af:jr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Qq=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Zq=typeof navigator<"u"&&/Win/.test(navigator.platform);function e6(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Qq?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function t6(n){let e=Object.create(null);for(let t in n)e[e6(t)]=n[t];return e}function fy(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function n6(n){let e=t6(n);return function(t,o){let r=Yq(o),i,s=e[fy(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[fy(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(Zq&&o.ctrlKey&&o.altKey)&&(i=jr[o.keyCode])&&i!=r){let l=e[fy(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}let py,hy;if(typeof WeakMap<"u"){let n=new WeakMap;py=e=>n.get(e),hy=(e,t)=>(n.set(e,t),t)}else{const n=[];let e=0;py=t=>{for(let o=0;o<n.length;o+=2)if(n[o]==t)return n[o+1]},hy=(t,o)=>(e==10&&(e=0),n[e++]=t,n[e++]=o)}var at=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:o,right:r,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?o==0:r==this.width)?null:this.map[i*this.width+(t<0?o-1:r)]:(t<0?i==0:s==this.height)?null:this.map[o+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:o,top:r,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:d}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,d)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let r=n.left;r<n.right;r++){const i=o*this.width+r,s=this.map[i];t[s]||(t[s]=!0,!(r==n.left&&r&&this.map[i-1]==s||o==n.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let o=0,r=0;;o++){const i=r+t.child(o).nodeSize;if(o==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(n){return py(n)||hy(n,o6(n))}};function o6(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=r6(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let d=0,u=e*t;d<u;d++)o[d]=0;for(let d=0,u=0;d<t;d++){const f=n.child(d);u++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let x=0;x<b;x++){if(x+d>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-x});break}const w=r+x*e;for(let C=0;C<y;C++){o[w+C]==0?o[w+C]=u:(i||(i=[])).push({type:"collision",row:d,pos:u,n:y-C});const v=k&&k[C];if(v){const E=(w+C)%e*2,T=s[E];T==null||T!=v&&s[E+1]==1?(s[E]=v,s[E+1]=1):T==v&&s[E+1]++}}}r+=y,u+=g.nodeSize}const p=(d+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:d,n:h}),u++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new at(e,t,o,i);let a=!1;for(let d=0;!a&&d<s.length;d+=2)s[d]!=null&&s[d+1]<t&&(a=!0);return a&&i6(l,s,n),l}function r6(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const r=n.child(o);let i=0;if(t)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const d=l.child(a);s+d.attrs.rowspan>o&&(i+=d.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function i6(n,e,t){n.problems||(n.problems=[]);const o={};for(let r=0;r<n.map.length;r++){const i=n.map[r];if(o[i])continue;o[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let d=0;d<a.colspan;d++){const u=e[(r+d)%n.width*2];u!=null&&(!a.colwidth||a.colwidth[d]!=u)&&((l||(l=s6(a)))[d]=u)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function s6(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Yt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],r=o.spec.tableRole;r&&(e[r]=o)}}return e}const Ur=new Kg("selectingCells");function Hi(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function l6(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function ro(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function cf(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Hi(e.$head)||a6(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function a6(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function my(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function c6(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function gy(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function hT(n,e,t){const o=n.node(-1),r=at.get(o),i=n.start(-1),s=r.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Fi(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function mT(n,e,t=1){const o={...n,colspan:n.colspan+t};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<t;r++)o.colwidth.splice(e,0,0)}return o}function d6(n,e,t){const o=Yt(e.type.schema).header_cell;for(let r=0;r<n.height;r++)if(e.nodeAt(n.map[t+r*n.width]).type!=o)return!1;return!0}var Ge=class cr extends Ie{constructor(e,t=e){const o=e.node(-1),r=at.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(u=>u!=t.pos-i);a.unshift(t.pos-i);const d=a.map(u=>{const f=o.nodeAt(u);if(!f)throw new RangeError(`No cell with offset ${u} found`);const p=i+u+1;return new xM(l.resolve(p),l.resolve(p+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(my(o)&&my(r)&&gy(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?cr.rowSelection(o,r):i&&this.isColSelection()?cr.colSelection(o,r):new cr(o,r)}return Ve.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=at.get(e),o=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let a=r.top;a<r.bottom;a++){const d=[];for(let u=a*t.width+r.left,f=r.left;f<r.right;f++,u++){const p=t.map[u];if(i[p])continue;i[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=r.left-h.left,y=h.right-r.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=Fi(b,0,g)),y>0&&(b=Fi(b,b.colspan-y,y)),h.left<r.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<r.top||h.bottom>r.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}s.push(e.child(a).copy(Y.from(d)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new ee(Y.from(l),1,1)}replace(e,t=ee.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],d=e.mapping.slice(o);e.replace(d.map(l.pos),d.map(a.pos),s?ee.empty:t)}const i=Ie.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new ee(Y.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=at.get(t),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),r=at.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new cr(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=at.get(e),o=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-o),i=t.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof cr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),r=at.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new cr(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new cr(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new cr(e.resolve(t),e.resolve(o))}getBookmark(){return new u6(this.$anchorCell.pos,this.$headCell.pos)}};Ge.prototype.visible=!1,Ie.jsonID("cell",Ge);var u6=class uN{constructor(e,t){this.anchor=e,this.head=t}map(e){return new uN(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&gy(t,o)?new Ge(t,o):Ie.near(o,1)}};function f6(n){if(!(n.selection instanceof Ge))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(qn.node(o,o+t.nodeSize,{class:"selectedCell"}))}),gt.create(n.doc,e)}function p6({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return t==o&&/row|table/.test(n.node(r).type.spec.tableRole)}function h6({$from:n,$to:e}){let t,o;for(let r=n.depth;r>0;r--){const i=n.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return t!==o&&e.parentOffset===0}function m6(n,e,t){const o=(e||n).selection,r=(e||n).doc;let i,s;if(o instanceof _e&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ge.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=Ge.rowSelection(l,l)}else if(!t){const l=at.get(o.node),a=o.from+1,d=a+l.map[l.width*l.height-1];i=Ge.create(r,a+1,d)}}else o instanceof Ve&&p6(o)?i=Ve.create(r,o.from):o instanceof Ve&&h6(o)&&(i=Ve.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const g6=new Kg("fix-tables");function gT(n,e,t,o){const r=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let d=l,u=Math.min(r,s+3);d<u;d++)if(n.child(d)==a){l=d+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?gT(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function yT(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=y6(n,r,i,t))};return e?e.doc!=n.doc&&gT(e.doc,n.doc,0,o):n.doc.descendants(o),t}function y6(n,e,t,o){const r=at.get(e);if(!r.problems)return o;o||(o=n.tr);const i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){const d=r.problems[a];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const f=u.attrs;for(let p=0;p<f.rowspan;p++)i[d.row+p]+=d.n;o.setNodeMarkup(o.mapping.map(t+1+d.pos),null,Fi(f,f.colspan-d.n,d.n))}else if(d.type=="missing")i[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(t+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;o.setNodeMarkup(o.mapping.map(t+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=o.mapping.map(t);o.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,d=t+1;a<r.height;a++){const u=e.child(a),f=d+u.nodeSize,p=i[a];if(p>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=Yt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?d+1:f-1;o.insert(o.mapping.map(g),m)}d=f}return o.setMeta(g6,{fixTables:!0})}function Oo(n){const e=n.selection,t=cf(n),o=t.node(-1),r=t.start(-1),i=at.get(o);return{...e instanceof Ge?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(t.pos-r),tableStart:r,map:i,table:o}}function bT(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;d6(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],d=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,mT(d.attrs,r-e.colCount(a))),s+=d.attrs.rowspan-1}else{const a=i==null?Yt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,d=e.positionAt(s,r,o);n.insert(n.mapping.map(t+d),a.createAndFill())}}return n}function b6(n,e){if(!ro(n))return!1;if(e){const t=Oo(n);e(bT(n.tr,t,t.left))}return!0}function k6(n,e){if(!ro(n))return!1;if(e){const t=Oo(n);e(bT(n.tr,t,t.right))}return!0}function w6(n,{map:e,table:t,tableStart:o},r){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,a=e.map[l],d=t.nodeAt(a),u=d.attrs;if(r>0&&e.map[l-1]==a||r<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(o+a),null,Fi(u,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+d.nodeSize)}s+=u.rowspan}}function x6(n,e){if(!ro(n))return!1;if(e){const t=Oo(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;w6(o,t,r),r!=t.left;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=at.get(i)}e(o)}return!0}function C6(n,e,t){var o;const r=Yt(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((o=e.nodeAt(n.map[i+t*n.width]))===null||o===void 0?void 0:o.type)!=r)return!1;return!0}function kT(n,{map:e,tableStart:t,table:o},r){let i=t;for(let d=0;d<r;d++)i+=o.child(d).nodeSize;const s=[];let l=r>0?-1:0;C6(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let d=0,u=e.width*r;d<e.width;d++,u++)if(r>0&&r<e.height&&e.map[u]==e.map[u-e.width]){const f=e.map[u],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),d+=p.colspan-1}else{var a;const f=l==null?Yt(o.type.schema).cell:(a=o.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,p=f==null?void 0:f.createAndFill();p&&s.push(p)}return n.insert(i,Yt(o.type.schema).row.create(null,s)),n}function S6(n,e){if(!ro(n))return!1;if(e){const t=Oo(n);e(kT(n.tr,t,t.top))}return!0}function v6(n,e){if(!ro(n))return!1;if(e){const t=Oo(n);e(kT(n.tr,t,t.bottom))}return!0}function E6(n,{map:e,table:t,tableStart:o},r){let i=0;for(let d=0;d<r;d++)i+=t.child(d).nodeSize;const s=i+t.child(r).nodeSize,l=n.mapping.maps.length;n.delete(i+o,s+o);const a=new Set;for(let d=0,u=r*e.width;d<e.width;d++,u++){const f=e.map[u];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[u-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),d+=p.colspan-1}else if(r<e.height&&f==e.map[u+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(r+1,d,t);n.insert(n.mapping.slice(l).map(o+g),m),d+=h.colspan-1}}}}function M6(n,e){if(!ro(n))return!1;if(e){const t=Oo(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;E6(o,t,r),r!=t.top;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=at.get(t.table)}e(o)}return!0}function wT(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function T6({width:n,height:e,map:t},o){let r=o.top*n+o.left,i=r,s=(o.bottom-1)*n+o.left,l=r+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&t[i]==t[i-1]||o.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=o.left;a<o.right;a++){if(o.top>0&&t[r]==t[r-n]||o.bottom<e&&t[s]==t[s+n])return!0;r++,s++}return!1}function xT(n,e){const t=n.selection;if(!(t instanceof Ge)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=Oo(n),{map:r}=o;if(T6(r,o))return!1;if(e){const i=n.tr,s={};let l=Y.empty,a,d;for(let u=o.top;u<o.bottom;u++)for(let f=o.left;f<o.right;f++){const p=r.map[u*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,d=h;else{wT(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||d==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...mT(d.attrs,d.attrs.colspan,o.right-o.left-d.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const u=a+1+d.content.size,f=wT(d)?a+1:u;i.replaceWith(f+o.tableStart,u+o.tableStart,l)}i.setSelection(new Ge(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function CT(n,e){const t=Yt(n.schema);return N6(({node:o})=>t[o.type.spec.tableRole])(n,e)}function N6(n){return(e,t)=>{const o=e.selection;let r,i;if(o instanceof Ge){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(r=l6(o.$from),!r)return!1;i=(s=Hi(o.$from))===null||s===void 0?void 0:s.pos}if(r==null||i==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(t){let l=r.attrs;const a=[],d=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const u=Oo(e),f=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(d?{...l,colwidth:d&&d[h]?[d[h]]:null}:l);let p;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=r.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||f.insert(p=f.mapping.map(m+u.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:u.top,col:u.left}),a[0]),o instanceof Ge&&f.setSelection(new Ge(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function A6(n,e){return function(t,o){if(!ro(t))return!1;const r=cf(t);if(r.nodeAfter.attrs[n]===e)return!1;if(o){const i=t.tr;t.selection instanceof Ge?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:e}),o(i)}return!0}}function O6(n){return function(e,t){if(!ro(e))return!1;if(t){const o=Yt(e.schema),r=Oo(e),i=e.tr,s=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(a=>r.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[a],o.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(r.tableStart+s[a],o.header_cell,l[a].attrs);t(i)}return!0}}function ST(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==t.header_cell)return!1}return!0}function Da(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?O6(n):function(t,o){if(!ro(t))return!1;if(o){const r=Yt(t.schema),i=Oo(t),s=t.tr,l=ST("row",i,r),a=ST("column",i,r),d=(n==="column"?l:n==="row"&&a)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:i.map.height}:n=="row"?{left:d,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(u).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}Da("row",{useDeprecatedLogic:!0}),Da("column",{useDeprecatedLogic:!0});const $6=Da("cell",{useDeprecatedLogic:!0});function B6(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,r=n.before();o>=0;o--){const i=n.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),r=n.after();o<t.childCount;o++){const i=t.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function vT(n){return function(e,t){if(!ro(e))return!1;const o=B6(cf(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(Ve.between(r,c6(r))).scrollIntoView())}return!0}}function R6(n,e){const t=n.selection.$anchor;for(let o=t.depth;o>0;o--)if(t.node(o).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(o),t.after(o)).scrollIntoView()),!0;return!1}function df(n,e){const t=n.selection;if(!(t instanceof Ge))return!1;if(e){const o=n.tr,r=Yt(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new ee(r,0,0))}),o.docChanged&&e(o)}return!0}function D6(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let d=e.child(a).content;const u=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(u||f)&&(d=yy(Yt(s).row,new ee(d,u,f)).content),l.push(d)}else if(i=="cell"||i=="header_cell")l.push(t||o?yy(Yt(s).row,new ee(e,t,o)).content:e);else return null;return _6(s,l)}function _6(n,e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let d=r;d<r+l;d++)t[d]=(t[d]||0)+a}}let o=0;for(let r=0;r<t.length;r++)o=Math.max(o,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(Y.empty),t[r]<o){const i=Yt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(Y.from(s))}return{height:e.length,width:o,rows:e}}function yy(n,e){const t=n.createAndFill();return new sq(t).replace(0,t.content.size,e).doc}function I6({width:n,height:e,rows:t},o,r){if(n!=o){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],d=[];for(let u=i[l]||0,f=0;u<o;f++){let p=a.child(f%a.childCount);u+p.attrs.colspan>o&&(p=p.type.createChecked(Fi(p.attrs,p.attrs.colspan,u+p.attrs.colspan-o),p.content)),d.push(p),u+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(Y.from(d))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],d=t[l%e];for(let u=0;u<d.childCount;u++){let f=d.child(u);s+f.attrs.rowspan>r&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,r-f.attrs.rowspan)},f.content)),a.push(f)}i.push(Y.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function L6(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=Yt(l);let d,u;if(r>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=d||(d=a.cell.createAndFill()):g=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<r;y++)m.push(g);n.insert(n.mapping.slice(s).map(p-1+o),m)}if(i>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;f.push(y?u||(u=a.header_cell.createAndFill()):d||(d=a.cell.createAndFill()))}const p=a.row.create(null,Y.from(f)),h=[];for(let m=e.height;m<i;m++)h.push(p);n.insert(n.mapping.slice(s).map(o+t.nodeSize-2),h)}return!!(d||u)}function ET(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let d=r;d<i;d++){const u=s*e.width+d,f=e.map[u];if(e.map[u-e.width]==f){a=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-s})),d+=p.attrs.colspan-1}}return a}function MT(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let d=r;d<i;d++){const u=d*e.width+s,f=e.map[u];if(e.map[u-1]==f){a=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(l).map(f+o);n.setNodeMarkup(m,null,Fi(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(Fi(p.attrs,0,s-h))),d+=p.attrs.rowspan-1}}return a}function TT(n,e,t,o,r){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=at.get(i);const{top:l,left:a}=o,d=a+r.width,u=l+r.height,f=n.tr;let p=0;function h(){if(i=t?f.doc.nodeAt(t-1):f.doc,!i)throw new Error("No table found");s=at.get(i),p=f.mapping.maps.length}L6(f,s,i,t,d,u,p)&&h(),ET(f,s,i,t,a,d,l,p)&&h(),ET(f,s,i,t,a,d,u,p)&&h(),MT(f,s,i,t,l,u,a,p)&&h(),MT(f,s,i,t,l,u,d,p)&&h();for(let m=l;m<u;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,d,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new ee(r.rows[m-l],0,0))}h(),f.setSelection(new Ge(f.doc.resolve(t+s.positionAt(l,a,i)),f.doc.resolve(t+s.positionAt(u-1,d-1,i)))),e(f)}const P6=n6({ArrowLeft:ff("horiz",-1),ArrowRight:ff("horiz",1),ArrowUp:ff("vert",-1),ArrowDown:ff("vert",1),"Shift-ArrowLeft":pf("horiz",-1),"Shift-ArrowRight":pf("horiz",1),"Shift-ArrowUp":pf("vert",-1),"Shift-ArrowDown":pf("vert",1),Backspace:df,"Mod-Backspace":df,Delete:df,"Mod-Delete":df});function uf(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function ff(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof Ge)return uf(t,o,Ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=NT(r,n,e);if(s==null)return!1;if(n=="horiz")return uf(t,o,Ie.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=hT(l,n,e);let d;return a?d=Ie.near(a,1):e<0?d=Ie.near(t.doc.resolve(l.before(-1)),-1):d=Ie.near(t.doc.resolve(l.after(-1)),1),uf(t,o,d)}}}function pf(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;let s;if(i instanceof Ge)s=i;else{const a=NT(r,n,e);if(a==null)return!1;s=new Ge(t.doc.resolve(a))}const l=hT(s.$headCell,n,e);return l?uf(t,o,new Ge(s.$anchorCell,l)):!1}}function V6(n,e){const t=n.state.doc,o=Hi(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Ge(o))),!0):!1}function z6(n,e,t){if(!ro(n.state))return!1;let o=D6(t);const r=n.state.selection;if(r instanceof Ge){o||(o={width:1,height:1,rows:[Y.from(yy(Yt(n.state.schema).cell,t))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=at.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=I6(o,l.right-l.left,l.bottom-l.top),TT(n.state,n.dispatch,s,l,o),!0}else if(o){const i=cf(n.state),s=i.start(-1);return TT(n.state,n.dispatch,s,at.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function H6(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=AT(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof Ge)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=Hi(n.state.selection.$anchor))!=null&&((t=by(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,d){let u=by(n,d);const f=Ur.getState(n.state)==null;if(!u||!gy(a,u))if(f)u=a;else return;const p=new Ge(a,u);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(Ur,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Ur.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Ur,-1))}function l(a){const d=a,u=Ur.getState(n.state);let f;if(u!=null)f=n.state.doc.resolve(u);else if(AT(n,d.target)!=o&&(f=by(n,e),!f))return s();f&&i(f,d)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function NT(n,e,t){if(!(n.state.selection instanceof Ve))return null;const{$head:o}=n.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((t<0?o.index(r):o.indexAfter(r))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=o.before(r),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function AT(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function by(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:o,pos:r}=t;return o>=0&&Hi(n.state.doc.resolve(o))||Hi(n.state.doc.resolve(r))}var F6=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ky(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,ky(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function ky(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const d=n.firstChild;if(d){for(let f=0,p=0;f<d.childCount;f++){const{colspan:h,colwidth:m}=d.child(f).attrs;for(let g=0;g<h;g++,p++){const y=r==p?i:m&&m[g],b=y?y+"px":"";if(s+=y||o,y||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;a;){var u;const f=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const Mn=new Kg("tableColumnResizing");function j6({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=F6,lastColumnResizable:r=!0}={}){const i=new TM({key:Mn,state:{init(s,l){var a;const d=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Yt(l.schema).table.name;return o&&d&&(d[u]=(f,p)=>new o(f,t,p)),new U6(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Mn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{W6(s,l,n,r)},mouseleave:s=>{q6(s)},mousedown:(s,l)=>{K6(s,l,e,t)}},decorations:s=>{const l=Mn.getState(s);if(l&&l.activeHandle>-1)return Q6(s,l.activeHandle)},nodeViews:{}}});return i}var U6=class Mf{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(Mn);if(o&&o.setHandle!=null)return new Mf(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Mf(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return my(e.doc.resolve(r))||(r=-1),new Mf(r,t.dragging)}return t}};function W6(n,e,t,o){if(!n.editable)return;const r=Mn.getState(n.state);if(r&&!r.dragging){const i=G6(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=OT(n,e,"left",t):a-e.clientX<=t&&(s=OT(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),d=at.get(a),u=l.start(-1);if(d.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==d.width-1)return}BT(n,s)}}}function q6(n){if(!n.editable)return;const e=Mn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&BT(n,-1)}function K6(n,e,t,o){var r;if(!n.editable)return!1;const i=(r=n.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,s=Mn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=J6(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Mn,{setDragging:{startX:e.clientX,startWidth:a}}));function d(f){i.removeEventListener("mouseup",d),i.removeEventListener("mousemove",u);const p=Mn.getState(n.state);p!=null&&p.dragging&&(X6(n,p.activeHandle,$T(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(Mn,{setDragging:null})))}function u(f){if(!f.which)return d(f);const p=Mn.getState(n.state);if(p&&p.dragging){const h=$T(p.dragging,f,t);RT(n,p.activeHandle,h,o)}}return RT(n,s.activeHandle,a,o),i.addEventListener("mouseup",d),i.addEventListener("mousemove",u),e.preventDefault(),!0}function J6(n,e,{colspan:t,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=n.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=t;if(o)for(let a=0;a<t;a++)o[a]&&(s-=o[a],l--);return s/l}function G6(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function OT(n,e,t,o){const r=t=="right"?-o:o,i=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=Hi(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=at.get(l.node(-1)),d=l.start(-1),u=a.map.indexOf(l.pos-d);return u%a.width==0?-1:d+a.map[u-1]}function $T(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function BT(n,e){n.dispatch(n.state.tr.setMeta(Mn,{setHandle:e}))}function X6(n,e,t){const o=n.state.doc.resolve(e),r=o.node(-1),i=at.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let d=0;d<i.height;d++){const u=d*i.width+l;if(d&&i.map[u]==i.map[u-i.width])continue;const f=i.map[u],p=r.nodeAt(f).attrs,h=p.colspan==1?0:l-i.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():Y6(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function RT(n,e,t,o){const r=n.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=at.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&ky(i,a.firstChild,a,o,l,t)}function Y6(n){return Array(n).fill(0)}function Q6(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return gt.empty;const i=at.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let d=0;d<i.height;d++){const u=l+d*i.width;if((l==i.width-1||i.map[u]!=i.map[u+1])&&(d==0||i.map[u]!=i.map[u-i.width])){var a;const f=i.map[u],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=Mn.getState(n))===null||a===void 0)&&a.dragging&&t.push(qn.node(s+f,s+f+r.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),t.push(qn.widget(p,h))}}return gt.create(n.doc,t)}function Z6({allowTableNodeSelection:n=!1}={}){return new TM({key:Ur,state:{init(){return null},apply(e,t){const o=e.getMeta(Ur);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:f6,handleDOMEvents:{mousedown:H6},createSelectionBetween(e){return Ur.getState(e.state)!=null?e.state.selection:null},handleTripleClick:V6,handleKeyDown:P6,handlePaste:z6},appendTransaction(e,t,o){return m6(o,yT(o,t),n)}})}var eK=Oe.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const o=n.getAttribute("colwidth"),r=o?o.split(",").map(i=>parseInt(i,10)):null;if(!r){const i=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(s&&s>-1&&i&&i[s]){const l=i[s].getAttribute("width");return l?[parseInt(l,10)]:null}}return r}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",fe(this.options.HTMLAttributes,n),0]}}),tK=Oe.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(t=>parseInt(t,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",fe(this.options.HTMLAttributes,n),0]}}),nK=Oe.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",fe(this.options.HTMLAttributes,n),0]}});function wy(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function DT(n,e,t,o,r,i){var s;let l=0,a=!0,d=e.firstChild;const u=n.firstChild;if(u!==null)for(let p=0,h=0;p<u.childCount;p+=1){const{colspan:m,colwidth:g}=u.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],k=b?`${b}px`:"";if(l+=b||o,b||(a=!1),d){if(d.style.width!==k){const[x,w]=wy(o,b);d.style.setProperty(x,w)}d=d.nextSibling}else{const x=document.createElement("col"),[w,C]=wy(o,b);x.style.setProperty(w,C),e.appendChild(x)}}}for(;d;){const p=d.nextSibling;(s=d.parentNode)==null||s.removeChild(d),d=p}const f=n.attrs.style&&typeof n.attrs.style=="string"&&/\bwidth\s*:/i.test(n.attrs.style);a&&!f?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}var oK=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),n.attrs.style&&(this.table.style.cssText=n.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),DT(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,DT(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(t&&!o&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function rK(n,e,t,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let u=0,f=0;u<l.childCount;u+=1){const{colspan:p,colwidth:h}=l.child(u).attrs;for(let m=0;m<p;m+=1,f+=1){const g=t===f?o:h&&h[m];r+=g||e,g||(i=!1);const[y,b]=wy(e,g);s.push(["col",{style:`${y}: ${b}`}])}}const a=i?`${r}px`:"",d=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:d}}function _T(n,e){return n.createAndFill()}function iK(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const o=n.nodes[t];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),n.cached.tableNodeTypes=e,e}function sK(n,e,t,o,r){const i=iK(n),s=[],l=[];for(let d=0;d<t;d+=1){const u=_T(i.cell);if(u&&l.push(u),o){const f=_T(i.header_cell);f&&s.push(f)}}const a=[];for(let d=0;d<e;d+=1)a.push(i.row.createChecked(null,o&&d===0?s:l));return i.table.createChecked(null,a)}function lK(n){return n instanceof Ge}var hf=({editor:n})=>{const{selection:e}=n.state;if(!lK(e))return!1;let t=0;const o=kc(e.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},aK="";function cK(n){return(n||"").replace(/\s+/g," ").trim()}function IT(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:aK;if(!n||!n.content||n.content.length===0)return"";const i=[];n.content.forEach(h=>{const m=[];h.content&&h.content.forEach(g=>{let y="";g.content&&Array.isArray(g.content)&&g.content.length>1?y=g.content.map(x=>e.renderChildren(x)).join(r):y=g.content?e.renderChildren(g.content):"";const b=cK(y),k=g.type==="tableHeader";m.push({text:b,isHeader:k})}),i.push(m)});const s=i.reduce((h,m)=>Math.max(h,m.length),0);if(s===0)return"";const l=new Array(s).fill(0);i.forEach(h=>{var m;for(let g=0;g<s;g+=1){const y=(((m=h[g])==null?void 0:m.text)||"").length;y>l[g]&&(l[g]=y),l[g]<3&&(l[g]=3)}});const a=(h,m)=>h+" ".repeat(Math.max(0,m-h.length)),d=i[0],u=d.some(h=>h.isHeader);let f=`
326
- `;const p=new Array(s).fill(0).map((h,m)=>u&&d[m]&&d[m].text||"");return f+=`| ${p.map((h,m)=>a(h,l[m])).join(" | ")} |
327
- `,f+=`| ${l.map(h=>"-".repeat(Math.max(3,h))).join(" | ")} |
328
- `,(u?i.slice(1):i).forEach(h=>{f+=`| ${new Array(s).fill(0).map((m,g)=>a(h[g]&&h[g].text||"",l[g])).join(" | ")} |
329
- `}),f}var dK=IT,uK=Oe.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:oK,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:o,tableMinWidth:r}=rK(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",fe(this.options.HTMLAttributes,e,{style:s()}),t,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(n,e)=>{const t=[];if(n.header){const o=[];n.header.forEach(r=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),t.push(e.createNode("tableRow",{},o))}return n.rows&&n.rows.forEach(o=>{const r=[];o.forEach(i=>{r.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}),e.createNode("table",void 0,t)},renderMarkdown:(n,e)=>dK(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=sK(i.schema,n,e,t);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(Ve.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>b6(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>k6(n,e),deleteColumn:()=>({state:n,dispatch:e})=>x6(n,e),addRowBefore:()=>({state:n,dispatch:e})=>S6(n,e),addRowAfter:()=>({state:n,dispatch:e})=>v6(n,e),deleteRow:()=>({state:n,dispatch:e})=>M6(n,e),deleteTable:()=>({state:n,dispatch:e})=>R6(n,e),mergeCells:()=>({state:n,dispatch:e})=>xT(n,e),splitCell:()=>({state:n,dispatch:e})=>CT(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Da("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Da("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>$6(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>xT(n,e)?!0:CT(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>A6(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>vT(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>vT(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&yT(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const o=Ge.create(e.doc,n.anchorCell,n.headCell);e.setSelection(o)}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:hf,"Mod-Backspace":hf,Delete:hf,"Mod-Delete":hf}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[j6({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Z6({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Re(ne(n,"tableRole",e))}}});me.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(uK.configure(this.options.table)),this.options.tableCell!==!1&&n.push(eK.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(tK.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(nK.configure(this.options.tableRow)),n}});const fK=Oe.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:n}){return["table-wrapper",fe(n),0]},renderMarkdown:(n,e)=>n.content&&n.content.length?IT(n.content[0],e):""}),pK=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,t=c.ref(!1),o=c.computed(()=>{const{selection:i}=e.editor.view.state,s=i.from,l=e.getPos(),a=l+e.node.nodeSize;return s>=l&&s<=a});function r(i){t.value=i}return c.watch(o,i=>{r(i)}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:"o-table-wrapper-view"}),{default:c.withCtx(()=>[c.createVNode(c.unref(jo),{as:"table"})]),_:1},16))}}),LT=fK.extend({addNodeView(){return un(pK,{stopEvent:()=>!1})}});/**
330
- * Copyright 2026 Yiitap
331
- * @license MIT
332
- **/const hK=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,mK=Oe.create({name:"video",draggable:!0,addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{caption:{default:"",rendered:!1},src:{default:null,parseHTML:n=>{var e;return((e=n.firstElementChild)==null?void 0:e.src)??""}}}},parseHTML(){return[{tag:"video"}]},renderHTML({node:n,HTMLAttributes:e}){return["video",{caption:n.attrs.caption},["source",fe(this.options.HTMLAttributes,e)]]},parseMarkdown:(n,e)=>{if(n.type==="html_block"||n.type==="html_inline"){const t=n.content,o=t.match(/<video\b([^>]*)>/i);if(!o)return{};const r=o[1],i=t.match(/<source\s+src="([^"]+)"/i),s=r.match(/caption="([^"]*)"/i);if(i)return e.createNode("video",{src:i[1],caption:s?s[1]:""})}return{}},renderMarkdown:n=>{var t,o;const e=((t=n.attrs)==null?void 0:t.src)??"";return`<video caption="${((o=n.attrs)==null?void 0:o.caption)??""}" controls>
333
- <source src="${e}">
334
- </video>`},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[cs({find:hK,type:this.type,getAttributes:n=>{const[e]=n;return{src:e}}})]}}),gK={key:1,class:"video-container"},yK={key:1},bK=c.defineComponent({__name:"view",props:ut,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=xe(),r=c.ref(!1),i=c.ref({}),s=c.ref(null),l=c.ref(!1),a=c.ref(!1),d=c.computed({get(){return e.node.attrs.caption},set(k){e.updateAttributes({caption:k})}}),u=c.computed({get(){return e.node.attrs.src},set(k){e.updateAttributes({src:k})}});function f(k){switch(r.value=!1,k.value){case"replace":b(!0);break}}function p(){l.value=!0,setTimeout(()=>{var k;(k=s.value)==null||k.focus()},0)}function h(){l.value=!1}function m(){u.value==="init"&&b(!0)}function g(k){r.value=!0,i.value=k}function y(k){u.value=k,b(!1)}function b(k){a.value=k}return c.onMounted(()=>{b(u.value==="init")}),(k,x)=>{var w;return c.openBlock(),c.createBlock(c.unref(Sn),c.mergeProps(e,{class:["o-video-view",{readonly:!((w=k.editor)!=null&&w.isEditable),init:u.value==="init"}],as:"div",onContextmenu:c.withModifiers(g,["prevent"]),onClick:m}),{default:c.withCtx(()=>[c.createVNode(c.unref(wo),{modelValue:a.value,"onUpdate:modelValue":x[1]||(x[1]=C=>a.value=C),placement:u.value==="init"?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Gl),{val:u.value==="init"?"":u.value,type:"video",onInput:y},null,8,["val"])]),default:c.withCtx(()=>{var C;return[u.value==="init"?(c.openBlock(),c.createBlock(c.unref(ys),{key:0,icon:"videocam",placeholder:c.unref(t)("label.videoAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",gK,[x[3]||(x[3]=c.createElementVNode("div",{class:"video-cover"},null,-1)),c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Kl),c.mergeProps({key:0},e,{onAction:f}),{default:c.withCtx(()=>[c.createVNode(c.unref($e),{icon:"subtitles",tooltip:c.unref(t)("label.caption"),onClick:p},null,8,["tooltip"])]),_:1},16)):c.createCommentVNode("",!0),c.createElementVNode("video",c.mergeProps(k.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[c.createElementVNode("source",c.normalizeProps(c.guardReactiveProps(k.node.attrs)),null,16)],16),c.createElementVNode("div",{class:"caption",onClick:p},[(C=k.editor)!=null&&C.isEditable&&l.value?(c.openBlock(),c.createBlock(c.unref(jn),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":x[0]||(x[0]=v=>d.value=v),type:"text",placeholder:"Input caption",autosize:"",onBlur:h},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",yK,c.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(Ci),{modelValue:r.value,"onUpdate:modelValue":x[2]||(x[2]=C=>r.value=C),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Yo),c.mergeProps(e,{onAction:f}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),PT=mK.extend({addNodeView(){return un(bK)}}),VT=["BackgroundColor","Color","Focus","FontFamily","Highlight","Subscript","Superscript","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OBlockquote","OCallout","OCodeBlock","OHorizontalRule","OLink","OSelectionDecoration","OSlash","OSlashZh","OTable"],zT={BackgroundColor:n=>Mm.configure({types:["textStyle"],...n}),BlockMath:n=>Ks.BlockMath.configure(n),Collaboration:n=>hS.configure(n),CollaborationCaret:n=>yS.configure(n),Color:n=>Tm.configure(n),Focus:n=>X0.configure(n),FontFamily:n=>Nm.configure(n),Highlight:n=>bS.configure({multicolor:!0,...n}),Image:n=>kS.configure(n),InlineMath:n=>Ks.InlineMath.configure(n),Link:n=>Ch.configure(n),Markdown:n=>zy.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1},...n}),Subscript:n=>CS.configure(n),Superscript:n=>SS.configure(n),TaskItem:n=>ME.configure(n),TaskList:n=>Mh.configure({itemTypeName:"taskItem",...n}),TextAlign:n=>vS.configure({types:["heading","paragraph"],...n}),TextStyle:n=>Em.configure(n),Typography:n=>ES.configure(n),Underline:n=>F0.configure(n),UniqueID:n=>NS.configure({attributeName:"id",types:["aiBlock","blockquote","blockMath","codeBlock","callout","details","heading","image","paragraph","table-wrapper","video"],...n}),OAiBlock:n=>$E.configure(n),OAudio:n=>BE.configure(n),OBlockMath:n=>RE.configure(n),OBlockquote:n=>_E.configure({triggerCharacters:['"',"“","”"],...n}),OCallout:n=>IE.configure(n),OCodeBlock:n=>jE.configure(n),OColon:n=>TE.configure({suggestion:OE,...n}),OSlash:n=>NE.configure({suggestion:Og,...n}),OSlashZh:n=>AE.configure({suggestion:Og,...n}),OColorHighlighter:n=>OS.configure(n),OColumnDropCursor:n=>Qm.configure(n),OHorizontalRule:n=>WE.configure(n),OImage:n=>qE.configure(n),OInlinePlaceholder:n=>$S.configure(n),OLink:n=>KE.configure({openOnClick:!1,...n}),OModelViewer:n=>JE.configure(n),OSelectionDecoration:n=>IS.configure(n),OShortcut:n=>zS.configure({selectableNodes:["aiBlock","blockquote","callout","codeBlock","column","columns","heading","listItem","paragraph","tableCell","tableHeader","taskItem"],...n}),OVideo:n=>PT.configure(n),Table:n=>[iu.configure({resizable:!0,...n}),ou,nu,tu],ODetails:n=>[UE.configure({persist:!0,HTMLAttributes:{class:"details"},...n}),bC,kC],OMultiColumn:n=>[RS,BS,_S.configure(n),Qm],OTable:n=>[LT,FS.configure({resizable:!0,...n}),ou,XE,GE]},HT=n=>typeof n=="object"&&n!==null&&(n.type==="extension"||n.type==="node"||n.type==="mark"),mf=n=>{const{name:e,configure:t}=n,o=zT[e];return o?o(t):(console.warn(`[YiiEditor] Extension factory for "${String(e)}" not found.`),null)},xy=n=>n.flatMap(e=>Array.isArray(e)?xy(e):HT(e)?e:typeof e=="string"?mf({name:e})??[]:typeof e=="object"&&e!==null&&"name"in e?mf(e)??[]:[]),kK={configure(n={}){return VT.flatMap(e=>{const t=n[e];return t===!1?[]:mf({name:e,configure:typeof t=="object"?t:void 0})??[]})}},wK=["data-theme"],FT=c.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},title:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:[String,Number,Boolean],default:!1},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},sideMenu:{type:Object,default:()=>({show:!0,add:"menu"})},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:n=>["page","full"].includes(n)},aiOptions:{type:Object,default:()=>{}},collab:{type:Object,default:()=>({enabled:!1})}},emits:["create","transaction","update"],setup(n,{expose:e,emit:t}){const o=n,r=t,{tr:i}=de(),s=c.ref(!1),l=c.ref(!0),a=c.ref("en"),d=c.ref(),u=c.ref(!1);c.provide("darkMode",s),c.provide("isEditable",l),c.provide("locale",a),c.provide("aiOptions",d);const f=c.computed(()=>b()),p=YB({editable:o.editable,content:o.content,autofocus:o.autofocus,extensions:f.value,onCreate:()=>{u.value=!0,r("create",p.value)},onUpdate:({editor:k})=>{u.value&&r("update",{editor:k})},onTransaction:({editor:k,transaction:x})=>{r("transaction",{editor:k,transaction:x})}}),h=c.computed(()=>({editor:p.value,menu:o.mainMenu})),m=c.computed(()=>({editor:p.value,menu:o.bubbleMenu,aiOptions:o.aiOptions})),g=c.computed(()=>({editor:p.value,menu:o.floatingMenu})),y=c.computed(()=>({editor:p.value,add:o.sideMenu.add,title:o.title,menu:[]}));function b(){const k=[];o.title?k.push(Qp.extend({content:"heading block*"})):k.push(Qp),k.push(sx.configure({includeChildren:!0,placeholder:({editor:w,node:C,pos:v})=>{const E=w.state.doc.resolve(v);for(let T=E.depth;T>0;T--){const A=E.node(T).type.name;if(["tableCell","tableHeader","table"].includes(A))return""}if(C.type.name==="heading"){const T=C.attrs.level;return v>0?`H${T}`:i("label.untitled")}else return C.type.name==="paragraph"?i("label.typeForCommands"):""}})),k.push(AD.configure({dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},codeBlock:!1,document:!1,horizontalRule:!1,link:!1,blockquote:!1,trailingNode:o.title?{node:"paragraph",notAfter:["paragraph","heading"]}:{notAfter:[]},undoRedo:o.collab.enabled?!1:{depth:100,newGroupDelay:500}}));const x=xy(o.extensions);return k.push(...x),k}return c.watch(()=>o.darkMode,k=>{s.value=k}),c.watch(()=>o.locale,k=>{a.value=k}),c.watch(()=>o.aiOptions,k=>{d.value=k},{deep:!0}),c.watch(()=>o.editable,k=>{var x;(x=p.value)==null||x.setEditable(k),l.value=k}),c.onBeforeMount(()=>{l.value=o.editable,d.value=o.aiOptions,s.value=o.darkMode,a.value=o.locale}),e({editor:p,darkMode:s,locale:a}),(k,x)=>{var w,C,v;return c.openBlock(),c.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[n.showMainMenu?(c.openBlock(),c.createBlock(hC,c.mergeProps({key:0},h.value,{class:"desktop-only"}),{left:c.withCtx(()=>[c.renderSlot(k.$slots,"toolbar-left")]),right:c.withCtx(()=>[c.renderSlot(k.$slots,"toolbar-right")]),_:3},16)):c.createCommentVNode("",!0),(w=c.unref(p))!=null&&w.isEditable&&n.showBubbleMenu?(c.openBlock(),c.createBlock(gz,c.normalizeProps(c.mergeProps({key:1},m.value)),null,16)):c.createCommentVNode("",!0),(C=c.unref(p))!=null&&C.isEditable&&n.showFloatingMenu?(c.openBlock(),c.createBlock(bz,c.normalizeProps(c.mergeProps({key:2},g.value)),null,16)):c.createCommentVNode("",!0),(v=c.unref(p))!=null&&v.isEditable&&n.sideMenu.show?(c.openBlock(),c.createBlock(Oz,c.normalizeProps(c.mergeProps({key:3},y.value)),null,16)):c.createCommentVNode("",!0),c.createVNode(c.unref(XB),{class:c.normalizeClass(["editor-content",`${n.pageView}-view`]),editor:c.unref(p)},null,8,["class","editor"])],8,wK)}}}),xK=(n,e)=>{const o=new DOMParser().parseFromString(n,"text/html"),r=o.querySelectorAll(e),i=e.replace(/[[\]]/g,"");return r.forEach(s=>{s.removeAttribute(i)}),o.body.innerHTML},CK={installed:!1,spellcheck:!0,install(n){this.installed=!0,n.component("YiiEditor",FT)}};return Object.defineProperty(S,"BlockMath",{enumerable:!0,get:()=>Ks.BlockMath}),Object.defineProperty(S,"InlineMath",{enumerable:!0,get:()=>Ks.InlineMath}),Object.defineProperty(S,"Markdown",{enumerable:!0,get:()=>zy.Markdown}),S.AddNode=Gx,S.AdvancedBlocks=hx,S.AiBlocks=gx,S.AiProviders=eC,S.AskAiBlocks=mx,S.BackgroundColor=Mm,S.BasicBlocks=ql,S.BlockMenus=Vd,S.Blocks=Pd,S.BrandColor=ke,S.Collaboration=hS,S.CollaborationCaret=yS,S.ColonSuggestion=OE,S.Color=Tm,S.Column=BS,S.ColumnContainer=RS,S.ColumnDropCursor=Qm,S.CommandManager=pl,S.CommonBlocks=Ld,S.DefaultBubble=oC,S.DefaultEmbedServices=g2,S.DefaultExtensionNames=VT,S.DefaultFloating=dC,S.DefaultMenu=tC,S.Details=yC,S.DetailsContent=bC,S.DetailsSummary=kC,S.DragNode=Xx,S.Editor=St,S.EmojiSuggestion=s5,S.Extendable=Ac,S.Extension=me,S.Focus=X0,S.FontFamily=Nm,S.Fragment=VB,S.Highlight=bS,S.Image=kS,S.ImageBubble=sC,S.ImageLinkBubble=lC,S.InlineMathBubble=rC,S.InputRule=vr,S.Link=Ch,S.LinkBubble=iC,S.MappablePosition=Tc,S.Mark=In,S.MarkView=qB,S.Mention=pj,S.MoreBubble=aC,S.MultiColumn=_S,S.Node=Oe,S.NodePos=Gw,S.NodeView=t0,S.OAiBlock=$E,S.OAiMenu=fC,S.OAlignDropdown=nm,S.OAudio=BE,S.OBlockList=_d,S.OBlockListItem=rm,S.OBlockMath=RE,S.OBlockMenu=Yo,S.OBlockPlaceholder=ys,S.OBlockPopover=wo,S.OBlockToolbar=Kl,S.OBlockquote=_E,S.OBtn=Ke,S.OBtnGroup=Yx,S.OCallout=IE,S.OCalloutColorBoard=sm,S.OCalloutColorDropdown=VL,S.OCharCommand=z4,S.OCheckbox=km,S.OCodeBlock=jE,S.OCodeBlockDownloadDropdown=ax,S.OCodeBlockViewDropdown=cx,S.OColonCommand=TE,S.OColorBoard=Si,S.OColorHighlighter=OS,S.OCommandBtn=bt,S.OCommonBtn=Rr,S.OContextMenu=Ci,S.ODetails=UE,S.ODialog=wm,S.ODivider=_t,S.ODocToc=YL,S.OEmojiSelect=zd,S.OExtensionDropdown=dx,S.OHorizontalRule=WE,S.OIcon=X,S.OImage=qE,S.OImageViewer=Qx,S.OInlineMathMenu=pC,S.OInlinePlaceholder=$S,S.OInput=jn,S.OLanguageDropdown=yx,S.OLink=KE,S.OLinkBtn=om,S.OList=Et,S.OListItem=kt,S.OMainMenu=hC,S.OMediaInput=Gl,S.OMenubarBtn=$e,S.OMetaInput=Hd,S.OModelViewer=JE,S.ONodeView=Sn,S.OPlaceholder=sx,S.OPopover=De,S.OSelectionDecoration=IS,S.OShortcut=zS,S.OSlashCommand=NE,S.OSlashZhCommand=AE,S.OStarterKit=kK,S.OTable=FS,S.OTableCell=GE,S.OTableCellBackground=kx,S.OTableCellHandler=Fd,S.OTableGrid=bx,S.OTableHeader=XE,S.OTableWrapper=LT,S.OTaskItem=ME,S.OTextColorBoard=lm,S.OTextarea=Zx,S.OToast=Ql,S.OTooltip=xn,S.OVideo=PT,S.PasteRule=Oc,S.Prompts=xm,S.ResizableNodeView=Dc,S.ResizableNodeview=HB,S.SlashSuggestion=Og,S.StyleBlocks=Id,S.Subscript=CS,S.Superscript=SS,S.Table=iu,S.TableBubble=cC,S.TableCell=tu,S.TableHeader=nu,S.TableMenu=nC,S.TableRow=ou,S.TaskItem=V0,S.TaskList=Mh,S.TextAlign=vS,S.TextStyle=Em,S.Tracker=GB,S.Typography=ES,S.Underline=F0,S.UniqueID=NS,S.YiiEditor=FT,S.YiiEditorPlugin=CK,S.callOrReturn=Re,S.canInsertNode=Qw,S.combineTransactionSteps=yc,S.commands=Ep,S.convertShortcut=px,S.copyToClipboard=HE,S.createAtomBlockMarkdownSpec=e0,S.createBlockMarkdownSpec=Sl,S.createChainableState=fl,S.createDocument=gc,S.createElement=Yw,S.createExtension=mf,S.createExtensionList=xy,S.createInlineMarkdownSpec=Jp,S.createMappablePosition=$w,S.createNodeFromContent=is,S.createStyleTag=Xw,S.defaultBlockAt=bc,S.deleteProps=Np,S.elementFromString=rs,S.escapeForRegEx=Kp,S.extensionRegistry=zT,S.extensions=Lw,S.findChildren=zo,S.findChildrenInRange=Op,S.findDuplicates=Cw,S.findParentNode=Sr,S.findParentNodeClosestToPos=kc,S.flattenExtensions=wc,S.fromString=kw,S.generateHTML=Sw,S.generateJSON=_p,S.generateText=aB,S.getAttributes=Lp,S.getAttributesFromExtensions=Bp,S.getChangedRanges=vc,S.getDebugJSON=Mw,S.getExtensionField=ne,S.getHTMLFromFragment=bl,S.getMarkAttributes=Ap,S.getMarkRange=di,S.getMarkType=uo,S.getMarksBetween=Ec,S.getNodeAtPosition=Tw,S.getNodeAttributes=vw,S.getNodeType=dt,S.getProviderProp=m2,S.getRenderedAttributes=ss,S.getSchema=Cc,S.getSchemaByResolvedExtensions=Dp,S.getSchemaTypeByName=as,S.getSchemaTypeNameByName=yl,S.getSplittedAttributes=wl,S.getText=Sc,S.getTextBetween=Ip,S.getTextContentFromNodes=Nw,S.getTextSerializersFromSchema=kl,S.getUpdatedPosition=Fp,S.h=Yw,S.htmlToJSON=im,S.htmlToJSON0=ML,S.injectExtensionAttributesToParseRule=Rp,S.inputRulesPlugin=Dw,S.isActive=Pp,S.isAndroid=gl,S.isAtEndOfNode=Aw,S.isAtStartOfNode=Ow,S.isEmptyObject=bw,S.isExtensionInstance=HT,S.isExtensionRulesEnabled=Vp,S.isFirefox=FB,S.isFunction=$p,S.isList=zp,S.isMacOS=Tp,S.isMarkActive=Mc,S.isNodeActive=Vo,S.isNodeEmpty=xl,S.isNodeSelection=Hp,S.isNumber=_w,S.isPlainObject=Cl,S.isRegExp=mc,S.isSafari=mw,S.isString=jB,S.isTextSelection=ml,S.isiOS=ui,S.markInputRule=Er,S.markPasteRule=Fo,S.markdown=Zw,S.mergeAttributes=fe,S.mergeDeep=qp,S.minMax=fo,S.nodeInputRule=cs,S.nodePasteRule=KB,S.objectIncludes=hl,S.parseAttributes=_c,S.parseIndentedBlocks=Lc,S.pasteRulesPlugin=Iw,S.posToDOMRect=jp,S.removeDuplicates=Ew,S.removeHtmlAttributes=xK,S.renderNestedMarkdownContent=Pc,S.resolveExtensions=xc,S.resolveFocusPosition=Mp,S.rewriteUnknownContent=dB,S.selectionToInsertionEnd=yw,S.serializeAttributes=Ic,S.sortExtensions=ls,S.splitExtensions=fi,S.systemKeymap=fx,S.textInputRule=rt,S.textPasteRule=JB,S.textblockTypeInputRule=Rc,S.toJSON=ux,S.updateMarkViewAttributes=Gp,S.useAi=Kh,S.useCommon=Nd,S.useI18n=de,S.useNodeView=V1,S.useTable=tm,S.useTheme=xi,S.useTiptap=xe,S.wrappingInputRule=Ho,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"}),S})({},Vue,MarkdownIt,CustomyiitapI18n,CustomyiitapUtilEmoji,CustomtiptapExtensionMathematics,CustomtiptapMarkdown,Yjs,CustomtiptapExtensionAudio,Katex,Customlowlight,Mermaid,CustommermaidJsLayoutElk);
69
+ ${A}
70
+ `}function v(){k.value=!k.value}function U(){switch(y.value){case"mermaid":j();break}}function K(){Ho.initialize({...b,theme:r.value?"dark":h.value}),U()}async function j(){try{f.value="";const A=`mermaid-${_u()}`,{svg:J}=await Ho.render(A,x.value);d.value=J}catch(A){console.error(A),f.value=A.message}}return e.watch(x,A=>{U()}),e.watch(y,A=>{U()}),e.watch(r,A=>{K()}),e.watch(B,(A,J)=>{A==="splitHorizontal"&&(m.value=J,c.value="mermaid")}),e.onMounted(()=>{var J;const A=o.editor.extensionManager.extensions.find(ee=>ee.name==="codeBlock");h.value=((J=A==null?void 0:A.options)==null?void 0:J.diagramTheme)||"default",K()}),(A,J)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:["o-code-block-view",`language-${y.value} ${B.value}`]}),{default:e.withCtx(()=>[e.createElementVNode("div",Bu,[e.createElementVNode("div",Vu,[e.createElementVNode("div",Eu,e.toDisplayString(y.value),1),e.createVNode(e.unref(nr),{language:y.value,class:"editable",onSelect:$},null,8,["language"])]),e.createElementVNode("div",Nu,[B.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[B.value==="splitHorizontal"?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:"close",tooltip:e.unref(l)("label.close"),class:"editable",onClick:S},null,8,["tooltip"])):(e.openBlock(),e.createBlock(e.unref(Kl),{key:1,modelValue:u.value,"onUpdate:modelValue":J[0]||(J[0]=ee=>u.value=ee),class:"editable"},null,8,["modelValue"]))],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(X),{icon:g.value,"icon-class":{"rotate-270":k.value},tooltip:"Wrap",class:"editable",onClick:v},null,8,["icon","icon-class"]),V.value?(e.openBlock(),e.createBlock(e.unref(Gl),{key:1,onDownload:D})):(e.openBlock(),e.createBlock(e.unref(X),{key:2,icon:"download",tooltip:e.unref(l)("label.download"),onClick:D},null,8,["tooltip"])),_.value?(e.openBlock(),e.createBlock(e.unref(X),{key:3,icon:"play_circle",tooltip:"Run",onClick:N})):e.createCommentVNode("",!0),e.createVNode(e.unref(X),{icon:i.value,tooltip:e.unref(l)("label.copy"),onClick:R},null,8,["icon","tooltip"])])]),e.createVNode(e.unref(En),e.mergeProps({show:s.value.show,"onUpdate:show":J[1]||(J[1]=ee=>s.value.show=ee)},s.value,{onClose:S}),{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),default:e.withCtx(()=>[c.value==="run"?(e.openBlock(),e.createElementBlock("iframe",{key:0,sandbox:"allow-same-origin allow-scripts",srcdoc:p.value},null,8,Su)):c.value==="mermaid"?(e.openBlock(),e.createElementBlock("div",Ou,null,512)):e.createCommentVNode("",!0)]),_:1},16,["show"]),e.createElementVNode("pre",null,[e.createVNode(e.unref(P.NodeViewContent),{as:"code",class:e.normalizeClass({wrap:k.value})},null,8,["class"])]),V.value?(e.openBlock(),e.createElementBlock("section",Au,[f.value?(e.openBlock(),e.createElementBlock("div",$u,e.toDisplayString(f.value),1)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:d.value},null,8,Tu))])):e.createCommentVNode("",!0)]),_:1},16,["class"]))}}),ea=rl.createLowlight(rl.common);ea.register("mermaid",hu);const ta=Na.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),diagramTheme:"default"}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return P.VueNodeViewRenderer(Du)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:ea}),Mu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,n=e.ref(!!o.node.attrs.open);function l(){const r=!n.value;n.value=r,o.updateAttributes({open:r})}return(r,a)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:"o-details-view"}),{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["details",{"is-open":n.value}])},[e.createElementVNode("button",{type:"button",onClick:l},[e.createVNode(e.unref(O),{name:"details_arrow"})]),e.createVNode(e.unref(P.NodeViewContent))],2)]),_:1},16))}}),oa=wt.Details.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:t}=this.options,o=t.map(l=>l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),n=new RegExp(`^[${o}]\\s$`);return[new oe.InputRule({find:n,handler:({state:l,range:r})=>{const{tr:a,schema:i}=l,{$from:s}=a.selection,c=s.before(s.depth),p=s.after(s.depth);a.delete(r.from,r.to);const d=i.nodes.details.create(null,[i.nodes.detailsSummary.create(null),i.nodes.detailsContent.create(null,i.nodes.paragraph.create())]);a.replaceRangeWith(c,p-1,d);const f=Ue.TextSelection.near(a.doc.resolve(c+2));return a.setSelection(f),a}})]},addNodeView(){return P.VueNodeViewRenderer(Mu)}}),Lu={class:"horizontal"},Pu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t;return(n,l)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:"o-horizontal-view"}),{default:e.withCtx(()=>[e.createElementVNode("div",Lu,[e.createVNode(e.unref(P.NodeViewContent),{as:"div",class:"divider"})])]),_:1},16))}}),na=wa.extend({draggable:!0,addNodeView(){return P.VueNodeViewRenderer(Pu)}}),Ru={key:1,class:"image-panel"},vu={class:"label"},Iu={key:1,class:"resize-overlay"},ju={class:"resize-guide"},Fu={class:"size-display"},zu={key:1},Hu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{tr:n}=I(),{downloadImage:l}=uo(),{isEditable:r,getEditorImages:a}=W(),i=e.ref(!1),s=e.ref(!1),c=e.ref({}),p=e.ref(null),d=e.ref(!1),f=e.ref(!1),u=e.ref(0),m=e.ref([]),h=e.ref(),b=e.ref(null),y=e.ref(null),x=e.ref(null),k=e.ref(!1),_=e.ref(""),g=e.ref(0),V=e.ref(0),B=e.ref(0),$=e.ref(0),R=e.ref(o.node.attrs.width||0),D=e.ref(o.node.attrs.height||0),M=e.ref(0),H=e.ref(0),N=e.ref(0),S=e.ref(1200),T=e.ref(0),v=e.ref(0),U=e.ref(800),K=e.ref(400),j=e.ref(!1),A=e.ref(!0),J=e.ref(!1),ee=e.ref(o.node.attrs.positionY||0),me=e.ref(0),ge=e.ref(0),de=e.ref(!1),le=e.computed(()=>o.node.attrs),re=e.computed({get(){return o.node.attrs.src},set(w){o.updateAttributes({src:w})}}),Oe=e.computed({get(){return o.node.attrs.title},set(w){o.updateAttributes({title:w})}});function F(){d.value=!0,setTimeout(()=>{var w;(w=p.value)==null||w.focus()},0)}function G(){l(o.node.attrs.src)}function Q(){m.value=a(o.editor),u.value=m.value.findIndex(w=>w.pos===o.getPos())||0,f.value=!0}function ae(){d.value=!1}function De(){re.value==="init"&&ze(!0)}function mt(w){i.value=!0,c.value=w}function gt(w){switch(i.value=!1,w.value){case"replace":ze(!0);break}}function Dt(w){re.value=w,ze(!1)}function ze(w){s.value=w}const bt=e.computed(()=>({width:`${R.value}px`,maxWidth:`${S.value}px`,height:`${M.value}px`,maxHeight:j.value?`${T.value}px`:"auto",cursor:k.value?Mt():"default"}));function Mt(){switch(_.value){case"left":return"ew-resize";case"right":return"ew-resize";case"bottom":return"ew-resize";default:return"default"}}function Lt(){var w,E,L;if(x.value){H.value=x.value.naturalWidth,N.value=x.value.naturalHeight,U.value=((E=(w=h.value)==null?void 0:w.$el)==null?void 0:E.parentElement.getBoundingClientRect().width)??0,S.value=((L=document.querySelector(".layout"))==null?void 0:L.getBoundingClientRect().width)??1200;const Y=H.value/N.value;U.value=Math.min(U.value,800),K.value=U.value/Y,!R.value||!D.value?(j.value=H.value>U.value,j.value?(R.value=U.value,D.value=U.value/H.value*N.value):(R.value=H.value,D.value=N.value),He()):j.value=R.value>U.value,v.value>0?M.value=v.value:(M.value=D.value,v.value=D.value),T.value=D.value,kt()}}function Be(w,E){k.value=!0,_.value=E,B.value=w.clientX,$.value=w.clientY,g.value=R.value,V.value=D.value,document.addEventListener("mousemove",Me),document.addEventListener("mouseup",tt)}function Me(w){if(!k.value)return;const E=w.clientX-B.value,L=w.clientY-$.value,Y=H.value/N.value;let z=g.value,pe=v.value;switch(_.value){case"left":z=g.value-E;break;case"right":z=g.value+E;break;case"bottom":pe=v.value+L;break}const ke=z/Y;R.value=Math.round(z),D.value=Math.round(ke),j.value=z>U.value,j.value?(M.value=pe,T.value=D.value):(M.value=D.value,Mn())}function tt(){k.value=!1,_.value="",document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",tt),v.value=M.value,He()}function He(){o.updateAttributes({width:R.value,height:D.value,containerHeight:v.value})}const ht=e.computed(()=>!D.value||!M.value?0:Math.min(0,M.value-D.value)),Pt=e.computed(()=>({transform:`translateY(${ee.value}px)`,cursor:Xe.value?"grab":"default",transition:J.value?"none":"transform 0.2s ease"})),Xe=e.computed(()=>A.value&&j.value&&M.value<D.value);function Rt(){A.value=!A.value}function kt(){j.value&&M.value<D.value?de.value=!0:de.value=!1}function Mn(){ee.value!==0&&(ee.value=0,vo())}function Ln(w){!Xe.value||!de.value||k.value||w.target.closest(".block-resizer")||(w.preventDefault(),w.stopPropagation(),J.value=!0,me.value=w.clientY,ge.value=ee.value,document.addEventListener("mousemove",Po),document.addEventListener("mouseup",Ro),document.body.style.userSelect="none",document.body.style.cursor="grabbing")}function Po(w){if(!J.value)return;const E=w.clientY-me.value;let L=ge.value+E;L=Math.max(ht.value,Math.min(0,L)),ee.value=L}function Ro(){J.value=!1,document.removeEventListener("mousemove",Po),document.removeEventListener("mouseup",Ro),document.body.style.userSelect="",document.body.style.cursor="",vo()}function vo(){o.updateAttributes({positionY:ee.value})}return e.watch(()=>o.node.attrs.height,w=>{w&&(D.value=w)}),e.watch(()=>o.node.attrs.containerHeight,w=>{w&&(v.value=w,M.value=w,kt())}),e.watch(()=>o.node.attrs.positionY,w=>{w!==void 0&&(ee.value=w)}),e.onMounted(()=>{ze(re.value==="init"),le.value.width&&(R.value=le.value.width),le.value.height&&(D.value=le.value.height),le.value.containerHeight&&(v.value=le.value.containerHeight)}),e.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(w,E)=>{var L;return e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps({ref_key:"imageView",ref:h},o,{class:["o-image-view",{max:j.value,"with-caption":le.value.alt,readonly:!((L=w.editor)!=null&&L.isEditable),init:re.value==="init"}],as:"div",onContextmenu:e.withModifiers(mt,["prevent"]),onClick:De}),{default:e.withCtx(()=>[e.createVNode(e.unref(ve),{modelValue:s.value,"onUpdate:modelValue":E[4]||(E[4]=Y=>s.value=Y),placement:re.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(to),{val:re.value==="init"?"":re.value,type:"image",onInput:Dt},null,8,["val"])]),default:e.withCtx(()=>{var Y;return[re.value==="init"?(e.openBlock(),e.createBlock(e.unref(Nt),{key:0,icon:"image",placeholder:e.unref(n)("label.imageAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",Ru,[e.createVNode(e.unref(Qt),e.mergeProps(o,{onAction:gt}),{default:e.withCtx(()=>[e.unref(r)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[de.value?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:Xe.value?"arrow_expand":"close","icon-class":Xe.value?"rotate-315":"","content-class":"with-label",tooltip:e.unref(n)("image.repositionTips"),onClick:e.withModifiers(Rt,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("span",vu,e.toDisplayString(e.unref(n)("image.reposition")),1)]),_:1},8,["icon","icon-class","tooltip"])):e.createCommentVNode("",!0),e.createVNode(e.unref(X),{icon:"subtitles",tooltip:e.unref(n)("label.caption"),onClick:e.withModifiers(F,["stop"])},null,8,["tooltip"]),e.createVNode(e.unref(fn),{editor:w.editor},null,8,["editor"]),e.createVNode(e.unref(pn),{editor:w.editor,placement:"bottom-end"},null,8,["editor"])],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(X),{icon:"download",tooltip:e.unref(n)("label.download"),onClick:G},null,8,["tooltip"]),e.createVNode(e.unref(X),{icon:"zoom_in",tooltip:e.unref(n)("image.zoom"),onClick:Q},null,8,["tooltip"])]),_:1},16),e.createElementVNode("div",{ref_key:"imageContainer",ref:b,class:"image-container",style:e.normalizeStyle(bt.value),onMousedown:Ln},[e.createElementVNode("div",{ref_key:"imageWrapper",ref:y,class:"image-wrapper",style:e.normalizeStyle(Pt.value)},[e.createElementVNode("img",e.mergeProps({ref_key:"imageElement",ref:x},le.value,{draggable:"true","data-drag-handle":"",onLoad:Lt}),null,16)],4),e.unref(r)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"block-resizer left",onMousedown:E[0]||(E[0]=e.withModifiers(z=>Be(z,"left"),["stop","prevent"]))},[...E[7]||(E[7]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),e.createElementVNode("div",{class:"block-resizer right",onMousedown:E[1]||(E[1]=e.withModifiers(z=>Be(z,"right"),["stop","prevent"]))},[...E[8]||(E[8]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),j.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:E[2]||(E[2]=e.withModifiers(z=>Be(z,"bottom"),["stop","prevent"]))},[...E[9]||(E[9]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):e.createCommentVNode("",!0),k.value?(e.openBlock(),e.createElementBlock("div",Iu,[e.createElementVNode("div",ju,[e.createElementVNode("div",Fu,e.toDisplayString(R.value)+" × "+e.toDisplayString(M.value),1)])])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],36),e.createElementVNode("div",{class:"caption",onClick:F},[(Y=w.editor)!=null&&Y.isEditable&&d.value?(e.openBlock(),e.createBlock(e.unref(Se),{key:0,ref_key:"captionInput",ref:p,class:"caption-input",modelValue:Oe.value,"onUpdate:modelValue":E[3]||(E[3]=z=>Oe.value=z),type:"text",placeholder:"Input caption",autosize:"",onBlur:ae},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",zu,e.toDisplayString(Oe.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(ct),{modelValue:i.value,"onUpdate:modelValue":E[5]||(E[5]=Y=>i.value=Y),event:c.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:gt}),null,16)]),_:1},8,["modelValue","event"]),e.createVNode(e.unref(Or),{show:f.value,"onUpdate:show":E[6]||(E[6]=Y=>f.value=Y),images:m.value,current:u.value},{title:e.withCtx(()=>[...E[10]||(E[10]=[e.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class"])}}}),la=Oa.extend({addNodeView(){return P.VueNodeViewRenderer(Hu)}}).configure({inline:!0});function Uu(t){return new Ue.Plugin({key:new Ue.PluginKey("handleClickSelectLink"),props:{handleClick:(o,n,l)=>{const{schema:r,doc:a,tr:i}=o.state,s=oe.getMarkRange(a.resolve(n),r.marks.link);if(!s)return!1;const c=a.resolve(s.from),p=a.resolve(s.to),d=i.setSelection(new Ue.TextSelection(c,p));return o.dispatch(d),!0}}})}const ra=zo.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],Uu({type:this.type})]}}).configure({openOnClick:!1}),qu={key:1,class:"model-viewer-container"},Wu={key:1},Yu={class:"model-viewer-container"},Gu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{tr:n}=I(),{isEditable:l}=W(),r=e.ref(!1),a=e.ref({}),i=e.ref(null),s=e.ref(!1),c=e.ref(!1),p=e.ref({show:!1,fullscreen:!0}),d=e.computed({get(){return o.node.attrs.caption},set(g){o.updateAttributes({caption:g})}}),f=e.computed({get(){return o.node.attrs.src},set(g){o.updateAttributes({src:g})}});function u(g){switch(r.value=!1,g.value){case"replace":_(!0);break}}function m(){s.value=!0,setTimeout(()=>{var g;(g=i.value)==null||g.focus()},0)}function h(){s.value=!1}function b(){p.value.show=!0}function y(){f.value==="init"&&_(!0)}function x(g){r.value=!0,a.value=g}function k(g){f.value=g,_(!1)}function _(g){c.value=g}return e.onMounted(()=>{_(f.value==="init")}),(g,V)=>{var B;return e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:["o-model-viewer-view",{readonly:!((B=g.editor)!=null&&B.isEditable),init:f.value==="init"}],as:"div",onContextmenu:e.withModifiers(x,["prevent"]),onClick:y}),{default:e.withCtx(()=>[e.createVNode(e.unref(ve),{modelValue:c.value,"onUpdate:modelValue":V[1]||(V[1]=$=>c.value=$),placement:f.value==="init"?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(to),{val:f.value==="init"?"":f.value,type:"video",onInput:k},null,8,["val"])]),default:e.withCtx(()=>{var $;return[f.value==="init"?(e.openBlock(),e.createBlock(e.unref(Nt),{key:0,icon:"3d_rotation",placeholder:e.unref(n)("label.model3dAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",qu,[e.createVNode(e.unref(Qt),e.mergeProps(o,{onAction:u}),{default:e.withCtx(()=>[e.unref(l)?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:"subtitles",tooltip:e.unref(n)("label.caption"),onClick:m},null,8,["tooltip"])):e.createCommentVNode("",!0),e.createVNode(e.unref(X),{icon:"zoom_in",tooltip:e.unref(n)("image.zoom"),onClick:b},null,8,["tooltip"])]),_:1},16),e.createElementVNode("model-viewer",e.mergeProps(g.node.attrs,{ar:"","ar-modes":"webxr scene-viewer quick-look","seamless-poster":"","shadow-intensity":"1","camera-controls":"","enable-pan":""}),null,16),e.createElementVNode("div",{class:"caption",onClick:m},[($=g.editor)!=null&&$.isEditable&&s.value?(e.openBlock(),e.createBlock(e.unref(Se),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":V[0]||(V[0]=R=>d.value=R),type:"text",placeholder:"Input caption",autosize:"",onBlur:h},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Wu,e.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(ct),{modelValue:r.value,"onUpdate:modelValue":V[2]||(V[2]=$=>r.value=$),event:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:u}),null,16)]),_:1},8,["modelValue","event"]),e.createVNode(e.unref(En),e.mergeProps({show:p.value.show,"onUpdate:show":V[3]||(V[3]=$=>p.value.show=$)},p.value,{title:e.unref(n)("label.model3d"),"dialog-class":"model-viewer-dialog"}),{default:e.withCtx(()=>[e.createElementVNode("div",Yu,[e.createElementVNode("model-viewer",e.mergeProps(g.node.attrs,{ar:"","ar-modes":"webxr scene-viewer quick-look","seamless-poster":"","shadow-intensity":"1","camera-controls":"","enable-pan":""}),null,16)])]),_:1},16,["show","title"])]),_:1},16,["class"])}}}),aa=Aa.extend({addNodeView(){return P.VueNodeViewRenderer(Gu)}}),Ku=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{tr:n}=I(),{showRowPopover:l,rowActions:r,isEditable:a,cellInfo:i,initProps:s,runCommand:c}=dn(),p=e.ref(!1);return e.onMounted(()=>{s({getPos:o.getPos,editor:o.editor}),p.value=i.value.colIndex===0}),(d,f)=>(e.openBlock(),e.createBlock(e.unref(P.NodeViewWrapper),e.mergeProps({class:"o-table-cell-view",as:"td"},d.node.attrs,{style:{background:d.node.attrs.background}}),{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[p.value?(e.openBlock(),e.createBlock(e.unref(xo),{key:0,modelValue:e.unref(l),"onUpdate:modelValue":f[0]||(f[0]=u=>e.isRef(l)?l.value=u:null),offset:[0,10],tooltip:e.unref(n)("table.addRow"),placement:"right-start","tooltip-offset":[0,2],"tooltip-placement":"left",onAdd:f[1]||(f[1]=u=>e.unref(c)("tableAddRow")),row:""},{default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r),(u,m)=>(e.openBlock(),e.createBlock(e.unref(ce),{key:m,onClick:h=>e.unref(c)(u.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:u.icon,class:e.normalizeClass(u.class)},null,8,["name","class"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(P.NodeViewContent))]),_:1},16,["style"]))}}),ia=Ae.TableCell.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return P.VueNodeViewRenderer(Ku,{stopEvent:()=>!1})}}),Xu=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{tr:n}=I(),{showColPopover:l,showRowPopover:r,columnActions:a,rowActions:i,isEditable:s,cellInfo:c,initProps:p,runCommand:d}=dn(),f=e.ref(!1),u=e.ref(!1);return e.onMounted(()=>{p({getPos:o.getPos,editor:o.editor}),f.value=c.value.rowIndex===0,u.value=c.value.colIndex===0}),(m,h)=>(e.openBlock(),e.createBlock(e.unref(P.NodeViewWrapper),e.mergeProps({class:"o-table-header-view",as:"th"},m.node.attrs,{style:{background:m.node.attrs.background}}),{default:e.withCtx(()=>[e.unref(s)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[f.value?(e.openBlock(),e.createBlock(e.unref(xo),{key:0,modelValue:e.unref(l),"onUpdate:modelValue":h[0]||(h[0]=b=>e.isRef(l)?l.value=b:null),offset:[0,8],tooltip:e.unref(n)("table.addColumn"),placement:"bottom",column:"",onAdd:h[1]||(h[1]=b=>e.unref(d)("tableAddColumn"))},{default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(b,y)=>(e.openBlock(),e.createBlock(e.unref(ce),{key:y,onClick:x=>e.unref(d)(b.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:b.icon,class:e.normalizeClass(b.class)},null,8,["name","class"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(b.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createBlock(e.unref(xo),{key:1,modelValue:e.unref(r),"onUpdate:modelValue":h[2]||(h[2]=b=>e.isRef(r)?r.value=b:null),offset:[0,10],tooltip:e.unref(n)("table.addRow"),placement:"right-start","tooltip-offset":[0,2],"tooltip-placement":"left",row:"",onAdd:h[3]||(h[3]=b=>e.unref(d)("tableAddRow"))},{default:e.withCtx(()=>[e.createVNode(e.unref(se),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i).filter(b=>b.value!=="tableAddRowBefore"),(b,y)=>(e.openBlock(),e.createBlock(e.unref(ce),{key:y,onClick:x=>e.unref(d)(b.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(O),{name:b.icon,class:e.normalizeClass(b.class)},null,8,["name","class"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(b.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(P.NodeViewContent))]),_:1},16,["style"]))}}),ca=Ae.TableHeader.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return P.VueNodeViewRenderer(Xu,{stopEvent:()=>!1})}}),Ju=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,n=e.ref(!1),l=e.computed(()=>{const{selection:a}=o.editor.view.state,i=a.from,s=o.getPos(),c=s+o.node.nodeSize;return i>=s&&i<=c});function r(a){n.value=a}return e.watch(l,a=>{r(a)}),(a,i)=>(e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:"o-table-wrapper-view"}),{default:e.withCtx(()=>[e.createVNode(e.unref(P.NodeViewContent),{as:"table"})]),_:1},16))}}),sa=$a.TableWrapper.extend({addNodeView(){return P.VueNodeViewRenderer(Ju,{stopEvent:()=>!1})}}),Zu={key:1,class:"video-container"},Qu={key:1},em=e.defineComponent({__name:"view",props:P.nodeViewProps,setup(t){const o=t,{tr:n}=I(),{isEditable:l}=W(),r=e.ref(!1),a=e.ref({}),i=e.ref(null),s=e.ref(!1),c=e.ref(!1),p=e.computed({get(){return o.node.attrs.caption},set(k){o.updateAttributes({caption:k})}}),d=e.computed({get(){return o.node.attrs.src},set(k){o.updateAttributes({src:k})}});function f(k){switch(r.value=!1,k.value){case"replace":x(!0);break}}function u(){s.value=!0,setTimeout(()=>{var k;(k=i.value)==null||k.focus()},0)}function m(){s.value=!1}function h(){d.value==="init"&&x(!0)}function b(k){r.value=!0,a.value=k}function y(k){d.value=k,x(!1)}function x(k){c.value=k}return e.onMounted(()=>{x(d.value==="init")}),(k,_)=>{var g;return e.openBlock(),e.createBlock(e.unref(_e),e.mergeProps(o,{class:["o-video-view",{readonly:!((g=k.editor)!=null&&g.isEditable),init:d.value==="init"}],as:"div",onContextmenu:e.withModifiers(b,["prevent"]),onClick:h}),{default:e.withCtx(()=>[e.createVNode(e.unref(ve),{modelValue:c.value,"onUpdate:modelValue":_[1]||(_[1]=V=>c.value=V),placement:d.value==="init"?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(to),{val:d.value==="init"?"":d.value,type:"video",onInput:y},null,8,["val"])]),default:e.withCtx(()=>{var V;return[d.value==="init"?(e.openBlock(),e.createBlock(e.unref(Nt),{key:0,icon:"videocam",placeholder:e.unref(n)("label.videoAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",Zu,[_[3]||(_[3]=e.createElementVNode("div",{class:"video-cover"},null,-1)),e.unref(l)?(e.openBlock(),e.createBlock(e.unref(Qt),e.mergeProps({key:0},o,{onAction:f}),{default:e.withCtx(()=>[e.createVNode(e.unref(X),{icon:"subtitles",tooltip:e.unref(n)("label.caption"),onClick:u},null,8,["tooltip"])]),_:1},16)):e.createCommentVNode("",!0),e.createElementVNode("video",e.mergeProps(k.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[e.createElementVNode("source",e.normalizeProps(e.guardReactiveProps(k.node.attrs)),null,16)],16),e.createElementVNode("div",{class:"caption",onClick:u},[(V=k.editor)!=null&&V.isEditable&&s.value?(e.openBlock(),e.createBlock(e.unref(Se),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:p.value,"onUpdate:modelValue":_[0]||(_[0]=B=>p.value=B),type:"text",placeholder:"Input caption",autosize:"",onBlur:m},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Qu,e.toDisplayString(p.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(ct),{modelValue:r.value,"onUpdate:modelValue":_[2]||(_[2]=V=>r.value=V),event:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:f}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),da=Ta.Video.extend({addNodeView(){return P.VueNodeViewRenderer(em)}}),pa=["BackgroundColor","Color","Focus","FontFamily","Highlight","Subscript","Superscript","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OBlockquote","OCallout","OCodeBlock","OHorizontalRule","OLink","OSelectionDecoration","OSlash","OSlashZh","OTable"],fa={BackgroundColor:t=>Je.BackgroundColor.configure({types:["textStyle"],...t}),BlockMath:t=>Ft.BlockMath.configure(t),Collaboration:t=>Hn.configure(t),CollaborationCaret:t=>Un.configure(t),Color:t=>Je.Color.configure(t),Focus:t=>Fn.Focus.configure(t),FontFamily:t=>Je.FontFamily.configure(t),Highlight:t=>qn.configure({multicolor:!0,...t}),Image:t=>Wn.configure(t),InlineMath:t=>Ft.InlineMath.configure(t),Link:t=>zo.configure(t),Markdown:t=>zn.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1},...t}),Subscript:t=>Yn.configure(t),Superscript:t=>Gn.configure(t),TaskItem:t=>ll.configure(t),TaskList:t=>Fo.TaskList.configure({itemTypeName:"taskItem",...t}),TextAlign:t=>Kn.configure({types:["heading","paragraph"],...t}),TextStyle:t=>Je.TextStyle.configure(t),Typography:t=>Xn.configure(t),Underline:t=>Jn.configure(t),UniqueID:t=>Zn.configure({attributeName:"id",types:["aiBlock","blockquote","blockMath","codeBlock","callout","details","heading","image","paragraph","table-wrapper","video"],...t}),OAiBlock:t=>Gr.configure(t),OAudio:t=>Kr.configure(t),OBlockMath:t=>Xr.configure(t),OBlockquote:t=>Jr.configure({triggerCharacters:['"',"“","”"],...t}),OCallout:t=>Zr.configure(t),OCodeBlock:t=>ta.configure(t),OColon:t=>nt.ColonCommand.configure({suggestion:Yr,...t}),OSlash:t=>nt.SlashCommand.configure({suggestion:$n,...t}),OSlashZh:t=>nt.SlashZhCommand.configure({suggestion:$n,...t}),OColorHighlighter:t=>Qn.configure(t),OColumnDropCursor:t=>qe.ColumnDropCursor.configure(t),OHorizontalRule:t=>na.configure(t),OImage:t=>la.configure(t),OInlinePlaceholder:t=>el.configure(t),OLink:t=>ra.configure({openOnClick:!1,...t}),OModelViewer:t=>aa.configure(t),OSelectionDecoration:t=>tl.configure(t),OShortcut:t=>ol.configure({selectableNodes:["aiBlock","blockquote","callout","codeBlock","column","columns","heading","listItem","paragraph","tableCell","tableHeader","taskItem"],...t}),OVideo:t=>da.configure(t),Table:t=>[Ae.Table.configure({resizable:!0,...t}),Ae.TableRow,Ae.TableHeader,Ae.TableCell],ODetails:t=>[oa.configure({persist:!0,HTMLAttributes:{class:"details"},...t}),wt.DetailsContent,wt.DetailsSummary],OMultiColumn:t=>[qe.ColumnContainer,qe.Column,qe.MultiColumn.configure(t),qe.ColumnDropCursor],OTable:t=>[sa,nl.configure({resizable:!0,...t}),Ae.TableRow,ca,ia]},ua=t=>typeof t=="object"&&t!==null&&(t.type==="extension"||t.type==="node"||t.type==="mark"),Lo=t=>{const{name:o,configure:n}=t,l=fa[o];return l?l(n):(console.warn(`[YiiEditor] Extension factory for "${String(o)}" not found.`),null)},Dn=t=>t.flatMap(o=>Array.isArray(o)?Dn(o):ua(o)?o:typeof o=="string"?Lo({name:o})??[]:typeof o=="object"&&o!==null&&"name"in o?Lo(o)??[]:[]),tm={configure(t={}){return pa.flatMap(o=>{const n=t[o];return n===!1?[]:Lo({name:o,configure:typeof n=="object"?n:void 0})??[]})}},om=["data-theme"],ma=e.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},title:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:[String,Number,Boolean],default:!1},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},sideMenu:{type:Object,default:()=>({show:!0,add:"menu"})},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:t=>["page","full"].includes(t)},aiOptions:{type:Object,default:()=>{}},collab:{type:Object,default:()=>({enabled:!1})}},emits:["create","transaction","update"],setup(t,{expose:o,emit:n}){const l=t,r=n,{tr:a}=I(),i=e.ref(!1),s=e.ref(!0),c=e.ref("en"),p=e.ref(),d=e.ref(!1);e.provide("darkMode",i),e.provide("isEditable",s),e.provide("locale",c),e.provide("aiOptions",p);const f=e.computed(()=>x()),u=P.useEditor({editable:l.editable,content:l.content,autofocus:l.autofocus,extensions:f.value,onCreate:()=>{d.value=!0,r("create",u.value)},onUpdate:({editor:k})=>{d.value&&r("update",{editor:k})},onTransaction:({editor:k,transaction:_})=>{r("transaction",{editor:k,transaction:_})}}),m=e.computed(()=>({editor:u.value,menu:l.mainMenu})),h=e.computed(()=>({editor:u.value,menu:l.bubbleMenu,aiOptions:l.aiOptions})),b=e.computed(()=>({editor:u.value,menu:l.floatingMenu})),y=e.computed(()=>({editor:u.value,add:l.sideMenu.add,title:l.title,menu:[]}));function x(){const k=[];l.title?k.push(vn.extend({content:"heading block*"})):k.push(vn),k.push(ot.configure({includeChildren:!0,placeholder:({editor:g,node:V,pos:B})=>{const $=g.state.doc.resolve(B);for(let R=$.depth;R>0;R--){const D=$.node(R).type.name;if(["tableCell","tableHeader","table"].includes(D))return""}if(V.type.name==="heading"){const R=V.attrs.level;return B>0?`H${R}`:a("label.untitled")}else return V.type.name==="paragraph"?a("label.typeForCommands"):""}})),k.push(ba.configure({dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},codeBlock:!1,document:!1,horizontalRule:!1,link:!1,blockquote:!1,trailingNode:l.title?{node:"paragraph",notAfter:["paragraph","heading"]}:{notAfter:[]},undoRedo:l.collab.enabled?!1:{depth:100,newGroupDelay:500}}));const _=Dn(l.extensions);return k.push(..._),k}return e.watch(()=>l.darkMode,k=>{i.value=k}),e.watch(()=>l.locale,k=>{c.value=k}),e.watch(()=>l.aiOptions,k=>{p.value=k},{deep:!0}),e.watch(()=>l.editable,k=>{var _;(_=u.value)==null||_.setEditable(k),s.value=k}),e.onBeforeMount(()=>{s.value=l.editable,p.value=l.aiOptions,i.value=l.darkMode,c.value=l.locale}),o({editor:u,darkMode:i,locale:c}),(k,_)=>{var g,V,B;return e.openBlock(),e.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":i.value?"dark":""},[t.showMainMenu?(e.openBlock(),e.createBlock(qr,e.mergeProps({key:0},m.value,{class:"desktop-only"}),{left:e.withCtx(()=>[e.renderSlot(k.$slots,"toolbar-left")]),right:e.withCtx(()=>[e.renderSlot(k.$slots,"toolbar-right")]),_:3},16)):e.createCommentVNode("",!0),(g=e.unref(u))!=null&&g.isEditable&&t.showBubbleMenu?(e.openBlock(),e.createBlock(uf,e.normalizeProps(e.mergeProps({key:1},h.value)),null,16)):e.createCommentVNode("",!0),(V=e.unref(u))!=null&&V.isEditable&&t.showFloatingMenu?(e.openBlock(),e.createBlock(gf,e.normalizeProps(e.mergeProps({key:2},b.value)),null,16)):e.createCommentVNode("",!0),(B=e.unref(u))!=null&&B.isEditable&&t.sideMenu.show?(e.openBlock(),e.createBlock(Nf,e.normalizeProps(e.mergeProps({key:3},y.value)),null,16)):e.createCommentVNode("",!0),e.createVNode(e.unref(P.EditorContent),{class:e.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:e.unref(u)},null,8,["class","editor"])],8,om)}}}),nm=(t,o)=>{const l=new DOMParser().parseFromString(t,"text/html"),r=l.querySelectorAll(o),a=o.replace(/[[\]]/g,"");return r.forEach(i=>{i.removeAttribute(a)}),l.body.innerHTML},lm={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",ma)}};return C.OPlaceholder=ot,Object.defineProperty(C,"Focus",{enumerable:!0,get:()=>Fn.Focus}),Object.defineProperty(C,"Details",{enumerable:!0,get:()=>wt.Details}),Object.defineProperty(C,"DetailsContent",{enumerable:!0,get:()=>wt.DetailsContent}),Object.defineProperty(C,"DetailsSummary",{enumerable:!0,get:()=>wt.DetailsSummary}),Object.defineProperty(C,"TaskItem",{enumerable:!0,get:()=>Fo.TaskItem}),Object.defineProperty(C,"TaskList",{enumerable:!0,get:()=>Fo.TaskList}),Object.defineProperty(C,"BlockMath",{enumerable:!0,get:()=>Ft.BlockMath}),Object.defineProperty(C,"InlineMath",{enumerable:!0,get:()=>Ft.InlineMath}),Object.defineProperty(C,"Table",{enumerable:!0,get:()=>Ae.Table}),Object.defineProperty(C,"TableCell",{enumerable:!0,get:()=>Ae.TableCell}),Object.defineProperty(C,"TableHeader",{enumerable:!0,get:()=>Ae.TableHeader}),Object.defineProperty(C,"TableRow",{enumerable:!0,get:()=>Ae.TableRow}),Object.defineProperty(C,"BackgroundColor",{enumerable:!0,get:()=>Je.BackgroundColor}),Object.defineProperty(C,"Color",{enumerable:!0,get:()=>Je.Color}),Object.defineProperty(C,"FontFamily",{enumerable:!0,get:()=>Je.FontFamily}),Object.defineProperty(C,"TextStyle",{enumerable:!0,get:()=>Je.TextStyle}),Object.defineProperty(C,"Markdown",{enumerable:!0,get:()=>zn.Markdown}),C.Collaboration=Hn,C.CollaborationCaret=Un,C.Highlight=qn,C.Image=Wn,C.Link=zo,C.Mention=Ca,C.Subscript=Yn,C.Superscript=Gn,C.TextAlign=Kn,C.Typography=Xn,C.Underline=Jn,C.UniqueID=Zn,C.OColorHighlighter=Qn,C.OInlinePlaceholder=el,Object.defineProperty(C,"Column",{enumerable:!0,get:()=>qe.Column}),Object.defineProperty(C,"ColumnContainer",{enumerable:!0,get:()=>qe.ColumnContainer}),Object.defineProperty(C,"ColumnDropCursor",{enumerable:!0,get:()=>qe.ColumnDropCursor}),Object.defineProperty(C,"MultiColumn",{enumerable:!0,get:()=>qe.MultiColumn}),C.OSelectionDecoration=tl,C.OShortcut=ol,C.OTable=nl,C.OTaskItem=ll,C.OCharCommand=nt,Object.defineProperty(C,"OColonCommand",{enumerable:!0,get:()=>nt.ColonCommand}),Object.defineProperty(C,"OSlashCommand",{enumerable:!0,get:()=>nt.SlashCommand}),Object.defineProperty(C,"OSlashZhCommand",{enumerable:!0,get:()=>nt.SlashZhCommand}),C.AddNode=Er,C.AdvancedBlocks=er,C.AiBlocks=or,C.AiProviders=$r,C.AskAiBlocks=tr,C.BasicBlocks=Zt,C.BlockMenus=yo,C.Blocks=ko,C.BrandColor=q,C.ColonSuggestion=Yr,C.CommonBlocks=ho,C.DefaultBubble=Mr,C.DefaultEmbedServices=bp,C.DefaultExtensionNames=pa,C.DefaultFloating=Fr,C.DefaultMenu=Tr,C.DragNode=Nr,C.EmojiSuggestion=Yf,C.ImageBubble=Rr,C.ImageLinkBubble=vr,C.InlineMathBubble=Lr,C.LinkBubble=Pr,C.MoreBubble=Ir,C.OAiBlock=Gr,C.OAiMenu=Hr,C.OAlignDropdown=pn,C.OAudio=Kr,C.OBlockList=go,C.OBlockListItem=un,C.OBlockMath=Xr,C.OBlockMenu=Ke,C.OBlockPlaceholder=Nt,C.OBlockPopover=ve,C.OBlockToolbar=Qt,C.OBlockquote=Jr,C.OBtn=te,C.OBtnGroup=Sr,C.OCallout=Zr,C.OCalloutColorBoard=gn,C.OCalloutColorDropdown=qc,C.OCheckbox=Vn,C.OCodeBlock=ta,C.OCodeBlockDownloadDropdown=Gl,C.OCodeBlockViewDropdown=Kl,C.OColorBoard=st,C.OCommandBtn=ie,C.OCommonBtn=et,C.OContextMenu=ct,C.ODetails=oa,C.ODialog=En,C.ODivider=fe,C.ODocToc=ns,C.OEmojiSelect=wo,C.OExtensionDropdown=Xl,C.OHorizontalRule=na,C.OIcon=O,C.OImage=la,C.OImageViewer=Or,C.OInlineMathMenu=Ur,C.OInput=Se,C.OLanguageDropdown=nr,C.OLink=ra,C.OLinkBtn=fn,C.OList=se,C.OListItem=ce,C.OMainMenu=qr,C.OMediaInput=to,C.OMenubarBtn=X,C.OMetaInput=Co,C.OModelViewer=aa,C.ONodeView=_e,C.OPopover=Z,C.OStarterKit=tm,C.OTableCell=ia,C.OTableCellBackground=rr,C.OTableCellHandler=xo,C.OTableGrid=lr,C.OTableHeader=ca,C.OTableWrapper=sa,C.OTextColorBoard=bn,C.OTextarea=Ar,C.OToast=lo,C.OTooltip=Ce,C.OVideo=da,C.Prompts=Nn,C.SlashSuggestion=$n,C.StyleBlocks=bo,C.TableBubble=jr,C.TableMenu=Dr,C.YiiEditor=ma,C.YiiEditorPlugin=lm,C.convertShortcut=Ql,C.createExtension=Lo,C.createExtensionList=Dn,C.extensionRegistry=fa,C.getProviderProp=gp,C.htmlToJSON=mn,C.htmlToJSON0=Tc,C.isExtensionInstance=ua,C.removeHtmlAttributes=nm,C.systemKeymap=Zl,C.toJSON=Jl,C.useAi=sn,C.useCommon=uo,C.useI18n=I,C.useNodeView=Wl,C.useTable=dn,C.useTheme=it,C.useTiptap=W,Object.keys(oe).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(C,t)&&Object.defineProperty(C,t,{enumerable:!0,get:()=>oe[t]})}),Object.keys(Uo).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(C,t)&&Object.defineProperty(C,t,{enumerable:!0,get:()=>Uo[t]})}),Object.defineProperty(C,Symbol.toStringTag,{value:"Module"}),C})({},Vue,CustomtiptapVue3,CustomtiptapStarterKit,CustomtiptapExtensionDocument,MarkdownIt,CustomyiitapI18n,CustomtiptapPmTables,CustomyiitapExtensionPlaceholder,CustomtiptapCore,CustomtiptapPmModel,CustomyiitapUtilEmoji,CustomtiptapPmState,CustomtiptapVue3Menus,CustomtiptapExtensions,CustomtiptapExtensionDetails,CustomtiptapExtensionList,CustomtiptapExtensionMathematics,CustomtiptapExtensionTable,CustomtiptapExtensionTextStyle,CustomtiptapMarkdown,CustomtiptapExtensionCollaboration,CustomtiptapExtensionCollaborationCaret,CustomtiptapExtensionHighlight,CustomtiptapExtensionHorizontalRule,CustomtiptapExtensionImage,CustomtiptapExtensionLink,CustomtiptapExtensionMention,CustomtiptapExtensionSubscript,CustomtiptapExtensionSuperscript,CustomtiptapExtensionTextAlign,CustomtiptapExtensionTypography,CustomtiptapExtensionUnderline,CustomtiptapExtensionUniqueId,CustomyiitapExtensionColorHighlighter,CustomyiitapExtensionInlinePlaceholder,CustomyiitapExtensionMultiColumn,CustomyiitapExtensionSelectionDecoration,CustomyiitapExtensionShortcut,CustomyiitapExtensionTable,CustomyiitapExtensionTaskItem,CustomyiitapExtensionCharCommand,CustomtiptapSuggestion,CustomyiitapExtensionAiBlock,CustomtiptapExtensionAudio,Katex,CustomyiitapExtensionBlockquote,CustomyiitapExtensionCallout,CustomtiptapExtensionCodeBlockLowlight,Customlowlight,Mermaid,CustommermaidJsLayoutElk,CustomyiitapCore,CustomyiitapExtensionImage,CustomyiitapExtensionModelViewer,CustomyiitapExtensionTableWrapper,CustomyiitapExtensionVideo);
335
71
  //# sourceMappingURL=index.js.map