@yiitap/vue 0.16.3 → 0.17.1

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.cjs CHANGED
@@ -1,175 +1,31 @@
1
- "use strict";var NN=Object.defineProperty;var AN=(n,e,t)=>e in n?NN(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Ue=(n,e,t)=>AN(n,typeof e!="symbol"?e+"":e,t);/**
1
+ "use strict";var ga=Object.defineProperty;var ba=(t,o,n)=>o in t?ga(t,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[o]=n;var te=(t,o,n)=>ba(t,typeof o!="symbol"?o+"":o,n);/**
2
2
  * Copyright 2026 Yiitap
3
3
  * @license MIT
4
- **/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("vue"),ON=require("markdown-it"),$N=require("@yiitap/i18n"),Dl=require("@yiitap/util-emoji"),_l=require("@tiptap/extension-mathematics"),Fw=require("@tiptap/markdown"),cs=require("yjs"),BN=require("@tiptap/extension-audio"),RN=require("katex"),qy=require("lowlight"),$f=require("mermaid"),DN=require("@mermaid-js/layout-elk");function _N(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 oe=_N(cs);function Rt(n){this.content=n}Rt.prototype={constructor:Rt,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 Rt(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 Rt(t)},addToStart:function(n,e){return new Rt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Rt(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 Rt(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=Rt.from(n),n.size?new Rt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Rt.from(n),n.size?new Rt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Rt.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}};Rt.from=function(n){if(n instanceof Rt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Rt(e)};function jw(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=jw(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function Uw(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 u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=Uw(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}class I{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],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}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 u=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&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},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 I(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 I(o,r)}cutByIndex(e,t){return e==t?I.empty:e==0&&t==this.content.length?this:new I(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 I(r,i)}addToStart(e){return new I([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new I(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw 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 jw(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return Uw(this,e,t,o)}findIndex(e){if(e==0)return Ja(0,e);if(e==this.size)return Ja(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?Ja(t+1,i):Ja(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 I.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new I(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return I.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 I(t||e,o)}static from(e){if(!e)return I.empty;if(e instanceof I)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new I([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}I.empty=new I([],0);const Bf={index:0,offset:0};function Ja(n,e){return Bf.index=n,Bf.offset=e,Bf}function Kc(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(!Kc(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Kc(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let We=class Ip{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&&Kc(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 Ip.none;if(e instanceof Ip)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};We.none=[];class Jc extends Error{}class F{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=qw(this.content,e+this.openStart,t);return o&&new F(o,this.openStart,this.openEnd)}removeBetween(e,t){return new F(Ww(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 F.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 F(I.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 F(e,o,r)}}F.empty=new F(I.empty,0,0);function Ww(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(Ww(i.content,e-r-1,t-r-1)))}function qw(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=qw(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function IN(n,e,t){if(t.openStart>n.depth)throw new Jc("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Jc("Inconsistent open depths");return Kw(n,e,t,0)}function Kw(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=Kw(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 si(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=LN(t,n);return si(i,Gw(n,s,l,e,o))}else return si(i,Gc(n,e,o))}function Jw(n,e){if(!e.type.compatibleContent(n.type))throw new Jc("Cannot join "+e.type.name+" onto "+n.type.name)}function Lp(n,e,t){let o=n.node(t);return Jw(o,e.node(t)),o}function ii(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 hl(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&&(ii(n.nodeAfter,o),i++));for(let l=i;l<s;l++)ii(r.child(l),o);e&&e.depth==t&&e.textOffset&&ii(e.nodeBefore,o)}function si(n,e){return n.type.checkContent(e),n.copy(e)}function Gw(n,e,t,o,r){let i=n.depth>r&&Lp(n,e,r+1),s=o.depth>r&&Lp(t,o,r+1),l=[];return hl(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(Jw(i,s),ii(si(i,Gw(n,e,t,o,r+1)),l)):(i&&ii(si(i,Gc(n,e,r+1)),l),hl(e,t,r,l),s&&ii(si(s,Gc(t,o,r+1)),l)),hl(o,null,r,l),new I(l)}function Gc(n,e,t){let o=[];if(hl(null,n,t,o),n.depth>t){let r=Lp(n,e,t+1);ii(si(r,Gc(n,e,t+1)),o)}return hl(e,null,t,o),new I(o)}function LN(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(I.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class Il{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 We.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 Xc(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),u=i-a;if(o.push(s,l,r+a),!u||(s=s.child(l),s.isText))break;i=u-1,r+=a+1}return new Il(t,o,i)}static resolveCached(e,t){let o=Ky.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 Ky.set(e,o=new PN);let r=o.elts[o.i]=Il.resolve(e,t);return o.i=(o.i+1)%VN,r}}class PN{constructor(){this.elts=[],this.i=0}}const VN=12,Ky=new WeakMap;class Xc{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 zN=Object.create(null);let Ln=class Pp{constructor(e,t,o,r=We.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||I.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,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&&Kc(this.attrs,t||e.defaultAttrs||zN)&&We.sameSet(this.marks,o||We.none)}copy(e=null){return e==this.content?this:new Pp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Pp(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 F.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),u=r.node(s).content.cut(r.pos-l,i.pos-l);return new F(u,r.depth-s,i.depth-s)}replace(e,t,o){return IN(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 Il.resolveCached(this,e)}resolveNoCache(e){return Il.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()+")"),Xw(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=I.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=We.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(!We.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=I.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Ln.prototype.text=void 0;class Yc extends Ln{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):Xw(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 Yc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Yc(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 Xw(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class vi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new HN(e,t);if(o.next==null)return vi.empty;let r=Yw(o);o.next&&o.err("Unexpected trailing text");let i=JN(KN(r));return GN(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 I.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(d));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
- `)}}vi.empty=new vi(!0);class HN{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 Yw(n){let e=[];do e.push(FN(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function FN(n){let e=[];do e.push(jN(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function jN(n){let e=qN(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=UN(n,e);else break;return e}function Jy(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function UN(n,e){let t=Jy(n),o=t;return n.eat(",")&&(n.next!="}"?o=Jy(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function WN(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 qN(n){if(n.eat("(")){let e=Yw(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=WN(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 KN(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=i(s.exprs[a],l);if(a==s.exprs.length-1)return u;r(u,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 u=0;u<s.min;u++){let d=t();r(i(s.expr,a),d),a=d}if(s.max==-1)r(i(s.expr,a),a);else for(let u=s.min;u<s.max;u++){let d=t();o(a,d),r(i(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Qw(n,e){return e-n}function Gy(n,e){let t=[];return o(e),t.sort(Qw);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 JN(n){let e=Object.create(null);return t(Gy(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);Gy(n,a).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new vi(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Qw);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function GN(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:u}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Zw(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 e0(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 t0(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 n0(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new YN(n,o,e[o]);return t}let Xy=class o0{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=n0(e,o.attrs),this.defaultAttrs=Zw(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==vi.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:e0(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ln(this,this.computeAttrs(e),I.from(t),We.setFrom(o))}createChecked(e=null,t,o){return t=I.from(t),this.checkContent(t),new Ln(this,this.computeAttrs(e),t,We.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=I.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(I.empty,!0);return i?new Ln(this,e,t.append(i),We.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){t0(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:We.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new o0(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 XN(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 YN{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?XN(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class yd{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=n0(e,r.attrs),this.excluded=null;let i=Zw(this.attrs);this.instance=i?new We(this,i):null}create(e=null){return!e&&this.instance?this.instance:new We(this,e0(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new yd(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){t0(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let r0=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=Rt.from(e.nodes),t.marks=Rt.from(e.marks||{}),this.nodes=Xy.compile(this.spec.nodes,this),this.marks=yd.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]=vi.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?Yy(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==""?[]:Yy(this,s.split(" "))}this.nodeFromJSON=r=>Ln.fromJSON(this,r),this.markFromJSON=r=>We.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 Xy){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 Yc(o,o.defaultAttrs,e,We.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 Yy(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 QN(n){return n.tag!=null}function ZN(n){return n.style!=null}let $r=class Vp{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(QN(r))this.tags.push(r);else if(ZN(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 Zy(this,t,!1);return o.addAll(e,We.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Zy(this,t,!0);return o.addAll(e,We.none,t.from,t.to),F.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(nA(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=eb(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=eb(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Vp(e,Vp.schemaRules(e)))}};const i0={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},eA={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},s0={ol:!0,ul:!0},Ll=1,zp=2,ml=4;function Qy(n,e,t){return e!=null?(e?Ll:0)|(e==="full"?zp:0):n&&n.whitespace=="pre"?Ll|zp:t&~ml}class Ga{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=We.none,this.match=i||(s&ml?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(I.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let 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&Ll)){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=I.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(I.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!i0.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Zy{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=Qy(null,t.preserveWhitespace,0)|(o?ml:0);r?i=new Ga(r.type,r.attrs,We.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new Ga(null,null,We.none,!0,null,s):i=new Ga(e.schema.topNodeType,null,We.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&zp?"full":this.localPreserveWS||(r.options&Ll)>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;s0.hasOwnProperty(s)&&this.parser.normalizeLists&&tA(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:eA.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 u,d=this.needsBlock;if(i0.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!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),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,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(u=>!a.clearMark(u)):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],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.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=We.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):tb(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=Qy(e,i,s.options);s.options&ml&&s.content.length==0&&(l|=ml);let a=We.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):tb(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Ga(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|=Ll)}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 u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))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 tA(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&s0.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function nA(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function eb(n){let e={};for(let t in n)e[t]=n[t];return e}function tb(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:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Ii{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Rf(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 u=s.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let u=s.marks[a++],d=this.serializeMark(u,s.isInline,t);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=Ec(Rf(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&&Ec(Rf(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Ec(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ii(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=nb(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return nb(e.marks)}}function nb(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Rf(n){return n.document||window.document}const ob=new WeakMap;function oA(n){let e=ob.get(n);return e===void 0&&ob.set(n,e=rA(n)),e}function rA(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 Ec(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=oA(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),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>d)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}=Ec(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 l0=65535,a0=Math.pow(2,16);function iA(n,e){return n+e*a0}function rb(n){return n&l0}function sA(n){return(n-(n&l0))/a0}const c0=1,u0=2,Mc=4,d0=8;class Hp{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&d0)>0}get deletedBefore(){return(this.delInfo&(c0|Mc))>0}get deletedAfter(){return(this.delInfo&(u0|Mc))>0}get deletedAcross(){return(this.delInfo&Mc)>0}}class kn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&kn.empty)return kn.empty}recover(e){let t=0,o=rb(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+sA(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 u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:iA(l/3,e-a),g=e==a?u0:e==f?c0:Mc;return(t<0?e!=a:e!=f)&&(g|=d0),new Hp(h,g,m)}r+=d-u}return o?e+r:new Hp(e+r,0,null)}touches(e,t){let o=0,r=rb(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 u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}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),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new kn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?kn.empty:new kn(e<0?[0,-e,0]:[0,0,e])}}kn.empty=new kn([]);class Pl{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 Pl(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 Pl;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 Hp(e,r,null)}}const Df=Object.create(null);class Xt{getMap(){return kn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Df[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 Df)throw new RangeError("Duplicate use of step JSON ID "+e);return Df[e]=t,t.prototype.jsonID=e,t}}class ht{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ht(e,null)}static fail(e){return new ht(null,e)}static fromReplace(e,t,o,r){try{return ht.ok(e.replace(t,o,r))}catch(i){if(i instanceof Jc)return ht.fail(i.message);throw i}}}function bm(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(bm(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return I.fromArray(o)}class Er extends Xt{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 F(bm(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 ht.fromReplace(e,this.from,this.to,i)}invert(){return new Xn(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 Er(t.pos,o.pos,this.mark)}merge(e){return e instanceof Er&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Er(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 Er(t.from,t.to,e.markFromJSON(t.mark))}}Xt.jsonID("addMark",Er);class Xn extends Xt{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 F(bm(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return ht.fromReplace(e,this.from,this.to,o)}invert(){return new Er(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 Xn(t.pos,o.pos,this.mark)}merge(e){return e instanceof Xn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xn(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 Xn(t.from,t.to,e.markFromJSON(t.mark))}}Xt.jsonID("removeMark",Xn);class Mr extends Xt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ht.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ht.fromReplace(e,this.pos,this.pos+1,new F(I.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 Mr(this.pos,t.marks[r]);return new Mr(this.pos,this.mark)}}return new ki(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mr(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 Mr(t.pos,e.markFromJSON(t.mark))}}Xt.jsonID("addNodeMark",Mr);class ki extends Xt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ht.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ht.fromReplace(e,this.pos,this.pos+1,new F(I.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Mr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ki(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 ki(t.pos,e.markFromJSON(t.mark))}}Xt.jsonID("removeNodeMark",ki);class xt extends Xt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Fp(e,this.from,this.to)?ht.fail("Structure replace would overwrite content"):ht.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new kn([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?F.empty:new F(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?F.empty:new F(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,F.fromJSON(e,t.slice),!!t.structure)}}Xt.jsonID("replace",xt);class St extends Xt{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&&(Fp(e,this.from,this.gapFrom)||Fp(e,this.gapTo,this.to)))return ht.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ht.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?ht.fromReplace(e,this.from,this.to,o):ht.fail("Content does not fit in gap")}getMap(){return new kn([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 St(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 St(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 St(t.from,t.to,t.gapFrom,t.gapTo,F.fromJSON(e,t.slice),t.insert,!!t.structure)}}Xt.jsonID("replaceAround",St);function Fp(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 lA(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+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 Xn(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Er(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function aA(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 yd){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],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=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new Xn(s.from,s.to,s.style)))}function vm(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 u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new xt(l,d,F.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new Xn(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new F(I.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new xt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(I.empty,!0);n.replace(l,l,new F(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function cA(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Li(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||!cA(s,l,a))break;l&&(r=1),a<s.childCount&&(i=1)}return null}function uA(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=I.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=I.from(o.node(m).copy(d)),f++):a--;let p=I.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=I.from(r.node(m).copy(p)),h++):u++;n.step(new St(a,u,s,l,new F(d.append(p),f,h),d.size-f,!0))}function km(n,e,t=null,o=n){let r=dA(n,e),i=r&&fA(o,e);return i?r.map(ib).concat({type:e,attrs:t}).concat(i.map(ib)):null}function ib(n){return{type:n,attrs:null}}function dA(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 fA(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 u=o;a&&u<r;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:s}function pA(n,e,t){let o=I.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=I.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new St(r,i,r,i,new F(o,0,0),t.length,!0))}function hA(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)&&mA(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&p0(n,s,l,i),vm(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new St(f,p,f+1,p-1,new F(I.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&f0(n,s,l,i),!1}})}function f0(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 p0(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 mA(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function gA(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 St(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new F(I.from(s),0,0),1,!0))}function vo(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 u=r.depth-1,d=t-2;u>i;u--,d--){let f=r.node(u),p=r.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||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 yA(n,e,t=1,o){let r=n.doc.resolve(e),i=I.empty,s=I.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=I.from(r.node(l).copy(i));let d=o&&o[u];s=I.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new xt(e,e,new F(i.append(s),t,t),!0))}function Fr(n,e){let t=n.resolve(e),o=t.index();return h0(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function bA(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 h0(n,e){return!!(n&&e&&!n.isLeaf&&bA(n,e))}function bd(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&&h0(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 vA(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 d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);p0(n,d.node(),d.before(),l)}s.inlineContent&&vm(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new xt(u,a.map(e+t,-1),F.empty,!0)),o===!0){let d=n.doc.resolve(u);f0(n,d.node(),d.before(),n.steps.length)}return n}function kA(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 m0(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),u=o.node(s),d=!1;if(i==1)d=u.canReplace(a,a,r);else{let f=u.contentMatchAt(a).findWrapping(r.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function vd(n,e,t=e,o=F.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return g0(r,i,o)?new xt(e,t,o):new wA(r,i,o).fit()}function g0(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class wA{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=I.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=I.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):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 F(i,s,l);return e>-1?new St(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=_f(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:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(I.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=_f(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new F(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=_f(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new F(Qs(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new F(Qs(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,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(y0(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=Zs(this.placed,t,I.from(d)),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?F.empty:new F(Qs(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new F(Qs(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!If(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=If(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=If(e,l,u,a,!0);if(!d||d.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=Zs(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=Zs(this.placed,this.depth,I.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(I.empty,!0);t.childCount&&(this.placed=Zs(this.placed,this.frontier.length,t))}}function Qs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Qs(n.firstChild.content,e-1,t)))}function Zs(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Zs(n.lastChild.content,e-1,t)))}function _f(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function y0(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,y0(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(I.empty,!0)))),n.copy(o)}function If(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&&!xA(t,i.content,s)?l:null}function xA(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function CA(n){return n.spec.defining||n.spec.definingForContent}function SA(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(g0(r,i,o))return n.step(new xt(e,t,o));let s=v0(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),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=CA(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[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 v=r.node(y-1),w=r.index(y-1);if(v.canReplaceWith(w,w,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new F(b0(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 b0(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(b0(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(I.empty,!0))}return n}function EA(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=kA(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new F(I.from(o),0,0))}function MA(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=v0(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 v0(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 fs extends Xt{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 ht.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 ht.fromReplace(e,this.pos,this.pos+1,new F(I.from(r),0,t.isLeaf?0:1))}getMap(){return kn.empty}invert(e){return new fs(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 fs(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 fs(t.pos,t.attr,t.value)}}Xt.jsonID("attr",fs);class Vl extends Xt{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 ht.ok(o)}getMap(){return kn.empty}invert(e){return new Vl(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 Vl(t.attr,t.value)}}Xt.jsonID("docAttr",Vl);let vs=class extends Error{};vs=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};vs.prototype=Object.create(Error.prototype);vs.prototype.constructor=vs;vs.prototype.name="TransformError";class wm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new vs(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=F.empty){let r=vd(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new F(I.from(o),0,0))}delete(e,t){return this.replace(e,t,F.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return SA(this,e,t,o),this}replaceRangeWith(e,t,o){return EA(this,e,t,o),this}deleteRange(e,t){return MA(this,e,t),this}lift(e,t){return uA(this,e,t),this}join(e,t=1){return vA(this,e,t),this}wrap(e,t){return pA(this,e,t),this}setBlockType(e,t=e,o,r=null){return hA(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return gA(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new fs(e,t,o)),this}setDocAttribute(e,t){return this.step(new Vl(e,t)),this}addNodeMark(e,t){return this.step(new Mr(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 We)t.isInSet(o.marks)&&this.step(new ki(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new ki(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 yA(this,e,t,o),this}addMark(e,t,o){return lA(this,e,t,o),this}removeMark(e,t,o){return aA(this,e,t,o),this}clearIncompatible(e,t,o){return vm(this,e,t,o),this}}const Lf=Object.create(null);class ie{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new k0(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=F.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:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?F.empty:t),l==0&&ab(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),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),ab(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new q(e):Qi(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?Qi(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Qi(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 sn(e.node(0))}static atStart(e){return Qi(e,e,0,0,1)||new sn(e)}static atEnd(e){return Qi(e,e,e.content.size,e.childCount,-1)||new sn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Lf[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 Lf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Lf[e]=t,t.prototype.jsonID=e,t}getBookmark(){return q.between(this.$anchor,this.$head).getBookmark()}}ie.prototype.visible=!0;class k0{constructor(e,t){this.$from=e,this.$to=t}}let sb=!1;function lb(n){!sb&&!n.parent.inlineContent&&(sb=!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){lb(e),lb(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=F.empty){if(super.replace(e,t),t==F.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 kd(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 kd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new kd(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 F(I.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 xm(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 xm{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new kd(o,o):new xm(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Q.isSelectable(o)?new Q(t):ie.near(t)}}class sn extends ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=F.empty){if(t==F.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 sn(e)}map(e){return new sn(e)}eq(e){return e instanceof sn}getBookmark(){return TA}}ie.jsonID("all",sn);const TA={map(){return this},resolve(n){return new sn(n)}};function Qi(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=Qi(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function ab(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof xt||r instanceof St))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(ie.near(n.doc.resolve(s),t))}const cb=1,Xa=2,ub=4;class NA extends wm{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|cb)&~Xa,this.storedMarks=null,this}get selectionSet(){return(this.updated&cb)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xa,this}ensureMarks(e){return We.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&Xa)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Xa,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)||We.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|=ub,this}get scrolledIntoView(){return(this.updated&ub)>0}}function db(n,e){return!e||!n?n:n.bind(e)}class el{constructor(e,t,o){this.name=e,this.init=db(t.init,o),this.apply=db(t.apply,o)}}const AA=[new el("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new el("selection",{init(n,e){return n.selection||ie.atStart(e.doc)},apply(n){return n.selection}}),new el("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new el("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Pf{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=AA.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 el(o.key,o.spec.state,o))})}}class us{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,u=r?r[s].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,u,o);if(d&&o.filterTransaction(d,s)){if(d.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(d),o=o.applyInner(d),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 us(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 NA(this)}static create(e){let t=new Pf(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new us(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 Pf(this.schema,e.plugins),o=t.fields,r=new us(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 Pf(e.schema,e.plugins),i=new us(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Ln.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],u=a.spec.state;if(a.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=u.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function w0(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=w0(r,e,{})),t[o]=r}return t}class ce{constructor(e){this.spec=e,this.props={},e.props&&w0(e.props,this,this.props),this.key=e.key?e.key.key:x0("plugin")}getState(e){return e[this.key]}}const Vf=Object.create(null);function x0(n){return n in Vf?n+"$"+ ++Vf[n]:(Vf[n]=0,n+"$")}class le{constructor(e="key"){this.key=x0(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Cm=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function C0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const S0=(n,e,t)=>{let o=C0(n,t);if(!o)return!1;let r=Sm(o);if(!r){let s=o.blockRange(),l=s&&Li(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(B0(n,r,e,-1))return!0;if(o.parent.content.size==0&&(ks(i,"end")||Q.isSelectable(i)))for(let s=o.depth;;s--){let l=vd(n.doc,o.before(s),o.after(s),F.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(ks(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},OA=(n,e,t)=>{let o=C0(n,t);if(!o)return!1;let r=Sm(o);return r?E0(n,r,e):!1},$A=(n,e,t)=>{let o=T0(n,t);if(!o)return!1;let r=Em(o);return r?E0(n,r,e):!1};function E0(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 d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=vd(n.doc,i,a,F.empty);if(!u||u.from!=i||u instanceof xt&&u.slice.size>=a-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(q.create(d.doc,i)),t(d.scrollIntoView())}return!0}function ks(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 M0=(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=Sm(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 Sm(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 T0(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const N0=(n,e,t)=>{let o=T0(n,t);if(!o)return!1;let r=Em(o);if(!r)return!1;let i=r.nodeAfter;if(B0(n,r,e,1))return!0;if(o.parent.content.size==0&&(ks(i,"start")||Q.isSelectable(i))){let s=vd(n.doc,o.before(),o.after(),F.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(ks(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},A0=(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=Em(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 Em(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 BA=(n,e)=>{let t=n.selection,o=t instanceof Q,r;if(o){if(t.node.isTextblock||!Fr(n.doc,t.from))return!1;r=t.from}else if(r=bd(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},RA=(n,e)=>{let t=n.selection,o;if(t instanceof Q){if(t.node.isTextblock||!Fr(n.doc,t.to))return!1;o=t.to}else if(o=bd(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},DA=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Li(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Mm=(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 Tm(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 _A=(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=Tm(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},Nm=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof sn||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Tm(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},O0=(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(vo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Li(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function IA(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Q&&e.selection.node.isBlock)return!o.parentOffset||!vo(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,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=Tm(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 d=e.tr;(e.selection instanceof q||e.selection instanceof sn)&&d.deleteSelection();let f=d.mapping.map(o.pos),p=vo(d.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=vo(d.doc,f,i.length,i)),!p)return!1;if(d.split(f,i.length,i),!a&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const $0=IA(),LA=(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 PA(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||Fr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function B0(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&PA(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(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=I.empty;for(let b=s.length-1;b>=0;b--)m=I.from(s[b].create(null,m));m=I.from(r.copy(m));let g=n.tr.step(new St(e.pos-1,h,e.pos,h,new F(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&Fr(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&a?null:ie.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),p=f&&Li(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(u&&ks(i,"start",!0)&&ks(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=I.empty;for(let w=m.length-1;w>=0;w--)b=I.from(m[w].copy(b));let v=n.tr.step(new St(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new F(b,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function R0(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 VA=R0(-1),zA=R0(1);function HA(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&km(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function fb(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,u)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let d=t.doc.resolve(u),f=d.index();r=d.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 wd(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}wd(Cm,S0,M0);wd(Cm,N0,A0);wd(Mm,Nm,O0,$0);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function FA(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 jA(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function jA(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 Xc(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Xc(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=km(i,t,o,e);return l?(n&&UA(n,e,l,r,t),!0):!1}function UA(n,e,t,o,r){let i=I.empty;for(let d=t.length-1;d>=0;d--)i=I.from(t[d].type.create(t[d].attrs,i));n.step(new St(e.start-(o?2:0),e.end,e.start,e.end,new F(i,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==r&&(s=d+1);let l=t.length-s,a=e.start+t.length-(o?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,p=!0;d<f;d++,p=!1)!p&&vo(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}function WA(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?qA(e,t,n,i):KA(e,t,i):!0:!1}}function qA(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new St(i-1,s,i,s,new F(I.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Xc(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=Li(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return Fr(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function KA(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,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(a?I.empty:I.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new St(f-(l?1:0),p+(a?1:0),f+1,p-1,new F((l?I.empty:I.from(r.copy(I.empty))).append(a?I.empty:I.from(r.copy(I.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function JA(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.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 u=a.lastChild&&a.lastChild.type==l.type,d=I.from(u?n.create():null),f=new F(I.from(n.create(null,I.from(l.type.create(null,d)))),u?3:1,0),p=i.start,h=i.end;t(e.tr.step(new St(p-(u?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const It=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},ws=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let jp=null;const Wo=function(n,e,t){let o=jp||(jp=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},GA=function(){jp=null},wi=function(n,e,t,o){return t&&(pb(n,e,t,o,-1)||pb(n,e,t,o,1))},XA=/^(img|br|input|textarea|hr)$/i;function pb(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:_n(n))){let s=n.parentNode;if(!s||s.nodeType!=1||ba(n)||XA.test(n.nodeName)||n.contentEditable=="false")return!1;e=It(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?_n(n):0}else return!1}}function _n(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function YA(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=_n(n)}else if(n.parentNode&&!ba(n))e=It(n),n=n.parentNode;else return null}}function QA(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&&!ba(n))e=It(n)+1,n=n.parentNode;else return null}}function ZA(n,e,t){for(let o=e==0,r=e==_n(n);o||r;){if(n==t)return!0;let i=It(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==_n(n)}}function ba(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 xd=function(n){return n.focusNode&&wi(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Zr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function eO(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function tO(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(_n(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(_n(o.startContainer),o.startOffset)}}}const So=typeof navigator<"u"?navigator:null,hb=typeof document<"u"?document:null,jr=So&&So.userAgent||"",Up=/Edge\/(\d+)/.exec(jr),D0=/MSIE \d/.exec(jr),Wp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(jr),dn=!!(D0||Wp||Up),Br=D0?document.documentMode:Wp?+Wp[1]:Up?+Up[1]:0,Pn=!dn&&/gecko\/(\d+)/i.test(jr);Pn&&+(/Firefox\/(\d+)/.exec(jr)||[0,0])[1];const qp=!dn&&/Chrome\/(\d+)/.exec(jr),Vt=!!qp,_0=qp?+qp[1]:0,Kt=!dn&&!!So&&/Apple Computer/.test(So.vendor),xs=Kt&&(/Mobile\/\w+/.test(jr)||!!So&&So.maxTouchPoints>2),Rn=xs||(So?/Mac/.test(So.platform):!1),I0=So?/Win/.test(So.platform):!1,Ko=/Android \d/.test(jr),va=!!hb&&"webkitFontSmoothing"in hb.documentElement.style,nO=va?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function oO(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 Vo(n,e){return typeof n=="number"?n:n[e]}function rO(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 mb(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=ws(s);continue}let l=s,a=l==i.body,u=a?oO(i):rO(l),d=0,f=0;if(e.top<u.top+Vo(o,"top")?f=-(u.top-e.top+Vo(r,"top")):e.bottom>u.bottom-Vo(o,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Vo(r,"top")-u.top:e.bottom-u.bottom+Vo(r,"bottom")),e.left<u.left+Vo(o,"left")?d=-(u.left-e.left+Vo(r,"left")):e.right>u.right-Vo(o,"right")&&(d=e.right-u.right+Vo(r,"right")),d||f)if(a)i.defaultView.scrollBy(d,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);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:ws(s)}}function iO(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:L0(n.dom)}}function L0(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=ws(o));return e}function sO({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;P0(t,o==0?0:o-e)}function P0(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 qi=null;function lO(n){if(n.setActive)return n.setActive();if(qi)return n.focus(qi);let e=L0(n);n.focus(qi==null?{get preventScroll(){return qi={preventScroll:!0},!0}}:void 0),qi||(qi=!1,P0(e,0))}function V0(n,e){let t,o=2e8,r,i=0,s=e.top,l=e.top,a,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let p;if(d.nodeType==1)p=d.getClientRects();else if(d.nodeType==3)p=Wo(d).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=d,o=g,r=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.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=d,u={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=u,o=0),t&&t.nodeType==3?aO(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:V0(t,r)}function aO(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&&Am(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 Am(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function cO(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function uO(n,e,t){let{node:o,offset:r}=V0(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 dO(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 z0(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 u=l[a];if(Am(e,u))return z0(s,e,u)}}if((i=(i+1)%o)==r)break}return n}function fO(n,e){let t=n.dom.ownerDocument,o,r=0,i=tO(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 u=n.dom.getBoundingClientRect();if(!Am(e,u)||(s=z0(n.dom,e,u),!s))return null}if(Kt)for(let u=s;o&&u;u=ws(u))u.draggable&&(o=void 0);if(s=cO(s,e),o){if(Pn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let d=o.childNodes[r],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let u;va&&r&&o.nodeType==1&&(u=o.childNodes[r-1]).nodeType==1&&u.contentEditable=="false"&&u.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=dO(n,o,r,e))}l==null&&(l=uO(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function gb(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(gb(o))return o}return Array.prototype.find.call(t,gb)||n.getBoundingClientRect()}const pO=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function H0(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=va||Pn;if(o.nodeType==3)if(s&&(pO.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let a=gr(Wo(o,r,r),t);if(Pn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let u=gr(Wo(o,r-1,r-1),-1);if(u.top==a.top){let d=gr(Wo(o,r,r+1),-1);if(d.top!=a.top)return Js(d,d.left<u.left)}}return a}else{let a=r,u=r,d=t<0?1:-1;return t<0&&!r?(u++,d=-1):t>=0&&r==o.nodeValue.length?(a--,d=1):t<0?a--:u++,Js(gr(Wo(o,a,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==_n(o))){let a=o.childNodes[r-1];if(a.nodeType==1)return zf(a.getBoundingClientRect(),!1)}if(i==null&&r<_n(o)){let a=o.childNodes[r];if(a.nodeType==1)return zf(a.getBoundingClientRect(),!0)}return zf(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==_n(o))){let a=o.childNodes[r-1],u=a.nodeType==3?Wo(a,_n(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return Js(gr(u,1),!1)}if(i==null&&r<_n(o)){let a=o.childNodes[r];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?Wo(a,0,s?0:1):a.nodeType==1?a:null:null;if(u)return Js(gr(u,-1),!0)}return Js(gr(o.nodeType==3?Wo(o):o,-t),t>=0)}function Js(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 zf(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 F0(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 hO(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return F0(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=H0(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=Wo(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let d=a[u];if(d.bottom>d.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const mO=/[\u0590-\u08ac]/;function gO(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?!mO.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:F0(n,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:d,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&&u==g;try{l.collapse(d,f),a&&(a!=d||u!=f)&&l.extend&&l.extend(a,u)}catch{}return p!=null&&(l.caretBidiLevel=p),y}):o.pos==o.start()||o.pos==o.end()}let yb=null,bb=null,vb=!1;function yO(n,e,t){return yb==e&&bb==t?vb:(yb=e,bb=t,vb=t=="up"||t=="down"?hO(n,e,t):gO(n,e,t))}const Vn=0,kb=1,ti=2,Eo=3;class ka{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=Vn,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>It(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 U0){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 j0&&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?It(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?It(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],u=s+a.size;if(r==-1&&e<=u){let d=s+a.border;if(e>=d&&t<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);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=It(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(u>t||l==this.children.length-1)){t=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=It(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}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),u=o.root.getSelection(),d=o.domSelectionRange(),f=!1;if((Pn||Kt)&&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:It(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(Pn&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&Kt)&&wi(l.node,l.offset,d.anchorNode,d.anchorOffset)&&wi(a.node,a.offset,d.focusNode,d.focusOffset))return;let p=!1;if((u.extend||e==t)&&!(f&&Pn)){u.collapse(l.node,l.offset);try{e!=t&&u.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),u.removeAllRanges(),u.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?ti:kb,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Eo:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ti:Eo}o=s}this.dirty=ti}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?ti:kb;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class j0 extends ka{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==Vn&&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 bO extends ka{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 xi extends ka{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=Ii.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new xi(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Eo||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Eo&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Vn){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=Vn}}slice(e,t,o){let r=xi.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;t<s&&(i=Jp(i,t,s,o)),e>0&&(i=Jp(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 Rr extends ka{constructor(e,t,o,r,i,s,l,a,u){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,u=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},o,r),d=u&&u.dom,f=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=Ii.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=K0(d,o,t),u?a=new vO(e,t,o,r,d,f||null,p,u,i,s+1):t.isText?new Cd(e,t,o,r,d,p,i):new Rr(e,t,o,r,d,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=()=>I.empty)}return e}matchesNode(e,t,o){return this.dirty==Vn&&e.eq(this.node)&&Qc(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 wO(this,s&&s.node,e);SO(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?a.syncToMarks(u.spec.marks,o,e,d):u.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?We.none:this.node.child(d).marks,o,e,d),a.placeWidget(u,e,r)},(u,d,f,p)=>{a.syncToMarks(u.marks,o,e,p);let h;a.findNodeMatch(u,d,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+u.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,d,f,h,e)||a.updateNextNode(u,d,f,e,p,r)||a.addNode(u,d,f,e,r),r+=u.nodeSize}),a.syncToMarks([],o,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ti)&&(s&&this.protectLocalComposition(e,s),W0(this.contentDOM,this.children,e),xs&&EO(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=MO(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 bO(this,i,t,r);e.input.compositionNodes.push(s),this.children=Jp(this.children,o,o+r.length,e,s)}update(e,t,o,r){return this.dirty==Eo||!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=Vn}updateOuterDeco(e){if(Qc(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=q0(this.dom,this.nodeDOM,Kp(this.outerDeco,this.node,t),Kp(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 wb(n,e,t,o,r){K0(o,e,n);let i=new Rr(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Cd extends Rr{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==Eo||this.dirty!=Vn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Vn||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=Vn,!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 Cd(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=Eo)}get domAtom(){return!1}isText(e){return this.node.text==e}}class U0 extends ka{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Vn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class vO extends Rr{constructor(e,t,o,r,i,s,l,a,u,d){super(e,t,o,r,i,s,l,u,d),this.spec=a}update(e,t,o,r){if(this.dirty==Eo)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 W0(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=xb(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(s instanceof xi){let a=o?o.previousSibling:n.lastChild;W0(s.contentDOM,s.children,t),o=a?a.nextSibling:n.firstChild}}for(;o;)o=xb(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const gl=function(n){n&&(this.nodeName=n)};gl.prototype=Object.create(null);const ni=[new gl];function Kp(n,e,t){if(n.length==0)return ni;let o=t?ni[0]:new gl,r=[o];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&r.push(o=new gl(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&r.length==1&&r.push(o=new gl(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 q0(n,e,t,o){if(t==ni&&o==ni)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=ni[0]),r=a}kO(r,l||ni[0],s)}return r}function kO(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 K0(n,e,t){return q0(n,n,ni,Kp(e,t,n.nodeType!=1))}function Qc(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 xb(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class wO{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=xO(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=Vn,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,u=this.top.children.length;r<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){a=d;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let d=xi.create(this.top,e[s],t,o);this.top.children.splice(this.index,0,d),this.top=d,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 u=this.top.children[l];if(u.matchesNode(e,t,o)&&!this.preMatch.matched.has(u)){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==Eo&&s.dom==s.contentDOM&&(s.dirty=ti),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 Rr){let u=this.preMatch.matched.get(a);if(u!=null&&u!=i)return!1;let d=a.dom,f,p=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Eo&&Qc(t,a.outerDeco));if(!p&&a.update(e,t,o,r))return this.destroyBetween(this.index,l),a.dom!=d&&(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=ti,f.updateChildren(r,s+1),f.dirty=Vn),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)||!Qc(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Rr.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=Rr.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 j0(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 xi;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Cd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Kt||Vt)&&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 U0(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 xO(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 u=t.children[o-1];if(u instanceof xi)t=u,o=u.children.length;else{l=u,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 CO(n,e){return n.type.side-e.type.side}function SO(n,e,t,o){let r=e.locals(n),i=0;if(r.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);o(d,r,e.forChild(i,d),u),i+=d.nodeSize}return}let s=0,l=[],a=null;for(let u=0;;){let d,f;for(;s<r.length&&r[s].to==i;){let y=r[s++];y.widget&&(d?(f||(f=[d])).push(y):d=y)}if(d)if(f){f.sort(CO);for(let y=0;y<f.length;y++)t(f[y],u,!!a)}else t(d,u,!!a);let p,h;if(a)h=-1,p=a,a=null;else if(u<n.childCount)h=u,p=n.child(u++);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 EO(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 MO(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 u=n.child(r++);if(i+=u.nodeSize,!u.isText)break;a+=u.text}if(i>=t){if(i>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let u=l<o?a.lastIndexOf(e,o-l-1):-1;if(u>=0&&u+e.length+l>=t)return l+u;if(t==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function Jp(n,e,t,o,r){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],u=l,d=l+=a.size;u>=t||d<=e?i.push(a):(u<e&&i.push(a.slice(0,e-u,o)),r&&(i.push(r),r=void 0),d>t&&i.push(a.slice(t-u,a.size,o)))}return i}function Om(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,u;if(xd(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&&ZA(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;u=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 d=o.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;u=$m(n,d,l,f)}return u}function J0(n){return n.editable?n.hasFocus():X0(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Go(n,e=!1){let t=n.state.selection;if(G0(n,t),!!J0(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Vt){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&wi(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)NO(n);else{let{anchor:o,head:r}=t,i,s;Cb&&!(t instanceof q)&&(t.$from.parent.inlineContent||(i=Sb(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Sb(n,t.to))),n.docView.setSelection(o,r,n,e),Cb&&(i&&Eb(i),s&&Eb(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&TO(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Cb=Kt||Vt&&_0<63;function Sb(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(Kt&&r&&r.contentEditable=="false")return Hf(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return Hf(r);if(i)return Hf(i)}}function Hf(n){return n.contentEditable="true",Kt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function Eb(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function TO(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(()=>{(!J0(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function NO(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,It(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&dn&&Br<=11&&(t.disabled=!0,t.disabled=!1)}function G0(n,e){if(e instanceof Q){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Mb(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Mb(n)}function Mb(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function $m(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||q.between(e,t,o)}function Tb(n){return n.editable&&!n.hasFocus()?!1:X0(n)}function X0(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 AO(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return wi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Gp(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 yr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Nb(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 yr(n,new q(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=Gp(n.state,e);return r&&r instanceof Q?yr(n,r):!1}else if(!(Rn&&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)?yr(n,new Q(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):va?yr(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 yr(n,new q(e>0?o.$to:o.$from));{let r=Gp(n.state,e);return r?yr(n,r):!1}}}function Zc(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function yl(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ki(n,e){return e<0?OO(n):$O(n)}function OO(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(Pn&&t.nodeType==1&&o<Zc(t)&&yl(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(yl(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(Y0(t))break;{let l=t.previousSibling;for(;l&&yl(l,-1);)r=t.parentNode,i=It(l),l=l.previousSibling;if(l)t=l,o=Zc(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?Xp(n,t,o):r&&Xp(n,r,i)}function $O(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Zc(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(yl(l,1))i=t,s=++o;else break}else{if(Y0(t))break;{let l=t.nextSibling;for(;l&&yl(l,1);)i=l.parentNode,s=It(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Zc(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&Xp(n,i,s)}function Y0(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function BO(n,e){for(;n&&e==n.childNodes.length&&!ba(n);)e=It(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 RO(n,e){for(;n&&!e&&!ba(n);)e=It(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 Xp(n,e,t){if(e.nodeType!=3){let i,s;(s=BO(e,t))?(e=s,t=0):(i=RO(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(xd(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&&Go(n)},50)}function Ab(n,e){let t=n.state.doc.resolve(e);if(!(Vt||I0)&&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 Ob(n,e,t){let o=n.state.selection;if(o instanceof q&&!o.empty||t.indexOf("s")>-1||Rn&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Gp(n.state,e);if(s&&s instanceof Q)return yr(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof sn?ie.near(s,e):ie.findFrom(s,e);return l?yr(n,l):!1}return!1}function $b(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 Bb(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function DO(n){if(!Kt||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;Bb(n,o,"true"),setTimeout(()=>Bb(n,o,"false"),20)}return!1}function _O(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function IO(n,e){let t=e.keyCode,o=_O(e);if(t==8||Rn&&t==72&&o=="c")return $b(n,-1)||Ki(n,-1);if(t==46&&!e.shiftKey||Rn&&t==68&&o=="c")return $b(n,1)||Ki(n,1);if(t==13||t==27)return!0;if(t==37||Rn&&t==66&&o=="c"){let r=t==37?Ab(n,n.state.selection.from)=="ltr"?-1:1:-1;return Nb(n,r,o)||Ki(n,r)}else if(t==39||Rn&&t==70&&o=="c"){let r=t==39?Ab(n,n.state.selection.from)=="ltr"?1:-1:1;return Nb(n,r,o)||Ki(n,r)}else{if(t==38||Rn&&t==80&&o=="c")return Ob(n,-1,o)||Ki(n,-1);if(t==40||Rn&&t==78&&o=="c")return DO(n)||Ob(n,1,o)||Ki(n,1);if(o==(Rn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Bm(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")||Ii.fromSchema(n.state.schema),l=ox(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=nx[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.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 Q0(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 F(I.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=Ii.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=zO(t),va&&HO(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[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")||$r.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!LO.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)l=FO(Rb(l,+d[1],+d[2]),d[4]);else if(l=F.maxOpen(PO(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=Rb(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const LO=/^(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 PO(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),u;if(!a)return s=null;if(u=s.length&&i.length&&ex(a,i,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=tx(s[s.length-1],i.length));let d=Z0(l,a);s.push(d),r=r.matchType(d.type),i=a}}),s)return I.from(s)}return n}function Z0(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,I.from(n));return n}function ex(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=ex(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(I.from(Z0(t,n,r+1))))}}function tx(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,tx(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(I.empty,!0);return n.copy(t.append(o))}function Yp(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=Yp(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(I.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Rb(n,e,t){return e<n.openStart&&(n=new F(Yp(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new F(Yp(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const nx={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 Db=null;function ox(){return Db||(Db=document.implementation.createHTMLDocument("title"))}let Ff=null;function VO(n){let e=window.trustedTypes;return e?(Ff||(Ff=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ff.createHTML(n)):n}function zO(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=ox().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&nx[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=VO(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function HO(n){let e=n.querySelectorAll(Vt?"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 FO(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=I.from(a.create(o[l+1],r)),i++,s++}return new F(r,i,s)}const ln={},an={},jO={touchstart:!0,touchmove:!0};class UO{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 WO(n){for(let e in ln){let t=ln[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{KO(n,o)&&!Rm(n,o)&&(n.editable||!(o.type in an))&&t(n,o)},jO[e]?{passive:!0}:void 0)}Kt&&n.dom.addEventListener("input",()=>null),Qp(n)}function Tr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function qO(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 Qp(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>Rm(n,o))})}function Rm(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function KO(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 JO(n,e){!Rm(n,e)&&ln[e.type]&&(n.editable||!(e.type in an))&&ln[e.type](n,e)}an.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!ix(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ko&&Vt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),xs&&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,Zr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||IO(n,t)?t.preventDefault():Tr(n,"key")};an.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};an.keypress=(n,e)=>{let t=e;if(ix(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Rn&&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 Sd(n){return{left:n.clientX,top:n.clientY}}function GO(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function Dm(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 ps(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 XO(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Q.isSelectable(o)?(ps(n,new Q(t)),!0):!1}function YO(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?(ps(n,Q.create(n.state.doc,r)),!0):!1}function QO(n,e,t,o,r){return Dm(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?YO(n,t):XO(n,t))}function ZO(n,e,t,o){return Dm(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function e$(n,e,t,o){return Dm(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||t$(n,t,o)}function t$(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(ps(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)ps(n,q.create(o,l+1,l+1+s.content.size));else if(Q.isSelectable(s))ps(n,Q.create(o,l));else continue;return!0}}function _m(n){return eu(n)}const rx=Rn?"metaKey":"ctrlKey";ln.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=_m(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&GO(t,n.input.lastClick)&&!t[rx]&&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(Sd(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new n$(n,s,t,!!o)):(i=="doubleClick"?ZO:e$)(n,s.pos,s.inside,t)?t.preventDefault():Tr(n,"pointer"))};class n${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[rx],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.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:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Q&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Pn&&!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)),Tr(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(()=>Go(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(Sd(e))),this.updateAllowDefault(e),this.allowDefault||!t?Tr(this.view,"pointer"):QO(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Kt&&this.mightDrag&&!this.mightDrag.node.isAtom||Vt&&!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)?(ps(this.view,ie.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Tr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Tr(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)}}ln.touchstart=n=>{n.input.lastTouch=Date.now(),_m(n),Tr(n,"pointer")};ln.touchmove=n=>{n.input.lastTouch=Date.now(),Tr(n,"pointer")};ln.contextmenu=n=>_m(n);function ix(n,e){return n.composing?!0:Kt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const o$=Ko?5e3:-1;an.compositionstart=an.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)||Vt&&I0&&r$(n)))n.markCursor=n.state.storedMarks||t.marks(),eu(n,!0),n.markCursor=null;else if(eu(n,!e.selection.empty),Pn&&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}sx(n,o$)};function r$(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"}an.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++,sx(n,20))};function sx(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>eu(n),e))}function lx(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=s$());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function i$(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=YA(e.focusNode,e.focusOffset),o=QA(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 s$(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function eu(n,e=!1){if(!(Ko&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),lx(n),e||n.docView&&n.docView.dirty){let t=Om(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 l$(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 zl=dn&&Br<15||xs&&nO<604;ln.copy=an.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=zl?null:t.clipboardData,s=o.content(),{dom:l,text:a}=Bm(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):l$(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function a$(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function c$(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?Hl(n,o.value,null,r,e):Hl(n,o.textContent,o.innerHTML,r,e)},50)}function Hl(n,e,t,o,r){let i=Q0(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||F.empty)))return!0;if(!i)return!1;let s=a$(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 ax(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," "):""}an.paste=(n,e)=>{let t=e;if(n.composing&&!Ko)return;let o=zl?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&Hl(n,ax(o),o.getData("text/html"),r,t)?t.preventDefault():c$(n,t)};class cx{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const u$=Rn?"altKey":"ctrlKey";function ux(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[u$]}ln.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(Sd(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:u,slice:d}=Bm(n,l);(!t.dataTransfer.files.length||!Vt||_0>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(zl?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",zl||t.dataTransfer.setData("text/plain",u),n.dragging=new cx(d,ux(n,t),s)};ln.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};an.dragover=an.dragenter=(n,e)=>e.preventDefault();an.drop=(n,e)=>{try{d$(n,e,n.dragging)}finally{n.dragging=null}};function d$(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Sd(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=Q0(n,ax(e.dataTransfer),zl?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&ux(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||F.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?m0(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 u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&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($m(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}ln.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())&&Go(n)},20))};ln.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)};ln.beforeinput=(n,e)=>{if(Vt&&Ko&&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,Zr(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 an)ln[n]=an[n];function Fl(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 tu{constructor(e,t){this.toDOM=e,this.spec=t||li,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 tu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Fl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Dr{constructor(e,t){this.attrs=e,this.spec=t||li}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 Dr&&Fl(this.attrs,e.attrs)&&Fl(this.spec,e.spec)}static is(e){return e.type instanceof Dr}destroy(){}}class Im{constructor(e,t){this.attrs=e,this.spec=t||li}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 Im&&Fl(this.attrs,e.attrs)&&Fl(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 tu(t,o))}static inline(e,t,o,r){return new ze(e,t,new Dr(o,r))}static node(e,t,o,r){return new ze(e,t,new Im(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Dr}get widget(){return this.type instanceof tu}}const Zi=[],li={};class xe{constructor(e,t){this.local=e.length?e:Zi,this.children=t.length?t:Zi}static create(e,t){return t.length?nu(t,e,0,li):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||li)}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?f$(this.children,s||[],e,t,o,r,i):s?new xe(s.sort(ai),Zi):Ut}add(e,t){return t.length?this==Ut?xe.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let u=a+o,d;if(d=fx(t,l,u)){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,d,u+1):r.splice(i,0,a,a+l.nodeSize,nu(d,l,u+1,li)),i+=3}});let s=dx(i?px(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new xe(s.length?this.local.concat(s).sort(ai):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 d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=Ut?o[i+2]=u:(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 xe(r,o):Ut}forChild(e,t){if(this==Ut)return this;if(t.isLeaf)return xe.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 Dr){let u=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;u<d&&(r||(r=[])).push(a.copy(u,d))}}if(r){let l=new xe(r.sort(ai),Zi);return o?new wr([l,o]):l}return o||Ut}eq(e){if(this==e)return!0;if(!(e instanceof xe)||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 Lm(this.localsInner(e))}localsInner(e){if(this==Ut)return Zi;if(e.inlineContent||!this.local.some(Dr.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Dr||t.push(this.local[o]);return t}forEachSet(e){e(this)}}xe.empty=new xe([],[]);xe.removeOverlap=Lm;const Ut=xe.empty;class wr{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,li));return wr.from(o)}forChild(e,t){if(t.isLeaf)return xe.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=Ut&&(i instanceof wr?o=o.concat(i.members):o.push(i))}return wr.from(o)}eq(e){if(!(e instanceof wr)||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?Lm(o?t:t.sort(ai)):Zi}static from(e){switch(e.length){case 0:return Ut;case 1:return e[0];default:return new wr(e.every(t=>t instanceof xe)?e:e.reduce((t,o)=>t.concat(o instanceof xe?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function f$(n,e,t,o,r,i,s){let l=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let v=l[b+1];if(v<0||p>v+d-f)continue;let w=l[b]+d-f;h>=w?l[b+1]=p<=w?-2:-1:p>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[u+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[u+2].mapInner(t,y,d+1,n[u]+i+1,s);b!=Ut?(l[u]=f,l[u+1]=h,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=p$(l,n,e,t,r,i,s),d=nu(u,o,0,s);e=d.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<d.children.length;f+=3){let h=d.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new xe(e.sort(ai),l)}function dx(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 p$(n,e,t,o,r,i,s){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,r,u);f?t.push(f):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+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 fx(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 px(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function nu(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let u=fx(n,l,a+t);if(u){i=!0;let d=nu(u,l,t+a+1,o);d!=Ut&&r.push(a,a+l.nodeSize,d)}});let s=dx(i?px(n):n,-t).sort(ai);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 xe(s,r):Ut}function ai(n,e){return n.from-e.from||n.to-e.to}function Lm(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),_b(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),_b(e,r,o.copy(i.from,o.to)));break}}}return e}function _b(n,e,t){for(;e<n.length&&ai(t,n[e])>0;)e++;n.splice(e,0,t)}function jf(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=Ut&&e.push(o)}),n.cursorWrapper&&e.push(xe.create(n.state.doc,[n.cursorWrapper.deco])),wr.from(e)}const h$={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},m$=dn&&Br<=11;class g${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 y${constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new g$,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&&Br<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():Kt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),m$&&(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,h$)),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(Tb(this.view)){if(this.suppressingSelectionUpdates)return Go(this.view);if(dn&&Br<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&wi(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=ws(i))t.add(i);for(let i=e.anchorNode;i;i=ws(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)&&Tb(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],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(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of a)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&d.parentNode.removeChild(d)}}else if(Pn&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,p]=d;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of d){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||k$(e,f)!=h)&&p.remove()}}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&xd(o)&&(u=Om(e))&&u.eq(ie.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Go(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),b$(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,w$(e,a)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Go(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 d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];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&&Br<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:p}=e.addedNodes[d];(!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?It(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?It(i):e.target.childNodes.length,u=o.localPosFromDOM(e.target,a,1);return{from:l,to:u}}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 Ib=new WeakMap,Lb=!1;function b$(n){if(!Ib.has(n)&&(Ib.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Pn,Lb)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."),Lb=!0}}function Pb(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return wi(s.node,s.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function v$(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return Pb(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?Pb(n,t):null}function k$(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 w$(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 x$(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),u,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:a.anchorOffset}],xd(a)||u.push({node:a.focusNode,offset:a.focusOffset})),Vt&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let b=o.childNodes[y-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){i=y;break}if(!v||v.size)break}let f=n.state.doc,p=n.someProp("domParser")||$r.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:u,ruleFromNode:C$,context:h});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),m={anchor:y+s,head:b+s}}return{doc:g,sel:m,from:s,to:l}}function C$(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(Kt&&/^(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||Kt&&/^(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 S$=/^(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 E$(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let S=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,M=Om(n,S);if(M&&!n.state.selection.eq(M)){if(Vt&&Ko&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",O=>O(n,Zr(13,"Enter"))))return;let N=n.state.tr.setSelection(M);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),n.dispatch(N)}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,u=x$(n,e,t),d=n.state.doc,f=d.slice(u.from,u.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=N$(f.content,u.doc.content,u.from,p,h);if(m&&n.input.domChangeCount++,(xs&&n.input.lastIOSEnter>Date.now()-225||Ko)&&r.some(S=>S.nodeType==1&&!S$.test(S.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",S=>S(n,Zr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&a instanceof q&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let S=Vb(n,n.state.doc,u.sel);if(S&&!S.eq(n.state.selection)){let M=n.state.tr.setSelection(S);i&&M.setMeta("composition",i),n.dispatch(M)}}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>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),dn&&Br<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),b=d.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((xs&&n.input.lastIOSEnter>Date.now()-225&&(!v||r.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!v&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",S=>S(n,Zr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&T$(d,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",S=>S(n,Zr(8,"Backspace")))){Ko&&Vt&&n.domObserver.suppressSelectionUpdates();return}Vt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Ko&&!v&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(S){return S(n,Zr(13,"Enter"))})},20));let w=m.start,k=m.endA,x=S=>{let M=S||n.state.tr.replace(w,k,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let N=Vb(n,M.doc,u.sel);N&&!(Vt&&n.composing&&N.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(N.head==w||N.head==M.mapping.map(k)-1)||dn&&N.empty&&N.head==w)&&M.setSelection(N)}return i&&M.setMeta("composition",i),M.scrollIntoView()},C;if(v)if(g.pos==y.pos){dn&&Br<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Go(n),20));let S=x(n.state.tr.delete(w,k)),M=d.resolve(m.start).marksAcross(d.resolve(m.endA));M&&S.ensureMarks(M),n.dispatch(S)}else if(m.endA==m.endB&&(C=M$(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let S=x(n.state.tr);C.type=="add"?S.addMark(w,k,C.mark):S.removeMark(w,k,C.mark),n.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,y.parentOffset),M=()=>x(n.state.tr.insertText(S,w,k));n.someProp("handleTextInput",N=>N(n,w,k,S,M))||n.dispatch(M())}else n.dispatch(x());else n.dispatch(x())}function Vb(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:$m(n,e.resolve(t.anchor),e.resolve(t.head))}function M$(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,s,l,a;for(let d=0;d<o.length;d++)r=o[d].removeFromSet(r);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(a(e.child(d)));if(I.from(u).eq(n))return{mark:l,type:s}}function T$(n,e,t,o,r){if(t-e<=r.pos-o.pos||Uf(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(Uf(i,!0,!0));return!s.parent.isTextblock||s.pos>t||Uf(s,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Uf(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 N$(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&&zb(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&&zb(n.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function zb(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 hx{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 UO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Wb),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=jb(this),Fb(this),this.nodeViews=Ub(this),this.docView=wb(this.state.doc,Hb(this),jf(this),this.dom,this),this.domObserver=new y$(this,(o,r,i,s)=>E$(this,o,r,i,s)),this.domObserver.start(),WO(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&&Qp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wb),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&&(lx(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=Ub(this);O$(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Qp(this),this.editable=jb(this),Fb(this);let a=jf(this),u=Hb(this),d=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,a);(f||!e.selection.eq(r.selection))&&(s=!0);let p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&iO(this);if(s){this.domObserver.stop();let h=f&&(dn||Vt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&A$(r.selection,e.selection);if(f){let m=Vt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=i$(this)),(i||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=wb(e.doc,u,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&AO(this))?Go(this,h):(G0(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),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&sO(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&&mb(this,t.getBoundingClientRect(),e)}else mb(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 cx(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&&lO(this.dom),Go(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 fO(this,e)}coordsAtPos(e,t=1){return H0(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 yO(this,t||this.state,e)}pasteHTML(e,t){return Hl(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Hl(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Bm(this,e)}destroy(){this.docView&&(qO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,GA())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return JO(this,e)}domSelectionRange(){let e=this.domSelection();return e?Kt&&this.root.nodeType===11&&eO(this.dom.ownerDocument)==this.dom&&v$(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}hx.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function Hb(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 Fb(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 jb(n){return!n.someProp("editable",e=>e(n.state)===!1)}function A$(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 Ub(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 O$(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 Wb(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")}var Pr={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:"'"},ou={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$$=typeof navigator<"u"&&/Mac/.test(navigator.platform),B$=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Lt=0;Lt<10;Lt++)Pr[48+Lt]=Pr[96+Lt]=String(Lt);for(var Lt=1;Lt<=24;Lt++)Pr[Lt+111]="F"+Lt;for(var Lt=65;Lt<=90;Lt++)Pr[Lt]=String.fromCharCode(Lt+32),ou[Lt]=String.fromCharCode(Lt);for(var Wf in Pr)ou.hasOwnProperty(Wf)||(ou[Wf]=Pr[Wf]);function R$(n){var e=$$&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||B$&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ou:Pr)[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 D$=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),_$=typeof navigator<"u"&&/Win/.test(navigator.platform);function I$(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))D$?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 L$(n){let e=Object.create(null);for(let t in n)e[I$(t)]=n[t];return e}function qf(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 mx(n){return new ce({props:{handleKeyDown:Pm(n)}})}function Pm(n){let e=L$(n);return function(t,o){let r=R$(o),i,s=e[qf(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[qf(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(_$&&o.ctrlKey&&o.altKey)&&(i=Pr[o.keyCode])&&i!=r){let l=e[qf(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var P$=Object.defineProperty,Vm=(n,e)=>{for(var t in e)P$(n,t,{get:e[t],enumerable:!0})};function wa(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 xa=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,(...u)=>{const d=l(...u)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),d}]))}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,u=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(a,e),y=p(...m)(g);return s.push(y),d}])),run:u};return d}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,(...u)=>a(...u)({...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:wa({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,(...u)=>a(...u)(s)]))}};return s}},zm={};Vm(zm,{blur:()=>V$,clearContent:()=>z$,clearNodes:()=>H$,command:()=>F$,createParagraphNear:()=>j$,cut:()=>U$,deleteCurrentNode:()=>W$,deleteNode:()=>q$,deleteRange:()=>K$,deleteSelection:()=>J$,enter:()=>G$,exitCode:()=>X$,extendMarkRange:()=>Y$,first:()=>Q$,focus:()=>Z$,forEach:()=>eB,insertContent:()=>tB,insertContentAt:()=>oB,joinBackward:()=>sB,joinDown:()=>iB,joinForward:()=>lB,joinItemBackward:()=>aB,joinItemForward:()=>cB,joinTextblockBackward:()=>uB,joinTextblockForward:()=>dB,joinUp:()=>rB,keyboardShortcut:()=>pB,lift:()=>hB,liftEmptyBlock:()=>mB,liftListItem:()=>gB,newlineInCode:()=>yB,resetAttributes:()=>bB,scrollIntoView:()=>vB,selectAll:()=>kB,selectNodeBackward:()=>wB,selectNodeForward:()=>xB,selectParentNode:()=>CB,selectTextblockEnd:()=>SB,selectTextblockStart:()=>EB,setContent:()=>MB,setMark:()=>$B,setMeta:()=>BB,setNode:()=>RB,setNodeSelection:()=>DB,setTextDirection:()=>_B,setTextSelection:()=>IB,sinkListItem:()=>LB,splitBlock:()=>PB,splitListItem:()=>VB,toggleList:()=>zB,toggleMark:()=>HB,toggleNode:()=>FB,toggleWrap:()=>jB,undoInputRule:()=>UB,unsetAllMarks:()=>WB,unsetMark:()=>qB,unsetTextDirection:()=>KB,updateAttributes:()=>JB,wrapIn:()=>GB,wrapInList:()=>XB});var V$=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),z$=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),H$=()=>({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:u,mapping:d}=e,f=u.resolve(d.map(a)),p=u.resolve(d.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Li(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},F$=n=>e=>n(e),j$=()=>({state:n,dispatch:e})=>Nm(n,e),U$=(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},W$=()=>({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 ut(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 q$=n=>({tr:e,state:t,dispatch:o})=>{const r=ut(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),u=i.after(s);e.delete(a,u).scrollIntoView()}return!0}return!1},K$=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},J$=()=>({state:n,dispatch:e})=>Cm(n,e),G$=()=>({commands:n})=>n.keyboardShortcut("Enter"),X$=()=>({state:n,dispatch:e})=>_A(n,e);function Ed(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function jl(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:Ed(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function gx(n,e,t={}){return n.find(o=>o.type===e&&jl(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function qb(n,e,t={}){return!!gx(n,e,t)}function Pi(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),!gx([...r.node.marks],e,t)))return;let s=r.index,l=n.start()+r.offset,a=s+1,u=l+r.node.nodeSize;for(;s>0&&qb([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&qb([...n.parent.child(a).marks],e,t);)u+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function Oo(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 Y$=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=Oo(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:u,to:d}=l;if(r){const f=Pi(a,i,e);if(f&&f.from<=u&&f.to>=d){const p=q.create(s,f.from,f.to);t.setSelection(p)}}return!0},Q$=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 Ca(n){return n instanceof q}function go(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Hm(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,go(0,r,i),go(n.content.size,r,i)):q.create(n,go(e,r,i),go(e,r,i))}function Ul(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Ci(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function yx(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Z$=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Ci()||Ul())&&o.dom.focus(),yx()&&!Ci()&&!Ul()&&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&&!Ca(t.state.selection))return s(),!0;const l=Hm(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},eB=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),tB=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),bx=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&&bx(o)}return n};function ds(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 bx(t)}function Cs(n,e,t){if(n instanceof Ln||n instanceof I)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 I.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),Cs("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new r0({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:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?$r.fromSchema(a).parseSlice(ds(n),t.parseOptions):$r.fromSchema(a).parse(ds(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=$r.fromSchema(e);return t.slice?i.parseSlice(ds(n),t.parseOptions).content:i.parse(ds(n),t.parseOptions)}return Cs("",e,t)}function vx(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof xt||r instanceof St))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,u,d)=>{s===0&&(s=d)}),n.setSelection(ie.near(n.doc.resolve(s),t))}var nB=n=>!("type"in n),oB=(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)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Cs(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Cs(e,i.schema,{parseOptions:u,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((nB(l)?l:[l]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),d===f&&h){const{parent:y}=o.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof I){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,d,f)}else{g=l;const y=o.doc.resolve(d),b=y.node(),v=y.parentOffset===0,w=b.isText||b.isTextblock,k=b.content.size>0;v&&w&&k&&(d=Math.max(0,d-1)),o.replaceWith(d,f,g)}t.updateSelection&&vx(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:g})}return!0},rB=()=>({state:n,dispatch:e})=>BA(n,e),iB=()=>({state:n,dispatch:e})=>RA(n,e),sB=()=>({state:n,dispatch:e})=>S0(n,e),lB=()=>({state:n,dispatch:e})=>N0(n,e),aB=()=>({state:n,dispatch:e,tr:t})=>{try{const o=bd(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},cB=()=>({state:n,dispatch:e,tr:t})=>{try{const o=bd(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},uB=()=>({state:n,dispatch:e})=>OA(n,e),dB=()=>({state:n,dispatch:e})=>$A(n,e);function Fm(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function fB(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))Ci()||Fm()?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 pB=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=fB(n).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),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",u=>u(t,l))});return a==null||a.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function Zo(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?ut(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,u=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>jl(f.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((f,p)=>f+p.to-p.from,0)>=a}var hB=(n,e={})=>({state:t,dispatch:o})=>{const r=ut(n,t.schema);return Zo(t,r,e)?DA(t,o):!1},mB=()=>({state:n,dispatch:e})=>O0(n,e),gB=n=>({state:e,dispatch:t})=>{const o=ut(n,e.schema);return WA(o)(e,t)},yB=()=>({state:n,dispatch:e})=>Mm(n,e);function Sa(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Zp(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 bB=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=Sa(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=ut(n,o.schema)),l==="mark"&&(s=Oo(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{o.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,Zp(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+d.nodeSize,s.create(Zp(p.attrs,e))))})})}),a},vB=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),kB=()=>({tr:n,dispatch:e})=>{if(e){const t=new sn(n.doc);n.setSelection(t)}return!0},wB=()=>({state:n,dispatch:e})=>M0(n,e),xB=()=>({state:n,dispatch:e})=>A0(n,e),CB=()=>({state:n,dispatch:e})=>LA(n,e),SB=()=>({state:n,dispatch:e})=>zA(n,e),EB=()=>({state:n,dispatch:e})=>VA(n,e);function ru(n,e,t={},o={}){return Cs(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var MB=(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 u=ru(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,u).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 jm(n,e){const t=Oo(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 Md(n,e){const t=new wm(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function Td(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 Xo(n,e){const t=[];return n.descendants((o,r)=>{e(o)&&t.push({node:o,pos:r})}),t}function Um(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function Nd(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 Ur(n){return e=>Nd(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 Ad(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=ne(e,"addExtensions",t);return o?[e,...Ad(o())]:e}).flat(10)}function Ea(n,e){const t=Ii.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Wm(n){return typeof n=="function"}function Be(n,e=void 0,...t){return Wm(n)?e?n.bind(e)(...t):n(...t):n}function kx(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Si(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 qm(n){const e=[],{nodeExtensions:t,markExtensions:o}=Si(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=t.filter(u=>u.name!=="text").map(u=>u.name),l=o.map(u=>u.name),a=[...s,...l];return n.forEach(u=>{const d={name:u.name,options:u.options,storage:u.storage,extensions:r},f=ne(u,"addGlobalAttributes",d);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(u=>{const d={name:u.name,options:u.options,storage:u.storage},f=ne(u,"addAttributes",d);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:u.name,name:h,attribute:g})})}),e}function de(...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(" "):[],u=l.filter(d=>!a.includes(d));o[r]=[...a,...u].join(" ")}else if(r==="style"){const l=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],a=o[r]?o[r].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;a.forEach(d=>{const[f,p]=d.split(":").map(h=>h.trim());u.set(f,p)}),l.forEach(d=>{const[f,p]=d.split(":").map(h=>h.trim());u.set(f,p)}),o[r]=Array.from(u.entries()).map(([d,f])=>`${d}: ${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)=>de(t,o),{})}function wx(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function eh(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):wx(t.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function Kb(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&kx(t)?!1:t!=null))}function Jb(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 Km(n,e){var t;const o=qm(n),{nodeExtensions:r,markExtensions:i}=Si(n),s=(t=r.find(u=>ne(u,"topNode")))==null?void 0:t.name,l=Object.fromEntries(r.map(u=>{const d=o.filter(b=>b.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},p=n.reduce((b,v)=>{const w=ne(v,"extendNodeSchema",f);return{...b,...w?w(u):{}}},{}),h=Kb({...p,content:Be(ne(u,"content",f)),marks:Be(ne(u,"marks",f)),group:Be(ne(u,"group",f)),inline:Be(ne(u,"inline",f)),atom:Be(ne(u,"atom",f)),selectable:Be(ne(u,"selectable",f)),draggable:Be(ne(u,"draggable",f)),code:Be(ne(u,"code",f)),whitespace:Be(ne(u,"whitespace",f)),linebreakReplacement:Be(ne(u,"linebreakReplacement",f)),defining:Be(ne(u,"defining",f)),isolating:Be(ne(u,"isolating",f)),attrs:Object.fromEntries(d.map(Jb))}),m=Be(ne(u,"parseHTML",f));m&&(h.parseDOM=m.map(b=>eh(b,d)));const g=ne(u,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Ss(b,d)}));const y=ne(u,"renderText",f);return y&&(h.toText=y),[u.name,h]})),a=Object.fromEntries(i.map(u=>{const d=o.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},p=n.reduce((y,b)=>{const v=ne(b,"extendMarkSchema",f);return{...y,...v?v(u):{}}},{}),h=Kb({...p,inclusive:Be(ne(u,"inclusive",f)),excludes:Be(ne(u,"excludes",f)),group:Be(ne(u,"group",f)),spanning:Be(ne(u,"spanning",f)),code:Be(ne(u,"code",f)),attrs:Object.fromEntries(d.map(Jb))}),m=Be(ne(u,"parseHTML",f));m&&(h.parseDOM=m.map(y=>eh(y,d)));const g=ne(u,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Ss(y,d)})),[u.name,h]}));return new r0({topNode:s,nodes:l,marks:a})}function xx(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function hs(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 Od(n){const e=hs(Ad(n)),t=xx(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 $d(n,e){const t=Od(n);return Km(t,e)}function Cx(n,e){const t=$d(e),o=Ln.fromJSON(t,n);return Ea(o.content,t)}function Jm(n,e){const t=$d(e),o=ds(n);return $r.fromSchema(t).parse(o).toJSON()}function Gm(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
14
-
15
- `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,u,d,f)=>{var p;a.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,u)-u,r-u))}),l}function Bd(n,e){const t={from:0,to:n.content.size};return Gm(n,t,e)}function Ma(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function TB(n,e,t){const{blockSeparator:o=`
16
-
17
- `,textSerializers:r={}}=t||{},i=$d(e),s=Ln.fromJSON(i,n);return Bd(s,{blockSeparator:o,textSerializers:{...Ma(i),...r}})}function Sx(n,e){const t=ut(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 Xm(n,e){const t=Sa(typeof e=="string"?e:e.name,n.schema);return t==="node"?Sx(n,e):t==="mark"?jm(n,e):{}}function Ex(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 NB(n){const e=Ex(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 Rd(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 u=e.slice(i).map(l,-1),d=e.slice(i).map(a),f=e.invert().map(u,-1),p=e.invert().map(d);o.push({oldRange:{from:f,to:p},newRange:{from:u,to:d}})})}),NB(o)}function Mx(n,e=0){const o=n.type===n.type.schema.topNodeType?0:1,r=e,i=r+n.nodeSize,s=n.marks.map(u=>{const d={type:u.type.name};return Object.keys(u.attrs).length&&(d.attrs={...u.attrs}),d}),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((u,d)=>{var f;(f=a.content)==null||f.push(Mx(u,e+d+o))})),n.text&&(a.text=n.text),a}function Dd(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),s=Pi(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 Tx=(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 es(n,e){return e.nodes[n]||e.marks[n]||null}function bl(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 Nx=(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,u;const d=((u=(a=r.type.spec).toText)==null?void 0:u.call(a,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?d:d.slice(0,Math.max(0,o-i))}),t};function iu(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?Oo(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>jl(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),v=Math.min(m,y+g.nodeSize),w=v-b;s+=w,l.push(...g.marks.map(k=>({mark:k,from:b,to:v})))})}),s===0)return!1;const a=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>jl(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),u=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+u:a)>=s}function Ym(n,e,t={}){if(!e)return Zo(n,null,t)||iu(n,null,t);const o=Sa(e,n.schema);return o==="node"?Zo(n,e,t):o==="mark"?iu(n,e,t):!1}var Ax=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Ur(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)},Ox=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function th(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function nh(n,e){const{nodeExtensions:t}=Si(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Be(ne(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function Ta(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&&(Ta(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function Qm(n){return n instanceof Q}var _d=class $x{constructor(e){this.position=e}static fromJSON(e){return new $x(e.position)}toJSON(){return{position:this.position}}};function Zm(n,e){const t=e.mapping.mapResult(n.position);return{position:new _d(t.pos),mapResult:t}}function Bx(n){return new _d(n)}function eg(n,e,t){const r=n.state.doc.content.size,i=go(e,0,r),s=go(t,0,r),l=n.coordsAtPos(i),a=n.coordsAtPos(s,-1),u=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),p=Math.max(l.right,a.right),h=p-f,m=d-u,b={top:u,bottom:d,left:f,right:p,width:h,height:m,x:f,y:u};return{...b,toJSON:()=>b}}function Rx({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=>Rx({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 AB(n,e,t){return Rx({json:n,validNodes:new Set(Object.keys(e.nodes)),validMarks:new Set(Object.keys(e.marks)),options:t})}function OB(n,e,t){var o;const{selection:r}=e;let i=null;if(Ca(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(u=>u.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,p)=>{if(u)return!1;if(d.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=h&&m}return!u}),u})}var $B=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=Oo(n,o.schema);if(r)if(s){const u=jm(o,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;o.doc.nodesBetween(d,f,(p,h)=>{const m=Math.max(h,d),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 OB(o,t,a)},BB=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),RB=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=ut(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})=>fb(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>fb(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},DB=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=go(n,0,o.content.size),i=Q.create(o,r);e.setSelection(i)}return!0},_B=(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,u)=>{a.isText||t.setNodeMarkup(u,void 0,{...a.attrs,dir:n})}),!0},IB=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=go(r,s,l),u=go(i,s,l),d=q.create(o,a,u);e.setSelection(d)}return!0},LB=n=>({state:e,dispatch:t})=>{const o=ut(n,e.schema);return JA(o)(e,t)};function Gb(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 PB=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,u=r.extensionManager.attributes,d=bl(u,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!vo(s,l.pos)?!1:(o&&(n&&Gb(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:Td(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=vo(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&vo(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]: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&&Gb(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},VB=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=ut(n,o.schema),{$from:a,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))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=I.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-v;M>=a.depth-3;M-=1)b=I.from(a.node(M).copy(b));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...bl(p,a.node().type.name,a.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;b=b.append(I.from(l.createAndFill(null,x)||void 0));const C=a.before(a.depth-(v-1));t.replace(C,a.after(-w),new F(b,4-v,0));let S=-1;t.doc.nodesBetween(C,t.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&t.setSelection(q.near(t.doc.resolve(S))),t.scrollIntoView()}return!0}const h=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...bl(p,f.type.name,f.attrs),...e},g={...bl(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!vo(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,k=v||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!k||!r)return!0;const x=k.filter(C=>w.includes(C.type.name));t.ensureMarks(x)}return!0},Kf=(n,e)=>{const t=Ur(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)&&Fr(n.doc,t.pos)&&n.join(t.pos),!0},Jf=(n,e)=>{const t=Ur(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)&&Fr(n.doc,o)&&n.join(o),!0},zB=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=ut(n,s.schema),m=ut(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:v}=g,w=b.blockRange(v),k=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const x=Ur(C=>nh(C.type.name,f))(g);if(w.depth>=1&&x&&w.depth-x.depth<=1){if(x.node.type===h)return u.liftListItem(m);if(nh(x.node.type.name,f)&&h.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,h),!0)).command(()=>Kf(i,h)).command(()=>Jf(i,h)).run()}return!t||!k||!l?a().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>Kf(i,h)).command(()=>Jf(i,h)).run():a().command(()=>{const C=d().wrapInList(h,o),S=k.filter(M=>p.includes(M.type.name));return i.ensureMarks(S),C?!0:u.clearNodes()}).wrapInList(h,o).command(()=>Kf(i,h)).command(()=>Jf(i,h)).run()},HB=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=Oo(n,o.schema);return iu(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},FB=(n,e,t={})=>({state:o,commands:r})=>{const i=ut(n,o.schema),s=ut(e,o.schema),l=Zo(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})},jB=(n,e={})=>({state:t,commands:o})=>{const r=ut(n,t.schema);return Zo(t,r,e)?o.lift(r):o.wrapIn(r,e)},UB=()=>({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},WB=()=>({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},qB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Oo(n,o.schema),{$from:u,empty:d,ranges:f}=l;if(!r)return!0;if(d&&s){let{from:p,to:h}=l;const m=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=Pi(u,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},KB=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 u={...l.attrs};delete u.dir,e.setNodeMarkup(a,void 0,u)}),!0},JB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=Sa(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=ut(n,o.schema)),l==="mark"&&(s=Oo(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(d,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(d,f,(y,b)=>{b<d&&i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=d&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,r)){const w=Math.max(b,d),k=Math.min(b+y.nodeSize,f);t.addMark(w,k,s.create({...v.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},GB=(n,e={})=>({state:t,dispatch:o})=>{const r=ut(n,t.schema);return HA(r,e)(t,o)},XB=(n,e={})=>({state:t,dispatch:o})=>{const r=ut(n,t.schema);return FA(r,e)(t,o)},YB=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={}}},Wr=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},QB=(n,e)=>{if(Ed(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 Ya(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 u=a.state.doc.resolve(o);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let d=!1;const f=Nx(u)+i;return s.forEach(p=>{if(d)return;const h=QB(f,p.find);if(!h)return;const m=a.state.tr,g=wa({state:a.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:b,chain:v,can:w}=new xa({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:v,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),a.dispatch(m),d=!0)}),d}function Dx(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:d}=a;typeof d=="string"?d=d:d=Ea(I.from(d),s.schema);const{from:f}=a,p=f+d.length;Ya({editor:e,from:f,to:p,text:d,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return Ya({editor:e,from:i,to:s,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Ya({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?Ya({editor:e,from:s.pos,to:s.pos,text:`
18
- `,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function ZB(n){return Object.prototype.toString.call(n).slice(8,-1)}function tl(n){return ZB(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function tg(n,e){const t={...n};return tl(n)&&tl(e)&&Object.keys(e).forEach(o=>{tl(e[o])&&tl(n[o])?t[o]=tg(n[o],e[o]):t[o]=e[o]}),t}var Id=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{...Be(ne(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Be(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>tg(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}},Wn=class _x extends Id{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new _x(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(u=>(u==null?void 0:u.type.name)===t.name))return!1;const a=s.find(u=>(u==null?void 0:u.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 Ix(n){return typeof n=="number"}var Ld=class{constructor(n){this.find=n.find,this.handler=n.handler}},eR=(n,e,t)=>{if(Ed(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 tR(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:u,can:d}=new xa({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,b,v,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const k=(w=(v=(b=h.content)==null?void 0:b.size)!=null?v:h.nodeSize)!=null?w:0,x=Math.max(o,m),C=Math.min(r,m+k);if(x>=C)return;const S=h.isText?h.text||"":h.textBetween(x-m,C-m,void 0,"");eR(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const O=x+N.index+1,A=O+N[0].length,$={from:t.tr.mapping.map(O),to:t.tr.mapping.map(A)},D=i.handler({state:t,range:$,match:N,commands:a,chain:u,can:d,pasteEvent:s,dropEvent:l});f.push(D)})}),f.every(h=>h!==null)}var Qa=null,nR=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function Lx(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:d,from:f,to:p,rule:h,pasteEvt:m})=>{const g=d.tr,y=wa({state:d,transaction:g});if(!(!tR({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(d=>new ce({view(f){const p=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&(Qa=e)},h=()=>{Qa&&(Qa=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=Qa;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"),v=!!b;if(!g&&!y&&!v)return;if(v){let{text:x}=b;typeof x=="string"?x=x:x=Ea(I.from(x),h.schema);const{from:C}=b,S=C+x.length,M=nR(x);return a({rule:d,state:h,from:C,to:{b:S},pasteEvt:M})}const w=p.doc.content.findDiffStart(h.doc.content),k=p.doc.content.findDiffEnd(h.doc.content);if(!(!Ix(w)||!k||w===k.b))return a({rule:d,state:h,from:w,to:k,pasteEvt:s})}}))}var Pd=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=Od(n),this.schema=Km(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:es(e.name,this.schema)},o=ne(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return hs([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:es(o.name,this.schema)},i=[],s=ne(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&ne(o,"exitable",r)&&(l.ArrowRight=()=>Wn.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=mx(l);i.push(a);const u=ne(o,"addInputRules",r);if(th(o,n.options.enableInputRules)&&u){const p=u();if(p&&p.length){const h=Dx({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const d=ne(o,"addPasteRules",r);if(th(o,n.options.enablePasteRules)&&d){const p=d();if(p&&p.length){const h=Lx({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 qm(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Si(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:ut(t.name,this.schema)},i=ne(t,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(a,u,d,f,p)=>{const h=Ss(a,o);return s({node:a,view:u,getPos:d,decorations:f,innerDecorations:p,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return hs([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:es(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 hs([...this.extensions]).reduce((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:es(r.name,this.schema)},s=ne(r,"transformPastedHTML",i);return s?(l,a)=>{const u=o(l,a);return s.call(i,u)}:o},n||(o=>o))}get markViews(){const{editor:n}=this,{markExtensions:e}=Si(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:Oo(t.name,this.schema)},i=ne(t,"addMarkView",r);if(!i)return[];const s=(l,a,u)=>{const d=Ss(l,o);return i()({mark:l,view:a,inline:u,editor:n,extension:t,HTMLAttributes:d,updateAttributes:f=>{rg(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:es(e.name,this.schema)};e.type==="mark"&&((t=Be(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),u=ne(e,"onFocus",o),d=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),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Pd.resolve=Od;Pd.sort=hs;Pd.flatten=Ad;var Px={};Vm(Px,{ClipboardTextSerializer:()=>zx,Commands:()=>Hx,Delete:()=>Fx,Drop:()=>jx,Editable:()=>Ux,FocusEvents:()=>qx,Keymap:()=>Kx,Paste:()=>Jx,Tabindex:()=>Gx,TextDirection:()=>Xx,focusEventsPluginKey:()=>Wx});var ye=class Vx extends Id{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Vx(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},zx=ye.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=Ma(t);return Gm(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),Hx=ye.create({name:"commands",addCommands(){return{...zm}}}),Fx=ye.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,u;if((u=(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?u:n.getMeta("y-sync$"))return;const d=Md(n.before,[n,...e]);Rd(d).forEach(h=>{d.mapping.mapResult(h.oldRange.from).deletedAfter&&d.mapping.mapResult(h.oldRange.to).deletedBefore&&d.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:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const p=d.mapping;d.steps.forEach((h,m)=>{var g,y;if(h instanceof Xn){const b=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),w=p.invert().map(b,-1),k=p.invert().map(v),x=(g=d.doc.nodeAt(b-1))==null?void 0:g.marks.some(S=>S.eq(h.mark)),C=(y=d.doc.nodeAt(v))==null?void 0:y.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:k},newRange:{from:b,to:v},partial:!!(C||x),editor:this.editor,transaction:n,combinedTransform:d})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),jx=ye.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})}}})]}}),Ux=ye.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Wx=new le("focusEvents"),qx=ye.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ce({key:Wx,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}}}})]}}),Kx=ye.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:d,$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(u).from===p;return!d||!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 Ci()||Fm()?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,u=ie.atEnd(e.doc).to;if(i||!(s===a&&l===u)||!Ta(t.doc))return;const p=t.tr,h=wa({state:t,transaction:p}),{commands:m}=new xa({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Jx=ye.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})}}})]}}),Gx=ye.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Xx=ye.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=Si(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}:{}}}})]}}),Yx=class nl{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 nl(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 nl(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 nl(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 u=new nl(a,this.editor,r,r||s?t:null);r&&(u.actualDepth=this.depth+1),e.push(u)}),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)}},oR=`.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 Qx(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 Nt=class extends YB{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:Zm,createMappablePosition:Bx},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=Hm(t,this.options.autofocus);this.editorState=us.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=Qx(oR,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=Wm(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?[Ux,zx.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),Hx,qx,Kx,Gx,jx,Jx,Fx,Xx.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 Pd(r,this)}createCommandManager(){this.commandManager=new xa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=ru(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=ru(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 hx(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 u=this.view.dom;u.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(d=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(d)});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(d=>d.getMeta("focus")||d.getMeta("blur")),a=l==null?void 0:l.getMeta("focus"),u=l==null?void 0:l.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(d=>d.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return Xm(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return Ym(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ea(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
89
-
90
- `,textSerializers:o={}}=e||{};return Bd(this.state.doc,{blockSeparator:t,textSerializers:{...Ma(this.schema),...o}})}get isEmpty(){return Ta(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 Yx(t,this)}get $doc(){return this.$pos(0)}};function Vr(n){return new Wr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=Be(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/),u=t.from+l.indexOf(s),d=u+s.length;if(Dd(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>u).length)return null;d<t.to&&i.delete(d,t.to),u>t.from&&i.delete(t.from+a,u);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 Ps(n){return new Wr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=Be(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 u=o[0].lastIndexOf(o[1]);let d=s+u;d>l?d=l:l=d+o[1].length;const f=o[0][o[0].length-1];i.insertText(f,s+o[0].length-1),i.replaceWith(d,l,a)}else if(o[0]){const u=n.type.isInline?s:s-1;i.insert(u,n.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:n.undoable})}function su(n){return new Wr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=e.doc.resolve(t.from),i=Be(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 Wr({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 er(n){return new Wr({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=Be(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),u=a&&km(a,n.type,i);if(!u)return null;if(s.wrap(a,u),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 d=s.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Fr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,d))&&s.join(t.from-1)},undoable:n.undoable})}function rR(n){return n.children}var Zx=(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]},iR=n=>"touches"in n,Vd=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,u=l.clientY-this.startY;this.handleResize(a,u)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const u=a.clientX-this.startX,d=a.clientY-this.startY;this.handleResize(u,d)},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,iR(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 u=Math.max(this.minSize.width,n),d=Math.max(this.minSize.height,e);return(o=this.maxSize)!=null&&o.width&&(u=Math.min(this.maxSize.width,u)),(r=this.maxSize)!=null&&r.height&&(d=Math.min(this.maxSize.height,d)),{width:u,height:d}}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}}},sR=Vd;function e1(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 ng(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function lR(){return typeof navigator<"u"?/Firefox/.test(navigator.userAgent):!1}function aR(n){return typeof n=="string"}var t1={};Vm(t1,{createAtomBlockMarkdownSpec:()=>n1,createBlockMarkdownSpec:()=>Na,createInlineMarkdownSpec:()=>og,parseAttributes:()=>zd,parseIndentedBlocks:()=>lu,renderNestedMarkdownContent:()=>Fd,serializeAttributes:()=>Hd});function zd(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const u=r.map(d=>d.trim().slice(1));e.class=u.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(([,u,d])=>{var f;const p=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[u]=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(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Hd(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 n1(n){const{nodeName:e,name:t,parseAttributes:o=zd,serializeAttributes:r=Hd,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{const p={...i,...d.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!s.find(v=>!(v in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const f=u(d.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function Na(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=zd,serializeAttributes:i=Hd,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,u=t||e,d=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(`^:::${u}`,"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(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,v=""]=y,w=r(v);let k=1;const x=b.length;let C="";const S=/^:::([\w-]*)(\s.*)?/gm,M=f.slice(x);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const O=N.index,A=N[1];if(!((m=N[2])!=null&&m.endsWith(":::"))){if(A)k+=1;else if(k-=1,k===0){const $=M.slice(0,O);C=$.trim();const D=f.slice(0,x+O+N[0].length);let R=[];if(C)if(l==="block")for(R=h.blockTokens($),R.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=h.inlineTokens(L.text))});R.length>0;){const L=R[R.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))R.pop();else break}else R=h.inlineTokens(C);return{type:e,raw:D,attributes:w,content:C,tokens:R}}}}}},renderMarkdown:(f,p)=>{const h=d(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
91
-
92
- `);return`:::${u}${g}
93
-
94
- ${y}
95
-
96
- :::`}}}function cR(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 uR(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function og(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=cR,serializeAttributes:i=uR,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=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=u.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="",v="";if(l){const[,k]=y;v=k}else{const[,k,x]=y;v=k,b=x||""}const w=r(v.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},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=d(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${h}[/${u}]`}}}function lu(n,e,t){var o,r,i,s;const l=n.split(`
97
- `),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const p=l[d],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){d+=1,u=`${u}${p}
98
- `;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;u=`${u}${p}
99
- `;const b=[y];for(d+=1;d<l.length;){const x=l[d];if(x.trim()===""){const S=l.slice(d+1).findIndex(O=>O.trim()!=="");if(S===-1)break;if((((r=(o=l[d+1+S].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(x),u=`${u}${x}
100
- `,d+=1;continue}else break}if((((s=(i=x.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(x),u=`${u}${x}
101
- `,d+=1;else break}let v;const w=b.slice(1);if(w.length>0){const x=w.map(C=>C.slice(g+f)).join(`
102
- `);x.trim()&&(e.customNestedParser?v=e.customNestedParser(x):v=t.blockTokens(x))}const k=e.createToken(m,v);a.push(k)}if(a.length!==0)return{items:a,raw:u}}function Fd(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(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
103
- `).map(p=>p?e.indent(p):"").join(`
104
- `);a.push(f)}}),a.join(`
105
- `)}function rg(n,e,t={}){const{state:o}=e,{doc:r,tr:i}=o,s=n;r.descendants((l,a)=>{const u=i.mapping.map(a),d=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(u,d,n.type),i.addMark(u,d,h)}}),i.docChanged&&e.view.dispatch(i)}var dR=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){rg(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"&&(Ci()||Ul())&&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 o1 extends Id{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new o1(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},r1=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,u=n.target,d=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(u)||!d)return;let f=0,p=0;if(this.dom!==d){const v=this.dom.getBoundingClientRect(),w=d.getBoundingClientRect(),k=(r=n.offsetX)!=null?r:(o=n.nativeEvent)==null?void 0:o.offsetX,x=(s=n.offsetY)!=null?s:(i=n.nativeEvent)==null?void 0:i.offsetY;f=w.x-v.x+k,p=w.y-v.y+x}const h=this.dom.cloneNode(!0);try{const v=this.dom.getBoundingClientRect();h.style.width=`${Math.round(v.width)}px`,h.style.height=`${Math.round(v.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,u=!!this.node.type.spec.draggable,d=Q.isSelectable(this.node),f=n.type==="copy",p=n.type==="paste",h=n.type==="cut",m=n.type==="mousedown";if(!u&&d&&r&&n.target===this.dom&&n.preventDefault(),u&&r&&!a&&n.target===this.dom)return n.preventDefault(),!1;if(u&&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&&d)}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"&&(Ci()||Ul())&&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 tr(n){return new Ld({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:r})=>{const i=Be(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 u=t.to;if(l){const d=a.search(/\S/),f=t.from+a.indexOf(l),p=f+l.length;if(Dd(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+d,f),u=t.from+d+l.length,s.addMark(t.from+d,u,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function fR(n){return new Ld({find:n.find,handler({match:e,chain:t,range:o,pasteEvent:r}){const i=Be(n.getAttributes,void 0,e,r),s=Be(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 pR(n){return new Ld({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 hR=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 Xb(n){return c.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var i1=class extends Nt{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=Xb(this.view.state),this.reactiveExtensionStorage=Xb(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}},mR=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}})}}),rr=c.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return c.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),ig=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))}}),gR=(n={})=>{const e=c.shallowRef();return c.onMounted(()=>{e.value=new i1(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},jd=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 dt={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}},yR=class extends r1{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 jd(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 mn(n,e){return t=>{if(!t.editor.contentComponent)return{};const o=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new yR(o,t,e)}}var au=(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]},bR=/^\s*>\s$/,vR=Oe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return au("blockquote",{...de(this.options.HTMLAttributes,n),children:au("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[er({find:bR,type:this.type})]}}),kR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,wR=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,xR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,CR=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,SR=Wn.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 au("strong",{...de(this.options.HTMLAttributes,n),children:au("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[Vr({find:kR,type:this.type}),Vr({find:xR,type:this.type})]},addPasteRules(){return[tr({find:wR,type:this.type}),tr({find:CR,type:this.type})]}}),ER=/(^|[^`])`([^`]+)`(?!`)$/,MR=/(^|[^`])`([^`]+)`(?!`)/g,TR=Wn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",de(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[Vr({find:ER,type:this.type})]},addPasteRules(){return[tr({find:MR,type:this.type})]}}),Gf=4,NR=/^```([a-z]+)?[\s\n]$/,AR=/^~~~([a-z]+)?[\s\n]$/,s1=Oe.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Gf,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",de(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:Gf,{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:u,to:d}=r,h=o.doc.textBetween(u,d,`
113
- `,`
114
- `).split(`
115
- `).map(m=>l+m).join(`
116
- `);return a.replaceWith(u,d,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:Gf,{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:u}=i,d=i.start(),f=i.end(),h=o.doc.textBetween(d,f,`
117
- `,`
118
- `).split(`
119
- `);let m=0,g=0;const y=u-d;for(let C=0;C<h.length;C+=1){if(g+h[C].length>=y){m=C;break}g+=h[C].length+1}const v=((a=h[m].match(/^ */))==null?void 0:a[0])||"",w=Math.min(v.length,t);if(w===0)return!0;let k=d;for(let C=0;C<m;C+=1)k+=h[C].length+1;return l.delete(k,k+w),u-k<=w&&l.setSelection(q.create(l.doc,k)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:u}=r,p=o.doc.textBetween(a,u,`
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,u,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:u})=>(u.setSelection(ie.near(o.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[su({find:NR,type:this.type,getAttributes:n=>({language:n[1]})}),su({find:AR,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}}})]}}),l1=Oe.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
127
-
128
- `):""}),oh=l1,OR=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",de(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:u,dispatch:d})=>{if(d&&a&&s){const f=a.filter(p=>l.includes(p.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),$R=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]}`,de(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=>su({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),a1=Oe.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",de(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!e1(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:o}=t,r=n();return Qm(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,u=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 d=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=d==null?void 0:d.create();f&&(s.insert(u,f),s.setSelection(q.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Ps({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),BR=a1,RR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,DR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_R=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,IR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,LR=Wn.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",de(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[Vr({find:RR,type:this.type}),Vr({find:_R,type:this.type})]},addPasteRules(){return[tr({find:DR,type:this.type}),tr({find:IR,type:this.type})]}});const PR="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",VR="ελ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",rh="numeric",ih="ascii",sh="alpha",vl="asciinumeric",ol="alphanumeric",lh="domain",c1="emoji",zR="scheme",HR="slashscheme",Xf="whitespace";function FR(n,e){return n in e||(e[n]=[]),e[n]}function oi(n,e,t){e[rh]&&(e[vl]=!0,e[ol]=!0),e[ih]&&(e[vl]=!0,e[sh]=!0),e[vl]&&(e[ol]=!0),e[sh]&&(e[ol]=!0),e[ol]&&(e[lh]=!0),e[c1]&&(e[lh]=!0);for(const o in e){const r=FR(o,t);r.indexOf(n)<0&&r.push(n)}}function jR(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function un(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}un.groups={};un.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||un.groups;let r;return e&&e.j?r=e:(r=new un(e),t&&o&&oi(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||un.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 un,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new un,i){if(o)if(s.t&&typeof s.t=="string"){const a=Object.assign(jR(s.t,o),t);oi(i,a,o)}else t&&oi(i,t,o);s.t=i}return r.j[n]=s,s}};const Ce=(n,e,t,o,r)=>n.ta(e,t,o,r),st=(n,e,t,o,r)=>n.tr(e,t,o,r),Yb=(n,e,t,o,r)=>n.ts(e,t,o,r),V=(n,e,t,o,r)=>n.tt(e,t,o,r),Fo="WORD",ah="UWORD",u1="ASCIINUMERICAL",d1="ALPHANUMERICAL",Wl="LOCALHOST",ch="TLD",uh="UTLD",Tc="SCHEME",ts="SLASH_SCHEME",sg="NUM",dh="WS",lg="NL",kl="OPENBRACE",wl="CLOSEBRACE",cu="OPENBRACKET",uu="CLOSEBRACKET",du="OPENPAREN",fu="CLOSEPAREN",pu="OPENANGLEBRACKET",hu="CLOSEANGLEBRACKET",mu="FULLWIDTHLEFTPAREN",gu="FULLWIDTHRIGHTPAREN",yu="LEFTCORNERBRACKET",bu="RIGHTCORNERBRACKET",vu="LEFTWHITECORNERBRACKET",ku="RIGHTWHITECORNERBRACKET",wu="FULLWIDTHLESSTHAN",xu="FULLWIDTHGREATERTHAN",Cu="AMPERSAND",Su="APOSTROPHE",Eu="ASTERISK",br="AT",Mu="BACKSLASH",Tu="BACKTICK",Nu="CARET",xr="COLON",ag="COMMA",Au="DOLLAR",fo="DOT",Ou="EQUALS",cg="EXCLAMATION",Bn="HYPHEN",xl="PERCENT",$u="PIPE",Bu="PLUS",Ru="POUND",Cl="QUERY",ug="QUOTE",f1="FULLWIDTHMIDDLEDOT",dg="SEMI",po="SLASH",Sl="TILDE",Du="UNDERSCORE",p1="EMOJI",_u="SYM";var h1=Object.freeze({__proto__:null,ALPHANUMERICAL:d1,AMPERSAND:Cu,APOSTROPHE:Su,ASCIINUMERICAL:u1,ASTERISK:Eu,AT:br,BACKSLASH:Mu,BACKTICK:Tu,CARET:Nu,CLOSEANGLEBRACKET:hu,CLOSEBRACE:wl,CLOSEBRACKET:uu,CLOSEPAREN:fu,COLON:xr,COMMA:ag,DOLLAR:Au,DOT:fo,EMOJI:p1,EQUALS:Ou,EXCLAMATION:cg,FULLWIDTHGREATERTHAN:xu,FULLWIDTHLEFTPAREN:mu,FULLWIDTHLESSTHAN:wu,FULLWIDTHMIDDLEDOT:f1,FULLWIDTHRIGHTPAREN:gu,HYPHEN:Bn,LEFTCORNERBRACKET:yu,LEFTWHITECORNERBRACKET:vu,LOCALHOST:Wl,NL:lg,NUM:sg,OPENANGLEBRACKET:pu,OPENBRACE:kl,OPENBRACKET:cu,OPENPAREN:du,PERCENT:xl,PIPE:$u,PLUS:Bu,POUND:Ru,QUERY:Cl,QUOTE:ug,RIGHTCORNERBRACKET:bu,RIGHTWHITECORNERBRACKET:ku,SCHEME:Tc,SEMI:dg,SLASH:po,SLASH_SCHEME:ts,SYM:_u,TILDE:Sl,TLD:ch,UNDERSCORE:Du,UTLD:uh,UWORD:ah,WORD:Fo,WS:dh});const zo=/[a-z]/,Gs=new RegExp("\\p{L}","u"),Yf=new RegExp("\\p{Emoji}","u"),Ho=/\d/,Qf=/\s/,Qb="\r",Zf=`
131
- `,UR="️",WR="‍",ep="";let Za=null,ec=null;function qR(n=[]){const e={};un.groups=e;const t=new un;Za==null&&(Za=Zb(PR)),ec==null&&(ec=Zb(VR)),V(t,"'",Su),V(t,"{",kl),V(t,"}",wl),V(t,"[",cu),V(t,"]",uu),V(t,"(",du),V(t,")",fu),V(t,"<",pu),V(t,">",hu),V(t,"(",mu),V(t,")",gu),V(t,"「",yu),V(t,"」",bu),V(t,"『",vu),V(t,"』",ku),V(t,"<",wu),V(t,">",xu),V(t,"&",Cu),V(t,"*",Eu),V(t,"@",br),V(t,"`",Tu),V(t,"^",Nu),V(t,":",xr),V(t,",",ag),V(t,"$",Au),V(t,".",fo),V(t,"=",Ou),V(t,"!",cg),V(t,"-",Bn),V(t,"%",xl),V(t,"|",$u),V(t,"+",Bu),V(t,"#",Ru),V(t,"?",Cl),V(t,'"',ug),V(t,"/",po),V(t,";",dg),V(t,"~",Sl),V(t,"_",Du),V(t,"\\",Mu),V(t,"・",f1);const o=st(t,Ho,sg,{[rh]:!0});st(o,Ho,o);const r=st(o,zo,u1,{[vl]:!0}),i=st(o,Gs,d1,{[ol]:!0}),s=st(t,zo,Fo,{[ih]:!0});st(s,Ho,r),st(s,zo,s),st(r,Ho,r),st(r,zo,r);const l=st(t,Gs,ah,{[sh]:!0});st(l,zo),st(l,Ho,i),st(l,Gs,l),st(i,Ho,i),st(i,zo),st(i,Gs,i);const a=V(t,Zf,lg,{[Xf]:!0}),u=V(t,Qb,dh,{[Xf]:!0}),d=st(t,Qf,dh,{[Xf]:!0});V(t,ep,d),V(u,Zf,a),V(u,ep,d),st(u,Qf,d),V(d,Qb),V(d,Zf),st(d,Qf,d),V(d,ep,d);const f=st(t,Yf,p1,{[c1]:!0});V(f,"#"),st(f,Yf,f),V(f,UR,f);const p=V(f,WR);V(p,"#"),st(p,Yf,f);const h=[[zo,s],[Ho,r]],m=[[zo,null],[Gs,l],[Ho,i]];for(let g=0;g<Za.length;g++)mr(t,Za[g],ch,Fo,h);for(let g=0;g<ec.length;g++)mr(t,ec[g],uh,ah,m);oi(ch,{tld:!0,ascii:!0},e),oi(uh,{utld:!0,alpha:!0},e),mr(t,"file",Tc,Fo,h),mr(t,"mailto",Tc,Fo,h),mr(t,"http",ts,Fo,h),mr(t,"https",ts,Fo,h),mr(t,"ftp",ts,Fo,h),mr(t,"ftps",ts,Fo,h),oi(Tc,{scheme:!0,ascii:!0},e),oi(ts,{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],v=n[g][1]?{[zR]:!0}:{[HR]:!0};y.indexOf("-")>=0?v[lh]=!0:zo.test(y)?Ho.test(y)?v[vl]=!0:v[ih]=!0:v[rh]=!0,Yb(t,y,y,v)}return Yb(t,"localhost",Wl,{ascii:!0}),t.jd=new un(_u),{start:t,tokens:Object.assign({groups:e},h1)}}function m1(n,e){const t=KR(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,u=0,d=null,f=-1,p=-1;for(;s<o&&(a=l.go(t[s]));)l=a,l.accepts()?(f=0,p=0,d=l):f>=0&&(f+=t[s].length,p++),u+=t[s].length,i+=t[s].length,s++;i-=f,s-=p,u-=f,r.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return r}function KR(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 mr(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 un(o),i.jr=r.slice(),n.j[a]=i),n=i}return i=new un(t),i.jr=r.slice(),n.j[e[s-1]]=i,i}function Zb(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 ql={defaultProtocol:"http",events:null,format:ev,formatHref:ev,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function fg(n,e=null){let t=Object.assign({},ql);n&&(t=Object.assign(t,n instanceof fg?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}fg.prototype={o:ql,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]:ql[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 ev(n){return n}function g1(n,e){this.t="token",this.v=n,this.tk=e}g1.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=ql.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),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=o,l&&(s.class=l),a&&(s.target=a),u&&(s.rel=u),d&&Object.assign(s,d),{tagName:r,attributes:s,content:i,eventListeners:f}}};function Ud(n,e){class t extends g1{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 tv=Ud("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),nv=Ud("text"),JR=Ud("nl"),tc=Ud("url",{isLink:!0,toHref(n=ql.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Wl&&n[1].t===xr}}),$n=n=>new un(n);function GR({groups:n}){const e=n.domain.concat([Cu,Eu,br,Mu,Tu,Nu,Au,Ou,Bn,sg,xl,$u,Bu,Ru,po,_u,Sl,Du]),t=[Su,xr,ag,fo,cg,xl,Cl,ug,dg,pu,hu,kl,wl,uu,cu,du,fu,mu,gu,yu,bu,vu,ku,wu,xu],o=[Cu,Su,Eu,Mu,Tu,Nu,Au,Ou,Bn,kl,wl,xl,$u,Bu,Ru,Cl,po,_u,Sl,Du],r=$n(),i=V(r,Sl);Ce(i,o,i),Ce(i,n.domain,i);const s=$n(),l=$n(),a=$n();Ce(r,n.domain,s),Ce(r,n.scheme,l),Ce(r,n.slashscheme,a),Ce(s,o,i),Ce(s,n.domain,s);const u=V(s,br);V(i,br,u),V(l,br,u),V(a,br,u);const d=V(i,fo);Ce(d,o,i),Ce(d,n.domain,i);const f=$n();Ce(u,n.domain,f),Ce(f,n.domain,f);const p=V(f,fo);Ce(p,n.domain,f);const h=$n(tv);Ce(p,n.tld,h),Ce(p,n.utld,h),V(u,Wl,h);const m=V(f,Bn);V(m,Bn,m),Ce(m,n.domain,f),Ce(h,n.domain,f),V(h,fo,p),V(h,Bn,m);const g=V(h,xr);Ce(g,n.numeric,tv);const y=V(s,Bn),b=V(s,fo);V(y,Bn,y),Ce(y,n.domain,s),Ce(b,o,i),Ce(b,n.domain,s);const v=$n(tc);Ce(b,n.tld,v),Ce(b,n.utld,v),Ce(v,n.domain,s),Ce(v,o,i),V(v,fo,b),V(v,Bn,y),V(v,br,u);const w=V(v,xr),k=$n(tc);Ce(w,n.numeric,k);const x=$n(tc),C=$n();Ce(x,e,x),Ce(x,t,C),Ce(C,e,x),Ce(C,t,C),V(v,po,x),V(k,po,x);const S=V(l,xr),M=V(a,xr),N=V(M,po),O=V(N,po);Ce(l,n.domain,s),V(l,fo,b),V(l,Bn,y),Ce(a,n.domain,s),V(a,fo,b),V(a,Bn,y),Ce(S,n.domain,x),V(S,po,x),V(S,Cl,x),Ce(O,n.domain,x),Ce(O,e,x),V(O,po,x);const A=[[kl,wl],[cu,uu],[du,fu],[pu,hu],[mu,gu],[yu,bu],[vu,ku],[wu,xu]];for(let $=0;$<A.length;$++){const[D,R]=A[$],L=V(x,D);V(C,D,L),V(L,R,x);const B=$n(tc);Ce(L,e,B);const W=$n();Ce(L,t),Ce(B,e,B),Ce(B,t,W),Ce(W,e,B),Ce(W,t,W),V(B,R,x),V(W,R,x)}return V(r,Wl,v),V(r,lg,JR),{start:r,tokens:h1}}function XR(n,e,t){let o=t.length,r=0,i=[],s=[];for(;r<o;){let l=n,a=null,u=null,d=0,f=null,p=-1;for(;r<o&&!(a=l.go(t[r].t));)s.push(t[r++]);for(;r<o&&(u=a||l.go(t[r].t));)a=null,l=u,l.accepts()?(p=0,f=l):p>=0&&p++,r++,d++;if(p<0)r-=d,r<o&&(s.push(t[r]),r++);else{s.length>0&&(i.push(tp(nv,e,s)),s=[]),r-=p,d-=p;const h=f.t,m=t.slice(r-d,r);i.push(tp(h,e,m))}}return s.length>0&&i.push(tp(nv,e,s)),i}function tp(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 YR=typeof console<"u"&&console&&console.warn||(()=>{}),QR="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 ZR(){return un.groups={},Ze.scanner=null,Ze.parser=null,Ze.tokenQueue=[],Ze.pluginQueue=[],Ze.customSchemes=[],Ze.initialized=!1,Ze}function ov(n,e=!1){if(Ze.initialized&&YR(`linkifyjs: already initialized - will not register custom scheme "${n}" ${QR}`),!/^[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 eD(){Ze.scanner=qR(Ze.customSchemes);for(let n=0;n<Ze.tokenQueue.length;n++)Ze.tokenQueue[n][1]({scanner:Ze.scanner});Ze.parser=GR(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 pg(n){return Ze.initialized||eD(),XR(Ze.parser.start,n,m1(Ze.scanner.start,n))}pg.scan=m1;function y1(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 fg(t),r=pg(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 hg="[\0-   ᠎ -\u2029  ]",tD=new RegExp(hg),nD=new RegExp(`${hg}$`),oD=new RegExp(hg,"g");function rD(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function iD(n){return new ce({key:new le("autolink"),appendTransaction:(e,t,o)=>{const r=e.some(u=>u.docChanged)&&!t.doc.eq(o.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=Md(t.doc,[...e]);if(Rd(l).forEach(({newRange:u})=>{const d=Um(o.doc,u,h=>h.isTextblock);let f,p;if(d.length>1)f=d[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const h=o.doc.textBetween(u.from,u.to," "," ");if(!nD.test(h))return;f=d[0],p=o.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&p){const h=p.split(tD).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=pg(m).map(b=>b.toObject(n.defaultProtocol));if(!rD(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=>{Dd(b.from,b.to,o.doc).some(v=>v.mark.type===n.type)||s.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function sD(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 u=n.editor.view.dom;s=a.closest("a"),s&&!u.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=Xm(e.state,n.type.name),u=(r=s.href)!=null?r:a.href,d=(i=s.target)!=null?i:a.target;u&&(window.open(u,d),l=!0)}return l}}})}function lD(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(d=>{a+=d.textContent});const u=y1(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!u||r!==void 0&&!r(u.value)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function Yr(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(oD,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var b1=Wn.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"){ov(n);return}ov(n.scheme,n.optionalSlashes)})},onDestroy(){ZR()},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)=>!!Yr(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=>!!Yr(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=>!!Yr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",de(this.options.HTMLAttributes,n),0]:["a",de(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=>!!Yr(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=>!!Yr(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[tr({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=y1(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Yr(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(iD({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Yr(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(sD({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(lD({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),mg=b1,aD=Object.defineProperty,cD=(n,e)=>{for(var t in e)aD(n,t,{get:e[t],enumerable:!0})},uD="listItem",rv="textStyle",iv=/^\s*([-+*])\s$/,v1=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",de(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(uD,this.editor.getAttributes(rv)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=er({find:iv,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=er({find:iv,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(rv),editor:this.editor})),[n]}}),k1=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",de(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)=>Fd(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)}}}),dD={};cD(dD,{findListItemPos:()=>Aa,getNextListDepth:()=>gg,handleBackspace:()=>fh,handleDelete:()=>ph,hasListBefore:()=>w1,hasListItemAfter:()=>fD,hasListItemBefore:()=>x1,listItemHasSubList:()=>C1,nextListIsDeeper:()=>S1,nextListIsHigher:()=>E1});var Aa=(n,e)=>{const{$from:t}=e.selection,o=ut(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}},gg=(n,e)=>{const t=Aa(n,e);if(!t)return!1;const[,o]=Tx(e,n,t.$pos.pos+4);return o},w1=(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))},x1=(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)},C1=(n,e,t)=>{if(!t)return!1;const o=ut(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},fh=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Zo(n.state,e)&&w1(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),u=[];a.node().descendants((p,h)=>{p.type.name===e&&u.push({node:p,pos:h})});const d=u.at(-1);if(!d)return!1;const f=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Zo(n.state,e)||!Ox(n.state))return!1;const o=Aa(e,n.state);if(!o)return!1;const i=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),s=C1(e,n.state,i);return x1(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},S1=(n,e)=>{const t=gg(n,e),o=Aa(n,e);return!o||!t?!1:t>o.depth},E1=(n,e)=>{const t=gg(n,e),o=Aa(n,e);return!o||!t?!1:t<o.depth},ph=(n,e)=>{if(!Zo(n.state,e)||!Ax(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:S1(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():E1(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},fD=(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)},M1=ye.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&&ph(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&&ph(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&&fh(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&&fh(n,t,o)&&(e=!0)}),e}}}}),sv=/^(\s*)(\d+)\.\s+(.*)$/,pD=/^\s/;function hD(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(sv);if(!i)break;const[,s,l,a]=i,u=s.length;let d=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(sv))break;if(h.trim()==="")p.push(h),d+=`
136
- `,f+=1;else if(h.match(pD))p.push(h),d+=`
137
- ${h.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:p.join(`
138
- `)}),o=f,t=f}return[e,o]}function T1(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())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
140
- `).trim();if(d){const h=t.blockTokens(d);u.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=T1(p,h,t);u.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:u}),i=f}else i+=1}return r}function mD(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 gD="listItem",lv="textStyle",av=/^(\d+)\.\s$/,N1=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",de(this.options.HTMLAttributes,t),0]:["ol",de(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?mD(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]=hD(r);if(i.length===0)return;const l=T1(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(gD,this.editor.getAttributes(lv)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=er({find:av,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=er({find:av,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(lv)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),yD=/^\s*(\[([( |x])?\])\s$/,A1=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",de(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 Fd(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"),u=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"}`};u(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 d=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,u(f);const p=o.extensionManager.attributes,h=Ss(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.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)}),d=m,!0}}}},addInputRules(){return[er({find:yD,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),yg=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",de(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=lu(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=lu(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()}}});ye.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(v1.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(k1.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(M1.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(N1.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(A1.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(yg.configure(this.options.taskList)),n}});var cv="&nbsp;",bD=" ",vD=Oe.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",de(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===cv||o[0].text===bD)?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?cv:e.renderChildren(t)},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),kD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,xD=Wn.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",de(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[Vr({find:kD,type:this.type})]},addPasteRules(){return[tr({find:wD,type:this.type})]}}),CD=Oe.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),O1=Wn.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",de(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()}}}),$1=O1;function SD(n={}){return new ce({view(e){return new ED(e,n)}})}class ED{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 u,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=a.getBoundingClientRect(),p=f.width/a.offsetWidth,h=f.height/a.offsetHeight;u=f.left-a.scrollLeft*p,d=f.top-a.scrollTop*h}this.element.style.left=(o.left-u)/s+"px",this.element.style.top=(o.top-d)/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=m0(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 et extends ie{constructor(e){super(e,e)}map(e,t){let o=e.resolve(t.map(this.head));return et.valid(o)?new et(o):ie.near(o)}content(){return F.empty}eq(e){return e instanceof et&&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 et(e.resolve(t.pos))}getBookmark(){return new bg(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!MD(e)||!TD(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&&et.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(et.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(et.valid(l))return l}return null}}}et.prototype.visible=!1;et.findFrom=et.findGapCursorFrom;ie.jsonID("gapcursor",et);class bg{constructor(e){this.pos=e}map(e){return new bg(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return et.valid(t)?new et(t):ie.near(t)}}function B1(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function MD(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||B1(r.type))return!0;if(r.inlineContent)return!1}}return!0}function TD(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||B1(r.type))return!0;if(r.inlineContent)return!1}}return!0}function ND(){return new ce({props:{decorations:BD,createSelectionBetween(n,e,t){return e.pos==t.pos&&et.valid(t)?new et(t):null},handleClick:OD,handleKeyDown:AD,handleDOMEvents:{beforeinput:$D}}})}const AD=Pm({ArrowLeft:nc("horiz",-1),ArrowRight:nc("horiz",1),ArrowUp:nc("vert",-1),ArrowDown:nc("vert",1)});function nc(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 u=et.findGapCursorFrom(l,e,a);return u?(r&&r(o.tr.setSelection(new et(u))),!0):!1}}function OD(n,e,t){if(!n||!n.editable)return!1;let o=n.state.doc.resolve(e);if(!et.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 et(o))),!0)}function $D(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof et))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=I.empty;for(let s=o.length-1;s>=0;s--)r=I.from(o[s].createAndFill(null,r));let i=n.state.tr.replace(t.pos,t.pos,new F(r,0,0));return i.setSelection(q.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function BD(n){if(!(n.selection instanceof et))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",xe.create(n.doc,[ze.widget(n.selection.head,e,{key:"gapcursor"})])}var Iu=200,Et=function(){};Et.prototype.append=function(e){return e.length?(e=Et.from(e),!this.length&&e||e.length<Iu&&this.leafAppend(e)||this.length<Iu&&e.leafPrepend(this)||this.appendInner(e)):this};Et.prototype.prepend=function(e){return e.length?Et.from(e).append(this):this};Et.prototype.appendInner=function(e){return new RD(this,e)};Et.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Et.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};Et.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Et.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)};Et.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};Et.from=function(e){return e instanceof Et?e:e&&e.length?new R1(e):Et.empty};var R1=(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<=Iu)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Iu)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})(Et);Et.empty=new R1([]);var RD=(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})(Et);const DD=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,u=[],d=[];return this.items.forEach((f,p)=>{if(!f.step){r||(r=this.remapping(o,p+1),i=r.maps.length),i--,d.push(f);return}if(r){d.push(new ho(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],u.push(new ho(m,void 0,void 0,u.length+d.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(d.reverse().concat(u)),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 d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),p=new ho(e.mapping.maps[d],f,t),h;(h=a&&a.merge(p))&&(p=h,d?i.pop():l=l.slice(0,l.length-1)),i.push(p),t&&(s++,t=void 0),r||(a=p)}let u=s-o.depth;return u>ID&&(l=_D(l,u),s-=u),new Gn(l.append(i),s)}remapping(e,t){let o=new Pl;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 ho(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 ho(m,g,y))}else o.push(new ho(m))},r);let u=[];for(let p=t;p<s;p++)u.push(new ho(i.maps[p]));let d=this.items.slice(0,r).append(u).append(o),f=new Gn(d,l);return f.emptyItemCount()>DD&&(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)),u=a&&a.getMap();if(o--,u&&t.appendMap(u,o),a){let d=s.selection&&s.selection.map(t.slice(o));d&&i++;let f=new ho(u.invert(),a,d),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(Et.from(r.reverse()),i)}}Gn.empty=new Gn(Et.empty,0);function _D(n,e){let t;return n.forEach((o,r)=>{if(o.selection&&e--==0)return t=r,!1}),n.slice(t)}class ho{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 ho(t.getMap().invert(),t,this.selection)}}}class vr{constructor(e,t,o,r,i){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const ID=20;function LD(n,e,t,o){let r=t.getMeta(ci),i;if(r)return r.historyState;t.getMeta(zD)&&(n=new vr(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(ci))return s.getMeta(ci).redo?new vr(n.done.addTransform(t,void 0,o,Nc(e)),n.undone,uv(t.mapping.maps),n.prevTime,n.prevComposition):new vr(n.done,n.undone.addTransform(t,void 0,o,Nc(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||!PD(t,n.prevRanges)),u=s?np(n.prevRanges,t.mapping):uv(t.mapping.maps);return new vr(n.done.addTransform(t,a?e.selection.getBookmark():void 0,o,Nc(e)),Gn.empty,u,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new vr(n.done.rebased(t,i),n.undone.rebased(t,i),np(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new vr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),np(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function PD(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 uv(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 np(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 VD(n,e,t){let o=Nc(e),r=ci.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 vr(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(ci,{redo:t,historyState:a})}let op=!1,dv=null;function Nc(n){let e=n.plugins;if(dv!=e){op=!1,dv=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){op=!0;break}}return op}const ci=new le("history"),zD=new le("closeHistory");function HD(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ce({key:ci,state:{init(){return new vr(Gn.empty,Gn.empty,null,0,-1)},apply(e,t,o){return LD(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,r=o=="historyUndo"?_1:o=="historyRedo"?I1:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function D1(n,e){return(t,o)=>{let r=ci.getState(t);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(o){let i=VD(r,t,n);i&&o(e?i.scrollIntoView():i)}return!0}}const _1=D1(!1,!0),I1=D1(!0,!0);ye.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 u=o.tr.deleteRange(l,a);return n=!0,u}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,u=l-a,d=l;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>o)}})]}});var FD=ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[SD(this.options)]}}),L1=ye.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 xe.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,u)=>{if(a.isText)return;if(!(r>=u&&r<=u+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,u)=>{if(a.isText||!(r>=u&&r<=u+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(u,u+a.nodeSize,{class:this.options.className}))}),xe.create(n,i)}}})]}}),jD=ye.create({name:"gapCursor",addProseMirrorPlugins(){return[ND()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Be(ne(n,"allowGapCursor",t)))!=null?e:null}}}),fv="placeholder";function UD(n){return n.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}ye.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:fv,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const n=this.options.dataAttribute?`data-${UD(this.options.dataAttribute)}`:`data-${fv}`;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 u=r>=a&&r<=a+l.nodeSize,d=!l.isLeaf&&Ta(l);if((u||!this.options.showOnlyCurrent)&&d){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:u}):this.options.placeholder});i.push(p)}return this.options.includeChildren}),xe.create(e,i)}}})]}});ye.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||Qm(t.selection)||n.view.dragging?null:xe.create(t.doc,[ze.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function pv({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var WD=ye.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:u}=s,d=e.getState(s),f=l.content.size,p=u.nodes[t];if(d)return a.insert(f,p.create())},state:{init:(r,i)=>{const s=i.tr.doc.lastChild;return!pv({node:s,types:o})},apply:(r,i)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return i;const s=r.doc.lastChild;return!pv({node:s,types:o})}}})]}}),qD=ye.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>_1(n,e),redo:()=>({state:n,dispatch:e})=>I1(n,e)}},addProseMirrorPlugins(){return[HD(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()}}}),KD=ye.create({name:"starterKit",addExtensions(){var n,e,t,o;const r=[];return this.options.bold!==!1&&r.push(SR.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(vR.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(v1.configure(this.options.bulletList)),this.options.code!==!1&&r.push(TR.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(s1.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(l1.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(FD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(jD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(OR.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push($R.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(qD.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(a1.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(LR.configure(this.options.italic)),this.options.listItem!==!1&&r.push(k1.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(M1.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&r.push(b1.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(N1.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(vD.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(xD.configure(this.options.strike)),this.options.text!==!1&&r.push(CD.configure(this.options.text)),this.options.underline!==!1&&r.push(O1.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&r.push(WD.configure((o=this.options)==null?void 0:o.trailingNode)),r}}),JD=KD;const G=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 fn="top",Hn="bottom",Fn="right",pn="left",vg="auto",Oa=[fn,Hn,Fn,pn],Es="start",Kl="end",GD="clippingParents",P1="viewport",Xs="popper",XD="reference",hv=Oa.reduce(function(n,e){return n.concat([e+"-"+Es,e+"-"+Kl])},[]),V1=[].concat(Oa,[vg]).reduce(function(n,e){return n.concat([e,e+"-"+Es,e+"-"+Kl])},[]),YD="beforeRead",QD="read",ZD="afterRead",e_="beforeMain",t_="main",n_="afterMain",o_="beforeWrite",r_="write",i_="afterWrite",s_=[YD,QD,ZD,e_,t_,n_,o_,r_,i_];function Mo(n){return n?(n.nodeName||"").toLowerCase():null}function Mn(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function Ei(n){var e=Mn(n).Element;return n instanceof e||n instanceof Element}function zn(n){var e=Mn(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function kg(n){if(typeof ShadowRoot>"u")return!1;var e=Mn(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function l_(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];!zn(i)||!Mo(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 a_(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,u){return a[u]="",a},{});!zn(r)||!Mo(r)||(Object.assign(r.style,l),Object.keys(i).forEach(function(a){r.removeAttribute(a)}))})}}const z1={name:"applyStyles",enabled:!0,phase:"write",fn:l_,effect:a_,requires:["computeStyles"]};function ko(n){return n.split("-")[0]}var ui=Math.max,Lu=Math.min,Ms=Math.round;function hh(){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 H1(){return!/^((?!chrome|android).)*safari/i.test(hh())}function Ts(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var o=n.getBoundingClientRect(),r=1,i=1;e&&zn(n)&&(r=n.offsetWidth>0&&Ms(o.width)/n.offsetWidth||1,i=n.offsetHeight>0&&Ms(o.height)/n.offsetHeight||1);var s=Ei(n)?Mn(n):window,l=s.visualViewport,a=!H1()&&t,u=(o.left+(a&&l?l.offsetLeft:0))/r,d=(o.top+(a&&l?l.offsetTop:0))/i,f=o.width/r,p=o.height/i;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function wg(n){var e=Ts(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 F1(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&kg(t)){var o=e;do{if(o&&n.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function nr(n){return Mn(n).getComputedStyle(n)}function c_(n){return["table","td","th"].indexOf(Mo(n))>=0}function qr(n){return((Ei(n)?n.ownerDocument:n.document)||window.document).documentElement}function Wd(n){return Mo(n)==="html"?n:n.assignedSlot||n.parentNode||(kg(n)?n.host:null)||qr(n)}function mv(n){return!zn(n)||nr(n).position==="fixed"?null:n.offsetParent}function u_(n){var e=/firefox/i.test(hh()),t=/Trident/i.test(hh());if(t&&zn(n)){var o=nr(n);if(o.position==="fixed")return null}var r=Wd(n);for(kg(r)&&(r=r.host);zn(r)&&["html","body"].indexOf(Mo(r))<0;){var i=nr(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 $a(n){for(var e=Mn(n),t=mv(n);t&&c_(t)&&nr(t).position==="static";)t=mv(t);return t&&(Mo(t)==="html"||Mo(t)==="body"&&nr(t).position==="static")?e:t||u_(n)||e}function xg(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function El(n,e,t){return ui(n,Lu(e,t))}function d_(n,e,t){var o=El(n,e,t);return o>t?t:o}function j1(){return{top:0,right:0,bottom:0,left:0}}function U1(n){return Object.assign({},j1(),n)}function W1(n,e){return e.reduce(function(t,o){return t[o]=n,t},{})}var f_=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,U1(typeof e!="number"?e:W1(e,Oa))};function p_(n){var e,t=n.state,o=n.name,r=n.options,i=t.elements.arrow,s=t.modifiersData.popperOffsets,l=ko(t.placement),a=xg(l),u=[pn,Fn].indexOf(l)>=0,d=u?"height":"width";if(!(!i||!s)){var f=f_(r.padding,t),p=wg(i),h=a==="y"?fn:pn,m=a==="y"?Hn:Fn,g=t.rects.reference[d]+t.rects.reference[a]-s[a]-t.rects.popper[d],y=s[a]-t.rects.reference[a],b=$a(i),v=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,w=g/2-y/2,k=f[h],x=v-p[d]-f[m],C=v/2-p[d]/2+w,S=El(k,C,x),M=a;t.modifiersData[o]=(e={},e[M]=S,e.centerOffset=S-C,e)}}function h_(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)||F1(e.elements.popper,r)&&(e.elements.arrow=r))}const m_={name:"arrow",enabled:!0,phase:"main",fn:p_,effect:h_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Ns(n){return n.split("-")[1]}var g_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function y_(n,e){var t=n.x,o=n.y,r=e.devicePixelRatio||1;return{x:Ms(t*r)/r||0,y:Ms(o*r)/r||0}}function gv(n){var e,t=n.popper,o=n.popperRect,r=n.placement,i=n.variation,s=n.offsets,l=n.position,a=n.gpuAcceleration,u=n.adaptive,d=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 d=="function"?d({x:h,y:g}):{x:h,y:g};h=y.x,g=y.y;var b=s.hasOwnProperty("x"),v=s.hasOwnProperty("y"),w=pn,k=fn,x=window;if(u){var C=$a(t),S="clientHeight",M="clientWidth";if(C===Mn(t)&&(C=qr(t),nr(C).position!=="static"&&l==="absolute"&&(S="scrollHeight",M="scrollWidth")),C=C,r===fn||(r===pn||r===Fn)&&i===Kl){k=Hn;var N=f&&C===x&&x.visualViewport?x.visualViewport.height:C[S];g-=N-o.height,g*=a?1:-1}if(r===pn||(r===fn||r===Hn)&&i===Kl){w=Fn;var O=f&&C===x&&x.visualViewport?x.visualViewport.width:C[M];h-=O-o.width,h*=a?1:-1}}var A=Object.assign({position:l},u&&g_),$=d===!0?y_({x:h,y:g},Mn(t)):{x:h,y:g};if(h=$.x,g=$.y,a){var D;return Object.assign({},A,(D={},D[k]=v?"0":"",D[w]=b?"0":"",D.transform=(x.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",D))}return Object.assign({},A,(e={},e[k]=v?g+"px":"",e[w]=b?h+"px":"",e.transform="",e))}function b_(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,u={placement:ko(e.placement),variation:Ns(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,gv(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,gv(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const v_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:b_,data:{}};var oc={passive:!0};function k_(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=Mn(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(d){d.addEventListener("scroll",t.update,oc)}),l&&a.addEventListener("resize",t.update,oc),function(){i&&u.forEach(function(d){d.removeEventListener("scroll",t.update,oc)}),l&&a.removeEventListener("resize",t.update,oc)}}const w_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:k_,data:{}};var x_={left:"right",right:"left",bottom:"top",top:"bottom"};function Ac(n){return n.replace(/left|right|bottom|top/g,function(e){return x_[e]})}var C_={start:"end",end:"start"};function yv(n){return n.replace(/start|end/g,function(e){return C_[e]})}function Cg(n){var e=Mn(n),t=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:t,scrollTop:o}}function Sg(n){return Ts(qr(n)).left+Cg(n).scrollLeft}function S_(n,e){var t=Mn(n),o=qr(n),r=t.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;var u=H1();(u||!u&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}return{width:i,height:s,x:l+Sg(n),y:a}}function E_(n){var e,t=qr(n),o=Cg(n),r=(e=n.ownerDocument)==null?void 0:e.body,i=ui(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=ui(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+Sg(n),a=-o.scrollTop;return nr(r||t).direction==="rtl"&&(l+=ui(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:l,y:a}}function Eg(n){var e=nr(n),t=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+o)}function q1(n){return["html","body","#document"].indexOf(Mo(n))>=0?n.ownerDocument.body:zn(n)&&Eg(n)?n:q1(Wd(n))}function Ml(n,e){var t;e===void 0&&(e=[]);var o=q1(n),r=o===((t=n.ownerDocument)==null?void 0:t.body),i=Mn(o),s=r?[i].concat(i.visualViewport||[],Eg(o)?o:[]):o,l=e.concat(s);return r?l:l.concat(Ml(Wd(s)))}function mh(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function M_(n,e){var t=Ts(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 bv(n,e,t){return e===P1?mh(S_(n,t)):Ei(e)?M_(e,t):mh(E_(qr(n)))}function T_(n){var e=Ml(Wd(n)),t=["absolute","fixed"].indexOf(nr(n).position)>=0,o=t&&zn(n)?$a(n):n;return Ei(o)?e.filter(function(r){return Ei(r)&&F1(r,o)&&Mo(r)!=="body"}):[]}function N_(n,e,t,o){var r=e==="clippingParents"?T_(n):[].concat(e),i=[].concat(r,[t]),s=i[0],l=i.reduce(function(a,u){var d=bv(n,u,o);return a.top=ui(d.top,a.top),a.right=Lu(d.right,a.right),a.bottom=Lu(d.bottom,a.bottom),a.left=ui(d.left,a.left),a},bv(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 K1(n){var e=n.reference,t=n.element,o=n.placement,r=o?ko(o):null,i=o?Ns(o):null,s=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(r){case fn:a={x:s,y:e.y-t.height};break;case Hn:a={x:s,y:e.y+e.height};break;case Fn:a={x:e.x+e.width,y:l};break;case pn:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var u=r?xg(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(i){case Es:a[u]=a[u]-(e[d]/2-t[d]/2);break;case Kl:a[u]=a[u]+(e[d]/2-t[d]/2);break}}return a}function Jl(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?GD:l,u=t.rootBoundary,d=u===void 0?P1:u,f=t.elementContext,p=f===void 0?Xs:f,h=t.altBoundary,m=h===void 0?!1:h,g=t.padding,y=g===void 0?0:g,b=U1(typeof y!="number"?y:W1(y,Oa)),v=p===Xs?XD:Xs,w=n.rects.popper,k=n.elements[m?v:p],x=N_(Ei(k)?k:k.contextElement||qr(n.elements.popper),a,d,s),C=Ts(n.elements.reference),S=K1({reference:C,element:w,placement:r}),M=mh(Object.assign({},w,S)),N=p===Xs?M:C,O={top:x.top-N.top+b.top,bottom:N.bottom-x.bottom+b.bottom,left:x.left-N.left+b.left,right:N.right-x.right+b.right},A=n.modifiersData.offset;if(p===Xs&&A){var $=A[r];Object.keys(O).forEach(function(D){var R=[Fn,Hn].indexOf(D)>=0?1:-1,L=[fn,Hn].indexOf(D)>=0?"y":"x";O[D]+=$[L]*R})}return O}function A_(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,u=a===void 0?V1:a,d=Ns(o),f=d?l?hv:hv.filter(function(m){return Ns(m)===d}):Oa,p=f.filter(function(m){return u.indexOf(m)>=0});p.length===0&&(p=f);var h=p.reduce(function(m,g){return m[g]=Jl(n,{placement:g,boundary:r,rootBoundary:i,padding:s})[ko(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function O_(n){if(ko(n)===vg)return[];var e=Ac(n);return[yv(n),e,yv(e)]}function $_(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,u=t.padding,d=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=ko(y),v=b===y,w=a||(v||!m?[Ac(y)]:O_(y)),k=[y].concat(w).reduce(function(He,Ne){return He.concat(ko(Ne)===vg?A_(e,{placement:Ne,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:g}):Ne)},[]),x=e.rects.reference,C=e.rects.popper,S=new Map,M=!0,N=k[0],O=0;O<k.length;O++){var A=k[O],$=ko(A),D=Ns(A)===Es,R=[fn,Hn].indexOf($)>=0,L=R?"width":"height",B=Jl(e,{placement:A,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),W=R?D?Fn:pn:D?Hn:fn;x[L]>C[L]&&(W=Ac(W));var z=Ac(W),U=[];if(i&&U.push(B[$]<=0),l&&U.push(B[W]<=0,B[z]<=0),U.every(function(He){return He})){N=A,M=!1;break}S.set(A,U)}if(M)for(var he=m?3:1,Se=function(Ne){var Fe=k.find(function(kt){var fe=S.get(kt);if(fe)return fe.slice(0,Ne).every(function(Ee){return Ee})});if(Fe)return N=Fe,"break"},_e=he;_e>0;_e--){var je=Se(_e);if(je==="break")break}e.placement!==N&&(e.modifiersData[o]._skip=!0,e.placement=N,e.reset=!0)}}const B_={name:"flip",enabled:!0,phase:"main",fn:$_,requiresIfExists:["offset"],data:{_skip:!1}};function vv(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 kv(n){return[fn,Fn,Hn,pn].some(function(e){return n[e]>=0})}function R_(n){var e=n.state,t=n.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=Jl(e,{elementContext:"reference"}),l=Jl(e,{altBoundary:!0}),a=vv(s,o),u=vv(l,r,i),d=kv(a),f=kv(u);e.modifiersData[t]={referenceClippingOffsets:a,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const D_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:R_};function __(n,e,t){var o=ko(n),r=[pn,fn].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,[pn,Fn].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function I_(n){var e=n.state,t=n.options,o=n.name,r=t.offset,i=r===void 0?[0,0]:r,s=V1.reduce(function(d,f){return d[f]=__(f,e.rects,i),d},{}),l=s[e.placement],a=l.x,u=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=u),e.modifiersData[o]=s}const L_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:I_};function P_(n){var e=n.state,t=n.name;e.modifiersData[t]=K1({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const V_={name:"popperOffsets",enabled:!0,phase:"read",fn:P_,data:{}};function z_(n){return n==="x"?"y":"x"}function H_(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,u=t.rootBoundary,d=t.altBoundary,f=t.padding,p=t.tether,h=p===void 0?!0:p,m=t.tetherOffset,g=m===void 0?0:m,y=Jl(e,{boundary:a,rootBoundary:u,padding:f,altBoundary:d}),b=ko(e.placement),v=Ns(e.placement),w=!v,k=xg(b),x=z_(k),C=e.modifiersData.popperOffsets,S=e.rects.reference,M=e.rects.popper,N=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,O=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),A=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,$={x:0,y:0};if(C){if(i){var D,R=k==="y"?fn:pn,L=k==="y"?Hn:Fn,B=k==="y"?"height":"width",W=C[k],z=W+y[R],U=W-y[L],he=h?-M[B]/2:0,Se=v===Es?S[B]:M[B],_e=v===Es?-M[B]:-S[B],je=e.elements.arrow,He=h&&je?wg(je):{width:0,height:0},Ne=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:j1(),Fe=Ne[R],kt=Ne[L],fe=El(0,S[B],He[B]),Ee=w?S[B]/2-he-fe-Fe-O.mainAxis:Se-fe-Fe-O.mainAxis,Me=w?-S[B]/2+he+fe+kt+O.mainAxis:_e+fe+kt+O.mainAxis,it=e.elements.arrow&&$a(e.elements.arrow),gn=it?k==="y"?it.clientTop||0:it.clientLeft||0:0,Do=(D=A==null?void 0:A[k])!=null?D:0,_o=W+Ee-Do-gn,cr=W+Me-Do,On=El(h?Lu(z,_o):z,W,h?ui(U,cr):U);C[k]=On,$[k]=On-W}if(l){var Io,ur=k==="x"?fn:pn,dr=k==="x"?Hn:Fn,Ht=C[x],yn=x==="y"?"height":"width",so=Ht+y[ur],bn=Ht-y[dr],en=[fn,pn].indexOf(b)!==-1,Lo=(Io=A==null?void 0:A[x])!=null?Io:0,Ft=en?so:Ht-S[yn]-M[yn]-Lo+O.altAxis,Kn=en?Ht+S[yn]+M[yn]-Lo-O.altAxis:bn,lo=h&&en?d_(Ft,Ht,Kn):El(h?Ft:so,Ht,h?Kn:bn);C[x]=lo,$[x]=lo-Ht}e.modifiersData[o]=$}}const F_={name:"preventOverflow",enabled:!0,phase:"main",fn:H_,requiresIfExists:["offset"]};function j_(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function U_(n){return n===Mn(n)||!zn(n)?Cg(n):j_(n)}function W_(n){var e=n.getBoundingClientRect(),t=Ms(e.width)/n.offsetWidth||1,o=Ms(e.height)/n.offsetHeight||1;return t!==1||o!==1}function q_(n,e,t){t===void 0&&(t=!1);var o=zn(e),r=zn(e)&&W_(e),i=qr(e),s=Ts(n,r,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!t)&&((Mo(e)!=="body"||Eg(i))&&(l=U_(e)),zn(e)?(a=Ts(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):i&&(a.x=Sg(i))),{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function K_(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 J_(n){var e=K_(n);return s_.reduce(function(t,o){return t.concat(e.filter(function(r){return r.phase===o}))},[])}function G_(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function X_(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 wv={placement:"bottom",modifiers:[],strategy:"absolute"};function xv(){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 Y_(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,o=t===void 0?[]:t,r=e.defaultOptions,i=r===void 0?wv:r;return function(l,a,u){u===void 0&&(u=i);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},wv,i),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},f=[],p=!1,h={state:d,setOptions:function(b){var v=typeof b=="function"?b(d.options):b;g(),d.options=Object.assign({},i,d.options,v),d.scrollParents={reference:Ei(l)?Ml(l):l.contextElement?Ml(l.contextElement):[],popper:Ml(a)};var w=J_(X_([].concat(o,d.options.modifiers)));return d.orderedModifiers=w.filter(function(k){return k.enabled}),m(),h.update()},forceUpdate:function(){if(!p){var b=d.elements,v=b.reference,w=b.popper;if(xv(v,w)){d.rects={reference:q_(v,$a(w),d.options.strategy==="fixed"),popper:wg(w)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(O){return d.modifiersData[O.name]=Object.assign({},O.data)});for(var k=0;k<d.orderedModifiers.length;k++){if(d.reset===!0){d.reset=!1,k=-1;continue}var x=d.orderedModifiers[k],C=x.fn,S=x.options,M=S===void 0?{}:S,N=x.name;typeof C=="function"&&(d=C({state:d,options:M,name:N,instance:h})||d)}}}},update:G_(function(){return new Promise(function(y){h.forceUpdate(),y(d)})}),destroy:function(){g(),p=!0}};if(!xv(l,a))return h;h.setOptions(u).then(function(y){!p&&u.onFirstUpdate&&u.onFirstUpdate(y)});function m(){d.orderedModifiers.forEach(function(y){var b=y.name,v=y.options,w=v===void 0?{}:v,k=y.effect;if(typeof k=="function"){var x=k({state:d,name:b,instance:h,options:w}),C=function(){};f.push(x||C)}})}function g(){f.forEach(function(y){return y()}),f=[]}return h}}var Q_=[w_,V_,v_,z1,L_,B_,F_,m_,D_],Z_=Y_({defaultModifiers:Q_}),eI="tippy-box",J1="tippy-content",tI="tippy-backdrop",G1="tippy-arrow",X1="tippy-svg-arrow",Qr={passive:!0,capture:!0},Y1=function(){return document.body};function nI(n,e){return{}.hasOwnProperty.call(n,e)}function rp(n,e,t){if(Array.isArray(n)){var o=n[e];return o??(Array.isArray(t)?t[e]:t)}return n}function Mg(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function Q1(n,e){return typeof n=="function"?n.apply(void 0,e):n}function Cv(n,e){if(e===0)return n;var t;return function(o){clearTimeout(t),t=setTimeout(function(){n(o)},e)}}function oI(n,e){var t=Object.assign({},n);return e.forEach(function(o){delete t[o]}),t}function rI(n){return n.split(/\s+/).filter(Boolean)}function ns(n){return[].concat(n)}function Sv(n,e){n.indexOf(e)===-1&&n.push(e)}function iI(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function sI(n){return n.split("-")[0]}function Pu(n){return[].slice.call(n)}function Ev(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function Tl(){return document.createElement("div")}function Gl(n){return["Element","Fragment"].some(function(e){return Mg(n,e)})}function lI(n){return Mg(n,"NodeList")}function aI(n){return Mg(n,"MouseEvent")}function cI(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function uI(n){return Gl(n)?[n]:lI(n)?Pu(n):Array.isArray(n)?n:Pu(document.querySelectorAll(n))}function ip(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Mv(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function dI(n){var e,t=ns(n),o=t[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function fI(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,u=sI(s.placement),d=s.modifiersData.offset;if(!d)return!0;var f=u==="bottom"?d.top.y:0,p=u==="top"?d.bottom.y:0,h=u==="right"?d.left.x:0,m=u==="left"?d.right.x:0,g=i.top-o+f>a,y=o-i.bottom-p>a,b=i.left-t+h>a,v=t-i.right-m>a;return g||y||b||v})}function sp(n,e,t){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){n[o](r,t)})}function Tv(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 mo={isTouch:!1},Nv=0;function pI(){mo.isTouch||(mo.isTouch=!0,window.performance&&document.addEventListener("mousemove",Z1))}function Z1(){var n=performance.now();n-Nv<20&&(mo.isTouch=!1,document.removeEventListener("mousemove",Z1)),Nv=n}function hI(){var n=document.activeElement;if(cI(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function mI(){document.addEventListener("touchstart",pI,Qr),window.addEventListener("blur",hI)}var gI=typeof window<"u"&&typeof document<"u",yI=gI?!!window.msCrypto:!1;function Ji(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 Av(n){var e=/[ \t]{2,}/g,t=/^[ \t]*/gm;return n.replace(e," ").replace(t,"").trim()}function bI(n){return Av(`
4
+ **/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),R=require("@tiptap/vue-3"),ha=require("@tiptap/starter-kit"),Rn=require("@tiptap/extension-document"),ka=require("markdown-it"),ya=require("@yiitap/i18n"),wa=require("@tiptap/pm/tables"),ft=require("@yiitap/extension-placeholder"),oe=require("@tiptap/core"),mr=require("@tiptap/pm/model"),Ht=require("@yiitap/util-emoji"),We=require("@tiptap/pm/state"),vr=require("@tiptap/vue-3/menus"),gr=require("@tiptap/extensions"),Ot=require("@tiptap/extension-details"),cn=require("@tiptap/extension-list"),Ut=require("@tiptap/extension-mathematics"),$e=require("@tiptap/extension-table"),Je=require("@tiptap/extension-text-style"),br=require("@tiptap/markdown"),hr=require("@tiptap/extension-collaboration"),kr=require("@tiptap/extension-collaboration-caret"),yr=require("@tiptap/extension-highlight"),xa=require("@tiptap/extension-horizontal-rule"),wr=require("@tiptap/extension-image"),sn=require("@tiptap/extension-link"),Ca=require("@tiptap/extension-mention"),xr=require("@tiptap/extension-subscript"),Cr=require("@tiptap/extension-superscript"),_r=require("@tiptap/extension-text-align"),Br=require("@tiptap/extension-typography"),Vr=require("@tiptap/extension-underline"),Nr=require("@tiptap/extension-unique-id"),Er=require("@yiitap/extension-color-highlighter"),Sr=require("@yiitap/extension-inline-placeholder"),Ue=require("@yiitap/extension-multi-column"),Or=require("@yiitap/extension-selection-decoration"),$r=require("@yiitap/extension-shortcut"),Ar=require("@yiitap/extension-table"),Tr=require("@yiitap/extension-task-item"),st=require("@yiitap/extension-char-command");require("@tiptap/suggestion");const _a=require("@yiitap/extension-ai-block"),Ba=require("@tiptap/extension-audio"),Va=require("katex"),Na=require("@yiitap/extension-blockquote"),Ea=require("@yiitap/extension-callout"),Sa=require("@tiptap/extension-code-block-lowlight"),In=require("lowlight"),Ho=require("mermaid"),Oa=require("@mermaid-js/layout-elk"),Jo=require("@yiitap/core"),$a=require("@yiitap/extension-image"),Aa=require("@yiitap/extension-model-viewer"),Ta=require("@yiitap/extension-table-wrapper"),Da=require("@yiitap/extension-video"),E=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 ge="top",Ve="bottom",Ne="right",be="left",un="auto",Qt=[ge,Ve,Ne,be],$t="start",Wt="end",Ma="clippingParents",Dr="viewport",It="popper",La="reference",jn=Qt.reduce(function(t,o){return t.concat([o+"-"+$t,o+"-"+Wt])},[]),Mr=[].concat(Qt,[un]).reduce(function(t,o){return t.concat([o,o+"-"+$t,o+"-"+Wt])},[]),Pa="beforeRead",Ra="read",Ia="afterRead",ja="beforeMain",Fa="main",za="afterMain",qa="beforeWrite",Ha="write",Ua="afterWrite",Wa=[Pa,Ra,Ia,ja,Fa,za,qa,Ha,Ua];function Ie(t){return t?(t.nodeName||"").toLowerCase():null}function we(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var o=t.ownerDocument;return o&&o.defaultView||window}return t}function mt(t){var o=we(t).Element;return t instanceof o||t instanceof Element}function Be(t){var o=we(t).HTMLElement;return t instanceof o||t instanceof HTMLElement}function dn(t){if(typeof ShadowRoot>"u")return!1;var o=we(t).ShadowRoot;return t instanceof o||t instanceof ShadowRoot}function Ya(t){var o=t.state;Object.keys(o.elements).forEach(function(n){var r=o.styles[n]||{},l=o.attributes[n]||{},a=o.elements[n];!Be(a)||!Ie(a)||(Object.assign(a.style,r),Object.keys(l).forEach(function(i){var s=l[i];s===!1?a.removeAttribute(i):a.setAttribute(i,s===!0?"":s)}))})}function Ga(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(r){var l=o.elements[r],a=o.attributes[r]||{},i=Object.keys(o.styles.hasOwnProperty(r)?o.styles[r]:n[r]),s=i.reduce(function(c,d){return c[d]="",c},{});!Be(l)||!Ie(l)||(Object.assign(l.style,s),Object.keys(a).forEach(function(c){l.removeAttribute(c)}))})}}const Lr={name:"applyStyles",enabled:!0,phase:"write",fn:Ya,effect:Ga,requires:["computeStyles"]};function Pe(t){return t.split("-")[0]}var ut=Math.max,ho=Math.min,At=Math.round;function Zo(){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 Pr(){return!/^((?!chrome|android).)*safari/i.test(Zo())}function Tt(t,o,n){o===void 0&&(o=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),l=1,a=1;o&&Be(t)&&(l=t.offsetWidth>0&&At(r.width)/t.offsetWidth||1,a=t.offsetHeight>0&&At(r.height)/t.offsetHeight||1);var i=mt(t)?we(t):window,s=i.visualViewport,c=!Pr()&&n,d=(r.left+(c&&s?s.offsetLeft:0))/l,u=(r.top+(c&&s?s.offsetTop:0))/a,p=r.width/l,f=r.height/a;return{width:p,height:f,top:u,right:d+p,bottom:u+f,left:d,x:d,y:u}}function pn(t){var o=Tt(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(o.width-n)<=1&&(n=o.width),Math.abs(o.height-r)<=1&&(r=o.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function Rr(t,o){var n=o.getRootNode&&o.getRootNode();if(t.contains(o))return!0;if(n&&dn(n)){var r=o;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ye(t){return we(t).getComputedStyle(t)}function Ka(t){return["table","td","th"].indexOf(Ie(t))>=0}function et(t){return((mt(t)?t.ownerDocument:t.document)||window.document).documentElement}function So(t){return Ie(t)==="html"?t:t.assignedSlot||t.parentNode||(dn(t)?t.host:null)||et(t)}function Fn(t){return!Be(t)||Ye(t).position==="fixed"?null:t.offsetParent}function Xa(t){var o=/firefox/i.test(Zo()),n=/Trident/i.test(Zo());if(n&&Be(t)){var r=Ye(t);if(r.position==="fixed")return null}var l=So(t);for(dn(l)&&(l=l.host);Be(l)&&["html","body"].indexOf(Ie(l))<0;){var a=Ye(l);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 l;l=l.parentNode}return null}function eo(t){for(var o=we(t),n=Fn(t);n&&Ka(n)&&Ye(n).position==="static";)n=Fn(n);return n&&(Ie(n)==="html"||Ie(n)==="body"&&Ye(n).position==="static")?o:n||Xa(t)||o}function fn(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ft(t,o,n){return ut(t,ho(o,n))}function Ja(t,o,n){var r=Ft(t,o,n);return r>n?n:r}function Ir(){return{top:0,right:0,bottom:0,left:0}}function jr(t){return Object.assign({},Ir(),t)}function Fr(t,o){return o.reduce(function(n,r){return n[r]=t,n},{})}var Za=function(o,n){return o=typeof o=="function"?o(Object.assign({},n.rects,{placement:n.placement})):o,jr(typeof o!="number"?o:Fr(o,Qt))};function Qa(t){var o,n=t.state,r=t.name,l=t.options,a=n.elements.arrow,i=n.modifiersData.popperOffsets,s=Pe(n.placement),c=fn(s),d=[be,Ne].indexOf(s)>=0,u=d?"height":"width";if(!(!a||!i)){var p=Za(l.padding,n),f=pn(a),m=c==="y"?ge:be,b=c==="y"?Ve:Ne,g=n.rects.reference[u]+n.rects.reference[c]-i[c]-n.rects.popper[u],k=i[c]-n.rects.reference[c],w=eo(a),h=w?c==="y"?w.clientHeight||0:w.clientWidth||0:0,x=g/2-k/2,v=p[m],_=h-f[u]-p[b],C=h/2-f[u]/2+x,O=Ft(v,C,_),M=c;n.modifiersData[r]=(o={},o[M]=O,o.centerOffset=O-C,o)}}function ei(t){var o=t.state,n=t.options,r=n.element,l=r===void 0?"[data-popper-arrow]":r;l!=null&&(typeof l=="string"&&(l=o.elements.popper.querySelector(l),!l)||Rr(o.elements.popper,l)&&(o.elements.arrow=l))}const ti={name:"arrow",enabled:!0,phase:"main",fn:Qa,effect:ei,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Dt(t){return t.split("-")[1]}var oi={top:"auto",right:"auto",bottom:"auto",left:"auto"};function ni(t,o){var n=t.x,r=t.y,l=o.devicePixelRatio||1;return{x:At(n*l)/l||0,y:At(r*l)/l||0}}function zn(t){var o,n=t.popper,r=t.popperRect,l=t.placement,a=t.variation,i=t.offsets,s=t.position,c=t.gpuAcceleration,d=t.adaptive,u=t.roundOffsets,p=t.isFixed,f=i.x,m=f===void 0?0:f,b=i.y,g=b===void 0?0:b,k=typeof u=="function"?u({x:m,y:g}):{x:m,y:g};m=k.x,g=k.y;var w=i.hasOwnProperty("x"),h=i.hasOwnProperty("y"),x=be,v=ge,_=window;if(d){var C=eo(n),O="clientHeight",M="clientWidth";if(C===we(n)&&(C=et(n),Ye(C).position!=="static"&&s==="absolute"&&(O="scrollHeight",M="scrollWidth")),C=C,l===ge||(l===be||l===Ne)&&a===Wt){v=Ve;var A=p&&C===_&&_.visualViewport?_.visualViewport.height:C[O];g-=A-r.height,g*=c?1:-1}if(l===be||(l===ge||l===Ve)&&a===Wt){x=Ne;var T=p&&C===_&&_.visualViewport?_.visualViewport.width:C[M];m-=T-r.width,m*=c?1:-1}}var z=Object.assign({position:s},d&&oi),V=u===!0?ni({x:m,y:g},we(n)):{x:m,y:g};if(m=V.x,g=V.y,c){var N;return Object.assign({},z,(N={},N[v]=h?"0":"",N[x]=w?"0":"",N.transform=(_.devicePixelRatio||1)<=1?"translate("+m+"px, "+g+"px)":"translate3d("+m+"px, "+g+"px, 0)",N))}return Object.assign({},z,(o={},o[v]=h?g+"px":"",o[x]=w?m+"px":"",o.transform="",o))}function ri(t){var o=t.state,n=t.options,r=n.gpuAcceleration,l=r===void 0?!0:r,a=n.adaptive,i=a===void 0?!0:a,s=n.roundOffsets,c=s===void 0?!0:s,d={placement:Pe(o.placement),variation:Dt(o.placement),popper:o.elements.popper,popperRect:o.rects.popper,gpuAcceleration:l,isFixed:o.options.strategy==="fixed"};o.modifiersData.popperOffsets!=null&&(o.styles.popper=Object.assign({},o.styles.popper,zn(Object.assign({},d,{offsets:o.modifiersData.popperOffsets,position:o.options.strategy,adaptive:i,roundOffsets:c})))),o.modifiersData.arrow!=null&&(o.styles.arrow=Object.assign({},o.styles.arrow,zn(Object.assign({},d,{offsets:o.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),o.attributes.popper=Object.assign({},o.attributes.popper,{"data-popper-placement":o.placement})}const li={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:ri,data:{}};var uo={passive:!0};function ai(t){var o=t.state,n=t.instance,r=t.options,l=r.scroll,a=l===void 0?!0:l,i=r.resize,s=i===void 0?!0:i,c=we(o.elements.popper),d=[].concat(o.scrollParents.reference,o.scrollParents.popper);return a&&d.forEach(function(u){u.addEventListener("scroll",n.update,uo)}),s&&c.addEventListener("resize",n.update,uo),function(){a&&d.forEach(function(u){u.removeEventListener("scroll",n.update,uo)}),s&&c.removeEventListener("resize",n.update,uo)}}const ii={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:ai,data:{}};var ci={left:"right",right:"left",bottom:"top",top:"bottom"};function vo(t){return t.replace(/left|right|bottom|top/g,function(o){return ci[o]})}var si={start:"end",end:"start"};function qn(t){return t.replace(/start|end/g,function(o){return si[o]})}function mn(t){var o=we(t),n=o.pageXOffset,r=o.pageYOffset;return{scrollLeft:n,scrollTop:r}}function vn(t){return Tt(et(t)).left+mn(t).scrollLeft}function ui(t,o){var n=we(t),r=et(t),l=n.visualViewport,a=r.clientWidth,i=r.clientHeight,s=0,c=0;if(l){a=l.width,i=l.height;var d=Pr();(d||!d&&o==="fixed")&&(s=l.offsetLeft,c=l.offsetTop)}return{width:a,height:i,x:s+vn(t),y:c}}function di(t){var o,n=et(t),r=mn(t),l=(o=t.ownerDocument)==null?void 0:o.body,a=ut(n.scrollWidth,n.clientWidth,l?l.scrollWidth:0,l?l.clientWidth:0),i=ut(n.scrollHeight,n.clientHeight,l?l.scrollHeight:0,l?l.clientHeight:0),s=-r.scrollLeft+vn(t),c=-r.scrollTop;return Ye(l||n).direction==="rtl"&&(s+=ut(n.clientWidth,l?l.clientWidth:0)-a),{width:a,height:i,x:s,y:c}}function gn(t){var o=Ye(t),n=o.overflow,r=o.overflowX,l=o.overflowY;return/auto|scroll|overlay|hidden/.test(n+l+r)}function zr(t){return["html","body","#document"].indexOf(Ie(t))>=0?t.ownerDocument.body:Be(t)&&gn(t)?t:zr(So(t))}function zt(t,o){var n;o===void 0&&(o=[]);var r=zr(t),l=r===((n=t.ownerDocument)==null?void 0:n.body),a=we(r),i=l?[a].concat(a.visualViewport||[],gn(r)?r:[]):r,s=o.concat(i);return l?s:s.concat(zt(So(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 pi(t,o){var n=Tt(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 Hn(t,o,n){return o===Dr?Qo(ui(t,n)):mt(o)?pi(o,n):Qo(di(et(t)))}function fi(t){var o=zt(So(t)),n=["absolute","fixed"].indexOf(Ye(t).position)>=0,r=n&&Be(t)?eo(t):t;return mt(r)?o.filter(function(l){return mt(l)&&Rr(l,r)&&Ie(l)!=="body"}):[]}function mi(t,o,n,r){var l=o==="clippingParents"?fi(t):[].concat(o),a=[].concat(l,[n]),i=a[0],s=a.reduce(function(c,d){var u=Hn(t,d,r);return c.top=ut(u.top,c.top),c.right=ho(u.right,c.right),c.bottom=ho(u.bottom,c.bottom),c.left=ut(u.left,c.left),c},Hn(t,i,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function qr(t){var o=t.reference,n=t.element,r=t.placement,l=r?Pe(r):null,a=r?Dt(r):null,i=o.x+o.width/2-n.width/2,s=o.y+o.height/2-n.height/2,c;switch(l){case ge:c={x:i,y:o.y-n.height};break;case Ve:c={x:i,y:o.y+o.height};break;case Ne:c={x:o.x+o.width,y:s};break;case be:c={x:o.x-n.width,y:s};break;default:c={x:o.x,y:o.y}}var d=l?fn(l):null;if(d!=null){var u=d==="y"?"height":"width";switch(a){case $t:c[d]=c[d]-(o[u]/2-n[u]/2);break;case Wt:c[d]=c[d]+(o[u]/2-n[u]/2);break}}return c}function Yt(t,o){o===void 0&&(o={});var n=o,r=n.placement,l=r===void 0?t.placement:r,a=n.strategy,i=a===void 0?t.strategy:a,s=n.boundary,c=s===void 0?Ma:s,d=n.rootBoundary,u=d===void 0?Dr:d,p=n.elementContext,f=p===void 0?It:p,m=n.altBoundary,b=m===void 0?!1:m,g=n.padding,k=g===void 0?0:g,w=jr(typeof k!="number"?k:Fr(k,Qt)),h=f===It?La:It,x=t.rects.popper,v=t.elements[b?h:f],_=mi(mt(v)?v:v.contextElement||et(t.elements.popper),c,u,i),C=Tt(t.elements.reference),O=qr({reference:C,element:x,placement:l}),M=Qo(Object.assign({},x,O)),A=f===It?M:C,T={top:_.top-A.top+w.top,bottom:A.bottom-_.bottom+w.bottom,left:_.left-A.left+w.left,right:A.right-_.right+w.right},z=t.modifiersData.offset;if(f===It&&z){var V=z[l];Object.keys(T).forEach(function(N){var $=[Ne,Ve].indexOf(N)>=0?1:-1,L=[ge,Ve].indexOf(N)>=0?"y":"x";T[N]+=V[L]*$})}return T}function vi(t,o){o===void 0&&(o={});var n=o,r=n.placement,l=n.boundary,a=n.rootBoundary,i=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?Mr:c,u=Dt(r),p=u?s?jn:jn.filter(function(b){return Dt(b)===u}):Qt,f=p.filter(function(b){return d.indexOf(b)>=0});f.length===0&&(f=p);var m=f.reduce(function(b,g){return b[g]=Yt(t,{placement:g,boundary:l,rootBoundary:a,padding:i})[Pe(g)],b},{});return Object.keys(m).sort(function(b,g){return m[b]-m[g]})}function gi(t){if(Pe(t)===un)return[];var o=vo(t);return[qn(t),o,qn(o)]}function bi(t){var o=t.state,n=t.options,r=t.name;if(!o.modifiersData[r]._skip){for(var l=n.mainAxis,a=l===void 0?!0:l,i=n.altAxis,s=i===void 0?!0:i,c=n.fallbackPlacements,d=n.padding,u=n.boundary,p=n.rootBoundary,f=n.altBoundary,m=n.flipVariations,b=m===void 0?!0:m,g=n.allowedAutoPlacements,k=o.options.placement,w=Pe(k),h=w===k,x=c||(h||!b?[vo(k)]:gi(k)),v=[k].concat(x).reduce(function(ce,ne){return ce.concat(Pe(ne)===un?vi(o,{placement:ne,boundary:u,rootBoundary:p,padding:d,flipVariations:b,allowedAutoPlacements:g}):ne)},[]),_=o.rects.reference,C=o.rects.popper,O=new Map,M=!0,A=v[0],T=0;T<v.length;T++){var z=v[T],V=Pe(z),N=Dt(z)===$t,$=[ge,Ve].indexOf(V)>=0,L=$?"width":"height",q=Yt(o,{placement:z,boundary:u,rootBoundary:p,altBoundary:f,padding:d}),G=$?N?Ne:be:N?Ve:ge;_[L]>C[L]&&(G=vo(G));var I=vo(G),S=[];if(a&&S.push(q[V]<=0),s&&S.push(q[G]<=0,q[I]<=0),S.every(function(ce){return ce})){A=z,M=!1;break}O.set(z,S)}if(M)for(var K=b?3:1,Q=function(ne){var re=v.find(function(_e){var j=O.get(_e);if(j)return j.slice(0,ne).every(function(Y){return Y})});if(re)return A=re,"break"},de=K;de>0;de--){var me=Q(de);if(me==="break")break}o.placement!==A&&(o.modifiersData[r]._skip=!0,o.placement=A,o.reset=!0)}}const hi={name:"flip",enabled:!0,phase:"main",fn:bi,requiresIfExists:["offset"],data:{_skip:!1}};function Un(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 Wn(t){return[ge,Ne,Ve,be].some(function(o){return t[o]>=0})}function ki(t){var o=t.state,n=t.name,r=o.rects.reference,l=o.rects.popper,a=o.modifiersData.preventOverflow,i=Yt(o,{elementContext:"reference"}),s=Yt(o,{altBoundary:!0}),c=Un(i,r),d=Un(s,l,a),u=Wn(c),p=Wn(d);o.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:p},o.attributes.popper=Object.assign({},o.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}const yi={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ki};function wi(t,o,n){var r=Pe(t),l=[be,ge].indexOf(r)>=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)*l,[be,Ne].indexOf(r)>=0?{x:s,y:i}:{x:i,y:s}}function xi(t){var o=t.state,n=t.options,r=t.name,l=n.offset,a=l===void 0?[0,0]:l,i=Mr.reduce(function(u,p){return u[p]=wi(p,o.rects,a),u},{}),s=i[o.placement],c=s.x,d=s.y;o.modifiersData.popperOffsets!=null&&(o.modifiersData.popperOffsets.x+=c,o.modifiersData.popperOffsets.y+=d),o.modifiersData[r]=i}const Ci={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:xi};function _i(t){var o=t.state,n=t.name;o.modifiersData[n]=qr({reference:o.rects.reference,element:o.rects.popper,placement:o.placement})}const Bi={name:"popperOffsets",enabled:!0,phase:"read",fn:_i,data:{}};function Vi(t){return t==="x"?"y":"x"}function Ni(t){var o=t.state,n=t.options,r=t.name,l=n.mainAxis,a=l===void 0?!0:l,i=n.altAxis,s=i===void 0?!1:i,c=n.boundary,d=n.rootBoundary,u=n.altBoundary,p=n.padding,f=n.tether,m=f===void 0?!0:f,b=n.tetherOffset,g=b===void 0?0:b,k=Yt(o,{boundary:c,rootBoundary:d,padding:p,altBoundary:u}),w=Pe(o.placement),h=Dt(o.placement),x=!h,v=fn(w),_=Vi(v),C=o.modifiersData.popperOffsets,O=o.rects.reference,M=o.rects.popper,A=typeof g=="function"?g(Object.assign({},o.rects,{placement:o.placement})):g,T=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),z=o.modifiersData.offset?o.modifiersData.offset[o.placement]:null,V={x:0,y:0};if(C){if(a){var N,$=v==="y"?ge:be,L=v==="y"?Ve:Ne,q=v==="y"?"height":"width",G=C[v],I=G+k[$],S=G-k[L],K=m?-M[q]/2:0,Q=h===$t?O[q]:M[q],de=h===$t?-M[q]:-O[q],me=o.elements.arrow,ce=m&&me?pn(me):{width:0,height:0},ne=o.modifiersData["arrow#persistent"]?o.modifiersData["arrow#persistent"].padding:Ir(),re=ne[$],_e=ne[L],j=Ft(0,O[q],ce[q]),Y=x?O[q]/2-K-j-re-T.mainAxis:Q-j-re-T.mainAxis,J=x?-O[q]/2+K+j+_e+T.mainAxis:de+j+_e+T.mainAxis,le=o.elements.arrow&&eo(o.elements.arrow),Se=le?v==="y"?le.clientTop||0:le.clientLeft||0:0,tt=(N=z==null?void 0:z[v])!=null?N:0,ot=G+Y-tt-Se,kt=G+J-tt,De=Ft(m?ho(I,ot):I,G,m?ut(S,kt):S);C[v]=De,V[v]=De-G}if(s){var nt,yt=v==="x"?ge:be,wt=v==="x"?Ve:Ne,he=C[_],Oe=_==="y"?"height":"width",Xe=he+k[yt],Me=he-k[wt],rt=[ge,be].indexOf(w)!==-1,xt=(nt=z==null?void 0:z[_])!=null?nt:0,qe=rt?Xe:he-O[Oe]-M[Oe]-xt+T.altAxis,Ct=rt?he+O[Oe]+M[Oe]-xt-T.altAxis:Me,lt=m&&rt?Ja(qe,he,Ct):Ft(m?qe:Xe,he,m?Ct:Me);C[_]=lt,V[_]=lt-he}o.modifiersData[r]=V}}const Ei={name:"preventOverflow",enabled:!0,phase:"main",fn:Ni,requiresIfExists:["offset"]};function Si(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Oi(t){return t===we(t)||!Be(t)?mn(t):Si(t)}function $i(t){var o=t.getBoundingClientRect(),n=At(o.width)/t.offsetWidth||1,r=At(o.height)/t.offsetHeight||1;return n!==1||r!==1}function Ai(t,o,n){n===void 0&&(n=!1);var r=Be(o),l=Be(o)&&$i(o),a=et(o),i=Tt(t,l,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Ie(o)!=="body"||gn(a))&&(s=Oi(o)),Be(o)?(c=Tt(o,!0),c.x+=o.clientLeft,c.y+=o.clientTop):a&&(c.x=vn(a))),{x:i.left+s.scrollLeft-c.x,y:i.top+s.scrollTop-c.y,width:i.width,height:i.height}}function Ti(t){var o=new Map,n=new Set,r=[];t.forEach(function(a){o.set(a.name,a)});function l(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&&l(c)}}),r.push(a)}return t.forEach(function(a){n.has(a.name)||l(a)}),r}function Di(t){var o=Ti(t);return Wa.reduce(function(n,r){return n.concat(o.filter(function(l){return l.phase===r}))},[])}function Mi(t){var o;return function(){return o||(o=new Promise(function(n){Promise.resolve().then(function(){o=void 0,n(t())})})),o}}function Li(t){var o=t.reduce(function(n,r){var l=n[r.name];return n[r.name]=l?Object.assign({},l,r,{options:Object.assign({},l.options,r.options),data:Object.assign({},l.data,r.data)}):r,n},{});return Object.keys(o).map(function(n){return o[n]})}var Yn={placement:"bottom",modifiers:[],strategy:"absolute"};function Gn(){for(var t=arguments.length,o=new Array(t),n=0;n<t;n++)o[n]=arguments[n];return!o.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Pi(t){t===void 0&&(t={});var o=t,n=o.defaultModifiers,r=n===void 0?[]:n,l=o.defaultOptions,a=l===void 0?Yn:l;return function(s,c,d){d===void 0&&(d=a);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Yn,a),modifiersData:{},elements:{reference:s,popper:c},attributes:{},styles:{}},p=[],f=!1,m={state:u,setOptions:function(w){var h=typeof w=="function"?w(u.options):w;g(),u.options=Object.assign({},a,u.options,h),u.scrollParents={reference:mt(s)?zt(s):s.contextElement?zt(s.contextElement):[],popper:zt(c)};var x=Di(Li([].concat(r,u.options.modifiers)));return u.orderedModifiers=x.filter(function(v){return v.enabled}),b(),m.update()},forceUpdate:function(){if(!f){var w=u.elements,h=w.reference,x=w.popper;if(Gn(h,x)){u.rects={reference:Ai(h,eo(x),u.options.strategy==="fixed"),popper:pn(x)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(T){return u.modifiersData[T.name]=Object.assign({},T.data)});for(var v=0;v<u.orderedModifiers.length;v++){if(u.reset===!0){u.reset=!1,v=-1;continue}var _=u.orderedModifiers[v],C=_.fn,O=_.options,M=O===void 0?{}:O,A=_.name;typeof C=="function"&&(u=C({state:u,options:M,name:A,instance:m})||u)}}}},update:Mi(function(){return new Promise(function(k){m.forceUpdate(),k(u)})}),destroy:function(){g(),f=!0}};if(!Gn(s,c))return m;m.setOptions(d).then(function(k){!f&&d.onFirstUpdate&&d.onFirstUpdate(k)});function b(){u.orderedModifiers.forEach(function(k){var w=k.name,h=k.options,x=h===void 0?{}:h,v=k.effect;if(typeof v=="function"){var _=v({state:u,name:w,instance:m,options:x}),C=function(){};p.push(_||C)}})}function g(){p.forEach(function(k){return k()}),p=[]}return m}}var Ri=[ii,Bi,li,Lr,Ci,hi,Ei,ti,yi],Ii=Pi({defaultModifiers:Ri}),ji="tippy-box",Hr="tippy-content",Fi="tippy-backdrop",Ur="tippy-arrow",Wr="tippy-svg-arrow",it={passive:!0,capture:!0},Yr=function(){return document.body};function zi(t,o){return{}.hasOwnProperty.call(t,o)}function Uo(t,o,n){if(Array.isArray(t)){var r=t[o];return r??(Array.isArray(n)?n[o]:n)}return t}function bn(t,o){var n={}.toString.call(t);return n.indexOf("[object")===0&&n.indexOf(o+"]")>-1}function Gr(t,o){return typeof t=="function"?t.apply(void 0,o):t}function Kn(t,o){if(o===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},o)}}function qi(t,o){var n=Object.assign({},t);return o.forEach(function(r){delete n[r]}),n}function Hi(t){return t.split(/\s+/).filter(Boolean)}function Et(t){return[].concat(t)}function Xn(t,o){t.indexOf(o)===-1&&t.push(o)}function Ui(t){return t.filter(function(o,n){return t.indexOf(o)===n})}function Wi(t){return t.split("-")[0]}function ko(t){return[].slice.call(t)}function Jn(t){return Object.keys(t).reduce(function(o,n){return t[n]!==void 0&&(o[n]=t[n]),o},{})}function qt(){return document.createElement("div")}function Gt(t){return["Element","Fragment"].some(function(o){return bn(t,o)})}function Yi(t){return bn(t,"NodeList")}function Gi(t){return bn(t,"MouseEvent")}function Ki(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function Xi(t){return Gt(t)?[t]:Yi(t)?ko(t):Array.isArray(t)?t:ko(document.querySelectorAll(t))}function Wo(t,o){t.forEach(function(n){n&&(n.style.transitionDuration=o+"ms")})}function Zn(t,o){t.forEach(function(n){n&&n.setAttribute("data-state",o)})}function Ji(t){var o,n=Et(t),r=n[0];return r!=null&&(o=r.ownerDocument)!=null&&o.body?r.ownerDocument:document}function Zi(t,o){var n=o.clientX,r=o.clientY;return t.every(function(l){var a=l.popperRect,i=l.popperState,s=l.props,c=s.interactiveBorder,d=Wi(i.placement),u=i.modifiersData.offset;if(!u)return!0;var p=d==="bottom"?u.top.y:0,f=d==="top"?u.bottom.y:0,m=d==="right"?u.left.x:0,b=d==="left"?u.right.x:0,g=a.top-r+p>c,k=r-a.bottom-f>c,w=a.left-n+m>c,h=n-a.right-b>c;return g||k||w||h})}function Yo(t,o,n){var r=o+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(l){t[r](l,n)})}function Qn(t,o){for(var n=o;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Le={isTouch:!1},er=0;function Qi(){Le.isTouch||(Le.isTouch=!0,window.performance&&document.addEventListener("mousemove",Kr))}function Kr(){var t=performance.now();t-er<20&&(Le.isTouch=!1,document.removeEventListener("mousemove",Kr)),er=t}function ec(){var t=document.activeElement;if(Ki(t)){var o=t._tippy;t.blur&&!o.state.isVisible&&t.blur()}}function tc(){document.addEventListener("touchstart",Qi,it),window.addEventListener("blur",ec)}var oc=typeof window<"u"&&typeof document<"u",nc=oc?!!window.msCrypto:!1;function Vt(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 tr(t){var o=/[ \t]{2,}/g,n=/^[ \t]*/gm;return t.replace(o," ").replace(n,"").trim()}function rc(t){return tr(`
146
5
  %ctippy.js
147
6
 
148
- %c`+Av(n)+`
7
+ %c`+tr(t)+`
149
8
 
150
9
  %c👷‍ This is a development-only message. It will be removed in production.
151
- `)}function eC(n){return[bI(n),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Xl;process.env.NODE_ENV!=="production"&&vI();function vI(){Xl=new Set}function qo(n,e){if(n&&!Xl.has(e)){var t;Xl.add(e),(t=console).warn.apply(t,eC(e))}}function gh(n,e){if(n&&!Xl.has(e)){var t;Xl.add(e),(t=console).error.apply(t,eC(e))}}function kI(n){var e=!n,t=Object.prototype.toString.call(n)==="[object Object]"&&!n.addEventListener;gh(e,["tippy() was passed","`"+String(n)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),gh(t,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var tC={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},wI={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},wn=Object.assign({appendTo:Y1,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},tC,wI),xI=Object.keys(wn),CI=function(e){process.env.NODE_ENV!=="production"&&oC(e,[]);var t=Object.keys(e);t.forEach(function(o){wn[o]=e[o]})};function nC(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=wn[i])!=null?l:s}return o},{});return Object.assign({},n,t)}function SI(n,e){var t=e?Object.keys(nC(Object.assign({},wn,{plugins:e}))):xI,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 Ov(n,e){var t=Object.assign({},e,{content:Q1(e.content,[n])},e.ignoreAttributes?{}:SI(n,e.plugins));return t.aria=Object.assign({},wn.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 oC(n,e){n===void 0&&(n={}),e===void 0&&(e=[]);var t=Object.keys(n);t.forEach(function(o){var r=oI(wn,Object.keys(tC)),i=!nI(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),qo(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 Xr(t){return[rc(t),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Kt;process.env.NODE_ENV!=="production"&&lc();function lc(){Kt=new Set}function He(t,o){if(t&&!Kt.has(o)){var n;Kt.add(o),(n=console).warn.apply(n,Xr(o))}}function en(t,o){if(t&&!Kt.has(o)){var n;Kt.add(o),(n=console).error.apply(n,Xr(o))}}function ac(t){var o=!t,n=Object.prototype.toString.call(t)==="[object Object]"&&!t.addEventListener;en(o,["tippy() was passed","`"+String(t)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),en(n,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var Jr={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},ic={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},ke=Object.assign({appendTo:Yr,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},Jr,ic),cc=Object.keys(ke),sc=function(o){process.env.NODE_ENV!=="production"&&Qr(o,[]);var n=Object.keys(o);n.forEach(function(r){ke[r]=o[r]})};function Zr(t){var o=t.plugins||[],n=o.reduce(function(r,l){var a=l.name,i=l.defaultValue;if(a){var s;r[a]=t[a]!==void 0?t[a]:(s=ke[a])!=null?s:i}return r},{});return Object.assign({},t,n)}function uc(t,o){var n=o?Object.keys(Zr(Object.assign({},ke,{plugins:o}))):cc,r=n.reduce(function(l,a){var i=(t.getAttribute("data-tippy-"+a)||"").trim();if(!i)return l;if(a==="content")l[a]=i;else try{l[a]=JSON.parse(i)}catch{l[a]=i}return l},{});return r}function or(t,o){var n=Object.assign({},o,{content:Gr(o.content,[t])},o.ignoreAttributes?{}:uc(t,o.plugins));return n.aria=Object.assign({},ke.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 Qr(t,o){t===void 0&&(t={}),o===void 0&&(o=[]);var n=Object.keys(t);n.forEach(function(r){var l=qi(ke,Object.keys(Jr)),a=!zi(l,r);a&&(a=o.filter(function(i){return i.name===r}).length===0),He(a,["`"+r+"`","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 EI=function(){return"innerHTML"};function yh(n,e){n[EI()]=e}function $v(n){var e=Tl();return n===!0?e.className=G1:(e.className=X1,Gl(n)?e.appendChild(n):yh(e,n)),e}function Bv(n,e){Gl(e.content)?(yh(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?yh(n,e.content):n.textContent=e.content)}function bh(n){var e=n.firstElementChild,t=Pu(e.children);return{box:e,content:t.find(function(o){return o.classList.contains(J1)}),arrow:t.find(function(o){return o.classList.contains(G1)||o.classList.contains(X1)}),backdrop:t.find(function(o){return o.classList.contains(tI)})}}function rC(n){var e=Tl(),t=Tl();t.className=eI,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var o=Tl();o.className=J1,o.setAttribute("data-state","hidden"),Bv(o,n.props),e.appendChild(t),t.appendChild(o),r(n.props,n.props);function r(i,s){var l=bh(e),a=l.box,u=l.content,d=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)&&Bv(u,n.props),s.arrow?d?i.arrow!==s.arrow&&(a.removeChild(d),a.appendChild($v(s.arrow))):a.appendChild($v(s.arrow)):d&&a.removeChild(d)}return{popper:e,onUpdate:r}}rC.$$tippy=!0;var MI=1,rc=[],lp=[];function TI(n,e){var t=Ov(n,Object.assign({},wn,nC(Ev(e)))),o,r,i,s=!1,l=!1,a=!1,u=!1,d,f,p,h=[],m=Cv(_o,t.interactiveDebounce),g,y=MI++,b=null,v=iI(t.plugins),w={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},k={id:y,reference:n,popper:Tl(),popperInstance:b,props:t,state:w,plugins:v,clearDelayTimeouts:Ft,setProps:Kn,setContent:lo,show:Us,hide:Ws,hideWithInteractivity:ji,enable:en,disable:Lo,unmount:Ui,destroy:Wi};if(!t.render)return process.env.NODE_ENV!=="production"&&gh(!0,"render() function has not been supplied."),k;var x=t.render(k),C=x.popper,S=x.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+k.id,k.popper=C,n._tippy=k,C._tippy=k;var M=v.map(function(T){return T.fn(k)}),N=n.hasAttribute("aria-expanded");return it(),he(),W(),z("onCreate",[k]),t.showOnCreate&&so(),C.addEventListener("mouseenter",function(){k.props.interactive&&k.state.isVisible&&k.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){k.props.interactive&&k.props.trigger.indexOf("mouseenter")>=0&&R().addEventListener("mousemove",m)}),k;function O(){var T=k.props.touch;return Array.isArray(T)?T:[T,0]}function A(){return O()[0]==="hold"}function $(){var T;return!!((T=k.props.render)!=null&&T.$$tippy)}function D(){return g||n}function R(){var T=D().parentNode;return T?dI(T):document}function L(){return bh(C)}function B(T){return k.state.isMounted&&!k.state.isVisible||mo.isTouch||d&&d.type==="focus"?0:rp(k.props.delay,T?0:1,wn.delay)}function W(T){T===void 0&&(T=!1),C.style.pointerEvents=k.props.interactive&&!T?"":"none",C.style.zIndex=""+k.props.zIndex}function z(T,P,ee){if(ee===void 0&&(ee=!0),M.forEach(function(pe){pe[T]&&pe[T].apply(pe,P)}),ee){var be;(be=k.props)[T].apply(be,P)}}function U(){var T=k.props.aria;if(T.content){var P="aria-"+T.content,ee=C.id,be=ns(k.props.triggerTarget||n);be.forEach(function(pe){var ct=pe.getAttribute(P);if(k.state.isVisible)pe.setAttribute(P,ct?ct+" "+ee:ee);else{var Ot=ct&&ct.replace(ee,"").trim();Ot?pe.setAttribute(P,Ot):pe.removeAttribute(P)}})}}function he(){if(!(N||!k.props.aria.expanded)){var T=ns(k.props.triggerTarget||n);T.forEach(function(P){k.props.interactive?P.setAttribute("aria-expanded",k.state.isVisible&&P===D()?"true":"false"):P.removeAttribute("aria-expanded")})}}function Se(){R().removeEventListener("mousemove",m),rc=rc.filter(function(T){return T!==m})}function _e(T){if(!(mo.isTouch&&(a||T.type==="mousedown"))){var P=T.composedPath&&T.composedPath()[0]||T.target;if(!(k.props.interactive&&Tv(C,P))){if(ns(k.props.triggerTarget||n).some(function(ee){return Tv(ee,P)})){if(mo.isTouch||k.state.isVisible&&k.props.trigger.indexOf("click")>=0)return}else z("onClickOutside",[k,T]);k.props.hideOnClick===!0&&(k.clearDelayTimeouts(),k.hide(),l=!0,setTimeout(function(){l=!1}),k.state.isMounted||Fe())}}}function je(){a=!0}function He(){a=!1}function Ne(){var T=R();T.addEventListener("mousedown",_e,!0),T.addEventListener("touchend",_e,Qr),T.addEventListener("touchstart",He,Qr),T.addEventListener("touchmove",je,Qr)}function Fe(){var T=R();T.removeEventListener("mousedown",_e,!0),T.removeEventListener("touchend",_e,Qr),T.removeEventListener("touchstart",He,Qr),T.removeEventListener("touchmove",je,Qr)}function kt(T,P){Ee(T,function(){!k.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&P()})}function fe(T,P){Ee(T,P)}function Ee(T,P){var ee=L().box;function be(pe){pe.target===ee&&(sp(ee,"remove",be),P())}if(T===0)return P();sp(ee,"remove",f),sp(ee,"add",be),f=be}function Me(T,P,ee){ee===void 0&&(ee=!1);var be=ns(k.props.triggerTarget||n);be.forEach(function(pe){pe.addEventListener(T,P,ee),h.push({node:pe,eventType:T,handler:P,options:ee})})}function it(){A()&&(Me("touchstart",Do,{passive:!0}),Me("touchend",cr,{passive:!0})),rI(k.props.trigger).forEach(function(T){if(T!=="manual")switch(Me(T,Do),T){case"mouseenter":Me("mouseleave",cr);break;case"focus":Me(yI?"focusout":"blur",On);break;case"focusin":Me("focusout",On);break}})}function gn(){h.forEach(function(T){var P=T.node,ee=T.eventType,be=T.handler,pe=T.options;P.removeEventListener(ee,be,pe)}),h=[]}function Do(T){var P,ee=!1;if(!(!k.state.isEnabled||Io(T)||l)){var be=((P=d)==null?void 0:P.type)==="focus";d=T,g=T.currentTarget,he(),!k.state.isVisible&&aI(T)&&rc.forEach(function(pe){return pe(T)}),T.type==="click"&&(k.props.trigger.indexOf("mouseenter")<0||s)&&k.props.hideOnClick!==!1&&k.state.isVisible?ee=!0:so(T),T.type==="click"&&(s=!ee),ee&&!be&&bn(T)}}function _o(T){var P=T.target,ee=D().contains(P)||C.contains(P);if(!(T.type==="mousemove"&&ee)){var be=yn().concat(C).map(function(pe){var ct,Ot=pe._tippy,fr=(ct=Ot.popperInstance)==null?void 0:ct.state;return fr?{popperRect:pe.getBoundingClientRect(),popperState:fr,props:t}:null}).filter(Boolean);fI(be,T)&&(Se(),bn(T))}}function cr(T){var P=Io(T)||k.props.trigger.indexOf("click")>=0&&s;if(!P){if(k.props.interactive){k.hideWithInteractivity(T);return}bn(T)}}function On(T){k.props.trigger.indexOf("focusin")<0&&T.target!==D()||k.props.interactive&&T.relatedTarget&&C.contains(T.relatedTarget)||bn(T)}function Io(T){return mo.isTouch?A()!==T.type.indexOf("touch")>=0:!1}function ur(){dr();var T=k.props,P=T.popperOptions,ee=T.placement,be=T.offset,pe=T.getReferenceClientRect,ct=T.moveTransition,Ot=$()?bh(C).arrow:null,fr=pe?{getBoundingClientRect:pe,contextElement:pe.contextElement||D()}:n,qs={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(_){var j=_.state;if($()){var me=L(),Qe=me.box;["placement","reference-hidden","escaped"].forEach(function(qe){qe==="placement"?Qe.setAttribute("data-placement",j.placement):j.attributes.popper["data-popper-"+qe]?Qe.setAttribute("data-"+qe,""):Qe.removeAttribute("data-"+qe)}),j.attributes.popper={}}}},cn=[{name:"offset",options:{offset:be}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ct}},qs];$()&&Ot&&cn.push({name:"arrow",options:{element:Ot,padding:3}}),cn.push.apply(cn,(P==null?void 0:P.modifiers)||[]),k.popperInstance=Z_(fr,C,Object.assign({},P,{placement:ee,onFirstUpdate:p,modifiers:cn}))}function dr(){k.popperInstance&&(k.popperInstance.destroy(),k.popperInstance=null)}function Ht(){var T=k.props.appendTo,P,ee=D();k.props.interactive&&T===Y1||T==="parent"?P=ee.parentNode:P=Q1(T,[ee]),P.contains(C)||P.appendChild(C),k.state.isMounted=!0,ur(),process.env.NODE_ENV!=="production"&&qo(k.props.interactive&&T===wn.appendTo&&ee.nextElementSibling!==C,["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 dc=function(){return"innerHTML"};function tn(t,o){t[dc()]=o}function nr(t){var o=qt();return t===!0?o.className=Ur:(o.className=Wr,Gt(t)?o.appendChild(t):tn(o,t)),o}function rr(t,o){Gt(o.content)?(tn(t,""),t.appendChild(o.content)):typeof o.content!="function"&&(o.allowHTML?tn(t,o.content):t.textContent=o.content)}function on(t){var o=t.firstElementChild,n=ko(o.children);return{box:o,content:n.find(function(r){return r.classList.contains(Hr)}),arrow:n.find(function(r){return r.classList.contains(Ur)||r.classList.contains(Wr)}),backdrop:n.find(function(r){return r.classList.contains(Fi)})}}function el(t){var o=qt(),n=qt();n.className=ji,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=qt();r.className=Hr,r.setAttribute("data-state","hidden"),rr(r,t.props),o.appendChild(n),n.appendChild(r),l(t.props,t.props);function l(a,i){var s=on(o),c=s.box,d=s.content,u=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)&&rr(d,t.props),i.arrow?u?a.arrow!==i.arrow&&(c.removeChild(u),c.appendChild(nr(i.arrow))):c.appendChild(nr(i.arrow)):u&&c.removeChild(u)}return{popper:o,onUpdate:l}}el.$$tippy=!0;var pc=1,po=[],Go=[];function fc(t,o){var n=or(t,Object.assign({},ke,Zr(Jn(o)))),r,l,a,i=!1,s=!1,c=!1,d=!1,u,p,f,m=[],b=Kn(ot,n.interactiveDebounce),g,k=pc++,w=null,h=Ui(n.plugins),x={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:k,reference:t,popper:qt(),popperInstance:w,props:n,state:x,plugins:h,clearDelayTimeouts:qe,setProps:Ct,setContent:lt,show:jo,hide:Fo,hideWithInteractivity:lo,enable:rt,disable:xt,unmount:ao,destroy:io};if(!n.render)return process.env.NODE_ENV!=="production"&&en(!0,"render() function has not been supplied."),v;var _=n.render(v),C=_.popper,O=_.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+v.id,v.popper=C,t._tippy=v,C._tippy=v;var M=h.map(function(y){return y.fn(v)}),A=t.hasAttribute("aria-expanded");return le(),K(),G(),I("onCreate",[v]),n.showOnCreate&&Xe(),C.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&$().addEventListener("mousemove",b)}),v;function T(){var y=v.props.touch;return Array.isArray(y)?y:[y,0]}function z(){return T()[0]==="hold"}function V(){var y;return!!((y=v.props.render)!=null&&y.$$tippy)}function N(){return g||t}function $(){var y=N().parentNode;return y?Ji(y):document}function L(){return on(C)}function q(y){return v.state.isMounted&&!v.state.isVisible||Le.isTouch||u&&u.type==="focus"?0:Uo(v.props.delay,y?0:1,ke.delay)}function G(y){y===void 0&&(y=!1),C.style.pointerEvents=v.props.interactive&&!y?"":"none",C.style.zIndex=""+v.props.zIndex}function I(y,B,D){if(D===void 0&&(D=!0),M.forEach(function(F){F[y]&&F[y].apply(F,B)}),D){var W;(W=v.props)[y].apply(W,B)}}function S(){var y=v.props.aria;if(y.content){var B="aria-"+y.content,D=C.id,W=Et(v.props.triggerTarget||t);W.forEach(function(F){var se=F.getAttribute(B);if(v.state.isVisible)F.setAttribute(B,se?se+" "+D:D);else{var ve=se&&se.replace(D,"").trim();ve?F.setAttribute(B,ve):F.removeAttribute(B)}})}}function K(){if(!(A||!v.props.aria.expanded)){var y=Et(v.props.triggerTarget||t);y.forEach(function(B){v.props.interactive?B.setAttribute("aria-expanded",v.state.isVisible&&B===N()?"true":"false"):B.removeAttribute("aria-expanded")})}}function Q(){$().removeEventListener("mousemove",b),po=po.filter(function(y){return y!==b})}function de(y){if(!(Le.isTouch&&(c||y.type==="mousedown"))){var B=y.composedPath&&y.composedPath()[0]||y.target;if(!(v.props.interactive&&Qn(C,B))){if(Et(v.props.triggerTarget||t).some(function(D){return Qn(D,B)})){if(Le.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else I("onClickOutside",[v,y]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),s=!0,setTimeout(function(){s=!1}),v.state.isMounted||re())}}}function me(){c=!0}function ce(){c=!1}function ne(){var y=$();y.addEventListener("mousedown",de,!0),y.addEventListener("touchend",de,it),y.addEventListener("touchstart",ce,it),y.addEventListener("touchmove",me,it)}function re(){var y=$();y.removeEventListener("mousedown",de,!0),y.removeEventListener("touchend",de,it),y.removeEventListener("touchstart",ce,it),y.removeEventListener("touchmove",me,it)}function _e(y,B){Y(y,function(){!v.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&B()})}function j(y,B){Y(y,B)}function Y(y,B){var D=L().box;function W(F){F.target===D&&(Yo(D,"remove",W),B())}if(y===0)return B();Yo(D,"remove",p),Yo(D,"add",W),p=W}function J(y,B,D){D===void 0&&(D=!1);var W=Et(v.props.triggerTarget||t);W.forEach(function(F){F.addEventListener(y,B,D),m.push({node:F,eventType:y,handler:B,options:D})})}function le(){z()&&(J("touchstart",tt,{passive:!0}),J("touchend",kt,{passive:!0})),Hi(v.props.trigger).forEach(function(y){if(y!=="manual")switch(J(y,tt),y){case"mouseenter":J("mouseleave",kt);break;case"focus":J(nc?"focusout":"blur",De);break;case"focusin":J("focusout",De);break}})}function Se(){m.forEach(function(y){var B=y.node,D=y.eventType,W=y.handler,F=y.options;B.removeEventListener(D,W,F)}),m=[]}function tt(y){var B,D=!1;if(!(!v.state.isEnabled||nt(y)||s)){var W=((B=u)==null?void 0:B.type)==="focus";u=y,g=y.currentTarget,K(),!v.state.isVisible&&Gi(y)&&po.forEach(function(F){return F(y)}),y.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||i)&&v.props.hideOnClick!==!1&&v.state.isVisible?D=!0:Xe(y),y.type==="click"&&(i=!D),D&&!W&&Me(y)}}function ot(y){var B=y.target,D=N().contains(B)||C.contains(B);if(!(y.type==="mousemove"&&D)){var W=Oe().concat(C).map(function(F){var se,ve=F._tippy,_t=(se=ve.popperInstance)==null?void 0:se.state;return _t?{popperRect:F.getBoundingClientRect(),popperState:_t,props:n}:null}).filter(Boolean);Zi(W,y)&&(Q(),Me(y))}}function kt(y){var B=nt(y)||v.props.trigger.indexOf("click")>=0&&i;if(!B){if(v.props.interactive){v.hideWithInteractivity(y);return}Me(y)}}function De(y){v.props.trigger.indexOf("focusin")<0&&y.target!==N()||v.props.interactive&&y.relatedTarget&&C.contains(y.relatedTarget)||Me(y)}function nt(y){return Le.isTouch?z()!==y.type.indexOf("touch")>=0:!1}function yt(){wt();var y=v.props,B=y.popperOptions,D=y.placement,W=y.offset,F=y.getReferenceClientRect,se=y.moveTransition,ve=V()?on(C).arrow:null,_t=F?{getBoundingClientRect:F,contextElement:F.contextElement||N()}:t,Pn={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(co){var Bt=co.state;if(V()){var va=L(),qo=va.box;["placement","reference-hidden","escaped"].forEach(function(so){so==="placement"?qo.setAttribute("data-placement",Bt.placement):Bt.attributes.popper["data-popper-"+so]?qo.setAttribute("data-"+so,""):qo.removeAttribute("data-"+so)}),Bt.attributes.popper={}}}},at=[{name:"offset",options:{offset:W}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!se}},Pn];V()&&ve&&at.push({name:"arrow",options:{element:ve,padding:3}}),at.push.apply(at,(B==null?void 0:B.modifiers)||[]),v.popperInstance=Ii(_t,C,Object.assign({},B,{placement:D,onFirstUpdate:f,modifiers:at}))}function wt(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function he(){var y=v.props.appendTo,B,D=N();v.props.interactive&&y===Yr||y==="parent"?B=D.parentNode:B=Gr(y,[D]),B.contains(C)||B.appendChild(C),v.state.isMounted=!0,yt(),process.env.NODE_ENV!=="production"&&He(v.props.interactive&&y===ke.appendTo&&D.nextElementSibling!==C,["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 yn(){return Pu(C.querySelectorAll("[data-tippy-root]"))}function so(T){k.clearDelayTimeouts(),T&&z("onTrigger",[k,T]),Ne();var P=B(!0),ee=O(),be=ee[0],pe=ee[1];mo.isTouch&&be==="hold"&&pe&&(P=pe),P?o=setTimeout(function(){k.show()},P):k.show()}function bn(T){if(k.clearDelayTimeouts(),z("onUntrigger",[k,T]),!k.state.isVisible){Fe();return}if(!(k.props.trigger.indexOf("mouseenter")>=0&&k.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(T.type)>=0&&s)){var P=B(!1);P?r=setTimeout(function(){k.state.isVisible&&k.hide()},P):i=requestAnimationFrame(function(){k.hide()})}}function en(){k.state.isEnabled=!0}function Lo(){k.hide(),k.state.isEnabled=!1}function Ft(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function Kn(T){if(process.env.NODE_ENV!=="production"&&qo(k.state.isDestroyed,Ji("setProps")),!k.state.isDestroyed){z("onBeforeUpdate",[k,T]),gn();var P=k.props,ee=Ov(n,Object.assign({},P,Ev(T),{ignoreAttributes:!0}));k.props=ee,it(),P.interactiveDebounce!==ee.interactiveDebounce&&(Se(),m=Cv(_o,ee.interactiveDebounce)),P.triggerTarget&&!ee.triggerTarget?ns(P.triggerTarget).forEach(function(be){be.removeAttribute("aria-expanded")}):ee.triggerTarget&&n.removeAttribute("aria-expanded"),he(),W(),S&&S(P,ee),k.popperInstance&&(ur(),yn().forEach(function(be){requestAnimationFrame(be._tippy.popperInstance.forceUpdate)})),z("onAfterUpdate",[k,T])}}function lo(T){k.setProps({content:T})}function Us(){process.env.NODE_ENV!=="production"&&qo(k.state.isDestroyed,Ji("show"));var T=k.state.isVisible,P=k.state.isDestroyed,ee=!k.state.isEnabled,be=mo.isTouch&&!k.props.touch,pe=rp(k.props.duration,0,wn.duration);if(!(T||P||ee||be)&&!D().hasAttribute("disabled")&&(z("onShow",[k],!1),k.props.onShow(k)!==!1)){if(k.state.isVisible=!0,$()&&(C.style.visibility="visible"),W(),Ne(),k.state.isMounted||(C.style.transition="none"),$()){var ct=L(),Ot=ct.box,fr=ct.content;ip([Ot,fr],0)}p=function(){var cn;if(!(!k.state.isVisible||u)){if(u=!0,C.offsetHeight,C.style.transition=k.props.moveTransition,$()&&k.props.animation){var E=L(),_=E.box,j=E.content;ip([_,j],pe),Mv([_,j],"visible")}U(),he(),Sv(lp,k),(cn=k.popperInstance)==null||cn.forceUpdate(),z("onMount",[k]),k.props.animation&&$()&&fe(pe,function(){k.state.isShown=!0,z("onShown",[k])})}},Ht()}}function Ws(){process.env.NODE_ENV!=="production"&&qo(k.state.isDestroyed,Ji("hide"));var T=!k.state.isVisible,P=k.state.isDestroyed,ee=!k.state.isEnabled,be=rp(k.props.duration,1,wn.duration);if(!(T||P||ee)&&(z("onHide",[k],!1),k.props.onHide(k)!==!1)){if(k.state.isVisible=!1,k.state.isShown=!1,u=!1,s=!1,$()&&(C.style.visibility="hidden"),Se(),Fe(),W(!0),$()){var pe=L(),ct=pe.box,Ot=pe.content;k.props.animation&&(ip([ct,Ot],be),Mv([ct,Ot],"hidden"))}U(),he(),k.props.animation?$()&&kt(be,k.unmount):k.unmount()}}function ji(T){process.env.NODE_ENV!=="production"&&qo(k.state.isDestroyed,Ji("hideWithInteractivity")),R().addEventListener("mousemove",m),Sv(rc,m),m(T)}function Ui(){process.env.NODE_ENV!=="production"&&qo(k.state.isDestroyed,Ji("unmount")),k.state.isVisible&&k.hide(),k.state.isMounted&&(dr(),yn().forEach(function(T){T._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),lp=lp.filter(function(T){return T!==k}),k.state.isMounted=!1,z("onHidden",[k]))}function Wi(){process.env.NODE_ENV!=="production"&&qo(k.state.isDestroyed,Ji("destroy")),!k.state.isDestroyed&&(k.clearDelayTimeouts(),k.unmount(),gn(),delete n._tippy,k.state.isDestroyed=!0,z("onDestroy",[k]))}}function ir(n,e){e===void 0&&(e={});var t=wn.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(kI(n),oC(e,t)),mI();var o=Object.assign({},e,{plugins:t}),r=uI(n);if(process.env.NODE_ENV!=="production"){var i=Gl(o.content),s=r.length>1;qo(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 Oe(){return ko(C.querySelectorAll("[data-tippy-root]"))}function Xe(y){v.clearDelayTimeouts(),y&&I("onTrigger",[v,y]),ne();var B=q(!0),D=T(),W=D[0],F=D[1];Le.isTouch&&W==="hold"&&F&&(B=F),B?r=setTimeout(function(){v.show()},B):v.show()}function Me(y){if(v.clearDelayTimeouts(),I("onUntrigger",[v,y]),!v.state.isVisible){re();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(y.type)>=0&&i)){var B=q(!1);B?l=setTimeout(function(){v.state.isVisible&&v.hide()},B):a=requestAnimationFrame(function(){v.hide()})}}function rt(){v.state.isEnabled=!0}function xt(){v.hide(),v.state.isEnabled=!1}function qe(){clearTimeout(r),clearTimeout(l),cancelAnimationFrame(a)}function Ct(y){if(process.env.NODE_ENV!=="production"&&He(v.state.isDestroyed,Vt("setProps")),!v.state.isDestroyed){I("onBeforeUpdate",[v,y]),Se();var B=v.props,D=or(t,Object.assign({},B,Jn(y),{ignoreAttributes:!0}));v.props=D,le(),B.interactiveDebounce!==D.interactiveDebounce&&(Q(),b=Kn(ot,D.interactiveDebounce)),B.triggerTarget&&!D.triggerTarget?Et(B.triggerTarget).forEach(function(W){W.removeAttribute("aria-expanded")}):D.triggerTarget&&t.removeAttribute("aria-expanded"),K(),G(),O&&O(B,D),v.popperInstance&&(yt(),Oe().forEach(function(W){requestAnimationFrame(W._tippy.popperInstance.forceUpdate)})),I("onAfterUpdate",[v,y])}}function lt(y){v.setProps({content:y})}function jo(){process.env.NODE_ENV!=="production"&&He(v.state.isDestroyed,Vt("show"));var y=v.state.isVisible,B=v.state.isDestroyed,D=!v.state.isEnabled,W=Le.isTouch&&!v.props.touch,F=Uo(v.props.duration,0,ke.duration);if(!(y||B||D||W)&&!N().hasAttribute("disabled")&&(I("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,V()&&(C.style.visibility="visible"),G(),ne(),v.state.isMounted||(C.style.transition="none"),V()){var se=L(),ve=se.box,_t=se.content;Wo([ve,_t],0)}f=function(){var at;if(!(!v.state.isVisible||d)){if(d=!0,C.offsetHeight,C.style.transition=v.props.moveTransition,V()&&v.props.animation){var zo=L(),co=zo.box,Bt=zo.content;Wo([co,Bt],F),Zn([co,Bt],"visible")}S(),K(),Xn(Go,v),(at=v.popperInstance)==null||at.forceUpdate(),I("onMount",[v]),v.props.animation&&V()&&j(F,function(){v.state.isShown=!0,I("onShown",[v])})}},he()}}function Fo(){process.env.NODE_ENV!=="production"&&He(v.state.isDestroyed,Vt("hide"));var y=!v.state.isVisible,B=v.state.isDestroyed,D=!v.state.isEnabled,W=Uo(v.props.duration,1,ke.duration);if(!(y||B||D)&&(I("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,d=!1,i=!1,V()&&(C.style.visibility="hidden"),Q(),re(),G(!0),V()){var F=L(),se=F.box,ve=F.content;v.props.animation&&(Wo([se,ve],W),Zn([se,ve],"hidden"))}S(),K(),v.props.animation?V()&&_e(W,v.unmount):v.unmount()}}function lo(y){process.env.NODE_ENV!=="production"&&He(v.state.isDestroyed,Vt("hideWithInteractivity")),$().addEventListener("mousemove",b),Xn(po,b),b(y)}function ao(){process.env.NODE_ENV!=="production"&&He(v.state.isDestroyed,Vt("unmount")),v.state.isVisible&&v.hide(),v.state.isMounted&&(wt(),Oe().forEach(function(y){y._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),Go=Go.filter(function(y){return y!==v}),v.state.isMounted=!1,I("onHidden",[v]))}function io(){process.env.NODE_ENV!=="production"&&He(v.state.isDestroyed,Vt("destroy")),!v.state.isDestroyed&&(v.clearDelayTimeouts(),v.unmount(),Se(),delete t._tippy,v.state.isDestroyed=!0,I("onDestroy",[v]))}}function Ge(t,o){o===void 0&&(o={});var n=ke.plugins.concat(o.plugins||[]);process.env.NODE_ENV!=="production"&&(ac(t),Qr(o,n)),tc();var r=Object.assign({},o,{plugins:n}),l=Xi(t);if(process.env.NODE_ENV!=="production"){var a=Gt(r.content),i=l.length>1;He(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,u){var d=u&&TI(u,o);return d&&a.push(d),a},[]);return Gl(n)?l[0]:l}ir.defaultProps=wn;ir.setDefaultProps=CI;ir.currentInput=mo;Object.assign({},z1,{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)}});ir.setDefaultProps({render:rC});const NI=new ON({breaks:!0});function Tg(){return{md:NI}}function qd(){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),u=document.createElement("a");u.href=a,u.download=r,u.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 iC(){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 ue(){const n=c.inject("locale",{value:"en"}),e=c.computed(()=>$N.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 vh,kh;if(typeof WeakMap<"u"){let n=new WeakMap;vh=e=>n.get(e),kh=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;vh=o=>{for(let r=0;r<n.length;r+=2)if(n[r]==o)return n[r+1]},kh=(o,r)=>(t==10&&(t=0),n[t++]=o,n[t++]=r)}var ot=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:u}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,u)}}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 vh(n)||kh(n,AI(n))}};function AI(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=OI(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*t;u<d;u++)o[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;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:v}=g.attrs;for(let w=0;w<b;w++){if(w+u>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-w});break}const k=r+w*e;for(let x=0;x<y;x++){o[k+x]==0?o[k+x]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:y-x});const C=v&&v[x];if(C){const S=(k+x)%e*2,M=s[S];M==null||M!=C&&s[S+1]==1?(s[S]=C,s[S+1]=1):M==C&&s[S+1]++}}}r+=y,d+=g.nodeSize}const p=(u+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new ot(e,t,o,i);let a=!1;for(let u=0;!a&&u<s.length;u+=2)s[u]!=null&&s[u+1]<t&&(a=!0);return a&&$I(l,s,n),l}function OI(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 u=l.child(a);s+u.attrs.rowspan>o&&(i+=u.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 $I(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 u=0;u<a.colspan;u++){const d=e[(r+u)%n.width*2];d!=null&&(!a.colwidth||a.colwidth[u]!=d)&&((l||(l=BI(a)))[u]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function BI(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Jt(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 Cr=new le("selectingCells");function Mi(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 RI(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 oo(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 Kd(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=Mi(e.$head)||DI(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function DI(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 wh(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function _I(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Ng(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function sC(n,e,t){const o=n.node(-1),r=ot.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 Ti(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 lC(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 II(n,e,t){const o=Jt(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 jo extends ie{constructor(e,t=e){const o=e.node(-1),r=ot.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(d=>d!=t.pos-i);a.unshift(t.pos-i);const u=a.map(d=>{const f=o.nodeAt(d);if(!f)throw new RangeError(`No cell with offset ${d} found`);const p=i+d+1;return new k0(l.resolve(p),l.resolve(p+f.content.size))});super(u[0].$from,u[0].$to,u),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(wh(o)&&wh(r)&&Ng(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?jo.rowSelection(o,r):i&&this.isColSelection()?jo.colSelection(o,r):new jo(o,r)}return q.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=ot.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 u=[];for(let d=a*t.width+r.left,f=r.left;f<r.right;f++,d++){const p=t.map[d];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=Ti(b,0,g)),y>0&&(b=Ti(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)}u.push(m)}s.push(e.child(a).copy(I.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new F(I.from(l),1,1)}replace(e,t=F.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(a.pos),s?F.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 F(I.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=ot.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=ot.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 jo(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=ot.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 jo&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),r=ot.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 jo(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new jo(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new jo(e.resolve(t),e.resolve(o))}getBookmark(){return new LI(this.$anchorCell.pos,this.$headCell.pos)}};Pe.prototype.visible=!1;ie.jsonID("cell",Pe);var LI=class aC{constructor(e,t){this.anchor=e,this.head=t}map(e){return new aC(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&&Ng(t,o)?new Pe(t,o):ie.near(o,1)}};function PI(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"}))}),xe.create(n.doc,e)}function VI({$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 zI({$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 HI(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=ot.get(o.node),a=o.from+1,u=a+l.map[l.width*l.height-1];i=Pe.create(r,a+1,u)}}else o instanceof q&&VI(o)?i=q.create(r,o.from):o instanceof q&&zI(o)&&(i=q.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const FI=new le("fix-tables");function cC(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 u=l,d=Math.min(r,s+3);u<d;u++)if(n.child(u)==a){l=u+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?cC(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function uC(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=jI(n,r,i,t))};return e?e.doc!=n.doc&&cC(e.doc,n.doc,0,o):n.doc.descendants(o),t}function jI(n,e,t,o){const r=ot.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 u=r.problems[a];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const f=d.attrs;for(let p=0;p<f.rowspan;p++)i[u.row+p]+=u.n;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,Ti(f,f.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(t);o.delete(d,d+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,u=t+1;a<r.height;a++){const d=e.child(a),f=u+d.nodeSize,p=i[a];if(p>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=Jt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?u+1:f-1;o.insert(o.mapping.map(g),m)}u=f}return o.setMeta(FI,{fixTables:!0})}function $o(n){const e=n.selection,t=Kd(n),o=t.node(-1),r=t.start(-1),i=ot.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 dC(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;II(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],u=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,lC(u.attrs,r-e.colCount(a))),s+=u.attrs.rowspan-1}else{const a=i==null?Jt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);n.insert(n.mapping.map(t+u),a.createAndFill())}}return n}function UI(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e(dC(n.tr,t,t.left))}return!0}function WI(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e(dC(n.tr,t,t.right))}return!0}function qI(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],u=t.nodeAt(a),d=u.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,Ti(d,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+u.nodeSize)}s+=d.rowspan}}function KI(n,e){if(!oo(n))return!1;if(e){const t=$o(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;qI(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=ot.get(i)}e(o)}return!0}function JI(n,e,t){var o;const r=Jt(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 fC(n,{map:e,tableStart:t,table:o},r){let i=t;for(let u=0;u<r;u++)i+=o.child(u).nodeSize;const s=[];let l=r>0?-1:0;JI(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const f=e.map[d],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),u+=p.colspan-1}else{var a;const f=l==null?Jt(o.type.schema).cell:(a=o.nodeAt(e.map[d+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,Jt(o.type.schema).row.create(null,s)),n}function GI(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e(fC(n.tr,t,t.top))}return!0}function XI(n,e){if(!oo(n))return!1;if(e){const t=$o(n);e(fC(n.tr,t,t.bottom))}return!0}function YI(n,{map:e,table:t,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=t.child(u).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 u=0,d=r*e.width;u<e.width;u++,d++){const f=e.map[d];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[d-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),u+=p.colspan-1}else if(r<e.height&&f==e.map[d+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,u,t);n.insert(n.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function QI(n,e){if(!oo(n))return!1;if(e){const t=$o(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;YI(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=ot.get(t.table)}e(o)}return!0}function Rv(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function ZI({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 Dv(n,e){const t=n.selection;if(!(t instanceof Pe)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=$o(n),{map:r}=o;if(ZI(r,o))return!1;if(e){const i=n.tr,s={};let l=I.empty,a,u;for(let d=o.top;d<o.bottom;d++)for(let f=o.left;f<o.right;f++){const p=r.map[d*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,u=h;else{Rv(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||u==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...lC(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const d=a+1+u.content.size,f=Rv(u)?a+1:d;i.replaceWith(f+o.tableStart,d+o.tableStart,l)}i.setSelection(new Pe(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function _v(n,e){const t=Jt(n.schema);return eL(({node:o})=>t[o.type.spec.tableRole])(n,e)}function eL(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=RI(o.$from),!r)return!1;i=(s=Mi(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=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=$o(e),f=e.tr;for(let h=0;h<d.right-d.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let p;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=r.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&h==d.top||f.insert(p=f.mapping.map(m+d.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:d.top,col:d.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 tL(n,e){return function(t,o){if(!oo(t))return!1;const r=Kd(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 nL(n){return function(e,t){if(!oo(e))return!1;if(t){const o=Jt(e.schema),r=$o(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 Iv(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 Yl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?nL(n):function(t,o){if(!oo(t))return!1;if(o){const r=Jt(t.schema),i=$o(t),s=t.tr,l=Iv("row",i,r),a=Iv("column",i,r),u=(n==="column"?l:n==="row"&&a)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,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(d).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}Yl("row",{useDeprecatedLogic:!0});Yl("column",{useDeprecatedLogic:!0});const oL=Yl("cell",{useDeprecatedLogic:!0});function rL(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 Lv(n){return function(e,t){if(!oo(e))return!1;const o=rL(Kd(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(q.between(r,_I(r))).scrollIntoView())}return!0}}function iL(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 ic(n,e){const t=n.selection;if(!(t instanceof Pe))return!1;if(e){const o=n.tr,r=Jt(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 F(r,0,0))}),o.docChanged&&e(o)}return!0}function sL(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 u=e.child(a).content;const d=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(d||f)&&(u=xh(Jt(s).row,new F(u,d,f)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(t||o?xh(Jt(s).row,new F(e,t,o)).content:e);else return null;return lL(s,l)}function lL(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 u=r;u<r+l;u++)t[u]=(t[u]||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(I.empty),t[r]<o){const i=Jt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(I.from(s))}return{height:e.length,width:o,rows:e}}function xh(n,e){const t=n.createAndFill();return new wm(t).replace(0,t.content.size,e).doc}function aL({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],u=[];for(let d=i[l]||0,f=0;d<o;f++){let p=a.child(f%a.childCount);d+p.attrs.colspan>o&&(p=p.type.createChecked(Ti(p.attrs,p.attrs.colspan,d+p.attrs.colspan-o),p.content)),u.push(p),d+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(I.from(u))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],u=t[l%e];for(let d=0;d<u.childCount;d++){let f=u.child(d);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(I.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function cL(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=Jt(l);let u,d;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=u||(u=a.cell.createAndFill()):g=d||(d=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?d||(d=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const p=a.row.create(null,I.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!!(u||d)}function Pv(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let u=r;u<i;u++){const d=s*e.width+u,f=e.map[d];if(e.map[d-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})),u+=p.attrs.colspan-1}}return a}function Vv(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let u=r;u<i;u++){const d=u*e.width+s,f=e.map[d];if(e.map[d-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,Ti(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(Ti(p.attrs,0,s-h))),u+=p.attrs.rowspan-1}}return a}function zv(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=ot.get(i);const{top:l,left:a}=o,u=a+r.width,d=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=ot.get(i),p=f.mapping.maps.length}cL(f,s,i,t,u,d,p)&&h(),Pv(f,s,i,t,a,u,l,p)&&h(),Pv(f,s,i,t,a,u,d,p)&&h(),Vv(f,s,i,t,l,d,a,p)&&h(),Vv(f,s,i,t,l,d,u,p)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,u,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new F(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(d-1,u-1,i)))),e(f)}const uL=Pm({ArrowLeft:sc("horiz",-1),ArrowRight:sc("horiz",1),ArrowUp:sc("vert",-1),ArrowDown:sc("vert",1),"Shift-ArrowLeft":lc("horiz",-1),"Shift-ArrowRight":lc("horiz",1),"Shift-ArrowUp":lc("vert",-1),"Shift-ArrowDown":lc("vert",1),Backspace:ic,"Mod-Backspace":ic,Delete:ic,"Mod-Delete":ic});function Oc(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function sc(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof Pe)return Oc(t,o,ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=pC(r,n,e);if(s==null)return!1;if(n=="horiz")return Oc(t,o,ie.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=sC(l,n,e);let u;return a?u=ie.near(a,1):e<0?u=ie.near(t.doc.resolve(l.before(-1)),-1):u=ie.near(t.doc.resolve(l.after(-1)),1),Oc(t,o,u)}}}function lc(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=pC(r,n,e);if(a==null)return!1;s=new Pe(t.doc.resolve(a))}const l=sC(s.$headCell,n,e);return l?Oc(t,o,new Pe(s.$anchorCell,l)):!1}}function dL(n,e){const t=n.state.doc,o=Mi(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Pe(o))),!0):!1}function fL(n,e,t){if(!oo(n.state))return!1;let o=sL(t);const r=n.state.selection;if(r instanceof Pe){o||(o={width:1,height:1,rows:[I.from(xh(Jt(n.state.schema).cell,t))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=ot.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=aL(o,l.right-l.left,l.bottom-l.top),zv(n.state,n.dispatch,s,l,o),!0}else if(o){const i=Kd(n.state),s=i.start(-1);return zv(n.state,n.dispatch,s,ot.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function pL(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=Hv(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=Mi(n.state.selection.$anchor))!=null&&((t=ap(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,u){let d=ap(n,u);const f=Cr.getState(n.state)==null;if(!d||!Ng(a,d))if(f)d=a;else return;const p=new Pe(a,d);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(Cr,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Cr.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Cr,-1))}function l(a){const u=a,d=Cr.getState(n.state);let f;if(d!=null)f=n.state.doc.resolve(d);else if(Hv(n,u.target)!=o&&(f=ap(n,e),!f))return s();f&&i(f,u)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function pC(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 Hv(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ap(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&&Mi(n.state.doc.resolve(o))||Mi(n.state.doc.resolve(r))}var hL=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")),Ch(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,Ch(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Ch(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.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 v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;a;){var d;const f=a.nextSibling;(d=a.parentNode)===null||d===void 0||d.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const xn=new le("tableColumnResizing");function mL({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=hL,lastColumnResizable:r=!0}={}){const i=new ce({key:xn,state:{init(s,l){var a;const u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,d=Jt(l.schema).table.name;return o&&u&&(u[d]=(f,p)=>new o(f,t,p)),new gL(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=xn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{yL(s,l,n,r)},mouseleave:s=>{bL(s)},mousedown:(s,l)=>{vL(s,l,e,t)}},decorations:s=>{const l=xn.getState(s);if(l&&l.activeHandle>-1)return SL(s,l.activeHandle)},nodeViews:{}}});return i}var gL=class $c{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(xn);if(o&&o.setHandle!=null)return new $c(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new $c(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return wh(e.doc.resolve(r))||(r=-1),new $c(r,t.dragging)}return t}};function yL(n,e,t,o){if(!n.editable)return;const r=xn.getState(n.state);if(r&&!r.dragging){const i=wL(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=Fv(n,e,"left",t):a-e.clientX<=t&&(s=Fv(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),u=ot.get(a),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}hC(n,s)}}}function bL(n){if(!n.editable)return;const e=xn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&hC(n,-1)}function vL(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=xn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=kL(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(xn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(f){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const p=xn.getState(n.state);p!=null&&p.dragging&&(xL(n,p.activeHandle,jv(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(xn,{setDragging:null})))}function d(f){if(!f.which)return u(f);const p=xn.getState(n.state);if(p&&p.dragging){const h=jv(p.dragging,f,t);Uv(n,p.activeHandle,h,o)}}return Uv(n,s.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function kL(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 wL(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Fv(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=Mi(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=ot.get(l.node(-1)),u=l.start(-1),d=a.map.indexOf(l.pos-u);return d%a.width==0?-1:u+a.map[d-1]}function jv(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function hC(n,e){n.dispatch(n.state.tr.setMeta(xn,{setHandle:e}))}function xL(n,e,t){const o=n.state.doc.resolve(e),r=o.node(-1),i=ot.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const f=i.map[d],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():CL(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function Uv(n,e,t,o){const r=n.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=ot.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&&Ch(i,a.firstChild,a,o,l,t)}function CL(n){return Array(n).fill(0)}function SL(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return xe.empty;const i=ot.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){const d=l+u*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(u==0||i.map[d]!=i.map[d-i.width])){var a;const f=i.map[d],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=xn.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 xe.create(n.doc,t)}function EL({allowTableNodeSelection:n=!1}={}){return new ce({key:Cr,state:{init(){return null},apply(e,t){const o=e.getMeta(Cr);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:PI,handleDOMEvents:{mousedown:pL},createSelectionBetween(e){return Cr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:dL,handleKeyDown:uL,handlePaste:fL},appendTransaction(e,t,o){return HI(o,uC(o,t),n)}})}/**
166
- * Copyright 2026 Yiitap
167
- * @license MIT
168
- **/const Jo=new le("inlinePlaceholder"),mC=ye.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=Jo.getState(n))!=null&&l.active||!r?null:(e.descendants((a,u)=>{const d=i>=u&&i<=u+a.nodeSize,f=!a.isLeaf&&!a.childCount,p=this.options.showOnlyCurrent;if((d||!p)&&f){const h=[this.options.emptyNodeClass];this.editor.isEmpty&&h.push(this.options.emptyEditorClass);const m=ze.node(u,u+a.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:u,hasAnchor:d}):this.options.placeholder});s.push(m)}return this.options.includeChildren}),xe.create(e,s))}}}),new ce({key:Jo,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(Jo);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=Jo.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 xe.create(n.doc,[t])}},view:()=>({destroy:this.options.onHideInline})})]}}),Jd=[{type:"paragraph",content:[]}],ML={type:"aiBlock",content:Jd},TL={type:"audio",attrs:{src:"//init.mp3"}},NL={type:"blockquote",content:Jd},AL={type:"callout",attrs:{icon:"💡"},content:Jd},OL={type:"codeBlock",attrs:{attrs:{language:"shell"}},content:[]},$L={type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:Jd}]},gC={type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
169
- Mermaid --> Diagram`}]},BL={type:"paragraph",content:[{type:"text",text:":"}]},RL={type:"image",attrs:{src:"init"}},DL=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],_L={type:"table",content:Array.from({length:3},()=>({type:"tableRow",content:Array.from({length:3},()=>({type:"tableCell",content:[{type:"paragraph"}]}))}))},IL=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],LL={type:"video",attrs:{src:"init"}};function we(){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(),u=i==null?void 0:i.commands;switch(s){case"inlineMath":o(i);break;default:t(u,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(gC);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,d=l.domAtPos(a).node.getBoundingClientRect(),f=s.tr.setMeta(Jo,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:a,rect:d}}).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 Ag(){const{tr:n}=ue(),{isEditable:e,run:t}=we(),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 x;const{state:h}=o.value.editor,m=(x=o.value)==null?void 0:x.getPos(),g=h.doc.resolve(m);let y=null,b=-1;for(let C=g.depth;C>0;C--)if(g.node(C).type.name==="table"){y=g.node(C),b=g.before(C);break}if(!y)return{rowIndex:-1,colIndex:-1};const v=ot.get(y),w=m-b-1,k=v.findCell(w);return{rowIndex:k.top,colIndex:k.left}});function u(h){o.value=h}function d(){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":d();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:u,selectColumn:d,selectRow:f,runCommand:p}}function Vi(){const n=c.inject("darkMode",{value:!1}),e=c.computed(()=>n.value?"dark":"light");return{darkMode:n,theme:e}}const Tn=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}=Vi(),o=c.ref(),r=c.ref(),i=c.ref();function s(){i.value=ir(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,u)=>(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))}}),Ae=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(Tn,{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(G,{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"]))}}),PL=c.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const e=n,{run:t}=we(),{tr:o}=ue(),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 u;return c.openBlock(),c.createBlock(Ae,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(u=n.editor)==null?void 0:u.isActive(n.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),Og=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}=ue(),{run:o}=we(),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(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createBlock(c.unref(vt),{key:d,class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive({textAlign:u.value})}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive({textAlign:u.value})?(c.openBlock(),c.createBlock(c.unref(G),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),yC=c.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=ue(),{run:i}=we(),s=c.ref(null),l=c.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function a(d){return t.modelValue===d.value}function u(d){var f;(f=s.value)==null||f.setShow(!1),o("download",d.value)}return(d,f)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{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(vt),{key:h,class:c.normalizeClass({"is-active":a(p)}),onClick:m=>u(p)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:p.icon},null,8,["name"])]),suffix:c.withCtx(()=>[a(p)?(c.openBlock(),c.createBlock(c.unref(G),{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))}}),bC=c.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=ue(),{run:i}=we(),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 u(f){return t.modelValue===f.value}function d(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(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{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(zt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(vt),{class:c.normalizeClass({"is-active":u(h)}),onClick:g=>d(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:h.icon},null,8,["name"])]),suffix:c.withCtx(()=>[h.suffixIcon?(c.openBlock(),c.createBlock(c.unref(G),{key:0,name:h.suffixIcon,small:""},null,8,["name"])):u(h)?(c.openBlock(),c.createBlock(c.unref(G),{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))}});const vC=c.defineComponent({__name:"OExtensionDropdown",props:{editor:{type:Nt}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(zt),{key:0})):c.createCommentVNode("",!0),(u.group,c.createCommentVNode("",!0)),c.createVNode(c.unref(vt),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive(u.value)}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive(u.value)?(c.openBlock(),c.createBlock(c.unref(G),{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))}}),$g=c.defineComponent({__name:"OLinkBtn",props:{editor:{type:Nt}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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 u(){var f;(f=r.value)==null||f.setShow(!1)}function d(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(Re),{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(Yd),{key:0,title:c.unref(t)("editor.hyperlink"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(jg),{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"]))}}),VL={class:"o-block-placeholder"},zL={class:"icon"},HL={class:"placeholder"},Vs=c.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("section",VL,[c.createElementVNode("div",zL,[c.createVNode(c.unref(G),{name:n.icon},null,8,["name"])]),c.createElementVNode("div",HL,c.toDisplayString(n.placeholder),1)]))}}),FL={class:"group o-tips"},jL={key:1,class:"item"},Gd=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}=ue(),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 u(){l.value=(l.value+t.items.length-1)%t.items.length}function d(){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(),u();break;case"ArrowDown":h.preventDefault(),d();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(Mt),{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(zt),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",FL,c.toDisplayString(c.unref(r)(g.group)),1)],64)):c.createCommentVNode("",!0),(b=g.children)!=null&&b.length?(c.openBlock(),c.createBlock(c.unref(Re),{key:1,ref_for:!0,ref:v=>s(v,y),placement:"right-start",offset:[-10,16]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Sh),{item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:""},null,8,["item","class"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Gd),{items:g.children,onSelect:v=>a(g,y,v)},null,8,["items","onSelect"])]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(Sh),{key:2,item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:"",onClick:v=>a(g,y)},null,8,["item","class","onClick"]))],64)}),128)):(c.openBlock(),c.createElementBlock("div",jL,c.toDisplayString(c.unref(r)("label.noResults")),1))]),_:1}))}}),UL={key:0,class:"o-tips"},Sh=c.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(n,{emit:e}){const{tr:t}=ue();return(o,r)=>(c.openBlock(),c.createBlock(c.unref(vt),{class:"o-block-list-item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{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",UL,c.toDisplayString(n.item.tips),1)):c.createCommentVNode("",!0),(i=n.item.children)!=null&&i.length?(c.openBlock(),c.createBlock(c.unref(G),{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}))}}),kC=(n,e)=>Jm(e,n.extensionManager.extensions),Bg=(n,e)=>{const t=document.createElement("div");return t.innerHTML=e,$r.fromSchema(n.schema).parse(t).toJSON()},WL=(n,e)=>{const t=document.createElement("div");return t.innerHTML=e,$r.fromSchema(n.schema).parse(t).toJSON()},wC=()=>{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"}},xC=n=>{const e=n==null?void 0:n.split("+").map(r=>r.trim().toLowerCase()).filter(Boolean);if(!e||!e.length)return n;const t=wC();return e.map(r=>t[r]??r.toUpperCase()).join("+")},ve={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"},Ba=[{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:ve.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:ve.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:ve.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:ve.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:ve.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:ve.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:ve.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:ve.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:ve.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:ve.blue},{label:"editor.callout",value:"callout",color:ve.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:ve.blue}],Vu=Ba.filter(n=>n.style),zu=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:ve.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:ve.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:ve.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:ve.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:ve.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:ve.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:ve.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:ve.purple},{label:"label.audio",value:"audio",icon:"graphic_eq",tips:"audio",color:ve.teal},{label:"label.model3d",value:"modelViewer",icon:"3d_rotation",tips:"model",color:ve.purple}],CC=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:ve.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:ve.indigo,tips:"math",keywords:"block, math, equation"},{label:"editor.multiColumn",value:"multiColumn",icon:"view_column",color:ve.amber,tips:"column",keywords:"column,columns"}],Hu=[...Ba,...zu,...CC],Bc=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:ve.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:ve.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:ve.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:ve.blue,filter:"audio,image,video,modelViewer"},{label:"label.color",value:"color",icon:"palette",color:ve.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:ve.purple,filter:"callout",component:"OCalloutColorBoard"}],SC=[{label:"ai.improveWriting",value:"improveWriting",icon:"title",color:ve.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fixSpellingGrammar",value:"fixSpellingGrammar",icon:"spellcheck",color:ve.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrichWithEmoji",value:"enrichWithEmoji",icon:"emoji_emotions",color:ve.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:ve.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:ve.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.makeShorter",value:"makeShorter",icon:"short_text",color:ve.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.changeTone",value:"changeTone",icon:"invert_colors",color:ve.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:ve.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],EC=[{label:"ai.summarize",value:"summarize",icon:"notes",color:ve.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:ve.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],qL={key:1,class:"group o-tips"},KL={class:"suffix o-tips"},JL={key:1,class:"item"},sr=c.defineComponent({__name:"OBlockMenu",props:{...dt,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=ue(),{run:i}=we(),s=c.ref([]),l=c.computed(()=>{var b;return(b=t.node)==null?void 0:b.type.name}),a=c.computed(()=>Vu.find(b=>b.value===l.value)),u=c.computed(()=>{const b=a.value?Bc.filter(k=>{var x;return((x=k.filter)==null?void 0:x.indexOf("style"))>=0})??[]:[];let v=Bc.filter(k=>{var x;return((x=k.filter)==null?void 0:x.indexOf(l.value))>=0})??[];if(v=v.concat(b),v.length>0){const k=v[0];k.group=`editor.${l.value}`}const w=Bc.filter(k=>{var x;return((x=k.filter)==null?void 0:x.indexOf("common"))>=0});return[...v,...w]});function d(b){switch(b.component){case"OCalloutColorBoard":return Rg;case"OTextColorBoard":return Dg;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,v){switch(console.log("select",b,v),v.name){case"backColor":t.updateAttributes({backColor:v.value});break;case"foreColor":t.updateAttributes({borderColor:v.value});break;case"color":i(t.editor,v.name,{color:v.value});break;case"backgroundColor":i(t.editor,v.name,{color:v.value});break}}return(b,v)=>(c.openBlock(),c.createBlock(c.unref(Mt),{class:"o-block-menu",hoverable:"",clickable:""},{default:c.withCtx(()=>[u.value.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(u.value,(w,k)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:k},[w.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[k>0||a.value?(c.openBlock(),c.createBlock(c.unref(zt),{key:0})):c.createCommentVNode("",!0),n.showGroup?(c.openBlock(),c.createElementBlock("div",qL,c.toDisplayString(c.unref(r)(w.group)),1)):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),d(w)?(c.openBlock(),c.createBlock(c.unref(Re),{key:1,ref_for:!0,ref:s.value[w.value],offset:[0,4],placement:"right"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(vt),{class:"item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:w.icon,color:n.colorful?w.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"navigate_next",class:"o-tips"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(w.label)),1)]),_:2},1024)]),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(d(w)),{onSelect:x=>y(w,x)},null,40,["onSelect"]))]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(vt),{key:2,class:"item",clickable:"",onClick:c.withModifiers(x=>f(w),["stop"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:w.icon,color:n.colorful?w.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("div",KL,c.toDisplayString(c.unref(xC)(w.tips)),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(w.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(c.openBlock(),c.createElementBlock("div",JL,"No result"))]),_:1}))}}),To=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,u;l&&!t.readonly?(a=r.value)==null||a.setShow(!0):(u=r.value)==null||u.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(Re),{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"]))}}),GL={class:"o-block-toolbar editable-only"},XL={class:"button-group"},Ra=c.defineComponent({__name:"OBlockToolbar",props:{...dt,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}=ue(),{isEditable:s,run:l}=we(),a=c.ref();function u(d){var f;o("action",d),(f=a.value)==null||f.setShow(!1)}return(d,f)=>(c.openBlock(),c.createElementBlock("div",GL,[c.createElementVNode("section",XL,[c.renderSlot(d.$slots,"default"),c.createVNode(c.unref(Re),{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(sr),c.mergeProps(t,{onAction:u}),null,16)]),_:1},8,["trigger"])])]))}}),YL={class:"o-callout-color-board"},QL={class:"fore-colors"},ZL={class:"color-row"},eP={class:"color-row"},tP={class:"back-colors"},nP={class:"color-row"},oP={class:"color-row"},Rg=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",YL,[c.createElementVNode("section",QL,[l[4]||(l[4]=c.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),c.createElementVNode("div",ZL,[c.createVNode(c.unref(Ae),{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(Ae),{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",eP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${u}`,tooltip:a.label,"content-style":{borderColor:a.value},onClick:d=>o("foreColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])]),c.createElementVNode("section",tP,[l[5]||(l[5]=c.createElementVNode("div",{class:"label o-tips"},"Background",-1)),c.createElementVNode("div",nP,[c.createVNode(c.unref(Ae),{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(Ae),{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",oP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(a,u)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${u}`,tooltip:a.label,"content-style":{backgroundColor:a.value},onClick:d=>o("backColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),rP=c.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:o}=ue(),{run:r}=we(),i=c.ref(null),s=c.ref(""),l=c.ref("");function a(u,d){u==="foreColor"?(s.value=d,localStorage.setItem("yiitap.text-color.fore",d)):u==="backColor"&&(l.value=d,localStorage.setItem("yiitap.text-color.back",d)),t("select",u,d)}return c.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",l.value=localStorage.getItem("yiitap.text-color.back")||""}),(u,d)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var f;return[c.createVNode(c.unref(Rg),{"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))}}),zi=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 u;(u=r.value)==null||u.setShow(l)},0):(a=r.value)==null||a.setShow(l)}),(l,a)=>(c.openBlock(),c.createBlock(c.unref(Re),{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"]))}}),iP={class:"o-color-board"},sP={class:"cell-container"},lP={class:"label"},aP=["onClick"],Ni=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,u)=>(c.openBlock(),c.createElementBlock("section",iP,[n.defaultDisabled?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"default-color",onClick:u[0]||(u[0]=d=>r({hex:n.defaultColor}))},[c.createElementVNode("div",sP,[c.createElementVNode("div",{class:"cell border",style:c.normalizeStyle({background:n.defaultColor})},[c.createVNode(c.unref(G),{name:"slash_forward"})],4)]),c.createElementVNode("div",lP,c.toDisplayString(n.defaultLabel),1)])),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(d,f)=>(c.openBlock(),c.createElementBlock("div",{class:"color-row",key:`row-${f}`},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d,(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(G),{key:0,name:"done",style:c.normalizeStyle({color:s(p.rgb)})},null,8,["style"])):c.createCommentVNode("",!0)],6)],8,aP)]))),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(Tn),{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(G),{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"]))}}),cP={key:0,class:"o-doc-toc toc"},uP={class:"mini-view"},dP={class:"toc__list"},fP={class:"main-view o-scroll",style:{"max-width":"480px"}},pP={class:"toc__title"},hP={class:"toc__list"},mP=["onClick"],gP=c.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:Nt},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(n,{expose:e,emit:t}){const o=n,r=t,{tr:i}=ue(),s=c.ref([]),l=c.ref("");function a(){var h;l.value=window.location.hash,(h=o.editor)==null||h.on("update",d),setTimeout(()=>{u(),d()},0)}function u(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",f)}function d(){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",cP,[c.createVNode(c.unref(Re),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:c.withCtx(()=>[c.createElementVNode("div",uP,[c.createElementVNode("ul",dP,[(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",fP,[c.createElementVNode("div",pP,c.toDisplayString(c.unref(i)("label.toc")),1),c.renderSlot(h.$slots,"title"),c.createElementVNode("ul",hP,[(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,mP)],2))),128))])])]),_:3},512)])):c.createCommentVNode("",!0)}}),yP={class:"o-emoji-select"},bP={key:0},vP={class:"groups o-scroll"},kP={class:"items"},wP=["onClick"],xP={key:0,class:"groups-empty"},CP={class:"group-icons"},SP=["onClick"],Xd=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),u=c.computed(()=>i.value?s.value:t.items),d=c.computed(()=>{let m=!1;return u.value.map(g=>{m=m||g.emojis.length}),m});function f(){a.value=0,s.value=i.value?Dl.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",yP,[n.enableSearch?(c.openBlock(),c.createElementBlock("div",bP,[c.createVNode(c.unref(Un),{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(G),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("section",vP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u.value,(y,b)=>{var v;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",kP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(y.emojis,(w,k)=>(c.openBlock(),c.createElementBlock("div",{key:`item-${k}`},[c.createElementVNode("div",{class:"item",onClick:x=>p(w)},c.toDisplayString(w.emoji),9,wP)]))),128))])],512)),[[c.vShow,(v=y.emojis)==null?void 0:v.length]])}),128)),d.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",xP,"没有记录"))]),c.createElementVNode("section",CP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u.value,(y,b)=>(c.openBlock(),c.createBlock(c.unref(Tn),{key:`target-${b}`,delay:300},{trigger:c.withCtx(()=>{var v;return[c.withDirectives(c.createElementVNode("div",{class:c.normalizeClass(["item",{active:a.value===b}]),onClick:w=>h(y,b)},[c.createVNode(c.unref(G),{name:c.unref(Dl.emojiGroupIcons)[y.slug]},null,8,["name"])],10,SP),[[c.vShow,(v=y.emojis)==null?void 0:v.length]])]}),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(y.name),1)]),_:2},1024))),128))])]))}}),rl=[{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"}],EP={class:"selected-language"},MP={class:"header"},TP={class:"o-scroll"},MC=c.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=ue(),i=c.ref(),s=c.ref(),l=c.ref(""),a=c.ref(0),u=c.ref(""),d=c.computed(()=>l.value?rl.filter(b=>b.value.toLowerCase().indexOf(l.value.toLowerCase())>=0):rl),f=c.computed(()=>{let b=rl.find(v=>v.value===u.value);return b||(b=rl.find(v=>v.ext.includes(u.value))),b});function p(b){b&&setTimeout(()=>{var v;(v=s.value)==null||v.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(),u.value=b.value,o("select",b.value)}function g(){m(d.value[a.value])}function y(b){if(d.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>=d.value.length&&(a.value=0),a.value<0&&(a.value=d.value.length-1)}else a.value=0}return c.onMounted(()=>{u.value=t.language}),(b,v)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(Xe),{class:"o-dropdown-btn"},{default:c.withCtx(()=>{var w;return[c.createElementVNode("span",EP,c.toDisplayString((w=f.value)==null?void 0:w.label),1),c.createVNode(c.unref(G),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:c.withCtx(()=>[c.createElementVNode("header",MP,[c.createVNode(c.unref(Un),{ref_key:"input",ref:s,modelValue:l.value,"onUpdate:modelValue":v[0]||(v[0]=w=>l.value=w),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),c.createElementVNode("section",TP,[c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,(w,k)=>(c.openBlock(),c.createBlock(c.unref(vt),{key:k,onClick:x=>m(w),class:c.normalizeClass({"is-active":w.value===u.value,"is-select":k===a.value})},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:w.icon},null,8,["name"])]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(w.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),NP={class:"o-media-input"},AP={class:"fields"},OP={class:"o-media-title"},$P={class:"actions"},Da=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}=ue(),i=c.ref(),s=c.ref(""),l=c.ref("");function a(){return l.value?(s.value="null",!0):(s.value="error",!1)}function u(){a()&&o("input",l.value)}return c.onMounted(()=>{l.value=t.val,setTimeout(()=>{var d;(d=i.value)==null||d.focus()},0)}),(d,f)=>(c.openBlock(),c.createElementBlock("section",NP,[c.createElementVNode("section",AP,[c.createElementVNode("div",OP,c.toDisplayString(c.unref(r)("label.link")),1),c.createVNode(c.unref(Un),{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:u},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),c.createElementVNode("footer",$P,[c.createVNode(c.unref(Xe),{type:"info",onClick:u},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),BP={class:"o-meta-input"},RP={class:"header"},DP={class:"title"},_P={class:"fields"},IP={class:"actions"},Yd=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}=ue(),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,u)=>(c.openBlock(),c.createElementBlock("section",BP,[c.createElementVNode("section",RP,[c.createElementVNode("div",DP,c.toDisplayString(n.title),1),c.createElementVNode("div",null,[c.renderSlot(a.$slots,"header-right")])]),c.createElementVNode("section",_P,[c.createVNode(c.unref(Un),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=d=>s.value=d),type:"text",autofocus:"",clearable:"",onEnter:l},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:n.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),c.createElementVNode("footer",IP,[c.createVNode(c.unref(Xe),{type:"tertiary",onClick:u[1]||(u[1]=d=>o("cancel"))},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.cancel")),1)]),_:1}),c.createVNode(c.unref(Xe),{type:"info",onClick:l},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),LP={class:"add"},Fu=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(To),{modelValue:r.value,"onUpdate:modelValue":[a[0]||(a[0]=u=>r.value=u),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",LP,[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(Tn),{placement:n.tooltipPlacement,offset:n.tooltipOffset},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:"circle-button",onClick:a[1]||(a[1]=c.withModifiers(u=>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))}}),PP={class:"o-table-grid"},VP=["onMouseover"],TC=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(u,d){i.value=u,s.value=d,o.value===u&&o.value<10&&(o.value+=1),r.value===d&&r.value<10&&(r.value+=1)}function a(){t("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(u,d)=>(c.openBlock(),c.createElementBlock("section",PP,[(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,VP)]))),128))]))),128)),c.createElementVNode("footer",null,c.toDisplayString(i.value)+" x "+c.toDisplayString(s.value),1)]))}}),zP={class:"o-table-cell-background o-button-group"},HP={class:"o-command-btn"},NC=c.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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,u)=>(c.openBlock(),c.createBlock(c.unref(Re),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Tn),{trigger:"hover"},{trigger:c.withCtx(()=>[c.createElementVNode("div",zP,[c.createElementVNode("div",{class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},[c.createVNode(c.unref(G),{name:"crop_16_9",class:"arrow"}),c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),c.createElementVNode("div",HP,[c.createVNode(c.unref(G),{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(Ni),{"default-color":"","default-label":c.unref(t)("editor.noColor"),onSelect:l},null,8,["default-label"])]),_:1},512))}}),FP={class:"o-simple-color-board"},jP={class:"fore-colors"},UP={class:"label o-tips"},WP={class:"color-row"},qP={class:"color-row"},KP={class:"back-colors"},JP={class:"label o-tips"},GP={class:"color-row"},XP={class:"color-row"},Dg=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}=ue();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",FP,[c.createElementVNode("section",jP,[c.createElementVNode("header",null,[c.createElementVNode("div",UP,c.toDisplayString(c.unref(o)("editor.textColor")),1),c.createVNode(c.unref(Re),{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(Tn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(Xe),{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(Ni),{"default-color":"","default-disabled":"",onSelect:a[0]||(a[0]=u=>r("color",{value:u}))})]),_:1},512)]),c.createElementVNode("div",WP,[c.createVNode(c.unref(Ae),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:a[1]||(a[1]=u=>r("color",{value:""}))}),n.foreColor?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"format_text",color:n.foreColor,tooltip:"Last used","content-class":"border",onClick:a[2]||(a[2]=u=>r("color",{value:n.foreColor}))},null,8,["color"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",qP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${d}`,icon:"format_text",color:u.value,tooltip:u.label,onClick:f=>r("color",u)},null,8,["color","tooltip","onClick"]))),128))])]),c.createElementVNode("section",KP,[c.createElementVNode("header",null,[c.createElementVNode("div",JP,c.toDisplayString(c.unref(o)("editor.backgroundColor")),1),c.createVNode(c.unref(Re),{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(Tn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(Xe),{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(Ni),{"default-color":"","default-disabled":"",onSelect:a[3]||(a[3]=u=>r("backgroundColor",{value:u}))})]),_:1},512)]),c.createElementVNode("div",GP,[c.createVNode(c.unref(Ae),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:a[4]||(a[4]=u=>r("backgroundColor",{value:""}))}),n.backColor?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:n.backColor},onClick:a[5]||(a[5]=u=>r("backgroundColor",{value:n.backColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",XP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(u,d)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${d}`,icon:"format_text",tooltip:u.label,"content-style":{backgroundColor:u.value},onClick:f=>r("backgroundColor",u)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),AC=["top","right","bottom","left"],Wv=["start","end"],qv=AC.reduce((n,e)=>n.concat(e,e+"-"+Wv[0],e+"-"+Wv[1]),[]),eo=Math.min,Wt=Math.max,ju=Math.round,ac=Math.floor,wo=n=>({x:n,y:n}),YP={left:"right",right:"left",bottom:"top",top:"bottom"},QP={start:"end",end:"start"};function Eh(n,e,t){return Wt(n,eo(e,t))}function lr(n,e){return typeof n=="function"?n(e):n}function jn(n){return n.split("-")[0]}function Qn(n){return n.split("-")[1]}function OC(n){return n==="x"?"y":"x"}function _g(n){return n==="y"?"height":"width"}const ZP=new Set(["top","bottom"]);function yo(n){return ZP.has(jn(n))?"y":"x"}function Ig(n){return OC(yo(n))}function $C(n,e,t){t===void 0&&(t=!1);const o=Qn(n),r=Ig(n),i=_g(r);let s=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Wu(s)),[s,Wu(s)]}function eV(n){const e=Wu(n);return[Uu(n),e,Uu(e)]}function Uu(n){return n.replace(/start|end/g,e=>QP[e])}const Kv=["left","right"],Jv=["right","left"],tV=["top","bottom"],nV=["bottom","top"];function oV(n,e,t){switch(n){case"top":case"bottom":return t?e?Jv:Kv:e?Kv:Jv;case"left":case"right":return e?tV:nV;default:return[]}}function rV(n,e,t,o){const r=Qn(n);let i=oV(jn(n),t==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Uu)))),i}function Wu(n){return n.replace(/left|right|bottom|top/g,e=>YP[e])}function iV(n){return{top:0,right:0,bottom:0,left:0,...n}}function Lg(n){return typeof n!="number"?iV(n):{top:n,right:n,bottom:n,left:n}}function As(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 Gv(n,e,t){let{reference:o,floating:r}=n;const i=yo(e),s=Ig(e),l=_g(s),a=jn(e),u=i==="y",d=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:d,y:o.y-r.height};break;case"bottom":h={x:d,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&&u?-1:1);break;case"end":h[s]+=p*(t&&u?-1:1);break}return h}async function sV(n,e){var t;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:l,strategy:a}=n,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=lr(e,n),m=Lg(h),y=l[p?f==="floating"?"reference":"floating":f],b=As(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:u,rootBoundary:d,strategy:a})),v=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),k=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},x=As(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:a}):v);return{top:(b.top-x.top+m.top)/k.y,bottom:(x.bottom-b.bottom+m.bottom)/k.y,left:(b.left-x.left+m.left)/k.x,right:(x.right-b.right+m.right)/k.x}}const lV=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 u=await s.getElementRects({reference:n,floating:e,strategy:r}),{x:d,y:f}=Gv(u,o,a),p=o,h={},m=0;for(let y=0;y<l.length;y++){var g;const{name:b,fn:v}=l[y],{x:w,y:k,data:x,reset:C}=await v({x:d,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:h,rects:u,platform:{...s,detectOverflow:(g=s.detectOverflow)!=null?g:sV},elements:{reference:n,floating:e}});d=w??d,f=k??f,h={...h,[b]:{...h[b],...x}},C&&m<=50&&(m++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await s.getElementRects({reference:n,floating:e,strategy:r}):C.rects),{x:d,y:f}=Gv(u,p,a)),y=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:h}},aV=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:u,padding:d=0}=lr(n,e)||{};if(u==null)return{};const f=Lg(d),p={x:t,y:o},h=Ig(r),m=_g(h),g=await s.getDimensions(u),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",w=y?"clientHeight":"clientWidth",k=i.reference[m]+i.reference[h]-p[h]-i.floating[m],x=p[h]-i.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=C?C[w]:0;(!S||!await(s.isElement==null?void 0:s.isElement(C)))&&(S=l.floating[w]||i.floating[m]);const M=k/2-x/2,N=S/2-g[m]/2-1,O=eo(f[b],N),A=eo(f[v],N),$=O,D=S-g[m]-A,R=S/2-g[m]/2+M,L=Eh($,R,D),B=!a.arrow&&Qn(r)!=null&&R!==L&&i.reference[m]/2-(R<$?O:A)-g[m]/2<0,W=B?R<$?R-$:R-D:0;return{[h]:p[h]+W,data:{[h]:L,centerOffset:R-L-W,...B&&{alignmentOffset:W}},reset:B}}});function cV(n,e,t){return(n?[...t.filter(r=>Qn(r)===n),...t.filter(r=>Qn(r)!==n)]:t.filter(r=>jn(r)===r)).filter(r=>n?Qn(r)===n||(e?Uu(r)!==r:!1):!0)}const uV=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:u}=e,{crossAxis:d=!1,alignment:f,allowedPlacements:p=qv,autoAlignment:h=!0,...m}=lr(n,e),g=f!==void 0||p===qv?cV(f||null,h,p):p,y=await a.detectOverflow(e,m),b=((t=s.autoPlacement)==null?void 0:t.index)||0,v=g[b];if(v==null)return{};const w=$C(v,i,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==v)return{reset:{placement:g[0]}};const k=[y[jn(v)],y[w[0]],y[w[1]]],x=[...((o=s.autoPlacement)==null?void 0:o.overflows)||[],{placement:v,overflows:k}],C=g[b+1];if(C)return{data:{index:b+1,overflows:x},reset:{placement:C}};const S=x.map(O=>{const A=Qn(O.placement);return[O.placement,A&&d?O.overflows.slice(0,2).reduce(($,D)=>$+D,0):O.overflows[0],O.overflows]}).sort((O,A)=>O[1]-A[1]),N=((r=S.filter(O=>O[2].slice(0,Qn(O[0])?2:3).every(A=>A<=0))[0])==null?void 0:r[0])||S[0][0];return N!==l?{data:{index:b+1,overflows:x},reset:{placement:N}}:{}}}},dV=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:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=lr(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=jn(r),v=yo(l),w=jn(l)===l,k=await(a.isRTL==null?void 0:a.isRTL(u.floating)),x=p||(w||!g?[Wu(l)]:eV(l)),C=m!=="none";!p&&C&&x.push(...rV(l,g,m,k));const S=[l,...x],M=await a.detectOverflow(e,y),N=[];let O=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&N.push(M[b]),f){const R=$C(r,s,k);N.push(M[R[0]],M[R[1]])}if(O=[...O,{placement:r,overflows:N}],!N.every(R=>R<=0)){var A,$;const R=(((A=i.flip)==null?void 0:A.index)||0)+1,L=S[R];if(L&&(!(f==="alignment"?v!==yo(L):!1)||O.every(z=>yo(z.placement)===v?z.overflows[0]>0:!0)))return{data:{index:R,overflows:O},reset:{placement:L}};let B=($=O.filter(W=>W.overflows[0]<=0).sort((W,z)=>W.overflows[1]-z.overflows[1])[0])==null?void 0:$.placement;if(!B)switch(h){case"bestFit":{var D;const W=(D=O.filter(z=>{if(C){const U=yo(z.placement);return U===v||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,he)=>U+he,0)]).sort((z,U)=>z[1]-U[1])[0])==null?void 0:D[0];W&&(B=W);break}case"initialPlacement":B=l;break}if(r!==B)return{reset:{placement:B}}}return{}}}};function Xv(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function Yv(n){return AC.some(e=>n[e]>=0)}const fV=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:o}=e,{strategy:r="referenceHidden",...i}=lr(n,e);switch(r){case"referenceHidden":{const s=await o.detectOverflow(e,{...i,elementContext:"reference"}),l=Xv(s,t.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Yv(l)}}}case"escaped":{const s=await o.detectOverflow(e,{...i,altBoundary:!0}),l=Xv(s,t.floating);return{data:{escapedOffsets:l,escaped:Yv(l)}}}default:return{}}}}};function BC(n){const e=eo(...n.map(i=>i.left)),t=eo(...n.map(i=>i.top)),o=Wt(...n.map(i=>i.right)),r=Wt(...n.map(i=>i.bottom));return{x:e,y:t,width:o-e,height:r-t}}function pV(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=>As(BC(r)))}const hV=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:u}=lr(n,e),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(o.reference))||[]),f=pV(d),p=As(BC(d)),h=Lg(l);function m(){if(f.length===2&&f[0].left>f[1].right&&a!=null&&u!=null)return f.find(y=>a>y.left-h.left&&a<y.right+h.right&&u>y.top-h.top&&u<y.bottom+h.bottom)||p;if(f.length>=2){if(yo(t)==="y"){const O=f[0],A=f[f.length-1],$=jn(t)==="top",D=O.top,R=A.bottom,L=$?O.left:A.left,B=$?O.right:A.right,W=B-L,z=R-D;return{top:D,bottom:R,left:L,right:B,width:W,height:z,x:L,y:D}}const y=jn(t)==="left",b=Wt(...f.map(O=>O.right)),v=eo(...f.map(O=>O.left)),w=f.filter(O=>y?O.left===v:O.right===b),k=w[0].top,x=w[w.length-1].bottom,C=v,S=b,M=S-C,N=x-k;return{top:k,bottom:x,left:C,right:S,width:M,height:N,x:C,y:k}}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}}:{}}}},mV=new Set(["left","top"]);async function gV(n,e){const{placement:t,platform:o,elements:r}=n,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=jn(t),l=Qn(t),a=yo(t)==="y",u=mV.has(s)?-1:1,d=i&&a?-1:1,f=lr(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*d,y:p*u}:{x:p*u,y:h*d}}const yV=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 gV(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}}}}},bV=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:v,y:w}=b;return{x:v,y:w}}},...u}=lr(n,e),d={x:t,y:o},f=await i.detectOverflow(e,u),p=yo(jn(r)),h=OC(p);let m=d[h],g=d[p];if(s){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=m+f[b],k=m-f[v];m=Eh(w,m,k)}if(l){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",w=g+f[b],k=g-f[v];g=Eh(w,g,k)}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}}}}}},vV=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=()=>{},...u}=lr(n,e),d=await s.detectOverflow(e,u),f=jn(r),p=Qn(r),h=yo(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 v=g-d.top-d.bottom,w=m-d.left-d.right,k=eo(g-d[y],v),x=eo(m-d[b],w),C=!e.middlewareData.shift;let S=k,M=x;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(M=w),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(S=v),C&&!p){const O=Wt(d.left,0),A=Wt(d.right,0),$=Wt(d.top,0),D=Wt(d.bottom,0);h?M=m-2*(O!==0||A!==0?O+A:Wt(d.left,d.right)):S=g-2*($!==0||D!==0?$+D:Wt(d.top,d.bottom))}await a({...e,availableWidth:M,availableHeight:S});const N=await s.getDimensions(l.floating);return m!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function Qd(){return typeof window<"u"}function zs(n){return RC(n)?(n.nodeName||"").toLowerCase():"#document"}function En(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Bo(n){var e;return(e=(RC(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function RC(n){return Qd()?n instanceof Node||n instanceof En(n).Node:!1}function to(n){return Qd()?n instanceof Element||n instanceof En(n).Element:!1}function No(n){return Qd()?n instanceof HTMLElement||n instanceof En(n).HTMLElement:!1}function Qv(n){return!Qd()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof En(n).ShadowRoot}const kV=new Set(["inline","contents"]);function _a(n){const{overflow:e,overflowX:t,overflowY:o,display:r}=no(n);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&!kV.has(r)}const wV=new Set(["table","td","th"]);function xV(n){return wV.has(zs(n))}const CV=[":popover-open",":modal"];function Zd(n){return CV.some(e=>{try{return n.matches(e)}catch{return!1}})}const SV=["transform","translate","scale","rotate","perspective"],EV=["transform","translate","scale","rotate","perspective","filter"],MV=["paint","layout","strict","content"];function Pg(n){const e=Vg(),t=to(n)?no(n):n;return SV.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)||EV.some(o=>(t.willChange||"").includes(o))||MV.some(o=>(t.contain||"").includes(o))}function TV(n){let e=zr(n);for(;No(e)&&!Os(e);){if(Pg(e))return e;if(Zd(e))return null;e=zr(e)}return null}function Vg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const NV=new Set(["html","body","#document"]);function Os(n){return NV.has(zs(n))}function no(n){return En(n).getComputedStyle(n)}function ef(n){return to(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function zr(n){if(zs(n)==="html")return n;const e=n.assignedSlot||n.parentNode||Qv(n)&&n.host||Bo(n);return Qv(e)?e.host:e}function DC(n){const e=zr(n);return Os(e)?n.ownerDocument?n.ownerDocument.body:n.body:No(e)&&_a(e)?e:DC(e)}function Ql(n,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=DC(n),i=r===((o=n.ownerDocument)==null?void 0:o.body),s=En(r);if(i){const l=Mh(s);return e.concat(s,s.visualViewport||[],_a(r)?r:[],l&&t?Ql(l):[])}return e.concat(r,Ql(r,[],t))}function Mh(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function _C(n){const e=no(n);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=No(n),i=r?n.offsetWidth:t,s=r?n.offsetHeight:o,l=ju(t)!==i||ju(o)!==s;return l&&(t=i,o=s),{width:t,height:o,$:l}}function zg(n){return to(n)?n:n.contextElement}function ms(n){const e=zg(n);if(!No(e))return wo(1);const t=e.getBoundingClientRect(),{width:o,height:r,$:i}=_C(e);let s=(i?ju(t.width):t.width)/o,l=(i?ju(t.height):t.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const AV=wo(0);function IC(n){const e=En(n);return!Vg()||!e.visualViewport?AV:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function OV(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==En(n)?!1:e}function Ai(n,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),i=zg(n);let s=wo(1);e&&(o?to(o)&&(s=ms(o)):s=ms(n));const l=OV(i,t,o)?IC(i):wo(0);let a=(r.left+l.x)/s.x,u=(r.top+l.y)/s.y,d=r.width/s.x,f=r.height/s.y;if(i){const p=En(i),h=o&&to(o)?En(o):o;let m=p,g=Mh(m);for(;g&&o&&h!==m;){const y=ms(g),b=g.getBoundingClientRect(),v=no(g),w=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,k=b.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,u*=y.y,d*=y.x,f*=y.y,a+=w,u+=k,m=En(g),g=Mh(m)}}return As({width:d,height:f,x:a,y:u})}function tf(n,e){const t=ef(n).scrollLeft;return e?e.left+t:Ai(Bo(n)).left+t}function LC(n,e){const t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-tf(n,t),r=t.top+e.scrollTop;return{x:o,y:r}}function $V(n){let{elements:e,rect:t,offsetParent:o,strategy:r}=n;const i=r==="fixed",s=Bo(o),l=e?Zd(e.floating):!1;if(o===s||l&&i)return t;let a={scrollLeft:0,scrollTop:0},u=wo(1);const d=wo(0),f=No(o);if((f||!f&&!i)&&((zs(o)!=="body"||_a(s))&&(a=ef(o)),No(o))){const h=Ai(o);u=ms(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=s&&!f&&!i?LC(s,a):wo(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-a.scrollLeft*u.x+d.x+p.x,y:t.y*u.y-a.scrollTop*u.y+d.y+p.y}}function BV(n){return Array.from(n.getClientRects())}function RV(n){const e=Bo(n),t=ef(n),o=n.ownerDocument.body,r=Wt(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=Wt(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-t.scrollLeft+tf(n);const l=-t.scrollTop;return no(o).direction==="rtl"&&(s+=Wt(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:l}}const Zv=25;function DV(n,e){const t=En(n),o=Bo(n),r=t.visualViewport;let i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;const d=Vg();(!d||d&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const u=tf(o);if(u<=0){const d=o.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-f.clientWidth-h);m<=Zv&&(i-=m)}else u<=Zv&&(i+=u);return{width:i,height:s,x:l,y:a}}const _V=new Set(["absolute","fixed"]);function IV(n,e){const t=Ai(n,!0,e==="fixed"),o=t.top+n.clientTop,r=t.left+n.clientLeft,i=No(n)?ms(n):wo(1),s=n.clientWidth*i.x,l=n.clientHeight*i.y,a=r*i.x,u=o*i.y;return{width:s,height:l,x:a,y:u}}function ek(n,e,t){let o;if(e==="viewport")o=DV(n,t);else if(e==="document")o=RV(Bo(n));else if(to(e))o=IV(e,t);else{const r=IC(n);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return As(o)}function PC(n,e){const t=zr(n);return t===e||!to(t)||Os(t)?!1:no(t).position==="fixed"||PC(t,e)}function LV(n,e){const t=e.get(n);if(t)return t;let o=Ql(n,[],!1).filter(l=>to(l)&&zs(l)!=="body"),r=null;const i=no(n).position==="fixed";let s=i?zr(n):n;for(;to(s)&&!Os(s);){const l=no(s),a=Pg(s);!a&&l.position==="fixed"&&(r=null),(i?!a&&!r:!a&&l.position==="static"&&!!r&&_V.has(r.position)||_a(s)&&!a&&PC(n,s))?o=o.filter(d=>d!==s):r=l,s=zr(s)}return e.set(n,o),o}function PV(n){let{element:e,boundary:t,rootBoundary:o,strategy:r}=n;const s=[...t==="clippingAncestors"?Zd(e)?[]:LV(e,this._c):[].concat(t),o],l=s[0],a=s.reduce((u,d)=>{const f=ek(e,d,r);return u.top=Wt(f.top,u.top),u.right=eo(f.right,u.right),u.bottom=eo(f.bottom,u.bottom),u.left=Wt(f.left,u.left),u},ek(e,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function VV(n){const{width:e,height:t}=_C(n);return{width:e,height:t}}function zV(n,e,t){const o=No(e),r=Bo(e),i=t==="fixed",s=Ai(n,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=wo(0);function u(){a.x=tf(r)}if(o||!o&&!i)if((zs(e)!=="body"||_a(r))&&(l=ef(e)),o){const h=Ai(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else r&&u();i&&!o&&r&&u();const d=r&&!o&&!i?LC(r,l):wo(0),f=s.left+l.scrollLeft-a.x-d.x,p=s.top+l.scrollTop-a.y-d.y;return{x:f,y:p,width:s.width,height:s.height}}function cp(n){return no(n).position==="static"}function tk(n,e){if(!No(n)||no(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Bo(n)===t&&(t=t.ownerDocument.body),t}function VC(n,e){const t=En(n);if(Zd(n))return t;if(!No(n)){let r=zr(n);for(;r&&!Os(r);){if(to(r)&&!cp(r))return r;r=zr(r)}return t}let o=tk(n,e);for(;o&&xV(o)&&cp(o);)o=tk(o,e);return o&&Os(o)&&cp(o)&&!Pg(o)?t:o||TV(n)||t}const HV=async function(n){const e=this.getOffsetParent||VC,t=this.getDimensions,o=await t(n.floating);return{reference:zV(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function FV(n){return no(n).direction==="rtl"}const jV={convertOffsetParentRelativeRectToViewportRelativeRect:$V,getDocumentElement:Bo,getClippingRect:PV,getOffsetParent:VC,getElementRects:HV,getClientRects:BV,getDimensions:VV,getScale:ms,isElement:to,isRTL:FV};function zC(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function UV(n,e){let t=null,o;const r=Bo(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 u=n.getBoundingClientRect(),{left:d,top:f,width:p,height:h}=u;if(l||e(),!p||!h)return;const m=ac(f),g=ac(r.clientWidth-(d+p)),y=ac(r.clientHeight-(f+h)),b=ac(d),w={rootMargin:-m+"px "+-g+"px "+-y+"px "+-b+"px",threshold:Wt(0,eo(1,a))||1};let k=!0;function x(C){const S=C[0].intersectionRatio;if(S!==a){if(!k)return s();S?s(!1,S):o=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!zC(u,n.getBoundingClientRect())&&s(),k=!1}try{t=new IntersectionObserver(x,{...w,root:r.ownerDocument})}catch{t=new IntersectionObserver(x,w)}t.observe(n)}return s(!0),i}function WV(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,u=zg(n),d=r||i?[...u?Ql(u):[],...Ql(e)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=u&&l?UV(u,t):null;let p=-1,h=null;s&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(e)})),t()}),u&&!a&&h.observe(u),h.observe(e));let m,g=a?Ai(n):null;a&&y();function y(){const b=Ai(n);g&&!zC(g,b)&&t(),g=b,m=requestAnimationFrame(y)}return t(),()=>{var b;d.forEach(v=>{r&&v.removeEventListener("scroll",t),i&&v.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const HC=yV,FC=uV,Hg=bV,Fg=dV,jC=vV,UC=fV,WC=aV,qC=hV,nf=(n,e,t)=>{const o=new Map,r={platform:jV,...t},i={...r.platform,_c:o};return lV(n,e,{...r,platform:i})};class qV{constructor(){Ue(this,"instances",[]);Ue(this,"gap",12);Ue(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=WV(document.body,r,()=>{nf(document.body,r,{placement:"top",middleware:[Hg(),Fg()]}).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 Zl=new qV,An=c.defineComponent({__name:"ONodeView",props:dt,setup(n){return(e,t)=>(c.openBlock(),c.createBlock(c.unref(ig),{class:"o-node-view","data-id":e.node.attrs.id},{default:c.withCtx(()=>[c.renderSlot(e.$slots,"default")]),_:3},8,["data-id"]))}}),KV={class:"o-add-node-view"},JV={key:0,class:"view-main"},GV={class:"group o-tips"},XV={class:"panel"},YV={class:"group o-tips"},QV={key:1,class:"item"},ZV=c.defineComponent({__name:"AddNodeView",props:dt,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=ue(),{run:s}=we(),l=c.ref("main");function a(f){let p=null;switch(f.value){case"aiBlock":p=ML;break;case"audio":p=TL;break;case"blockquote":p=NL;break;case"callout":p=AL;break;case"codeBlock":p=OL;break;case"details":p=$L;break;case"diagram":p=gC;break;case"emoji":p=BL;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:DL};break;case"taskList":p={content:IL};break;case"table":p=_L;break;case"image":p=RL;break;case"model-viewer":p={attrs:{src:"init"}};break;case"video":p=LL;break}if(p){p.type=p.type||f.value;const h=u.value?d.value+1:d.value,m=f.value==="emoji"?h+2:h+1;requestAnimationFrame(()=>{t.editor.chain().insertContentAt(h,p).focus(m).scrollIntoView().run()})}o("action",f)}const u=c.computed(()=>{var f;return((f=t.node)==null?void 0:f.content.size)===0}),d=c.computed(()=>u.value?t.getPos():t.getPos()+t.node.nodeSize);return(f,p)=>(c.openBlock(),c.createElementBlock("section",KV,[l.value==="main"?(c.openBlock(),c.createElementBlock("section",JV,[c.createElementVNode("section",null,[c.createElementVNode("div",GV,c.toDisplayString(c.unref(i)("label.basic")),1),c.createElementVNode("section",XV,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(Ba),(h,m)=>(c.openBlock(),c.createBlock(c.unref(Ae),{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(zt)),c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[c.unref(zu).length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(zu),(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(zt),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",YV,c.toDisplayString(c.unref(i)(h.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(vt),{class:"item",clickable:"",onClick:g=>a(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{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",QV,"No result"))]),_:1})])):c.createCommentVNode("",!0)]))}}),KC=c.defineComponent({__name:"AddNode",props:{...dt,add:{type:String,default:"menu"}},setup(n){const e=n,t=c.ref(),o=c.ref(!1),r=c.computed(()=>{var d;return((d=e.node)==null?void 0:d.content.size)===0}),i=c.computed(()=>r.value?e.getPos():e.getPos()+e.node.nodeSize);function s(d){o.value=d}function l(){var d;e.add==="menu"?(d=t.value)==null||d.setShow(!0):a()}function a(){const d={type:"paragraph",content:[{type:"text",text:"/"}]},f=r.value?i.value+1:i.value,p=f+2;requestAnimationFrame(()=>{e.editor.chain().insertContentAt(f,d).focus(p).scrollIntoView().run()})}function u(){var d;(d=t.value)==null||d.setShow(!1),o.value=!1}return(d,f)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(Xe),{type:"tertiary",class:"o-node-btn",onClick:l},{default:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"add",small:""})]),_:1})],2)]),default:c.withCtx(()=>[c.createVNode(ZV,c.mergeProps(e,{onAction:u}),null,16)]),_:1},512))}}),e2={class:"o-drag-node-view"},t2={key:0,class:"view-main"},n2={key:0},o2={class:"group o-tips"},r2={class:"panel"},i2=c.defineComponent({__name:"DragNodeView",props:dt,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=ue(),{run:s,onCommand:l}=we(),a=c.ref("main"),u=c.ref(["heading","codeBlock","paragraph"]),d=c.computed(()=>{var y,b;const g=(y=t.node)==null?void 0:y.content.content;if(g.length>0){const v=g[0];if(v.type.name==="image")return v.type.name}return(b=t.node)==null?void 0:b.type.name}),f=c.computed(()=>Vu.find(g=>g.value===d.value));function p(g){var y;return g.value===d.value&&((y=t.editor)==null?void 0:y.isActive(d.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 w,k,x,C,S;const y=t.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const M=(w=t.editor)==null?void 0:w.isActive(d.value),N=(k=t.editor)==null?void 0:k.commands.lift(d.value);console.log("lift",d.value,M,N);return}const b=(x=t.editor)==null?void 0:x.commands,v=(C=t.editor)==null?void 0:C.chain().focus(y+1);console.log("runCommand",g),l(b,v,g.value,g.options),(S=t.editor)==null||S.commands.focus()}return(g,y)=>(c.openBlock(),c.createElementBlock("section",e2,[a.value==="main"?(c.openBlock(),c.createElementBlock("section",t2,[f.value?(c.openBlock(),c.createElementBlock("section",n2,[c.createElementVNode("div",o2,c.toDisplayString(c.unref(i)("label.turnInto")),1),c.createElementVNode("section",r2,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(Vu),(b,v)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:v,icon:b.icon,tooltip:c.unref(i)(b.label),"content-class":{"is-active":p(b)},quaternary:"",onClick:w=>h(b)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):c.createCommentVNode("",!0),c.createVNode(c.unref(sr),c.mergeProps(t,{colorful:"","show-group":"",onAction:h}),null,16)])):c.createCommentVNode("",!0)]))}}),JC=c.defineComponent({__name:"DragNode",props:dt,emits:["dragstart","dragend"],setup(n,{emit:e}){const t=n,o=e,{run:r}=we(),i=c.ref(null),s=c.ref(!1),l=c.ref(["heading","codeBlock","paragraph"]),a=c.computed(()=>{var y,b,v;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 w=g[0];if(w.type.name==="image")return w.type.name}return(v=t.node)==null?void 0:v.type.name}),u=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:ve.blue}:(g==="table-wrapper"&&(g="table"),Hu.find(b=>b.value===g)||Hu.find(b=>{var v;return(v=b.keywords)==null?void 0:v.split(",").includes(g)})||{icon:"title"})});function d(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(Re),{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:d,onDragend:f},[c.createVNode(c.unref(Xe),{type:"tertiary",class:"o-node-btn"},{default:c.withCtx(()=>[c.createVNode(c.unref(G),{name:u.value.icon,color:u.value.color,small:""},null,8,["name","color"]),c.createVNode(c.unref(G),{name:"drag_indicator",small:""})]),_:1})],34)]),default:c.withCtx(()=>[c.createVNode(i2,c.mergeProps(t,{onAction:p}),null,16)]),_:1},512))}}),s2={key:0,class:"spinner"},l2={key:2,class:"o-btn__label"},Xe=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",s2)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[n.icon?(c.openBlock(),c.createBlock(c.unref(G),{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",l2,c.toDisplayString(n.label),1)):c.createCommentVNode("",!0),c.renderSlot(o.$slots,"default")],2))}}),a2={class:"o-btn-group"},GC=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",a2,[c.renderSlot(t.$slots,"default")]))}}),c2={class:"o-checkbox"},u2={class:"o-checkbox__main"},d2={class:"o-checkbox__suffix"},jg=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",c2,[c.createElementVNode("div",u2,[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",d2,c.toDisplayString(n.label),1)]))}}),f2={class:"dialog-header"},p2={class:"dialog-body"},h2={class:"dialog-footer"},Ug=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",f2,[c.renderSlot(r.$slots,"title",{},()=>[c.createTextVNode(c.toDisplayString(n.title),1)]),c.createVNode(c.unref(Xe),{icon:"close",class:"close",onClick:o})]),c.createElementVNode("div",p2,[c.renderSlot(r.$slots,"default")]),c.createElementVNode("div",h2,[c.renderSlot(r.$slots,"footer")])],2)],2)):c.createCommentVNode("",!0)]))}}),zt=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))}}),m2={key:0,class:"dialog-overlay o-image-viewer"},g2={class:"dialog-box"},y2={class:"dialog-body"},b2=["src"],v2={class:"action-group"},k2={class:"action-group"},w2={class:"o-btn scale"},XC=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}=qd(),i=c.ref(0),s=c.ref(1),l=c.ref({x:0,y:0}),a=c.ref(!1),u=c.ref({x:0,y:0}),d=c.ref(null),f=c.ref(null),p={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},h=c.computed(()=>{const $=t.images.length;let D={};return $>0&&(D=i.value>=0&&i.value<$?t.images.at(i.value):t.images.at(0)),D}),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=$=>{$.preventDefault();const D=-$.deltaY*p.WHEEL_SENSITIVITY;let R=s.value+D;if(R=Math.max(p.MIN_SCALE,Math.min(p.MAX_SCALE,R)),f.value&&d.value){const L=f.value.getBoundingClientRect(),B=$.clientX-L.left-L.width/2,W=$.clientY-L.top-L.height/2,z=R-s.value;l.value.x-=B*z,l.value.y-=W*z}s.value=R},b=$=>{s.value<=1||($.preventDefault(),a.value=!0,u.value={x:$.clientX-l.value.x,y:$.clientY-l.value.y},document.addEventListener("mousemove",v),document.addEventListener("mouseup",w))},v=$=>{a.value&&(l.value.x=$.clientX-u.value.x,l.value.y=$.clientY-u.value.y)},w=()=>{a.value=!1,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w)},k=()=>{s.value=Math.min(p.MAX_SCALE,s.value+p.STEP)},x=()=>{s.value=Math.max(p.MIN_SCALE,s.value-p.STEP)},C=()=>{s.value=1,l.value={x:0,y:0}},S=()=>{i.value>0&&(i.value-=1,C())},M=()=>{i.value<t.images.length-1&&(i.value+=1,C())},N=()=>{C(),o("update:show",!1)},O=()=>{var $;r(($=h.value.attrs)==null?void 0:$.src)},A=$=>{if(t.show)switch($.preventDefault(),$.stopPropagation(),$.key){case"+":case"=":$.preventDefault(),k();break;case"-":$.preventDefault(),x();break;case"0":$.preventDefault(),C();break;case"ArrowLeft":($.ctrlKey||$.metaKey)&&($.preventDefault(),S());break;case"ArrowRight":($.ctrlKey||$.metaKey)&&($.preventDefault(),M());break;case"Escape":N();break}};return c.watch(()=>t.current,$=>{i.value=$,C()}),c.onMounted(()=>{i.value=t.current,document.addEventListener("keydown",A)}),c.onBeforeUnmount(()=>{document.removeEventListener("keydown",A),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w)}),($,D)=>(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[n.show?(c.openBlock(),c.createElementBlock("div",m2,[c.createElementVNode("header",null,[c.createVNode(c.unref(Xe),{icon:"close",onClick:N})]),c.createElementVNode("div",g2,[c.createElementVNode("div",y2,[c.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:f,onWheel:c.withModifiers(y,["prevent"]),onDblclick:C},[c.createElementVNode("img",{ref_key:"imageRef",ref:d,src:h.value.attrs.src,alt:"image",style:c.normalizeStyle(m.value),onMousedown:b},null,44,b2)],544)])]),c.createElementVNode("footer",null,[c.createElementVNode("div",v2,[c.createVNode(c.unref(Xe),{icon:"arrow_back",class:c.normalizeClass({disabled:i.value<=0}),onClick:S},null,8,["class"]),c.createVNode(c.unref(Xe),{icon:"arrow_back","icon-class":"rotate-180",class:c.normalizeClass({disabled:i.value>=t.images.length-1}),onClick:M},null,8,["class"])]),c.createElementVNode("div",k2,[c.createVNode(c.unref(Xe),{icon:"horizontal_rule",onClick:x}),c.createElementVNode("div",w2,c.toDisplayString(g.value)+"%",1),c.createVNode(c.unref(Xe),{icon:"add",onClick:k}),c.createVNode(c.unref(Xe),{icon:"download",onClick:O}),c.createVNode(c.unref(Xe),{icon:"close",onClick:N})])])])):c.createCommentVNode("",!0)]))}}),x2={class:"o-input__prefix"},C2={class:"o-input__main"},S2=["placeholder"],E2={class:"o-input__suffix"},Un=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(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(u,d)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-input",`type-${n.type}`])},[c.createElementVNode("div",x2,[c.renderSlot(u.$slots,"prefix")]),c.createElementVNode("div",C2,[c.withDirectives(c.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),placeholder:n.placeholder,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur")),onKeyup:d[3]||(d[3]=c.withKeys(f=>r("enter"),["enter"]))},null,40,S2),[[c.vModelText,s.value]])]),c.createElementVNode("div",E2,[c.renderSlot(u.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(G,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),Mt=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))}}),M2={class:"o-list-item"},T2={class:"o-list-item__prefix"},N2={class:"o-list-item__main"},A2={class:"o-list-item__suffix"},vt=c.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("li",M2,[c.createElementVNode("div",T2,[c.renderSlot(e.$slots,"prefix")]),c.createElementVNode("div",N2,[c.renderSlot(e.$slots,"default")]),c.createElementVNode("div",A2,[c.renderSlot(e.$slots,"suffix")])]))}}),Re=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}=Vi(),s=c.ref(null),l=c.ref(),a=c.ref();function u(h){var m,g,y,b;h?((g=a.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?d:null}),(y=a.value)==null||y.show()):(b=a.value)==null||b.hide()}function d(){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=ir(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:u}),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))}}),O2={class:"o-textarea__prefix"},$2={class:"o-textarea__main"},B2=["placeholder","rows"],R2={class:"o-textarea__suffix"},YC=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(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(u,d)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-textarea",`type-${n.type}`])},[c.createElementVNode("div",O2,[c.renderSlot(u.$slots,"prefix")]),c.createElementVNode("div",$2,[c.withDirectives(c.createElementVNode("textarea",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),placeholder:n.placeholder,rows:n.rows,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur"))},null,40,B2),[[c.vModelText,s.value]])]),c.createElementVNode("div",R2,[c.renderSlot(u.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(G,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),QC={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},D2=(n,e)=>{const t=QC[n];return t?t[e]:null},_2=`
24
+ `,"2) content: () => element.cloneNode(true)"].join(" "))}var s=l.reduce(function(c,d){var u=d&&fc(d,r);return u&&c.push(u),c},[]);return Gt(t)?s[0]:s}Ge.defaultProps=ke;Ge.setDefaultProps=sc;Ge.currentInput=Le;Object.assign({},Lr,{effect:function(o){var n=o.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});Ge.setDefaultProps({render:el});const mc=new ka({breaks:!0});function hn(){return{md:mc}}function Oo(){const t=(r,l,a)=>{const i={type:"text/plain"};switch(r){case"svg":i.type="image/svg+xml;charset=utf-8";break}const s=new Blob([a],i),c=URL.createObjectURL(s),d=document.createElement("a");d.href=c,d.download=l,d.click(),URL.revokeObjectURL(c)},o=async r=>{try{const a=await(await fetch(r)).blob(),i=window.URL.createObjectURL(a),s=n(r),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(r,"_blank")}},n=(r,l="png")=>{try{const s=new URL(r).pathname.split("/"),c=s[s.length-1];return c&&c.includes(".")?decodeURIComponent(c):`image-${Date.now()}.${l}`}catch{return`download-${Date.now()}.${l}`}};return{commonDownload:t,downloadImage:o}}function tl(){const t=e.ref(),o=e.ref(!1);function n(i){t.value=i,i.editor.on("selectionUpdate",a)}function r(){var i;(i=t.value)==null||i.editor.off("selectionUpdate",a)}const l=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)>=l.value.start&&(s==null?void 0:s.$to.pos)<=l.value.end)};return{isFocused:o,bind:n,unbind:r,checkFocus:a}}function P(){const t=e.inject("locale",{value:"en"}),o=e.computed(()=>ya.getMessage(t.value)),n=e.computed(()=>{var l;return((l=o.value)==null?void 0:l.name)||"English"});function r(l){return l.split(".").reduce((a,i)=>{if(a)return a[i]},o.value)}return{languageName:n,locale:t,message:o,tr:r}}const $o=[{type:"paragraph",content:[]}],vc={type:"aiBlock",content:$o},gc={type:"audio",attrs:{src:"//init.mp3"}},bc={type:"blockquote",content:$o},hc={type:"callout",attrs:{icon:"💡"},content:$o},kc={type:"codeBlock",attrs:{attrs:{language:"shell"}},content:[]},yc={type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:$o}]},ol={type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
25
+ Mermaid --> Diagram`}]},wc={type:"paragraph",content:[{type:"text",text:":"}]},xc={type:"image",attrs:{src:"init"}},Cc=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],_c={type:"table",content:Array.from({length:3},()=>({type:"tableRow",content:Array.from({length:3},()=>({type:"tableCell",content:[{type:"paragraph"}]}))}))},Bc=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],Vc={type:"video",attrs:{src:"init"}};function U(){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(),d=a==null?void 0:a.commands;switch(i){case"inlineMath":r(a);break;default:n(d,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(ol);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 r(a){const{state:i,view:s}=a,{from:c}=i.selection,u=s.domAtPos(c).node.getBoundingClientRect(),p=i.tr.setMeta(ft.InlinePlaceholderKey,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:c,rect:u}}).setSelection(i.selection);s.dispatch(p)}function l(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:l}}function kn(){const{tr:t}=P(),{isEditable:o,run:n}=U(),r=e.ref(null),l=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 _;const{state:m}=r.value.editor,b=(_=r.value)==null?void 0:_.getPos(),g=m.doc.resolve(b);let k=null,w=-1;for(let C=g.depth;C>0;C--)if(g.node(C).type.name==="table"){k=g.node(C),w=g.before(C);break}if(!k)return{rowIndex:-1,colIndex:-1};const h=wa.TableMap.get(k),x=b-w-1,v=h.findCell(x);return{rowIndex:v.top,colIndex:v.left}});function d(m){r.value=m}function u(){var m;l.value=!1,f("tableSelectColumn",{pos:(m=r.value)==null?void 0:m.getPos()})}function p(){var m;a.value=!1,f("tableSelectRow",{pos:(m=r.value)==null?void 0:m.getPos()})}function f(m,b={}){switch(console.log("runCommand",m,b),m){case"selectColumn":u();return;case"selectRow":p();return;case"tableAddRowAfter":case"tableAddRowBefore":case"tableDeleteRow":a.value=!1;break;case"tableAddColumnAfter":case"tableAddColumnBefore":case"tableDeleteColumn":l.value=!1;break}setTimeout(()=>{var g;n((g=r.value)==null?void 0:g.editor,m,b)},0)}return{showColPopover:l,showRowPopover:a,columnActions:i,rowActions:s,isEditable:o,cellInfo:c,initProps:d,selectColumn:u,selectRow:p,runCommand:f}}function bt(){const t=e.inject("darkMode",{value:!1}),o=e.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:o}}const xe=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}=bt(),r=e.ref(),l=e.ref(),a=e.ref();function i(){a.value=Ge(r.value,{appendTo:()=>document.body,animation:"perspective",content:l.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,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"triggerRef",ref:r,"data-tippy-role":"tooltip"},[e.renderSlot(c.$slots,"trigger"),e.createElementVNode("div",{ref_key:"contentRef",ref:l,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(r,l)=>(e.openBlock(),e.createBlock(xe,{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:l[0]||(l[0]=a=>n("click",a))},[e.createVNode(E,{name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"]),e.renderSlot(r.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Nc=e.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const o=t,{run:n}=U(),{tr:r}=P(),l=e.computed(()=>({aiBlock:{icon:"auto_awesome",tooltip:r("editor.aiBlock")},audio:{icon:"graphic_eq",tooltip:r("label.audio")},blockMath:{icon:"functions",tooltip:r("editor.blockMath")},blockquote:{icon:"format_quote_open",tooltip:r("editor.blockquote")},bold:{icon:"format_bold",tooltip:r("editor.bold")},callout:{icon:"card_text",tooltip:r("editor.callout")},clearFormat:{icon:"format_clear",tooltip:r("editor.removeFormat")},code:{icon:"code",tooltip:r("editor.code")},codeBlock:{icon:"code_braces",tooltip:r("editor.codeBlock")},diagram:{icon:"mermaid",tooltip:r("diagram.name")},horizontalRule:{icon:"horizontal_rule",tooltip:r("editor.hr")},italic:{icon:"format_italic",tooltip:r("editor.italic")},image:{icon:"image",tooltip:r("editor.photo")},inlineMath:{icon:"function",tooltip:r("editor.inlineMath")},inlineMathDelete:{icon:"close",tooltip:r("editor.delete")},linkUnset:{icon:"link_off",tooltip:r("link.off")},modelViewer:{icon:"3d_rotation",tooltip:r("label.modelViewer")},multiColumn:{icon:"view_column",tooltip:r("editor.multiColumn")},strike:{icon:"format_strikethrough",tooltip:r("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:r("editor.underline")},video:{icon:"videocam",tooltip:r("editor.video")}})),a=e.computed(()=>l.value[o.name]||{icon:"",isActive:!1,command:()=>{}});function i(){n(o.editor,o.name)}return(s,c)=>{var d;return e.openBlock(),e.createBlock(X,{class:"o-simple-command-btn",icon:a.value.icon,tooltip:a.value.tooltip,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(t.name),"rotate-90":a.value.rotate},onClick:i},null,8,["icon","tooltip","content-class"])}}}),yn=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}=P(),{run:r}=U(),l=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=l.value)==null||c.setShow(!1),r(o.editor,"textAlign",{textAlign:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",placement:t.placement,trigger:t.trigger},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:e.unref(n)("editor.align")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(d,u)=>{var p;return e.openBlock(),e.createBlock(e.unref(ie),{key:u,class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive({textAlign:d.value})}),onClick:f=>i(d.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive({textAlign:d.value})?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),nl=e.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(t,{emit:o}){const n=t,r=o,{tr:l}=P(),{run:a}=U(),i=e.ref(null),s=e.computed(()=>[{label:l("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function c(u){return n.modelValue===u.value}function d(u){var p;(p=i.value)==null||p.setShow(!1),r("download",u.value)}return(u,p)=>(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(ae),{"content-class":"o-code-block-download-dropdown dropdown",icon:"download",tooltip:e.unref(l)("label.download")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(f,m)=>(e.openBlock(),e.createBlock(e.unref(ie),{key:m,class:e.normalizeClass({"is-active":c(f)}),onClick:b=>d(f)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:f.icon},null,8,["name"])]),suffix:e.withCtx(()=>[c(f)?(e.openBlock(),e.createBlock(e.unref(E),{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))}}),rl=e.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,r=o,{tr:l}=P(),{run:a}=U(),i=e.ref(null),s=e.computed(()=>[{label:l("editor.code"),value:"code",icon:"code"},{label:l("label.preview"),value:"preview",icon:"mermaid"},{label:l("label.splitHorizontal"),value:"splitHorizontal",icon:"splitscreen_right"},{label:l("label.splitVertical"),value:"splitVertical",icon:"splitscreen_bottom"},{label:l("label.help"),value:"help",icon:"help",suffixIcon:"open_in_new",separator:!0}]),c=e.computed(()=>s.value.find(p=>p.value===n.modelValue));function d(p){return n.modelValue===p.value}function u(p){var f;switch((f=i.value)==null||f.setShow(!1),p.value){case"help":window.open("https://mermaid.js.org/intro/","target");break;default:r("update:modelValue",p.value)}}return(p,f)=>(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(ae),{"content-class":"o-code-block-view-dropdown dropdown",icon:c.value.icon,tooltip:e.unref(l)("label.view")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(m,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[m.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ie),{class:e.normalizeClass({"is-active":d(m)}),onClick:g=>u(m)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:m.icon},null,8,["name"])]),suffix:e.withCtx(()=>[m.suffixIcon?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:m.suffixIcon,small:""},null,8,["name"])):d(m)?(e.openBlock(),e.createBlock(e.unref(E),{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))}});const ll=e.defineComponent({__name:"OExtensionDropdown",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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=l.value)==null||c.setShow(!1),r(o.editor,s)}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"extension","content-class":"o-extension-dropdown dropdown",tooltip:e.unref(n)("label.more")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(d,u)=>{var p;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[d.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),(d.group,e.createCommentVNode("",!0)),e.createVNode(e.unref(ie),{class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(d.value)}),onClick:f=>i(d.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive(d.value)?(e.openBlock(),e.createBlock(e.unref(E),{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))}}),wn=e.defineComponent({__name:"OLinkBtn",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(),a=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var f;i.value="",s.value=!0;const p=(f=o.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(i.value=p.href,s.value=p.target==="_blank",console.log("show",a.value,p,s.value))}function d(){var p;(p=l.value)==null||p.setShow(!1)}function u(p){var f;p?r(o.editor,"linkSet",{href:p,target:s.value?"_blank":""}):r(o.editor,"linkUnset"),(f=l.value)==null||f.setShow(!1)}return(p,f)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:a.value,"onUpdate:show":[f[1]||(f[1]=m=>a.value=m),c]},{trigger:e.withCtx(()=>{var m;return[e.createVNode(e.unref(ae),{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(Do),{key:0,title:e.unref(n)("editor.hyperlink"),val:i.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(On),{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[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"},Sc={class:"icon"},Oc={class:"placeholder"},Pt=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",Sc,[e.createVNode(e.unref(E),{name:t.icon},null,8,["name"])]),e.createElementVNode("div",Oc,e.toDisplayString(t.placeholder),1)]))}}),$c={class:"group o-tips"},Ac={key:1,class:"item"},Ao=e.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(t,{emit:o}){const n=t,r=o,{tr:l}=P(),a=e.ref([]),i=(m,b)=>{m&&(a.value[b]=m)},s=e.ref(0);function c(m,b,g){r("select",m,g),a.value[b]&&a.value[b].setShow(!1)}function d(){s.value=(s.value+n.items.length-1)%n.items.length}function u(){s.value=(s.value+1)%n.items.length}function p(){c(n.items[s.value],s.value)}function f(m){switch(m.key){case"ArrowUp":m.preventDefault(),d();break;case"ArrowDown":m.preventDefault(),u();break;case"Enter":m.preventDefault(),p();break}}return e.watch(()=>n.useKeyboard,m=>{m?window.addEventListener("keydown",f):window.removeEventListener("keydown",f)}),e.onMounted(()=>{n.useKeyboard&&window.addEventListener("keydown",f)}),e.onBeforeUnmount(()=>{n.useKeyboard&&window.removeEventListener("keydown",f)}),(m,b)=>(e.openBlock(),e.createBlock(e.unref(ue),{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,(g,k)=>{var w;return e.openBlock(),e.createElementBlock(e.Fragment,{key:k},[g.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[k>0?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",$c,e.toDisplayString(e.unref(l)(g.group)),1)],64)):e.createCommentVNode("",!0),(w=g.children)!=null&&w.length?(e.openBlock(),e.createBlock(e.unref(Z),{key:1,ref_for:!0,ref:h=>i(h,k),placement:"right-start",offset:[-10,16]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(nn),{item:g,class:e.normalizeClass(["item",{"is-active":k===s.value}]),clickable:""},null,8,["item","class"])]),default:e.withCtx(()=>[e.createVNode(e.unref(Ao),{items:g.children,onSelect:h=>c(g,k,h)},null,8,["items","onSelect"])]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(nn),{key:2,item:g,class:e.normalizeClass(["item",{"is-active":k===s.value}]),clickable:"",onClick:h=>c(g,k)},null,8,["item","class","onClick"]))],64)}),128)):(e.openBlock(),e.createElementBlock("div",Ac,e.toDisplayString(e.unref(l)("label.noResults")),1))]),_:1}))}}),Tc={key:0,class:"o-tips"},nn=e.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(t,{emit:o}){const{tr:n}=P();return(r,l)=>(e.openBlock(),e.createBlock(e.unref(ie),{class:"o-block-list-item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{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",Tc,e.toDisplayString(t.item.tips),1)):e.createCommentVNode("",!0),(a=t.item.children)!=null&&a.length?(e.openBlock(),e.createBlock(e.unref(E),{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}))}}),al=(t,o)=>oe.generateJSON(o,t.extensionManager.extensions),xn=(t,o)=>{const n=document.createElement("div");return n.innerHTML=o,mr.DOMParser.fromSchema(t.schema).parse(n).toJSON()},Dc=(t,o)=>{const n=document.createElement("div");return n.innerHTML=o,mr.DOMParser.fromSchema(t.schema).parse(n).toJSON()},il=()=>{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"}},cl=t=>{const o=t==null?void 0:t.split("+").map(l=>l.trim().toLowerCase()).filter(Boolean);if(!o||!o.length)return t;const n=il();return o.map(l=>n[l]??l.toUpperCase()).join("+")},H={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"},to=[{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:H.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:H.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:H.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:H.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:H.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:H.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:H.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:H.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:H.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:H.blue},{label:"editor.callout",value:"callout",color:H.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:H.blue}],yo=to.filter(t=>t.style),wo=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:H.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:H.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:H.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:H.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:H.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:H.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:H.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:H.purple},{label:"label.audio",value:"audio",icon:"graphic_eq",tips:"audio",color:H.teal},{label:"label.model3d",value:"modelViewer",icon:"3d_rotation",tips:"model",color:H.purple}],sl=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:H.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:H.indigo,tips:"math",keywords:"block, math, equation"},{label:"editor.multiColumn",value:"multiColumn",icon:"view_column",color:H.amber,tips:"column",keywords:"column,columns"}],xo=[...to,...wo,...sl],go=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:H.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:H.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:H.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:H.blue,filter:"audio,image,video,modelViewer"},{label:"label.color",value:"color",icon:"palette",color:H.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:H.purple,filter:"callout",component:"OCalloutColorBoard"}],ul=[{label:"ai.improveWriting",value:"improveWriting",icon:"title",color:H.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fixSpellingGrammar",value:"fixSpellingGrammar",icon:"spellcheck",color:H.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrichWithEmoji",value:"enrichWithEmoji",icon:"emoji_emotions",color:H.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:H.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:H.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.makeShorter",value:"makeShorter",icon:"short_text",color:H.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.changeTone",value:"changeTone",icon:"invert_colors",color:H.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:H.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],dl=[{label:"ai.summarize",value:"summarize",icon:"notes",color:H.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:H.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],Mc={key:1,class:"group o-tips"},Lc={class:"suffix o-tips"},Pc={key:1,class:"item"},Ke=e.defineComponent({__name:"OBlockMenu",props:{...R.nodeViewProps,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(t,{emit:o}){const n=t,r=o,{tr:l}=P(),{run:a}=U(),i=e.ref([]),s=e.computed(()=>{var w;return(w=n.node)==null?void 0:w.type.name}),c=e.computed(()=>yo.find(w=>w.value===s.value)),d=e.computed(()=>{const w=c.value?go.filter(v=>{var _;return((_=v.filter)==null?void 0:_.indexOf("style"))>=0})??[]:[];let h=go.filter(v=>{var _;return((_=v.filter)==null?void 0:_.indexOf(s.value))>=0})??[];if(h=h.concat(w),h.length>0){const v=h[0];v.group=`editor.${s.value}`}const x=go.filter(v=>{var _;return((_=v.filter)==null?void 0:_.indexOf("common"))>=0});return[...h,...x]});function u(w){switch(w.component){case"OCalloutColorBoard":return Cn;case"OTextColorBoard":return _n;default:return null}}function p(w){setTimeout(()=>{f(w),r("action",w)},0)}function f(w){switch(w.value){case"copy":m();break;case"delete":b();break;case"duplicate":g();break}}function m(){a(n.editor,"copySelected")}function b(){a(n.editor,"deleteSelected")}function g(){a(n.editor,"duplicateSelected")}function k(w,h){switch(console.log("select",w,h),h.name){case"backColor":n.updateAttributes({backColor:h.value});break;case"foreColor":n.updateAttributes({borderColor:h.value});break;case"color":a(n.editor,h.name,{color:h.value});break;case"backgroundColor":a(n.editor,h.name,{color:h.value});break}}return(w,h)=>(e.openBlock(),e.createBlock(e.unref(ue),{class:"o-block-menu",hoverable:"",clickable:""},{default:e.withCtx(()=>[d.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.value,(x,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v},[x.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[v>0||c.value?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),t.showGroup?(e.openBlock(),e.createElementBlock("div",Mc,e.toDisplayString(e.unref(l)(x.group)),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),u(x)?(e.openBlock(),e.createBlock(e.unref(Z),{key:1,ref_for:!0,ref:i.value[x.value],offset:[0,4],placement:"right"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ie),{class:"item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:x.icon,color:t.colorful?x.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"navigate_next",class:"o-tips"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)(x.label)),1)]),_:2},1024)]),default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u(x)),{onSelect:_=>k(x,_)},null,40,["onSelect"]))]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(ie),{key:2,class:"item",clickable:"",onClick:e.withModifiers(_=>p(x),["stop"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:x.icon,color:t.colorful?x.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("div",Lc,e.toDisplayString(e.unref(cl)(x.tips)),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)(x.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(e.openBlock(),e.createElementBlock("div",Pc,"No result"))]),_:1}))}}),je=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,r=o,l=e.ref();function a(s){r("update:modelValue",s)}function i(){console.log("click outside"),n.hideClickOutside&&r("update:modelValue",!1)}return e.watch(()=>n.modelValue,s=>{var c,d;s&&!n.readonly?(c=l.value)==null||c.setShow(!0):(d=l.value)==null||d.setShow(!1)}),e.onMounted(()=>{var s;n.modelValue&&((s=l.value)==null||s.setShow(!0))}),e.onUnmounted(()=>{var s;(s=l.value)==null||s.setShow(!1)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,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"]))}}),Rc={class:"o-block-toolbar editable-only"},Ic={class:"button-group"},oo=e.defineComponent({__name:"OBlockToolbar",props:{...R.nodeViewProps,type:{type:String,default:"link"},trigger:{type:String,default:"click"}},emits:["action"],setup(t,{emit:o}){const n=t,r=o,{locale:l,tr:a}=P(),{isEditable:i,run:s}=U(),c=e.ref();function d(u){var p;r("action",u),(p=c.value)==null||p.setShow(!1)}return(u,p)=>(e.openBlock(),e.createElementBlock("div",Rc,[e.createElementVNode("section",Ic,[e.renderSlot(u.$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(ae),{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:d}),null,16)]),_:1},8,["trigger"])])]))}}),jc={class:"o-callout-color-board"},Fc={class:"fore-colors"},zc={class:"color-row"},qc={class:"color-row"},Hc={class:"back-colors"},Uc={class:"color-row"},Wc={class:"color-row"},Cn=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 r(i,s){n("select",{name:i,value:s.value})}const l=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",jc,[e.createElementVNode("section",Fc,[s[4]||(s[4]=e.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),e.createElementVNode("div",zc,[e.createVNode(e.unref(X),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:s[0]||(s[0]=c=>r("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=>r("foreColor",{value:t.foreColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",qc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(c,d)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${d}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:u=>r("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),e.createElementVNode("section",Hc,[s[5]||(s[5]=e.createElementVNode("div",{class:"label o-tips"},"Background",-1)),e.createElementVNode("div",Uc,[e.createVNode(e.unref(X),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:s[2]||(s[2]=c=>r("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=>r("backColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Wc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${d}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>r("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),Yc=e.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:o}){const n=o,{tr:r}=P(),{run:l}=U(),a=e.ref(null),i=e.ref(""),s=e.ref("");function c(d,u){d==="foreColor"?(i.value=u,localStorage.setItem("yiitap.text-color.fore",u)):d==="backColor"&&(s.value=u,localStorage.setItem("yiitap.text-color.back",u)),n("select",d,u)}return e.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(d,u)=>(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(ae),{icon:"palette",tooltip:e.unref(r)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var p;return[e.createVNode(e.unref(Cn),{"fore-color":i.value,"back-color":s.value,"default-label":e.unref(r)("editor.defaultColor"),"active-color":(p=t.editor)==null?void 0:p.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),ht=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,r=o,l=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){r("update:modelValue",s)}function i(){r("update:modelValue",!1)}return e.watch(()=>n.modelValue,s=>{var c;s?setTimeout(()=>{var d;(d=l.value)==null||d.setShow(s)},0):(c=l.value)==null||c.setShow(s)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,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"]))}}),Gc={class:"o-color-board"},Kc={class:"cell-container"},Xc={class:"label"},Jc=["onClick"],vt=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,r=o;function l(c){r("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,d)=>(e.openBlock(),e.createElementBlock("section",Gc,[t.defaultDisabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"default-color",onClick:d[0]||(d[0]=u=>l({hex:t.defaultColor}))},[e.createElementVNode("div",Kc,[e.createElementVNode("div",{class:"cell border",style:e.normalizeStyle({background:t.defaultColor})},[e.createVNode(e.unref(E),{name:"slash_forward"})],4)]),e.createElementVNode("div",Xc,e.toDisplayString(t.defaultLabel),1)])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(u,p)=>(e.openBlock(),e.createElementBlock("div",{class:"color-row",key:`row-${p}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u,(f,m)=>(e.openBlock(),e.createElementBlock("div",{class:"",key:`col-${m}`},[e.createElementVNode("div",{class:"cell-container",onClick:b=>l(f)},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{border:f.border}]),style:e.normalizeStyle({backgroundColor:f.hex})},[a(f.hex)?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:"done",style:e.normalizeStyle({color:i(f.rgb)})},null,8,["style"])):e.createCommentVNode("",!0)],6)],8,Jc)]))),128))]))),128))]))}}),ae=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(r,l)=>(e.openBlock(),e.createBlock(e.unref(xe),{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:l[0]||(l[0]=a=>n("click",a))},[t.icon?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Zc={key:0,class:"o-doc-toc toc"},Qc={class:"mini-view"},es={class:"toc__list"},ts={class:"main-view o-scroll",style:{"max-width":"480px"}},os={class:"toc__title"},ns={class:"toc__list"},rs=["onClick"],ls=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 r=t,l=n,{tr:a}=P(),i=e.ref([]),s=e.ref("");function c(){var m;s.value=window.location.hash,(m=r.editor)==null||m.on("update",u),setTimeout(()=>{d(),u()},0)}function d(){const m=document.querySelector(".yiitap"),b=m==null?void 0:m.parentElement;b==null||b.addEventListener("scroll",p)}function u(){var b;const m=[];(b=r.editor)==null||b.state.doc.descendants((g,k)=>{if(g.type.name==="heading"){const w=g.attrs.id;m.push({level:g.attrs.level,text:g.textContent,id:w})}}),i.value=m}function p(m){for(const b of i.value){const g=document.querySelector(`[data-id="${b.id}"]`);if(!g)continue;const k=g.getBoundingClientRect();if(k.top>=0&&k.top<window.innerHeight/2){s.value=b.id;break}}l("docScroll",m)}function f(m){s.value=m.id;const b=document.querySelector(`[data-id="${m.id}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"start"})}return e.watch(()=>r.editor,m=>{c()}),o({onScroll:p,headings:i}),(m,b)=>i.value.length?(e.openBlock(),e.createElementBlock("section",Zc,[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",Qc,[e.createElementVNode("ul",es,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(g,k)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k},[g.level<=Math.max(Math.min(t.maxLevel,3),2)?(e.openBlock(),e.createElementBlock("li",{key:0,class:e.normalizeClass(["toc__item",[s.value===g.id?"selected":"",`toc__item--${g.level}`]])},null,2)):e.createCommentVNode("",!0)],64))),128))])])]),default:e.withCtx(()=>[e.createElementVNode("div",ts,[e.createElementVNode("div",os,e.toDisplayString(e.unref(a)("label.toc")),1),e.renderSlot(m.$slots,"title"),e.createElementVNode("ul",ns,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(g,k)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["toc__item",`toc__item--${g.level}`]),key:k},[e.createElementVNode("span",{class:e.normalizeClass(["heading",{selected:s.value===g.id}]),onClick:w=>f(g)},e.toDisplayString(g.text),11,rs)],2))),128))])])]),_:3},512)])):e.createCommentVNode("",!0)}}),as={class:"o-emoji-select"},is={key:0},cs={class:"groups o-scroll"},ss={class:"items"},us=["onClick"],ds={key:0,class:"groups-empty"},ps={class:"group-icons"},fs=["onClick"],To=e.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(t,{emit:o}){const n=t,r=o,l=e.ref(null),a=e.ref(""),i=e.ref([]),s=e.ref([]),c=e.ref(0),d=e.computed(()=>a.value?i.value:n.items),u=e.computed(()=>{let b=!1;return d.value.map(g=>{b=b||g.emojis.length}),b});function p(){c.value=0,i.value=a.value?Ht.filterEmojiGroups(a.value):[]}function f(b){r("select",b)}function m(b,g){c.value=g,s.value[g].scrollIntoView({behavior:"instant",block:"start"})}return e.onMounted(()=>{}),(b,g)=>(e.openBlock(),e.createElementBlock("section",as,[t.enableSearch?(e.openBlock(),e.createElementBlock("div",is,[e.createVNode(e.unref(Ee),{ref_key:"input",ref:l,modelValue:a.value,"onUpdate:modelValue":[g[0]||(g[0]=k=>a.value=k),p],type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("section",cs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(k,w)=>{var h;return e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:`group-${w}`,class:"group"},[e.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:s},e.toDisplayString(k.name),513),e.createElementVNode("section",ss,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.emojis,(x,v)=>(e.openBlock(),e.createElementBlock("div",{key:`item-${v}`},[e.createElementVNode("div",{class:"item",onClick:_=>f(x)},e.toDisplayString(x.emoji),9,us)]))),128))])],512)),[[e.vShow,(h=k.emojis)==null?void 0:h.length]])}),128)),u.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ds,"没有记录"))]),e.createElementVNode("section",ps,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(k,w)=>(e.openBlock(),e.createBlock(e.unref(xe),{key:`target-${w}`,delay:300},{trigger:e.withCtx(()=>{var h;return[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["item",{active:c.value===w}]),onClick:x=>m(k,w)},[e.createVNode(e.unref(E),{name:e.unref(Ht.emojiGroupIcons)[k.slug]},null,8,["name"])],10,fs),[[e.vShow,(h=k.emojis)==null?void 0:h.length]])]}),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(k.name),1)]),_:2},1024))),128))])]))}}),jt=[{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"}],ms={class:"selected-language"},vs={class:"header"},gs={class:"o-scroll"},pl=e.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:o}){const n=t,r=o,{tr:l}=P(),a=e.ref(),i=e.ref(),s=e.ref(""),c=e.ref(0),d=e.ref(""),u=e.computed(()=>s.value?jt.filter(w=>w.value.toLowerCase().indexOf(s.value.toLowerCase())>=0):jt),p=e.computed(()=>{let w=jt.find(h=>h.value===d.value);return w||(w=jt.find(h=>h.ext.includes(d.value))),w});function f(w){w&&setTimeout(()=>{var h;(h=i.value)==null||h.focus(),c.value=0,window.addEventListener("keyup",k)},0)}function m(){var w;window.removeEventListener("keyup",k),(w=a.value)==null||w.setShow(!1)}function b(w){m(),d.value=w.value,r("select",w.value)}function g(){b(u.value[c.value])}function k(w){if(u.value.length>0){switch(w.code){case"ArrowDown":c.value=c.value+1;break;case"ArrowUp":c.value=c.value-1;break;case"Enter":g();break}c.value>=u.value.length&&(c.value=0),c.value<0&&(c.value=u.value.length-1)}else c.value=0}return e.onMounted(()=>{d.value=n.language}),(w,h)=>(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":f},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ee),{class:"o-dropdown-btn"},{default:e.withCtx(()=>{var x;return[e.createElementVNode("span",ms,e.toDisplayString((x=p.value)==null?void 0:x.label),1),e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:e.withCtx(()=>[e.createElementVNode("header",vs,[e.createVNode(e.unref(Ee),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":h[0]||(h[0]=x=>s.value=x),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),e.createElementVNode("section",gs,[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(x,v)=>(e.openBlock(),e.createBlock(e.unref(ie),{key:v,onClick:_=>b(x),class:e.normalizeClass({"is-active":x.value===d.value,"is-select":v===c.value})},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:x.icon},null,8,["name"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),bs={class:"o-media-input"},hs={class:"fields"},ks={class:"o-media-title"},ys={class:"actions"},no=e.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(t,{emit:o}){const n=t,r=o,{tr:l}=P(),a=e.ref(),i=e.ref(""),s=e.ref("");function c(){return s.value?(i.value="null",!0):(i.value="error",!1)}function d(){c()&&r("input",s.value)}return e.onMounted(()=>{s.value=n.val,setTimeout(()=>{var u;(u=a.value)==null||u.focus()},0)}),(u,p)=>(e.openBlock(),e.createElementBlock("section",bs,[e.createElementVNode("section",hs,[e.createElementVNode("div",ks,e.toDisplayString(e.unref(l)("label.link")),1),e.createVNode(e.unref(Ee),{ref_key:"input",ref:a,modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=f=>s.value=f),status:i.value,type:"text",autofocus:"",clearable:"",onEnter:d},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),e.createElementVNode("footer",ys,[e.createVNode(e.unref(ee),{type:"info",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("label.ok")),1)]),_:1})])]))}}),ws={class:"o-meta-input"},xs={class:"header"},Cs={class:"title"},_s={class:"fields"},Bs={class:"actions"},Do=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,r=o,{tr:l}=P(),a=e.ref(null),i=e.ref("");function s(){console.log("confirm",i.value),r("confirm",i.value)}return e.onMounted(()=>{i.value=n.val,setTimeout(()=>{var c;(c=a.value)==null||c.focus()},0)}),(c,d)=>(e.openBlock(),e.createElementBlock("section",ws,[e.createElementVNode("section",xs,[e.createElementVNode("div",Cs,e.toDisplayString(t.title),1),e.createElementVNode("div",null,[e.renderSlot(c.$slots,"header-right")])]),e.createElementVNode("section",_s,[e.createVNode(e.unref(Ee),{ref_key:"input",ref:a,modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>i.value=u),type:"text",autofocus:"",clearable:"",onEnter:s},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),e.createElementVNode("footer",Bs,[e.createVNode(e.unref(ee),{type:"tertiary",onClick:d[1]||(d[1]=u=>r("cancel"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("label.cancel")),1)]),_:1}),e.createVNode(e.unref(ee),{type:"info",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)("label.ok")),1)]),_:1})])]))}}),Vs={class:"add"},Co=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,r=o,l=e.ref(!1);function a(){setTimeout(()=>{l.value=!0},0)}function i(s){r("update:modelValue",s)}return e.watch(()=>n.modelValue,s=>{l.value=s}),e.onMounted(()=>{l.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(je),{modelValue:l.value,"onUpdate:modelValue":[c[0]||(c[0]=d=>l.value=d),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} ${l.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",Vs,[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(xe),{placement:t.tooltipPlacement,offset:t.tooltipOffset},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:"circle-button",onClick:c[1]||(c[1]=e.withModifiers(d=>r("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))}}),Ns={class:"o-table-grid"},Es=["onMouseover"],fl=e.defineComponent({__name:"OTableGrid",emits:["select"],setup(t,{emit:o}){const n=o,r=e.ref(6),l=e.ref(6),a=e.ref(2),i=e.ref(2);function s(d,u){a.value=d,i.value=u,r.value===d&&r.value<10&&(r.value+=1),l.value===u&&l.value<10&&(l.value+=1)}function c(){n("select",{rows:a.value,cols:i.value,withHeaderRow:!0})}return(d,u)=>(e.openBlock(),e.createElementBlock("section",Ns,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(p,f)=>(e.openBlock(),e.createElementBlock("div",{class:"rows",key:`row-${f}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(m,b)=>(e.openBlock(),e.createElementBlock("div",{key:`col-${b}`},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{selected:p<=a.value&&m<=i.value}]),onMouseover:g=>s(p,m),onClick:c},null,42,Es)]))),128))]))),128)),e.createElementVNode("footer",null,e.toDisplayString(a.value)+" x "+e.toDisplayString(i.value),1)]))}}),Ss={class:"o-table-cell-background o-button-group"},Os={class:"o-command-btn"},ml=e.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(),a=e.ref("#ffec3d");function i(){s(a.value)}function s(c){l.value.setShow(!1),a.value=c,r(o.editor,"tableCellAttribute",{name:"background",value:a.value})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(xe),{trigger:"hover"},{trigger:e.withCtx(()=>[e.createElementVNode("div",Ss,[e.createElementVNode("div",{class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},[e.createVNode(e.unref(E),{name:"crop_16_9",class:"arrow"}),e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${a.value}`)},null,4)]),e.createElementVNode("div",Os,[e.createVNode(e.unref(E),{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(vt),{"default-color":"","default-label":e.unref(n)("editor.noColor"),onSelect:s},null,8,["default-label"])]),_:1},512))}}),$s={class:"o-simple-color-board"},As={class:"fore-colors"},Ts={class:"label o-tips"},Ds={class:"color-row"},Ms={class:"color-row"},Ls={class:"back-colors"},Ps={class:"label o-tips"},Rs={class:"color-row"},Is={class:"color-row"},_n=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:r}=P();function l(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",$s,[e.createElementVNode("section",As,[e.createElementVNode("header",null,[e.createElementVNode("div",Ts,e.toDisplayString(e.unref(r)("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(xe),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(ee),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(vt),{"default-color":"","default-disabled":"",onSelect:c[0]||(c[0]=d=>l("color",{value:d}))})]),_:1},512)]),e.createElementVNode("div",Ds,[e.createVNode(e.unref(X),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:c[1]||(c[1]=d=>l("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]=d=>l("color",{value:t.foreColor}))},null,8,["color"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ms,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(d,u)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${u}`,icon:"format_text",color:d.value,tooltip:d.label,onClick:p=>l("color",d)},null,8,["color","tooltip","onClick"]))),128))])]),e.createElementVNode("section",Ls,[e.createElementVNode("header",null,[e.createElementVNode("div",Ps,e.toDisplayString(e.unref(r)("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(xe),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(ee),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(vt),{"default-color":"","default-disabled":"",onSelect:c[3]||(c[3]=d=>l("backgroundColor",{value:d}))})]),_:1},512)]),e.createElementVNode("div",Rs,[e.createVNode(e.unref(X),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:c[4]||(c[4]=d=>l("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]=d=>l("backgroundColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Is,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(d,u)=>(e.openBlock(),e.createBlock(e.unref(X),{key:`col-${u}`,icon:"format_text",tooltip:d.label,"content-style":{backgroundColor:d.value},onClick:p=>l("backgroundColor",d)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),_o=Math.min,dt=Math.max,Bo=Math.round,fo=Math.floor,Re=t=>({x:t,y:t}),js={left:"right",right:"left",bottom:"top",top:"bottom"},Fs={start:"end",end:"start"};function lr(t,o,n){return dt(t,_o(o,n))}function Bn(t,o){return typeof t=="function"?t(o):t}function Mt(t){return t.split("-")[0]}function Vn(t){return t.split("-")[1]}function vl(t){return t==="x"?"y":"x"}function gl(t){return t==="y"?"height":"width"}const zs=new Set(["top","bottom"]);function ct(t){return zs.has(Mt(t))?"y":"x"}function bl(t){return vl(ct(t))}function qs(t,o,n){n===void 0&&(n=!1);const r=Vn(t),l=bl(t),a=gl(l);let i=l==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return o.reference[a]>o.floating[a]&&(i=Vo(i)),[i,Vo(i)]}function Hs(t){const o=Vo(t);return[rn(t),o,rn(o)]}function rn(t){return t.replace(/start|end/g,o=>Fs[o])}const ar=["left","right"],ir=["right","left"],Us=["top","bottom"],Ws=["bottom","top"];function Ys(t,o,n){switch(t){case"top":case"bottom":return n?o?ir:ar:o?ar:ir;case"left":case"right":return o?Us:Ws;default:return[]}}function Gs(t,o,n,r){const l=Vn(t);let a=Ys(Mt(t),n==="start",r);return l&&(a=a.map(i=>i+"-"+l),o&&(a=a.concat(a.map(rn)))),a}function Vo(t){return t.replace(/left|right|bottom|top/g,o=>js[o])}function Ks(t){return{top:0,right:0,bottom:0,left:0,...t}}function Xs(t){return typeof t!="number"?Ks(t):{top:t,right:t,bottom:t,left:t}}function No(t){const{x:o,y:n,width:r,height:l}=t;return{width:r,height:l,top:n,left:o,right:o+r,bottom:n+l,x:o,y:n}}function cr(t,o,n){let{reference:r,floating:l}=t;const a=ct(o),i=bl(o),s=gl(i),c=Mt(o),d=a==="y",u=r.x+r.width/2-l.width/2,p=r.y+r.height/2-l.height/2,f=r[s]/2-l[s]/2;let m;switch(c){case"top":m={x:u,y:r.y-l.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:p};break;case"left":m={x:r.x-l.width,y:p};break;default:m={x:r.x,y:r.y}}switch(Vn(o)){case"start":m[i]-=f*(n&&d?-1:1);break;case"end":m[i]+=f*(n&&d?-1:1);break}return m}async function Js(t,o){var n;o===void 0&&(o={});const{x:r,y:l,platform:a,rects:i,elements:s,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:f=!1,padding:m=0}=Bn(o,t),b=Xs(m),k=s[f?p==="floating"?"reference":"floating":p],w=No(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(k)))==null||n?k:k.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:d,rootBoundary:u,strategy:c})),h=p==="floating"?{x:r,y:l,width:i.floating.width,height:i.floating.height}:i.reference,x=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),v=await(a.isElement==null?void 0:a.isElement(x))?await(a.getScale==null?void 0:a.getScale(x))||{x:1,y:1}:{x:1,y:1},_=No(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:h,offsetParent:x,strategy:c}):h);return{top:(w.top-_.top+b.top)/v.y,bottom:(_.bottom-w.bottom+b.bottom)/v.y,left:(w.left-_.left+b.left)/v.x,right:(_.right-w.right+b.right)/v.x}}const Zs=async(t,o,n)=>{const{placement:r="bottom",strategy:l="absolute",middleware:a=[],platform:i}=n,s=a.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(o));let d=await i.getElementRects({reference:t,floating:o,strategy:l}),{x:u,y:p}=cr(d,r,c),f=r,m={},b=0;for(let k=0;k<s.length;k++){var g;const{name:w,fn:h}=s[k],{x,y:v,data:_,reset:C}=await h({x:u,y:p,initialPlacement:r,placement:f,strategy:l,middlewareData:m,rects:d,platform:{...i,detectOverflow:(g=i.detectOverflow)!=null?g:Js},elements:{reference:t,floating:o}});u=x??u,p=v??p,m={...m,[w]:{...m[w],..._}},C&&b<=50&&(b++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(d=C.rects===!0?await i.getElementRects({reference:t,floating:o,strategy:l}):C.rects),{x:u,y:p}=cr(d,f,c)),k=-1)}return{x:u,y:p,placement:f,strategy:l,middlewareData:m}},Qs=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(o){var n,r;const{placement:l,middlewareData:a,rects:i,initialPlacement:s,platform:c,elements:d}=o,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...k}=Bn(t,o);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const w=Mt(l),h=ct(s),x=Mt(s)===s,v=await(c.isRTL==null?void 0:c.isRTL(d.floating)),_=f||(x||!g?[Vo(s)]:Hs(s)),C=b!=="none";!f&&C&&_.push(...Gs(s,g,b,v));const O=[s,..._],M=await c.detectOverflow(o,k),A=[];let T=((r=a.flip)==null?void 0:r.overflows)||[];if(u&&A.push(M[w]),p){const $=qs(l,i,v);A.push(M[$[0]],M[$[1]])}if(T=[...T,{placement:l,overflows:A}],!A.every($=>$<=0)){var z,V;const $=(((z=a.flip)==null?void 0:z.index)||0)+1,L=O[$];if(L&&(!(p==="alignment"?h!==ct(L):!1)||T.every(I=>ct(I.placement)===h?I.overflows[0]>0:!0)))return{data:{index:$,overflows:T},reset:{placement:L}};let q=(V=T.filter(G=>G.overflows[0]<=0).sort((G,I)=>G.overflows[1]-I.overflows[1])[0])==null?void 0:V.placement;if(!q)switch(m){case"bestFit":{var N;const G=(N=T.filter(I=>{if(C){const S=ct(I.placement);return S===h||S==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(S=>S>0).reduce((S,K)=>S+K,0)]).sort((I,S)=>I[1]-S[1])[0])==null?void 0:N[0];G&&(q=G);break}case"initialPlacement":q=s;break}if(l!==q)return{reset:{placement:q}}}return{}}}},eu=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(o){const{x:n,y:r,placement:l,platform:a}=o,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:w=>{let{x:h,y:x}=w;return{x:h,y:x}}},...d}=Bn(t,o),u={x:n,y:r},p=await a.detectOverflow(o,d),f=ct(Mt(l)),m=vl(f);let b=u[m],g=u[f];if(i){const w=m==="y"?"top":"left",h=m==="y"?"bottom":"right",x=b+p[w],v=b-p[h];b=lr(x,b,v)}if(s){const w=f==="y"?"top":"left",h=f==="y"?"bottom":"right",x=g+p[w],v=g-p[h];g=lr(x,g,v)}const k=c.fn({...o,[m]:b,[f]:g});return{...k,data:{x:k.x-n,y:k.y-r,enabled:{[m]:i,[f]:s}}}}}};function Mo(){return typeof window<"u"}function Rt(t){return hl(t)?(t.nodeName||"").toLowerCase():"#document"}function ye(t){var o;return(t==null||(o=t.ownerDocument)==null?void 0:o.defaultView)||window}function ze(t){var o;return(o=(hl(t)?t.ownerDocument:t.document)||window.document)==null?void 0:o.documentElement}function hl(t){return Mo()?t instanceof Node||t instanceof ye(t).Node:!1}function Ae(t){return Mo()?t instanceof Element||t instanceof ye(t).Element:!1}function Fe(t){return Mo()?t instanceof HTMLElement||t instanceof ye(t).HTMLElement:!1}function sr(t){return!Mo()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ye(t).ShadowRoot}const tu=new Set(["inline","contents"]);function ro(t){const{overflow:o,overflowX:n,overflowY:r,display:l}=Te(t);return/auto|scroll|overlay|hidden|clip/.test(o+r+n)&&!tu.has(l)}const ou=new Set(["table","td","th"]);function nu(t){return ou.has(Rt(t))}const ru=[":popover-open",":modal"];function Lo(t){return ru.some(o=>{try{return t.matches(o)}catch{return!1}})}const lu=["transform","translate","scale","rotate","perspective"],au=["transform","translate","scale","rotate","perspective","filter"],iu=["paint","layout","strict","content"];function Nn(t){const o=En(),n=Ae(t)?Te(t):t;return lu.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!o&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!o&&(n.filter?n.filter!=="none":!1)||au.some(r=>(n.willChange||"").includes(r))||iu.some(r=>(n.contain||"").includes(r))}function cu(t){let o=Qe(t);for(;Fe(o)&&!Lt(o);){if(Nn(o))return o;if(Lo(o))return null;o=Qe(o)}return null}function En(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const su=new Set(["html","body","#document"]);function Lt(t){return su.has(Rt(t))}function Te(t){return ye(t).getComputedStyle(t)}function Po(t){return Ae(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Qe(t){if(Rt(t)==="html")return t;const o=t.assignedSlot||t.parentNode||sr(t)&&t.host||ze(t);return sr(o)?o.host:o}function kl(t){const o=Qe(t);return Lt(o)?t.ownerDocument?t.ownerDocument.body:t.body:Fe(o)&&ro(o)?o:kl(o)}function Xt(t,o,n){var r;o===void 0&&(o=[]),n===void 0&&(n=!0);const l=kl(t),a=l===((r=t.ownerDocument)==null?void 0:r.body),i=ye(l);if(a){const s=ln(i);return o.concat(i,i.visualViewport||[],ro(l)?l:[],s&&n?Xt(s):[])}return o.concat(l,Xt(l,[],n))}function ln(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function yl(t){const o=Te(t);let n=parseFloat(o.width)||0,r=parseFloat(o.height)||0;const l=Fe(t),a=l?t.offsetWidth:n,i=l?t.offsetHeight:r,s=Bo(n)!==a||Bo(r)!==i;return s&&(n=a,r=i),{width:n,height:r,$:s}}function Sn(t){return Ae(t)?t:t.contextElement}function St(t){const o=Sn(t);if(!Fe(o))return Re(1);const n=o.getBoundingClientRect(),{width:r,height:l,$:a}=yl(o);let i=(a?Bo(n.width):n.width)/r,s=(a?Bo(n.height):n.height)/l;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const uu=Re(0);function wl(t){const o=ye(t);return!En()||!o.visualViewport?uu:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function du(t,o,n){return o===void 0&&(o=!1),!n||o&&n!==ye(t)?!1:o}function gt(t,o,n,r){o===void 0&&(o=!1),n===void 0&&(n=!1);const l=t.getBoundingClientRect(),a=Sn(t);let i=Re(1);o&&(r?Ae(r)&&(i=St(r)):i=St(t));const s=du(a,n,r)?wl(a):Re(0);let c=(l.left+s.x)/i.x,d=(l.top+s.y)/i.y,u=l.width/i.x,p=l.height/i.y;if(a){const f=ye(a),m=r&&Ae(r)?ye(r):r;let b=f,g=ln(b);for(;g&&r&&m!==b;){const k=St(g),w=g.getBoundingClientRect(),h=Te(g),x=w.left+(g.clientLeft+parseFloat(h.paddingLeft))*k.x,v=w.top+(g.clientTop+parseFloat(h.paddingTop))*k.y;c*=k.x,d*=k.y,u*=k.x,p*=k.y,c+=x,d+=v,b=ye(g),g=ln(b)}}return No({width:u,height:p,x:c,y:d})}function Ro(t,o){const n=Po(t).scrollLeft;return o?o.left+n:gt(ze(t)).left+n}function xl(t,o){const n=t.getBoundingClientRect(),r=n.left+o.scrollLeft-Ro(t,n),l=n.top+o.scrollTop;return{x:r,y:l}}function pu(t){let{elements:o,rect:n,offsetParent:r,strategy:l}=t;const a=l==="fixed",i=ze(r),s=o?Lo(o.floating):!1;if(r===i||s&&a)return n;let c={scrollLeft:0,scrollTop:0},d=Re(1);const u=Re(0),p=Fe(r);if((p||!p&&!a)&&((Rt(r)!=="body"||ro(i))&&(c=Po(r)),Fe(r))){const m=gt(r);d=St(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const f=i&&!p&&!a?xl(i,c):Re(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+f.x,y:n.y*d.y-c.scrollTop*d.y+u.y+f.y}}function fu(t){return Array.from(t.getClientRects())}function mu(t){const o=ze(t),n=Po(t),r=t.ownerDocument.body,l=dt(o.scrollWidth,o.clientWidth,r.scrollWidth,r.clientWidth),a=dt(o.scrollHeight,o.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ro(t);const s=-n.scrollTop;return Te(r).direction==="rtl"&&(i+=dt(o.clientWidth,r.clientWidth)-l),{width:l,height:a,x:i,y:s}}const ur=25;function vu(t,o){const n=ye(t),r=ze(t),l=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,s=0,c=0;if(l){a=l.width,i=l.height;const u=En();(!u||u&&o==="fixed")&&(s=l.offsetLeft,c=l.offsetTop)}const d=Ro(r);if(d<=0){const u=r.ownerDocument,p=u.body,f=getComputedStyle(p),m=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,b=Math.abs(r.clientWidth-p.clientWidth-m);b<=ur&&(a-=b)}else d<=ur&&(a+=d);return{width:a,height:i,x:s,y:c}}const gu=new Set(["absolute","fixed"]);function bu(t,o){const n=gt(t,!0,o==="fixed"),r=n.top+t.clientTop,l=n.left+t.clientLeft,a=Fe(t)?St(t):Re(1),i=t.clientWidth*a.x,s=t.clientHeight*a.y,c=l*a.x,d=r*a.y;return{width:i,height:s,x:c,y:d}}function dr(t,o,n){let r;if(o==="viewport")r=vu(t,n);else if(o==="document")r=mu(ze(t));else if(Ae(o))r=bu(o,n);else{const l=wl(t);r={x:o.x-l.x,y:o.y-l.y,width:o.width,height:o.height}}return No(r)}function Cl(t,o){const n=Qe(t);return n===o||!Ae(n)||Lt(n)?!1:Te(n).position==="fixed"||Cl(n,o)}function hu(t,o){const n=o.get(t);if(n)return n;let r=Xt(t,[],!1).filter(s=>Ae(s)&&Rt(s)!=="body"),l=null;const a=Te(t).position==="fixed";let i=a?Qe(t):t;for(;Ae(i)&&!Lt(i);){const s=Te(i),c=Nn(i);!c&&s.position==="fixed"&&(l=null),(a?!c&&!l:!c&&s.position==="static"&&!!l&&gu.has(l.position)||ro(i)&&!c&&Cl(t,i))?r=r.filter(u=>u!==i):l=s,i=Qe(i)}return o.set(t,r),r}function ku(t){let{element:o,boundary:n,rootBoundary:r,strategy:l}=t;const i=[...n==="clippingAncestors"?Lo(o)?[]:hu(o,this._c):[].concat(n),r],s=i[0],c=i.reduce((d,u)=>{const p=dr(o,u,l);return d.top=dt(p.top,d.top),d.right=_o(p.right,d.right),d.bottom=_o(p.bottom,d.bottom),d.left=dt(p.left,d.left),d},dr(o,s,l));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function yu(t){const{width:o,height:n}=yl(t);return{width:o,height:n}}function wu(t,o,n){const r=Fe(o),l=ze(o),a=n==="fixed",i=gt(t,!0,a,o);let s={scrollLeft:0,scrollTop:0};const c=Re(0);function d(){c.x=Ro(l)}if(r||!r&&!a)if((Rt(o)!=="body"||ro(l))&&(s=Po(o)),r){const m=gt(o,!0,a,o);c.x=m.x+o.clientLeft,c.y=m.y+o.clientTop}else l&&d();a&&!r&&l&&d();const u=l&&!r&&!a?xl(l,s):Re(0),p=i.left+s.scrollLeft-c.x-u.x,f=i.top+s.scrollTop-c.y-u.y;return{x:p,y:f,width:i.width,height:i.height}}function Ko(t){return Te(t).position==="static"}function pr(t,o){if(!Fe(t)||Te(t).position==="fixed")return null;if(o)return o(t);let n=t.offsetParent;return ze(t)===n&&(n=n.ownerDocument.body),n}function _l(t,o){const n=ye(t);if(Lo(t))return n;if(!Fe(t)){let l=Qe(t);for(;l&&!Lt(l);){if(Ae(l)&&!Ko(l))return l;l=Qe(l)}return n}let r=pr(t,o);for(;r&&nu(r)&&Ko(r);)r=pr(r,o);return r&&Lt(r)&&Ko(r)&&!Nn(r)?n:r||cu(t)||n}const xu=async function(t){const o=this.getOffsetParent||_l,n=this.getDimensions,r=await n(t.floating);return{reference:wu(t.reference,await o(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cu(t){return Te(t).direction==="rtl"}const _u={convertOffsetParentRelativeRectToViewportRelativeRect:pu,getDocumentElement:ze,getClippingRect:ku,getOffsetParent:_l,getElementRects:xu,getClientRects:fu,getDimensions:yu,getScale:St,isElement:Ae,isRTL:Cu};function Bl(t,o){return t.x===o.x&&t.y===o.y&&t.width===o.width&&t.height===o.height}function Bu(t,o){let n=null,r;const l=ze(t);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function i(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();const d=t.getBoundingClientRect(),{left:u,top:p,width:f,height:m}=d;if(s||o(),!f||!m)return;const b=fo(p),g=fo(l.clientWidth-(u+f)),k=fo(l.clientHeight-(p+m)),w=fo(u),x={rootMargin:-b+"px "+-g+"px "+-k+"px "+-w+"px",threshold:dt(0,_o(1,c))||1};let v=!0;function _(C){const O=C[0].intersectionRatio;if(O!==c){if(!v)return i();O?i(!1,O):r=setTimeout(()=>{i(!1,1e-7)},1e3)}O===1&&!Bl(d,t.getBoundingClientRect())&&i(),v=!1}try{n=new IntersectionObserver(_,{...x,root:l.ownerDocument})}catch{n=new IntersectionObserver(_,x)}n.observe(t)}return i(!0),a}function Vu(t,o,n,r){r===void 0&&(r={});const{ancestorScroll:l=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Sn(t),u=l||a?[...d?Xt(d):[],...Xt(o)]:[];u.forEach(w=>{l&&w.addEventListener("scroll",n,{passive:!0}),a&&w.addEventListener("resize",n)});const p=d&&s?Bu(d,n):null;let f=-1,m=null;i&&(m=new ResizeObserver(w=>{let[h]=w;h&&h.target===d&&m&&(m.unobserve(o),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(o)})),n()}),d&&!c&&m.observe(d),m.observe(o));let b,g=c?gt(t):null;c&&k();function k(){const w=gt(t);g&&!Bl(g,w)&&n(),g=w,b=requestAnimationFrame(k)}return n(),()=>{var w;u.forEach(h=>{l&&h.removeEventListener("scroll",n),a&&h.removeEventListener("resize",n)}),p==null||p(),(w=m)==null||w.disconnect(),m=null,c&&cancelAnimationFrame(b)}}const Nu=eu,Eu=Qs,Vl=(t,o,n)=>{const r=new Map,l={platform:_u,...n},a={...l.platform,_c:r};return Zs(t,o,{...l,platform:a})};class Su{constructor(){te(this,"instances",[]);te(this,"gap",12);te(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",r=3e3){const l=document.createElement("div");l.className=`o-toast ${n}`,Object.assign(l.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"}),l.innerHTML=`
26
+ <i class="yiitip-icon icon-${n}"></i>
27
+ <span class="message">${o}</span>
28
+ `,document.body.appendChild(l);const a={el:l,cleanup:()=>{},x:0};let i=!0;a.cleanup=Vu(document.body,l,()=>{Vl(document.body,l,{placement:"top",middleware:[Nu(),Eu()]}).then(({x:s})=>{if(a.x=s,i){const c=-l.offsetHeight;l.style.transition="none",l.style.transform=`translate3d(${s}px, ${c}px, 0)`,l.offsetHeight,l.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(),l.style.opacity="1"}else this.repositionToasts()})}),r>0&&setTimeout(()=>this.destroy(a),r)}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 r=l=>{l.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",r))};o.el.addEventListener("transitionend",r)}}const Jt=new Su,Ce=e.defineComponent({__name:"ONodeView",props:R.nodeViewProps,setup(t){return(o,n)=>(e.openBlock(),e.createBlock(e.unref(R.NodeViewWrapper),{class:"o-node-view","data-id":o.node.attrs.id},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},8,["data-id"]))}}),Ou={class:"o-add-node-view"},$u={key:0,class:"view-main"},Au={class:"group o-tips"},Tu={class:"panel"},Du={class:"group o-tips"},Mu={key:1,class:"item"},Lu=e.defineComponent({__name:"AddNodeView",props:R.nodeViewProps,emits:["action"],setup(t,{emit:o}){const n=t,r=o,{locale:l,tr:a}=P(),{run:i}=U(),s=e.ref("main");function c(p){let f=null;switch(p.value){case"aiBlock":f=vc;break;case"audio":f=gc;break;case"blockquote":f=bc;break;case"callout":f=hc;break;case"codeBlock":f=kc;break;case"details":f=yc;break;case"diagram":f=ol;break;case"emoji":f=wc;break;case"heading":f={attrs:p.options};break;case"horizontalRule":f={};break;case"paragraph":f={type:"paragraph",content:[]};break;case"bulletList":case"orderedList":f={content:Cc};break;case"taskList":f={content:Bc};break;case"table":f=_c;break;case"image":f=xc;break;case"model-viewer":f={attrs:{src:"init"}};break;case"video":f=Vc;break}if(f){f.type=f.type||p.value;const m=d.value?u.value+1:u.value,b=p.value==="emoji"?m+2:m+1;requestAnimationFrame(()=>{n.editor.chain().insertContentAt(m,f).focus(b).scrollIntoView().run()})}r("action",p)}const d=e.computed(()=>{var p;return((p=n.node)==null?void 0:p.content.size)===0}),u=e.computed(()=>d.value?n.getPos():n.getPos()+n.node.nodeSize);return(p,f)=>(e.openBlock(),e.createElementBlock("section",Ou,[s.value==="main"?(e.openBlock(),e.createElementBlock("section",$u,[e.createElementVNode("section",null,[e.createElementVNode("div",Au,e.toDisplayString(e.unref(a)("label.basic")),1),e.createElementVNode("section",Tu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(to),(m,b)=>(e.openBlock(),e.createBlock(e.unref(X),{key:b,icon:m.icon,tooltip:e.unref(a)(m.label),quaternary:"",onClick:g=>c(m)},null,8,["icon","tooltip","onClick"]))),128))])]),e.createVNode(e.unref(fe)),e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[e.unref(wo).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(wo),(m,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[m.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[b>0?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",Du,e.toDisplayString(e.unref(a)(m.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(ie),{class:"item",clickable:"",onClick:g=>c(m)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{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",Mu,"No result"))]),_:1})])):e.createCommentVNode("",!0)]))}}),Nl=e.defineComponent({__name:"AddNode",props:{...R.nodeViewProps,add:{type:String,default:"menu"}},setup(t){const o=t,n=e.ref(),r=e.ref(!1),l=e.computed(()=>{var u;return((u=o.node)==null?void 0:u.content.size)===0}),a=e.computed(()=>l.value?o.getPos():o.getPos()+o.node.nodeSize);function i(u){r.value=u}function s(){var u;o.add==="menu"?(u=n.value)==null||u.setShow(!0):c()}function c(){const u={type:"paragraph",content:[{type:"text",text:"/"}]},p=l.value?a.value+1:a.value,f=p+2;requestAnimationFrame(()=>{o.editor.chain().insertContentAt(p,u).focus(f).scrollIntoView().run()})}function d(){var u;(u=n.value)==null||u.setShow(!1),r.value=!1}return(u,p)=>(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":r.value}])},[e.createVNode(e.unref(ee),{type:"tertiary",class:"o-node-btn",onClick:s},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"add",small:""})]),_:1})],2)]),default:e.withCtx(()=>[e.createVNode(Lu,e.mergeProps(o,{onAction:d}),null,16)]),_:1},512))}}),Pu={class:"o-drag-node-view"},Ru={key:0,class:"view-main"},Iu={key:0},ju={class:"group o-tips"},Fu={class:"panel"},zu=e.defineComponent({__name:"DragNodeView",props:R.nodeViewProps,emits:["action"],setup(t,{emit:o}){const n=t,r=o,{locale:l,tr:a}=P(),{run:i,onCommand:s}=U(),c=e.ref("main"),d=e.ref(["heading","codeBlock","paragraph"]),u=e.computed(()=>{var k,w;const g=(k=n.node)==null?void 0:k.content.content;if(g.length>0){const h=g[0];if(h.type.name==="image")return h.type.name}return(w=n.node)==null?void 0:w.type.name}),p=e.computed(()=>yo.find(g=>g.value===u.value));function f(g){var k;return g.value===u.value&&((k=n.editor)==null?void 0:k.isActive(u.value,g.options))}function m(g){switch(g.value){case"copy":case"delete":case"duplicate":break;default:b(g);break}r("action",g)}function b(g){var x,v,_,C,O;const k=n.getPos();if(g.value===u.value&&d.value.indexOf(u.value)<0){const M=(x=n.editor)==null?void 0:x.isActive(u.value),A=(v=n.editor)==null?void 0:v.commands.lift(u.value);console.log("lift",u.value,M,A);return}const w=(_=n.editor)==null?void 0:_.commands,h=(C=n.editor)==null?void 0:C.chain().focus(k+1);console.log("runCommand",g),s(w,h,g.value,g.options),(O=n.editor)==null||O.commands.focus()}return(g,k)=>(e.openBlock(),e.createElementBlock("section",Pu,[c.value==="main"?(e.openBlock(),e.createElementBlock("section",Ru,[p.value?(e.openBlock(),e.createElementBlock("section",Iu,[e.createElementVNode("div",ju,e.toDisplayString(e.unref(a)("label.turnInto")),1),e.createElementVNode("section",Fu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(yo),(w,h)=>(e.openBlock(),e.createBlock(e.unref(X),{key:h,icon:w.icon,tooltip:e.unref(a)(w.label),"content-class":{"is-active":f(w)},quaternary:"",onClick:x=>m(w)},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)]))}}),El=e.defineComponent({__name:"DragNode",props:R.nodeViewProps,emits:["dragstart","dragend"],setup(t,{emit:o}){const n=t,r=o,{run:l}=U(),a=e.ref(null),i=e.ref(!1),s=e.ref(["heading","codeBlock","paragraph"]),c=e.computed(()=>{var k,w,h;const g=(w=(k=n.node)==null?void 0:k.content)==null?void 0:w.content;if((g==null?void 0:g.length)>0){const x=g[0];if(x.type.name==="image")return x.type.name}return(h=n.node)==null?void 0:h.type.name}),d=e.computed(()=>{var k;let g=c.value;return g==="heading"?{icon:`format_h${((k=n.node.attrs)==null?void 0:k.level)||1}`,color:H.blue}:(g==="table-wrapper"&&(g="table"),xo.find(w=>w.value===g)||xo.find(w=>{var h;return(h=w.keywords)==null?void 0:h.split(",").includes(g)})||{icon:"title"})});function u(g){r("dragstart",g)}function p(g){r("dragend",g)}function f(g){var k;(k=a.value)==null||k.setShow(!1)}function m(g){i.value=g,g&&b()}function b(){var k;let g=n.getPos();s.value.includes(c.value),(k=n.editor)==null||k.commands.setNodeSelection(g)}return e.watch(()=>n.getPos(),g=>{var k;(k=a.value)==null||k.setShow(!1)}),(g,k)=>(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:u,onDragend:p},[e.createVNode(e.unref(ee),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:d.value.icon,color:d.value.color,small:""},null,8,["name","color"]),e.createVNode(e.unref(E),{name:"drag_indicator",small:""})]),_:1})],34)]),default:e.withCtx(()=>[e.createVNode(zu,e.mergeProps(n,{onAction:f}),null,16)]),_:1},512))}}),qu={key:0,class:"spinner"},Hu={key:2,class:"o-btn__label"},ee=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(r,l)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["o-btn",t.type?`type-${t.type}`:""]),onClick:l[0]||(l[0]=a=>n("click",a))},[t.loading?(e.openBlock(),e.createElementBlock("div",qu)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.icon?(e.openBlock(),e.createBlock(e.unref(E),{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",Hu,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default")],2))}}),Uu={class:"o-btn-group"},Sl=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,r)=>(e.openBlock(),e.createElementBlock("div",Uu,[e.renderSlot(n.$slots,"default")]))}}),Wu={class:"o-checkbox"},Yu={class:"o-checkbox__main"},Gu={class:"o-checkbox__suffix"},On=e.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t,r=o,l=e.computed({get(){return n.modelValue},set(a){r("update:modelValue",a)}});return(a,i)=>(e.openBlock(),e.createElementBlock("div",Wu,[e.createElementVNode("div",Yu,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=s=>l.value=s),type:"checkbox"},null,512),[[e.vModelCheckbox,l.value]])]),e.createElementVNode("div",Gu,e.toDisplayString(t.label),1)]))}}),Ku={class:"dialog-header"},Xu={class:"dialog-body"},Ju={class:"dialog-footer"},$n=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,r=()=>{n("update:show",!1),n("close")};return(l,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(r,["self"])},[e.createElementVNode("div",{class:e.normalizeClass(["dialog-box",{fullscreen:t.fullscreen}])},[e.createElementVNode("div",Ku,[e.renderSlot(l.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),e.createVNode(e.unref(ee),{icon:"close",class:"close",onClick:r})]),e.createElementVNode("div",Xu,[e.renderSlot(l.$slots,"default")]),e.createElementVNode("div",Ju,[e.renderSlot(l.$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))}}),Zu={key:0,class:"dialog-overlay o-image-viewer"},Qu={class:"dialog-box"},ed={class:"dialog-body"},td=["src"],od={class:"action-group"},nd={class:"action-group"},rd={class:"o-btn scale"},Ol=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,r=o,{downloadImage:l}=Oo(),a=e.ref(0),i=e.ref(1),s=e.ref({x:0,y:0}),c=e.ref(!1),d=e.ref({x:0,y:0}),u=e.ref(null),p=e.ref(null),f={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},m=e.computed(()=>{const V=n.images.length;let N={};return V>0&&(N=a.value>=0&&a.value<V?n.images.at(a.value):n.images.at(0)),N}),b=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"})),g=e.computed(()=>parseInt(`${i.value*100}`)),k=V=>{V.preventDefault();const N=-V.deltaY*f.WHEEL_SENSITIVITY;let $=i.value+N;if($=Math.max(f.MIN_SCALE,Math.min(f.MAX_SCALE,$)),p.value&&u.value){const L=p.value.getBoundingClientRect(),q=V.clientX-L.left-L.width/2,G=V.clientY-L.top-L.height/2,I=$-i.value;s.value.x-=q*I,s.value.y-=G*I}i.value=$},w=V=>{i.value<=1||(V.preventDefault(),c.value=!0,d.value={x:V.clientX-s.value.x,y:V.clientY-s.value.y},document.addEventListener("mousemove",h),document.addEventListener("mouseup",x))},h=V=>{c.value&&(s.value.x=V.clientX-d.value.x,s.value.y=V.clientY-d.value.y)},x=()=>{c.value=!1,document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",x)},v=()=>{i.value=Math.min(f.MAX_SCALE,i.value+f.STEP)},_=()=>{i.value=Math.max(f.MIN_SCALE,i.value-f.STEP)},C=()=>{i.value=1,s.value={x:0,y:0}},O=()=>{a.value>0&&(a.value-=1,C())},M=()=>{a.value<n.images.length-1&&(a.value+=1,C())},A=()=>{C(),r("update:show",!1)},T=()=>{var V;l((V=m.value.attrs)==null?void 0:V.src)},z=V=>{if(n.show)switch(V.preventDefault(),V.stopPropagation(),V.key){case"+":case"=":V.preventDefault(),v();break;case"-":V.preventDefault(),_();break;case"0":V.preventDefault(),C();break;case"ArrowLeft":(V.ctrlKey||V.metaKey)&&(V.preventDefault(),O());break;case"ArrowRight":(V.ctrlKey||V.metaKey)&&(V.preventDefault(),M());break;case"Escape":A();break}};return e.watch(()=>n.current,V=>{a.value=V,C()}),e.onMounted(()=>{a.value=n.current,document.addEventListener("keydown",z)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",z),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",x)}),(V,N)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.show?(e.openBlock(),e.createElementBlock("div",Zu,[e.createElementVNode("header",null,[e.createVNode(e.unref(ee),{icon:"close",onClick:A})]),e.createElementVNode("div",Qu,[e.createElementVNode("div",ed,[e.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:p,onWheel:e.withModifiers(k,["prevent"]),onDblclick:C},[e.createElementVNode("img",{ref_key:"imageRef",ref:u,src:m.value.attrs.src,alt:"image",style:e.normalizeStyle(b.value),onMousedown:w},null,44,td)],544)])]),e.createElementVNode("footer",null,[e.createElementVNode("div",od,[e.createVNode(e.unref(ee),{icon:"arrow_back",class:e.normalizeClass({disabled:a.value<=0}),onClick:O},null,8,["class"]),e.createVNode(e.unref(ee),{icon:"arrow_back","icon-class":"rotate-180",class:e.normalizeClass({disabled:a.value>=n.images.length-1}),onClick:M},null,8,["class"])]),e.createElementVNode("div",nd,[e.createVNode(e.unref(ee),{icon:"horizontal_rule",onClick:_}),e.createElementVNode("div",rd,e.toDisplayString(g.value)+"%",1),e.createVNode(e.unref(ee),{icon:"add",onClick:v}),e.createVNode(e.unref(ee),{icon:"download",onClick:T}),e.createVNode(e.unref(ee),{icon:"close",onClick:A})])])])):e.createCommentVNode("",!0)]))}}),ld={class:"o-input__prefix"},ad={class:"o-input__main"},id=["placeholder"],cd={class:"o-input__suffix"},Ee=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 r=t,l=n,a=e.ref(null),i=e.computed({get(){return r.modelValue},set(d){l("update:modelValue",d)}});function s(){var d;(d=a.value)==null||d.focus()}function c(){i.value="",s()}return o({clear:c,focus:s}),(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-input",`type-${t.type}`])},[e.createElementVNode("div",ld,[e.renderSlot(d.$slots,"prefix")]),e.createElementVNode("div",ad,[e.withDirectives(e.createElementVNode("input",{ref_key:"input",ref:a,"onUpdate:modelValue":u[0]||(u[0]=p=>i.value=p),placeholder:t.placeholder,onFocus:u[1]||(u[1]=p=>l("focus")),onBlur:u[2]||(u[2]=p=>l("blur")),onKeyup:u[3]||(u[3]=e.withKeys(p=>l("enter"),["enter"]))},null,40,id),[[e.vModelText,i.value]])]),e.createElementVNode("div",cd,[e.renderSlot(d.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock(E,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),ue=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))}}),sd={class:"o-list-item"},ud={class:"o-list-item__prefix"},dd={class:"o-list-item__main"},pd={class:"o-list-item__suffix"},ie=e.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(o,n)=>(e.openBlock(),e.createElementBlock("li",sd,[e.createElementVNode("div",ud,[e.renderSlot(o.$slots,"prefix")]),e.createElementVNode("div",dd,[e.renderSlot(o.$slots,"default")]),e.createElementVNode("div",pd,[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 r=t,l=n,{theme:a}=bt(),i=e.ref(null),s=e.ref(),c=e.ref();function d(m){var b,g,k,w;m?((g=c.value)==null||g.setProps({getReferenceClientRect:(b=r.event)!=null&&b.clientX?u:null}),(k=c.value)==null||k.show()):(w=c.value)==null||w.hide()}function u(){var m,b;return{width:0,height:0,left:r.event.clientX,right:r.event.clientX,top:r.event.clientY,bottom:r.event.clientY,x:((m=r.event)==null?void 0:m.clientX)||0,y:((b=r.event)==null?void 0:b.clientY)||0,toJSON:()=>{var g,k;return{width:100,height:100,left:((g=r.event)==null?void 0:g.clientX)||0,top:((k=r.event)==null?void 0:k.clientY)||0}}}}function p(){c.value=Ge(i.value,{appendTo:()=>document.body,animation:"shift-away",arrow:r.arrow,content:s.value,duration:r.duration,delay:r.delay,interactive:!0,offset:r.offset,placement:r.placement,trigger:r.trigger,theme:a.value,onShow:m=>{m.popper.classList.add(r.tippyClass||"tippy"),l("update:show",!0)},onHide:m=>{l("update:show",!1)}})}function f(){c.value.setProps({theme:a.value})}return e.watch(a,m=>{f()}),o({setShow:d}),e.onMounted(()=>{p()}),e.onUnmounted(()=>{c.value&&c.value.destroy()}),(m,b)=>(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))}}),fd={class:"o-textarea__prefix"},md={class:"o-textarea__main"},vd=["placeholder","rows"],gd={class:"o-textarea__suffix"},$l=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 r=t,l=n,a=e.ref(null),i=e.computed({get(){return r.modelValue},set(d){l("update:modelValue",d)}});function s(){var d;(d=a.value)==null||d.focus()}function c(){i.value="",s()}return o({clear:c,focus:s}),(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-textarea",`type-${t.type}`])},[e.createElementVNode("div",fd,[e.renderSlot(d.$slots,"prefix")]),e.createElementVNode("div",md,[e.withDirectives(e.createElementVNode("textarea",{ref_key:"input",ref:a,"onUpdate:modelValue":u[0]||(u[0]=p=>i.value=p),placeholder:t.placeholder,rows:t.rows,onFocus:u[1]||(u[1]=p=>l("focus")),onBlur:u[2]||(u[2]=p=>l("blur"))},null,40,vd),[[e.vModelText,i.value]])]),e.createElementVNode("div",gd,[e.renderSlot(d.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock(E,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),Al={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},bd=(t,o)=>{const n=Al[t];return n?n[o]:null},hd=`
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
- `,Wg={writing:_2},ZC=["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"],eS=["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"],tS=["bold","strike","text-color-dropdown","highlight","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],nS=["inline-math-edit","inlineMathDelete"],oS=["link-open","link-edit","linkUnset"],rS=["align-group","separator","link"],iS=["align-group","separator","link-open","link-edit","linkUnset"],sS=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],lS=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],aS=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],I2={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"]},cS=[`
39
+ `,An={writing:hd},Tl=["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"],Dl=["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"],Ml=["bold","strike","text-color-dropdown","highlight","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],Ll=["inline-math-edit","inlineMathDelete"],Pl=["link-open","link-edit","linkUnset"],Rl=["align-group","separator","link"],Il=["align-group","separator","link-open","link-edit","linkUnset"],jl=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],Fl=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],zl=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],kd={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"]},ql=[`
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
- `],L2={key:0,class:"o-ai-menu tiptap-toolbar"},P2={key:0,class:"o-scroll"},V2={class:"view-main"},z2={key:1,class:"view-output"},H2={class:"action-container"},F2={style:{display:"flex"}},j2={style:{padding:"0 4px"}},U2={key:0},W2={class:"actions"},q2={key:0,class:"o-scroll"},K2=["innerHTML"],J2={class:"ai-io-panel"},G2={class:"o-flex o-item-center actions"},uS=c.defineComponent({__name:"OAiMenu",props:{editor:{type:Nt,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}=Tg(),{locale:s,tr:l}=ue(),a=c.ref(),u=c.ref(!1),d=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:Wg.writing.replace("[LANG_CODE]",s.value)})),v=c.ref([{role:"system",content:""}]),w=c.computed(()=>{const D=d.value.toLowerCase();return SC.filter(R=>{var L;return R.value.toLowerCase().indexOf(D)>=0||((L=R.tips)==null?void 0:L.indexOf(D))>=0})});function k(){const{from:D,to:R}=t.editor.state.selection;return t.editor.state.doc.textBetween(D,R,"")}function x(){setTimeout(()=>{u.value=!0},0)}function C(D,R){switch(R&&(u.value=!0),h.value=D.options.prompt.replaceAll("[CONTENT]",k()),D.value){case"translate":h.value=h.value.replace("[LANGUAGE]",R.value);break;case"changeTone":h.value=h.value.replace("[TONE]",R.value);break}return d.value=l(D.label),y.value={...D,child:R},N(),!0}function S(){var D;$(),(D=a.value)==null||D.focus()}function M(){const D=Bg(t.editor,f.value),{from:R}=t.editor.state.selection,B=I.fromJSON(t.editor.schema,D.content).size;t.editor.chain().focus().deleteSelection().insertContent(f.value,{updateSelection:!0}).setTextSelection({from:R,to:R+B}).run(),$(),u.value=!1,setTimeout(()=>{o("confirm")},0)}function N(){p.value="output",m.value=!0,g.value?A():O()}async function O(){let D="";if(v.value.push({role:"user",content:h.value}),v.value[0].role==="system"&&(v.value.shift(),v.value.unshift(b.value)),!r){Zl.error("AI Completion method not implemented."),m.value=!1;return}try{const R=await r({messages:v.value,onChunk:L=>{D+=L,v.value=[...v.value.slice(0,-1),{role:"assistant",content:D}],f.value=i.render(D)}})}catch(R){v.value.pop(),console.error(R),Zl.error(l("ai.error"))}finally{m.value=!1}}async function A(){let D="";for(const R of cS)await new Promise(L=>setTimeout(L,500)),D+=R,f.value=i.render(D);m.value=!1}function $(){p.value="main",f.value="",d.value=""}return c.onMounted(()=>{setTimeout(()=>{var D;(D=a.value)==null||D.focus(),u.value=!0},300)}),(D,R)=>n.editor?(c.openBlock(),c.createElementBlock("section",L2,[c.createVNode(c.unref(To),{modelValue:u.value,"onUpdate:modelValue":R[1]||(R[1]=L=>u.value=L),offset:[-4,10],placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":c.withCtx(()=>{var L;return[p.value==="main"?(c.openBlock(),c.createElementBlock("div",P2,[c.createElementVNode("section",V2,[c.createVNode(c.unref(Gd),{items:w.value,onSelect:C,"use-keyboard":u.value},null,8,["items","use-keyboard"])])])):c.createCommentVNode("",!0),p.value==="output"?(c.openBlock(),c.createElementBlock("section",z2,[c.createElementVNode("div",H2,[c.createElementVNode("div",F2,[c.createVNode(c.unref(G),{name:"auto_awesome",class:"o-tips"}),c.createElementVNode("div",j2,[c.createTextVNode(c.toDisplayString(c.unref(l)(y.value.label))+" ",1),(L=y.value.child)!=null&&L.label?(c.openBlock(),c.createElementBlock("span",U2,": "+c.toDisplayString(c.unref(l)(y.value.child.label)),1)):c.createCommentVNode("",!0)])]),c.createElementVNode("div",W2,[c.createVNode(c.unref(_r),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(l)("label.confirm"),loading:m.value,onClick:M},null,8,["tooltip","loading"]),m.value?c.createCommentVNode("",!0):(c.openBlock(),c.createBlock(c.unref(_r),{key:0,icon:"close",tooltip:c.unref(l)("label.cancel"),onClick:S},null,8,["tooltip"]))])]),f.value?(c.openBlock(),c.createElementBlock("div",q2,[c.createElementVNode("div",{class:"tiptap output",innerHTML:f.value},null,8,K2)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createElementVNode("section",J2,[c.createVNode(c.unref(Un),{ref_key:"inputRef",ref:a,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":R[0]||(R[0]=L=>d.value=L),type:"text",placeholder:c.unref(l)("ai.askAi"),autofocus:"",onFocus:x},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"auto_awesome",class:"o-tips"})]),suffix:c.withCtx(()=>[c.createElementVNode("div",G2,[c.createVNode(c.unref(_r),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0)}}),X2={key:0,class:"o-inline-math-menu tiptap-toolbar"},dS=c.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:Nt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(n,{emit:e}){const t=n,o=e,{run:r}=we(),i=c.ref(null),s=c.ref(""),l=c.ref(null);c.computed(()=>{const f=Jo.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 u(){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 d=()=>{t.editor.view.dispatch(t.editor.state.tr.setMeta(Jo,{type:"hide"}))};return c.onMounted(()=>{a(),t.editor.on("focus",d)}),c.onUnmounted(()=>{t.editor.off("focus",d)}),(f,p)=>n.editor?(c.openBlock(),c.createElementBlock("section",X2,[c.createVNode(c.unref(Un),{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(u,["prevent"]),["enter"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"function",class:"o-tips"})]),suffix:c.withCtx(()=>[s.value?(c.openBlock(),c.createBlock(c.unref(G),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:u})):c.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):c.createCommentVNode("",!0)}}),Y2={key:0,class:"spinner"},_r=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(Tn),{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",Y2)):(c.openBlock(),c.createBlock(c.unref(G),{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"]))}}),Q2=c.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const{tr:e}=ue();return(t,o)=>(c.openBlock(),c.createBlock(_r,{"content-class":"o-ai-btn",icon:"auto_awesome",color:c.unref(ve).purple,tooltip:c.unref(e)("ai.askAi")},null,8,["color","tooltip"]))}}),Z2={class:"o-align-group"},ez=c.defineComponent({__name:"OAlignGroup",props:{editor:{type:Nt}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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",Z2,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>{var d;return c.openBlock(),c.createBlock(Ae,{key:u,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive({textAlign:a.value})},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),tz={class:"o-background-color-dropdown o-button-group"},nz=c.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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,u)=>(c.openBlock(),c.createBlock(c.unref(Re),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Tn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",tz,[c.createVNode(c.unref(Xe),{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(Xe),{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 d;return[c.createVNode(c.unref(Ni),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").backgroundColor,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),oz={class:"o-highlight-dropdown o-button-group"},rz=c.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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,u)=>(c.openBlock(),c.createBlock(c.unref(Re),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Tn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",oz,[c.createVNode(c.unref(Xe),{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(Xe),{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 d;return[c.createVNode(c.unref(Ni),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("highlight").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),iz=c.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(n){const e=n,{run:t}=we(),{tr:o}=ue();function r(){const{state:i}=e.editor,{selection:s}=i,{$from:l}=s,u=l.node().type.name;t(e.editor,"details",{type:u})}return(i,s)=>{var l;return c.openBlock(),c.createBlock(Ae,{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"])}}}),sz=c.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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(Re),{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(Xd),{items:c.unref(Dl.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),lz=c.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(zt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(vt),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive("textStyle",{fontFamily:u.value})}),onClick:p=>s(u.value)},{suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive("textStyle",{fontFamily:u.value})?(c.openBlock(),c.createBlock(c.unref(G),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createElementVNode("span",{style:c.normalizeStyle(`font-family: ${u.value}`)},c.toDisplayString(u.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),az={class:"o-fore-color-dropdown o-button-group"},cz=c.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),r=c.ref(null),i=c.ref("#ff4d4f");function s(){l(i.value)}function l(a){var u;(u=r.value)==null||u.setShow(!1),i.value=a,o(e.editor,"color",{color:a})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref(Re),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Tn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",az,[c.createVNode(c.unref(Xe),{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(Xe),{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 d;return[c.createVNode(c.unref(Ni),{"default-color":"","default-label":c.unref(t)("editor.defaultColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),uz=c.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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 u,d;return a.value==="heading"?(u=e.editor)==null?void 0:u.isActive(a.value,{level:a.valueAlt}):(d=e.editor)==null?void 0:d.isActive(a.value)}function l(a){var u;(u=r.value)==null||u.setShow(!1),o(e.editor,a.value,{level:a.valueAlt})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.separator?(c.openBlock(),c.createBlock(c.unref(zt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(vt),{class:c.normalizeClass({"is-active":s(d)}),onClick:p=>l(d)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(d)?(c.openBlock(),c.createBlock(c.unref(G),{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))}}),dz=c.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:Nt,required:!0}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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 u(){var p;(p=r.value)==null||p.setShow(!1)}function d(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(Re),{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(Yd),{key:0,title:c.unref(t)("label.edit"),val:s.value,icon:"function",onCancel:u,onConfirm:d},{"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"]))}}),fz={class:"o-list-dropdown o-button-group"},pz=c.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),r=c.ref(null),i=c.ref();function s(){o(e.editor,i.value.value)}function l(u){r.value.setShow(!1),i.value=u,o(e.editor,u.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]}),(u,d)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(Tn),null,{trigger:c.withCtx(()=>{var f;return[c.createElementVNode("div",fz,[c.createVNode(c.unref(Xe),{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(Xe),{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(Mt),{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(vt),{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(G),{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(G),{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))}}),hz={class:"o-list-group"},mz=c.defineComponent({__name:"OListGroup",props:{editor:{type:Nt,required:!0}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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",hz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>{var d;return c.openBlock(),c.createBlock(Ae,{key:u,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive(a.value)},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),gz=c.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Nt,required:!0}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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 u(){var f;(f=r.value)==null||f.setShow(!1)}function d(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(Re),{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(Yd),{key:0,title:c.unref(t)("link.edit"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(jg),{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"]))}}),yz=c.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue();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(Ae,{icon:"open_in_new",tooltip:c.unref(t)("link.open"),"content-class":"o-link-open-btn",onClick:o},null,8,["tooltip"]))}}),bz={class:"o-command-btn"},vz={class:"o-more-bubble"},kz=c.defineComponent({__name:"OMoreBubble",props:{editor:{type:Nt,required:!0}},setup(n){const e=c.ref();return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Re),{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",bz,[c.createVNode(c.unref(G),{name:"more_horiz"})])]),default:c.withCtx(()=>[c.createElementVNode("section",vz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(sS),(r,i)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:i},[r==="separator"?(c.openBlock(),c.createBlock(c.unref(zt),{key:0,vertical:""})):typeof r=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(of)(r)),{key:1,name:r,editor:n.editor},null,8,["name","editor"])):c.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),wz=c.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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 u;return(u=e.editor)==null?void 0:u.isActive(a.value,a.options)}function l(a){r.value.setShow(!1),o(e.editor,a.value,a.options)}return(a,u)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.separator?(c.openBlock(),c.createBlock(c.unref(zt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(vt),{class:c.normalizeClass({"is-active":s(d)}),onClick:p=>l(d)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(d)?(c.openBlock(),c.createBlock(c.unref(G),{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))}}),xz=c.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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(Re),{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(TC),{onSelect:i})]),_:1},512))}}),Cz={class:"o-table-group"},Sz=c.defineComponent({__name:"OTableGroup",props:{editor:{type:Nt,required:!0}},setup(n){const{tr:e}=ue(),{run:t}=we();return(o,r)=>{var i,s;return c.openBlock(),c.createElementBlock("section",Cz,[(i=n.editor)!=null&&i.can().mergeCells()?(c.openBlock(),c.createBlock(c.unref(Ae),{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(Ae),{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(NC),{editor:n.editor},null,8,["editor"])])}}}),Ez=c.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Nt}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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,u)=>(c.openBlock(),c.createBlock(c.unref(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(Dg),{"fore-color":i.value,"back-color":s.value,"default-label":c.unref(t)("editor.defaultColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),Mz=c.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Nt}},setup(n){const e=n,{tr:t}=ue(),{run:o}=we(),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(Re),{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(G),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(zt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(vt),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive(u.value)}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive(u.value)?(c.openBlock(),c.createBlock(c.unref(G),{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))}}),Tz={ai:Q2,"align-dropdown":Og,"align-group":ez,"background-color":nz,color:cz,details:iz,"extension-dropdown":vC,"font-family":lz,heading:uz,highlight:rz,"inline-math-edit":dz,"list-dropdown":pz,"list-group":mz,link:$g,"link-edit":gz,"link-open":yz,emoji:sz,more:kz,"style-dropdown":wz,table:xz,"table-group":Sz,"text-color-dropdown":Ez,"text-format-dropdown":Mz},of=n=>Tz[n]||PL,Nz={key:0,class:"o-main-menu"},Az={class:"left"},Oz={class:"right"},fS=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=eS),o.length>0?o:ZC});return(o,r)=>n.editor?(c.openBlock(),c.createElementBlock("section",Nz,[c.createElementVNode("section",Az,[(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(zt),{key:0,vertical:""})):typeof i=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(of)(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",Oz,[c.renderSlot(o.$slots,"right")])])):c.createCommentVNode("",!0)}});function $z(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,u=t;return new DOMRect(a,u,s,l)}var Bz=class{constructor({editor:n,element:e,view:t,pluginKey:o="bubbleMenu",updateDelay:r=250,resizeDelay:i=60,shouldShow:s,appendTo:l,getReferencedVirtualElement:a,options:u}){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,v=!g.textBetween(h,m).length&&Ca(p.selection),w=this.element.contains(document.activeElement);return!(!(f.hasFocus()||w)||b||v||!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 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=u==null?void 0:u.scrollTarget)!=null?d:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...u},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(Fg(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(Hg(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(HC(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(WC(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(jC(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(FC(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(UC(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(qC(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=eg(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,u=l?l.pos:a.pos,d=a?a.pos:l.pos,f=this.view.nodeDOM(u),p=this.view.nodeDOM(d);if(!f||!p)return;const h=f===p?f.getBoundingClientRect():$z(f.getBoundingClientRect(),p.getBoundingClientRect());s={getBoundingClientRect:()=>h,getClientRects:()=>[h]}}return s}updatePosition(){const n=this.virtualElement;n&&nf(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()}},Rz=n=>new ce({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new Bz({view:e,...n})}),Dz=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:u,getReferencedVirtualElement:d,updateDelay:f}=n,p=o.value;p&&(p.style.visibility="hidden",p.style.position="absolute",p.remove(),c.nextTick(()=>{r.registerPlugin(Rz({editor:r,element:p,options:i,pluginKey:s,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,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))}}}),_z=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:d,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!(!d.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=(d,f,p,h)=>{const{composing:m}=d;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:d})=>{var f;if(this.preventHide){this.preventHide=!1;return}d!=null&&d.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(d.relatedTarget))||(d==null?void 0:d.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:d})=>{const f=d.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 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=s==null?void 0:s.scrollTarget)!=null?u: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 Bd(n,{textSerializers:Ma(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Fg(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(Hg(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(HC(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(WC(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(jC(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(FC(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(UC(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(qC(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=eg(this.view,n.from,n.to);nf({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()}},Iz=n=>new ce({key:typeof n.pluginKey=="string"?new le(n.pluginKey):n.pluginKey,view:e=>new _z({view:e,...n})}),Lz=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:u,shouldShow:d}=n,f=o.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),i.registerPlugin(Iz({pluginKey:r,editor:i,element:f,updateDelay:s,resizeDelay:l,options:a,appendTo:u,shouldShow:d})))}),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 Pz={key:0},Vz=c.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Nt},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}=ue(),{theme:o}=Vi(),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 u(){r.value=!0}function d(w){w==="ai"&&(i.value=!0)}function f(){s.value=!0}function p(w){const{schema:k}=e.editor,x=k.marks.link;if(!x||!w)return!1;const{$from:C,$to:S}=w;return!!Pi(C,x)}function h({editor:w,element:k,view:x,state:C,oldState:S,from:M,to:N}){var z;const{doc:O,selection:A}=C,{empty:$}=A,D=!O.textBetween(M,N).length&&Ca(C.selection);if(l.value=e.editor.isActive("inlineMath"),v.value||e.editor.isActive("inlineMath"))return!0;if(!x.hasFocus()||$||s.value||D&&w.isActive("link")&&!w.isActive("image"))return!1;const R=["image"],L=["image","toc","video","model-viewer"],B=A.node,W=(z=B==null?void 0:B.type)==null?void 0:z.name;return!(w.isActive("codeBlock")||L.indexOf(W)>=0||W&&!R.includes(W))}const m=c.computed(()=>{if(e.editor){const{state:w}=e.editor,{tr:k}=w,{selection:x}=k;return p(x)}else return!1}),g=c.computed(()=>{var w,k;return!r.value&&!((w=e.editor)!=null&&w.isActive("image"))&&(m.value||((k=e.editor)==null?void 0:k.isActive("inlineMath")))}),y=c.computed(()=>v.value||l.value),b=c.computed(()=>{var k,x,C;let w=e.menu;return r.value||((k=e.editor)!=null&&k.isActive("image")?w=m.value?iS:rS:(x=e.editor)!=null&&x.isActive("table")?w=lS:m.value?w=oS:(C=e.editor)!=null&&C.isActive("inlineMath")&&(w=nS)),w.length>0?w:tS}),v=c.computed(()=>{const w=Jo.getState(e.editor.state);return!!(w!=null&&w.active)});return c.onMounted(()=>{r.value=!1}),(w,k)=>n.editor?(c.openBlock(),c.createElementBlock("section",Pz,[c.createVNode(c.unref(Dz),{editor:n.editor,"should-show":h,options:a.value},{default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(uS),{key:0,editor:n.editor,"ai-options":n.aiOptions,onConfirm:f},null,8,["editor","ai-options"])):y.value?(c.openBlock(),c.createBlock(c.unref(dS),{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(Ae),{icon:"arrow_back",tooltip:c.unref(t)("link.back"),onClick:u},null,8,["tooltip"]),c.createVNode(c.unref(zt),{vertical:""})],64)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(b.value,(x,C)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:C},[x==="separator"?(c.openBlock(),c.createBlock(c.unref(zt),{key:0,vertical:""})):typeof x=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(of)(x)),{key:1,name:x,editor:n.editor,onClick:S=>d(x)},null,8,["name","editor","onClick"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):c.createCommentVNode("",!0)}}),zz={key:0},Hz=c.defineComponent({__name:"OFloatingMenu",props:{editor:{type:i1},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(d){const{schema:f}=e.editor,p=f.marks.link;if(!p||!d)return!1;const{$from:h,$to:m}=d;return!!Pi(h,p)}const s=c.computed(()=>{if(e.editor){const{state:d}=e.editor,{tr:f}=d,{selection:p}=f;return i(p)}else return!1}),l=c.computed(()=>!t.value&&s.value),a=c.computed(()=>{const d=e.menu;return d.length>0?d:aS}),u=c.computed(()=>{const d=Jo.getState(e.editor.state);return!!(d!=null&&d.active)});return(d,f)=>n.editor&&!u.value?(c.openBlock(),c.createElementBlock("section",zz,[c.createVNode(c.unref(Lz),{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(Ae),{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(zt),{key:0,vertical:""})):typeof p=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(of)(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 qg(n,e){const t=e==null?void 0:e.posAtCoords(n);if(!t)return;let o=Rc(t.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function Rc(n,e){return e.nodeDOM(n)||e.domAtPos(n).node}function Kg(n,e){const t=qg(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 Fz(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 jz(n,e){const t=Kg(n,e.view);return typeof t=="number"&&t>=0?{node:e.state.doc.nodeAt(t),pos:t}:{node:null,pos:t}}const ea=new le("sideMenu");class Uz{constructor(){Ue(this,"hovered",!1);Ue(this,"coords",{left:0,top:0});Ue(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 Wz{constructor({editor:e,element:t,view:o,tippyOptions:r={},updateDelay:i=250}){Ue(this,"editor");Ue(this,"element");Ue(this,"view");Ue(this,"preventHide",!1);Ue(this,"tippy");Ue(this,"tippyOptions");Ue(this,"updateDelay");Ue(this,"updateDebounceTimer");Ue(this,"mousedownHandler",()=>{this.preventHide=!0});Ue(this,"onDragStart",e=>{this.hide()});Ue(this,"blurHandler",({event:e})=>{var t;e!=null&&e.relatedTarget&&((t=this.element.parentNode)!=null&&t.contains(e.relatedTarget))||this.hide()});Ue(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});Ue(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))});Ue(this,"updateHandler",(e,t,o,r)=>{var u,d;const{state:i,composing:s}=e,{coords:l}=ea.getState(i),a=qg(l,e);Kg(l,e),a&&(this.createTooltip(),(d=this.tippy)==null||d.setProps({getReferenceClientRect:((u=this.tippyOptions)==null?void 0:u.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=ir(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 qz=(n,e)=>{if(!n.dataTransfer)return;const{view:t}=e;t.dom.getBoundingClientRect();const o=ea.getState(t.state),r={left:o.coords.left,top:o.coords.top},i=Kg(r,t);if(i===null)return;const s=t.state.selection,l=t.state.doc;Fz(s,l),t.dispatch(t.state.tr.setSelection(Q.create(t.state.doc,i))),t.dom.classList.add("is-dragging"),Jz(t,i);const a=t.state.selection.content(),{dom:u,text:d}=t.serializeForClipboard(a);n.dataTransfer.clearData(),n.dataTransfer.setData("text/html",u.innerHTML),n.dataTransfer.setData("text/plain",d),n.dataTransfer.effectAllowed="move",n.dataTransfer.setDragImage(di,0,0),t.dragging={slice:a,move:!0}},Kz=(n,e)=>{const{view:t}=e;t.dom.classList.remove("is-dragging"),pS()};let di;function Jz(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(Rc(e,n))),a=l):(l=i(r,s(Rc(e+1,n))),a=i(r,s(Rc(t-1,n))));for(let f=r.childElementCount-1;f>=0;f--)(f>l||f<a)&&o.removeChild(o.children[f]);pS(),di=o;const d=n.dom.className.split(" ").filter(f=>f!=="ProseMirror"&&f!=="yiitap-root"&&f!=="yiitap-editor").join(" ");di.className+=" yiitap-dragging-preview "+d,document.body.appendChild(di)}function pS(){di!==void 0&&(document.body.removeChild(di),di=void 0)}class Gz{constructor(e){Ue(this,"options");Ue(this,"plugin");Ue(this,"sideMenuView");const t=new Uz;this.options=e,this.plugin=new ce({key:ea,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=qg(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(ea,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 Wz({view:o,...e}),this.sideMenuView)})}dragstart(e){qz(e,this.options.editor)}dragend(e){Kz(e,this.options.editor)}}const Xz=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:u,tippyOptions:d}=n;r.value=new Gz({updateDelay:u,editor:a,element:o.value,pluginKey:l,tippyOptions:d}),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))}}}),Yz={key:0,class:"o-side-menu"},Qz={class:"container"},Zz=c.defineComponent({__name:"OSideMenu",props:{editor:{type:Nt,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 u({editor:p,transaction:h}){let m={left:0,top:0};const g=ea.getState(e.editor.view.state);if(g){m=g.coords;const y=jz(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 d(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",u)}),(p,h)=>n.editor?(c.openBlock(),c.createElementBlock("section",Yz,[c.createVNode(c.unref(Xz),{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",Qz,[o.value?(c.openBlock(),c.createBlock(c.unref(KC),c.normalizeProps(c.mergeProps({key:0},s.value)),null,16)):c.createCommentVNode("",!0),o.value?(c.openBlock(),c.createBlock(c.unref(JC),c.mergeProps({key:1},s.value,{onDragstart:d,onDragend:f}),null,16)):c.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):c.createCommentVNode("",!0)}});var qu=(n,e)=>e.view.domAtPos(n).node.offsetParent!==null,eH=(n,e,t)=>{for(let o=n.depth;o>0;o-=1){const r=n.node(o),i=e(r),s=qu(n.start(o),t);if(i&&s)return{pos:o>0?n.before(o):0,start:n.start(o),depth:o,node:r}}},nk=(n,e)=>{const{state:t,view:o,extensionManager:r}=n,{schema:i,selection:s}=t,{empty:l,$anchor:a}=s,u=!!r.extensions.find(b=>b.name==="gapCursor");if(!l||a.parent.type!==i.nodes.detailsSummary||!u||e==="right"&&a.parentOffset!==a.parent.nodeSize-2)return!1;const d=Ur(b=>b.type===i.nodes.details)(s);if(!d)return!1;const f=Xo(d.node,b=>b.type===i.nodes.detailsContent);if(!f.length||qu(d.start+f[0].pos+1,n))return!1;const h=t.doc.resolve(d.pos+d.node.nodeSize),m=et.findFrom(h,1,!1);if(!m)return!1;const{tr:g}=t,y=new et(m);return g.setSelection(y),g.scrollIntoView(),o.dispatch(g),!0},hS=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",de(this.options.HTMLAttributes,n),0]},...Na({nodeName:"details",content:"block"}),addNodeView(){return({editor:n,getPos:e,node:t,HTMLAttributes:o})=>{const r=document.createElement("div"),i=de(this.options.HTMLAttributes,o,{"data-type":this.name});Object.entries(i).forEach(([u,d])=>r.setAttribute(u,d));const s=document.createElement("button");s.type="button",r.append(s);const l=document.createElement("div");r.append(l);const a=u=>{if(u!==void 0)if(u){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 d=new Event("toggleDetailsContent"),f=l.querySelector(':scope > div[data-type="detailsContent"]');f==null||f.dispatchEvent(d)};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:u,to:d}=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:u,to:d}).focus(void 0,{scrollIntoView:!1}).run()}}),{dom:r,contentDOM:l,ignoreMutation(u){return u.type==="selection"?!1:!r.contains(u.target)||r===u.target},update:u=>u.type!==this.type?!1:(u.attrs.open!==void 0&&a(u.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 d=((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:d}]}).setTextSelection(l.start+2).run()},unsetDetails:()=>({state:n,chain:e})=>{const{selection:t,schema:o}=n,r=Ur(b=>b.type===this.type)(t);if(!r)return!1;const i=Xo(r.node,b=>b.type===o.nodes.detailsSummary),s=Xo(r.node,b=>b.type===o.nodes.detailsContent);if(!i.length||!s.length)return!1;const l=i[0],a=s[0],u=r.pos,d=n.doc.resolve(u),f=u+r.node.nodeSize,p={from:u,to:f},h=a.node.content.toJSON()||[],m=d.parent.type.contentMatch.defaultType,y=[m==null?void 0:m.create(null,l.node.content).toJSON(),...h];return e().insertContentAt(p,y).setTextSelection(u+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=qu(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),u=Td(l.contentMatchAt(a));if(!u||!l.canReplaceWith(a,a,u))return!1;const d=u.createAndFill();if(!d)return!1;const f=s?i.after()+1:i.after(-1),p=e.tr.replaceWith(f,f,d),h=p.doc.resolve(f),m=ie.near(h,1);return p.setSelection(m),p.scrollIntoView(),t.dispatch(p),!0},ArrowRight:({editor:n})=>nk(n,"right"),ArrowDown:({editor:n})=>nk(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||!Ym(t,r.name))return;const{$from:a}=t.selection;if(qu(a.pos,o))return;const d=eH(a,b=>b.type===r,o);if(!d)return;const f=Xo(d.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"?d.start+p.pos:d.pos+p.pos+p.node.nodeSize,g=q.create(t.doc,m);return t.tr.setSelection(g)}})]}}),mS=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",de(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addNodeView(){return({HTMLAttributes:n})=>{const e=document.createElement("div"),t=de(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=Ur(A=>A.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 d=s.node.type.contentMatch.defaultType,f=d==null?void 0:d.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 v=r.indexAfter(-3),w=Td(b.contentMatchAt(v));if(!w||!b.canReplaceWith(v,v,w))return!1;const k=w.createAndFill();if(!k)return!1;const{tr:x}=e,C=r.after(-2);x.replaceWith(C,C,k);const S=x.doc.resolve(C),M=ie.near(S,1);x.setSelection(M);const N=g,O=g+m.nodeSize;return x.delete(N,O),x.scrollIntoView(),t.dispatch(x),!0}}},...Na({nodeName:"detailsContent"})}),gS=Oe.create({name:"detailsSummary",content:"text*",defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:n}){return["summary",de(this.options.HTMLAttributes,n),0]},...Na({nodeName:"detailsSummary",content:"inline"})}),rf=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",de(this.options.HTMLAttributes,n),0]}}),sf=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",de(this.options.HTMLAttributes,n),0]}}),Ku=Oe.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",de(this.options.HTMLAttributes,n),0]}});function Th(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function ok(n,e,t,o,r,i){var s;let l=0,a=!0,u=e.firstChild;const d=n.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:m,colwidth:g}=d.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],v=b?`${b}px`:"";if(l+=b||o,b||(a=!1),u){if(u.style.width!==v){const[w,k]=Th(o,b);u.style.setProperty(w,k)}u=u.nextSibling}else{const w=document.createElement("col"),[k,x]=Th(o,b);w.style.setProperty(k,x),e.appendChild(w)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=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 tH=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")),ok(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,ok(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 nH(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,v]=Th(e,y);s.push(["col",{style:`${b}: ${v}`}])}}const a=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:u}}function rk(n,e){return n.createAndFill()}function oH(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 yS(n,e,t,o,r){const i=oH(n),s=[],l=[];for(let u=0;u<t;u+=1){const d=rk(i.cell);if(d&&l.push(d),o){const f=rk(i.header_cell);f&&s.push(f)}}const a=[];for(let u=0;u<e;u+=1)a.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,a)}function rH(n){return n instanceof Pe}var cc=({editor:n})=>{const{selection:e}=n.state;if(!rH(e))return!1;let t=0;const o=Nd(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},iH="";function sH(n){return(n||"").replace(/\s+/g," ").trim()}function lH(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:iH;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(x=>e.renderChildren(x)).join(r):b=y.content?e.renderChildren(y.content):"";const v=sH(b),w=y.type==="tableHeader";g.push({text:v,isHeader:w})}),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 v=(((g=m[y])==null?void 0:g.text)||"").length;v>l[y]&&(l[y]=v),l[y]<3&&(l[y]=3)}});const a=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),u=i[0],d=u.some(m=>m.isHeader);let f=`
210
- `;const p=new Array(s).fill(0).map((m,g)=>d&&u[g]&&u[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
- `,(d?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 aH=lH,lf=Oe.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:tH,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}=nH(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",de(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)=>aH(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=yS(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})=>UI(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>WI(n,e),deleteColumn:()=>({state:n,dispatch:e})=>KI(n,e),addRowBefore:()=>({state:n,dispatch:e})=>GI(n,e),addRowAfter:()=>({state:n,dispatch:e})=>XI(n,e),deleteRow:()=>({state:n,dispatch:e})=>QI(n,e),deleteTable:()=>({state:n,dispatch:e})=>iL(n,e),mergeCells:()=>({state:n,dispatch:e})=>Dv(n,e),splitCell:()=>({state:n,dispatch:e})=>_v(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Yl("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Yl("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>oL(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Dv(n,e)?!0:_v(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>tL(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>Lv(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Lv(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&uC(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:cc,"Mod-Backspace":cc,Delete:cc,"Mod-Delete":cc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[mL({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],EL({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Be(ne(n,"tableRole",e))}}});ye.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(lf.configure(this.options.table)),this.options.tableCell!==!1&&n.push(rf.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(sf.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(Ku.configure(this.options.tableRow)),n}});var cH=20,bS=(n,e=0)=>{const t=[];return!n.children.length||e>cH||Array.from(n.children).forEach(o=>{o.tagName==="SPAN"?t.push(o):o.children.length&&t.push(...bS(o,e+1))}),t},uH=n=>{if(!n.children.length)return;const e=bS(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}`)})},Jg=Wn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&uH(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",de(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}}}}),Gg=ye.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()}}}),Xg=ye.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()}}}),Yg=ye.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()}}}),dH=ye.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()}}}),fH=ye.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()}}});ye.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(Gg.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(Xg.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(Yg.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(dH.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(fH.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(Jg.configure(this.options.textStyle)),n}});const Oi=Math.floor,pH=Math.abs,Ir=(n,e)=>n<e?n:e,$s=(n,e)=>n>e?n:e,hH=n=>n!==0?n<0:1/n<0,mH=64,ta=128,gH=1<<29,ik=63,Nl=127,yH=2147483647,sk=Number.MAX_SAFE_INTEGER,lk=Number.MIN_SAFE_INTEGER,bH=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&Oi(n)===n),vH=()=>new Set,Qg=(n,e)=>{for(let t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0},vS=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},kH=(n,e)=>{const t=new Array(n);for(let o=0;o<n;o++)t[o]=e(o,t);return t},af=Array.isArray,kS=String.fromCharCode,wH=n=>n.toLowerCase(),xH=/^\s*/g,CH=n=>n.replace(xH,""),SH=/([A-Z])/g,ak=(n,e)=>CH(n.replace(SH,t=>`${e}${wH(t)}`)),EH=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,MH=n=>na.encode(n),TH=na?MH:EH;let up=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});up&&up.decode(new Uint8Array).length===1&&(up=null);const NH=(n,e)=>kH(e,()=>n).join("");class AH{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const OH=()=>new AH,$H=n=>{const e=OH();return n(e),RH(e)},BH=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},RH=n=>{const e=new Uint8Array(BH(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($s(t,e)*2),n.cpos=0)},_t=(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>Nl;)_t(n,ta|Nl&e),e=Oi(e/128);_t(n,Nl&e)},_H=(n,e)=>{const t=hH(e);for(t&&(e=-e),_t(n,(e>ik?ta:0)|(t?mH:0)|ik&e),e=Oi(e/64);e>0;)_t(n,(e>Nl?ta:0)|Nl&e),e=Oi(e/128)},Nh=new Uint8Array(3e4),IH=Nh.length/3,LH=(n,e)=>{if(e.length<IH){const t=na.encodeInto(e,Nh).written||0;oa(n,t);for(let o=0;o<t;o++)_t(n,Nh[o])}else wS(n,TH(e))},PH=(n,e)=>{const t=unescape(encodeURIComponent(e)),o=t.length;oa(n,o);for(let r=0;r<o;r++)_t(n,t.codePointAt(r))},ck=na&&na.encodeInto?LH:PH,VH=(n,e)=>{const t=n.cbuf.length,o=n.cpos,r=Ir(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($s(t*2,i)),n.cbuf.set(e.subarray(r)),n.cpos=i)},wS=(n,e)=>{oa(n,e.byteLength),VH(n,e)},Zg=(n,e)=>{DH(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},zH=(n,e)=>Zg(n,4).setFloat32(0,e,!1),HH=(n,e)=>Zg(n,8).setFloat64(0,e,!1),FH=(n,e)=>Zg(n,8).setBigInt64(0,e,!1),uk=new DataView(new ArrayBuffer(4)),jH=n=>(uk.setFloat32(0,n),uk.getFloat32(0)===n),Ah=(n,e)=>{switch(typeof e){case"string":_t(n,119),ck(n,e);break;case"number":bH(e)&&pH(e)<=yH?(_t(n,125),_H(n,e)):jH(e)?(_t(n,124),zH(n,e)):(_t(n,123),HH(n,e));break;case"bigint":_t(n,122),FH(n,e);break;case"object":if(e===null)_t(n,126);else if(af(e)){_t(n,117),oa(n,e.length);for(let t=0;t<e.length;t++)Ah(n,e[t])}else if(e instanceof Uint8Array)_t(n,116),wS(n,e);else{_t(n,118);const t=Object.keys(e);oa(n,t.length);for(let o=0;o<t.length;o++){const r=t[o];ck(n,r),Ah(n,e[r])}}break;case"boolean":_t(n,e?120:121);break;default:_t(n,127)}},cf=n=>new Error(n),xS=()=>{throw cf("Method unimplemented")},Ia=()=>{throw cf("Unexpected case")},Dc=()=>new Map,CS=(n,e,t)=>{let o=n.get(e);return o===void 0&&n.set(e,o=t()),o},ra=Symbol("Equality"),UH=(n,e)=>{var t;return n===e||!!((t=n==null?void 0:n[ra])!=null&&t.call(n,e))||!1},WH=n=>typeof n=="object",SS=Object.keys,dk=n=>SS(n).length,La=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},ES=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),_c=(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[ra]!=null)return n[ra](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)||!_c(n.get(t),e.get(t)))return!1;break}case void 0:case Object:if(dk(n)!==dk(e))return!1;for(const t in n)if(!ES(n,t)||!_c(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(!_c(n[t],e[t]))return!1;break;default:return!1}return!0},qH=(n,e)=>e.includes(n),KH=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},JH=/[\uD800-\uDBFF]/,GH=/[\uDC00-\uDFFF]/,XH=(n,e)=>{let t=0,o=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t++;for(t>0&&JH.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&&GH.test(n[n.length-o])&&o--,{index:t,remove:n.length-t-o,insert:e.slice(t,e.length-o)}},YH=XH,QH=Math.random,ZH=n=>n[Oi(QH()*n.length)],fk=n=>n===void 0?null:n;class eF{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let MS=new eF,tF=!0;try{typeof localStorage<"u"&&localStorage&&(MS=localStorage,tF=!1)}catch{}const nF=MS,Bs=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",TS=typeof window<"u"&&typeof document<"u"&&!Bs;let uo;const oF=()=>{if(uo===void 0)if(Bs){uo=Dc();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const o=n[t];o[0]==="-"?(e!==null&&uo.set(e,""),e=o):e!==null&&(uo.set(e,o),e=null)}e!==null&&uo.set(e,"")}else typeof location=="object"?(uo=Dc(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");uo.set(`--${ak(e,"-")}`,t),uo.set(`-${ak(e,"-")}`,t)}})):uo=Dc();return uo},Oh=n=>oF().has(n),$h=n=>fk(Bs?process.env[n.toUpperCase().replaceAll("-","_")]:nF.getItem(n)),NS=n=>Oh("--"+n)||$h(n)!==null,rF=NS("production"),iF=Bs&&qH(process.env.FORCE_COLOR,["true","1","2"]);iF||!Oh("--no-colors")&&!NS("no-color")&&(!Bs||process.stdout.isTTY)&&(!Bs||Oh("--color")||$h("COLORTERM")!==null||($h("TERM")||"").includes("color"));const sF=n=>{let e="";for(let t=0;t<n.byteLength;t++)e+=kS(n[t]);return btoa(e)},lF=n=>Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),aF=TS?sF:lF,cF=n=>$H(e=>Ah(e,n)),pk=n=>n.next()>=.5,dp=(n,e,t)=>Oi(n.next()*(t+1-e)+e),AS=(n,e,t)=>Oi(n.next()*(t+1-e)+e),ey=(n,e,t)=>AS(n,e,t),uF=n=>kS(ey(n,97,122)),dF=(n,e=0,t=20)=>{const o=ey(n,e,t);let r="";for(let i=0;i<o;i++)r+=uF(n);return r},fp=(n,e)=>e[ey(n,0,e.length-1)],fF=Symbol("0schema");class pF{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(NH(" ",(this._rerrs.length-t)*2)+`${o.path!=null?`[${o.path}] `:""}${o.has} doesn't match ${o.expected}. ${o.message}`)}return e.join(`
214
- `)}}const Bh=(n,e)=>n===e?!0:n==null||e==null||n.constructor!==e.constructor?!1:n[ra]?UH(n,e):af(n)?Qg(n,t=>vS(e,o=>Bh(t,o))):WH(n)?La(n,(t,o)=>Bh(t,e[o])):!1;class Yt{extends(e){let[t,o]=[this.shape,e.shape];return this.constructor._dilutes&&([o,t]=[t,o]),Bh(t,o)}equals(e){return this.constructor===e.constructor&&_c(this.shape,e.shape)}[fF](){return!0}[ra](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){xS()}get nullable(){return Hs(this,hf)}get optional(){return new BS(this)}cast(e){return hk(e,this),e}expect(e){return hk(e,this),e}}Ue(Yt,"_dilutes",!1);class ty extends Yt{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 gt=(n,e=null)=>new ty(n,e);gt(ty);class ny extends Yt{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 At=n=>new ny(n);gt(ny);class uf extends Yt{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 df=(...n)=>new uf(n),OS=gt(uf),hF=RegExp.escape||(n=>n.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),$S=n=>{if(Rs.check(n))return[hF(n)];if(OS.check(n))return n.shape.map(e=>e+"");if(HS.check(n))return["[+-]?\\d+.?\\d*"];if(FS.check(n))return[".*"];if(Gu.check(n))return n.shape.map($S).flat(1);Ia()};class mF extends Yt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map($S).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}}gt(mF);const gF=Symbol("optional");class BS extends Yt{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[gF](){return!0}}const yF=gt(BS);class bF extends Yt{check(e,t){return t==null||t.extend(null,"never",typeof e),!1}}gt(bF);const gd=class gd extends Yt{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}get partial(){return new gd(this.shape,!0)}check(e,t){return e==null?(t==null||t.extend(null,"object","null"),!1):La(this.shape,(o,r)=>{const i=this._isPartial&&!ES(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})}};Ue(gd,"_dilutes",!0);let Ju=gd;const vF=n=>new Ju(n),kF=gt(Ju),wF=At(n=>n!=null&&(n.constructor===Object||n.constructor==null));class RS extends Yt{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&La(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 DS=(n,e)=>new RS(n,e),xF=gt(RS);class _S extends Yt{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&La(this.shape,(o,r)=>{const i=o.check(e[r],t);return!i&&(t==null||t.extend(r.toString(),"Tuple",typeof o)),i})}}const CF=(...n)=>new _S(n);gt(_S);class IS extends Yt{constructor(e){super(),this.shape=e.length===1?e[0]:new ff(e)}check(e,t){const o=af(e)&&Qg(e,r=>this.shape.check(r));return!o&&(t==null||t.extend(null,"Array","")),o}}const LS=(...n)=>new IS(n),SF=gt(IS),EF=At(n=>af(n));class PS extends Yt{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 MF=(n,e=null)=>new PS(n,e);gt(PS);const TF=MF(Yt);class NF extends Yt{constructor(e){super(),this.len=e.length-1,this.args=CF(...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 AF=gt(NF),OF=At(n=>typeof n=="function");class $F extends Yt{constructor(e){super(),this.shape=e}check(e,t){const o=Qg(this.shape,r=>r.check(e,t));return!o&&(t==null||t.extend(null,"Intersectinon",typeof e)),o}}gt($F,n=>n.shape.length>0);class ff extends Yt{constructor(e){super(),this.shape=e}check(e,t){const o=vS(this.shape,r=>r.check(e,t));return t==null||t.extend(null,"Union",typeof e),o}}Ue(ff,"_dilutes",!0);const Hs=(...n)=>n.findIndex(e=>Gu.check(e))>=0?Hs(...n.map(e=>ia(e)).map(e=>Gu.check(e)?e.shape:[e]).flat(1)):n.length===1?n[0]:new ff(n),Gu=gt(ff),VS=()=>!0,Xu=At(VS),BF=gt(ny,n=>n.shape===VS),oy=At(n=>typeof n=="bigint"),RF=At(n=>n===oy),zS=At(n=>typeof n=="symbol");At(n=>n===zS);const gs=At(n=>typeof n=="number"),HS=At(n=>n===gs),Rs=At(n=>typeof n=="string"),FS=At(n=>n===Rs),pf=At(n=>typeof n=="boolean"),DF=At(n=>n===pf),jS=df(void 0);gt(uf,n=>n.shape.length===1&&n.shape[0]===void 0);df(void 0);const hf=df(null),_F=gt(uf,n=>n.shape.length===1&&n.shape[0]===null);gt(Uint8Array);gt(ty,n=>n.shape===Uint8Array);const IF=Hs(gs,Rs,hf,jS,oy,pf,zS);(()=>{const n=LS(Xu),e=DS(Rs,Xu),t=Hs(gs,Rs,hf,pf,n,e);return n.shape=t,e.shape.values=t,t})();const ia=n=>{if(TF.check(n))return n;if(wF.check(n)){const e={};for(const t in n)e[t]=ia(n[t]);return vF(e)}else{if(EF.check(n))return Hs(...n.map(ia));if(IF.check(n))return df(n);if(OF.check(n))return gt(n)}Ia()},hk=rF?()=>{}:(n,e)=>{const t=new pF;if(!e.check(n,t))throw cf(`Expected value to be of type ${e.constructor.name}.
215
- ${t.toString()}`)};class LF{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:ia(e),h:t}),this}else(e){return this.if(Xu,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 cf("Unhandled pattern")}}}const PF=n=>new LF(n),US=PF(Xu).if(HS,(n,e)=>dp(e,lk,sk)).if(FS,(n,e)=>dF(e)).if(DF,(n,e)=>pk(e)).if(RF,(n,e)=>BigInt(dp(e,lk,sk))).if(Gu,(n,e)=>Gi(e,fp(e,n.shape))).if(kF,(n,e)=>{const t={};for(const o in n.shape){let r=n.shape[o];if(yF.check(r)){if(pk(e))continue;r=r.shape}t[o]=US(r,e)}return t}).if(SF,(n,e)=>{const t=[],o=AS(e,0,42);for(let r=0;r<o;r++)t.push(Gi(e,n.shape));return t}).if(OS,(n,e)=>fp(e,n.shape)).if(_F,(n,e)=>null).if(AF,(n,e)=>{const t=Gi(e,n.res);return()=>t}).if(BF,(n,e)=>Gi(e,fp(e,[gs,Rs,hf,jS,oy,pf,LS(gs),DS(Hs("a","b","c"),gs)]))).if(xF,(n,e)=>{const t={},o=dp(e,0,3);for(let r=0;r<o;r++){const i=Gi(e,n.shape.keys),s=Gi(e,n.shape.values);t[i]=s}return t}).done(),Gi=(n,e)=>US(ia(e),n),Pa=typeof document<"u"?document:{};At(n=>n.nodeType===FF);typeof DOMParser<"u"&&new DOMParser;At(n=>n.nodeType===VF);At(n=>n.nodeType===zF);const VF=Pa.ELEMENT_NODE,zF=Pa.TEXT_NODE,HF=Pa.DOCUMENT_NODE,FF=Pa.DOCUMENT_FRAGMENT_NODE;At(n=>n.nodeType===HF);const jF=n=>class{constructor(t){this._=t}destroy(){n(this._)}},UF=jF(clearTimeout),ry=(n,e)=>new UF(setTimeout(e,n)),xo=(n,e)=>n>>>e|n<<32-e,WF=n=>xo(n,2)^xo(n,13)^xo(n,22),qF=n=>xo(n,6)^xo(n,11)^xo(n,25),KF=n=>xo(n,7)^xo(n,18)^n>>>3,JF=n=>xo(n,17)^xo(n,19)^n>>>10,GF=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]),XF=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class YF{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(XF),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,t=this._W;for(let f=16;f<64;f++)t[f]=JF(t[f-2])+t[f-7]+KF(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],u=e[6],d=e[7];for(let f=0,p,h;f<64;f++)p=d+qF(l)+(l&a^~l&u)+GF[f]+t[f]>>>0,h=WF(o)+(o&r^o&i^r&i)>>>0,d=u,u=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]+=u,e[7]+=d}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]|=ta<<(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)]|=ta<<(3-t%4)*8),this._W[14]=e.byteLength/gH,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 QF=n=>new YF().digest(n),Ge=new le("y-sync"),Yo=new le("y-undo"),uc=new le("yjs-cursor"),ZF=n=>{for(let t=6;t<n.length;t++)n[t%6]=n[t%6]^n[t];return n.slice(0,6)},ej=n=>aF(ZF(QF(cF(n)))),Yu=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!oe.isDeleted(e.ds,n.id),tj=[{light:"#ecd44433",dark:"#ecd444"}],nj=(n,e,t)=>{if(!n.has(t)){if(n.size<e.length){const o=vH();n.forEach(r=>o.add(r)),e=e.filter(r=>!o.has(r))}n.set(t,ZH(e))}return n.get(t)},oj=(n,{colors:e=tj,colorMapping:t=new Map,permanentUserData:o=null,onFirstRender:r=()=>{},mapping:i}={})=>{let s=!1;const l=new sj(n,i),a=new ce({props:{editable:u=>{const d=Ge.getState(u);return d.snapshot==null&&d.prevSnapshot==null}},key:Ge,state:{init:(u,d)=>({type:n,doc:n.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:t,permanentUserData:o}),apply:(u,d)=>{const f=u.getMeta(Ge);if(f!==void 0){d=Object.assign({},d);for(const p in f)d[p]=f[p]}return d.addToHistory=u.getMeta("addToHistory")!==!1,d.isChangeOrigin=f!==void 0&&!!f.isChangeOrigin,d.isUndoRedoOperation=f!==void 0&&!!f.isChangeOrigin&&!!f.isUndoRedoOperation,l.prosemirrorView!==null&&f!==void 0&&(f.snapshot!=null||f.prevSnapshot!=null)&&ry(0,()=>{l.prosemirrorView!=null&&(f.restore==null?l._renderSnapshot(f.snapshot,f.prevSnapshot,d):(l._renderSnapshot(f.snapshot,f.snapshot,d),delete d.restore,delete d.snapshot,delete d.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),d}},view:u=>(l.initView(u),i==null&&l._forceRerender(),r(),{update:()=>{const d=a.getState(u.state);if(d.snapshot==null&&d.prevSnapshot==null&&(s||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(s=!0,d.addToHistory===!1&&!d.isChangeOrigin){const f=Yo.getState(u.state),p=f&&f.undoManager;p&&p.stopCapturing()}l.mux(()=>{d.doc.transact(f=>{f.meta.set("addToHistory",d.addToHistory),l._prosemirrorChanged(u.state.doc)},Ge)})}},destroy:()=>{l.destroy()}})});return a},rj=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")n.setSelection(new sn(n.doc));else if(e.type==="node"){const o=fi(t.doc,t.type,e.anchor,t.mapping);n.setSelection(ij(n,o))}else{const o=fi(t.doc,t.type,e.anchor,t.mapping),r=fi(t.doc,t.type,e.head,t.mapping);o!==null&&r!==null&&n.setSelection(q.between(n.doc.resolve(o),n.doc.resolve(r)))}},ij=(n,e)=>{const t=n.doc.resolve(e);return t.nodeAfter?Q.create(n.doc,e):q.near(t)},Rh=(n,e)=>({type:e.selection.jsonID,anchor:la(e.selection.anchor,n.type,n.mapping),head:la(e.selection.head,n.type,n.mapping)});class sj{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=KH(),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=Rh(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()?(TS&&this._domSelectionInView===null&&(ry(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=Pa.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=oe.createSnapshot(oe.createDeleteSet(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ge,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(o=>Ic(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(I.from(e),0,0));t.setMeta(Ge,{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=>Ic(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(I.from(t),0,0));if(e){const r=Ir($s(e.anchor,0),o.doc.content.size),i=Ir($s(e.head,0),o.doc.content.size);o.setSelection(q.create(o.doc,r,i))}this.prosemirrorView.dispatch(o.setMeta(Ge,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,o){let r=this.doc,i=this.type;if(e||(e=oe.snapshot(this.doc)),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&Ia(),r=new oe.Doc({gc:!1}),oe.applyUpdateV2(r,t),t=oe.snapshot(r),oe.applyUpdateV2(r,e),e=oe.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=oe.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=>{oe.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:nj(o.colorMapping,o.colors,h)}},u=oe.typeListToArraySnapshot(i,new oe.Snapshot(t.ds,e.sv)).map(f=>!f._item.deleted||Yu(f._item,e)||Yu(f._item,t)?Ic(f,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,a):null).filter(f=>f!==null),d=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(I.from(u),0,0));this.prosemirrorView.dispatch(d.setMeta(Ge,{isChangeOrigin:!0}))},Ge)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;const o=Ge.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);oe.iterateDeletedStructs(t,t.deleteSet,l=>{if(l.constructor===oe.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=>WS(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new F(I.from(i),0,0));rj(s,this.beforeTransactionSelection,this),s=s.setMeta(Ge,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof oe.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{_h(this.doc,this.type,e,this),this.beforeTransactionSelection=Rh(this,this.prosemirrorView.state)},Ge)}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 WS=(n,e,t,o,r,i)=>{const s=t.mapping.get(n);if(s===void 0){if(n instanceof oe.XmlElement)return Ic(n,e,t,o,r,i);throw xS()}return s},Ic=(n,e,t,o,r,i)=>{const s=[],l=a=>{var u,d;if(a instanceof oe.XmlElement){const f=WS(a,e,t,o,r,i);f!==null&&s.push(f)}else{const f=(d=(u=a._item.right)==null?void 0:u.content)==null?void 0:d.type;f instanceof oe.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=lj(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):oe.typeListToArraySnapshot(n,new oe.Snapshot(r.ds,o.sv)).forEach(l);try{const a=n.getAttributes(o);o!==void 0&&(Yu(n._item,o)?Yu(n._item,r)||(a.ychange=i?i("added",n._item.id):{type:"added"}):a.ychange=i?i("removed",n._item.id):{type:"removed"});const u=e.node(n.nodeName,a,s);return t.mapping.set(n,u),u}catch{return n.doc.transact(u=>{n._item.delete(u)},Ge),t.mapping.delete(n),null}},lj=(n,e,t,o,r,i)=>{const s=[],l=n.toDelta(o,r,i);try{for(let a=0;a<l.length;a++){const u=l[a];s.push(e.text(u.insert,pj(u.attributes,e)))}}catch{return n.doc.transact(u=>{n._item.delete(u)},Ge),null}return s},aj=(n,e)=>{const t=new oe.XmlText,o=n.map(r=>({insert:r.text,attributes:KS(r.marks,e)}));return t.applyDelta(o),e.mapping.set(t,n),t},cj=(n,e)=>{const t=new oe.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,mf(n).map(o=>Dh(o,e))),e.mapping.set(t,n),t},Dh=(n,e)=>n instanceof Array?aj(n,e):cj(n,e),mk=n=>typeof n=="object"&&n!==null,iy=(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||mk(s)&&mk(l)&&iy(s,l)}return o},mf=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},qS=(n,e)=>{const t=n.toDelta();return t.length===e.length&&t.every((o,r)=>o.insert===e[r].text&&SS(o.attributes||{}).length===e[r].marks.length&&La(o.attributes,(i,s)=>{var d;const l=sy(s),a=e[r].marks;return a.find(f=>f.type.name===l)?iy(i,(d=a.find(f=>f.type.name===l))==null?void 0:d.attrs):!1}))},sa=(n,e)=>{if(n instanceof oe.XmlElement&&!(e instanceof Array)&&Ih(n,e)){const t=mf(e);return n._length===t.length&&iy(n.getAttributes(),e.attrs)&&n.toArray().every((o,r)=>sa(o,t[r]))}return n instanceof oe.XmlText&&e instanceof Array&&qS(n,e)},Qu=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,o)=>e[o]===t),gk=(n,e,t)=>{const o=n.toArray(),r=mf(e),i=r.length,s=o.length,l=Ir(s,i);let a=0,u=0,d=!1;for(;a<l;a++){const f=o[a],p=r[a];if(Qu(t.mapping.get(f),p))d=!0;else if(!sa(f,p))break}for(;a+u<l;u++){const f=o[s-u-1],p=r[i-u-1];if(Qu(t.mapping.get(f),p))d=!0;else if(!sa(f,p))break}return{equalityFactor:a+u,foundMappedChild:d}},uj=n=>{let e="",t=n._start;const o={};for(;t!==null;)t.deleted||(t.countable&&t.content instanceof oe.ContentString?e+=t.content.str:t.content instanceof oe.ContentFormat&&(o[t.content.key]=null)),t=t.right;return{str:e,nAttrs:o}},dj=(n,e,t)=>{t.mapping.set(n,e);const{nAttrs:o,str:r}=uj(n),i=e.map(u=>({insert:u.text,attributes:Object.assign({},o,KS(u.marks,t))})),{insert:s,remove:l,index:a}=YH(r,i.map(u=>u.insert).join(""));n.delete(a,l),n.insert(a,s),n.applyDelta(i.map(u=>({retain:u.insert.length,attributes:u.attributes})))},fj=/(.*)(--[a-zA-Z0-9+/=]{8})$/,sy=n=>{var e;return((e=fj.exec(n))==null?void 0:e[1])??n},pj=(n,e)=>{const t=[];for(const o in n)t.push(e.mark(sy(o),n[o]));return t},KS=(n,e)=>{const t={};return n.forEach(o=>{if(o.type.name!=="ychange"){const r=CS(e.isOMark,o.type,()=>!o.type.excludes(o.type));t[r?`${o.type.name}--${ej(o.toJSON())}`:o.type.name]=o.attrs}}),t},_h=(n,e,t,o)=>{if(e instanceof oe.XmlElement&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(o.mapping.set(e,t),e instanceof oe.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=mf(t),i=r.length,s=e.toArray(),l=s.length,a=Ir(i,l);let u=0,d=0;for(;u<a;u++){const f=s[u],p=r[u];if(!Qu(o.mapping.get(f),p))if(sa(f,p))o.mapping.set(f,p);else break}for(;d+u+1<a;d++){const f=s[l-d-1],p=r[i-d-1];if(!Qu(o.mapping.get(f),p))if(sa(f,p))o.mapping.set(f,p);else break}n.transact(()=>{for(;l-u-d>0&&i-u-d>0;){const p=s[u],h=r[u],m=s[l-d-1],g=r[i-d-1];if(p instanceof oe.XmlText&&h instanceof Array)qS(p,h)||dj(p,h,o),u+=1;else{let y=p instanceof oe.XmlElement&&Ih(p,h),b=m instanceof oe.XmlElement&&Ih(m,g);if(y&&b){const v=gk(p,h,o),w=gk(m,g,o);v.foundMappedChild&&!w.foundMappedChild?b=!1:!v.foundMappedChild&&w.foundMappedChild||v.equalityFactor<w.equalityFactor?y=!1:b=!1}y?(_h(n,p,h,o),u+=1):b?(_h(n,m,g,o),d+=1):(o.mapping.delete(e.get(u)),e.delete(u,1),e.insert(u,[Dh(h,o)]),u+=1)}}const f=l-u-d;if(l===1&&i===0&&s[0]instanceof oe.XmlText?(o.mapping.delete(s[0]),s[0].delete(0,s[0].length)):f>0&&(e.slice(u,u+f).forEach(p=>o.mapping.delete(p)),e.delete(u,f)),u+d<i){const p=[];for(let h=u;h<i-d;h++)p.push(Dh(r[h],o));e.insert(u,p)}},Ge)},Ih=(n,e)=>!(e instanceof Array)&&n.nodeName===e.type.name;let Al=null;const hj=()=>{const n=Al;Al=null,n.forEach((e,t)=>{const o=t.state.tr,r=Ge.getState(t.state);r&&r.binding&&!r.binding.isDestroyed&&(e.forEach((i,s)=>{o.setMeta(s,i)}),t.dispatch(o))})},mj=(n,e,t)=>{Al||(Al=new Map,ry(0,hj)),CS(Al,n,Dc).set(e,t)},la=(n,e,t)=>{if(n===0)return oe.createRelativePositionFromTypeIndex(e,0,-1);let o=e._first===null?null:e._first.content.type;for(;o!==null&&e!==o;){if(o instanceof oe.XmlText){if(o._length>=n)return oe.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 oe.RelativePosition(o._item===null?null:o._item.id,o._item===null?oe.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 oe.RelativePosition(o._item===null?null:o._item.id,o._item===null?oe.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 Ia();if(n===0&&o.constructor!==oe.XmlText&&o!==e)return gj(o._item.parent,o._item)}return oe.createRelativePositionFromTypeIndex(e,e._length,-1)},gj=(n,e)=>{let t=null,o=null;return n._item===null?o=oe.findRootTypeKey(n):t=oe.createID(n._item.id.client,n._item.id.clock),new oe.RelativePosition(t,o,e.id)},fi=(n,e,t,o)=>{const r=oe.createAbsolutePositionFromRelativePosition(t,n);if(r===null||r.type!==e&&!oe.isParentOf(e,r.type._item))return null;let i=r.type,s=0;if(i.constructor===oe.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 u=l.content.type;a++,u instanceof oe.XmlText?s+=u._length:s+=o.get(u).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 u=a.content.type;if(u===i)break;a.deleted||(u instanceof oe.XmlText?s+=u._length:s+=o.get(u).nodeSize),a=a.right}}i=l}return s-1};function yj(n){const e=n.toArray(),t=o=>{let r;if(o instanceof oe.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 u=s.attributes[a],f={type:sy(a)};return Object.keys(u)&&(f.attrs=u),f})),l});else if(o instanceof oe.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 Ia();return r};return{type:"doc",content:e.map(t)}}const bj=(n,e,t)=>n!==e,vj=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},JS=n=>({style:`background-color: ${n.color}70`,class:"ProseMirror-yjs-selection"}),kj=/^#[0-9a-fA-F]{6}$/,yk=(n,e,t,o,r)=>{const i=Ge.getState(n);if(i==null||i.doc==null||i.binding==null)return xe.create(n.doc,[]);const s=i.doc,l=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?xe.create(n.doc,[]):(e.getStates().forEach((a,u)=>{if(t(s.clientID,u,a)&&a.cursor!=null){const d=a.user||{};d.color==null?d.color="#ffa500":kj.test(d.color)||console.warn("A user uses an unsupported color format",d),d.name==null&&(d.name=`User: ${u}`);let f=fi(s,i.type,oe.createRelativePositionFromJSON(a.cursor.anchor),i.binding.mapping),p=fi(s,i.type,oe.createRelativePositionFromJSON(a.cursor.head),i.binding.mapping);if(f!==null&&p!==null){const h=$s(n.doc.content.size-1,0);f=Ir(f,h),p=Ir(p,h),l.push(ze.widget(p,()=>o(d,u),{key:u+"",side:10}));const m=Ir(f,p),g=$s(f,p);l.push(ze.inline(m,g,r(d,u),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),xe.create(n.doc,l))},wj=(n,{awarenessStateFilter:e=bj,cursorBuilder:t=vj,selectionBuilder:o=JS,getSelection:r=s=>s.selection}={},i="cursor")=>new ce({key:uc,state:{init(s,l){return yk(l,n,e,t,o)},apply(s,l,a,u){const d=Ge.getState(u),f=s.getMeta(uc);return d&&d.isChangeOrigin||f&&f.awarenessUpdated?yk(u,n,e,t,o):l.map(s.mapping,s.doc)}},props:{decorations:s=>uc.getState(s)},view:s=>{const l=()=>{s.docView&&mj(s,uc,{awarenessUpdated:!0})},a=()=>{const u=Ge.getState(s.state),d=n.getLocalState()||{};if(s.hasFocus()){const f=r(s.state),p=la(f.anchor,u.type,u.binding.mapping),h=la(f.head,u.type,u.binding.mapping);(d.cursor==null||!oe.compareRelativePositions(oe.createRelativePositionFromJSON(d.cursor.anchor),p)||!oe.compareRelativePositions(oe.createRelativePositionFromJSON(d.cursor.head),h))&&n.setLocalStateField(i,{anchor:p,head:h})}else d.cursor!=null&&fi(u.doc,u.type,oe.createRelativePositionFromJSON(d.cursor.anchor),u.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)}}}}),xj=n=>{const e=Yo.getState(n).undoManager;if(e!=null)return e.undo(),!0},Cj=n=>{const e=Yo.getState(n).undoManager;if(e!=null)return e.redo(),!0},Sj=new Set(["paragraph"]),Ej=(n,e)=>!(n instanceof cs.Item)||!(n.content instanceof cs.ContentType)||!(n.content.type instanceof cs.Text||n.content.type instanceof cs.XmlElement&&e.has(n.content.type.nodeName))||n.content.type._length===0,Mj=({protectedNodes:n=Sj,trackedOrigins:e=[],undoManager:t=null}={})=>new ce({key:Yo,state:{init:(o,r)=>{const i=Ge.getState(r),s=t||new cs.UndoManager(i.type,{trackedOrigins:new Set([Ge].concat(e)),deleteFilter:l=>Ej(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=Ge.getState(s).binding,a=r.undoManager,u=a.undoStack.length>0,d=a.redoStack.length>0;return l?{undoManager:a,prevSel:Rh(l,i),hasUndoOps:u,hasRedoOps:d}:u!==r.hasUndoOps||d!==r.hasRedoOps?Object.assign({},r,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):r}},view:o=>{const r=Ge.getState(o.state),i=Yo.getState(o.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const l=r.binding;l&&s.meta.set(l,Yo.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 Tj(n){return!!n.getMeta(Ge)}function Nj(n,e){const t=Ge.getState(n);return fi(t.doc,t.type,e,t.binding.mapping)||0}function GS(n,e){const t=Ge.getState(n);return la(e,t.type,t.binding.mapping)}var Lc=class XS extends _d{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(e){return new XS(e.position,e.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function Aj(n,e){const t=GS(e,n);return new Lc(n,t)}function Oj(n,e,t){const o=n instanceof Lc?n.yRelativePosition:null;if(Tj(e)&&o){const s=Nj(t,o);return{position:new Lc(s,o),mapResult:null}}const r=Zm(n,e),i=r.position.position;return{position:new Lc(i,o??GS(t,i)),mapResult:r.mapResult}}var $j=ye.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)=>Oj(n,e,this.editor.state),this.editor.utils.createMappablePosition=n=>Aj(n,this.editor.state)},addCommands(){return{undo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Yo.getState(e).undoManager.undoStack.length===0?!1:t?xj(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Yo.getState(e).undoManager.redoStack.length===0?!1:t?Cj(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=Mj(this.options.yUndoOptions),o=t.spec.view;t.spec.view=s=>{const{undoManager:l}=Yo.getState(s.state);l.restore&&(l.restore(),l.restore=()=>{});const a=o?o(s):void 0;return{destroy:()=>{const u=l.trackedOrigins.has(l),d=l._observers;l.restore=()=>{u&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=d},a!=null&&a.destroy&&a.destroy()}}};const r={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},i=oj(e,r);return this.editor.options.enableContentCheck&&((n=e.doc)==null||n.on("beforeTransaction",()=>{try{const s=yj(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)}}),YS=$j,bk=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t.user})),vk=()=>null,Bj=ye.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:JS,onUpdate:vk}},onCreate(){if(this.options.onUpdate!==vk&&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[wj((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=bk(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=bk(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),QS=Bj,Rj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Dj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,_j=Wn.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",de(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[Vr({find:Rj,type:this.type})]},addPasteRules(){return[tr({find:Dj,type:this.type})]}}),ZS=_j,Ij=/(?:^|\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",de(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:"",u=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return u?`![${a}](${l} "${u}")`:`![${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 u=new Vd({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}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Ps({find:Ij,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),eE=Lj;function Pj(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,u=ng(t),d=new RegExp(`\\s${u}$`),f=s?"^":"",p=r?"":u,h=a?new RegExp(`${f}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\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),v=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const w=g+y.index;let k=w+y[0].length;return a&&d.test(m.slice(k-1,k+1))&&(y[0]+=" ",k+=1),w<l.pos&&k>=l.pos?{range:{from:w,to:k},query:y[0].slice(t.length),text:y[0]}:null}var Vj=new le("suggestion");function zj({pluginKey:n=Vj,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=Pj,shouldShow:y}){let b;const v=h==null?void 0:h(),w=()=>{const S=e.state.selection.$anchor.pos,M=e.view.coordsAtPos(S),{top:N,right:O,bottom:A,left:$}=M;try{return new DOMRect($,N,O-$,A-N)}catch{return null}},k=(S,M)=>M?()=>{const N=n.getState(e.state),O=N==null?void 0:N.decorationId,A=S.dom.querySelector(`[data-decoration-id="${O}"]`);return(A==null?void 0:A.getBoundingClientRect())||null}:w;function x(S,M){var N;try{const A=n.getState(S.state),$=A!=null&&A.decorationId?S.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`):null,D={editor:e,range:(A==null?void 0:A.range)||{from:0,to:0},query:(A==null?void 0:A.query)||null,text:(A==null?void 0:A.text)||null,items:[],command:R=>f({editor:e,range:(A==null?void 0:A.range)||{from:0,to:0},props:R}),decorationNode:$,clientRect:k(S,$)};(N=v==null?void 0:v.onExit)==null||N.call(v,D)}catch{}const O=S.state.tr.setMeta(M,{exit:!0});S.dispatch(O)}const C=new ce({key:n,view(){return{update:async(S,M)=>{var N,O,A,$,D,R,L;const B=(N=this.key)==null?void 0:N.getState(M),W=(O=this.key)==null?void 0:O.getState(S.state),z=B.active&&W.active&&B.range.from!==W.range.from,U=!B.active&&W.active,he=B.active&&!W.active,Se=!U&&!he&&B.query!==W.query,_e=U||z&&Se,je=Se||z,He=he||z&&Se;if(!_e&&!je&&!He)return;const Ne=He&&!_e?B:W,Fe=S.dom.querySelector(`[data-decoration-id="${Ne.decorationId}"]`);b={editor:e,range:Ne.range,query:Ne.query,text:Ne.text,items:[],command:kt=>f({editor:e,range:Ne.range,props:kt}),decorationNode:Fe,clientRect:k(S,Fe)},_e&&((A=v==null?void 0:v.onBeforeStart)==null||A.call(v,b)),je&&(($=v==null?void 0:v.onBeforeUpdate)==null||$.call(v,b)),(je||_e)&&(b.items=await p({editor:e,query:Ne.query})),He&&((D=v==null?void 0:v.onExit)==null||D.call(v,b)),je&&((R=v==null?void 0:v.onUpdate)==null||R.call(v,b)),_e&&((L=v==null?void 0:v.onStart)==null||L.call(v,b))},destroy:()=>{var S;b&&((S=v==null?void 0:v.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,M,N,O){const{isEditable:A}=e,{composing:$}=e.view,{selection:D}=S,{empty:R,from:L}=D,B={...M},W=S.getMeta(n);if(W&&W.exit)return B.active=!1,B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null,B;if(B.composing=$,A&&(R||e.view.composing)){(L<M.range.from||L>M.range.to)&&!$&&!M.composing&&(B.active=!1);const z=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:D.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;z&&m({editor:e,state:O,range:z.range,isActive:M.active})&&(!y||y({editor:e,range:z.range,query:z.query,text:z.text,transaction:S}))?(B.active=!0,B.decorationId=M.decorationId?M.decorationId:U,B.range=z.range,B.query=z.query,B.text=z.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(S,M){var N,O,A,$;const{active:D,range:R}=C.getState(S.state);if(!D)return!1;if(M.key==="Escape"||M.key==="Esc"){const B=C.getState(S.state),W=(N=b==null?void 0:b.decorationNode)!=null?N:null,z=W??(B!=null&&B.decorationId?S.dom.querySelector(`[data-decoration-id="${B.decorationId}"]`):null);if(((O=v==null?void 0:v.onKeyDown)==null?void 0:O.call(v,{view:S,event:M,range:B.range}))||!1)return!0;const he={editor:e,range:B.range,query:B.query,text:B.text,items:[],command:Se=>f({editor:e,range:B.range,props:Se}),decorationNode:z,clientRect:z?()=>z.getBoundingClientRect()||null:null};return(A=v==null?void 0:v.onExit)==null||A.call(v,he),x(S,n),!0}return(($=v==null?void 0:v.onKeyDown)==null?void 0:$.call(v,{view:S,event:M,range:R}))||!1},decorations(S){const{active:M,range:N,decorationId:O,query:A}=C.getState(S);if(!M)return null;const $=!(A!=null&&A.length),D=[a];return $&&D.push(d),xe.create(S.doc,[ze.inline(N.from,N.to,{nodeName:l,class:D.join(" "),"data-decoration-id":O,"data-decoration-content":u})])}}});return C}function Hj({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,u,d;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(),(d=(u=i.view.dom.ownerDocument.defaultView)==null?void 0:u.getSelection())==null||d.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 tE(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>Hj({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function kk(n,e){const t=tE(n),o=t.find(r=>r.char===e);return o||(t.length?t[0]:null)}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",de(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=kk(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",de({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const o={...this.options};o.HTMLAttributes=de({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:o,node:n,suggestion:t});return typeof r=="string"?["span",de({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},...og({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:kk(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 Ln,l=0;return e.doc.nodesBetween(i-1,i,(a,u)=>{if(a.type.name===this.name)return t=!0,s=a,l=u,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,l,l+s.nodeSize),t})}},addProseMirrorPlugins(){return tE(this).map(zj)}}),jj=Fj,Uj=Wn.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",de(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()}}}),nE=Uj,Wj=Wn.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",de(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()}}}),oE=Wj,qj=ye.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")}}}),rE=qj,Kj=n=>rt({find:/--$/,replace:n??"—"}),Jj=n=>rt({find:/\.\.\.$/,replace:n??"…"}),Gj=n=>rt({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:n??"“"}),Xj=n=>rt({find:/"$/,replace:n??"”"}),Yj=n=>rt({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:n??"‘"}),Qj=n=>rt({find:/'$/,replace:n??"’"}),Zj=n=>rt({find:/<-$/,replace:n??"←"}),e3=n=>rt({find:/->$/,replace:n??"→"}),t3=n=>rt({find:/\(c\)$/,replace:n??"©"}),n3=n=>rt({find:/\(tm\)$/,replace:n??"™"}),o3=n=>rt({find:/\(sm\)$/,replace:n??"℠"}),r3=n=>rt({find:/\(r\)$/,replace:n??"®"}),i3=n=>rt({find:/(?:^|\s)(1\/2)\s$/,replace:n??"½"}),s3=n=>rt({find:/\+\/-$/,replace:n??"±"}),l3=n=>rt({find:/!=$/,replace:n??"≠"}),a3=n=>rt({find:/<<$/,replace:n??"«"}),c3=n=>rt({find:/>>$/,replace:n??"»"}),u3=n=>rt({find:/\d+\s?([*x])\s?\d+$/,replace:n??"×"}),d3=n=>rt({find:/\^2$/,replace:n??"²"}),f3=n=>rt({find:/\^3$/,replace:n??"³"}),p3=n=>rt({find:/(?:^|\s)(1\/4)\s$/,replace:n??"¼"}),h3=n=>rt({find:/(?:^|\s)(3\/4)\s$/,replace:n??"¾"}),m3=ye.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(Kj(this.options.emDash)),this.options.ellipsis!==!1&&n.push(Jj(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&n.push(Gj(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(Xj(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&n.push(Yj(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(Qj(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&n.push(Zj(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(e3(this.options.rightArrow)),this.options.copyright!==!1&&n.push(t3(this.options.copyright)),this.options.trademark!==!1&&n.push(n3(this.options.trademark)),this.options.servicemark!==!1&&n.push(o3(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(r3(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(i3(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(s3(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(l3(this.options.notEqual)),this.options.laquo!==!1&&n.push(a3(this.options.laquo)),this.options.raquo!==!1&&n.push(c3(this.options.raquo)),this.options.multiplication!==!1&&n.push(u3(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(d3(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(f3(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(p3(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(h3(this.options.threeQuarters)),n}}),iE=m3,Bt=[];for(var pp=0;pp<256;++pp)Bt.push((pp+256).toString(16).slice(1));function g3(n,e=0){return(Bt[n[e+0]]+Bt[n[e+1]]+Bt[n[e+2]]+Bt[n[e+3]]+"-"+Bt[n[e+4]]+Bt[n[e+5]]+"-"+Bt[n[e+6]]+Bt[n[e+7]]+"-"+Bt[n[e+8]]+Bt[n[e+9]]+"-"+Bt[n[e+10]]+Bt[n[e+11]]+Bt[n[e+12]]+Bt[n[e+13]]+Bt[n[e+14]]+Bt[n[e+15]]).toLowerCase()}var dc,y3=new Uint8Array(16);function b3(){if(!dc&&(dc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!dc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return dc(y3)}var v3=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const wk={randomUUID:v3};function sE(n,e,t){if(wk.randomUUID&&!n)return wk.randomUUID();n=n||{};var o=n.random||(n.rng||b3)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,g3(o)}function k3(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 w3=ye.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>sE(),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:u,doc:d}=a,{types:f,attributeName:p,generateID:h}=this.options;Xo(d,g=>f.includes(g.type.name)&&g.attrs[p]===null).forEach(({node:g,pos:y})=>{u.setNodeMarkup(y,void 0,{...g.attrs,[p]:h({node:g,pos:y})})}),u.setMeta("addToHistory",!1),l.dispatch(u),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:u,attributeName:d,generateID:f}=this.options,p=Md(o.doc,t),{mapping:h}=p;if(Rd(p).forEach(({newRange:g})=>{const y=Um(r.doc,g,v=>u.includes(v.type.name)),b=y.map(({node:v})=>v.attrs[d]).filter(v=>v!==null);y.forEach(({node:v,pos:w},k)=>{var x;const C=(x=a.doc.nodeAt(w))==null?void 0:x.attrs[d];if(C===null){a.setNodeMarkup(w,void 0,{...v.attrs,[d]:f({node:v,pos:w})});return}const S=y[k+1];if(S&&v.content.size===0){const A=a.doc.nodeAt(S.pos);if(A!=null&&A.attrs[d]&&A.attrs[d]!==C)return;a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[d]:C}),b[k+1]=C;const $=f({node:v,pos:w});return a.setNodeMarkup(w,void 0,{...v.attrs,[d]:$}),b[k]=$,a}const M=k3(b),{deleted:N}=h.invert().mapResult(w);N&&M.includes(C)&&a.setNodeMarkup(w,void 0,{...v.attrs,[d]:f({node:v,pos:w})})})}),!!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 u=a.type.create({...a.attrs,[r]:null},i(a.content),a.marks);l.push(u)}),I.from(l)};return e=!1,new F(i(t.content),t.openStart,t.openEnd)}}})]}}),lE=w3;/**
216
- * Copyright 2026 Yiitap
217
- * @license MIT
218
- **/const xk=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,u=a+s.length,d=ze.inline(a,u,{class:"color-highlighter",style:`--color: ${s}`});t.push(d)})}),xe.create(n,t)},aE=ye.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new ce({key:new le("colorHighlighter"),state:{init(n,{doc:e}){return xk(e)},apply(n,e){return n.docChanged?xk(n.doc):e}},props:{decorations(n){return this.getState(n)}}})]}});/**
219
- * Copyright 2026 Yiitap
220
- * @license MIT
221
- **/const hp=new le("inlinePlaceholderPlugin"),cE=ye.create({name:"inlinePlaceholder",addOptions(){return{onShow:n=>{},onHide:()=>{}}},addProseMirrorPlugins(){return[new ce({key:hp,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(hp);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=hp.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 xe.create(n.doc,[t])}},view:()=>({destroy:this.options.onHide})})]}});/**
222
- * Copyright 2026 Yiitap
223
- * @license MIT
224
- **/const uE=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",de(n,{"data-type":"column"}),0]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
225
- `)+`
226
-
227
- `:""}),dE=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",de(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""}}),Lh=ye.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,u;const r=t.dom.getBoundingClientRect(),i=(a=document.elementFromPoint(o.clientX,o.clientY))==null?void 0:a.closest('[data-type="column"]');if(i){const d=i.getBoundingClientRect();if(o.clientX>d.right-d.width*.4)return o.preventDefault(),o.dataTransfer.dropEffect="move",n&&(n.style.display="block",n.style.height=`${d.height}px`,n.style.top=`${t.dom.offsetTop+(d.top-r.top)}px`,n.style.left=`${t.dom.offsetLeft+(d.left-r.left)+d.width+4}px`),t.dom.classList.add("hide-native-dropcursor"),!0}const s=r.left+r.width/2,l=(u=document.elementFromPoint(s,o.clientY))==null?void 0:u.closest(".tiptap > *");if(l&&!l.matches('[data-type="column-container"]')){const d=l.getBoundingClientRect();if(o.clientX>d.right-40&&o.clientX<d.right)return o.preventDefault(),o.dataTransfer.dropEffect="move",n&&(n.style.display="block",n.style.height=`${d.height}px`,n.style.top=`${t.dom.offsetTop+(d.top-r.top)}px`,n.style.left=`${t.dom.offsetLeft+(d.left-r.left)+d.width+4}px`),t.dom.classList.add("hide-native-dropcursor"),!0}return e(t),!1},drop:(t,o)=>{var v;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,u=a==null?void 0:a.slice;if(!u)return!1;const{state:d,dispatch:f}=t,{column:p,columns:h}=d.schema.nodes;let m=d.tr;if(a.move){const{from:w,to:k}=d.selection;m.delete(w,k)}const g=((v=u.content.firstChild)==null?void 0:v.type.name)==="columns",y=t.posAtDOM(s,0),b=d.doc.resolve(y);try{if(i){const w=m.mapping.map(b.after(b.depth)),k=[];g?u.content.firstChild.content.forEach(x=>k.push(x)):k.push(p.create({flexGrow:1},u.content)),m.insert(w,k)}else{const w=m.mapping.map(b.before(1)),k=m.doc.nodeAt(w);if(!k)return!1;if(g){const x=u.content.firstChild,C=[p.create({flexGrow:1},k)];x.content.forEach(S=>C.push(S)),m.replaceWith(w,w+k.nodeSize,h.create(null,C))}else{const x=h.create(null,[p.create({flexGrow:1},k),p.create({flexGrow:1},u.content)]);m.replaceWith(w,w+k.nodeSize,x)}}return t.dragging=null,f&&f(m),!0}catch(w){return console.error("Column drop error:",w),!1}}},handleDragLeave:t=>e(t)}})]}});function x3(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 C3=()=>!!document.querySelector(".slash-tippy"),S3=(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(vo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}const o=t.blockRange(),r=o&&Li(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)},E3=mx({Enter:(n,e,t)=>C3()?!1:wd(Mm,Nm,S3,$0)(n,e,t),"Mod-a":(n,e,t)=>{const{selection:o}=n,{$from:r}=o,i=x3(r);if(i){const{depth:s}=i,l=r.start(s),a=r.end(s),u=n.tr.setSelection(q.create(n.doc,l,a));return e&&e(u),!0}return!1}}),Yn=new le("gridResizingPlugin");let M3=class Ph{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=e.getMeta(Yn);return(t==null?void 0:t.setHandle)!==void 0?new Ph(t.setHandle,this.dragging):(t==null?void 0:t.setDragging)!==void 0?new Ph(this.activeHandle,t.setDragging):this}};function T3(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 N3(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 fE(n,e){n.dispatch(n.state.tr.setMeta(Yn,{setHandle:e}))}function A3(n,e,t){const o=Yn.getState(n.state);if(!o||o.dragging)return!1;const r=T3(n,e,t);return r!==o.activeHandle&&fE(n,r),!1}function O3(n){const e=Yn.getState(n.state);return e&&e.activeHandle>-1&&!e.dragging&&fE(n,-1),!1}function $3(n,e,t=.1){const o=Yn.getState(n.state);if(!o||o.activeHandle===-1||o.dragging)return!1;const r=N3(n,o.activeHandle);if(!r)return!1;const{$pos:i,node:s,columnEl:l}=r,a=i.before(),u=l.parentElement;if(!u)return!1;const d=a+s.nodeSize,f=n.state.doc.nodeAt(d),p=f&&f.type.name==="column";let h=0;i.parent.forEach(v=>{h+=v.attrs.flexGrow||1});const m=u.offsetWidth;n.dispatch(n.state.tr.setMeta(Yn,{setDragging:{startX:e.clientX,startFlex:s.attrs.flexGrow||1,nextColFlex:p?f.attrs.flexGrow||1:null,nextColPos:p?d:null,totalFlex:h,containerWidth:m}}));const g=n.dom.ownerDocument.defaultView||window,y=v=>{var D;if(!v.buttons){b();return}const w=(D=Yn.getState(n.state))==null?void 0:D.dragging;if(!w)return;const{startX:k,startFlex:x,nextColFlex:C,nextColPos:S,totalFlex:M,containerWidth:N}=w,O=(v.clientX-k)/N*M,A=n.state.tr;let $=Math.max(t,x+O);if(S!==null&&C!==null){const R=x+C;let L=Math.max(t,R-$);$=R-L,A.setNodeMarkup(a,void 0,{...s.attrs,flexGrow:$});const B=n.state.doc.nodeAt(S);B&&B.type.name==="column"&&A.setNodeMarkup(S,void 0,{...B.attrs,flexGrow:L})}else A.setNodeMarkup(a,void 0,{...s.attrs,flexGrow:$});n.dispatch(A.setMeta("addToHistory",!1))},b=()=>{g.removeEventListener("mouseup",b),g.removeEventListener("mousemove",y),n.dispatch(n.state.tr.setMeta(Yn,{setDragging:null}))};return g.addEventListener("mouseup",b),g.addEventListener("mousemove",y),e.preventDefault(),!0}function B3(n,e){if(n.doc.resolve(e).nodeAfter===null)return xe.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 xe.create(n.doc,[t])}function R3(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,u=s.after(s.depth),d=l.create({flexGrow:1},a.create()),f=i.tr.insert(u,d),p=f.doc.resolve(u+2),h=q.near(p);return n.dispatch(f.setSelection(h).scrollIntoView()),n.focus(),!0}function D3(n){const e=n==null?void 0:n.handleWidth,t=n==null?void 0:n.minColumnFlex;return new ce({key:Yn,state:{init:()=>new M3(-1,null),apply:(o,r)=>r.apply(o)},props:{attributes:o=>{const r=Yn.getState(o);return r&&r.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,r)=>A3(o,r,e),mouseleave:o=>O3(o),mousedown:(o,r)=>$3(o,r,t),mouseup:(o,r)=>R3(o,r)},decorations:o=>{const r=Yn.getState(o);return!r||r.activeHandle===-1?null:B3(o,r.activeHandle)}}})}const pE=ye.create({name:"multiColumn",addProseMirrorPlugins(){return[D3({handleWidth:2,minColumnFlex:.5}),E3]},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 d=0;d<n;d++)a.push(i.create({flexGrow:1},l.create()));const u=s.create(null,a);if(t){const d=e.selection.from;e.replaceSelectionWith(u);const f=e.doc.resolve(d),p=q.near(f);e.setSelection(p).scrollIntoView()}return!0}}}});/**
233
- * Copyright 2026 Yiitap
234
- * @license MIT
235
- **/const Ys="selection-decoration",fc={BLUR:"blur",FOCUS:"focus"},hE=ye.create({name:Ys,addProseMirrorPlugins(){return[new ce({key:new le(Ys),state:{init(n){return xe.empty},apply:(n,e)=>{const{selection:t,doc:o}=n,r=n.getMeta(Ys),i=t&&t.from!==t.to;if(!i||(r==null?void 0:r.action)===fc.FOCUS)return xe.empty;if(i&&(r==null?void 0:r.action)===fc.BLUR){const s=ze.inline(t.from,t.to,{class:"selection-decoration-blur"});return xe.create(o,[s])}return e}},props:{decorations(n){return this.getState(n)},handleDOMEvents:{blur:n=>{const{tr:e}=n.state,t=e.setMeta(Ys,{from:e.selection.from,to:e.selection.to,action:fc.BLUR});n.dispatch(t)},focus:n=>{const{tr:e}=n.state,t=e.setMeta(Ys,{from:e.selection.from,to:e.selection.to,action:fc.FOCUS});n.dispatch(t)}}}})]}});/**
236
- * Copyright 2026 Yiitap
237
- * @license MIT
238
- **/const _3=n=>n?n.split(/\r?\n/).filter(e=>e.trim().length>0).length>1:!1,I3=(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 u=a.trim();if(u.startsWith("```")){i=!i,r++;continue}if(i){r++;continue}o.some(d=>d.test(u))&&r++}const s=r/t.length,l=(n.match(/[*_`#>[\]]/g)||[]).length/n.length;return console.log("isMarkdown: ",s,l),s>=e||l>.05},Ck=(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
- `)},mE=["Mathematics","starterKit"],Sk=(n,e)=>{const t=Array.isArray(n)?{type:"doc",content:n}:n,o=e.extensionManager.extensions.filter(r=>!mE.includes(r.name));return Cx(t,o)},L3=(n,e)=>{const t=e.extensionManager.extensions,o=[...mE,"doc"],r=t.filter(i=>!o.includes(i.name));return r.push(oh),Jm(n,r)},gE=ye.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 d=o.node,f=o.to,p=d.type.create(d.attrs,d.content,d.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:d,to:f}=o,p=e.doc.slice(d,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 u=a.type.create(a.attrs,a.content,a.marks);if(t){const d=l+a.nodeSize;let f=e.tr.insert(d,u);const p=d+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=Sk(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((h=this.options.markdown)!=null&&h.enabled){const w=Ck(g,this.editor)||"";b["text/plain"]=new Blob([w],{type:"text/plain"})}const v=new ClipboardItem(b);navigator.clipboard.write([v])}catch(g){console.error("Clipboard write failed.",g)}return n.delete&&o&&(e.deleteRange(s,l),o(e.scrollIntoView())),!0}let a=i.depth,u=a;for(;a>0;a--)if(i.node(a).isBlock){u=a;break}const d=i.node(u);if(!d)return!1;const f=i.before(u),p=f+d.nodeSize;try{const g=d.toJSON(),y=Sk(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((m=this.options.markdown)!=null&&m.enabled){const w=Ck(g,this.editor)||"";b["text/plain"]=new Blob([w],{type:"text/plain"})}const v=new ClipboardItem(b);navigator.clipboard.write([v])}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:u}=s,{$from:d}=a,f=d.node(-1);let p=-1,h=-1;if(this.options.selectableNodes.includes(f==null?void 0:f.type.name))p=d.start(-1)+1,h=d.end(-1)-1;else if((f==null?void 0:f.type.name)==="doc"){let m=d.depth,g=null,y=0;for(;m>0;){const b=d.node(m);if(b.isBlock){g=b,y=d.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(u.doc,p,h);return u.setSelection(y),l.dispatch(u),!0}}return!1},n},addProseMirrorPlugins(){return[new ce({props:{handlePaste:(n,e,t)=>{var d,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 u=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=I.fromJSON(n.state.schema,b)}else{if(_3(i))return!1;{const b=s.tr.insertText(i,l.to);return n.dispatch(b.scrollIntoView()),!0}}const y=new F(g,0,0);if(h&&!u){const b=a.end(),v=n.state.tr.insert(b,g);n.dispatch(v.scrollIntoView())}else{const b=n.state.tr.replaceSelection(y);n.dispatch(b.scrollIntoView())}return!0}catch(h){console.error("Parse html failed.",h)}if((d=this.options.markdown)!=null&&d.enabled&&I3(i))try{const h=(p=((f=this.editor.markdown)==null?void 0:f.parse(i))||{})==null?void 0:p.content,m=I.fromJSON(n.state.schema,h),g=new F(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 Ek(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:h}=u.child(d).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 d=a.nextSibling;a.parentNode.removeChild(a),a=d}l?(t.style.width=`${s}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${s}px`)}let P3=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")),Ek(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,Ek(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}};const yE=lf.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:P3,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||{},u=yS(t.schema,s,l,a);if(i){const d=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[u.toJSON()]}),r.scrollIntoView().setSelection(q.near(r.doc.resolve(d)))}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 Dt(n){this.content=n}Dt.prototype={constructor:Dt,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 Dt(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 Dt(t)},addToStart:function(n,e){return new Dt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Dt(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 Dt(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=Dt.from(n),n.size?new Dt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Dt.from(n),n.size?new Dt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Dt.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}};Dt.from=function(n){if(n instanceof Dt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Dt(e)};function bE(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=bE(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function vE(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 u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=vE(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}let J=class tn{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],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}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 u=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&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},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 tn(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 tn(o,r)}cutByIndex(e,t){return e==t?tn.empty:e==0&&t==this.content.length?this:new tn(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 tn(r,i)}addToStart(e){return new tn([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new tn(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 bE(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return vE(this,e,t,o)}findIndex(e){if(e==0)return pc(0,e);if(e==this.size)return pc(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?pc(t+1,i):pc(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 tn.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new tn(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return tn.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 tn(t||e,o)}static from(e){if(!e)return tn.empty;if(e instanceof tn)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new tn([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};J.empty=new J([],0);const mp={index:0,offset:0};function pc(n,e){return mp.index=n,mp.offset=e,mp}function Zu(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(!Zu(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Zu(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let tt=class Vh{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&&Zu(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 Vh.none;if(e instanceof Vh)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};tt.none=[];let ed=class extends Error{},se=class rs{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=wE(this.content,e+this.openStart,t);return o&&new rs(o,this.openStart,this.openEnd)}removeBetween(e,t){return new rs(kE(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 rs.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 rs(J.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 rs(e,o,r)}};se.empty=new se(J.empty,0,0);function kE(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(kE(i.content,e-r-1,t-r-1)))}function wE(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=wE(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function V3(n,e,t){if(t.openStart>n.depth)throw new ed("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ed("Inconsistent open depths");return xE(n,e,t,0)}function xE(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=xE(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 hi(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=z3(t,n);return hi(i,SE(n,s,l,e,o))}else return hi(i,td(n,e,o))}function CE(n,e){if(!e.type.compatibleContent(n.type))throw new ed("Cannot join "+e.type.name+" onto "+n.type.name)}function zh(n,e,t){let o=n.node(t);return CE(o,e.node(t)),o}function pi(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 Ol(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&&(pi(n.nodeAfter,o),i++));for(let l=i;l<s;l++)pi(r.child(l),o);e&&e.depth==t&&e.textOffset&&pi(e.nodeBefore,o)}function hi(n,e){return n.type.checkContent(e),n.copy(e)}function SE(n,e,t,o,r){let i=n.depth>r&&zh(n,e,r+1),s=o.depth>r&&zh(t,o,r+1),l=[];return Ol(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(CE(i,s),pi(hi(i,SE(n,e,t,o,r+1)),l)):(i&&pi(hi(i,td(n,e,r+1)),l),Ol(e,t,r,l),s&&pi(hi(s,td(t,o,r+1)),l)),Ol(o,null,r,l),new J(l)}function td(n,e,t){let o=[];if(Ol(null,n,t,o),n.depth>t){let r=zh(n,e,t+1);pi(hi(r,td(n,e,t+1)),o)}return Ol(e,null,t,o),new J(o)}function z3(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(J.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}let Mk=class Hh{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 tt.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 nd(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),u=i-a;if(o.push(s,l,r+a),!u||(s=s.child(l),s.isText))break;i=u-1,r+=a+1}return new Hh(t,o,i)}static resolveCached(e,t){let o=Tk.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 Tk.set(e,o=new H3);let r=o.elts[o.i]=Hh.resolve(e,t);return o.i=(o.i+1)%F3,r}},H3=class{constructor(){this.elts=[],this.i=0}};const F3=12,Tk=new WeakMap;let nd=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 j3=Object.create(null);let mi=class Fh{constructor(e,t,o,r=tt.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||J.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&&Zu(this.attrs,t||e.defaultAttrs||j3)&&tt.sameSet(this.marks,o||tt.none)}copy(e=null){return e==this.content?this:new Fh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Fh(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 se.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 se(a,r.depth-s,i.depth-s)}replace(e,t,o){return V3(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 Mk.resolveCached(this,e)}resolveNoCache(e){return Mk.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()+")"),EE(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=J.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=tt.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(!tt.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=J.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};mi.prototype.text=void 0;let U3=class jh extends mi{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):EE(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 jh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new jh(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 EE(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}let aa=class ME{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new W3(e,t);if(o.next==null)return ME.empty;let r=TE(o);o.next&&o.err("Unexpected trailing text");let i=Q3(Y3(r));return Z3(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 J.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(d));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
- `)}};aa.empty=new aa(!0);let W3=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 TE(n){let e=[];do e.push(q3(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function q3(n){let e=[];do e.push(K3(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function K3(n){let e=X3(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=J3(n,e);else break;return e}function Nk(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function J3(n,e){let t=Nk(n),o=t;return n.eat(",")&&(n.next!="}"?o=Nk(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function G3(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 X3(n){if(n.eat("(")){let e=TE(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=G3(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 Y3(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=i(s.exprs[a],l);if(a==s.exprs.length-1)return u;r(u,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 u=0;u<s.min;u++){let d=t();r(i(s.expr,a),d),a=d}if(s.max==-1)r(i(s.expr,a),a);else for(let u=s.min;u<s.max;u++){let d=t();o(a,d),r(i(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function NE(n,e){return e-n}function Ak(n,e){let t=[];return o(e),t.sort(NE);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 Q3(n){let e=Object.create(null);return t(Ak(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);Ak(n,a).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new aa(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(NE);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function Z3(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:u}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function AE(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 OE(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 $E(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 BE(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new tU(n,o,e[o]);return t}let Ok=class RE{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=BE(e,o.attrs),this.defaultAttrs=AE(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==aa.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:OE(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new mi(this,this.computeAttrs(e),J.from(t),tt.setFrom(o))}createChecked(e=null,t,o){return t=J.from(t),this.checkContent(t),new mi(this,this.computeAttrs(e),t,tt.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=J.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(J.empty,!0);return i?new mi(this,e,t.append(i),tt.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){$E(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:tt.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new RE(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 eU(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 tU=class{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?eU(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}},DE=class _E{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=BE(e,r.attrs),this.excluded=null;let i=AE(this.attrs);this.instance=i?new tt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new tt(this,OE(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new _E(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){$E(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},nU=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=Dt.from(e.nodes),t.marks=Dt.from(e.marks||{}),this.nodes=Ok.compile(this.spec.nodes,this),this.marks=DE.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]=aa.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?$k(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==""?[]:$k(this,s.split(" "))}this.nodeFromJSON=r=>mi.fromJSON(this,r),this.markFromJSON=r=>tt.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 Ok){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 U3(o,o.defaultAttrs,e,tt.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 $k(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 oU(n){return n.tag!=null}function rU(n){return n.style!=null}let gp=class Uh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(oU(r))this.tags.push(r);else if(rU(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 Rk(this,t,!1);return o.addAll(e,tt.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Rk(this,t,!0);return o.addAll(e,tt.none,t.from,t.to),se.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(lU(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=Dk(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=Dk(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Uh(e,Uh.schemaRules(e)))}};const IE={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},iU={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},LE={ol:!0,ul:!0},ca=1,Wh=2,$l=4;function Bk(n,e,t){return e!=null?(e?ca:0)|(e==="full"?Wh:0):n&&n.whitespace=="pre"?ca|Wh:t&~$l}class hc{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=tt.none,this.match=i||(s&$l?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(J.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&ca)){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=J.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(J.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&&!IE.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}let Rk=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=Bk(null,t.preserveWhitespace,0)|(o?$l:0);r?i=new hc(r.type,r.attrs,tt.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new hc(null,null,tt.none,!0,null,s):i=new hc(e.schema.topNodeType,null,tt.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&Wh?"full":this.localPreserveWS||(r.options&ca)>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;LE.hasOwnProperty(s)&&this.parser.normalizeLists&&sU(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:iU.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 u,d=this.needsBlock;if(IE.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!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),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,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(u=>!a.clearMark(u)):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],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.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=tt.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):_k(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=Bk(e,i,s.options);s.options&$l&&s.content.length==0&&(l|=$l);let a=tt.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):_k(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new hc(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|=ca)}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 u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))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 sU(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&LE.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function lU(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Dk(n){let e={};for(let t in n)e[t]=n[t];return e}function _k(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:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}const PE=65535,VE=Math.pow(2,16);function aU(n,e){return n+e*VE}function Ik(n){return n&PE}function cU(n){return(n-(n&PE))/VE}const zE=1,HE=2,Pc=4,FE=8;let qh=class{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&FE)>0}get deletedBefore(){return(this.delInfo&(zE|Pc))>0}get deletedAfter(){return(this.delInfo&(HE|Pc))>0}get deletedAcross(){return(this.delInfo&Pc)>0}},$i=class is{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&is.empty)return is.empty}recover(e){let t=0,o=Ik(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+cU(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 u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:aU(l/3,e-a),g=e==a?HE:e==f?zE:Pc;return(t<0?e!=a:e!=f)&&(g|=FE),new qh(h,g,m)}r+=d-u}return o?e+r:new qh(e+r,0,null)}touches(e,t){let o=0,r=Ik(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 u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}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),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new is(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?is.empty:new is(e<0?[0,-e,0]:[0,0,e])}};$i.empty=new $i([]);let uU=class Kh{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 Kh(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 Kh;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 qh(e,r,null)}};const yp=Object.create(null);let Qt=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=yp[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 yp)throw new RangeError("Duplicate use of step JSON ID "+e);return yp[e]=t,t.prototype.jsonID=e,t}},rn=class il{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new il(e,null)}static fail(e){return new il(null,e)}static fromReplace(e,t,o,r){try{return il.ok(e.replace(t,o,r))}catch(i){if(i instanceof ed)return il.fail(i.message);throw i}}};function ly(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(ly(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return J.fromArray(o)}let ay=class sl extends Qt{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 se(ly(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 Fs(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 sl(t.pos,o.pos,this.mark)}merge(e){return e instanceof sl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sl(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 sl(t.from,t.to,e.markFromJSON(t.mark))}};Qt.jsonID("addMark",ay);let Fs=class ll extends Qt{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 se(ly(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 ay(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 ll(t.pos,o.pos,this.mark)}merge(e){return e instanceof ll&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ll(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 ll(t.from,t.to,e.markFromJSON(t.mark))}};Qt.jsonID("removeMark",Fs);let cy=class al extends Qt{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 se(J.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 al(this.pos,t.marks[r]);return new al(this.pos,this.mark)}}return new od(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new al(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 al(t.pos,e.markFromJSON(t.mark))}};Qt.jsonID("addNodeMark",cy);let od=class Jh extends Qt{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 se(J.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new cy(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Jh(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 Jh(t.pos,e.markFromJSON(t.mark))}};Qt.jsonID("removeNodeMark",od);class Ct extends Qt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Gh(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 Ct(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 Ct(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ct)||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?se.empty:new se(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ct(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?se.empty:new se(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ct(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 Ct(t.from,t.to,se.fromJSON(e,t.slice),!!t.structure)}}Qt.jsonID("replace",Ct);let hn=class Vc extends Qt{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&&(Gh(e,this.from,this.gapFrom)||Gh(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 Vc(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 Vc(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 Vc(t.from,t.to,t.gapFrom,t.gapTo,se.fromJSON(e,t.slice),t.insert,!!t.structure)}};Qt.jsonID("replaceAround",hn);function Gh(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 dU(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+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 Fs(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new ay(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function fU(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 DE){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],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=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new Fs(s.from,s.to,s.style)))}function uy(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 u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new Ct(l,d,se.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new Fs(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new se(J.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new Ct(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(J.empty,!0);n.replace(l,l,new se(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function pU(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function js(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||!pU(i,s,l))break;s&&(o=1),l<i.childCount&&(r=1)}return null}function hU(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=J.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=J.from(o.node(m).copy(d)),f++):a--;let p=J.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=J.from(r.node(m).copy(p)),h++):u++;n.step(new hn(a,u,s,l,new se(d.append(p),f,h),d.size-f,!0))}function dy(n,e,t=null,o=n){let r=mU(n,e),i=r&&gU(o,e);return i?r.map(Lk).concat({type:e,attrs:t}).concat(i.map(Lk)):null}function Lk(n){return{type:n,attrs:null}}function mU(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 gU(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 yU(n,e,t){let o=J.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=J.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new hn(r,i,r,i,new se(o,0,0),t.length,!0))}function bU(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)&&vU(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&UE(n,s,l,i),uy(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new hn(f,p,f+1,p-1,new se(J.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&jE(n,s,l,i),!1}})}function jE(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 UE(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 vU(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function kU(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 hn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new se(J.from(s),0,0),1,!0))}function Qo(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 u=r.depth-1,d=t-2;u>i;u--,d--){let f=r.node(u),p=r.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||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 wU(n,e,t=1,o){let r=n.doc.resolve(e),i=J.empty,s=J.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=J.from(r.node(l).copy(i));let d=o&&o[u];s=J.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new Ct(e,e,new se(i.append(s),t,t),!0))}function Kr(n,e){let t=n.resolve(e),o=t.index();return WE(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function xU(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 WE(n,e){return!!(n&&e&&!n.isLeaf&&xU(n,e))}function gf(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&&WE(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 CU(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 d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);UE(n,d.node(),d.before(),l)}s.inlineContent&&uy(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new Ct(u,a.map(e+t,-1),se.empty,!0)),o===!0){let d=n.doc.resolve(u);jE(n,d.node(),d.before(),n.steps.length)}return n}function SU(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 yf(n,e,t=e,o=se.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return qE(r,i,o)?new Ct(e,t,o):new EU(r,i,o).fit()}function qE(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let EU=class{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=J.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=J.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):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 se(i,s,l);return e>-1?new hn(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new Ct(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=bp(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:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(J.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=bp(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new se(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=bp(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new se(cl(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new se(cl(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,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(KE(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=ul(this.placed,t,J.from(d)),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?se.empty:new se(cl(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new se(cl(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!vp(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=vp(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=vp(e,l,u,a,!0);if(!d||d.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=ul(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=ul(this.placed,this.depth,J.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(J.empty,!0);e.childCount&&(this.placed=ul(this.placed,this.frontier.length,e))}};function cl(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(cl(n.firstChild.content,e-1,t)))}function ul(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ul(n.lastChild.content,e-1,t)))}function bp(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function KE(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,KE(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(J.empty,!0)))),n.copy(o)}function vp(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&&!MU(t,i.content,s)?l:null}function MU(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function TU(n){return n.spec.defining||n.spec.definingForContent}function NU(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(qE(r,i,o))return n.step(new Ct(e,t,o));let s=GE(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),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=TU(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[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 v=r.node(y-1),w=r.index(y-1);if(v.canReplaceWith(w,w,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new se(JE(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 JE(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(JE(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(J.empty,!0))}return n}function AU(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=SU(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new se(J.from(o),0,0))}function OU(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=GE(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 GE(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 XE=class zc extends Qt{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 se(J.from(r),0,t.isLeaf?0:1))}getMap(){return $i.empty}invert(e){return new zc(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 zc(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 zc(t.pos,t.attr,t.value)}};Qt.jsonID("attr",XE);let YE=class Xh extends Qt{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 Xh(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 Xh(t.attr,t.value)}};Qt.jsonID("docAttr",YE);let Ds=class extends Error{};Ds=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ds.prototype=Object.create(Error.prototype);Ds.prototype.constructor=Ds;Ds.prototype.name="TransformError";let $U=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new uU}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ds(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=se.empty){let r=yf(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new se(J.from(o),0,0))}delete(e,t){return this.replace(e,t,se.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return NU(this,e,t,o),this}replaceRangeWith(e,t,o){return AU(this,e,t,o),this}deleteRange(e,t){return OU(this,e,t),this}lift(e,t){return hU(this,e,t),this}join(e,t=1){return CU(this,e,t),this}wrap(e,t){return yU(this,e,t),this}setBlockType(e,t=e,o,r=null){return bU(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return kU(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new XE(e,t,o)),this}setDocAttribute(e,t){return this.step(new YE(e,t)),this}addNodeMark(e,t){return this.step(new cy(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 tt)t.isInSet(o.marks)&&this.step(new od(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new od(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 wU(this,e,t,o),this}addMark(e,t,o){return dU(this,e,t,o),this}removeMark(e,t,o){return fU(this,e,t,o),this}clearIncompatible(e,t,o){return uy(this,e,t,o),this}};const kp=Object.create(null);let lt=class{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new BU(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=se.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:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?se.empty:t),l==0&&zk(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),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),zk(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new or(e):ss(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?ss(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):ss(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 gi(e.node(0))}static atStart(e){return ss(e,e,0,0,1)||new gi(e)}static atEnd(e){return ss(e,e,e.content.size,e.childCount,-1)||new gi(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=kp[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 kp)throw new RangeError("Duplicate use of selection JSON ID "+e);return kp[e]=t,t.prototype.jsonID=e,t}getBookmark(){return or.between(this.$anchor,this.$head).getBookmark()}};lt.prototype.visible=!0;let BU=class{constructor(e,t){this.$from=e,this.$to=t}},Pk=!1;function Vk(n){!Pk&&!n.parent.inlineContent&&(Pk=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}let or=class dl extends lt{constructor(e,t=e){Vk(e),Vk(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 dl(r.parent.inlineContent?r:o,o)}replace(e,t=se.empty){if(super.replace(e,t),t==se.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof dl&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new QE(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 dl(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 dl(e,t)}};lt.jsonID("text",or);let QE=class ZE{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ZE(e.map(this.anchor),e.map(this.head))}resolve(e){return or.between(e.resolve(this.anchor),e.resolve(this.head))}};class nt 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 nt(i)}content(){return new se(J.from(this.node),0,0)}eq(e){return e instanceof nt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new RU(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new nt(e.resolve(t.anchor))}static create(e,t){return new nt(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}nt.prototype.visible=!1;lt.jsonID("node",nt);let RU=class eM{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new QE(o,o):new eM(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&nt.isSelectable(o)?new nt(t):lt.near(t)}},gi=class Hc extends lt{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=se.empty){if(t==se.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 Hc(e)}map(e){return new Hc(e)}eq(e){return e instanceof Hc}getBookmark(){return DU}};lt.jsonID("all",gi);const DU={map(){return this},resolve(n){return new gi(n)}};function ss(n,e,t,o,r,i=!1){if(e.inlineContent)return or.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&&nt.isSelectable(l))return nt.create(n,t-(r<0?l.nodeSize:0))}else{let a=ss(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function zk(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof Ct||r instanceof hn))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(lt.near(n.doc.resolve(s),t))}function Hk(n,e){return!e||!n?n:n.bind(e)}let mc=class{constructor(e,t,o){this.name=e,this.init=Hk(t.init,o),this.apply=Hk(t.apply,o)}};new mc("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new mc("selection",{init(n,e){return n.selection||lt.atStart(e.doc)},apply(n){return n.selection}}),new mc("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new mc("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});const fy=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function tM(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const nM=(n,e,t)=>{let o=tM(n,t);if(!o)return!1;let r=py(o);if(!r){let s=o.blockRange(),l=s&&js(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(dM(n,r,e,-1))return!0;if(o.parent.content.size==0&&(_s(i,"end")||nt.isSelectable(i)))for(let s=o.depth;;s--){let l=yf(n.doc,o.before(s),o.after(s),se.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(_s(i,"end")?lt.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):nt.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},_U=(n,e,t)=>{let o=tM(n,t);if(!o)return!1;let r=py(o);return r?oM(n,r,e):!1},IU=(n,e,t)=>{let o=iM(n,t);if(!o)return!1;let r=hy(o);return r?oM(n,r,e):!1};function oM(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 d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=yf(n.doc,i,a,se.empty);if(!u||u.from!=i||u instanceof Ct&&u.slice.size>=a-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(or.create(d.doc,i)),t(d.scrollIntoView())}return!0}function _s(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 rM=(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=py(o)}let s=i&&i.nodeBefore;return!s||!nt.isSelectable(s)?!1:(e&&e(n.tr.setSelection(nt.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function py(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 iM(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const sM=(n,e,t)=>{let o=iM(n,t);if(!o)return!1;let r=hy(o);if(!r)return!1;let i=r.nodeAfter;if(dM(n,r,e,1))return!0;if(o.parent.content.size==0&&(_s(i,"start")||nt.isSelectable(i))){let s=yf(n.doc,o.before(),o.after(),se.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(_s(i,"start")?lt.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):nt.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},lM=(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=hy(o)}let s=i&&i.nodeAfter;return!s||!nt.isSelectable(s)?!1:(e&&e(n.tr.setSelection(nt.create(n.doc,i.pos)).scrollIntoView()),!0)};function hy(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 nt,r;if(o){if(t.node.isTextblock||!Kr(n.doc,t.from))return!1;r=t.from}else if(r=gf(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(nt.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},PU=(n,e)=>{let t=n.selection,o;if(t instanceof nt){if(t.node.isTextblock||!Kr(n.doc,t.to))return!1;o=t.to}else if(o=gf(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},VU=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&js(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},aM=(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 my(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 zU=(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=my(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},cM=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof gi||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=my(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(or.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},uM=(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(Qo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&js(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function HU(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof nt&&e.selection.node.isBlock)return!o.parentOffset||!Qo(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,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=my(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 d=e.tr;(e.selection instanceof or||e.selection instanceof gi)&&d.deleteSelection();let f=d.mapping.map(o.pos),p=Qo(d.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=Qo(d.doc,f,i.length,i)),!p)return!1;if(d.split(f,i.length,i),!a&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const FU=HU(),jU=(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(nt.create(n.doc,r))),!0)};function UU(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||Kr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function dM(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&UU(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(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=J.empty;for(let b=s.length-1;b>=0;b--)m=J.from(s[b].create(null,m));m=J.from(r.copy(m));let g=n.tr.step(new hn(e.pos-1,h,e.pos,h,new se(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&Kr(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&a?null:lt.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),p=f&&js(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(u&&_s(i,"start",!0)&&_s(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=J.empty;for(let w=m.length-1;w>=0;w--)b=J.from(m[w].copy(b));let v=n.tr.step(new hn(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new se(b,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function fM(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(or.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const WU=fM(-1),qU=fM(1);function KU(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&dy(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Fk(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,u)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let d=t.doc.resolve(u),f=d.index();r=d.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 gy(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}gy(fy,nM,rM);gy(fy,sM,lM);gy(aM,cM,uM,FU);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function JU(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 GU(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function GU(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 nd(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new nd(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=dy(i,t,o,e);return l?(n&&XU(n,e,l,r,t),!0):!1}function XU(n,e,t,o,r){let i=J.empty;for(let d=t.length-1;d>=0;d--)i=J.from(t[d].type.create(t[d].attrs,i));n.step(new hn(e.start-(o?2:0),e.end,e.start,e.end,new se(i,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==r&&(s=d+1);let l=t.length-s,a=e.start+t.length-(o?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,p=!0;d<f;d++,p=!1)!p&&Qo(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}function YU(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?QU(e,t,n,i):ZU(e,t,i):!0:!1}}function QU(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new hn(i-1,s,i,s,new se(J.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new nd(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=js(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return Kr(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function ZU(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,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(a?J.empty:J.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new hn(f-(l?1:0),p+(a?1:0),f+1,p-1,new se((l?J.empty:J.from(r.copy(J.empty))).append(a?J.empty:J.from(r.copy(J.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function eW(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.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 u=a.lastChild&&a.lastChild.type==l.type,d=J.from(u?n.create():null),f=new se(J.from(n.create(null,J.from(l.type.create(null,d)))),u?3:1,0),p=i.start,h=i.end;t(e.tr.step(new hn(p-(u?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}var tW=Object.defineProperty,yy=(n,e)=>{for(var t in e)tW(n,t,{get:e[t],enumerable:!0})};function pM(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 nW=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,(...u)=>{const d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}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,u=e||i.tr,d=()=>(!a&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),l.every(p=>p===!0)),f={...Object.fromEntries(Object.entries(o).map(([p,h])=>[p,(...m)=>{const g=this.buildProps(u,t),y=h(...m)(g);return l.push(y),f}])),run:d};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,(...u)=>a(...u)({...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:pM({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,u])=>[a,(...d)=>u(...d)(l)]))}};return l}},hM={};yy(hM,{blur:()=>oW,clearContent:()=>rW,clearNodes:()=>iW,command:()=>sW,createParagraphNear:()=>lW,cut:()=>aW,deleteCurrentNode:()=>cW,deleteNode:()=>uW,deleteRange:()=>dW,deleteSelection:()=>fW,enter:()=>pW,exitCode:()=>hW,extendMarkRange:()=>gW,first:()=>yW,focus:()=>kW,forEach:()=>wW,insertContent:()=>xW,insertContentAt:()=>EW,joinBackward:()=>NW,joinDown:()=>TW,joinForward:()=>AW,joinItemBackward:()=>OW,joinItemForward:()=>$W,joinTextblockBackward:()=>BW,joinTextblockForward:()=>RW,joinUp:()=>MW,keyboardShortcut:()=>_W,lift:()=>IW,liftEmptyBlock:()=>LW,liftListItem:()=>PW,newlineInCode:()=>VW,resetAttributes:()=>zW,scrollIntoView:()=>HW,selectAll:()=>FW,selectNodeBackward:()=>jW,selectNodeForward:()=>UW,selectParentNode:()=>WW,selectTextblockEnd:()=>qW,selectTextblockStart:()=>KW,setContent:()=>GW,setMark:()=>f4,setMeta:()=>p4,setNode:()=>h4,setNodeSelection:()=>m4,setTextDirection:()=>g4,setTextSelection:()=>y4,sinkListItem:()=>b4,splitBlock:()=>v4,splitListItem:()=>k4,toggleList:()=>w4,toggleMark:()=>x4,toggleNode:()=>C4,toggleWrap:()=>S4,undoInputRule:()=>E4,unsetAllMarks:()=>M4,unsetMark:()=>T4,unsetTextDirection:()=>N4,updateAttributes:()=>A4,wrapIn:()=>O4,wrapInList:()=>$4});var oW=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),rW=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),iW=()=>({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:u,mapping:d}=e,f=u.resolve(d.map(a)),p=u.resolve(d.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=js(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},sW=n=>e=>n(e),lW=()=>({state:n,dispatch:e})=>cM(n,e),aW=(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},cW=()=>({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 Tt(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 uW=n=>({tr:e,state:t,dispatch:o})=>{const r=Tt(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},dW=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},fW=()=>({state:n,dispatch:e})=>fy(n,e),pW=()=>({commands:n})=>n.keyboardShortcut("Enter"),hW=()=>({state:n,dispatch:e})=>zU(n,e);function mW(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function rd(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:mW(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function mM(n,e,t={}){return n.find(o=>o.type===e&&rd(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function jk(n,e,t={}){return!!mM(n,e,t)}function gM(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),!mM([...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&&jk([...n.parent.child(i-1).marks],e,t);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&jk([...n.parent.child(l).marks],e,t);)a+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function Jr(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 gW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=Jr(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:u,to:d}=l;if(r){const f=gM(a,i,e);if(f&&f.from<=u&&f.to>=d){const p=q.create(s,f.from,f.to);t.setSelection(p)}}return!0},yW=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 yM(n){return n instanceof q}function ri(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function bW(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 Uk(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function id(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function vW(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var kW=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(id()||Uk())&&o.dom.focus(),vW()&&!id()&&!Uk()&&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&&!yM(t.state.selection))return s(),!0;const l=bW(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},wW=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),xW=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),bM=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&&bM(o)}return n};function gc(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 bM(t)}function ua(n,e,t){if(n instanceof mi||n instanceof J)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 J.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),ua("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new nU({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:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?gp.fromSchema(a).parseSlice(gc(n),t.parseOptions):gp.fromSchema(a).parse(gc(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=gp.fromSchema(e);return t.slice?i.parseSlice(gc(n),t.parseOptions).content:i.parse(gc(n),t.parseOptions)}return ua("",e,t)}function CW(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof Ct||r instanceof hn))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,u,d)=>{s===0&&(s=d)}),n.setSelection(ie.near(n.doc.resolve(s),t))}var SW=n=>!("type"in n),EW=(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)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ua(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=ua(e,i.schema,{parseOptions:u,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return a(g),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((SW(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),d===f&&h){const{parent:g}=o.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,f+=1)}let m;if(p){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof J){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,d,f)}else{m=l;const g=o.doc.resolve(d),y=g.node(),b=g.parentOffset===0,v=y.isText||y.isTextblock,w=y.content.size>0;b&&v&&w&&(d=Math.max(0,d-1)),o.replaceWith(d,f,m)}t.updateSelection&&CW(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:m})}return!0},MW=()=>({state:n,dispatch:e})=>LU(n,e),TW=()=>({state:n,dispatch:e})=>PU(n,e),NW=()=>({state:n,dispatch:e})=>nM(n,e),AW=()=>({state:n,dispatch:e})=>sM(n,e),OW=()=>({state:n,dispatch:e,tr:t})=>{try{const o=gf(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,tr:t})=>{try{const o=gf(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},BW=()=>({state:n,dispatch:e})=>_U(n,e),RW=()=>({state:n,dispatch:e})=>IU(n,e);function vM(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function DW(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))id()||vM()?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 _W=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=DW(n).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),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",u=>u(t,l))});return a==null||a.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function Is(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?Tt(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(d,f)=>{if(d.isText)return;const p=Math.max(o,f),h=Math.min(r,f+d.nodeSize);l.push({node:d,from:p,to:h})});const a=r-o,u=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>rd(d.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=a}var IW=(n,e={})=>({state:t,dispatch:o})=>{const r=Tt(n,t.schema);return Is(t,r,e)?VU(t,o):!1},LW=()=>({state:n,dispatch:e})=>uM(n,e),PW=n=>({state:e,dispatch:t})=>{const o=Tt(n,e.schema);return YU(o)(e,t)},VW=()=>({state:n,dispatch:e})=>aM(n,e);function kM(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Wk(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 zW=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=kM(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=Tt(n,o.schema)),l==="mark"&&(s=Jr(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{o.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,Wk(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+d.nodeSize,s.create(Wk(p.attrs,e))))})})}),a},HW=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),FW=()=>({tr:n,dispatch:e})=>{if(e){const t=new sn(n.doc);n.setSelection(t)}return!0},jW=()=>({state:n,dispatch:e})=>rM(n,e),UW=()=>({state:n,dispatch:e})=>lM(n,e),WW=()=>({state:n,dispatch:e})=>jU(n,e),qW=()=>({state:n,dispatch:e})=>qU(n,e),KW=()=>({state:n,dispatch:e})=>WU(n,e);function JW(n,e,t={},o={}){return ua(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var GW=(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 u=JW(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,u).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 XW(n,e){const t=Jr(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 YW(n,e){const t=new $U(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function QW(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 ZW(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 bf(n){return e=>ZW(e.$from,n)}function da(n,e,t){return n.config[e]===void 0&&n.parent?da(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?da(n.parent,e,t):null}):n.config[e]}function e4(n){return typeof n=="function"}function sd(n,e=void 0,...t){return e4(n)?e?n.bind(e)(...t):n(...t):n}function wM(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 Bi(...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(u=>!l.includes(u));o[r]=[...l,...a].join(" ")}else if(r==="style"){const s=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],a=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());a.set(d,f)}),s.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());a.set(d,f)}),o[r]=Array.from(a.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else o[r]=i}),o},{})}function t4(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)=>Bi(t,o),{})}function n4(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
252
-
253
- `,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,u,d,f)=>{var p;a.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,u)-u,r-u))}),l}function o4(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function r4(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 i4(n){const e=r4(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 s4(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 u=e.slice(i).map(l,-1),d=e.slice(i).map(a),f=e.invert().map(u,-1),p=e.invert().map(d);o.push({oldRange:{from:f,to:p},newRange:{from:u,to:d}})})}),i4(o)}var l4=(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 Fc(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 a4(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?Jr(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>rd(d.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:d,$to:f})=>{const p=d.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),v=b-y;s+=v,l.push(...m.marks.map(w=>({mark:w,from:y,to:b})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>rd(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+u:a)>=s}var c4=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=bf(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)},u4=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function qk(n,e){const{nodeExtensions:t}=wM(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=sd(da(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function xM(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&&(xM(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function d4(n,e,t){var o;const{selection:r}=e;let i=null;if(yM(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 u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,p)=>{if(u)return!1;if(d.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=h&&m}return!u}),u})}var f4=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=Jr(n,o.schema);if(r)if(s){const u=XW(o,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;o.doc.nodesBetween(d,f,(p,h)=>{const m=Math.max(h,d),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 d4(o,t,a)},p4=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),h4=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=Tt(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})=>Fk(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Fk(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},m4=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},g4=(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,u)=>{a.isText||t.setNodeMarkup(u,void 0,{...a.attrs,dir:n})}),!0},y4=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),u=ri(i,s,l),d=q.create(o,a,u);e.setSelection(d)}return!0},b4=n=>({state:e,dispatch:t})=>{const o=Tt(n,e.schema);return eW(o)(e,t)};function Kk(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 v4=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,u=r.extensionManager.attributes,d=Fc(u,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!Qo(s,l.pos)?!1:(o&&(n&&Kk(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:QW(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=Qo(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Qo(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]: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&&Kk(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},k4=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=Tt(n,o.schema),{$from:a,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))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=J.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-v;M>=a.depth-3;M-=1)b=J.from(a.node(M).copy(b));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...Fc(p,a.node().type.name,a.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;b=b.append(J.from(l.createAndFill(null,x)||void 0));const C=a.before(a.depth-(v-1));t.replace(C,a.after(-w),new se(b,4-v,0));let S=-1;t.doc.nodesBetween(C,t.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&t.setSelection(q.near(t.doc.resolve(S))),t.scrollIntoView()}return!0}const h=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...Fc(p,f.type.name,f.attrs),...e},g={...Fc(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Qo(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,k=v||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!k||!r)return!0;const x=k.filter(C=>w.includes(C.type.name));t.ensureMarks(x)}return!0},wp=(n,e)=>{const t=bf(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)&&Kr(n.doc,t.pos)&&n.join(t.pos),!0},xp=(n,e)=>{const t=bf(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)&&Kr(n.doc,o)&&n.join(o),!0},w4=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=Tt(n,s.schema),m=Tt(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:v}=g,w=b.blockRange(v),k=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const x=bf(C=>qk(C.type.name,f))(g);if(w.depth>=1&&x&&w.depth-x.depth<=1){if(x.node.type===h)return u.liftListItem(m);if(qk(x.node.type.name,f)&&h.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,h),!0)).command(()=>wp(i,h)).command(()=>xp(i,h)).run()}return!t||!k||!l?a().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>wp(i,h)).command(()=>xp(i,h)).run():a().command(()=>{const C=d().wrapInList(h,o),S=k.filter(M=>p.includes(M.type.name));return i.ensureMarks(S),C?!0:u.clearNodes()}).wrapInList(h,o).command(()=>wp(i,h)).command(()=>xp(i,h)).run()},x4=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=Jr(n,o.schema);return a4(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},C4=(n,e,t={})=>({state:o,commands:r})=>{const i=Tt(n,o.schema),s=Tt(e,o.schema),l=Is(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})},S4=(n,e={})=>({state:t,commands:o})=>{const r=Tt(n,t.schema);return Is(t,r,e)?o.lift(r):o.wrapIn(r,e)},E4=()=>({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},M4=()=>({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},T4=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=Jr(n,o.schema),{$from:u,empty:d,ranges:f}=l;if(!r)return!0;if(d&&s){let{from:p,to:h}=l;const m=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=gM(u,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},N4=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 u={...l.attrs};delete u.dir,e.setNodeMarkup(a,void 0,u)}),!0},A4=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=kM(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=Tt(n,o.schema)),l==="mark"&&(s=Jr(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(d,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(d,f,(y,b)=>{b<d&&i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=d&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,r)){const w=Math.max(b,d),k=Math.min(b+y.nodeSize,f);t.addMark(w,k,s.create({...v.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},O4=(n,e={})=>({state:t,dispatch:o})=>{const r=Tt(n,t.schema);return KU(r,e)(t,o)},$4=(n,e={})=>({state:t,dispatch:o})=>{const r=Tt(n,t.schema);return JU(r,e)(t,o)},B4=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}};function R4(n){return Object.prototype.toString.call(n).slice(8,-1)}function yc(n){return R4(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function CM(n,e){const t={...n};return yc(n)&&yc(e)&&Object.keys(e).forEach(o=>{yc(e[o])&&yc(n[o])?t[o]=CM(n[o],e[o]):t[o]=e[o]}),t}var SM=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{...sd(da(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...sd(da(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>CM(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}},D4={};yy(D4,{ClipboardTextSerializer:()=>_4,Commands:()=>I4,Delete:()=>L4,Drop:()=>P4,Editable:()=>V4,FocusEvents:()=>z4,Keymap:()=>H4,Paste:()=>F4,Tabindex:()=>j4,TextDirection:()=>U4,focusEventsPluginKey:()=>MM});var qn=class EM extends SM{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new EM(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},_4=qn.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=o4(t);return n4(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),I4=qn.create({name:"commands",addCommands(){return{...hM}}}),L4=qn.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,u;if((u=(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?u:n.getMeta("y-sync$"))return;const d=YW(n.before,[n,...e]);s4(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.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:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((p,h)=>{var m,g;if(p instanceof Fs){const y=f.slice(h).map(p.from,-1),b=f.slice(h).map(p.to),v=f.invert().map(y,-1),w=f.invert().map(b),k=(m=d.doc.nodeAt(y-1))==null?void 0:m.marks.some(C=>C.eq(p.mark)),x=(g=d.doc.nodeAt(b))==null?void 0:g.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:w},newRange:{from:y,to:b},partial:!!(x||k),editor:this.editor,transaction:n,combinedTransform:d})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),P4=qn.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})}}})]}}),V4=qn.create({name:"editable",addProseMirrorPlugins(){return[new ce({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),MM=new le("focusEvents"),z4=qn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ce({key:MM,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}}}})]}}),H4=qn.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:u,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?s.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&h.parent.childCount===1?g===d.pos:ie.atStart(a).from===f;return!u||!p.type.isTextblock||p.textContent.length||!y||y&&d.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 id()||vM()?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,u=ie.atEnd(e.doc).to;if(i||!(s===a&&l===u)||!xM(t.doc))return;const d=t.tr,f=pM({state:t,transaction:d}),{commands:p}=new nW({editor:this.editor,state:f});if(p.clearNodes(),!!d.steps.length)return d}})]}}),F4=qn.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})}}})]}}),j4=qn.create({name:"tabindex",addProseMirrorPlugins(){return[new ce({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),U4=qn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=wM(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 fa(n){return new B4({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=sd(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),l=s.doc.resolve(t.from).blockRange(),a=l&&dy(l,n.type,i);if(!a)return null;if(s.wrap(l,a),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(d,i).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Kr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&s.join(t.from-1)},undoable:n.undoable})}var W4={};yy(W4,{createAtomBlockMarkdownSpec:()=>q4,createBlockMarkdownSpec:()=>K4,createInlineMarkdownSpec:()=>X4,parseAttributes:()=>by,parseIndentedBlocks:()=>Yh,renderNestedMarkdownContent:()=>ky,serializeAttributes:()=>vy});function by(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(u=>u.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,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[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 vy(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 q4(n){const{nodeName:e,name:t,parseAttributes:o=by,serializeAttributes:r=vy,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{const p={...i,...d.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.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:d=>{const f=u(d.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function K4(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=by,serializeAttributes:i=vy,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,u=t||e,d=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(`^:::${u}`,"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(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,v=""]=y,w=r(v);let k=1;const x=b.length;let C="";const S=/^:::([\w-]*)(\s.*)?/gm,M=f.slice(x);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const O=N.index,A=N[1];if(!((m=N[2])!=null&&m.endsWith(":::"))){if(A)k+=1;else if(k-=1,k===0){const $=M.slice(0,O);C=$.trim();const D=f.slice(0,x+O+N[0].length);let R=[];if(C)if(l==="block")for(R=h.blockTokens($),R.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=h.inlineTokens(L.text))});R.length>0;){const L=R[R.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))R.pop();else break}else R=h.inlineTokens(C);return{type:e,raw:D,attributes:w,content:C,tokens:R}}}}}},renderMarkdown:(f,p)=>{const h=d(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
254
-
255
- `);return`:::${u}${g}
256
-
257
- ${y}
258
-
259
- :::`}}}function J4(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 G4(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function X4(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=J4,serializeAttributes:i=G4,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=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=u.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="",v="";if(l){const[,k]=y;v=k}else{const[,k,x]=y;v=k,b=x||""}const w=r(v.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},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=d(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${h}[/${u}]`}}}function Yh(n,e,t){var o,r,i,s;const l=n.split(`
260
- `),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const p=l[d],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){d+=1,u=`${u}${p}
261
- `;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;u=`${u}${p}
262
- `;const b=[y];for(d+=1;d<l.length;){const x=l[d];if(x.trim()===""){const C=l.slice(d+1).findIndex(S=>S.trim()!=="");if(C===-1)break;if((((r=(o=l[d+1+C].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(x),u=`${u}${x}
263
- `,d+=1;continue}else break}if((((s=(i=x.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(x),u=`${u}${x}
264
- `,d+=1;else break}let v;const w=b.slice(1);if(w.length>0){const x=w.map(C=>C.slice(g+f)).join(`
265
- `);x.trim()&&(e.customNestedParser?v=e.customNestedParser(x):v=t.blockTokens(x))}const k=e.createToken(m,v);a.push(k)}if(a.length!==0)return{items:a,raw:u}}function ky(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(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
266
- `).map(p=>p?e.indent(p):"").join(`
267
- `);a.push(f)}}),a.join(`
268
- `)}var Va=class TM extends SM{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new TM(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},Y4=Object.defineProperty,Q4=(n,e)=>{for(var t in e)Y4(n,t,{get:e[t],enumerable:!0})},Z4="listItem",Jk="textStyle",Gk=/^\s*([-+*])\s$/,e5=Va.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",Bi(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(Z4,this.editor.getAttributes(Jk)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=fa({find:Gk,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=fa({find:Gk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jk),editor:this.editor})),[n]}}),t5=Va.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Bi(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)=>ky(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)}}}),n5={};Q4(n5,{findListItemPos:()=>za,getNextListDepth:()=>wy,handleBackspace:()=>Qh,handleDelete:()=>Zh,hasListBefore:()=>NM,hasListItemAfter:()=>o5,hasListItemBefore:()=>AM,listItemHasSubList:()=>OM,nextListIsDeeper:()=>$M,nextListIsHigher:()=>BM});var za=(n,e)=>{const{$from:t}=e.selection,o=Tt(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}},wy=(n,e)=>{const t=za(n,e);if(!t)return!1;const[,o]=l4(e,n,t.$pos.pos+4);return o},NM=(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))},AM=(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)},OM=(n,e,t)=>{if(!t)return!1;const o=Tt(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Qh=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Is(n.state,e)&&NM(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 u=a.at(-1);if(!u)return!1;const d=n.state.doc.resolve(l.start()+u.pos+1);return n.chain().cut({from:s.start()-1,to:s.end()+1},d.end()).joinForward().run()}if(!Is(n.state,e)||!u4(n.state))return!1;const o=za(e,n.state);if(!o)return!1;const r=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),i=OM(e,n.state,r);return AM(e,n.state)&&!i?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},$M=(n,e)=>{const t=wy(n,e),o=za(n,e);return!o||!t?!1:t>o.depth},BM=(n,e)=>{const t=wy(n,e),o=za(n,e);return!o||!t?!1:t<o.depth},Zh=(n,e)=>{if(!Is(n.state,e)||!c4(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:$M(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():BM(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},o5=(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)},r5=qn.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&&Zh(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&&Zh(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&&Qh(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&&Qh(n,t,o)&&(e=!0)}),e}}}}),Xk=/^(\s*)(\d+)\.\s+(.*)$/,i5=/^\s/;function s5(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(Xk);if(!i)break;const[,s,l,a]=i,u=s.length;let d=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(Xk))break;if(h.trim()==="")p.push(h),d+=`
270
- `,f+=1;else if(h.match(i5))p.push(h),d+=`
271
- ${h.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:p.join(`
272
- `)}),o=f,t=f}return[e,o]}function RM(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())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
274
- `).trim();if(d){const h=t.blockTokens(d);u.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=RM(p,h,t);u.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:u}),i=f}else i+=1}return r}function l5(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 a5="listItem",Yk="textStyle",Qk=/^(\d+)\.\s$/,c5=Va.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",Bi(this.options.HTMLAttributes,t),0]:["ol",Bi(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?l5(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]=s5(r);if(i.length===0)return;const l=RM(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(a5,this.editor.getAttributes(Yk)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=fa({find:Qk,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=fa({find:Qk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Yk)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),u5=/^\s*(\[([( |x])?\])\s$/,DM=Va.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",Bi(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 ky(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"),u=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"}`};u(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 d=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,u(f);const p=o.extensionManager.attributes,h=t4(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.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)}),d=m,!0}}}},addInputRules(){return[fa({find:u5,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),d5=Va.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",Bi(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=Yh(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=Yh(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()}}});qn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(e5.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(t5.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(r5.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(c5.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(DM.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(d5.configure(this.options.taskList)),n}});var f5=DM;const _M=f5.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 p5(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,u=ng(t),d=new RegExp(`\\s${u}$`),f=s?"^":"",p=r?"":u,h=a?new RegExp(`${f}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\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),v=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const w=g+y.index;let k=w+y[0].length;return a&&d.test(m.slice(k-1,k+1))&&(y[0]+=" ",k+=1),w<l.pos&&k>=l.pos?{range:{from:w,to:k},query:y[0].slice(t.length),text:y[0]}:null}var h5=new le("suggestion");function m5({pluginKey:n=h5,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=p5,shouldShow:y}){let b;const v=h==null?void 0:h(),w=()=>{const S=e.state.selection.$anchor.pos,M=e.view.coordsAtPos(S),{top:N,right:O,bottom:A,left:$}=M;try{return new DOMRect($,N,O-$,A-N)}catch{return null}},k=(S,M)=>M?()=>{const N=n.getState(e.state),O=N==null?void 0:N.decorationId,A=S.dom.querySelector(`[data-decoration-id="${O}"]`);return(A==null?void 0:A.getBoundingClientRect())||null}:w;function x(S,M){var N;try{const A=n.getState(S.state),$=A!=null&&A.decorationId?S.dom.querySelector(`[data-decoration-id="${A.decorationId}"]`):null,D={editor:e,range:(A==null?void 0:A.range)||{from:0,to:0},query:(A==null?void 0:A.query)||null,text:(A==null?void 0:A.text)||null,items:[],command:R=>f({editor:e,range:(A==null?void 0:A.range)||{from:0,to:0},props:R}),decorationNode:$,clientRect:k(S,$)};(N=v==null?void 0:v.onExit)==null||N.call(v,D)}catch{}const O=S.state.tr.setMeta(M,{exit:!0});S.dispatch(O)}const C=new ce({key:n,view(){return{update:async(S,M)=>{var N,O,A,$,D,R,L;const B=(N=this.key)==null?void 0:N.getState(M),W=(O=this.key)==null?void 0:O.getState(S.state),z=B.active&&W.active&&B.range.from!==W.range.from,U=!B.active&&W.active,he=B.active&&!W.active,Se=!U&&!he&&B.query!==W.query,_e=U||z&&Se,je=Se||z,He=he||z&&Se;if(!_e&&!je&&!He)return;const Ne=He&&!_e?B:W,Fe=S.dom.querySelector(`[data-decoration-id="${Ne.decorationId}"]`);b={editor:e,range:Ne.range,query:Ne.query,text:Ne.text,items:[],command:kt=>f({editor:e,range:Ne.range,props:kt}),decorationNode:Fe,clientRect:k(S,Fe)},_e&&((A=v==null?void 0:v.onBeforeStart)==null||A.call(v,b)),je&&(($=v==null?void 0:v.onBeforeUpdate)==null||$.call(v,b)),(je||_e)&&(b.items=await p({editor:e,query:Ne.query})),He&&((D=v==null?void 0:v.onExit)==null||D.call(v,b)),je&&((R=v==null?void 0:v.onUpdate)==null||R.call(v,b)),_e&&((L=v==null?void 0:v.onStart)==null||L.call(v,b))},destroy:()=>{var S;b&&((S=v==null?void 0:v.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,M,N,O){const{isEditable:A}=e,{composing:$}=e.view,{selection:D}=S,{empty:R,from:L}=D,B={...M},W=S.getMeta(n);if(W&&W.exit)return B.active=!1,B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null,B;if(B.composing=$,A&&(R||e.view.composing)){(L<M.range.from||L>M.range.to)&&!$&&!M.composing&&(B.active=!1);const z=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:D.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;z&&m({editor:e,state:O,range:z.range,isActive:M.active})&&(!y||y({editor:e,range:z.range,query:z.query,text:z.text,transaction:S}))?(B.active=!0,B.decorationId=M.decorationId?M.decorationId:U,B.range=z.range,B.query=z.query,B.text=z.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(S,M){var N,O,A,$;const{active:D,range:R}=C.getState(S.state);if(!D)return!1;if(M.key==="Escape"||M.key==="Esc"){const L=C.getState(S.state),B=(N=b==null?void 0:b.decorationNode)!=null?N:null,W=B??(L!=null&&L.decorationId?S.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`):null);if((O=v==null?void 0:v.onKeyDown)!=null&&O.call(v,{view:S,event:M,range:L.range}))return!0;const z={editor:e,range:L.range,query:L.query,text:L.text,items:[],command:U=>f({editor:e,range:L.range,props:U}),decorationNode:W,clientRect:W?()=>W.getBoundingClientRect()||null:null};return(A=v==null?void 0:v.onExit)==null||A.call(v,z),x(S,n),!0}return(($=v==null?void 0:v.onKeyDown)==null?void 0:$.call(v,{view:S,event:M,range:R}))||!1},decorations(S){const{active:M,range:N,decorationId:O,query:A}=C.getState(S);if(!M)return null;const $=!(A!=null&&A.length),D=[a];return $&&D.push(d),xe.create(S.doc,[ze.inline(N.from,N.to,{nodeName:l,class:D.join(" "),"data-decoration-id":O,"data-decoration-content":u})])}}});return C}var vf=m5;const g5=ye.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[vf({pluginKey:new le(this.options.pluginKey),editor:this.editor,...this.options.suggestion})]}}),IM=ye.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[vf({pluginKey:new le("colon-command"),editor:this.editor,...this.options.suggestion})]}}),LM=ye.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[vf({pluginKey:new le("slash-command"),editor:this.editor,...this.options.suggestion})]}}),PM=ye.create({name:"slash-zh-command",addOptions(){return{suggestion:{char:"、",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[vf({pluginKey:new le("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}}),y5={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:n,tr:e}=ue(),{run:t}=we();return{locale:n,tr:e,run:t}},data(){return{view:"main"}},components:{OEmojiSelect:Xd},methods:{onSelect(n){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(n.emoji),this.editor.chain().focus()},onKeyDown({event:n}){return!1}}},xy=(n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t},b5={class:"o-colon-view"};function v5(n,e,t,o,r,i){const s=c.resolveComponent("o-emoji-select");return c.openBlock(),c.createElementBlock("section",b5,[c.createVNode(s,{items:t.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const k5=xy(y5,[["render",v5]]),VM={items:({query:n})=>Dl.filterEmojiGroups(n),render:()=>{let n,e;return{onStart:t=>{n=new jd(k5,{props:t,editor:t.editor}),t.clientRect&&(e=ir("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()}}}},w5={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Nt},range:{type:Object}},setup(){const{locale:n,tr:e}=ue(),{onCommand:t,run:o}=we();return{locale:n,tr:e,onCommand:t,run:o}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:zt,OIcon:G,OList:Mt,OListItem:vt},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 Ba.slice(1)}},mounted(){this.selectedIndex=0}},x5={key:0,class:"view-main"},C5={class:"group o-tips"},S5={class:"o-tips"},E5={key:1,class:"item"},M5={key:1,class:"view-emoji"},T5={key:2,class:"view-emoji"};function N5(n,e,t,o,r,i){const s=c.resolveComponent("o-divider"),l=c.resolveComponent("o-icon"),a=c.resolveComponent("o-list-item"),u=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",x5,[c.createVNode(u,{hoverable:"",clickable:""},{default:c.withCtx(()=>[t.items.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(t.items,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[f>0?(c.openBlock(),c.createBlock(s,{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",C5,c.toDisplayString(o.tr(d.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(a,{class:c.normalizeClass(["item",{"is-active":f===r.selectedIndex}]),clickable:"",onClick:p=>i.onClick(d)},{prefix:c.withCtx(()=>[c.createVNode(l,{name:d.icon,color:d.color},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("span",S5,c.toDisplayString(d.tips),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(o.tr(d.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",E5,"No result"))]),_:1})])):r.view==="emoji"?(c.openBlock(),c.createElementBlock("section",M5)):r.view==="ai"?(c.openBlock(),c.createElementBlock("section",T5)):c.createCommentVNode("",!0)],2)}const A5=xy(w5,[["render",N5]]),em={items:({query:n})=>Hu.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 jd(A5,{props:t,editor:t.editor}),t.clientRect&&(e=ir("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()}}}},O5={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})}}},$5={class:"dropdown-menu"},B5=["onClick"],R5=["src"];function D5(n,e,t,o,r,i){return c.openBlock(),c.createElementBlock("div",$5,[(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,R5)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(s.emoji),1)],64)),c.createTextVNode(" :"+c.toDisplayString(s.name)+": ",1)],10,B5))),128))])}const _5=xy(O5,[["render",D5]]),I5={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;nf({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 jd(_5,{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",de(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=Ln.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}}}}}),P5={class:"o-scroll"},V5={class:"view-main"},z5={class:"block-container"},H5={class:"block-content"},F5={key:0,class:"edit-prompt"},j5={key:1},U5={"data-tippy-role":"tooltip"},W5={class:"label"},q5={class:"block-container"},K5={class:"block-content"},J5=100,G5=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{md:t}=Tg(),{languageName:o,tr:r}=ue(),{isFocused:i,bind:s,unbind:l,checkFocus:a}=iC(),{theme:u}=Vi(),{isEditable:d}=we(),{getPos:f}=e,{provider:p,onStreamingChatCompletion:h}=e.extension.options,m=c.ref(null),g=c.ref(""),y=c.ref(!1),b=c.ref({}),v=c.ref(!1),w=c.ref(!1),k=c.ref(""),x=c.ref(null),C=c.ref(!1),S=c.ref(!1);let M=0;const N=c.computed(()=>({role:"system",content:Wg.writing.replace("[LANGUAGE]",o.value)})),O=c.ref([N.value]),A=c.computed(()=>!e.node.textContent),$=c.computed(()=>EC),D=c.computed({get(){return e.node.attrs.provider},set(fe){e.updateAttributes({provider:fe})}}),R=c.computed({get(){return e.node.attrs.prompt},set(fe){e.updateAttributes({prompt:fe})}}),L=c.computed({get(){return e.node.attrs.time},set(fe){e.updateAttributes({time:fe})}});function B(){g.value=R.value,A.value&&!R.value&&setTimeout(()=>{var fe;(fe=m.value)==null||fe.focus()},0)}function W(){setTimeout(()=>{},0)}function z(){k.value="edit",setTimeout(()=>{var fe;(fe=x.value)==null||fe.focus()},0)}function U(){D.value=p.provider,R.value=g.value,L.value=Date.now(),C.value=!0,k.value&&(k.value=""),S.value?_e():he()}async function he(){const fe=f();let Ee="";if(O.value.push({role:"user",content:R.value}),O.value[0].role==="system"&&(O.value.shift(),O.value.unshift(N.value)),!h){Zl.error("AI Completion method not implemented."),C.value=!1;return}try{const Me=await h({messages:O.value,options:{id:e.node.attrs.id,type:"ai-block"},onChunk:it=>{Ee+=it,O.value=[...O.value.slice(0,-1),{role:"assistant",content:Ee}];const gn=Date.now();gn-M>J5&&(Se(fe,Ee),M=gn)}});Se(fe,Ee)}catch(Me){O.value.pop(),console.error(Me),Zl.error(r("ai.error"))}finally{C.value=!1}}function Se(fe,Ee){const Me=t.render(Ee),it=Bg(e.editor,Me);je(fe,it)}async function _e(){const fe=f();let Ee="";try{for(const Me of cS){await new Promise(gn=>setTimeout(gn,500)),Ee+=Me;const it=kC(e.editor,t.render(Ee));je(fe,it)}}catch(Me){console.error(Me)}C.value=!1}function je(fe,Ee){var it;const Me=e.node.toJSON();Me.content=Ee.content,(it=e.editor)==null||it.commands.updateAiBlock(fe,Me),e.editor.commands.setNodeSelection(fe),e.editor.view.focus(),He()}function He(){const Ee=e.node.content.lastChild;if(Ee&&Ee.attrs.id){const Me=Ee.attrs.id,it=document.querySelector(`[data-id="${Me}"]`);it&&it.scrollIntoView({behavior:"smooth",block:"center"})}}function Ne(fe){y.value=!1,fe.value}function Fe(fe,Ee){Ee?g.value=r(Ee.label):g.value=r(fe.label),v.value=!1}function kt(fe){y.value=!0,b.value=fe}return c.watch(()=>e.node.content,fe=>{a()}),c.watch(A,fe=>{fe&&(w.value=!1)}),c.watch(i,fe=>{fe&&!A.value&&setTimeout(()=>{g.value=R.value,k.value="",w.value=fe},100)}),c.onMounted(()=>{B(),s(e)}),c.onBeforeUnmount(()=>{l()}),(fe,Ee)=>(c.openBlock(),c.createBlock(c.unref(An),c.mergeProps(e,{class:["o-ai-block-view",{"is-empty":A.value,"has-focus":c.unref(i)}],onContextmenu:c.withModifiers(kt,["prevent"])}),{default:c.withCtx(()=>[A.value?(c.openBlock(),c.createBlock(c.unref(To),{key:0,modelValue:v.value,"onUpdate:modelValue":Ee[1]||(Ee[1]=Me=>v.value=Me),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":c.withCtx(()=>[c.createElementVNode("section",P5,[c.createElementVNode("section",V5,[c.createVNode(c.unref(Gd),{items:$.value,onSelect:Fe,"use-keyboard":v.value},null,8,["items","use-keyboard"])])])]),default:c.withCtx(()=>[c.createElementVNode("div",z5,[c.createElementVNode("div",H5,[c.createVNode(c.unref(Un),{ref_key:"inputRef",ref:m,modelValue:g.value,"onUpdate:modelValue":Ee[0]||(Ee[0]=Me=>g.value=Me),placeholder:c.unref(r)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:W},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(_r),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(r)("label.generate"),loading:C.value,onClick:U},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):c.createCommentVNode("",!0),c.withDirectives(c.createVNode(c.unref(To),{modelValue:w.value,"onUpdate:modelValue":Ee[4]||(Ee[4]=Me=>w.value=Me),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":c.withCtx(()=>[k.value==="edit"?(c.openBlock(),c.createElementBlock("section",F5,[c.createVNode(c.unref(Un),{ref_key:"updateInputRef",ref:x,modelValue:g.value,"onUpdate:modelValue":Ee[2]||(Ee[2]=Me=>g.value=Me),placeholder:c.unref(r)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(_r),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(r)("label.generate"),loading:C.value,onClick:U},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(c.openBlock(),c.createElementBlock("section",j5,[c.createVNode(c.unref(GC),null,{default:c.withCtx(()=>[c.createElementVNode("div",U5,[c.createVNode(c.unref(Xe),{icon:"auto_awesome",onClick:z},{default:c.withCtx(()=>[c.createElementVNode("span",W5,c.toDisplayString(c.unref(r)("label.generatedBy"))+" "+c.toDisplayString(D.value||"AI"),1)]),_:1})]),c.createVNode(c.unref(_r),{icon:"autorenew",tooltip:c.unref(r)("label.update"),loading:C.value,onClick:U},null,8,["tooltip","loading"])]),_:1})]))]),default:c.withCtx(()=>[c.createElementVNode("div",q5,[c.createElementVNode("div",K5,[c.createVNode(c.unref(rr))]),c.unref(d)?(c.openBlock(),c.createBlock(c.unref(zi),{key:0,modelValue:y.value,"onUpdate:modelValue":Ee[3]||(Ee[3]=Me=>y.value=Me),event:b.value},{default:c.withCtx(()=>[c.createVNode(c.unref(sr),c.mergeProps(e,{onAction:Ne}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[c.vShow,!A.value]])]),_:1},16,["class"]))}}),zM=L5.extend({addNodeView(){return mn(G5)}}),X5={key:1,class:"audio-container"},Xi="//init.mp3",Y5=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{tr:t}=ue(),{isEditable:o}=we(),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 u(){l.value===Xi&&p(!0)}function d(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===Xi)}),(h,m)=>{var g;return c.openBlock(),c.createBlock(c.unref(An),c.mergeProps(e,{class:["o-audio-view",{readonly:!((g=h.editor)!=null&&g.isEditable),init:l.value===Xi}],as:"div",onContextmenu:c.withModifiers(d,["prevent"]),onClick:u}),{default:c.withCtx(()=>[c.createVNode(c.unref(To),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=y=>s.value=y),placement:l.value===Xi?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Da),{val:l.value===Xi?"":l.value,type:"audio",onInput:f},null,8,["val"])]),default:c.withCtx(()=>[l.value===Xi?(c.openBlock(),c.createBlock(c.unref(Vs),{key:0,icon:"graphic_eq",placeholder:c.unref(t)("label.audioAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",X5,[c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Ra),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(zi),{modelValue:r.value,"onUpdate:modelValue":m[1]||(m[1]=y=>r.value=y),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(sr),c.mergeProps(e,{onAction:a}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),HM=BN.extend({addNodeView(){return mn(Y5)}}),Q5={class:"header o-tips"},Z5={style:{display:"flex"}},e8=["innerHTML"],t8=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{tr:t}=ue(),{isEditable:o}=we(),r=c.ref(!1),i=c.ref(null),s=c.computed({get(){return e.node.attrs.latex},set(d){e.updateAttributes({latex:d||""})}}),l=c.computed(()=>RN.renderToString(s.value,{throwOnError:!1}));function a(d){r.value=d,d&&setTimeout(()=>{var f;(f=i.value)==null||f.focus()},100)}function u(){window.open("https://katex.org/docs/supported.html","target")}return c.onMounted(()=>{a(!s.value)}),(d,f)=>(c.openBlock(),c.createBlock(c.unref(An),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(To),{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",Q5,[c.createElementVNode("div",Z5,[c.createVNode(c.unref(G),{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:u},null,8,["tooltip"])])]),c.createVNode(c.unref(YC),{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,e8)])):(c.openBlock(),c.createBlock(c.unref(Vs),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),FM=_l.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 mn(t8)}});/**
287
- * Copyright 2026 Yiitap
288
- * @license MIT
289
- **/var Zk=(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]},n8=/^\s*>\s$/,o8=Oe.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Zk("blockquote",{...de(this.options.HTMLAttributes,n),children:Zk("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[er({find:n8,type:this.type})]}});const r8=o8.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[er({find:t,type:this.type})]}}),i8=c.defineComponent({__name:"view",props:dt,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(An),c.mergeProps(e,{class:"o-blockquote-view"}),{default:c.withCtx(()=>[c.createElementVNode("blockquote",null,[c.createVNode(c.unref(rr))])]),_:1},16))}}),jM=r8.extend({addNodeView(){return mn(i8)}});/**
294
- * Copyright 2026 Yiitap
295
- * @license MIT
296
- **/const s8=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 Wr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.callout.create(null,s.nodes.paragraph.create());i.replaceRangeWith(a,u,d);const f=q.near(i.doc.resolve(a+2));i.setSelection(f)}})]},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:n}){return["div",de(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()}}}),l8={class:"callout-container"},a8={class:"callout-icon"},c8={class:"callout-content"},u8=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{theme:t}=Vi(),{isEditable:o}=we(),r=c.ref(!1),i=c.ref(!1),s=c.ref({}),l=c.ref(null),a=c.computed(()=>{const{selection:k}=e.editor.view.state,x=k.from,C=e.getPos(),S=C+e.node.nodeSize;return x>=C&&x<=S}),u=c.computed({get(){return e.node.attrs.backColor},set(k){e.updateAttributes({backColor:k})}}),d=c.computed({get(){return e.node.attrs.backColorDark},set(k){e.updateAttributes({backColorDark:k})}}),f=c.computed({get(){return e.node.attrs.borderColor},set(k){e.updateAttributes({borderColor:k})}}),p=c.computed({get(){return e.node.attrs.borderColorDark},set(k){e.updateAttributes({borderColorDark:k})}}),h=c.computed(()=>t.value==="dark"?d.value:u.value),m=c.computed(()=>t.value==="dark"?p.value:f.value);function g(k){e.updateAttributes({icon:k})}function y(k){switch(r.value=!1,k.value){case"palette":v(!0);break}}function b(k){r.value=!0,s.value=k}function v(k){i.value=k}function w(k,x){var C;switch(k){case"backColor":u.value=x;break;case"foreColor":f.value=x;break;case"icon":g(x.emoji),(C=l.value)==null||C.setShow(!1);break}}return c.watch(a,k=>{v(k)}),(k,x)=>(c.openBlock(),c.createBlock(c.unref(An),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",l8,[c.createVNode(c.unref(Re),{ref_key:"iconPopover",ref:l,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!c.unref(o)},{trigger:c.withCtx(()=>[c.createElementVNode("div",a8,c.toDisplayString(k.node.attrs.icon),1)]),default:c.withCtx(()=>[c.createVNode(c.unref(Xd),{items:c.unref(Dl.emojiGroups),onSelect:x[0]||(x[0]=C=>w("icon",C)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),c.createElementVNode("div",c8,[c.createVNode(c.unref(rr))]),c.unref(o)?(c.openBlock(),c.createBlock(c.unref(zi),{key:0,modelValue:r.value,"onUpdate:modelValue":x[1]||(x[1]=C=>r.value=C),event:s.value},{default:c.withCtx(()=>[c.createVNode(c.unref(sr),c.mergeProps(e,{onAction:y}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),UM=s8.extend({addNodeView(){return mn(u8)}});function d8(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Cp,ew;function f8(){if(ew)return Cp;ew=1;function n(E){return E instanceof Map?E.clear=E.delete=E.set=function(){throw new Error("map is read-only")}:E instanceof Set&&(E.add=E.clear=E.delete=function(){throw new Error("set is read-only")}),Object.freeze(E),Object.getOwnPropertyNames(E).forEach(_=>{const j=E[_],me=typeof j;(me==="object"||me==="function")&&!Object.isFrozen(j)&&n(j)}),E}class e{constructor(_){_.data===void 0&&(_.data={}),this.data=_.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(E){return E.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function o(E,..._){const j=Object.create(null);for(const me in E)j[me]=E[me];return _.forEach(function(me){for(const Qe in me)j[Qe]=me[Qe]}),j}const r="</span>",i=E=>!!E.scope,s=(E,{prefix:_})=>{if(E.startsWith("language:"))return E.replace("language:","language-");if(E.includes(".")){const j=E.split(".");return[`${_}${j.shift()}`,...j.map((me,Qe)=>`${me}${"_".repeat(Qe+1)}`)].join(" ")}return`${_}${E}`};class l{constructor(_,j){this.buffer="",this.classPrefix=j.classPrefix,_.walk(this)}addText(_){this.buffer+=t(_)}openNode(_){if(!i(_))return;const j=s(_.scope,{prefix:this.classPrefix});this.span(j)}closeNode(_){i(_)&&(this.buffer+=r)}value(){return this.buffer}span(_){this.buffer+=`<span class="${_}">`}}const a=(E={})=>{const _={children:[]};return Object.assign(_,E),_};class u{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(_){this.top.children.push(_)}openNode(_){const j=a({scope:_});this.add(j),this.stack.push(j)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(_){return this.constructor._walk(_,this.rootNode)}static _walk(_,j){return typeof j=="string"?_.addText(j):j.children&&(_.openNode(j),j.children.forEach(me=>this._walk(_,me)),_.closeNode(j)),_}static _collapse(_){typeof _!="string"&&_.children&&(_.children.every(j=>typeof j=="string")?_.children=[_.children.join("")]:_.children.forEach(j=>{u._collapse(j)}))}}class d extends u{constructor(_){super(),this.options=_}addText(_){_!==""&&this.add(_)}startScope(_){this.openNode(_)}endScope(){this.closeNode()}__addSublanguage(_,j){const me=_.root;j&&(me.scope=`language:${j}`),this.add(me)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(E){return E?typeof E=="string"?E:E.source:null}function p(E){return g("(?=",E,")")}function h(E){return g("(?:",E,")*")}function m(E){return g("(?:",E,")?")}function g(...E){return E.map(j=>f(j)).join("")}function y(E){const _=E[E.length-1];return typeof _=="object"&&_.constructor===Object?(E.splice(E.length-1,1),_):{}}function b(...E){return"("+(y(E).capture?"":"?:")+E.map(me=>f(me)).join("|")+")"}function v(E){return new RegExp(E.toString()+"|").exec("").length-1}function w(E,_){const j=E&&E.exec(_);return j&&j.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function x(E,{joinWith:_}){let j=0;return E.map(me=>{j+=1;const Qe=j;let qe=f(me),te="";for(;qe.length>0;){const Y=k.exec(qe);if(!Y){te+=qe;break}te+=qe.substring(0,Y.index),qe=qe.substring(Y.index+Y[0].length),Y[0][0]==="\\"&&Y[1]?te+="\\"+String(Number(Y[1])+Qe):(te+=Y[0],Y[0]==="("&&j++)}return te}).map(me=>`(${me})`).join(_)}const C=/\b\B/,S="[a-zA-Z]\\w*",M="[a-zA-Z_]\\w*",N="\\b\\d+(\\.\\d+)?",O="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",A="\\b(0b[01]+)",$="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",D=(E={})=>{const _=/^#![ ]*\//;return E.binary&&(E.begin=g(_,/.*\b/,E.binary,/\b.*/)),o({scope:"meta",begin:_,end:/$/,relevance:0,"on:begin":(j,me)=>{j.index!==0&&me.ignoreMatch()}},E)},R={begin:"\\\\[\\s\\S]",relevance:0},L={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[R]},B={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[R]},W={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/},z=function(E,_,j={}){const me=o({scope:"comment",begin:E,end:_,contains:[]},j);me.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 Qe=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 me.contains.push({begin:g(/[ ]+/,"(",Qe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),me},U=z("//","$"),he=z("/\\*","\\*/"),Se=z("#","$"),_e={scope:"number",begin:N,relevance:0},je={scope:"number",begin:O,relevance:0},He={scope:"number",begin:A,relevance:0},Ne={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[R,{begin:/\[/,end:/\]/,relevance:0,contains:[R]}]},Fe={scope:"title",begin:S,relevance:0},kt={scope:"title",begin:M,relevance:0},fe={begin:"\\.\\s*"+M,relevance:0};var Me=Object.freeze({__proto__:null,APOS_STRING_MODE:L,BACKSLASH_ESCAPE:R,BINARY_NUMBER_MODE:He,BINARY_NUMBER_RE:A,COMMENT:z,C_BLOCK_COMMENT_MODE:he,C_LINE_COMMENT_MODE:U,C_NUMBER_MODE:je,C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(E){return Object.assign(E,{"on:begin":(_,j)=>{j.data._beginMatch=_[1]},"on:end":(_,j)=>{j.data._beginMatch!==_[1]&&j.ignoreMatch()}})},HASH_COMMENT_MODE:Se,IDENT_RE:S,MATCH_NOTHING_RE:C,METHOD_GUARD:fe,NUMBER_MODE:_e,NUMBER_RE:N,PHRASAL_WORDS_MODE:W,QUOTE_STRING_MODE:B,REGEXP_MODE:Ne,RE_STARTERS_RE:$,SHEBANG:D,TITLE_MODE:Fe,UNDERSCORE_IDENT_RE:M,UNDERSCORE_TITLE_MODE:kt});function it(E,_){E.input[E.index-1]==="."&&_.ignoreMatch()}function gn(E,_){E.className!==void 0&&(E.scope=E.className,delete E.className)}function Do(E,_){_&&E.beginKeywords&&(E.begin="\\b("+E.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",E.__beforeBegin=it,E.keywords=E.keywords||E.beginKeywords,delete E.beginKeywords,E.relevance===void 0&&(E.relevance=0))}function _o(E,_){Array.isArray(E.illegal)&&(E.illegal=b(...E.illegal))}function cr(E,_){if(E.match){if(E.begin||E.end)throw new Error("begin & end are not supported with match");E.begin=E.match,delete E.match}}function On(E,_){E.relevance===void 0&&(E.relevance=1)}const Io=(E,_)=>{if(!E.beforeMatch)return;if(E.starts)throw new Error("beforeMatch cannot be used with starts");const j=Object.assign({},E);Object.keys(E).forEach(me=>{delete E[me]}),E.keywords=j.keywords,E.begin=g(j.beforeMatch,p(j.begin)),E.starts={relevance:0,contains:[Object.assign(j,{endsParent:!0})]},E.relevance=0,delete j.beforeMatch},ur=["of","and","for","in","not","or","if","then","parent","list","value"],dr="keyword";function Ht(E,_,j=dr){const me=Object.create(null);return typeof E=="string"?Qe(j,E.split(" ")):Array.isArray(E)?Qe(j,E):Object.keys(E).forEach(function(qe){Object.assign(me,Ht(E[qe],_,qe))}),me;function Qe(qe,te){_&&(te=te.map(Y=>Y.toLowerCase())),te.forEach(function(Y){const ge=Y.split("|");me[ge[0]]=[qe,yn(ge[0],ge[1])]})}}function yn(E,_){return _?Number(_):so(E)?0:1}function so(E){return ur.includes(E.toLowerCase())}const bn={},en=E=>{console.error(E)},Lo=(E,..._)=>{console.log(`WARN: ${E}`,..._)},Ft=(E,_)=>{bn[`${E}/${_}`]||(console.log(`Deprecated as of ${E}. ${_}`),bn[`${E}/${_}`]=!0)},Kn=new Error;function lo(E,_,{key:j}){let me=0;const Qe=E[j],qe={},te={};for(let Y=1;Y<=_.length;Y++)te[Y+me]=Qe[Y],qe[Y+me]=!0,me+=v(_[Y-1]);E[j]=te,E[j]._emit=qe,E[j]._multi=!0}function Us(E){if(Array.isArray(E.begin)){if(E.skip||E.excludeBegin||E.returnBegin)throw en("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Kn;if(typeof E.beginScope!="object"||E.beginScope===null)throw en("beginScope must be object"),Kn;lo(E,E.begin,{key:"beginScope"}),E.begin=x(E.begin,{joinWith:""})}}function Ws(E){if(Array.isArray(E.end)){if(E.skip||E.excludeEnd||E.returnEnd)throw en("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Kn;if(typeof E.endScope!="object"||E.endScope===null)throw en("endScope must be object"),Kn;lo(E,E.end,{key:"endScope"}),E.end=x(E.end,{joinWith:""})}}function ji(E){E.scope&&typeof E.scope=="object"&&E.scope!==null&&(E.beginScope=E.scope,delete E.scope)}function Ui(E){ji(E),typeof E.beginScope=="string"&&(E.beginScope={_wrap:E.beginScope}),typeof E.endScope=="string"&&(E.endScope={_wrap:E.endScope}),Us(E),Ws(E)}function Wi(E){function _(te,Y){return new RegExp(f(te),"m"+(E.case_insensitive?"i":"")+(E.unicodeRegex?"u":"")+(Y?"g":""))}class j{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Y,ge){ge.position=this.position++,this.matchIndexes[this.matchAt]=ge,this.regexes.push([ge,Y]),this.matchAt+=v(Y)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Y=this.regexes.map(ge=>ge[1]);this.matcherRe=_(x(Y,{joinWith:"|"}),!0),this.lastIndex=0}exec(Y){this.matcherRe.lastIndex=this.lastIndex;const ge=this.matcherRe.exec(Y);if(!ge)return null;const wt=ge.findIndex((Ks,Ef)=>Ef>0&&Ks!==void 0),ft=this.matchIndexes[wt];return ge.splice(0,wt),Object.assign(ge,ft)}}class me{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Y){if(this.multiRegexes[Y])return this.multiRegexes[Y];const ge=new j;return this.rules.slice(Y).forEach(([wt,ft])=>ge.addRule(wt,ft)),ge.compile(),this.multiRegexes[Y]=ge,ge}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Y,ge){this.rules.push([Y,ge]),ge.type==="begin"&&this.count++}exec(Y){const ge=this.getMatcher(this.regexIndex);ge.lastIndex=this.lastIndex;let wt=ge.exec(Y);if(this.resumingScanAtSamePosition()&&!(wt&&wt.index===this.lastIndex)){const ft=this.getMatcher(0);ft.lastIndex=this.lastIndex+1,wt=ft.exec(Y)}return wt&&(this.regexIndex+=wt.position+1,this.regexIndex===this.count&&this.considerAll()),wt}}function Qe(te){const Y=new me;return te.contains.forEach(ge=>Y.addRule(ge.begin,{rule:ge,type:"begin"})),te.terminatorEnd&&Y.addRule(te.terminatorEnd,{type:"end"}),te.illegal&&Y.addRule(te.illegal,{type:"illegal"}),Y}function qe(te,Y){const ge=te;if(te.isCompiled)return ge;[gn,cr,Ui,Io].forEach(ft=>ft(te,Y)),E.compilerExtensions.forEach(ft=>ft(te,Y)),te.__beforeBegin=null,[Do,_o,On].forEach(ft=>ft(te,Y)),te.isCompiled=!0;let wt=null;return typeof te.keywords=="object"&&te.keywords.$pattern&&(te.keywords=Object.assign({},te.keywords),wt=te.keywords.$pattern,delete te.keywords.$pattern),wt=wt||/\w+/,te.keywords&&(te.keywords=Ht(te.keywords,E.case_insensitive)),ge.keywordPatternRe=_(wt,!0),Y&&(te.begin||(te.begin=/\B|\b/),ge.beginRe=_(ge.begin),!te.end&&!te.endsWithParent&&(te.end=/\B|\b/),te.end&&(ge.endRe=_(ge.end)),ge.terminatorEnd=f(ge.end)||"",te.endsWithParent&&Y.terminatorEnd&&(ge.terminatorEnd+=(te.end?"|":"")+Y.terminatorEnd)),te.illegal&&(ge.illegalRe=_(te.illegal)),te.contains||(te.contains=[]),te.contains=[].concat(...te.contains.map(function(ft){return P(ft==="self"?te:ft)})),te.contains.forEach(function(ft){qe(ft,ge)}),te.starts&&qe(te.starts,Y),ge.matcher=Qe(ge),ge}if(E.compilerExtensions||(E.compilerExtensions=[]),E.contains&&E.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return E.classNameAliases=o(E.classNameAliases||{}),qe(E)}function T(E){return E?E.endsWithParent||T(E.starts):!1}function P(E){return E.variants&&!E.cachedVariants&&(E.cachedVariants=E.variants.map(function(_){return o(E,{variants:null},_)})),E.cachedVariants?E.cachedVariants:T(E)?o(E,{starts:E.starts?o(E.starts):null}):Object.isFrozen(E)?o(E):E}var ee="11.11.1";class be extends Error{constructor(_,j){super(_),this.name="HTMLInjectionError",this.html=j}}const pe=t,ct=o,Ot=Symbol("nomatch"),fr=7,qs=function(E){const _=Object.create(null),j=Object.create(null),me=[];let Qe=!0;const qe="Could not find the language '{}', did you forget to load/include a language module?",te={disableAutodetect:!0,name:"Plain text",contains:[]};let Y={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function ge(H){return Y.noHighlightRe.test(H)}function wt(H){let ae=H.className+" ";ae+=H.parentNode?H.parentNode.className:"";const $e=Y.languageDetectRe.exec(ae);if($e){const Ke=pr($e[1]);return Ke||(Lo(qe.replace("{}",$e[1])),Lo("Falling back to no-highlight mode for this block.",H)),Ke?$e[1]:"no-highlight"}return ae.split(/\s+/).find(Ke=>ge(Ke)||pr(Ke))}function ft(H,ae,$e){let Ke="",yt="";typeof ae=="object"?(Ke=H,$e=ae.ignoreIllegals,yt=ae.language):(Ft("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ft("10.7.0",`Please use highlight(code, options) instead.
301
- https://github.com/highlightjs/highlight.js/issues/2277`),yt=H,Ke=ae),$e===void 0&&($e=!0);const Jn={code:Ke,language:yt};Ua("before:highlight",Jn);const hr=Jn.result?Jn.result:Ks(Jn.language,Jn.code,$e);return hr.code=Jn.code,Ua("after:highlight",hr),hr}function Ks(H,ae,$e,Ke){const yt=Object.create(null);function Jn(K,re){return K.keywords[re]}function hr(){if(!ke.keywords){$t.addText(Je);return}let K=0;ke.keywordPatternRe.lastIndex=0;let re=ke.keywordPatternRe.exec(Je),Te="";for(;re;){Te+=Je.substring(K,re.index);const Ve=co.case_insensitive?re[0].toLowerCase():re[0],jt=Jn(ke,Ve);if(jt){const[Po,MN]=jt;if($t.addText(Te),Te="",yt[Ve]=(yt[Ve]||0)+1,yt[Ve]<=fr&&(Ka+=MN),Po.startsWith("_"))Te+=re[0];else{const TN=co.classNameAliases[Po]||Po;ao(re[0],TN)}}else Te+=re[0];K=ke.keywordPatternRe.lastIndex,re=ke.keywordPatternRe.exec(Je)}Te+=Je.substring(K),$t.addText(Te)}function Wa(){if(Je==="")return;let K=null;if(typeof ke.subLanguage=="string"){if(!_[ke.subLanguage]){$t.addText(Je);return}K=Ks(ke.subLanguage,Je,!0,Wy[ke.subLanguage]),Wy[ke.subLanguage]=K._top}else K=Mf(Je,ke.subLanguage.length?ke.subLanguage:null);ke.relevance>0&&(Ka+=K.relevance),$t.__addSublanguage(K._emitter,K.language)}function vn(){ke.subLanguage!=null?Wa():hr(),Je=""}function ao(K,re){K!==""&&($t.startScope(re),$t.addText(K),$t.endScope())}function Hy(K,re){let Te=1;const Ve=re.length-1;for(;Te<=Ve;){if(!K._emit[Te]){Te++;continue}const jt=co.classNameAliases[K[Te]]||K[Te],Po=re[Te];jt?ao(Po,jt):(Je=Po,hr(),Je=""),Te++}}function Fy(K,re){return K.scope&&typeof K.scope=="string"&&$t.openNode(co.classNameAliases[K.scope]||K.scope),K.beginScope&&(K.beginScope._wrap?(ao(Je,co.classNameAliases[K.beginScope._wrap]||K.beginScope._wrap),Je=""):K.beginScope._multi&&(Hy(K.beginScope,re),Je="")),ke=Object.create(K,{parent:{value:ke}}),ke}function jy(K,re,Te){let Ve=w(K.endRe,Te);if(Ve){if(K["on:end"]){const jt=new e(K);K["on:end"](re,jt),jt.isMatchIgnored&&(Ve=!1)}if(Ve){for(;K.endsParent&&K.parent;)K=K.parent;return K}}if(K.endsWithParent)return jy(K.parent,re,Te)}function wN(K){return ke.matcher.regexIndex===0?(Je+=K[0],1):(Of=!0,0)}function xN(K){const re=K[0],Te=K.rule,Ve=new e(Te),jt=[Te.__beforeBegin,Te["on:begin"]];for(const Po of jt)if(Po&&(Po(K,Ve),Ve.isMatchIgnored))return wN(re);return Te.skip?Je+=re:(Te.excludeBegin&&(Je+=re),vn(),!Te.returnBegin&&!Te.excludeBegin&&(Je=re)),Fy(Te,K),Te.returnBegin?0:re.length}function CN(K){const re=K[0],Te=ae.substring(K.index),Ve=jy(ke,K,Te);if(!Ve)return Ot;const jt=ke;ke.endScope&&ke.endScope._wrap?(vn(),ao(re,ke.endScope._wrap)):ke.endScope&&ke.endScope._multi?(vn(),Hy(ke.endScope,K)):jt.skip?Je+=re:(jt.returnEnd||jt.excludeEnd||(Je+=re),vn(),jt.excludeEnd&&(Je=re));do ke.scope&&$t.closeNode(),!ke.skip&&!ke.subLanguage&&(Ka+=ke.relevance),ke=ke.parent;while(ke!==Ve.parent);return Ve.starts&&Fy(Ve.starts,K),jt.returnEnd?0:re.length}function SN(){const K=[];for(let re=ke;re!==co;re=re.parent)re.scope&&K.unshift(re.scope);K.forEach(re=>$t.openNode(re))}let qa={};function Uy(K,re){const Te=re&&re[0];if(Je+=K,Te==null)return vn(),0;if(qa.type==="begin"&&re.type==="end"&&qa.index===re.index&&Te===""){if(Je+=ae.slice(re.index,re.index+1),!Qe){const Ve=new Error(`0 width match regex (${H})`);throw Ve.languageName=H,Ve.badRule=qa.rule,Ve}return 1}if(qa=re,re.type==="begin")return xN(re);if(re.type==="illegal"&&!$e){const Ve=new Error('Illegal lexeme "'+Te+'" for mode "'+(ke.scope||"<unnamed>")+'"');throw Ve.mode=ke,Ve}else if(re.type==="end"){const Ve=CN(re);if(Ve!==Ot)return Ve}if(re.type==="illegal"&&Te==="")return Je+=`
302
- `,1;if(Af>1e5&&Af>re.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Je+=Te,Te.length}const co=pr(H);if(!co)throw en(qe.replace("{}",H)),new Error('Unknown language: "'+H+'"');const EN=Wi(co);let Nf="",ke=Ke||EN;const Wy={},$t=new Y.__emitter(Y);SN();let Je="",Ka=0,Xr=0,Af=0,Of=!1;try{if(co.__emitTokens)co.__emitTokens(ae,$t);else{for(ke.matcher.considerAll();;){Af++,Of?Of=!1:ke.matcher.considerAll(),ke.matcher.lastIndex=Xr;const K=ke.matcher.exec(ae);if(!K)break;const re=ae.substring(Xr,K.index),Te=Uy(re,K);Xr=K.index+Te}Uy(ae.substring(Xr))}return $t.finalize(),Nf=$t.toHTML(),{language:H,value:Nf,relevance:Ka,illegal:!1,_emitter:$t,_top:ke}}catch(K){if(K.message&&K.message.includes("Illegal"))return{language:H,value:pe(ae),illegal:!0,relevance:0,_illegalBy:{message:K.message,index:Xr,context:ae.slice(Xr-100,Xr+100),mode:K.mode,resultSoFar:Nf},_emitter:$t};if(Qe)return{language:H,value:pe(ae),illegal:!1,relevance:0,errorRaised:K,_emitter:$t,_top:ke};throw K}}function Ef(H){const ae={value:pe(H),illegal:!1,relevance:0,_top:te,_emitter:new Y.__emitter(Y)};return ae._emitter.addText(H),ae}function Mf(H,ae){ae=ae||Y.languages||Object.keys(_);const $e=Ef(H),Ke=ae.filter(pr).filter(zy).map(vn=>Ks(vn,H,!1));Ke.unshift($e);const yt=Ke.sort((vn,ao)=>{if(vn.relevance!==ao.relevance)return ao.relevance-vn.relevance;if(vn.language&&ao.language){if(pr(vn.language).supersetOf===ao.language)return 1;if(pr(ao.language).supersetOf===vn.language)return-1}return 0}),[Jn,hr]=yt,Wa=Jn;return Wa.secondBest=hr,Wa}function uN(H,ae,$e){const Ke=ae&&j[ae]||$e;H.classList.add("hljs"),H.classList.add(`language-${Ke}`)}function Tf(H){let ae=null;const $e=wt(H);if(ge($e))return;if(Ua("before:highlightElement",{el:H,language:$e}),H.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",H);return}if(H.children.length>0&&(Y.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(H)),Y.throwUnescapedHTML))throw new be("One of your code blocks includes unescaped HTML.",H.innerHTML);ae=H;const Ke=ae.textContent,yt=$e?ft(Ke,{language:$e,ignoreIllegals:!0}):Mf(Ke);H.innerHTML=yt.value,H.dataset.highlighted="yes",uN(H,$e,yt.language),H.result={language:yt.language,re:yt.relevance,relevance:yt.relevance},yt.secondBest&&(H.secondBest={language:yt.secondBest.language,relevance:yt.secondBest.relevance}),Ua("after:highlightElement",{el:H,result:yt,text:Ke})}function dN(H){Y=ct(Y,H)}const fN=()=>{ja(),Ft("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function pN(){ja(),Ft("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Py=!1;function ja(){function H(){ja()}if(document.readyState==="loading"){Py||window.addEventListener("DOMContentLoaded",H,!1),Py=!0;return}document.querySelectorAll(Y.cssSelector).forEach(Tf)}function hN(H,ae){let $e=null;try{$e=ae(E)}catch(Ke){if(en("Language definition for '{}' could not be registered.".replace("{}",H)),Qe)en(Ke);else throw Ke;$e=te}$e.name||($e.name=H),_[H]=$e,$e.rawDefinition=ae.bind(null,E),$e.aliases&&Vy($e.aliases,{languageName:H})}function mN(H){delete _[H];for(const ae of Object.keys(j))j[ae]===H&&delete j[ae]}function gN(){return Object.keys(_)}function pr(H){return H=(H||"").toLowerCase(),_[H]||_[j[H]]}function Vy(H,{languageName:ae}){typeof H=="string"&&(H=[H]),H.forEach($e=>{j[$e.toLowerCase()]=ae})}function zy(H){const ae=pr(H);return ae&&!ae.disableAutodetect}function yN(H){H["before:highlightBlock"]&&!H["before:highlightElement"]&&(H["before:highlightElement"]=ae=>{H["before:highlightBlock"](Object.assign({block:ae.el},ae))}),H["after:highlightBlock"]&&!H["after:highlightElement"]&&(H["after:highlightElement"]=ae=>{H["after:highlightBlock"](Object.assign({block:ae.el},ae))})}function bN(H){yN(H),me.push(H)}function vN(H){const ae=me.indexOf(H);ae!==-1&&me.splice(ae,1)}function Ua(H,ae){const $e=H;me.forEach(function(Ke){Ke[$e]&&Ke[$e](ae)})}function kN(H){return Ft("10.7.0","highlightBlock will be removed entirely in v12.0"),Ft("10.7.0","Please use highlightElement now."),Tf(H)}Object.assign(E,{highlight:ft,highlightAuto:Mf,highlightAll:ja,highlightElement:Tf,highlightBlock:kN,configure:dN,initHighlighting:fN,initHighlightingOnLoad:pN,registerLanguage:hN,unregisterLanguage:mN,listLanguages:gN,getLanguage:pr,registerAliases:Vy,autoDetection:zy,inherit:ct,addPlugin:bN,removePlugin:vN}),E.debugMode=function(){Qe=!1},E.safeMode=function(){Qe=!0},E.versionString=ee,E.regex={concat:g,lookahead:p,either:b,optional:m,anyNumberOfTimes:h};for(const H in Me)typeof Me[H]=="object"&&n(Me[H]);return Object.assign(E,Me),E},cn=qs({});return cn.newInstance=()=>qs({}),Cp=cn,cn.HighlightJS=cn,cn.default=cn,Cp}var p8=f8();const h8=d8(p8);function WM(n,e=[]){return n.flatMap(t=>{const o=[...e,...t.properties?t.properties.className:[]];return t.children?WM(t.children,o):{text:t.value,classes:o}})}function tw(n){return n.value||n.children||[]}function m8(n){return!!h8.getLanguage(n)}function nw({doc:n,name:e,lowlight:t,defaultLanguage:o}){const r=[];return Xo(n,i=>i.type.name===e).forEach(i=>{var s;let l=i.pos+1;const a=i.node.attrs.language||o,u=t.listLanguages(),d=a&&(u.includes(a)||m8(a)||(s=t.registered)!=null&&s.call(t,a))?tw(t.highlight(a,i.node.textContent)):tw(t.highlightAuto(i.node.textContent));WM(d).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})}),xe.create(n,r)}function g8(n){return typeof n=="function"}function y8({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(r=>g8(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})=>nw({doc:i,name:n,lowlight:e,defaultLanguage:t}),apply:(r,i,s,l)=>{const a=s.selection.$head.parent.type.name,u=l.selection.$head.parent.type.name,d=Xo(s.doc,p=>p.type.name===n),f=Xo(l.doc,p=>p.type.name===n);return r.docChanged&&([a,u].includes(n)||f.length!==d.length||r.steps.some(p=>p.from!==void 0&&p.to!==void 0&&d.some(h=>h.pos>=p.from&&h.pos+h.node.nodeSize<=p.to)))?nw({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 b8=s1.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))||[],y8({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),v8=b8;const k8=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 w8(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 qM(n){return navigator.clipboard!==void 0?navigator.clipboard.writeText(n):new Promise((e,t)=>{const o=w8(n);o?e(!0):t(o)})}const x8=()=>sE(),C8={class:"code-block-toolbar"},S8={class:"wrap"},E8={class:"language readonly"},M8={class:"wrap"},T8=["srcdoc"],N8={key:1,ref:"mermaidMount",class:"tiptap ProseMirror mermaid-split-horizontal"},A8={key:0,class:"preview"},O8={key:0,class:"error"},$8=["innerHTML"],B8=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{commonDownload:t}=qd(),{tr:o}=ue(),{darkMode:r}=Vi(),{isEditable:i}=we(),s=c.ref("content_copy"),l=c.ref({show:!1,fullscreen:!1}),a=c.ref(""),u=c.ref(""),d=c.ref(""),f=c.ref(""),p=c.ref("splitVertical"),h=c.ref(""),m=c.ref("default");$f.registerLayoutLoaders(DN);const g={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},y=c.computed({get(){return e.node.attrs.language},set(U){e.updateAttributes({language:U})}}),b=c.computed(()=>{var U;return((U=e.node.content.content[0])==null?void 0:U.text)||""}),v=c.computed({get(){return e.node.attrs.wrap},set(U){e.updateAttributes({wrap:U})}}),w=c.computed(()=>["html","svg"].includes(y.value)),k=c.computed(()=>v.value?"text_select_move_down":"format_text_wrap"),x=c.computed(()=>y.value==="mermaid"),C=c.computed(()=>y.value==="mermaid"?i.value?p.value:"preview":"");function S(U){y.value=U}function M(){const U=e.node.content.content[0].text;qM(U).then(()=>{s.value="done",setTimeout(()=>{s.value="content_copy"},2e3)})}function N(U="code"){switch(U){case"svg":A();break;default:O();break}}function O(){const U=y.value;let he=U;const Se=rl.find(He=>He.value===U);Se&&(he=Se.ext.at(0));const _e=`${U}-${Date.now()}.${he}`,je=e.node.content.content[0].text;t("code",_e,je)}function A(){if(!d.value)return;const U=`mermaid-${Date.now()}.svg`,he=d.value;t("svg",U,he)}function $(){const U=e.node.content.content[0].text;u.value=R(U),a.value="run",l.value={show:!0,fullscreen:!1}}function D(){a.value==="mermaid"&&(p.value=h.value)}function R(U){return`
65
+ `],yd={key:0,class:"o-ai-menu tiptap-toolbar"},wd={key:0,class:"o-scroll"},xd={class:"view-main"},Cd={key:1,class:"view-output"},_d={class:"action-container"},Bd={style:{display:"flex"}},Vd={style:{padding:"0 4px"}},Nd={key:0},Ed={class:"actions"},Sd={key:0,class:"o-scroll"},Od=["innerHTML"],$d={class:"ai-io-panel"},Ad={class:"o-flex o-item-center actions"},Hl=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,r=o,{onStreamingChatCompletion:l}=n.aiOptions,{md:a}=hn(),{locale:i,tr:s}=P(),c=e.ref(),d=e.ref(!1),u=e.ref(""),p=e.ref(""),f=e.ref("main"),m=e.ref(""),b=e.ref(!1),g=e.ref(!1),k=e.ref({}),w=e.computed(()=>({role:"system",content:An.writing.replace("[LANG_CODE]",i.value)})),h=e.ref([{role:"system",content:""}]),x=e.computed(()=>{const N=u.value.toLowerCase();return ul.filter($=>{var L;return $.value.toLowerCase().indexOf(N)>=0||((L=$.tips)==null?void 0:L.indexOf(N))>=0})});function v(){const{from:N,to:$}=n.editor.state.selection;return n.editor.state.doc.textBetween(N,$,"")}function _(){setTimeout(()=>{d.value=!0},0)}function C(N,$){switch($&&(d.value=!0),m.value=N.options.prompt.replaceAll("[CONTENT]",v()),N.value){case"translate":m.value=m.value.replace("[LANGUAGE]",$.value);break;case"changeTone":m.value=m.value.replace("[TONE]",$.value);break}return u.value=s(N.label),k.value={...N,child:$},A(),!0}function O(){var N;V(),(N=c.value)==null||N.focus()}function M(){const N=JSON.parse(JSON.stringify(xn(n.editor,p.value))),$=n.editor.schema.nodeFromJSON(N),{from:L}=n.editor.state.selection,q=$.content.size;n.editor.chain().focus().deleteSelection().insertContent(N,{updateSelection:!0}).setTextSelection({from:L,to:L+q}).run(),V(),d.value=!1,setTimeout(()=>{r("confirm")},0)}function A(){f.value="output",b.value=!0,g.value?z():T()}async function T(){let N="";if(h.value.push({role:"user",content:m.value}),h.value[0].role==="system"&&(h.value.shift(),h.value.unshift(w.value)),!l){Jt.error("AI Completion method not implemented."),b.value=!1;return}try{const $=await l({messages:h.value,onChunk:L=>{N+=L,h.value=[...h.value.slice(0,-1),{role:"assistant",content:N}],p.value=a.render(N)}})}catch($){h.value.pop(),console.error($),Jt.error(s("ai.error"))}finally{b.value=!1}}async function z(){let N="";for(const $ of ql)await new Promise(L=>setTimeout(L,500)),N+=$,p.value=a.render(N);b.value=!1}function V(){f.value="main",p.value="",u.value=""}return e.onMounted(()=>{setTimeout(()=>{var N;(N=c.value)==null||N.focus(),d.value=!0},300)}),(N,$)=>t.editor?(e.openBlock(),e.createElementBlock("section",yd,[e.createVNode(e.unref(je),{modelValue:d.value,"onUpdate:modelValue":$[1]||($[1]=L=>d.value=L),offset:[-4,10],placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":e.withCtx(()=>{var L;return[f.value==="main"?(e.openBlock(),e.createElementBlock("div",wd,[e.createElementVNode("section",xd,[e.createVNode(e.unref(Ao),{items:x.value,onSelect:C,"use-keyboard":d.value},null,8,["items","use-keyboard"])])])):e.createCommentVNode("",!0),f.value==="output"?(e.openBlock(),e.createElementBlock("section",Cd,[e.createElementVNode("div",_d,[e.createElementVNode("div",Bd,[e.createVNode(e.unref(E),{name:"auto_awesome",class:"o-tips"}),e.createElementVNode("div",Vd,[e.createTextVNode(e.toDisplayString(e.unref(s)(k.value.label))+" ",1),(L=k.value.child)!=null&&L.label?(e.openBlock(),e.createElementBlock("span",Nd,": "+e.toDisplayString(e.unref(s)(k.value.child.label)),1)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ed,[e.createVNode(e.unref(Ze),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(s)("label.confirm"),loading:b.value,onClick:M},null,8,["tooltip","loading"]),b.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(Ze),{key:0,icon:"close",tooltip:e.unref(s)("label.cancel"),onClick:O},null,8,["tooltip"]))])]),p.value?(e.openBlock(),e.createElementBlock("div",Sd,[e.createElementVNode("div",{class:"tiptap output",innerHTML:p.value},null,8,Od)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createElementVNode("section",$d,[e.createVNode(e.unref(Ee),{ref_key:"inputRef",ref:c,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":$[0]||($[0]=L=>u.value=L),type:"text",placeholder:e.unref(s)("ai.askAi"),autofocus:"",onFocus:_},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"auto_awesome",class:"o-tips"})]),suffix:e.withCtx(()=>[e.createElementVNode("div",Ad,[e.createVNode(e.unref(Ze),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0)}}),Td={key:0,class:"o-inline-math-menu tiptap-toolbar"},Ul=e.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:oe.Editor,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:o}){const n=t,r=o,{run:l}=U(),a=e.ref(null),i=e.ref(""),s=e.ref(null);e.computed(()=>{const p=ft.InlinePlaceholderKey.getState(n.editor.state);return!!(p!=null&&p.active)});function c(){if(i.value="",s.value=null,n.editor.isActive("inlineMath")){const{state:p}=n.editor,{selection:f,schema:m}=p;if(f instanceof We.NodeSelection){const b=f.node;s.value=f.from,b.type.name==="inlineMath"&&(i.value=b.attrs.latex)}}setTimeout(()=>{var p;(p=a.value)==null||p.focus()},300)}function d(){console.log("latex",i.value,s.value),s.value?i.value?l(n.editor,"inlineMathUpdate",{latex:i.value}):l(n.editor,"inlineMathDelete",{pos:s.value}):i.value&&l(n.editor,"inlineMathInsert",{latex:i.value}),setTimeout(()=>{r("confirm")},0)}const u=()=>{n.editor.view.dispatch(n.editor.state.tr.setMeta(ft.InlinePlaceholderKey,{type:"hide"}))};return e.onMounted(()=>{c(),n.editor.on("focus",u)}),e.onUnmounted(()=>{n.editor.off("focus",u)}),(p,f)=>t.editor?(e.openBlock(),e.createElementBlock("section",Td,[e.createVNode(e.unref(Ee),{ref_key:"input",ref:a,modelValue:i.value,"onUpdate:modelValue":f[0]||(f[0]=m=>i.value=m),type:"text",autofocus:"",clearable:"",onKeydown:e.withKeys(e.withModifiers(d,["prevent"]),["enter"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"function",class:"o-tips"})]),suffix:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:d})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):e.createCommentVNode("",!0)}}),Dd={key:0,class:"spinner"},Ze=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,r=o;function l(a){n.loading||r("click",a)}return(a,i)=>(e.openBlock(),e.createBlock(e.unref(xe),{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(l,["stop"])},[t.loading?(e.openBlock(),e.createElementBlock("div",Dd)):(e.openBlock(),e.createBlock(e.unref(E),{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"]))}}),Md=e.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const{tr:o}=P();return(n,r)=>(e.openBlock(),e.createBlock(Ze,{"content-class":"o-ai-btn",icon:"auto_awesome",color:e.unref(H).purple,tooltip:e.unref(o)("ai.askAi")},null,8,["color","tooltip"]))}}),Ld={class:"o-align-group"},Pd=e.defineComponent({__name:"OAlignGroup",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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){r(o.editor,"textAlign",{textAlign:i.value})}return(i,s)=>(e.openBlock(),e.createElementBlock("div",Ld,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(c,d)=>{var u;return e.openBlock(),e.createBlock(X,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive({textAlign:c.value})},onClick:p=>a(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),Rd={class:"o-background-color-dropdown o-button-group"},Id=e.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(null),a=e.ref("#ffec3d");function i(){s(a.value)}function s(c){l.value.setShow(!1),a.value=c,r(o.editor,"backgroundColor",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(xe),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",Rd,[e.createVNode(e.unref(ee),{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(ee),{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 u;return[e.createVNode(e.unref(vt),{"default-color":"","default-label":e.unref(n)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").backgroundColor,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),jd={class:"o-highlight-dropdown o-button-group"},Fd=e.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(null),a=e.ref("#ffec3d");function i(){s(a.value)}function s(c){l.value.setShow(!1),a.value=c,r(o.editor,"highlight",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(xe),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",jd,[e.createVNode(e.unref(ee),{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(ee),{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 u;return[e.createVNode(e.unref(vt),{"default-color":"","default-label":e.unref(n)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("highlight").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),zd=e.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(t){const o=t,{run:n}=U(),{tr:r}=P();function l(){const{state:a}=o.editor,{selection:i}=a,{$from:s}=i,d=s.node().type.name;n(o.editor,"details",{type:d})}return(a,i)=>{var s;return e.openBlock(),e.createBlock(X,{class:"o-details-btn",icon:"toggle_list",tooltip:e.unref(r)("editor.toggleList"),"content-class":{"is-active":(s=t.editor)==null?void 0:s.isActive("details")},onClick:l},null,8,["tooltip","content-class"])}}}),qd=e.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(null);function a(i){var s;(s=l.value)==null||s.setShow(!1),r(o.editor,"content",{content:i.emoji})}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:e.unref(n)("editor.emoji")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(To),{items:e.unref(Ht.emojiGroups),onSelect:a,"enable-search":""},null,8,["items"])]),_:1},512))}}),Hd=e.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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=l.value)==null||c.setShow(!1),r(o.editor,"fontFamily",{fontFamily:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:e.unref(n)("editor.fontFamily")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(d,u)=>{var p;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[d.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ie),{class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive("textStyle",{fontFamily:d.value})}),onClick:f=>i(d.value)},{suffix:e.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive("textStyle",{fontFamily:d.value})?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createElementVNode("span",{style:e.normalizeStyle(`font-family: ${d.value}`)},e.toDisplayString(d.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),Ud={class:"o-fore-color-dropdown o-button-group"},Wd=e.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(null),a=e.ref("#ff4d4f");function i(){s(a.value)}function s(c){var d;(d=l.value)==null||d.setShow(!1),a.value=c,r(o.editor,"color",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(xe),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",Ud,[e.createVNode(e.unref(ee),{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(ee),{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 u;return[e.createVNode(e.unref(vt),{"default-color":"","default-label":e.unref(n)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),Yd=e.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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 d,u;return c.value==="heading"?(d=o.editor)==null?void 0:d.isActive(c.value,{level:c.valueAlt}):(u=o.editor)==null?void 0:u.isActive(c.value)}function s(c){var d;(d=l.value)==null||d.setShow(!1),r(o.editor,c.value,{level:c.valueAlt})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:e.unref(n)("editor.heading")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ie),{class:e.normalizeClass({"is-active":i(u)}),onClick:f=>s(u)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:u.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(u)?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),Gd=e.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(),a=e.ref(!1),i=e.ref(""),s=e.ref(null);function c(){if(o.editor.isActive("inlineMath")){const{state:f}=o.editor,{selection:m,schema:b}=f;if(m instanceof We.NodeSelection){const g=m.node;s.value=m.from,g.type.name==="inlineMath"&&(i.value=g.attrs.latex)}}}function d(){var f;(f=l.value)==null||f.setShow(!1)}function u(f){var m;console.log("confirm",f),f?r(o.editor,"inlineMathUpdate",{latex:f,pos:s.value}):r(o.editor,"inlineMathDelete",{pos:s.value}),(m=l.value)==null||m.setShow(!1)}function p(){window.open("https://katex.org/docs/supported.html","target")}return(f,m)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:a.value,"onUpdate:show":[m[0]||(m[0]=b=>a.value=b),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"edit",tooltip:e.unref(n)("label.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[a.value?(e.openBlock(),e.createBlock(e.unref(Do),{key:0,title:e.unref(n)("label.edit"),val:i.value,icon:"function",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"help",tooltip:e.unref(n)("label.help"),onClick:p},null,8,["tooltip"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Kd={class:"o-list-dropdown o-button-group"},Xd=e.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(null),a=e.ref();function i(){r(o.editor,a.value.value)}function s(d){l.value.setShow(!1),a.value=d,r(o.editor,d.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]}),(d,u)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(xe),null,{trigger:e.withCtx(()=>{var p;return[e.createElementVNode("div",Kd,[e.createVNode(e.unref(ee),{icon:(p=a.value)==null?void 0:p.icon,class:"o-command-btn",onClick:e.withModifiers(i,["stop"])},null,8,["icon"]),e.createVNode(e.unref(ee),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:e.withCtx(()=>{var p;return[e.createTextVNode(" "+e.toDisplayString((p=a.value)==null?void 0:p.label),1)]}),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(p,f)=>{var m;return e.openBlock(),e.createBlock(e.unref(ie),{key:f,class:e.normalizeClass({"is-active":(m=t.editor)==null?void 0:m.isActive(p.value)}),onClick:b=>s(p)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:p.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var b;return[(b=t.editor)!=null&&b.isActive(p.value)?(e.openBlock(),e.createBlock(e.unref(E),{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},512))}}),Jd={class:"o-list-group"},Zd=e.defineComponent({__name:"OListGroup",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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){r(o.editor,i.value)}return(i,s)=>(e.openBlock(),e.createElementBlock("div",Jd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(c,d)=>{var u;return e.openBlock(),e.createBlock(X,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive(c.value)},onClick:p=>a(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),Qd=e.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(),a=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var f;i.value="",s.value=!0;const p=(f=o.editor)==null?void 0:f.getAttributes("link");p!=null&&p.href&&(i.value=p.href,s.value=p.target==="_blank")}function d(){var p;(p=l.value)==null||p.setShow(!1)}function u(p){var f;p?r(o.editor,"linkSet",{href:p,target:s.value?"_blank":""}):r(o.editor,"linkUnset"),(f=l.value)==null||f.setShow(!1)}return(p,f)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:a.value,"onUpdate:show":[f[1]||(f[1]=m=>a.value=m),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"edit",tooltip:e.unref(n)("link.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[a.value?(e.openBlock(),e.createBlock(e.unref(Do),{key:0,title:e.unref(n)("link.edit"),val:i.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(On),{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[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"]))}}),ep=e.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P();function r(){var a;const l=(a=o.editor)==null?void 0:a.getAttributes("link");l!=null&&l.href&&window.open(l.href,"target")}return(l,a)=>(e.openBlock(),e.createBlock(X,{icon:"open_in_new",tooltip:e.unref(n)("link.open"),"content-class":"o-link-open-btn",onClick:r},null,8,["tooltip"]))}}),tp={class:"o-command-btn"},op={class:"o-more-bubble"},np=e.defineComponent({__name:"OMoreBubble",props:{editor:{type:oe.Editor,required:!0}},setup(t){const o=e.ref();return(n,r)=>(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",tp,[e.createVNode(e.unref(E),{name:"more_horiz"})])]),default:e.withCtx(()=>[e.createElementVNode("section",op,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(jl),(l,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:a},[l==="separator"?(e.openBlock(),e.createBlock(e.unref(fe),{key:0,vertical:""})):typeof l=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Io)(l)),{key:1,name:l,editor:t.editor},null,8,["name","editor"])):e.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),rp=e.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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 d;return(d=o.editor)==null?void 0:d.isActive(c.value,c.options)}function s(c){l.value.setShow(!1),r(o.editor,c.value,c.options)}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{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(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ie),{class:e.normalizeClass({"is-active":i(u)}),onClick:f=>s(u)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:u.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(u)?(e.openBlock(),e.createBlock(e.unref(E),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),lp=e.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=e.ref(null);function a(i){var s;(s=l.value)==null||s.setShow(!1),r(o.editor,"tableInsert",i)}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"window","content-class":"o-table-btn",tooltip:e.unref(n)("table.insert")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(fl),{onSelect:a})]),_:1},512))}}),ap={class:"o-table-group"},ip=e.defineComponent({__name:"OTableGroup",props:{editor:{type:oe.Editor,required:!0}},setup(t){const{tr:o}=P(),{run:n}=U();return(r,l)=>{var a,i;return e.openBlock(),e.createElementBlock("section",ap,[(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:l[0]||(l[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:l[1]||(l[1]=s=>e.unref(n)(t.editor,"tableSplitCell"))},null,8,["tooltip"])):e.createCommentVNode("",!0),e.createVNode(e.unref(ml),{editor:t.editor},null,8,["editor"])])}}}),cp=e.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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)),l.value.setShow(!1),r(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,d)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:e.unref(n)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(_n),{"fore-color":a.value,"back-color":i.value,"default-label":e.unref(n)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:s},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),sp=e.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:oe.Editor}},setup(t){const o=t,{tr:n}=P(),{run:r}=U(),l=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=l.value)==null||c.setShow(!1),r(o.editor,s)}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(Z),{ref_key:"popover",ref:l,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ae),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:e.unref(n)("editor.textFormat")},{default:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(d,u)=>{var p;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[d.separator?(e.openBlock(),e.createBlock(e.unref(fe),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(ie),{class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(d.value)}),onClick:f=>i(d.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var f;return[(f=t.editor)!=null&&f.isActive(d.value)?(e.openBlock(),e.createBlock(e.unref(E),{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))}}),up={ai:Md,"align-dropdown":yn,"align-group":Pd,"background-color":Id,color:Wd,details:zd,"extension-dropdown":ll,"font-family":Hd,heading:Yd,highlight:Fd,"inline-math-edit":Gd,"list-dropdown":Xd,"list-group":Zd,link:wn,"link-edit":Qd,"link-open":ep,emoji:qd,more:np,"style-dropdown":rp,table:lp,"table-group":ip,"text-color-dropdown":cp,"text-format-dropdown":sp},Io=t=>up[t]||Nc,dp={key:0,class:"o-main-menu"},pp={class:"left"},fp={class:"right"},Wl=e.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(t){const o=t,n=e.computed(()=>{var l;let r=o.menu;return(l=o.editor)!=null&&l.isActive("table")&&(r=Dl),r.length>0?r:Tl});return(r,l)=>t.editor?(e.openBlock(),e.createElementBlock("section",dp,[e.createElementVNode("section",pp,[(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(Io)(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(r.$slots,"left")]),e.createElementVNode("section",fp,[e.renderSlot(r.$slots,"right")])])):e.createCommentVNode("",!0)}}),mp={key:0},vp=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}=P(),{theme:r}=bt(),l=e.ref(!1),a=e.ref(!1),i=e.ref(!1),s=e.ref(!1),c=e.ref({offset:10,placement:"bottom-start",onShow:()=>{l.value=!1,a.value=!1,i.value=!1},onHide:()=>{i.value=!1}});function d(){l.value=!0}function u(x){x==="ai"&&(a.value=!0)}function p(){i.value=!0}function f(x){const{schema:v}=o.editor,_=v.marks.link;if(!_||!x)return!1;const{$from:C,$to:O}=x;return!!oe.getMarkRange(C,_)}function m({editor:x,element:v,view:_,state:C,oldState:O,from:M,to:A}){var I;const{doc:T,selection:z}=C,{empty:V}=z,N=!T.textBetween(M,A).length&&oe.isTextSelection(C.selection);if(s.value=o.editor.isActive("inlineMath"),h.value||o.editor.isActive("inlineMath"))return!0;if(!_.hasFocus()||V||i.value||N&&x.isActive("link")&&!x.isActive("image"))return!1;const $=["image"],L=["image","toc","video","model-viewer"],q=z.node,G=(I=q==null?void 0:q.type)==null?void 0:I.name;return!(x.isActive("codeBlock")||L.indexOf(G)>=0||G&&!$.includes(G))}const b=e.computed(()=>{if(o.editor){const{state:x}=o.editor,{tr:v}=x,{selection:_}=v;return f(_)}else return!1}),g=e.computed(()=>{var x,v;return!l.value&&!((x=o.editor)!=null&&x.isActive("image"))&&(b.value||((v=o.editor)==null?void 0:v.isActive("inlineMath")))}),k=e.computed(()=>h.value||s.value),w=e.computed(()=>{var v,_,C;let x=o.menu;return l.value||((v=o.editor)!=null&&v.isActive("image")?x=b.value?Il:Rl:(_=o.editor)!=null&&_.isActive("table")?x=Fl:b.value?x=Pl:(C=o.editor)!=null&&C.isActive("inlineMath")&&(x=Ll)),x.length>0?x:Ml}),h=e.computed(()=>{const x=ft.InlinePlaceholderKey.getState(o.editor.state);return!!(x!=null&&x.active)});return e.onMounted(()=>{l.value=!1}),(x,v)=>t.editor?(e.openBlock(),e.createElementBlock("section",mp,[e.createVNode(e.unref(vr.BubbleMenu),{editor:t.editor,"should-show":m,options:c.value},{default:e.withCtx(()=>[a.value?(e.openBlock(),e.createBlock(e.unref(Hl),{key:0,editor:t.editor,"ai-options":t.aiOptions,onConfirm:p},null,8,["editor","ai-options"])):k.value?(e.openBlock(),e.createBlock(e.unref(Ul),{key:1,editor:t.editor},null,8,["editor"])):(e.openBlock(),e.createElementBlock("section",{key:2,class:e.normalizeClass(["tiptap-toolbar",t.menuClass])},[g.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(X),{icon:"arrow_back",tooltip:e.unref(n)("link.back"),onClick:d},null,8,["tooltip"]),e.createVNode(e.unref(fe),{vertical:""})],64)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,(_,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:C},[_==="separator"?(e.openBlock(),e.createBlock(e.unref(fe),{key:0,vertical:""})):typeof _=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Io)(_)),{key:1,name:_,editor:t.editor,onClick:O=>u(_)},null,8,["name","editor","onClick"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(_),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}}),gp={key:0},bp=e.defineComponent({__name:"OFloatingMenu",props:{editor:{type:R.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),r=e.ref({placement:"right",offset:168});function l(){n.value=!0}function a(u){const{schema:p}=o.editor,f=p.marks.link;if(!f||!u)return!1;const{$from:m,$to:b}=u;return!!oe.getMarkRange(m,f)}const i=e.computed(()=>{if(o.editor){const{state:u}=o.editor,{tr:p}=u,{selection:f}=p;return a(f)}else return!1}),s=e.computed(()=>!n.value&&i.value),c=e.computed(()=>{const u=o.menu;return u.length>0?u:zl}),d=e.computed(()=>{const u=ft.InlinePlaceholderKey.getState(o.editor.state);return!!(u!=null&&u.active)});return(u,p)=>t.editor&&!d.value?(e.openBlock(),e.createElementBlock("section",gp,[e.createVNode(e.unref(vr.FloatingMenu),{editor:t.editor,options:r.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:l})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(f,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m},[f==="separator"?(e.openBlock(),e.createBlock(e.unref(fe),{key:0,vertical:""})):typeof f=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Io)(f)),{key:1,name:f,editor:t.editor},null,8,["name","editor"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2)]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}});function Tn(t,o){const n=o==null?void 0:o.posAtCoords(t);if(!n)return;let r=bo(n.pos,o);if(r!==o.dom){for(;r&&r.parentNode&&r.parentNode!==o.dom;)r=r.parentNode;if(r)return r}}function bo(t,o){return o.nodeDOM(t)||o.domAtPos(t).node}function Dn(t,o){const n=Tn(t,o);if(n&&n.nodeType===1){const r=o.docView,l=r.nearestDesc(n,!0);return!l||l===r?null:l.posBefore}return null}function hp(t,o){let n,r;const l=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(l&&a){const s=t.$from.start(i-1),c=t.$to.end(i-1);n=o.resolve(s-1).pos,r=o.resolve(c+1).pos}else n=t.from,r=t.to;return{from:n,to:r}}function kp(t,o){const n=Dn(t,o.view);return typeof n=="number"&&n>=0?{node:o.state.doc.nodeAt(n),pos:n}:{node:null,pos:n}}const Zt=new We.PluginKey("sideMenu");class yp{constructor(){te(this,"hovered",!1);te(this,"coords",{left:0,top:0});te(this,"className","")}init(o){return this}apply({tr:o,oldState:n,newState:r}){return o.docChanged?this:this}setHover(o,n,r=""){this.hovered=o,this.coords=n,this.className=r}}class wp{constructor({editor:o,element:n,view:r,tippyOptions:l={},updateDelay:a=250}){te(this,"editor");te(this,"element");te(this,"view");te(this,"preventHide",!1);te(this,"tippy");te(this,"tippyOptions");te(this,"updateDelay");te(this,"updateDebounceTimer");te(this,"mousedownHandler",()=>{this.preventHide=!0});te(this,"onDragStart",o=>{this.hide()});te(this,"blurHandler",({event:o})=>{var n;o!=null&&o.relatedTarget&&((n=this.element.parentNode)!=null&&n.contains(o.relatedTarget))||this.hide()});te(this,"tippyBlurHandler",o=>{this.blurHandler({event:o})});te(this,"handleDebouncedUpdate",(o,n)=>{const r=!(n!=null&&n.selection.eq(o.state.selection)),l=!(n!=null&&n.doc.eq(o.state.doc));!r&&!l||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(o,r,l,n)},this.updateDelay))});te(this,"updateHandler",(o,n,r,l)=>{var d,u;const{state:a,composing:i}=o,{coords:s}=Zt.getState(a),c=Tn(s,o);Dn(s,o),c&&(this.createTooltip(),(u=this.tippy)==null||u.setProps({getReferenceClientRect:((d=this.tippyOptions)==null?void 0:d.getReferenceClientRect)||(()=>c.getBoundingClientRect())}),this.show())});this.editor=o,this.element=n,this.view=r,this.updateDelay=a,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=l,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,r=!!(n!=null&&n.parentElement);this.tippy||!r||(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:r}=o,l=!(n!=null&&n.selection.eq(o.state.selection)),a=!(n!=null&&n.doc.eq(o.state.doc));this.updateHandler(o,l,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 xp=(t,o)=>{if(!t.dataTransfer)return;const{view:n}=o;n.dom.getBoundingClientRect();const r=Zt.getState(n.state),l={left:r.coords.left,top:r.coords.top},a=Dn(l,n);if(a===null)return;const i=n.state.selection,s=n.state.doc;hp(i,s),n.dispatch(n.state.tr.setSelection(We.NodeSelection.create(n.state.doc,a))),n.dom.classList.add("is-dragging"),_p(n,a);const c=n.state.selection.content(),{dom:d,text:u}=n.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",d.innerHTML),t.dataTransfer.setData("text/plain",u),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(pt,0,0),n.dragging={slice:c,move:!0}},Cp=(t,o)=>{const{view:n}=o;n.dom.classList.remove("is-dragging"),Yl()};let pt;function _p(t,o,n=o){const r=t.domAtPos(o).node.cloneNode(!0),l=t.domAtPos(o).node,a=(p,f)=>Array.prototype.indexOf.call(p.children,f),i=p=>{let f=p,m=f.parentElement;for(;m;){if(m===t.dom)return f;f=m,m=f.parentElement}return f};let s=-1,c=-1;o===n?(s=a(l,i(bo(o,t))),c=s):(s=a(l,i(bo(o+1,t))),c=a(l,i(bo(n-1,t))));for(let p=l.childElementCount-1;p>=0;p--)(p>s||p<c)&&r.removeChild(r.children[p]);Yl(),pt=r;const u=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");pt.className+=" yiitap-dragging-preview "+u,document.body.appendChild(pt)}function Yl(){pt!==void 0&&(document.body.removeChild(pt),pt=void 0)}class Bp{constructor(o){te(this,"options");te(this,"plugin");te(this,"sideMenuView");const n=new yp;this.options=o,this.plugin=new We.Plugin({key:Zt,props:{handleDOMEvents:{mouseover(r,l){const a={left:l.clientX,top:l.clientY},i=Tn(a,r),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),r.dispatch(r.state.tr.setMeta(Zt,n)))}}},state:{init(r,l){return n.init(l)},apply(r,l,a,i){return n.apply({tr:r,oldState:a,newState:i})}},view:r=>(this.sideMenuView=new wp({view:r,...o}),this.sideMenuView)})}dragstart(o){xp(o,this.options.editor)}dragend(o){Cp(o,this.options.editor)}}const Vp=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 r=e.ref(null),l=e.ref(),a=s=>{var c;(c=l.value)==null||c.dragstart(s)},i=s=>{var c;(c=l.value)==null||c.dragend(s)};return e.onMounted(()=>{const{pluginKey:s,editor:c,updateDelay:d,tippyOptions:u}=t;l.value=new Bp({updateDelay:d,editor:c,element:r.value,pluginKey:s,tippyOptions:u}),c.registerPlugin(l.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:r},(s=n.default)==null?void 0:s.call(n))}}}),Np={key:0,class:"o-side-menu"},Ep={class:"container"},Sp=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),r=e.ref(null),l=e.ref(0),a=e.computed(()=>({arrow:!1,duration:100,placement:"left"})),i=e.computed(()=>({editor:o.editor,node:r.value,decorations:[],selected:!1,extension:{},getPos:()=>l.value,pos:l.value,updateAttributes:c,deleteNode:s,view:{},innerDecorations:[],HTMLAttributes:{},add:o.add}));function s(){var b,g;const f=l.value,m=f+((b=r.value)==null?void 0:b.nodeSize);(g=o.editor)==null||g.commands.deleteRange({from:f,to:m})}function c(f){var m;(m=o.editor)==null||m.commands.command(({tr:b})=>{var g;return b.setNodeMarkup(l.value,void 0,{...(g=r.value)==null?void 0:g.attrs,...f}),!0})}function d({editor:f,transaction:m}){let b={left:0,top:0};const g=Zt.getState(o.editor.view.state);if(g){b=g.coords;const k=kp(b,f);k.node&&(o.title&&k.pos===0?r.value=null:(!o.title||k.pos>0)&&(r.value=k.node,l.value=k.pos))}}function u(f){var m;(m=n.value)==null||m.dragstart(f)}function p(f){var m;(m=n.value)==null||m.dragend(f)}return e.onMounted(()=>{var f;(f=o.editor)==null||f.on("transaction",d)}),(f,m)=>t.editor?(e.openBlock(),e.createElementBlock("section",Np,[e.createVNode(e.unref(Vp),{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",Ep,[r.value?(e.openBlock(),e.createBlock(e.unref(Nl),e.normalizeProps(e.mergeProps({key:0},i.value)),null,16)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(e.unref(El),e.mergeProps({key:1},i.value,{onDragstart:u,onDragend:p}),null,16)):e.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):e.createCommentVNode("",!0)}}),Op={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:o}=P(),{run:n}=U();return{locale:t,tr:o,run:n}},data(){return{view:"main"}},components:{OEmojiSelect:To},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},Mn=(t,o)=>{const n=t.__vccOpts||t;for(const[r,l]of o)n[r]=l;return n},$p={class:"o-colon-view"};function Ap(t,o,n,r,l,a){const i=e.resolveComponent("o-emoji-select");return e.openBlock(),e.createElementBlock("section",$p,[e.createVNode(i,{items:n.items,onSelect:a.onSelect},null,8,["items","onSelect"])])}const Tp=Mn(Op,[["render",Ap]]),Gl={items:({query:t})=>Ht.filterEmojiGroups(t),render:()=>{let t,o;return{onStart:n=>{t=new R.VueRenderer(Tp,{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(r){r.popper.classList.add("emoji-tippy")}}))},onUpdate(n){t.updateProps(n),o[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var r;return n.event.key==="Escape"?(o[0].hide(),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(n)},onExit(){o[0].destroy(),t.destroy()}}}},Dp={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:oe.Editor},range:{type:Object}},setup(){const{locale:t,tr:o}=P(),{onCommand:n,run:r}=U();return{locale:t,tr:o,onCommand:n,run:r}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:fe,OIcon:E,OList:ue,OListItem:ie},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 to.slice(1)}},mounted(){this.selectedIndex=0}},Mp={key:0,class:"view-main"},Lp={class:"group o-tips"},Pp={class:"o-tips"},Rp={key:1,class:"item"},Ip={key:1,class:"view-emoji"},jp={key:2,class:"view-emoji"};function Fp(t,o,n,r,l,a){const i=e.resolveComponent("o-divider"),s=e.resolveComponent("o-icon"),c=e.resolveComponent("o-list-item"),d=e.resolveComponent("o-list");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${l.view}`])},[l.view==="main"?(e.openBlock(),e.createElementBlock("section",Mp,[e.createVNode(d,{hoverable:"",clickable:""},{default:e.withCtx(()=>[n.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(n.items,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[p>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",Lp,e.toDisplayString(r.tr(u.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(c,{class:e.normalizeClass(["item",{"is-active":p===l.selectedIndex}]),clickable:"",onClick:f=>a.onClick(u)},{prefix:e.withCtx(()=>[e.createVNode(s,{name:u.icon,color:u.color},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("span",Pp,e.toDisplayString(u.tips),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(r.tr(u.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",Rp,"No result"))]),_:1})])):l.view==="emoji"?(e.openBlock(),e.createElementBlock("section",Ip)):l.view==="ai"?(e.openBlock(),e.createElementBlock("section",jp)):e.createCommentVNode("",!0)],2)}const zp=Mn(Dp,[["render",Fp]]),an={items:({query:t})=>xo.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 R.VueRenderer(zp,{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:r=>{r.popper.classList.add("slash-tippy")}}))},onUpdate(n){t.updateProps(n),o[0].setProps({getReferenceClientRect:n.clientRect})},onKeyDown(n){var r;return n.event.key==="Escape"?(o[0].hide(),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(n)},onExit(){o[0].destroy(),t.destroy()}}}},qp={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})}}},Hp={class:"dropdown-menu"},Up=["onClick"],Wp=["src"];function Yp(t,o,n,r,l,a){return e.openBlock(),e.createElementBlock("div",Hp,[(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===l.selectedIndex}),key:s,onClick:c=>a.selectItem(s)},[i.fallbackImage?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.fallbackImage,align:"middle"},null,8,Wp)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i.emoji),1)],64)),e.createTextVNode(" :"+e.toDisplayString(i.name)+": ",1)],10,Up))),128))])}const Gp=Mn(qp,[["render",Yp]]),Kp={items:({editor:t,query:o})=>t.storage.emoji.emojis.filter(({shortcodes:n,tags:r})=>n.find(l=>l.startsWith(o.toLowerCase()))||r.find(l=>l.startsWith(o.toLowerCase()))).slice(0,10),render:()=>{let t;function o(n){if(!t||!t.element)return;Vl({getBoundingClientRect(){return n}},t.element,{placement:"bottom-start"}).then(l=>{Object.assign(t.element.style,{left:`${l.x}px`,top:`${l.y}px`,position:l.strategy==="fixed"?"fixed":"absolute"})})}return{onStart:n=>{t=new R.VueRenderer(Gp,{props:n,editor:n.editor}),document.body.appendChild(t.element),o(n.clientRect())},onUpdate(n){t.updateProps(n),o(n.clientRect())},onKeyDown(n){var r;return n.event.key==="Escape"?(document.body.removeChild(t.element),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(n)},onExit(){document.body.contains(t.element)&&document.body.removeChild(t.element),t.destroy()}}}},Xp={class:"o-scroll"},Jp={class:"view-main"},Zp={class:"block-container"},Qp={class:"block-content"},ef={key:0,class:"edit-prompt"},tf={key:1},of={"data-tippy-role":"tooltip"},nf={class:"label"},rf={class:"block-container"},lf={class:"block-content"},af=100,cf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{md:n}=hn(),{languageName:r,tr:l}=P(),{isFocused:a,bind:i,unbind:s,checkFocus:c}=tl(),{theme:d}=bt(),{isEditable:u}=U(),{getPos:p}=o,{provider:f,onStreamingChatCompletion:m}=o.extension.options,b=e.ref(null),g=e.ref(""),k=e.ref(!1),w=e.ref({}),h=e.ref(!1),x=e.ref(!1),v=e.ref(""),_=e.ref(null),C=e.ref(!1),O=e.ref(!1);let M=0;const A=e.computed(()=>({role:"system",content:An.writing.replace("[LANGUAGE]",r.value)})),T=e.ref([A.value]),z=e.computed(()=>!o.node.textContent),V=e.computed(()=>dl),N=e.computed({get(){return o.node.attrs.provider},set(j){o.updateAttributes({provider:j})}}),$=e.computed({get(){return o.node.attrs.prompt},set(j){o.updateAttributes({prompt:j})}}),L=e.computed({get(){return o.node.attrs.time},set(j){o.updateAttributes({time:j})}});function q(){g.value=$.value,z.value&&!$.value&&setTimeout(()=>{var j;(j=b.value)==null||j.focus()},0)}function G(){setTimeout(()=>{},0)}function I(){v.value="edit",setTimeout(()=>{var j;(j=_.value)==null||j.focus()},0)}function S(){N.value=f.provider,$.value=g.value,L.value=Date.now(),C.value=!0,v.value&&(v.value=""),O.value?de():K()}async function K(){const j=p();let Y="";if(T.value.push({role:"user",content:$.value}),T.value[0].role==="system"&&(T.value.shift(),T.value.unshift(A.value)),!m){Jt.error("AI Completion method not implemented."),C.value=!1;return}try{const J=await m({messages:T.value,options:{id:o.node.attrs.id,type:"ai-block"},onChunk:le=>{Y+=le,T.value=[...T.value.slice(0,-1),{role:"assistant",content:Y}];const Se=Date.now();Se-M>af&&(Q(j,Y),M=Se)}});Q(j,Y)}catch(J){T.value.pop(),console.error(J),Jt.error(l("ai.error"))}finally{C.value=!1}}function Q(j,Y){const J=n.render(Y),le=xn(o.editor,J);me(j,le)}async function de(){const j=p();let Y="";try{for(const J of ql){await new Promise(Se=>setTimeout(Se,500)),Y+=J;const le=al(o.editor,n.render(Y));me(j,le)}}catch(J){console.error(J)}C.value=!1}function me(j,Y){var le;const J=o.node.toJSON();J.content=Y.content,(le=o.editor)==null||le.commands.updateAiBlock(j,J),o.editor.commands.setNodeSelection(j),o.editor.view.focus(),ce()}function ce(){const Y=o.node.content.lastChild;if(Y&&Y.attrs.id){const J=Y.attrs.id,le=document.querySelector(`[data-id="${J}"]`);le&&le.scrollIntoView({behavior:"smooth",block:"center"})}}function ne(j){k.value=!1,j.value}function re(j,Y){Y?g.value=l(Y.label):g.value=l(j.label),h.value=!1}function _e(j){k.value=!0,w.value=j}return e.watch(()=>o.node.content,j=>{c()}),e.watch(z,j=>{j&&(x.value=!1)}),e.watch(a,j=>{j&&!z.value&&setTimeout(()=>{g.value=$.value,v.value="",x.value=j},100)}),e.onMounted(()=>{q(),i(o)}),e.onBeforeUnmount(()=>{s()}),(j,Y)=>(e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:["o-ai-block-view",{"is-empty":z.value,"has-focus":e.unref(a)}],onContextmenu:e.withModifiers(_e,["prevent"])}),{default:e.withCtx(()=>[z.value?(e.openBlock(),e.createBlock(e.unref(je),{key:0,modelValue:h.value,"onUpdate:modelValue":Y[1]||(Y[1]=J=>h.value=J),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":e.withCtx(()=>[e.createElementVNode("section",Xp,[e.createElementVNode("section",Jp,[e.createVNode(e.unref(Ao),{items:V.value,onSelect:re,"use-keyboard":h.value},null,8,["items","use-keyboard"])])])]),default:e.withCtx(()=>[e.createElementVNode("div",Zp,[e.createElementVNode("div",Qp,[e.createVNode(e.unref(Ee),{ref_key:"inputRef",ref:b,modelValue:g.value,"onUpdate:modelValue":Y[0]||(Y[0]=J=>g.value=J),placeholder:e.unref(l)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:G},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(Ze),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(l)("label.generate"),loading:C.value,onClick:S},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.withDirectives(e.createVNode(e.unref(je),{modelValue:x.value,"onUpdate:modelValue":Y[4]||(Y[4]=J=>x.value=J),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":e.withCtx(()=>[v.value==="edit"?(e.openBlock(),e.createElementBlock("section",ef,[e.createVNode(e.unref(Ee),{ref_key:"updateInputRef",ref:_,modelValue:g.value,"onUpdate:modelValue":Y[2]||(Y[2]=J=>g.value=J),placeholder:e.unref(l)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(Ze),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(l)("label.generate"),loading:C.value,onClick:S},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(e.openBlock(),e.createElementBlock("section",tf,[e.createVNode(e.unref(Sl),null,{default:e.withCtx(()=>[e.createElementVNode("div",of,[e.createVNode(e.unref(ee),{icon:"auto_awesome",onClick:I},{default:e.withCtx(()=>[e.createElementVNode("span",nf,e.toDisplayString(e.unref(l)("label.generatedBy"))+" "+e.toDisplayString(N.value||"AI"),1)]),_:1})]),e.createVNode(e.unref(Ze),{icon:"autorenew",tooltip:e.unref(l)("label.update"),loading:C.value,onClick:S},null,8,["tooltip","loading"])]),_:1})]))]),default:e.withCtx(()=>[e.createElementVNode("div",rf,[e.createElementVNode("div",lf,[e.createVNode(e.unref(R.NodeViewContent))]),e.unref(u)?(e.openBlock(),e.createBlock(e.unref(ht),{key:0,modelValue:k.value,"onUpdate:modelValue":Y[3]||(Y[3]=J=>k.value=J),event:w.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:ne}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[e.vShow,!z.value]])]),_:1},16,["class"]))}}),Kl=_a.extend({addNodeView(){return R.VueNodeViewRenderer(cf)}}),sf={key:1,class:"audio-container"},Nt="//init.mp3",uf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{tr:n}=P(),{isEditable:r}=U(),l=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(l.value=!1,m.value){case"replace":f(!0);break}}function d(){s.value===Nt&&f(!0)}function u(m){l.value=!0,a.value=m}function p(m){s.value=m,f(!1)}function f(m){i.value=m}return e.onMounted(()=>{f(s.value===Nt)}),(m,b)=>{var g;return e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:["o-audio-view",{readonly:!((g=m.editor)!=null&&g.isEditable),init:s.value===Nt}],as:"div",onContextmenu:e.withModifiers(u,["prevent"]),onClick:d}),{default:e.withCtx(()=>[e.createVNode(e.unref(je),{modelValue:i.value,"onUpdate:modelValue":b[0]||(b[0]=k=>i.value=k),placement:s.value===Nt?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(no),{val:s.value===Nt?"":s.value,type:"audio",onInput:p},null,8,["val"])]),default:e.withCtx(()=>[s.value===Nt?(e.openBlock(),e.createBlock(e.unref(Pt),{key:0,icon:"graphic_eq",placeholder:e.unref(n)("label.audioAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",sf,[e.unref(r)?(e.openBlock(),e.createBlock(e.unref(oo),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(ht),{modelValue:l.value,"onUpdate:modelValue":b[1]||(b[1]=k=>l.value=k),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"])}}}),Xl=Ba.extend({addNodeView(){return R.VueNodeViewRenderer(uf)}}),df={class:"header o-tips"},pf={style:{display:"flex"}},ff=["innerHTML"],mf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{tr:n}=P(),{isEditable:r}=U(),l=e.ref(!1),a=e.ref(null),i=e.computed({get(){return o.node.attrs.latex},set(u){o.updateAttributes({latex:u||""})}}),s=e.computed(()=>Va.renderToString(i.value,{throwOnError:!1}));function c(u){l.value=u,u&&setTimeout(()=>{var p;(p=a.value)==null||p.focus()},100)}function d(){window.open("https://katex.org/docs/supported.html","target")}return e.onMounted(()=>{c(!i.value)}),(u,p)=>(e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:["o-block-math-view",{init:!i.value}],as:"div",onClick:p[3]||(p[3]=f=>c(!0))}),{default:e.withCtx(()=>[e.createVNode(e.unref(je),{modelValue:l.value,"onUpdate:modelValue":p[2]||(p[2]=f=>l.value=f),"content-class":"o-block-math-editor",placement:i.value==="init"?"bottom":"top",readonly:!e.unref(r),"show-arrow":""},{"popover-content":e.withCtx(()=>[e.createElementVNode("header",df,[e.createElementVNode("div",pf,[e.createVNode(e.unref(E),{name:"functions"}),e.createTextVNode(" "+e.toDisplayString(e.unref(n)("editor.blockMath")),1)]),e.createElementVNode("div",null,[e.createVNode(e.unref(ae),{icon:"help",tooltip:e.unref(n)("label.help"),onClick:d},null,8,["tooltip"])])]),e.createVNode(e.unref($l),{ref_key:"input",ref:a,modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=f=>i.value=f),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:p[1]||(p[1]=f=>c(!0))},[e.createElementVNode("div",{class:"katex-container",innerHTML:s.value},null,8,ff)])):(e.openBlock(),e.createBlock(e.unref(Pt),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),Jl=Ut.BlockMath.extend({addCommands(){return{insertBlockMath:(t={})=>({tr:o,dispatch:n,state:r})=>{const l=r.schema.nodes.blockMath.create({latex:t.latex??""});return n&&(o.replaceSelectionWith(l),o.scrollIntoView()),!0}}},addNodeView(){return R.VueNodeViewRenderer(mf)}}),vf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t;return(n,r)=>(e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:"o-blockquote-view"}),{default:e.withCtx(()=>[e.createElementVNode("blockquote",null,[e.createVNode(e.unref(R.NodeViewContent))])]),_:1},16))}}),Zl=Na.extend({addNodeView(){return R.VueNodeViewRenderer(vf)}}),gf={class:"callout-container"},bf={class:"callout-icon"},hf={class:"callout-content"},kf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{theme:n}=bt(),{isEditable:r}=U(),l=e.ref(!1),a=e.ref(!1),i=e.ref({}),s=e.ref(null),c=e.computed(()=>{const{selection:v}=o.editor.view.state,_=v.from,C=o.getPos(),O=C+o.node.nodeSize;return _>=C&&_<=O}),d=e.computed({get(){return o.node.attrs.backColor},set(v){o.updateAttributes({backColor:v})}}),u=e.computed({get(){return o.node.attrs.backColorDark},set(v){o.updateAttributes({backColorDark:v})}}),p=e.computed({get(){return o.node.attrs.borderColor},set(v){o.updateAttributes({borderColor:v})}}),f=e.computed({get(){return o.node.attrs.borderColorDark},set(v){o.updateAttributes({borderColorDark:v})}}),m=e.computed(()=>n.value==="dark"?u.value:d.value),b=e.computed(()=>n.value==="dark"?f.value:p.value);function g(v){o.updateAttributes({icon:v})}function k(v){switch(l.value=!1,v.value){case"palette":h(!0);break}}function w(v){l.value=!0,i.value=v}function h(v){a.value=v}function x(v,_){var C;switch(v){case"backColor":d.value=_;break;case"foreColor":p.value=_;break;case"icon":g(_.emoji),(C=s.value)==null||C.setShow(!1);break}}return e.watch(c,v=>{h(v)}),(v,_)=>(e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:"o-callout-view",style:`--callout-border-color: ${b.value}; --callout-back-color: ${m.value}`,onContextmenu:e.withModifiers(w,["prevent"])}),{default:e.withCtx(()=>[e.createElementVNode("div",gf,[e.createVNode(e.unref(Z),{ref_key:"iconPopover",ref:s,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!e.unref(r)},{trigger:e.withCtx(()=>[e.createElementVNode("div",bf,e.toDisplayString(v.node.attrs.icon),1)]),default:e.withCtx(()=>[e.createVNode(e.unref(To),{items:e.unref(Ht.emojiGroups),onSelect:_[0]||(_[0]=C=>x("icon",C)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),e.createElementVNode("div",hf,[e.createVNode(e.unref(R.NodeViewContent))]),e.unref(r)?(e.openBlock(),e.createBlock(e.unref(ht),{key:0,modelValue:l.value,"onUpdate:modelValue":_[1]||(_[1]=C=>l.value=C),event:i.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:k}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),Ql=Ea.extend({addNodeView(){return R.VueNodeViewRenderer(kf)}}),yf=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/}]});var pe=[];for(var Xo=0;Xo<256;++Xo)pe.push((Xo+256).toString(16).slice(1));function wf(t,o=0){return(pe[t[o+0]]+pe[t[o+1]]+pe[t[o+2]]+pe[t[o+3]]+"-"+pe[t[o+4]]+pe[t[o+5]]+"-"+pe[t[o+6]]+pe[t[o+7]]+"-"+pe[t[o+8]]+pe[t[o+9]]+"-"+pe[t[o+10]]+pe[t[o+11]]+pe[t[o+12]]+pe[t[o+13]]+pe[t[o+14]]+pe[t[o+15]]).toLowerCase()}var mo,xf=new Uint8Array(16);function Cf(){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(xf)}var _f=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const fr={randomUUID:_f};function Bf(t,o,n){if(fr.randomUUID&&!t)return fr.randomUUID();t=t||{};var r=t.random||(t.rng||Cf)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,wf(r)}const Vf=()=>Bf(),Nf={class:"code-block-toolbar"},Ef={class:"wrap"},Sf={class:"language readonly"},Of={class:"wrap"},$f=["srcdoc"],Af={key:1,ref:"mermaidMount",class:"tiptap ProseMirror mermaid-split-horizontal"},Tf={key:0,class:"preview"},Df={key:0,class:"error"},Mf=["innerHTML"],Lf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{commonDownload:n}=Oo(),{tr:r}=P(),{darkMode:l}=bt(),{isEditable:a}=U(),i=e.ref("content_copy"),s=e.ref({show:!1,fullscreen:!1}),c=e.ref(""),d=e.ref(""),u=e.ref(""),p=e.ref(""),f=e.ref("splitVertical"),m=e.ref(""),b=e.ref("default");Ho.registerLayoutLoaders(Oa);const g={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},k=e.computed({get(){return o.node.attrs.language},set(S){o.updateAttributes({language:S})}}),w=e.computed(()=>{var S;return((S=o.node.content.content[0])==null?void 0:S.text)||""}),h=e.computed({get(){return o.node.attrs.wrap},set(S){o.updateAttributes({wrap:S})}}),x=e.computed(()=>["html","svg"].includes(k.value)),v=e.computed(()=>h.value?"text_select_move_down":"format_text_wrap"),_=e.computed(()=>k.value==="mermaid"),C=e.computed(()=>k.value==="mermaid"?a.value?f.value:"preview":"");function O(S){k.value=S}function M(){const S=o.node.content.content[0].text;Jo.copyToClipboard(S).then(()=>{i.value="done",setTimeout(()=>{i.value="content_copy"},2e3)})}function A(S="code"){switch(S){case"svg":z();break;default:T();break}}function T(){const S=k.value;let K=S;const Q=jt.find(ce=>ce.value===S);Q&&(K=Q.ext.at(0));const de=`${S}-${Date.now()}.${K}`,me=o.node.content.content[0].text;n("code",de,me)}function z(){if(!u.value)return;const S=`mermaid-${Date.now()}.svg`,K=u.value;n("svg",S,K)}function V(){const S=o.node.content.content[0].text;d.value=$(S),c.value="run",s.value={show:!0,fullscreen:!1}}function N(){c.value==="mermaid"&&(f.value=m.value)}function $(S){return`
306
66
  <style>
307
67
  body { margin: 0 !important; padding: 0; }
308
68
  </style>
309
- ${U}
310
- `}function L(){v.value=!v.value}function B(){switch(y.value){case"mermaid":z();break}}function W(){$f.initialize({...g,theme:r.value?"dark":m.value}),B()}async function z(){try{f.value="";const U=`mermaid-${x8()}`,{svg:he}=await $f.render(U,b.value);d.value=he}catch(U){console.error(U),f.value=U.message}}return c.watch(b,U=>{B()}),c.watch(y,U=>{B()}),c.watch(r,U=>{W()}),c.watch(C,(U,he)=>{U==="splitHorizontal"&&(h.value=he,a.value="mermaid")}),c.onMounted(()=>{var he;const U=e.editor.extensionManager.extensions.find(Se=>Se.name==="codeBlock");m.value=((he=U==null?void 0:U.options)==null?void 0:he.diagramTheme)||"default",W()}),(U,he)=>(c.openBlock(),c.createBlock(c.unref(An),c.mergeProps(e,{class:["o-code-block-view",`language-${y.value} ${C.value}`]}),{default:c.withCtx(()=>[c.createElementVNode("div",C8,[c.createElementVNode("div",S8,[c.createElementVNode("div",E8,c.toDisplayString(y.value),1),c.createVNode(c.unref(MC),{language:y.value,class:"editable",onSelect:S},null,8,["language"])]),c.createElementVNode("div",M8,[C.value?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[C.value==="splitHorizontal"?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"close",tooltip:c.unref(o)("label.close"),class:"editable",onClick:D},null,8,["tooltip"])):(c.openBlock(),c.createBlock(c.unref(bC),{key:1,modelValue:p.value,"onUpdate:modelValue":he[0]||(he[0]=Se=>p.value=Se),class:"editable"},null,8,["modelValue"]))],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:k.value,"icon-class":{"rotate-270":v.value},tooltip:"Wrap",class:"editable",onClick:L},null,8,["icon","icon-class"]),x.value?(c.openBlock(),c.createBlock(c.unref(yC),{key:1,onDownload:N})):(c.openBlock(),c.createBlock(c.unref(Ae),{key:2,icon:"download",tooltip:c.unref(o)("label.download"),onClick:N},null,8,["tooltip"])),w.value?(c.openBlock(),c.createBlock(c.unref(Ae),{key:3,icon:"play_circle",tooltip:"Run",onClick:$})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:s.value,tooltip:c.unref(o)("label.copy"),onClick:M},null,8,["icon","tooltip"])])]),c.createVNode(c.unref(Ug),c.mergeProps({show:l.value.show,"onUpdate:show":he[1]||(he[1]=Se=>l.value.show=Se)},l.value,{onClose:D}),{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:u.value},null,8,T8)):a.value==="mermaid"?(c.openBlock(),c.createElementBlock("div",N8,null,512)):c.createCommentVNode("",!0)]),_:1},16,["show"]),c.createElementVNode("pre",null,[c.createVNode(c.unref(rr),{as:"code",class:c.normalizeClass({wrap:v.value})},null,8,["class"])]),x.value?(c.openBlock(),c.createElementBlock("section",A8,[f.value?(c.openBlock(),c.createElementBlock("div",O8,c.toDisplayString(f.value),1)):(c.openBlock(),c.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:d.value},null,8,$8))])):c.createCommentVNode("",!0)]),_:1},16,["class"]))}}),KM=qy.createLowlight(qy.common);KM.register("mermaid",k8);const JM=v8.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 mn(B8)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:KM}),R8=c.defineComponent({__name:"view",props:dt,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(An),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(G),{name:"details_arrow"})]),c.createVNode(c.unref(rr))],2)]),_:1},16))}}),GM=hS.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 Wr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.details.create(null,[s.nodes.detailsSummary.create(null),s.nodes.detailsContent.create(null,s.nodes.paragraph.create())]);i.replaceRangeWith(a,u-1,d);const f=q.near(i.doc.resolve(a+2));return i.setSelection(f),i}})]},addNodeView(){return mn(R8)}}),D8={class:"horizontal"},_8=c.defineComponent({__name:"view",props:dt,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(An),c.mergeProps(e,{class:"o-horizontal-view"}),{default:c.withCtx(()=>[c.createElementVNode("div",D8,[c.createVNode(c.unref(rr),{as:"div",class:"divider"})])]),_:1},16))}}),XM=BR.extend({draggable:!0,addNodeView(){return mn(_8)}});/**
311
- * Copyright 2026 Yiitap
312
- * @license MIT
313
- **/var I8=/(?:^|\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",de(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:"",u=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return u?`![${a}](${l} "${u}")`:`![${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 u=new Vd({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}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Ps({find:I8,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),P8=L8;const V8=P8.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",de(this.options.HTMLAttributes,e)]}}),z8={key:1,class:"image-panel"},H8={class:"label"},F8={key:1,class:"resize-overlay"},j8={class:"resize-guide"},U8={class:"size-display"},W8={key:1},q8=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{tr:t}=ue(),{downloadImage:o}=qd(),{isEditable:r,getEditorImages:i}=we(),s=c.ref(!1),l=c.ref(!1),a=c.ref({}),u=c.ref(null),d=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),v=c.ref(!1),w=c.ref(""),k=c.ref(0),x=c.ref(0),C=c.ref(0),S=c.ref(0),M=c.ref(e.node.attrs.width||0),N=c.ref(e.node.attrs.height||0),O=c.ref(0),A=c.ref(0),$=c.ref(0),D=c.ref(1200),R=c.ref(0),L=c.ref(0),B=c.ref(800),W=c.ref(400),z=c.ref(!1),U=c.ref(!0),he=c.ref(!1),Se=c.ref(e.node.attrs.positionY||0),_e=c.ref(0),je=c.ref(0),He=c.ref(!1),Ne=c.computed(()=>e.node.attrs),Fe=c.computed({get(){return e.node.attrs.src},set(T){e.updateAttributes({src:T})}}),kt=c.computed({get(){return e.node.attrs.title},set(T){e.updateAttributes({title:T})}});function fe(){d.value=!0,setTimeout(()=>{var T;(T=u.value)==null||T.focus()},0)}function Ee(){o(e.node.attrs.src)}function Me(){h.value=i(e.editor),p.value=h.value.findIndex(T=>T.pos===e.getPos())||0,f.value=!0}function it(){d.value=!1}function gn(){Fe.value==="init"&&On(!0)}function Do(T){s.value=!0,a.value=T}function _o(T){switch(s.value=!1,T.value){case"replace":On(!0);break}}function cr(T){Fe.value=T,On(!1)}function On(T){l.value=T}const Io=c.computed(()=>({width:`${M.value}px`,maxWidth:`${D.value}px`,height:`${O.value}px`,maxHeight:z.value?`${R.value}px`:"auto",cursor:v.value?ur():"default"}));function ur(){switch(w.value){case"left":return"ew-resize";case"right":return"ew-resize";case"bottom":return"ew-resize";default:return"default"}}function dr(){var T,P,ee;if(b.value){A.value=b.value.naturalWidth,$.value=b.value.naturalHeight,B.value=((P=(T=m.value)==null?void 0:T.$el)==null?void 0:P.parentElement.getBoundingClientRect().width)??0,D.value=((ee=document.querySelector(".layout"))==null?void 0:ee.getBoundingClientRect().width)??1200;const be=A.value/$.value;B.value=Math.min(B.value,800),W.value=B.value/be,!M.value||!N.value?(z.value=A.value>B.value,z.value?(M.value=B.value,N.value=B.value/A.value*$.value):(M.value=A.value,N.value=$.value),bn()):z.value=M.value>B.value,L.value>0?O.value=L.value:(O.value=N.value,L.value=N.value),R.value=N.value,lo()}}function Ht(T,P){v.value=!0,w.value=P,C.value=T.clientX,S.value=T.clientY,k.value=M.value,x.value=N.value,document.addEventListener("mousemove",yn),document.addEventListener("mouseup",so)}function yn(T){if(!v.value)return;const P=T.clientX-C.value,ee=T.clientY-S.value,be=A.value/$.value;let pe=k.value,ct=L.value;switch(w.value){case"left":pe=k.value-P;break;case"right":pe=k.value+P;break;case"bottom":ct=L.value+ee;break}const Ot=pe/be;M.value=Math.round(pe),N.value=Math.round(Ot),z.value=pe>B.value,z.value?(O.value=ct,R.value=N.value):(O.value=N.value,Us())}function so(){v.value=!1,w.value="",document.removeEventListener("mousemove",yn),document.removeEventListener("mouseup",so),L.value=O.value,bn()}function bn(){e.updateAttributes({width:M.value,height:N.value,containerHeight:L.value})}const en=c.computed(()=>!N.value||!O.value?0:Math.min(0,O.value-N.value)),Lo=c.computed(()=>({transform:`translateY(${Se.value}px)`,cursor:Ft.value?"grab":"default",transition:he.value?"none":"transform 0.2s ease"})),Ft=c.computed(()=>U.value&&z.value&&O.value<N.value);function Kn(){U.value=!U.value}function lo(){z.value&&O.value<N.value?He.value=!0:He.value=!1}function Us(){Se.value!==0&&(Se.value=0,Wi())}function Ws(T){!Ft.value||!He.value||v.value||T.target.closest(".block-resizer")||(T.preventDefault(),T.stopPropagation(),he.value=!0,_e.value=T.clientY,je.value=Se.value,document.addEventListener("mousemove",ji),document.addEventListener("mouseup",Ui),document.body.style.userSelect="none",document.body.style.cursor="grabbing")}function ji(T){if(!he.value)return;const P=T.clientY-_e.value;let ee=je.value+P;ee=Math.max(en.value,Math.min(0,ee)),Se.value=ee}function Ui(){he.value=!1,document.removeEventListener("mousemove",ji),document.removeEventListener("mouseup",Ui),document.body.style.userSelect="",document.body.style.cursor="",Wi()}function Wi(){e.updateAttributes({positionY:Se.value})}return c.watch(()=>e.node.attrs.height,T=>{T&&(N.value=T)}),c.watch(()=>e.node.attrs.containerHeight,T=>{T&&(L.value=T,O.value=T,lo())}),c.watch(()=>e.node.attrs.positionY,T=>{T!==void 0&&(Se.value=T)}),c.onMounted(()=>{On(Fe.value==="init"),Ne.value.width&&(M.value=Ne.value.width),Ne.value.height&&(N.value=Ne.value.height),Ne.value.containerHeight&&(L.value=Ne.value.containerHeight)}),c.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(T,P)=>{var ee;return c.openBlock(),c.createBlock(c.unref(An),c.mergeProps({ref_key:"imageView",ref:m},e,{class:["o-image-view",{max:z.value,"with-caption":Ne.value.alt,readonly:!((ee=T.editor)!=null&&ee.isEditable),init:Fe.value==="init"}],as:"div",onContextmenu:c.withModifiers(Do,["prevent"]),onClick:gn}),{default:c.withCtx(()=>[c.createVNode(c.unref(To),{modelValue:l.value,"onUpdate:modelValue":P[4]||(P[4]=be=>l.value=be),placement:Fe.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Da),{val:Fe.value==="init"?"":Fe.value,type:"image",onInput:cr},null,8,["val"])]),default:c.withCtx(()=>{var be;return[Fe.value==="init"?(c.openBlock(),c.createBlock(c.unref(Vs),{key:0,icon:"image",placeholder:c.unref(t)("label.imageAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",z8,[c.createVNode(c.unref(Ra),c.mergeProps(e,{onAction:_o}),{default:c.withCtx(()=>[c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[He.value?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:Ft.value?"arrow_expand":"close","icon-class":Ft.value?"rotate-315":"","content-class":"with-label",tooltip:c.unref(t)("image.repositionTips"),onClick:c.withModifiers(Kn,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("span",H8,c.toDisplayString(c.unref(t)("image.reposition")),1)]),_:1},8,["icon","icon-class","tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:"subtitles",tooltip:c.unref(t)("label.caption"),onClick:c.withModifiers(fe,["stop"])},null,8,["tooltip"]),c.createVNode(c.unref($g),{editor:T.editor},null,8,["editor"]),c.createVNode(c.unref(Og),{editor:T.editor,placement:"bottom-end"},null,8,["editor"])],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:"download",tooltip:c.unref(t)("label.download"),onClick:Ee},null,8,["tooltip"]),c.createVNode(c.unref(Ae),{icon:"zoom_in",tooltip:c.unref(t)("image.zoom"),onClick:Me},null,8,["tooltip"])]),_:1},16),c.createElementVNode("div",{ref_key:"imageContainer",ref:g,class:"image-container",style:c.normalizeStyle(Io.value),onMousedown:Ws},[c.createElementVNode("div",{ref_key:"imageWrapper",ref:y,class:"image-wrapper",style:c.normalizeStyle(Lo.value)},[c.createElementVNode("img",c.mergeProps({ref_key:"imageElement",ref:b},Ne.value,{draggable:"true","data-drag-handle":"",onLoad:dr}),null,16)],4),c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createElementVNode("div",{class:"block-resizer left",onMousedown:P[0]||(P[0]=c.withModifiers(pe=>Ht(pe,"left"),["stop","prevent"]))},[...P[7]||(P[7]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),c.createElementVNode("div",{class:"block-resizer right",onMousedown:P[1]||(P[1]=c.withModifiers(pe=>Ht(pe,"right"),["stop","prevent"]))},[...P[8]||(P[8]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),z.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:P[2]||(P[2]=c.withModifiers(pe=>Ht(pe,"bottom"),["stop","prevent"]))},[...P[9]||(P[9]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):c.createCommentVNode("",!0),v.value?(c.openBlock(),c.createElementBlock("div",F8,[c.createElementVNode("div",j8,[c.createElementVNode("div",U8,c.toDisplayString(M.value)+" × "+c.toDisplayString(O.value),1)])])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0)],36),c.createElementVNode("div",{class:"caption",onClick:fe},[(be=T.editor)!=null&&be.isEditable&&d.value?(c.openBlock(),c.createBlock(c.unref(Un),{key:0,ref_key:"captionInput",ref:u,class:"caption-input",modelValue:kt.value,"onUpdate:modelValue":P[3]||(P[3]=pe=>kt.value=pe),type:"text",placeholder:"Input caption",autosize:"",onBlur:it},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",W8,c.toDisplayString(kt.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(zi),{modelValue:s.value,"onUpdate:modelValue":P[5]||(P[5]=be=>s.value=be),event:a.value},{default:c.withCtx(()=>[c.createVNode(c.unref(sr),c.mergeProps(e,{onAction:_o}),null,16)]),_:1},8,["modelValue","event"]),c.createVNode(c.unref(XC),{show:f.value,"onUpdate:show":P[6]||(P[6]=be=>f.value=be),images:h.value,current:p.value},{title:c.withCtx(()=>[...P[10]||(P[10]=[c.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class"])}}}),YM=V8.extend({addNodeView(){return mn(q8)}}).configure({inline:!0});function K8(n){return new ce({key:new le("handleClickSelectLink"),props:{handleClick:(e,t,o)=>{const{schema:r,doc:i,tr:s}=e.state,l=Pi(i.resolve(t),r.marks.link);if(!l)return!1;const a=i.resolve(l.from),u=i.resolve(l.to),d=s.setSelection(new q(a,u));return e.dispatch(d),!0}}})}const QM=mg.extend({addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],K8({type:this.type})]}}).configure({openOnClick:!1});/**
314
- * Copyright 2026 Yiitap
315
- * @license MIT
316
- **/const J8=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,G8=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",de(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[Ps({find:J8,type:this.type,getAttributes:n=>{const[e]=n;return{src:e}}})]}}),X8={key:1,class:"model-viewer-container"},Y8={key:1},Q8={class:"model-viewer-container"},Z8=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{tr:t}=ue(),{isEditable:o}=we(),r=c.ref(!1),i=c.ref({}),s=c.ref(null),l=c.ref(!1),a=c.ref(!1),u=c.ref({show:!1,fullscreen:!0}),d=c.computed({get(){return e.node.attrs.caption},set(k){e.updateAttributes({caption:k})}}),f=c.computed({get(){return e.node.attrs.src},set(k){e.updateAttributes({src:k})}});function p(k){switch(r.value=!1,k.value){case"replace":w(!0);break}}function h(){l.value=!0,setTimeout(()=>{var k;(k=s.value)==null||k.focus()},0)}function m(){l.value=!1}function g(){u.value.show=!0}function y(){f.value==="init"&&w(!0)}function b(k){r.value=!0,i.value=k}function v(k){f.value=k,w(!1)}function w(k){a.value=k}return c.onMounted(()=>{w(f.value==="init")}),(k,x)=>{var C;return c.openBlock(),c.createBlock(c.unref(An),c.mergeProps(e,{class:["o-model-viewer-view",{readonly:!((C=k.editor)!=null&&C.isEditable),init:f.value==="init"}],as:"div",onContextmenu:c.withModifiers(b,["prevent"]),onClick:y}),{default:c.withCtx(()=>[c.createVNode(c.unref(To),{modelValue:a.value,"onUpdate:modelValue":x[1]||(x[1]=S=>a.value=S),placement:f.value==="init"?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Da),{val:f.value==="init"?"":f.value,type:"video",onInput:v},null,8,["val"])]),default:c.withCtx(()=>{var S;return[f.value==="init"?(c.openBlock(),c.createBlock(c.unref(Vs),{key:0,icon:"3d_rotation",placeholder:c.unref(t)("label.model3dAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",X8,[c.createVNode(c.unref(Ra),c.mergeProps(e,{onAction:p}),{default:c.withCtx(()=>[c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"subtitles",tooltip:c.unref(t)("label.caption"),onClick:h},null,8,["tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:"zoom_in",tooltip:c.unref(t)("image.zoom"),onClick:g},null,8,["tooltip"])]),_:1},16),c.createElementVNode("model-viewer",c.mergeProps(k.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},[(S=k.editor)!=null&&S.isEditable&&l.value?(c.openBlock(),c.createBlock(c.unref(Un),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":x[0]||(x[0]=M=>d.value=M),type:"text",placeholder:"Input caption",autosize:"",onBlur:m},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",Y8,c.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(zi),{modelValue:r.value,"onUpdate:modelValue":x[2]||(x[2]=S=>r.value=S),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(sr),c.mergeProps(e,{onAction:p}),null,16)]),_:1},8,["modelValue","event"]),c.createVNode(c.unref(Ug),c.mergeProps({show:u.value.show,"onUpdate:show":x[3]||(x[3]=S=>u.value.show=S)},u.value,{title:c.unref(t)("label.model3d"),"dialog-class":"model-viewer-dialog"}),{default:c.withCtx(()=>[c.createElementVNode("div",Q8,[c.createElementVNode("model-viewer",c.mergeProps(k.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"])}}}),ZM=G8.extend({addNodeView(){return mn(Z8)}}),eq=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{tr:t}=ue(),{showRowPopover:o,rowActions:r,isEditable:i,cellInfo:s,initProps:l,runCommand:a}=Ag(),u=c.ref(!1);return c.onMounted(()=>{l({getPos:e.getPos,editor:e.editor}),u.value=s.value.colIndex===0}),(d,f)=>(c.openBlock(),c.createBlock(c.unref(ig),c.mergeProps({class:"o-table-cell-view",as:"td"},d.node.attrs,{style:{background:d.node.attrs.background}}),{default:c.withCtx(()=>[c.unref(i)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[u.value?(c.openBlock(),c.createBlock(c.unref(Fu),{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(Mt),{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(vt),{key:h,onClick:m=>c.unref(a)(p.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{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(rr))]),_:1},16,["style"]))}}),eT=rf.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return mn(eq,{stopEvent:()=>!1})}}),tq=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{tr:t}=ue(),{showColPopover:o,showRowPopover:r,columnActions:i,rowActions:s,isEditable:l,cellInfo:a,initProps:u,runCommand:d}=Ag(),f=c.ref(!1),p=c.ref(!1);return c.onMounted(()=>{u({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(ig),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(Fu),{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(d)("tableAddColumn"))},{default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{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(vt),{key:y,onClick:b=>c.unref(d)(g.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{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(Fu),{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(d)("tableAddRow"))},{default:c.withCtx(()=>[c.createVNode(c.unref(Mt),{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(vt),{key:y,onClick:b=>c.unref(d)(g.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(G),{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(rr))]),_:1},16,["style"]))}}),tT=sf.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return mn(tq,{stopEvent:()=>!1})}});/**
317
- * Copyright 2026 Yiitap
318
- * @license MIT
319
- **/function nT(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=nT(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function oT(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 u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=oT(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}class X{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],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}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 u=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&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},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 X(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 X(o,r)}cutByIndex(e,t){return e==t?X.empty:e==0&&t==this.content.length?this:new X(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 X(r,i)}addToStart(e){return new X([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new X(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 nT(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return oT(this,e,t,o)}findIndex(e){if(e==0)return bc(0,e);if(e==this.size)return bc(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?bc(t+1,i):bc(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 X.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new X(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return X.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 X(t||e,o)}static from(e){if(!e)return X.empty;if(e instanceof X)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new X([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}X.empty=new X([],0);const Sp={index:0,offset:0};function bc(n,e){return Sp.index=n,Sp.offset=e,Sp}function tm(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(!tm(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!tm(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}class on{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&&tm(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 on.none;if(e instanceof on)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}}on.none=[];class nq extends Error{}class Z{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=iT(this.content,e+this.openStart,t);return o&&new Z(o,this.openStart,this.openEnd)}removeBetween(e,t){return new Z(rT(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 Z.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 Z(X.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 Z(e,o,r)}}Z.empty=new Z(X.empty,0,0);function rT(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(rT(i.content,e-r-1,t-r-1)))}function iT(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=iT(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function oq(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 rq(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 iq(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 sq(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new aq(n,o,e[o]);return t}function lq(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 aq{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?lq(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Cy{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=sq(e,r.attrs),this.excluded=null;let i=oq(this.attrs);this.instance=i?new on(this,i):null}create(e=null){return!e&&this.instance?this.instance:new on(this,rq(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Cy(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){iq(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}function cq(n){return n.tag!=null}function uq(n){return n.style!=null}class ld{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(cq(r))this.tags.push(r);else if(uq(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 rw(this,t,!1);return o.addAll(e,on.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new rw(this,t,!0);return o.addAll(e,on.none,t.from,t.to),Z.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(pq(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=iw(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=iw(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ld(e,ld.schemaRules(e)))}}const sT={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},dq={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lT={ol:!0,ul:!0},pa=1,nm=2,Bl=4;function ow(n,e,t){return e!=null?(e?pa:0)|(e==="full"?nm:0):n&&n.whitespace=="pre"?pa|nm:t&~Bl}class vc{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=on.none,this.match=i||(s&Bl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(X.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&pa)){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=X.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(X.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&&!sT.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class rw{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=ow(null,t.preserveWhitespace,0)|(o?Bl:0);r?i=new vc(r.type,r.attrs,on.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new vc(null,null,on.none,!0,null,s):i=new vc(e.schema.topNodeType,null,on.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&nm?"full":this.localPreserveWS||(r.options&pa)>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;lT.hasOwnProperty(s)&&this.parser.normalizeLists&&fq(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:dq.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 u,d=this.needsBlock;if(sT.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!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),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,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(u=>!a.clearMark(u)):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],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.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=on.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sw(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=ow(e,i,s.options);s.options&Bl&&s.content.length==0&&(l|=Bl);let a=on.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):sw(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new vc(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|=pa)}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 u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))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 fq(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&lT.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function pq(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function iw(n){let e={};for(let t in n)e[t]=n[t];return e}function sw(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:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class kf{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Ep(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 u=s.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let u=s.marks[a++],d=this.serializeMark(u,s.isInline,t);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=jc(Ep(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&&jc(Ep(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return jc(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new kf(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=lw(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return lw(e.marks)}}function lw(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Ep(n){return n.document||window.document}const aw=new WeakMap;function hq(n){let e=aw.get(n);return e===void 0&&aw.set(n,e=mq(n)),e}function mq(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 jc(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=hq(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),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>d)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}=jc(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 aT=65535,cT=Math.pow(2,16);function gq(n,e){return n+e*cT}function cw(n){return n&aT}function yq(n){return(n-(n&aT))/cT}const uT=1,dT=2,Uc=4,fT=8;class om{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&fT)>0}get deletedBefore(){return(this.delInfo&(uT|Uc))>0}get deletedAfter(){return(this.delInfo&(dT|Uc))>0}get deletedAcross(){return(this.delInfo&Uc)>0}}class Cn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Cn.empty)return Cn.empty}recover(e){let t=0,o=cw(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+yq(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 u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:gq(l/3,e-a),g=e==a?dT:e==f?uT:Uc;return(t<0?e!=a:e!=f)&&(g|=fT),new om(h,g,m)}r+=d-u}return o?e+r:new om(e+r,0,null)}touches(e,t){let o=0,r=cw(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 u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}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),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new Cn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Cn.empty:new Cn(e<0?[0,-e,0]:[0,0,e])}}Cn.empty=new Cn([]);class ad{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 ad(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 ad;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 om(e,r,null)}}const Mp=Object.create(null);class Zt{getMap(){return Cn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Mp[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 Mp)throw new RangeError("Duplicate use of step JSON ID "+e);return Mp[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 nq)return mt.fail(i.message);throw i}}}function Sy(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Sy(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return X.fromArray(o)}class Nr extends Zt{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 Z(Sy(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 bo(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 Nr(t.pos,o.pos,this.mark)}merge(e){return e instanceof Nr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nr(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 Nr(t.from,t.to,e.markFromJSON(t.mark))}}Zt.jsonID("addMark",Nr);class bo extends Zt{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 Z(Sy(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 Nr(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 bo(t.pos,o.pos,this.mark)}merge(e){return e instanceof bo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new bo(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 bo(t.from,t.to,e.markFromJSON(t.mark))}}Zt.jsonID("removeMark",bo);class Ar extends Zt{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 Z(X.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 Ar(this.pos,t.marks[r]);return new Ar(this.pos,this.mark)}}return new Ri(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ar(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 Ar(t.pos,e.markFromJSON(t.mark))}}Zt.jsonID("addNodeMark",Ar);class Ri extends Zt{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 Z(X.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ar(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ri(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 Ri(t.pos,e.markFromJSON(t.mark))}}Zt.jsonID("removeNodeMark",Ri);class qt extends Zt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&rm(e,this.from,this.to)?mt.fail("Structure replace would overwrite content"):mt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Cn([this.from,this.to-this.from,this.slice.size])}invert(e){return new qt(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 qt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof qt)||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?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new qt(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?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new qt(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 qt(t.from,t.to,Z.fromJSON(e,t.slice),!!t.structure)}}Zt.jsonID("replace",qt);class Zn extends Zt{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&&(rm(e,this.from,this.gapFrom)||rm(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 Cn([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 Zn(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 Zn(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 Zn(t.from,t.to,t.gapFrom,t.gapTo,Z.fromJSON(e,t.slice),t.insert,!!t.structure)}}Zt.jsonID("replaceAround",Zn);function rm(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 bq(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+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 bo(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Nr(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function vq(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 Cy){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],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=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new bo(s.from,s.to,s.style)))}function Ey(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 u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new qt(l,d,Z.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new bo(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new Z(X.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new qt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(X.empty,!0);n.replace(l,l,new Z(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function kq(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=X.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=X.from(o.node(m).copy(d)),f++):a--;let p=X.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=X.from(r.node(m).copy(p)),h++):u++;n.step(new Zn(a,u,s,l,new Z(d.append(p),f,h),d.size-f,!0))}function wq(n,e,t){let o=X.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=X.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new Zn(r,i,r,i,new Z(o,0,0),t.length,!0))}function xq(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)&&Cq(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&hT(n,s,l,i),Ey(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new Zn(f,p,f+1,p-1,new Z(X.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&pT(n,s,l,i),!1}})}function pT(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 hT(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 Cq(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function Sq(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 Zn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Z(X.from(s),0,0),1,!0))}function Eq(n,e,t=1,o){let r=n.doc.resolve(e),i=X.empty,s=X.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=X.from(r.node(l).copy(i));let d=o&&o[u];s=X.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new qt(e,e,new Z(i.append(s),t,t),!0))}function Mq(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 d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);hT(n,d.node(),d.before(),l)}s.inlineContent&&Ey(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new qt(u,a.map(e+t,-1),Z.empty,!0)),o===!0){let d=n.doc.resolve(u);pT(n,d.node(),d.before(),n.steps.length)}return n}function Tq(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 Nq(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),u=o.node(s),d=!1;if(i==1)d=u.canReplace(a,a,r);else{let f=u.contentMatchAt(a).findWrapping(r.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Aq(n,e,t=e,o=Z.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return mT(r,i,o)?new qt(e,t,o):new Oq(r,i,o).fit()}function mT(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Oq{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=X.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=X.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):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 Z(i,s,l);return e>-1?new Zn(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new qt(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=Tp(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:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(X.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=Tp(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new Z(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=Tp(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new Z(fl(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new Z(fl(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,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(gT(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=pl(this.placed,t,X.from(d)),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?Z.empty:new Z(fl(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new Z(fl(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Np(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=Np(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=Np(e,l,u,a,!0);if(!d||d.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=pl(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=pl(this.placed,this.depth,X.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(X.empty,!0);e.childCount&&(this.placed=pl(this.placed,this.frontier.length,e))}}function fl(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(fl(n.firstChild.content,e-1,t)))}function pl(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(pl(n.lastChild.content,e-1,t)))}function Tp(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function gT(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,gT(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(X.empty,!0)))),n.copy(o)}function Np(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&&!$q(t,i.content,s)?l:null}function $q(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function Bq(n){return n.spec.defining||n.spec.definingForContent}function Rq(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(mT(r,i,o))return n.step(new qt(e,t,o));let s=bT(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),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=Bq(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[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 v=r.node(y-1),w=r.index(y-1);if(v.canReplaceWith(w,w,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new Z(yT(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 yT(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(yT(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(X.empty,!0))}return n}function Dq(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=Tq(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new Z(X.from(o),0,0))}function _q(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=bT(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 bT(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 ys extends Zt{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 Z(X.from(r),0,t.isLeaf?0:1))}getMap(){return Cn.empty}invert(e){return new ys(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 ys(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 ys(t.pos,t.attr,t.value)}}Zt.jsonID("attr",ys);class ha extends Zt{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 Cn.empty}invert(e){return new ha(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 ha(t.attr,t.value)}}Zt.jsonID("docAttr",ha);let Ls=class extends Error{};Ls=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ls.prototype=Object.create(Error.prototype);Ls.prototype.constructor=Ls;Ls.prototype.name="TransformError";class Iq{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ad}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ls(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=Z.empty){let r=Aq(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new Z(X.from(o),0,0))}delete(e,t){return this.replace(e,t,Z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return Rq(this,e,t,o),this}replaceRangeWith(e,t,o){return Dq(this,e,t,o),this}deleteRange(e,t){return _q(this,e,t),this}lift(e,t){return kq(this,e,t),this}join(e,t=1){return Mq(this,e,t),this}wrap(e,t){return wq(this,e,t),this}setBlockType(e,t=e,o,r=null){return xq(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return Sq(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new ys(e,t,o)),this}setDocAttribute(e,t){return this.step(new ha(e,t)),this}addNodeMark(e,t){return this.step(new Ar(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 on)t.isInSet(o.marks)&&this.step(new Ri(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new Ri(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 Eq(this,e,t,o),this}addMark(e,t,o){return bq(this,e,t,o),this}removeMark(e,t,o){return vq(this,e,t,o),this}clearIncompatible(e,t,o){return Ey(this,e,t,o),this}}const Ap=Object.create(null);class Ie{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new vT(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=Z.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:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?Z.empty:t),l==0&&fw(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),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),fw(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Le(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 Co(e.node(0))}static atStart(e){return ls(e,e,0,0,1)||new Co(e)}static atEnd(e){return ls(e,e,e.content.size,e.childCount,-1)||new Co(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Ap[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 Ap)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ap[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Le.between(this.$anchor,this.$head).getBookmark()}}Ie.prototype.visible=!0;class vT{constructor(e,t){this.$from=e,this.$to=t}}let uw=!1;function dw(n){!uw&&!n.parent.inlineContent&&(uw=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Le extends Ie{constructor(e,t=e){dw(e),dw(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 Le(r.parent.inlineContent?r:o,o)}replace(e,t=Z.empty){if(super.replace(e,t),t==Z.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Le&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new wf(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 Le(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 Le(e,t)}}Ie.jsonID("text",Le);class wf{constructor(e,t){this.anchor=e,this.head=t}map(e){return new wf(e.map(this.anchor),e.map(this.head))}resolve(e){return Le.between(e.resolve(this.anchor),e.resolve(this.head))}}class De 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 De(i)}content(){return new Z(X.from(this.node),0,0)}eq(e){return e instanceof De&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new My(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new De(e.resolve(t.anchor))}static create(e,t){return new De(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}De.prototype.visible=!1;Ie.jsonID("node",De);class My{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new wf(o,o):new My(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&De.isSelectable(o)?new De(t):Ie.near(t)}}class Co extends Ie{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Z.empty){if(t==Z.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 Co(e)}map(e){return new Co(e)}eq(e){return e instanceof Co}getBookmark(){return Lq}}Ie.jsonID("all",Co);const Lq={map(){return this},resolve(n){return new Co(n)}};function ls(n,e,t,o,r,i=!1){if(e.inlineContent)return Le.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&&De.isSelectable(l))return De.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 fw(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof qt||r instanceof Zn))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(Ie.near(n.doc.resolve(s),t))}function pw(n,e){return!e||!n?n:n.bind(e)}class kc{constructor(e,t,o){this.name=e,this.init=pw(t.init,o),this.apply=pw(t.apply,o)}}new kc("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new kc("selection",{init(n,e){return n.selection||Ie.atStart(e.doc)},apply(n){return n.selection}}),new kc("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new kc("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function kT(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=kT(r,e,{})),t[o]=r}return t}class wT{constructor(e){this.spec=e,this.props={},e.props&&kT(e.props,this,this.props),this.key=e.key?e.key.key:xT("plugin")}getState(e){return e[this.key]}}const Op=Object.create(null);function xT(n){return n in Op?n+"$"+ ++Op[n]:(Op[n]=0,n+"$")}class Ty{constructor(e="key"){this.key=xT(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Hi=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},CT=function(n,e,t,o){return t&&(hw(n,e,t,o,-1)||hw(n,e,t,o,1))},Pq=/^(img|br|input|textarea|hr)$/i;function hw(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:cd(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Ny(n)||Pq.test(n.nodeName)||n.contentEditable=="false")return!1;e=Hi(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?cd(n):0}else return!1}}function cd(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Vq(n,e,t){for(let o=e==0,r=e==cd(n);o||r;){if(n==t)return!0;let i=Hi(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==cd(n)}}function Ny(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 ST=function(n){return n.focusNode&&CT(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function ET(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,mw=typeof document<"u"?document:null,Gr=Ao&&Ao.userAgent||"",im=/Edge\/(\d+)/.exec(Gr),MT=/MSIE \d/.exec(Gr),sm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Gr),Ha=!!(MT||sm||im),TT=MT?document.documentMode:sm?+sm[1]:im?+im[1]:0,xf=!Ha&&/gecko\/(\d+)/i.test(Gr);xf&&+(/Firefox\/(\d+)/.exec(Gr)||[0,0])[1];const lm=!Ha&&/Chrome\/(\d+)/.exec(Gr),ar=!!lm,NT=lm?+lm[1]:0,Fi=!Ha&&!!Ao&&/Apple Computer/.test(Ao.vendor),Ay=Fi&&(/Mobile\/\w+/.test(Gr)||!!Ao&&Ao.maxTouchPoints>2),Dn=Ay||(Ao?/Mac/.test(Ao.platform):!1),AT=Ao?/Win/.test(Ao.platform):!1,Fa=/Android \d/.test(Gr),Oy=!!mw&&"webkitFontSmoothing"in mw.documentElement.style,zq=Oy?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Hq(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,u;if(ST(t)){for(a=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&De.isSelectable(f)&&r.parent&&!(f.isInline&&Vq(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;u=new De(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 d=o.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;u=$T(n,d,l,f)}return u}function OT(n){return n.editable?n.hasFocus():Wq(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function $y(n,e=!1){let t=n.state.selection;if(Uq(n,t),!!OT(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&ar){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&CT(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)jq(n);else{let{anchor:o,head:r}=t,i,s;gw&&!(t instanceof Le)&&(t.$from.parent.inlineContent||(i=yw(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=yw(n,t.to))),n.docView.setSelection(o,r,n,e),gw&&(i&&bw(i),s&&bw(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 gw=Fi||ar&&NT<63;function yw(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(Fi&&r&&r.contentEditable=="false")return $p(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return $p(r);if(i)return $p(i)}}function $p(n){return n.contentEditable="true",Fi&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function bw(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(()=>{(!OT(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function jq(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,Hi(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&Ha&&TT<=11&&(t.disabled=!0,t.disabled=!1)}function Uq(n,e){if(e instanceof De){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(vw(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else vw(n)}function vw(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function $T(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||Le.between(e,t,o)}function Wq(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 am(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 kr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function kw(n,e,t){let o=n.state.selection;if(o instanceof Le)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 kr(n,new Le(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=am(n.state,e);return r&&r instanceof De?kr(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?De.isSelectable(i)?kr(n,new De(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):Oy?kr(n,new Le(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof De&&o.node.isInline)return kr(n,new Le(e>0?o.$to:o.$from));{let r=am(n.state,e);return r?kr(n,r):!1}}}function ud(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Rl(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Yi(n,e){return e<0?qq(n):Kq(n)}function qq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(xf&&t.nodeType==1&&o<ud(t)&&Rl(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Rl(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(BT(t))break;{let l=t.previousSibling;for(;l&&Rl(l,-1);)r=t.parentNode,i=Hi(l),l=l.previousSibling;if(l)t=l,o=ud(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?cm(n,t,o):r&&cm(n,r,i)}function Kq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=ud(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Rl(l,1))i=t,s=++o;else break}else{if(BT(t))break;{let l=t.nextSibling;for(;l&&Rl(l,1);)i=l.parentNode,s=Hi(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=ud(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&cm(n,i,s)}function BT(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Jq(n,e){for(;n&&e==n.childNodes.length&&!Ny(n);)e=Hi(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 Gq(n,e){for(;n&&!e&&!Ny(n);)e=Hi(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 cm(n,e,t){if(e.nodeType!=3){let i,s;(s=Jq(e,t))?(e=s,t=0):(i=Gq(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(ST(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&&$y(n)},50)}function ww(n,e){let t=n.state.doc.resolve(e);if(!(ar||AT)&&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 xw(n,e,t){let o=n.state.selection;if(o instanceof Le&&!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=am(n.state,e);if(s&&s instanceof De)return kr(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Co?Ie.near(s,e):Ie.findFrom(s,e);return l?kr(n,l):!1}return!1}function Cw(n,e){if(!(n.state.selection instanceof Le))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 Sw(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Xq(n){if(!Fi||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;Sw(n,o,"true"),setTimeout(()=>Sw(n,o,"false"),20)}return!1}function Yq(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Qq(n,e){let t=e.keyCode,o=Yq(e);if(t==8||Dn&&t==72&&o=="c")return Cw(n,-1)||Yi(n,-1);if(t==46&&!e.shiftKey||Dn&&t==68&&o=="c")return Cw(n,1)||Yi(n,1);if(t==13||t==27)return!0;if(t==37||Dn&&t==66&&o=="c"){let r=t==37?ww(n,n.state.selection.from)=="ltr"?-1:1:-1;return kw(n,r,o)||Yi(n,r)}else if(t==39||Dn&&t==70&&o=="c"){let r=t==39?ww(n,n.state.selection.from)=="ltr"?1:-1:1;return kw(n,r,o)||Yi(n,r)}else{if(t==38||Dn&&t==80&&o=="c")return xw(n,-1,o)||Yi(n,-1);if(t==40||Dn&&t==78&&o=="c")return Xq(n)||xw(n,1,o)||Yi(n,1);if(o==(Dn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function RT(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")||kf.fromSchema(n.state.schema),l=VT(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=PT[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.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 DT(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 Z(X.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=kf.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=n6(t),Oy&&o6(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[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")||ld.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!Zq.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=r6(Ew(l,+d[1],+d[2]),d[4]);else if(l=Z.maxOpen(e6(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=Ew(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const Zq=/^(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 e6(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&&IT(l,r,s,i[i.length-1],0))i[i.length-1]=a;else{i.length&&(i[i.length-1]=LT(i[i.length-1],r.length));let u=_T(s,l);i.push(u),o=o.matchType(u.type),r=l}}),i)return X.from(i)}return n}function _T(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,X.from(n));return n}function IT(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=IT(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(X.from(_T(t,n,r+1))))}}function LT(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,LT(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(X.empty,!0);return n.copy(t.append(o))}function um(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=um(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(X.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Ew(n,e,t){return e<n.openStart&&(n=new Z(um(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new Z(um(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const PT={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 Mw=null;function VT(){return Mw||(Mw=document.implementation.createHTMLDocument("title"))}let Bp=null;function t6(n){let e=window.trustedTypes;return e?(Bp||(Bp=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Bp.createHTML(n)):n}function n6(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=VT().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&PT[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=t6(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function o6(n){let e=n.querySelectorAll(ar?"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 r6(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=X.from(a.create(o[l+1],r)),i++,s++}return new Z(r,i,s)}const ro={},Nn={};function Or(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}Nn.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!HT(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Fa&&ar&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Ay&&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,ET(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||Qq(n,t)?t.preventDefault():Or(n,"key")};Nn.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};Nn.keypress=(n,e)=>{let t=e;if(HT(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 Le)||!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 Cf(n){return{left:n.clientX,top:n.clientY}}function i6(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function By(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 bs(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 s6(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&De.isSelectable(o)?(bs(n,new De(t)),!0):!1}function l6(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof De&&(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(De.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?(bs(n,De.create(n.state.doc,r)),!0):!1}function a6(n,e,t,o,r){return By(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?l6(n,t):s6(n,t))}function c6(n,e,t,o){return By(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function u6(n,e,t,o){return By(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||d6(n,t,o)}function d6(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(bs(n,Le.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)bs(n,Le.create(o,l+1,l+1+s.content.size));else if(De.isSelectable(s))bs(n,De.create(o,l));else continue;return!0}}function Ry(n){return dd(n)}const zT=Dn?"metaKey":"ctrlKey";ro.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=Ry(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&i6(t,n.input.lastClick)&&!t[zT]&&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(Cf(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new f6(n,s,t,!!o)):(i=="doubleClick"?c6:u6)(n,s.pos,s.inside,t)?t.preventDefault():Or(n,"pointer"))};class f6{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[zT],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.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:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof De&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xf&&!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)),Or(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(()=>$y(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(Cf(e))),this.updateAllowDefault(e),this.allowDefault||!t?Or(this.view,"pointer"):a6(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Fi&&this.mightDrag&&!this.mightDrag.node.isAtom||ar&&!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)?(bs(this.view,Ie.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Or(this.view,"pointer")}move(e){this.updateAllowDefault(e),Or(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)}}ro.touchstart=n=>{n.input.lastTouch=Date.now(),Ry(n),Or(n,"pointer")};ro.touchmove=n=>{n.input.lastTouch=Date.now(),Or(n,"pointer")};ro.contextmenu=n=>Ry(n);function HT(n,e){return n.composing?!0:Fi&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const p6=Fa?5e3:-1;Nn.compositionstart=Nn.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Le&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||ar&&AT&&h6(n)))n.markCursor=n.state.storedMarks||t.marks(),dd(n,!0),n.markCursor=null;else if(dd(n,!e.selection.empty),xf&&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}FT(n,p6)};function h6(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"}Nn.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++,FT(n,20))};function FT(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>dd(n),e))}function m6(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=g6());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function g6(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function dd(n,e=!1){if(!(Fa&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),m6(n),e||n.docView&&n.docView.dirty){let t=Hq(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 y6(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 ma=Ha&&TT<15||Ay&&zq<604;ro.copy=Nn.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=ma?null:t.clipboardData,s=o.content(),{dom:l,text:a}=RT(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):y6(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function b6(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function v6(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?dm(n,o.value,null,r,e):dm(n,o.textContent,o.innerHTML,r,e)},50)}function dm(n,e,t,o,r){let i=DT(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||Z.empty)))return!0;if(!i)return!1;let s=b6(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 jT(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," "):""}Nn.paste=(n,e)=>{let t=e;if(n.composing&&!Fa)return;let o=ma?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&dm(n,jT(o),o.getData("text/html"),r,t)?t.preventDefault():v6(n,t)};class k6{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const w6=Dn?"altKey":"ctrlKey";function UT(n,e){return n.someProp("dragCopies",o=>!o(e))??!e[w6]}ro.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(Cf(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof De?r.to-1:r.to))){if(o&&o.mightDrag)s=De.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=De.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:u,slice:d}=RT(n,l);(!t.dataTransfer.files.length||!ar||NT>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ma?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",ma||t.dataTransfer.setData("text/plain",u),n.dragging=new k6(d,UT(n,t),s)};ro.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};Nn.dragover=Nn.dragenter=(n,e)=>e.preventDefault();Nn.drop=(n,e)=>{try{x6(n,e,n.dragging)}finally{n.dragging=null}};function x6(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Cf(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=DT(n,jT(e.dataTransfer),ma?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&UT(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||Z.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Nq(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 u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&De.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new De(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($T(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}ro.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())&&$y(n)},20))};ro.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)};ro.beforeinput=(n,e)=>{if(ar&&Fa&&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,ET(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 Nn)ro[n]=Nn[n];function ga(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 fd{constructor(e,t){this.toDOM=e,this.spec=t||yi,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 In(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof fd&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ga(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Lr{constructor(e,t){this.attrs=e,this.spec=t||yi}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 In(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Lr&&ga(this.attrs,e.attrs)&&ga(this.spec,e.spec)}static is(e){return e.type instanceof Lr}destroy(){}}class Dy{constructor(e,t){this.attrs=e,this.spec=t||yi}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 In(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 Dy&&ga(this.attrs,e.attrs)&&ga(this.spec,e.spec)}destroy(){}}class In{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new In(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 In(e,e,new fd(t,o))}static inline(e,t,o,r){return new In(e,t,new Lr(o,r))}static node(e,t,o,r){return new In(e,t,new Dy(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Lr}get widget(){return this.type instanceof fd}}const as=[],yi={};class pt{constructor(e,t){this.local=e.length?e:as,this.children=t.length?t:as}static create(e,t){return t.length?pd(t,e,0,yi):nn}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==nn||e.maps.length==0?this:this.mapInner(e,t,0,0,o||yi)}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?C6(this.children,s||[],e,t,o,r,i):s?new pt(s.sort(bi),as):nn}add(e,t){return t.length?this==nn?pt.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let u=a+o,d;if(d=qT(t,l,u)){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,d,u+1):r.splice(i,0,a,a+l.nodeSize,pd(d,l,u+1,yi)),i+=3}});let s=WT(i?KT(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new pt(s.length?this.local.concat(s).sort(bi):this.local,r||this.children)}remove(e){return e.length==0||this==nn?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 d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=nn?o[i+2]=u:(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 pt(r,o):nn}forChild(e,t){if(this==nn)return this;if(t.isLeaf)return pt.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 Lr){let u=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;u<d&&(r||(r=[])).push(a.copy(u,d))}}if(r){let l=new pt(r.sort(bi),as);return o?new ei([l,o]):l}return o||nn}eq(e){if(this==e)return!0;if(!(e instanceof pt)||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 _y(this.localsInner(e))}localsInner(e){if(this==nn)return as;if(e.inlineContent||!this.local.some(Lr.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Lr||t.push(this.local[o]);return t}forEachSet(e){e(this)}}pt.empty=new pt([],[]);pt.removeOverlap=_y;const nn=pt.empty;class ei{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,yi));return ei.from(o)}forChild(e,t){if(t.isLeaf)return pt.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=nn&&(i instanceof ei?o=o.concat(i.members):o.push(i))}return ei.from(o)}eq(e){if(!(e instanceof ei)||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?_y(o?t:t.sort(bi)):as}static from(e){switch(e.length){case 0:return nn;case 1:return e[0];default:return new ei(e.every(t=>t instanceof pt)?e:e.reduce((t,o)=>t.concat(o instanceof pt?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function C6(n,e,t,o,r,i,s){let l=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let v=l[b+1];if(v<0||p>v+d-f)continue;let w=l[b]+d-f;h>=w?l[b+1]=p<=w?-2:-1:p>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[u+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[u+2].mapInner(t,y,d+1,n[u]+i+1,s);b!=nn?(l[u]=f,l[u+1]=h,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=S6(l,n,e,t,r,i,s),d=pd(u,o,0,s);e=d.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<d.children.length;f+=3){let h=d.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new pt(e.sort(bi),l)}function WT(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 In(r.from+e,r.to+e,r.type))}return t}function S6(n,e,t,o,r,i,s){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,r,u);f?t.push(f):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+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 qT(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 KT(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function pd(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let u=qT(n,l,a+t);if(u){i=!0;let d=pd(u,l,t+a+1,o);d!=nn&&r.push(a,a+l.nodeSize,d)}});let s=WT(i?KT(n):n,-t).sort(bi);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 pt(s,r):nn}function bi(n,e){return n.from-e.from||n.to-e.to}function _y(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),Tw(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),Tw(e,r,o.copy(i.from,o.to)));break}}}return e}function Tw(n,e,t){for(;e<n.length&&bi(t,n[e])>0;)e++;n.splice(e,0,t)}var Hr={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:"'"},hd={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},E6=typeof navigator<"u"&&/Mac/.test(navigator.platform),M6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Pt=0;Pt<10;Pt++)Hr[48+Pt]=Hr[96+Pt]=String(Pt);for(var Pt=1;Pt<=24;Pt++)Hr[Pt+111]="F"+Pt;for(var Pt=65;Pt<=90;Pt++)Hr[Pt]=String.fromCharCode(Pt+32),hd[Pt]=String.fromCharCode(Pt);for(var Rp in Hr)hd.hasOwnProperty(Rp)||(hd[Rp]=Hr[Rp]);function T6(n){var e=E6&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||M6&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?hd:Hr)[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 N6=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),A6=typeof navigator<"u"&&/Win/.test(navigator.platform);function O6(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))N6?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 $6(n){let e=Object.create(null);for(let t in n)e[O6(t)]=n[t];return e}function Dp(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 B6(n){let e=$6(n);return function(t,o){let r=T6(o),i,s=e[Dp(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Dp(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(A6&&o.ctrlKey&&o.altKey)&&(i=Hr[o.keyCode])&&i!=r){let l=e[Dp(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}let fm,pm;if(typeof WeakMap<"u"){let n=new WeakMap;fm=e=>n.get(e),pm=(e,t)=>(n.set(e,t),t)}else{const n=[];let e=0;fm=t=>{for(let o=0;o<n.length;o+=2)if(n[o]==t)return n[o+1]},pm=(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:u}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,u)}}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 fm(n)||pm(n,R6(n))}};function R6(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=D6(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*t;u<d;u++)o[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;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:v}=g.attrs;for(let w=0;w<b;w++){if(w+u>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-w});break}const k=r+w*e;for(let x=0;x<y;x++){o[k+x]==0?o[k+x]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:y-x});const C=v&&v[x];if(C){const S=(k+x)%e*2,M=s[S];M==null||M!=C&&s[S+1]==1?(s[S]=C,s[S+1]=1):M==C&&s[S+1]++}}}r+=y,d+=g.nodeSize}const p=(u+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new at(e,t,o,i);let a=!1;for(let u=0;!a&&u<s.length;u+=2)s[u]!=null&&s[u+1]<t&&(a=!0);return a&&_6(l,s,n),l}function D6(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 u=l.child(a);s+u.attrs.rowspan>o&&(i+=u.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 _6(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 u=0;u<a.colspan;u++){const d=e[(r+u)%n.width*2];d!=null&&(!a.colwidth||a.colwidth[u]!=d)&&((l||(l=I6(a)))[u]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function I6(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Gt(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 Sr=new Ty("selectingCells");function Di(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 io(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 Sf(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=Di(e.$head)||P6(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function P6(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 hm(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function V6(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Iy(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function JT(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 _i(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 GT(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 z6(n,e,t){const o=Gt(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 Ye=class Uo 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(d=>d!=t.pos-i);a.unshift(t.pos-i);const u=a.map(d=>{const f=o.nodeAt(d);if(!f)throw new RangeError(`No cell with offset ${d} found`);const p=i+d+1;return new vT(l.resolve(p),l.resolve(p+f.content.size))});super(u[0].$from,u[0].$to,u),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(hm(o)&&hm(r)&&Iy(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?Uo.rowSelection(o,r):i&&this.isColSelection()?Uo.colSelection(o,r):new Uo(o,r)}return Le.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 u=[];for(let d=a*t.width+r.left,f=r.left;f<r.right;f++,d++){const p=t.map[d];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=_i(b,0,g)),y>0&&(b=_i(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)}u.push(m)}s.push(e.child(a).copy(X.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new Z(X.from(l),1,1)}replace(e,t=Z.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(a.pos),s?Z.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 Z(X.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 Uo(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 Uo&&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 Uo(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Uo(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new Uo(e.resolve(t),e.resolve(o))}getBookmark(){return new H6(this.$anchorCell.pos,this.$headCell.pos)}};Ye.prototype.visible=!1;Ie.jsonID("cell",Ye);var H6=class XT{constructor(e,t){this.anchor=e,this.head=t}map(e){return new XT(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&&Iy(t,o)?new Ye(t,o):Ie.near(o,1)}};function F6(n){if(!(n.selection instanceof Ye))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(In.node(o,o+t.nodeSize,{class:"selectedCell"}))}),pt.create(n.doc,e)}function j6({$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 U6({$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 W6(n,e,t){const o=(e||n).selection,r=(e||n).doc;let i,s;if(o instanceof De&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Ye.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=Ye.rowSelection(l,l)}else if(!t){const l=at.get(o.node),a=o.from+1,u=a+l.map[l.width*l.height-1];i=Ye.create(r,a+1,u)}}else o instanceof Le&&j6(o)?i=Le.create(r,o.from):o instanceof Le&&U6(o)&&(i=Le.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const q6=new Ty("fix-tables");function YT(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 u=l,d=Math.min(r,s+3);u<d;u++)if(n.child(u)==a){l=u+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?YT(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function QT(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=K6(n,r,i,t))};return e?e.doc!=n.doc&&YT(e.doc,n.doc,0,o):n.doc.descendants(o),t}function K6(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 u=r.problems[a];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const f=d.attrs;for(let p=0;p<f.rowspan;p++)i[u.row+p]+=u.n;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,_i(f,f.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(t);o.delete(d,d+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,u=t+1;a<r.height;a++){const d=e.child(a),f=u+d.nodeSize,p=i[a];if(p>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=Gt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?u+1:f-1;o.insert(o.mapping.map(g),m)}u=f}return o.setMeta(q6,{fixTables:!0})}function Ro(n){const e=n.selection,t=Sf(n),o=t.node(-1),r=t.start(-1),i=at.get(o);return{...e instanceof Ye?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(t.pos-r),tableStart:r,map:i,table:o}}function ZT(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;z6(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],u=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,GT(u.attrs,r-e.colCount(a))),s+=u.attrs.rowspan-1}else{const a=i==null?Gt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);n.insert(n.mapping.map(t+u),a.createAndFill())}}return n}function J6(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(ZT(n.tr,t,t.left))}return!0}function G6(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(ZT(n.tr,t,t.right))}return!0}function X6(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],u=t.nodeAt(a),d=u.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,_i(d,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+u.nodeSize)}s+=d.rowspan}}function Y6(n,e){if(!io(n))return!1;if(e){const t=Ro(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;X6(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 Q6(n,e,t){var o;const r=Gt(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 eN(n,{map:e,tableStart:t,table:o},r){let i=t;for(let u=0;u<r;u++)i+=o.child(u).nodeSize;const s=[];let l=r>0?-1:0;Q6(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const f=e.map[d],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),u+=p.colspan-1}else{var a;const f=l==null?Gt(o.type.schema).cell:(a=o.nodeAt(e.map[d+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,Gt(o.type.schema).row.create(null,s)),n}function Z6(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(eN(n.tr,t,t.top))}return!0}function eK(n,e){if(!io(n))return!1;if(e){const t=Ro(n);e(eN(n.tr,t,t.bottom))}return!0}function tK(n,{map:e,table:t,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=t.child(u).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 u=0,d=r*e.width;u<e.width;u++,d++){const f=e.map[d];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[d-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),u+=p.colspan-1}else if(r<e.height&&f==e.map[d+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,u,t);n.insert(n.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function nK(n,e){if(!io(n))return!1;if(e){const t=Ro(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;tK(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 Nw(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function oK({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 Aw(n,e){const t=n.selection;if(!(t instanceof Ye)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=Ro(n),{map:r}=o;if(oK(r,o))return!1;if(e){const i=n.tr,s={};let l=X.empty,a,u;for(let d=o.top;d<o.bottom;d++)for(let f=o.left;f<o.right;f++){const p=r.map[d*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,u=h;else{Nw(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||u==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...GT(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const d=a+1+u.content.size,f=Nw(u)?a+1:d;i.replaceWith(f+o.tableStart,d+o.tableStart,l)}i.setSelection(new Ye(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function Ow(n,e){const t=Gt(n.schema);return rK(({node:o})=>t[o.type.spec.tableRole])(n,e)}function rK(n){return(e,t)=>{const o=e.selection;let r,i;if(o instanceof Ye){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=Di(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=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=Ro(e),f=e.tr;for(let h=0;h<d.right-d.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let p;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=r.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&h==d.top||f.insert(p=f.mapping.map(m+d.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),a[0]),o instanceof Ye&&f.setSelection(new Ye(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function iK(n,e){return function(t,o){if(!io(t))return!1;const r=Sf(t);if(r.nodeAfter.attrs[n]===e)return!1;if(o){const i=t.tr;t.selection instanceof Ye?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 sK(n){return function(e,t){if(!io(e))return!1;if(t){const o=Gt(e.schema),r=Ro(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 $w(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 ya(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?sK(n):function(t,o){if(!io(t))return!1;if(o){const r=Gt(t.schema),i=Ro(t),s=t.tr,l=$w("row",i,r),a=$w("column",i,r),u=(n==="column"?l:n==="row"&&a)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,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(d).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}ya("row",{useDeprecatedLogic:!0});ya("column",{useDeprecatedLogic:!0});const lK=ya("cell",{useDeprecatedLogic:!0});function aK(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 Bw(n){return function(e,t){if(!io(e))return!1;const o=aK(Sf(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(Le.between(r,V6(r))).scrollIntoView())}return!0}}function cK(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 wc(n,e){const t=n.selection;if(!(t instanceof Ye))return!1;if(e){const o=n.tr,r=Gt(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 Z(r,0,0))}),o.docChanged&&e(o)}return!0}function uK(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 u=e.child(a).content;const d=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(d||f)&&(u=mm(Gt(s).row,new Z(u,d,f)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(t||o?mm(Gt(s).row,new Z(e,t,o)).content:e);else return null;return dK(s,l)}function dK(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 u=r;u<r+l;u++)t[u]=(t[u]||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(X.empty),t[r]<o){const i=Gt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(X.from(s))}return{height:e.length,width:o,rows:e}}function mm(n,e){const t=n.createAndFill();return new Iq(t).replace(0,t.content.size,e).doc}function fK({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],u=[];for(let d=i[l]||0,f=0;d<o;f++){let p=a.child(f%a.childCount);d+p.attrs.colspan>o&&(p=p.type.createChecked(_i(p.attrs,p.attrs.colspan,d+p.attrs.colspan-o),p.content)),u.push(p),d+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(X.from(u))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],u=t[l%e];for(let d=0;d<u.childCount;d++){let f=u.child(d);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(X.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function pK(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=Gt(l);let u,d;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=u||(u=a.cell.createAndFill()):g=d||(d=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?d||(d=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const p=a.row.create(null,X.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!!(u||d)}function Rw(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let u=r;u<i;u++){const d=s*e.width+u,f=e.map[d];if(e.map[d-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})),u+=p.attrs.colspan-1}}return a}function Dw(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let u=r;u<i;u++){const d=u*e.width+s,f=e.map[d];if(e.map[d-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,_i(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(_i(p.attrs,0,s-h))),u+=p.attrs.rowspan-1}}return a}function _w(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,u=a+r.width,d=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}pK(f,s,i,t,u,d,p)&&h(),Rw(f,s,i,t,a,u,l,p)&&h(),Rw(f,s,i,t,a,u,d,p)&&h(),Dw(f,s,i,t,l,d,a,p)&&h(),Dw(f,s,i,t,l,d,u,p)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,u,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new Z(r.rows[m-l],0,0))}h(),f.setSelection(new Ye(f.doc.resolve(t+s.positionAt(l,a,i)),f.doc.resolve(t+s.positionAt(d-1,u-1,i)))),e(f)}const hK=B6({ArrowLeft:xc("horiz",-1),ArrowRight:xc("horiz",1),ArrowUp:xc("vert",-1),ArrowDown:xc("vert",1),"Shift-ArrowLeft":Cc("horiz",-1),"Shift-ArrowRight":Cc("horiz",1),"Shift-ArrowUp":Cc("vert",-1),"Shift-ArrowDown":Cc("vert",1),Backspace:wc,"Mod-Backspace":wc,Delete:wc,"Mod-Delete":wc});function Wc(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function xc(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof Ye)return Wc(t,o,Ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=tN(r,n,e);if(s==null)return!1;if(n=="horiz")return Wc(t,o,Ie.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=JT(l,n,e);let u;return a?u=Ie.near(a,1):e<0?u=Ie.near(t.doc.resolve(l.before(-1)),-1):u=Ie.near(t.doc.resolve(l.after(-1)),1),Wc(t,o,u)}}}function Cc(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;let s;if(i instanceof Ye)s=i;else{const a=tN(r,n,e);if(a==null)return!1;s=new Ye(t.doc.resolve(a))}const l=JT(s.$headCell,n,e);return l?Wc(t,o,new Ye(s.$anchorCell,l)):!1}}function mK(n,e){const t=n.state.doc,o=Di(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Ye(o))),!0):!1}function gK(n,e,t){if(!io(n.state))return!1;let o=uK(t);const r=n.state.selection;if(r instanceof Ye){o||(o={width:1,height:1,rows:[X.from(mm(Gt(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=fK(o,l.right-l.left,l.bottom-l.top),_w(n.state,n.dispatch,s,l,o),!0}else if(o){const i=Sf(n.state),s=i.start(-1);return _w(n.state,n.dispatch,s,at.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function yK(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=Iw(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof Ye)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=Di(n.state.selection.$anchor))!=null&&((t=_p(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,u){let d=_p(n,u);const f=Sr.getState(n.state)==null;if(!d||!Iy(a,d))if(f)d=a;else return;const p=new Ye(a,d);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(Sr,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),Sr.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Sr,-1))}function l(a){const u=a,d=Sr.getState(n.state);let f;if(d!=null)f=n.state.doc.resolve(d);else if(Iw(n,u.target)!=o&&(f=_p(n,e),!f))return s();f&&i(f,u)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function tN(n,e,t){if(!(n.state.selection instanceof Le))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 Iw(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function _p(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&&Di(n.state.doc.resolve(o))||Di(n.state.doc.resolve(r))}var bK=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")),gm(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,gm(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function gm(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.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 v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;a;){var d;const f=a.nextSibling;(d=a.parentNode)===null||d===void 0||d.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const Sn=new Ty("tableColumnResizing");function vK({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=bK,lastColumnResizable:r=!0}={}){const i=new wT({key:Sn,state:{init(s,l){var a;const u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,d=Gt(l.schema).table.name;return o&&u&&(u[d]=(f,p)=>new o(f,t,p)),new kK(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=Sn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{wK(s,l,n,r)},mouseleave:s=>{xK(s)},mousedown:(s,l)=>{CK(s,l,e,t)}},decorations:s=>{const l=Sn.getState(s);if(l&&l.activeHandle>-1)return NK(s,l.activeHandle)},nodeViews:{}}});return i}var kK=class qc{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(Sn);if(o&&o.setHandle!=null)return new qc(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new qc(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return hm(e.doc.resolve(r))||(r=-1),new qc(r,t.dragging)}return t}};function wK(n,e,t,o){if(!n.editable)return;const r=Sn.getState(n.state);if(r&&!r.dragging){const i=EK(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=Lw(n,e,"left",t):a-e.clientX<=t&&(s=Lw(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),u=at.get(a),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}nN(n,s)}}}function xK(n){if(!n.editable)return;const e=Sn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&nN(n,-1)}function CK(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=Sn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=SK(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(Sn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(f){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const p=Sn.getState(n.state);p!=null&&p.dragging&&(MK(n,p.activeHandle,Pw(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(Sn,{setDragging:null})))}function d(f){if(!f.which)return u(f);const p=Sn.getState(n.state);if(p&&p.dragging){const h=Pw(p.dragging,f,t);Vw(n,p.activeHandle,h,o)}}return Vw(n,s.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function SK(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 EK(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Lw(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=Di(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=at.get(l.node(-1)),u=l.start(-1),d=a.map.indexOf(l.pos-u);return d%a.width==0?-1:u+a.map[d-1]}function Pw(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function nN(n,e){n.dispatch(n.state.tr.setMeta(Sn,{setHandle:e}))}function MK(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 u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const f=i.map[d],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():TK(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function Vw(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&&gm(i,a.firstChild,a,o,l,t)}function TK(n){return Array(n).fill(0)}function NK(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return pt.empty;const i=at.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){const d=l+u*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(u==0||i.map[d]!=i.map[d-i.width])){var a;const f=i.map[d],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=Sn.getState(n))===null||a===void 0)&&a.dragging&&t.push(In.node(s+f,s+f+r.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),t.push(In.widget(p,h))}}return pt.create(n.doc,t)}function AK({allowTableNodeSelection:n=!1}={}){return new wT({key:Sr,state:{init(){return null},apply(e,t){const o=e.getMeta(Sr);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:yK},createSelectionBetween(e){return Sr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:mK,handleKeyDown:hK,handlePaste:gK},appendTransaction(e,t,o){return W6(o,QT(o,t),n)}})}var OK=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",de(this.options.HTMLAttributes,n),0]}}),$K=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",de(this.options.HTMLAttributes,n),0]}}),BK=Oe.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",de(this.options.HTMLAttributes,n),0]}});function ym(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function zw(n,e,t,o,r,i){var s;let l=0,a=!0,u=e.firstChild;const d=n.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:m,colwidth:g}=d.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],v=b?`${b}px`:"";if(l+=b||o,b||(a=!1),u){if(u.style.width!==v){const[w,k]=ym(o,b);u.style.setProperty(w,k)}u=u.nextSibling}else{const w=document.createElement("col"),[k,x]=ym(o,b);w.style.setProperty(k,x),e.appendChild(w)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=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 RK=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")),zw(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,zw(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 DK(n,e,t,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:p,colwidth:h}=l.child(d).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]=ym(e,g);s.push(["col",{style:`${y}: ${b}`}])}}const a=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:u}}function Hw(n,e){return n.createAndFill()}function _K(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 IK(n,e,t,o,r){const i=_K(n),s=[],l=[];for(let u=0;u<t;u+=1){const d=Hw(i.cell);if(d&&l.push(d),o){const f=Hw(i.header_cell);f&&s.push(f)}}const a=[];for(let u=0;u<e;u+=1)a.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,a)}function LK(n){return n instanceof Ye}var Sc=({editor:n})=>{const{selection:e}=n.state;if(!LK(e))return!1;let t=0;const o=Nd(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},PK="";function VK(n){return(n||"").replace(/\s+/g," ").trim()}function oN(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:PK;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(w=>e.renderChildren(w)).join(r):y=g.content?e.renderChildren(g.content):"";const b=VK(y),v=g.type==="tableHeader";m.push({text:b,isHeader:v})}),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)),u=i[0],d=u.some(h=>h.isHeader);let f=`
326
- `;const p=new Array(s).fill(0).map((h,m)=>d&&u[m]&&u[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
- `,(d?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 zK=oN,HK=Oe.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:RK,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}=DK(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",de(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)=>zK(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=IK(i.schema,n,e,t);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(Le.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>J6(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>G6(n,e),deleteColumn:()=>({state:n,dispatch:e})=>Y6(n,e),addRowBefore:()=>({state:n,dispatch:e})=>Z6(n,e),addRowAfter:()=>({state:n,dispatch:e})=>eK(n,e),deleteRow:()=>({state:n,dispatch:e})=>nK(n,e),deleteTable:()=>({state:n,dispatch:e})=>cK(n,e),mergeCells:()=>({state:n,dispatch:e})=>Aw(n,e),splitCell:()=>({state:n,dispatch:e})=>Ow(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>ya("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>ya("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>lK(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Aw(n,e)?!0:Ow(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>iK(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>Bw(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Bw(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&QT(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const o=Ye.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:Sc,"Mod-Backspace":Sc,Delete:Sc,"Mod-Delete":Sc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[vK({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],AK({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Be(ne(n,"tableRole",e))}}});ye.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(HK.configure(this.options.table)),this.options.tableCell!==!1&&n.push(OK.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push($K.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(BK.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",de(n),0]},renderMarkdown:(n,e)=>n.content&&n.content.length?oN(n.content[0],e):""}),jK=c.defineComponent({__name:"view",props:dt,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(An),c.mergeProps(e,{class:"o-table-wrapper-view"}),{default:c.withCtx(()=>[c.createVNode(c.unref(rr),{as:"table"})]),_:1},16))}}),rN=FK.extend({addNodeView(){return mn(jK,{stopEvent:()=>!1})}});/**
330
- * Copyright 2026 Yiitap
331
- * @license MIT
332
- **/const UK=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,WK=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",de(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[Ps({find:UK,type:this.type,getAttributes:n=>{const[e]=n;return{src:e}}})]}}),qK={key:1,class:"video-container"},KK={key:1},JK=c.defineComponent({__name:"view",props:dt,setup(n){const e=n,{tr:t}=ue(),{isEditable:o}=we(),r=c.ref(!1),i=c.ref({}),s=c.ref(null),l=c.ref(!1),a=c.ref(!1),u=c.computed({get(){return e.node.attrs.caption},set(v){e.updateAttributes({caption:v})}}),d=c.computed({get(){return e.node.attrs.src},set(v){e.updateAttributes({src:v})}});function f(v){switch(r.value=!1,v.value){case"replace":b(!0);break}}function p(){l.value=!0,setTimeout(()=>{var v;(v=s.value)==null||v.focus()},0)}function h(){l.value=!1}function m(){d.value==="init"&&b(!0)}function g(v){r.value=!0,i.value=v}function y(v){d.value=v,b(!1)}function b(v){a.value=v}return c.onMounted(()=>{b(d.value==="init")}),(v,w)=>{var k;return c.openBlock(),c.createBlock(c.unref(An),c.mergeProps(e,{class:["o-video-view",{readonly:!((k=v.editor)!=null&&k.isEditable),init:d.value==="init"}],as:"div",onContextmenu:c.withModifiers(g,["prevent"]),onClick:m}),{default:c.withCtx(()=>[c.createVNode(c.unref(To),{modelValue:a.value,"onUpdate:modelValue":w[1]||(w[1]=x=>a.value=x),placement:d.value==="init"?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(Da),{val:d.value==="init"?"":d.value,type:"video",onInput:y},null,8,["val"])]),default:c.withCtx(()=>{var x;return[d.value==="init"?(c.openBlock(),c.createBlock(c.unref(Vs),{key:0,icon:"videocam",placeholder:c.unref(t)("label.videoAdd")},null,8,["placeholder"])):(c.openBlock(),c.createElementBlock("div",qK,[w[3]||(w[3]=c.createElementVNode("div",{class:"video-cover"},null,-1)),c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Ra),c.mergeProps({key:0},e,{onAction:f}),{default:c.withCtx(()=>[c.createVNode(c.unref(Ae),{icon:"subtitles",tooltip:c.unref(t)("label.caption"),onClick:p},null,8,["tooltip"])]),_:1},16)):c.createCommentVNode("",!0),c.createElementVNode("video",c.mergeProps(v.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[c.createElementVNode("source",c.normalizeProps(c.guardReactiveProps(v.node.attrs)),null,16)],16),c.createElementVNode("div",{class:"caption",onClick:p},[(x=v.editor)!=null&&x.isEditable&&l.value?(c.openBlock(),c.createBlock(c.unref(Un),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":w[0]||(w[0]=C=>u.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:h},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",KK,c.toDisplayString(u.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(zi),{modelValue:r.value,"onUpdate:modelValue":w[2]||(w[2]=x=>r.value=x),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(sr),c.mergeProps(e,{onAction:f}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),iN=WK.extend({addNodeView(){return mn(JK)}}),sN=["BackgroundColor","Color","Focus","FontFamily","Highlight","Subscript","Superscript","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OBlockquote","OCallout","OCodeBlock","OHorizontalRule","OLink","OSelectionDecoration","OSlash","OSlashZh","OTable"],lN={BackgroundColor:n=>Gg.configure({types:["textStyle"],...n}),BlockMath:n=>_l.BlockMath.configure(n),Collaboration:n=>YS.configure(n),CollaborationCaret:n=>QS.configure(n),Color:n=>Xg.configure(n),Focus:n=>L1.configure(n),FontFamily:n=>Yg.configure(n),Highlight:n=>ZS.configure({multicolor:!0,...n}),Image:n=>eE.configure(n),InlineMath:n=>_l.InlineMath.configure(n),Link:n=>mg.configure(n),Markdown:n=>Fw.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1},...n}),Subscript:n=>nE.configure(n),Superscript:n=>oE.configure(n),TaskItem:n=>_M.configure(n),TaskList:n=>yg.configure({itemTypeName:"taskItem",...n}),TextAlign:n=>rE.configure({types:["heading","paragraph"],...n}),TextStyle:n=>Jg.configure(n),Typography:n=>iE.configure(n),Underline:n=>$1.configure(n),UniqueID:n=>lE.configure({attributeName:"id",types:["aiBlock","blockquote","blockMath","codeBlock","callout","details","heading","image","paragraph","table-wrapper","video"],...n}),OAiBlock:n=>zM.configure(n),OAudio:n=>HM.configure(n),OBlockMath:n=>FM.configure(n),OBlockquote:n=>jM.configure({triggerCharacters:['"',"“","”"],...n}),OCallout:n=>UM.configure(n),OCodeBlock:n=>JM.configure(n),OColon:n=>IM.configure({suggestion:VM,...n}),OSlash:n=>LM.configure({suggestion:em,...n}),OSlashZh:n=>PM.configure({suggestion:em,...n}),OColorHighlighter:n=>aE.configure(n),OColumnDropCursor:n=>Lh.configure(n),OHorizontalRule:n=>XM.configure(n),OImage:n=>YM.configure(n),OInlinePlaceholder:n=>cE.configure(n),OLink:n=>QM.configure({openOnClick:!1,...n}),OModelViewer:n=>ZM.configure(n),OSelectionDecoration:n=>hE.configure(n),OShortcut:n=>gE.configure({selectableNodes:["aiBlock","blockquote","callout","codeBlock","column","columns","heading","listItem","paragraph","tableCell","tableHeader","taskItem"],...n}),OVideo:n=>iN.configure(n),Table:n=>[lf.configure({resizable:!0,...n}),Ku,sf,rf],ODetails:n=>[GM.configure({persist:!0,HTMLAttributes:{class:"details"},...n}),mS,gS],OMultiColumn:n=>[dE,uE,pE.configure(n),Lh],OTable:n=>[rN,yE.configure({resizable:!0,...n}),Ku,tT,eT]},aN=n=>typeof n=="object"&&n!==null&&(n.type==="extension"||n.type==="node"||n.type==="mark"),md=n=>{const{name:e,configure:t}=n,o=lN[e];return o?o(t):(console.warn(`[YiiEditor] Extension factory for "${String(e)}" not found.`),null)},Ly=n=>n.flatMap(e=>Array.isArray(e)?Ly(e):aN(e)?e:typeof e=="string"?md({name:e})??[]:typeof e=="object"&&e!==null&&"name"in e?md(e)??[]:[]),GK={configure(n={}){return sN.flatMap(e=>{const t=n[e];return t===!1?[]:md({name:e,configure:typeof t=="object"?t:void 0})??[]})}},XK=["data-theme"],cN=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}=ue(),s=c.ref(!1),l=c.ref(!0),a=c.ref("en"),u=c.ref(),d=c.ref(!1);c.provide("darkMode",s),c.provide("isEditable",l),c.provide("locale",a),c.provide("aiOptions",u);const f=c.computed(()=>b()),p=gR({editable:o.editable,content:o.content,autofocus:o.autofocus,extensions:f.value,onCreate:()=>{d.value=!0,r("create",p.value)},onUpdate:({editor:v})=>{d.value&&r("update",{editor:v})},onTransaction:({editor:v,transaction:w})=>{r("transaction",{editor:v,transaction:w})}}),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 v=[];o.title?v.push(oh.extend({content:"heading block*"})):v.push(oh),v.push(mC.configure({includeChildren:!0,placeholder:({editor:k,node:x,pos:C})=>{const S=k.state.doc.resolve(C);for(let M=S.depth;M>0;M--){const N=S.node(M).type.name;if(["tableCell","tableHeader","table"].includes(N))return""}if(x.type.name==="heading"){const M=x.attrs.level;return C>0?`H${M}`:i("label.untitled")}else return x.type.name==="paragraph"?i("label.typeForCommands"):""}})),v.push(JD.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 w=Ly(o.extensions);return v.push(...w),v}return c.watch(()=>o.darkMode,v=>{s.value=v}),c.watch(()=>o.locale,v=>{a.value=v}),c.watch(()=>o.aiOptions,v=>{u.value=v},{deep:!0}),c.watch(()=>o.editable,v=>{var w;(w=p.value)==null||w.setEditable(v),l.value=v}),c.onBeforeMount(()=>{l.value=o.editable,u.value=o.aiOptions,s.value=o.darkMode,a.value=o.locale}),e({editor:p,darkMode:s,locale:a}),(v,w)=>{var k,x,C;return c.openBlock(),c.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[n.showMainMenu?(c.openBlock(),c.createBlock(fS,c.mergeProps({key:0},h.value,{class:"desktop-only"}),{left:c.withCtx(()=>[c.renderSlot(v.$slots,"toolbar-left")]),right:c.withCtx(()=>[c.renderSlot(v.$slots,"toolbar-right")]),_:3},16)):c.createCommentVNode("",!0),(k=c.unref(p))!=null&&k.isEditable&&n.showBubbleMenu?(c.openBlock(),c.createBlock(Vz,c.normalizeProps(c.mergeProps({key:1},m.value)),null,16)):c.createCommentVNode("",!0),(x=c.unref(p))!=null&&x.isEditable&&n.showFloatingMenu?(c.openBlock(),c.createBlock(Hz,c.normalizeProps(c.mergeProps({key:2},g.value)),null,16)):c.createCommentVNode("",!0),(C=c.unref(p))!=null&&C.isEditable&&n.sideMenu.show?(c.openBlock(),c.createBlock(Zz,c.normalizeProps(c.mergeProps({key:3},y.value)),null,16)):c.createCommentVNode("",!0),c.createVNode(c.unref(mR),{class:c.normalizeClass(["editor-content",`${n.pageView}-view`]),editor:c.unref(p)},null,8,["class","editor"])],8,XK)}}}),YK=(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},QK={installed:!1,spellcheck:!0,install(n){this.installed=!0,n.component("YiiEditor",cN)}};Object.defineProperty(exports,"BlockMath",{enumerable:!0,get:()=>_l.BlockMath});Object.defineProperty(exports,"InlineMath",{enumerable:!0,get:()=>_l.InlineMath});Object.defineProperty(exports,"Markdown",{enumerable:!0,get:()=>Fw.Markdown});exports.AddNode=KC;exports.AdvancedBlocks=CC;exports.AiBlocks=EC;exports.AiProviders=QC;exports.AskAiBlocks=SC;exports.BackgroundColor=Gg;exports.BasicBlocks=Ba;exports.BlockMenus=Bc;exports.Blocks=Hu;exports.BrandColor=ve;exports.Collaboration=YS;exports.CollaborationCaret=QS;exports.ColonSuggestion=VM;exports.Color=Xg;exports.Column=uE;exports.ColumnContainer=dE;exports.ColumnDropCursor=Lh;exports.CommandManager=xa;exports.CommonBlocks=zu;exports.DefaultBubble=tS;exports.DefaultEmbedServices=I2;exports.DefaultExtensionNames=sN;exports.DefaultFloating=aS;exports.DefaultMenu=ZC;exports.Details=hS;exports.DetailsContent=mS;exports.DetailsSummary=gS;exports.DragNode=JC;exports.Editor=Nt;exports.EmojiSuggestion=I5;exports.Extendable=Id;exports.Extension=ye;exports.Focus=L1;exports.FontFamily=Yg;exports.Fragment=rR;exports.Highlight=ZS;exports.Image=eE;exports.ImageBubble=rS;exports.ImageLinkBubble=iS;exports.InlineMathBubble=nS;exports.InputRule=Wr;exports.Link=mg;exports.LinkBubble=oS;exports.MappablePosition=_d;exports.Mark=Wn;exports.MarkView=dR;exports.Mention=jj;exports.MoreBubble=sS;exports.MultiColumn=pE;exports.Node=Oe;exports.NodePos=Yx;exports.NodeView=r1;exports.OAiBlock=zM;exports.OAiMenu=uS;exports.OAlignDropdown=Og;exports.OAudio=HM;exports.OBlockList=Gd;exports.OBlockListItem=Sh;exports.OBlockMath=FM;exports.OBlockMenu=sr;exports.OBlockPlaceholder=Vs;exports.OBlockPopover=To;exports.OBlockToolbar=Ra;exports.OBlockquote=jM;exports.OBtn=Xe;exports.OBtnGroup=GC;exports.OCallout=UM;exports.OCalloutColorBoard=Rg;exports.OCalloutColorDropdown=rP;exports.OCharCommand=g5;exports.OCheckbox=jg;exports.OCodeBlock=JM;exports.OCodeBlockDownloadDropdown=yC;exports.OCodeBlockViewDropdown=bC;exports.OColonCommand=IM;exports.OColorBoard=Ni;exports.OColorHighlighter=aE;exports.OCommandBtn=bt;exports.OCommonBtn=_r;exports.OContextMenu=zi;exports.ODetails=GM;exports.ODialog=Ug;exports.ODivider=zt;exports.ODocToc=gP;exports.OEmojiSelect=Xd;exports.OExtensionDropdown=vC;exports.OHorizontalRule=XM;exports.OIcon=G;exports.OImage=YM;exports.OImageViewer=XC;exports.OInlineMathMenu=dS;exports.OInlinePlaceholder=cE;exports.OInput=Un;exports.OLanguageDropdown=MC;exports.OLink=QM;exports.OLinkBtn=$g;exports.OList=Mt;exports.OListItem=vt;exports.OMainMenu=fS;exports.OMediaInput=Da;exports.OMenubarBtn=Ae;exports.OMetaInput=Yd;exports.OModelViewer=ZM;exports.ONodeView=An;exports.OPlaceholder=mC;exports.OPopover=Re;exports.OSelectionDecoration=hE;exports.OShortcut=gE;exports.OSlashCommand=LM;exports.OSlashZhCommand=PM;exports.OStarterKit=GK;exports.OTable=yE;exports.OTableCell=eT;exports.OTableCellBackground=NC;exports.OTableCellHandler=Fu;exports.OTableGrid=TC;exports.OTableHeader=tT;exports.OTableWrapper=rN;exports.OTaskItem=_M;exports.OTextColorBoard=Dg;exports.OTextarea=YC;exports.OToast=Zl;exports.OTooltip=Tn;exports.OVideo=iN;exports.PasteRule=Ld;exports.Prompts=Wg;exports.ResizableNodeView=Vd;exports.ResizableNodeview=sR;exports.SlashSuggestion=em;exports.StyleBlocks=Vu;exports.Subscript=nE;exports.Superscript=oE;exports.Table=lf;exports.TableBubble=lS;exports.TableCell=rf;exports.TableHeader=sf;exports.TableMenu=eS;exports.TableRow=Ku;exports.TaskItem=A1;exports.TaskList=yg;exports.TextAlign=rE;exports.TextStyle=Jg;exports.Tracker=hR;exports.Typography=iE;exports.Underline=$1;exports.UniqueID=lE;exports.YiiEditor=cN;exports.YiiEditorPlugin=QK;exports.callOrReturn=Be;exports.canInsertNode=e1;exports.combineTransactionSteps=Md;exports.commands=zm;exports.convertShortcut=xC;exports.copyToClipboard=qM;exports.createAtomBlockMarkdownSpec=n1;exports.createBlockMarkdownSpec=Na;exports.createChainableState=wa;exports.createDocument=ru;exports.createElement=Zx;exports.createExtension=md;exports.createExtensionList=Ly;exports.createInlineMarkdownSpec=og;exports.createMappablePosition=Bx;exports.createNodeFromContent=Cs;exports.createStyleTag=Qx;exports.defaultBlockAt=Td;exports.deleteProps=Zp;exports.elementFromString=ds;exports.escapeForRegEx=ng;exports.extensionRegistry=lN;exports.extensions=Px;exports.findChildren=Xo;exports.findChildrenInRange=Um;exports.findDuplicates=xx;exports.findParentNode=Ur;exports.findParentNodeClosestToPos=Nd;exports.flattenExtensions=Ad;exports.fromString=wx;exports.generateHTML=Cx;exports.generateJSON=Jm;exports.generateText=TB;exports.getAttributes=Xm;exports.getAttributesFromExtensions=qm;exports.getChangedRanges=Rd;exports.getDebugJSON=Mx;exports.getExtensionField=ne;exports.getHTMLFromFragment=Ea;exports.getMarkAttributes=jm;exports.getMarkRange=Pi;exports.getMarkType=Oo;exports.getMarksBetween=Dd;exports.getNodeAtPosition=Tx;exports.getNodeAttributes=Sx;exports.getNodeType=ut;exports.getProviderProp=D2;exports.getRenderedAttributes=Ss;exports.getSchema=$d;exports.getSchemaByResolvedExtensions=Km;exports.getSchemaTypeByName=es;exports.getSchemaTypeNameByName=Sa;exports.getSplittedAttributes=bl;exports.getText=Bd;exports.getTextBetween=Gm;exports.getTextContentFromNodes=Nx;exports.getTextSerializersFromSchema=Ma;exports.getUpdatedPosition=Zm;exports.h=Zx;exports.htmlToJSON=Bg;exports.htmlToJSON0=WL;exports.injectExtensionAttributesToParseRule=eh;exports.inputRulesPlugin=Dx;exports.isActive=Ym;exports.isAndroid=Ul;exports.isAtEndOfNode=Ax;exports.isAtStartOfNode=Ox;exports.isEmptyObject=kx;exports.isExtensionInstance=aN;exports.isExtensionRulesEnabled=th;exports.isFirefox=lR;exports.isFunction=Wm;exports.isList=nh;exports.isMacOS=Fm;exports.isMarkActive=iu;exports.isNodeActive=Zo;exports.isNodeEmpty=Ta;exports.isNodeSelection=Qm;exports.isNumber=Ix;exports.isPlainObject=tl;exports.isRegExp=Ed;exports.isSafari=yx;exports.isString=aR;exports.isTextSelection=Ca;exports.isiOS=Ci;exports.markInputRule=Vr;exports.markPasteRule=tr;exports.markdown=t1;exports.mergeAttributes=de;exports.mergeDeep=tg;exports.minMax=go;exports.nodeInputRule=Ps;exports.nodePasteRule=fR;exports.objectIncludes=jl;exports.parseAttributes=zd;exports.parseIndentedBlocks=lu;exports.pasteRulesPlugin=Lx;exports.posToDOMRect=eg;exports.removeDuplicates=Ex;exports.removeHtmlAttributes=YK;exports.renderNestedMarkdownContent=Fd;exports.resolveExtensions=Od;exports.resolveFocusPosition=Hm;exports.rewriteUnknownContent=AB;exports.selectionToInsertionEnd=vx;exports.serializeAttributes=Hd;exports.sortExtensions=hs;exports.splitExtensions=Si;exports.systemKeymap=wC;exports.textInputRule=rt;exports.textPasteRule=pR;exports.textblockTypeInputRule=su;exports.toJSON=kC;exports.updateMarkViewAttributes=rg;exports.useAi=Tg;exports.useCommon=qd;exports.useI18n=ue;exports.useNodeView=iC;exports.useTable=Ag;exports.useTheme=Vi;exports.useTiptap=we;exports.wrappingInputRule=er;
69
+ ${S}
70
+ `}function L(){h.value=!h.value}function q(){switch(k.value){case"mermaid":I();break}}function G(){Ho.initialize({...g,theme:l.value?"dark":b.value}),q()}async function I(){try{p.value="";const S=`mermaid-${Vf()}`,{svg:K}=await Ho.render(S,w.value);u.value=K}catch(S){console.error(S),p.value=S.message}}return e.watch(w,S=>{q()}),e.watch(k,S=>{q()}),e.watch(l,S=>{G()}),e.watch(C,(S,K)=>{S==="splitHorizontal"&&(m.value=K,c.value="mermaid")}),e.onMounted(()=>{var K;const S=o.editor.extensionManager.extensions.find(Q=>Q.name==="codeBlock");b.value=((K=S==null?void 0:S.options)==null?void 0:K.diagramTheme)||"default",G()}),(S,K)=>(e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:["o-code-block-view",`language-${k.value} ${C.value}`]}),{default:e.withCtx(()=>[e.createElementVNode("div",Nf,[e.createElementVNode("div",Ef,[e.createElementVNode("div",Sf,e.toDisplayString(k.value),1),e.createVNode(e.unref(pl),{language:k.value,class:"editable",onSelect:O},null,8,["language"])]),e.createElementVNode("div",Of,[C.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[C.value==="splitHorizontal"?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:"close",tooltip:e.unref(r)("label.close"),class:"editable",onClick:N},null,8,["tooltip"])):(e.openBlock(),e.createBlock(e.unref(rl),{key:1,modelValue:f.value,"onUpdate:modelValue":K[0]||(K[0]=Q=>f.value=Q),class:"editable"},null,8,["modelValue"]))],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(X),{icon:v.value,"icon-class":{"rotate-270":h.value},tooltip:"Wrap",class:"editable",onClick:L},null,8,["icon","icon-class"]),_.value?(e.openBlock(),e.createBlock(e.unref(nl),{key:1,onDownload:A})):(e.openBlock(),e.createBlock(e.unref(X),{key:2,icon:"download",tooltip:e.unref(r)("label.download"),onClick:A},null,8,["tooltip"])),x.value?(e.openBlock(),e.createBlock(e.unref(X),{key:3,icon:"play_circle",tooltip:"Run",onClick:V})):e.createCommentVNode("",!0),e.createVNode(e.unref(X),{icon:i.value,tooltip:e.unref(r)("label.copy"),onClick:M},null,8,["icon","tooltip"])])]),e.createVNode(e.unref($n),e.mergeProps({show:s.value.show,"onUpdate:show":K[1]||(K[1]=Q=>s.value.show=Q)},s.value,{onClose:N}),{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:d.value},null,8,$f)):c.value==="mermaid"?(e.openBlock(),e.createElementBlock("div",Af,null,512)):e.createCommentVNode("",!0)]),_:1},16,["show"]),e.createElementVNode("pre",null,[e.createVNode(e.unref(R.NodeViewContent),{as:"code",class:e.normalizeClass({wrap:h.value})},null,8,["class"])]),_.value?(e.openBlock(),e.createElementBlock("section",Tf,[p.value?(e.openBlock(),e.createElementBlock("div",Df,e.toDisplayString(p.value),1)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:u.value},null,8,Mf))])):e.createCommentVNode("",!0)]),_:1},16,["class"]))}}),ea=In.createLowlight(In.common);ea.register("mermaid",yf);const ta=Sa.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 R.VueNodeViewRenderer(Lf)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:ea}),Pf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,n=e.ref(!!o.node.attrs.open);function r(){const l=!n.value;n.value=l,o.updateAttributes({open:l})}return(l,a)=>(e.openBlock(),e.createBlock(e.unref(Ce),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:r},[e.createVNode(e.unref(E),{name:"details_arrow"})]),e.createVNode(e.unref(R.NodeViewContent))],2)]),_:1},16))}}),oa=Ot.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(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),n=new RegExp(`^[${o}]\\s$`);return[new oe.InputRule({find:n,handler:({state:r,range:l})=>{const{tr:a,schema:i}=r,{$from:s}=a.selection,c=s.before(s.depth),d=s.after(s.depth);a.delete(l.from,l.to);const u=i.nodes.details.create(null,[i.nodes.detailsSummary.create(null),i.nodes.detailsContent.create(null,i.nodes.paragraph.create())]);a.replaceRangeWith(c,d-1,u);const p=We.TextSelection.near(a.doc.resolve(c+2));return a.setSelection(p),a}})]},addNodeView(){return R.VueNodeViewRenderer(Pf)}}),Rf={class:"horizontal"},If=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t;return(n,r)=>(e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:"o-horizontal-view"}),{default:e.withCtx(()=>[e.createElementVNode("div",Rf,[e.createVNode(e.unref(R.NodeViewContent),{as:"div",class:"divider"})])]),_:1},16))}}),na=xa.extend({draggable:!0,addNodeView(){return R.VueNodeViewRenderer(If)}}),jf={key:1,class:"image-panel"},Ff={class:"label"},zf={key:1,class:"resize-overlay"},qf={class:"resize-guide"},Hf={class:"size-display"},Uf={key:1},Wf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{tr:n}=P(),{downloadImage:r}=Oo(),{isEditable:l,getEditorImages:a}=U(),i=e.ref(!1),s=e.ref(!1),c=e.ref({}),d=e.ref(null),u=e.ref(!1),p=e.ref(!1),f=e.ref(0),m=e.ref([]),b=e.ref(),g=e.ref(null),k=e.ref(null),w=e.ref(null),h=e.ref(!1),x=e.ref(""),v=e.ref(0),_=e.ref(0),C=e.ref(0),O=e.ref(0),M=e.ref(o.node.attrs.width||0),A=e.ref(o.node.attrs.height||0),T=e.ref(0),z=e.ref(0),V=e.ref(0),N=e.ref(1200),$=e.ref(0),L=e.ref(0),q=e.ref(800),G=e.ref(400),I=e.ref(!1),S=e.ref(!0),K=e.ref(!1),Q=e.ref(o.node.attrs.positionY||0),de=e.ref(0),me=e.ref(0),ce=e.ref(!1),ne=e.computed(()=>o.node.attrs),re=e.computed({get(){return o.node.attrs.src},set(y){o.updateAttributes({src:y})}}),_e=e.computed({get(){return o.node.attrs.title},set(y){o.updateAttributes({title:y})}});function j(){u.value=!0,setTimeout(()=>{var y;(y=d.value)==null||y.focus()},0)}function Y(){r(o.node.attrs.src)}function J(){m.value=a(o.editor),f.value=m.value.findIndex(y=>y.pos===o.getPos())||0,p.value=!0}function le(){u.value=!1}function Se(){re.value==="init"&&De(!0)}function tt(y){i.value=!0,c.value=y}function ot(y){switch(i.value=!1,y.value){case"replace":De(!0);break}}function kt(y){re.value=y,De(!1)}function De(y){s.value=y}const nt=e.computed(()=>({width:`${M.value}px`,maxWidth:`${N.value}px`,height:`${T.value}px`,maxHeight:I.value?`${$.value}px`:"auto",cursor:h.value?yt():"default"}));function yt(){switch(x.value){case"left":return"ew-resize";case"right":return"ew-resize";case"bottom":return"ew-resize";default:return"default"}}function wt(){var y,B,D;if(w.value){z.value=w.value.naturalWidth,V.value=w.value.naturalHeight,q.value=((B=(y=b.value)==null?void 0:y.$el)==null?void 0:B.parentElement.getBoundingClientRect().width)??0,N.value=((D=document.querySelector(".layout"))==null?void 0:D.getBoundingClientRect().width)??1200;const W=z.value/V.value;q.value=Math.min(q.value,800),G.value=q.value/W,!M.value||!A.value?(I.value=z.value>q.value,I.value?(M.value=q.value,A.value=q.value/z.value*V.value):(M.value=z.value,A.value=V.value),Me()):I.value=M.value>q.value,L.value>0?T.value=L.value:(T.value=A.value,L.value=A.value),$.value=A.value,lt()}}function he(y,B){h.value=!0,x.value=B,C.value=y.clientX,O.value=y.clientY,v.value=M.value,_.value=A.value,document.addEventListener("mousemove",Oe),document.addEventListener("mouseup",Xe)}function Oe(y){if(!h.value)return;const B=y.clientX-C.value,D=y.clientY-O.value,W=z.value/V.value;let F=v.value,se=L.value;switch(x.value){case"left":F=v.value-B;break;case"right":F=v.value+B;break;case"bottom":se=L.value+D;break}const ve=F/W;M.value=Math.round(F),A.value=Math.round(ve),I.value=F>q.value,I.value?(T.value=se,$.value=A.value):(T.value=A.value,jo())}function Xe(){h.value=!1,x.value="",document.removeEventListener("mousemove",Oe),document.removeEventListener("mouseup",Xe),L.value=T.value,Me()}function Me(){o.updateAttributes({width:M.value,height:A.value,containerHeight:L.value})}const rt=e.computed(()=>!A.value||!T.value?0:Math.min(0,T.value-A.value)),xt=e.computed(()=>({transform:`translateY(${Q.value}px)`,cursor:qe.value?"grab":"default",transition:K.value?"none":"transform 0.2s ease"})),qe=e.computed(()=>S.value&&I.value&&T.value<A.value);function Ct(){S.value=!S.value}function lt(){I.value&&T.value<A.value?ce.value=!0:ce.value=!1}function jo(){Q.value!==0&&(Q.value=0,io())}function Fo(y){!qe.value||!ce.value||h.value||y.target.closest(".block-resizer")||(y.preventDefault(),y.stopPropagation(),K.value=!0,de.value=y.clientY,me.value=Q.value,document.addEventListener("mousemove",lo),document.addEventListener("mouseup",ao),document.body.style.userSelect="none",document.body.style.cursor="grabbing")}function lo(y){if(!K.value)return;const B=y.clientY-de.value;let D=me.value+B;D=Math.max(rt.value,Math.min(0,D)),Q.value=D}function ao(){K.value=!1,document.removeEventListener("mousemove",lo),document.removeEventListener("mouseup",ao),document.body.style.userSelect="",document.body.style.cursor="",io()}function io(){o.updateAttributes({positionY:Q.value})}return e.watch(()=>o.node.attrs.height,y=>{y&&(A.value=y)}),e.watch(()=>o.node.attrs.containerHeight,y=>{y&&(L.value=y,T.value=y,lt())}),e.watch(()=>o.node.attrs.positionY,y=>{y!==void 0&&(Q.value=y)}),e.onMounted(()=>{De(re.value==="init"),ne.value.width&&(M.value=ne.value.width),ne.value.height&&(A.value=ne.value.height),ne.value.containerHeight&&(L.value=ne.value.containerHeight)}),e.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(y,B)=>{var D;return e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps({ref_key:"imageView",ref:b},o,{class:["o-image-view",{max:I.value,"with-caption":ne.value.alt,readonly:!((D=y.editor)!=null&&D.isEditable),init:re.value==="init"}],as:"div",onContextmenu:e.withModifiers(tt,["prevent"]),onClick:Se}),{default:e.withCtx(()=>[e.createVNode(e.unref(je),{modelValue:s.value,"onUpdate:modelValue":B[4]||(B[4]=W=>s.value=W),placement:re.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(no),{val:re.value==="init"?"":re.value,type:"image",onInput:kt},null,8,["val"])]),default:e.withCtx(()=>{var W;return[re.value==="init"?(e.openBlock(),e.createBlock(e.unref(Pt),{key:0,icon:"image",placeholder:e.unref(n)("label.imageAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",jf,[e.createVNode(e.unref(oo),e.mergeProps(o,{onAction:ot}),{default:e.withCtx(()=>[e.unref(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[ce.value?(e.openBlock(),e.createBlock(e.unref(X),{key:0,icon:qe.value?"arrow_expand":"close","icon-class":qe.value?"rotate-315":"","content-class":"with-label",tooltip:e.unref(n)("image.repositionTips"),onClick:e.withModifiers(Ct,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("span",Ff,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(j,["stop"])},null,8,["tooltip"]),e.createVNode(e.unref(wn),{editor:y.editor},null,8,["editor"]),e.createVNode(e.unref(yn),{editor:y.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:Y},null,8,["tooltip"]),e.createVNode(e.unref(X),{icon:"zoom_in",tooltip:e.unref(n)("image.zoom"),onClick:J},null,8,["tooltip"])]),_:1},16),e.createElementVNode("div",{ref_key:"imageContainer",ref:g,class:"image-container",style:e.normalizeStyle(nt.value),onMousedown:Fo},[e.createElementVNode("div",{ref_key:"imageWrapper",ref:k,class:"image-wrapper",style:e.normalizeStyle(xt.value)},[e.createElementVNode("img",e.mergeProps({ref_key:"imageElement",ref:w},ne.value,{draggable:"true","data-drag-handle":"",onLoad:wt}),null,16)],4),e.unref(l)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"block-resizer left",onMousedown:B[0]||(B[0]=e.withModifiers(F=>he(F,"left"),["stop","prevent"]))},[...B[7]||(B[7]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),e.createElementVNode("div",{class:"block-resizer right",onMousedown:B[1]||(B[1]=e.withModifiers(F=>he(F,"right"),["stop","prevent"]))},[...B[8]||(B[8]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),I.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:B[2]||(B[2]=e.withModifiers(F=>he(F,"bottom"),["stop","prevent"]))},[...B[9]||(B[9]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):e.createCommentVNode("",!0),h.value?(e.openBlock(),e.createElementBlock("div",zf,[e.createElementVNode("div",qf,[e.createElementVNode("div",Hf,e.toDisplayString(M.value)+" × "+e.toDisplayString(T.value),1)])])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],36),e.createElementVNode("div",{class:"caption",onClick:j},[(W=y.editor)!=null&&W.isEditable&&u.value?(e.openBlock(),e.createBlock(e.unref(Ee),{key:0,ref_key:"captionInput",ref:d,class:"caption-input",modelValue:_e.value,"onUpdate:modelValue":B[3]||(B[3]=F=>_e.value=F),type:"text",placeholder:"Input caption",autosize:"",onBlur:le},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Uf,e.toDisplayString(_e.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(ht),{modelValue:i.value,"onUpdate:modelValue":B[5]||(B[5]=W=>i.value=W),event:c.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:ot}),null,16)]),_:1},8,["modelValue","event"]),e.createVNode(e.unref(Ol),{show:p.value,"onUpdate:show":B[6]||(B[6]=W=>p.value=W),images:m.value,current:f.value},{title:e.withCtx(()=>[...B[10]||(B[10]=[e.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class"])}}}),ra=$a.extend({addNodeView(){return R.VueNodeViewRenderer(Wf)}}).configure({inline:!0});function Yf(t){return new We.Plugin({key:new We.PluginKey("handleClickSelectLink"),props:{handleClick:(o,n,r)=>{const{schema:l,doc:a,tr:i}=o.state,s=oe.getMarkRange(a.resolve(n),l.marks.link);if(!s)return!1;const c=a.resolve(s.from),d=a.resolve(s.to),u=i.setSelection(new We.TextSelection(c,d));return o.dispatch(u),!0}}})}const la=sn.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],Yf({type:this.type})]}}).configure({openOnClick:!1}),Gf={key:1,class:"model-viewer-container"},Kf={key:1},Xf={class:"model-viewer-container"},Jf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{tr:n}=P(),{isEditable:r}=U(),l=e.ref(!1),a=e.ref({}),i=e.ref(null),s=e.ref(!1),c=e.ref(!1),d=e.ref({show:!1,fullscreen:!0}),u=e.computed({get(){return o.node.attrs.caption},set(v){o.updateAttributes({caption:v})}}),p=e.computed({get(){return o.node.attrs.src},set(v){o.updateAttributes({src:v})}});function f(v){switch(l.value=!1,v.value){case"replace":x(!0);break}}function m(){s.value=!0,setTimeout(()=>{var v;(v=i.value)==null||v.focus()},0)}function b(){s.value=!1}function g(){d.value.show=!0}function k(){p.value==="init"&&x(!0)}function w(v){l.value=!0,a.value=v}function h(v){p.value=v,x(!1)}function x(v){c.value=v}return e.onMounted(()=>{x(p.value==="init")}),(v,_)=>{var C;return e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:["o-model-viewer-view",{readonly:!((C=v.editor)!=null&&C.isEditable),init:p.value==="init"}],as:"div",onContextmenu:e.withModifiers(w,["prevent"]),onClick:k}),{default:e.withCtx(()=>[e.createVNode(e.unref(je),{modelValue:c.value,"onUpdate:modelValue":_[1]||(_[1]=O=>c.value=O),placement:p.value==="init"?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(no),{val:p.value==="init"?"":p.value,type:"video",onInput:h},null,8,["val"])]),default:e.withCtx(()=>{var O;return[p.value==="init"?(e.openBlock(),e.createBlock(e.unref(Pt),{key:0,icon:"3d_rotation",placeholder:e.unref(n)("label.model3dAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",Gf,[e.createVNode(e.unref(oo),e.mergeProps(o,{onAction:f}),{default:e.withCtx(()=>[e.unref(r)?(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:g},null,8,["tooltip"])]),_:1},16),e.createElementVNode("model-viewer",e.mergeProps(v.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},[(O=v.editor)!=null&&O.isEditable&&s.value?(e.openBlock(),e.createBlock(e.unref(Ee),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":_[0]||(_[0]=M=>u.value=M),type:"text",placeholder:"Input caption",autosize:"",onBlur:b},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Kf,e.toDisplayString(u.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(ht),{modelValue:l.value,"onUpdate:modelValue":_[2]||(_[2]=O=>l.value=O),event:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:f}),null,16)]),_:1},8,["modelValue","event"]),e.createVNode(e.unref($n),e.mergeProps({show:d.value.show,"onUpdate:show":_[3]||(_[3]=O=>d.value.show=O)},d.value,{title:e.unref(n)("label.model3d"),"dialog-class":"model-viewer-dialog"}),{default:e.withCtx(()=>[e.createElementVNode("div",Xf,[e.createElementVNode("model-viewer",e.mergeProps(v.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 R.VueNodeViewRenderer(Jf)}}),Zf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{tr:n}=P(),{showRowPopover:r,rowActions:l,isEditable:a,cellInfo:i,initProps:s,runCommand:c}=kn(),d=e.ref(!1);return e.onMounted(()=>{s({getPos:o.getPos,editor:o.editor}),d.value=i.value.colIndex===0}),(u,p)=>(e.openBlock(),e.createBlock(e.unref(R.NodeViewWrapper),e.mergeProps({class:"o-table-cell-view",as:"td"},u.node.attrs,{style:{background:u.node.attrs.background}}),{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.value?(e.openBlock(),e.createBlock(e.unref(Co),{key:0,modelValue:e.unref(r),"onUpdate:modelValue":p[0]||(p[0]=f=>e.isRef(r)?r.value=f:null),offset:[0,10],tooltip:e.unref(n)("table.addRow"),placement:"right-start","tooltip-offset":[0,2],"tooltip-placement":"left",onAdd:p[1]||(p[1]=f=>e.unref(c)("tableAddRow")),row:""},{default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),(f,m)=>(e.openBlock(),e.createBlock(e.unref(ie),{key:m,onClick:b=>e.unref(c)(f.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:f.icon,class:e.normalizeClass(f.class)},null,8,["name","class"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(R.NodeViewContent))]),_:1},16,["style"]))}}),ia=$e.TableCell.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return R.VueNodeViewRenderer(Zf,{stopEvent:()=>!1})}}),Qf=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{tr:n}=P(),{showColPopover:r,showRowPopover:l,columnActions:a,rowActions:i,isEditable:s,cellInfo:c,initProps:d,runCommand:u}=kn(),p=e.ref(!1),f=e.ref(!1);return e.onMounted(()=>{d({getPos:o.getPos,editor:o.editor}),p.value=c.value.rowIndex===0,f.value=c.value.colIndex===0}),(m,b)=>(e.openBlock(),e.createBlock(e.unref(R.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},[p.value?(e.openBlock(),e.createBlock(e.unref(Co),{key:0,modelValue:e.unref(r),"onUpdate:modelValue":b[0]||(b[0]=g=>e.isRef(r)?r.value=g:null),offset:[0,8],tooltip:e.unref(n)("table.addColumn"),placement:"bottom",column:"",onAdd:b[1]||(b[1]=g=>e.unref(u)("tableAddColumn"))},{default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(g,k)=>(e.openBlock(),e.createBlock(e.unref(ie),{key:k,onClick:w=>e.unref(u)(g.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:g.icon,class:e.normalizeClass(g.class)},null,8,["name","class"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):e.createCommentVNode("",!0),f.value?(e.openBlock(),e.createBlock(e.unref(Co),{key:1,modelValue:e.unref(l),"onUpdate:modelValue":b[2]||(b[2]=g=>e.isRef(l)?l.value=g:null),offset:[0,10],tooltip:e.unref(n)("table.addRow"),placement:"right-start","tooltip-offset":[0,2],"tooltip-placement":"left",row:"",onAdd:b[3]||(b[3]=g=>e.unref(u)("tableAddRow"))},{default:e.withCtx(()=>[e.createVNode(e.unref(ue),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(i).filter(g=>g.value!=="tableAddRowBefore"),(g,k)=>(e.openBlock(),e.createBlock(e.unref(ie),{key:k,onClick:w=>e.unref(u)(g.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref(E),{name:g.icon,class:e.normalizeClass(g.class)},null,8,["name","class"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.label)+" ",1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["modelValue","tooltip"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(R.NodeViewContent))]),_:1},16,["style"]))}}),ca=$e.TableHeader.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return R.VueNodeViewRenderer(Qf,{stopEvent:()=>!1})}}),em=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,n=e.ref(!1),r=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 l(a){n.value=a}return e.watch(r,a=>{l(a)}),(a,i)=>(e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:"o-table-wrapper-view"}),{default:e.withCtx(()=>[e.createVNode(e.unref(R.NodeViewContent),{as:"table"})]),_:1},16))}}),sa=Ta.TableWrapper.extend({addNodeView(){return R.VueNodeViewRenderer(em,{stopEvent:()=>!1})}}),tm={key:1,class:"video-container"},om={key:1},nm=e.defineComponent({__name:"view",props:R.nodeViewProps,setup(t){const o=t,{tr:n}=P(),{isEditable:r}=U(),l=e.ref(!1),a=e.ref({}),i=e.ref(null),s=e.ref(!1),c=e.ref(!1),d=e.computed({get(){return o.node.attrs.caption},set(h){o.updateAttributes({caption:h})}}),u=e.computed({get(){return o.node.attrs.src},set(h){o.updateAttributes({src:h})}});function p(h){switch(l.value=!1,h.value){case"replace":w(!0);break}}function f(){s.value=!0,setTimeout(()=>{var h;(h=i.value)==null||h.focus()},0)}function m(){s.value=!1}function b(){u.value==="init"&&w(!0)}function g(h){l.value=!0,a.value=h}function k(h){u.value=h,w(!1)}function w(h){c.value=h}return e.onMounted(()=>{w(u.value==="init")}),(h,x)=>{var v;return e.openBlock(),e.createBlock(e.unref(Ce),e.mergeProps(o,{class:["o-video-view",{readonly:!((v=h.editor)!=null&&v.isEditable),init:u.value==="init"}],as:"div",onContextmenu:e.withModifiers(g,["prevent"]),onClick:b}),{default:e.withCtx(()=>[e.createVNode(e.unref(je),{modelValue:c.value,"onUpdate:modelValue":x[1]||(x[1]=_=>c.value=_),placement:u.value==="init"?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(no),{val:u.value==="init"?"":u.value,type:"video",onInput:k},null,8,["val"])]),default:e.withCtx(()=>{var _;return[u.value==="init"?(e.openBlock(),e.createBlock(e.unref(Pt),{key:0,icon:"videocam",placeholder:e.unref(n)("label.videoAdd")},null,8,["placeholder"])):(e.openBlock(),e.createElementBlock("div",tm,[x[3]||(x[3]=e.createElementVNode("div",{class:"video-cover"},null,-1)),e.unref(r)?(e.openBlock(),e.createBlock(e.unref(oo),e.mergeProps({key:0},o,{onAction:p}),{default:e.withCtx(()=>[e.createVNode(e.unref(X),{icon:"subtitles",tooltip:e.unref(n)("label.caption"),onClick:f},null,8,["tooltip"])]),_:1},16)):e.createCommentVNode("",!0),e.createElementVNode("video",e.mergeProps(h.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[e.createElementVNode("source",e.normalizeProps(e.guardReactiveProps(h.node.attrs)),null,16)],16),e.createElementVNode("div",{class:"caption",onClick:f},[(_=h.editor)!=null&&_.isEditable&&s.value?(e.openBlock(),e.createBlock(e.unref(Ee),{key:0,ref_key:"captionInput",ref:i,class:"caption-input",modelValue:d.value,"onUpdate:modelValue":x[0]||(x[0]=C=>d.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:m},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",om,e.toDisplayString(d.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(ht),{modelValue:l.value,"onUpdate:modelValue":x[2]||(x[2]=_=>l.value=_),event:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ke),e.mergeProps(o,{onAction:p}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),ua=Da.Video.extend({addNodeView(){return R.VueNodeViewRenderer(nm)}}),da=["BackgroundColor","Color","Focus","FontFamily","Highlight","Subscript","Superscript","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OBlockquote","OCallout","OCodeBlock","OHorizontalRule","OLink","OSelectionDecoration","OSlash","OSlashZh","OTable"],pa={BackgroundColor:t=>Je.BackgroundColor.configure({types:["textStyle"],...t}),BlockMath:t=>Ut.BlockMath.configure(t),Collaboration:t=>hr.configure(t),CollaborationCaret:t=>kr.configure(t),Color:t=>Je.Color.configure(t),Focus:t=>gr.Focus.configure(t),FontFamily:t=>Je.FontFamily.configure(t),Highlight:t=>yr.configure({multicolor:!0,...t}),Image:t=>wr.configure(t),InlineMath:t=>Ut.InlineMath.configure(t),Link:t=>sn.configure(t),Markdown:t=>br.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1},...t}),Subscript:t=>xr.configure(t),Superscript:t=>Cr.configure(t),TaskItem:t=>Tr.configure(t),TaskList:t=>cn.TaskList.configure({itemTypeName:"taskItem",...t}),TextAlign:t=>_r.configure({types:["heading","paragraph"],...t}),TextStyle:t=>Je.TextStyle.configure(t),Typography:t=>Br.configure(t),Underline:t=>Vr.configure(t),UniqueID:t=>Nr.configure({attributeName:"id",types:["aiBlock","blockquote","blockMath","codeBlock","callout","details","heading","image","paragraph","table-wrapper","video"],...t}),OAiBlock:t=>Kl.configure(t),OAudio:t=>Xl.configure(t),OBlockMath:t=>Jl.configure(t),OBlockquote:t=>Zl.configure({triggerCharacters:['"',"“","”"],...t}),OCallout:t=>Ql.configure(t),OCodeBlock:t=>ta.configure(t),OColon:t=>st.ColonCommand.configure({suggestion:Gl,...t}),OSlash:t=>st.SlashCommand.configure({suggestion:an,...t}),OSlashZh:t=>st.SlashZhCommand.configure({suggestion:an,...t}),OColorHighlighter:t=>Er.configure(t),OColumnDropCursor:t=>Ue.ColumnDropCursor.configure(t),OHorizontalRule:t=>na.configure(t),OImage:t=>ra.configure(t),OInlinePlaceholder:t=>Sr.configure(t),OLink:t=>la.configure({openOnClick:!1,...t}),OModelViewer:t=>aa.configure(t),OSelectionDecoration:t=>Or.configure(t),OShortcut:t=>$r.configure({selectableNodes:["aiBlock","blockquote","callout","codeBlock","column","columns","heading","listItem","paragraph","tableCell","tableHeader","taskItem"],...t}),OVideo:t=>ua.configure(t),Table:t=>[$e.Table.configure({resizable:!0,...t}),$e.TableRow,$e.TableHeader,$e.TableCell],ODetails:t=>[oa.configure({persist:!0,HTMLAttributes:{class:"details"},...t}),Ot.DetailsContent,Ot.DetailsSummary],OMultiColumn:t=>[Ue.ColumnContainer,Ue.Column,Ue.MultiColumn.configure(t),Ue.ColumnDropCursor],OTable:t=>[sa,Ar.configure({resizable:!0,...t}),$e.TableRow,ca,ia]},fa=t=>typeof t=="object"&&t!==null&&(t.type==="extension"||t.type==="node"||t.type==="mark"),Eo=t=>{const{name:o,configure:n}=t,r=pa[o];return r?r(n):(console.warn(`[YiiEditor] Extension factory for "${String(o)}" not found.`),null)},Ln=t=>t.flatMap(o=>Array.isArray(o)?Ln(o):fa(o)?o:typeof o=="string"?Eo({name:o})??[]:typeof o=="object"&&o!==null&&"name"in o?Eo(o)??[]:[]),rm={configure(t={}){return da.flatMap(o=>{const n=t[o];return n===!1?[]:Eo({name:o,configure:typeof n=="object"?n:void 0})??[]})}},lm=["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 r=t,l=n,{tr:a}=P(),i=e.ref(!1),s=e.ref(!0),c=e.ref("en"),d=e.ref(),u=e.ref(!1);e.provide("darkMode",i),e.provide("isEditable",s),e.provide("locale",c),e.provide("aiOptions",d);const p=e.computed(()=>w()),f=R.useEditor({editable:r.editable,content:r.content,autofocus:r.autofocus,extensions:p.value,onCreate:()=>{u.value=!0,l("create",f.value)},onUpdate:({editor:h})=>{u.value&&l("update",{editor:h})},onTransaction:({editor:h,transaction:x})=>{l("transaction",{editor:h,transaction:x})}}),m=e.computed(()=>({editor:f.value,menu:r.mainMenu})),b=e.computed(()=>({editor:f.value,menu:r.bubbleMenu,aiOptions:r.aiOptions})),g=e.computed(()=>({editor:f.value,menu:r.floatingMenu})),k=e.computed(()=>({editor:f.value,add:r.sideMenu.add,title:r.title,menu:[]}));function w(){const h=[];r.title?h.push(Rn.extend({content:"heading block*"})):h.push(Rn),h.push(ft.configure({includeChildren:!0,placeholder:({editor:v,node:_,pos:C})=>{const O=v.state.doc.resolve(C);for(let M=O.depth;M>0;M--){const A=O.node(M).type.name;if(["tableCell","tableHeader","table"].includes(A))return""}if(_.type.name==="heading"){const M=_.attrs.level;return C>0?`H${M}`:a("label.untitled")}else return _.type.name==="paragraph"?a("label.typeForCommands"):""}})),h.push(ha.configure({dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},codeBlock:!1,document:!1,horizontalRule:!1,link:!1,blockquote:!1,trailingNode:r.title?{node:"paragraph",notAfter:["paragraph","heading"]}:{notAfter:[]},undoRedo:r.collab.enabled?!1:{depth:100,newGroupDelay:500}}));const x=Ln(r.extensions);return h.push(...x),h}return e.watch(()=>r.darkMode,h=>{i.value=h}),e.watch(()=>r.locale,h=>{c.value=h}),e.watch(()=>r.aiOptions,h=>{d.value=h},{deep:!0}),e.watch(()=>r.editable,h=>{var x;(x=f.value)==null||x.setEditable(h),s.value=h}),e.onBeforeMount(()=>{s.value=r.editable,d.value=r.aiOptions,i.value=r.darkMode,c.value=r.locale}),o({editor:f,darkMode:i,locale:c}),(h,x)=>{var v,_,C;return e.openBlock(),e.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":i.value?"dark":""},[t.showMainMenu?(e.openBlock(),e.createBlock(Wl,e.mergeProps({key:0},m.value,{class:"desktop-only"}),{left:e.withCtx(()=>[e.renderSlot(h.$slots,"toolbar-left")]),right:e.withCtx(()=>[e.renderSlot(h.$slots,"toolbar-right")]),_:3},16)):e.createCommentVNode("",!0),(v=e.unref(f))!=null&&v.isEditable&&t.showBubbleMenu?(e.openBlock(),e.createBlock(vp,e.normalizeProps(e.mergeProps({key:1},b.value)),null,16)):e.createCommentVNode("",!0),(_=e.unref(f))!=null&&_.isEditable&&t.showFloatingMenu?(e.openBlock(),e.createBlock(bp,e.normalizeProps(e.mergeProps({key:2},g.value)),null,16)):e.createCommentVNode("",!0),(C=e.unref(f))!=null&&C.isEditable&&t.sideMenu.show?(e.openBlock(),e.createBlock(Sp,e.normalizeProps(e.mergeProps({key:3},k.value)),null,16)):e.createCommentVNode("",!0),e.createVNode(e.unref(R.EditorContent),{class:e.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:e.unref(f)},null,8,["class","editor"])],8,lm)}}}),am=(t,o)=>{const r=new DOMParser().parseFromString(t,"text/html"),l=r.querySelectorAll(o),a=o.replace(/[[\]]/g,"");return l.forEach(i=>{i.removeAttribute(a)}),r.body.innerHTML},im={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",ma)}};exports.OPlaceholder=ft;Object.defineProperty(exports,"Focus",{enumerable:!0,get:()=>gr.Focus});Object.defineProperty(exports,"Details",{enumerable:!0,get:()=>Ot.Details});Object.defineProperty(exports,"DetailsContent",{enumerable:!0,get:()=>Ot.DetailsContent});Object.defineProperty(exports,"DetailsSummary",{enumerable:!0,get:()=>Ot.DetailsSummary});Object.defineProperty(exports,"TaskItem",{enumerable:!0,get:()=>cn.TaskItem});Object.defineProperty(exports,"TaskList",{enumerable:!0,get:()=>cn.TaskList});Object.defineProperty(exports,"BlockMath",{enumerable:!0,get:()=>Ut.BlockMath});Object.defineProperty(exports,"InlineMath",{enumerable:!0,get:()=>Ut.InlineMath});Object.defineProperty(exports,"Table",{enumerable:!0,get:()=>$e.Table});Object.defineProperty(exports,"TableCell",{enumerable:!0,get:()=>$e.TableCell});Object.defineProperty(exports,"TableHeader",{enumerable:!0,get:()=>$e.TableHeader});Object.defineProperty(exports,"TableRow",{enumerable:!0,get:()=>$e.TableRow});Object.defineProperty(exports,"BackgroundColor",{enumerable:!0,get:()=>Je.BackgroundColor});Object.defineProperty(exports,"Color",{enumerable:!0,get:()=>Je.Color});Object.defineProperty(exports,"FontFamily",{enumerable:!0,get:()=>Je.FontFamily});Object.defineProperty(exports,"TextStyle",{enumerable:!0,get:()=>Je.TextStyle});Object.defineProperty(exports,"Markdown",{enumerable:!0,get:()=>br.Markdown});exports.Collaboration=hr;exports.CollaborationCaret=kr;exports.Highlight=yr;exports.Image=wr;exports.Link=sn;exports.Mention=Ca;exports.Subscript=xr;exports.Superscript=Cr;exports.TextAlign=_r;exports.Typography=Br;exports.Underline=Vr;exports.UniqueID=Nr;exports.OColorHighlighter=Er;exports.OInlinePlaceholder=Sr;Object.defineProperty(exports,"Column",{enumerable:!0,get:()=>Ue.Column});Object.defineProperty(exports,"ColumnContainer",{enumerable:!0,get:()=>Ue.ColumnContainer});Object.defineProperty(exports,"ColumnDropCursor",{enumerable:!0,get:()=>Ue.ColumnDropCursor});Object.defineProperty(exports,"MultiColumn",{enumerable:!0,get:()=>Ue.MultiColumn});exports.OSelectionDecoration=Or;exports.OShortcut=$r;exports.OTable=Ar;exports.OTaskItem=Tr;exports.OCharCommand=st;Object.defineProperty(exports,"OColonCommand",{enumerable:!0,get:()=>st.ColonCommand});Object.defineProperty(exports,"OSlashCommand",{enumerable:!0,get:()=>st.SlashCommand});Object.defineProperty(exports,"OSlashZhCommand",{enumerable:!0,get:()=>st.SlashZhCommand});exports.AddNode=Nl;exports.AdvancedBlocks=sl;exports.AiBlocks=dl;exports.AiProviders=Al;exports.AskAiBlocks=ul;exports.BasicBlocks=to;exports.BlockMenus=go;exports.Blocks=xo;exports.BrandColor=H;exports.ColonSuggestion=Gl;exports.CommonBlocks=wo;exports.DefaultBubble=Ml;exports.DefaultEmbedServices=kd;exports.DefaultExtensionNames=da;exports.DefaultFloating=zl;exports.DefaultMenu=Tl;exports.DragNode=El;exports.EmojiSuggestion=Kp;exports.ImageBubble=Rl;exports.ImageLinkBubble=Il;exports.InlineMathBubble=Ll;exports.LinkBubble=Pl;exports.MoreBubble=jl;exports.OAiBlock=Kl;exports.OAiMenu=Hl;exports.OAlignDropdown=yn;exports.OAudio=Xl;exports.OBlockList=Ao;exports.OBlockListItem=nn;exports.OBlockMath=Jl;exports.OBlockMenu=Ke;exports.OBlockPlaceholder=Pt;exports.OBlockPopover=je;exports.OBlockToolbar=oo;exports.OBlockquote=Zl;exports.OBtn=ee;exports.OBtnGroup=Sl;exports.OCallout=Ql;exports.OCalloutColorBoard=Cn;exports.OCalloutColorDropdown=Yc;exports.OCheckbox=On;exports.OCodeBlock=ta;exports.OCodeBlockDownloadDropdown=nl;exports.OCodeBlockViewDropdown=rl;exports.OColorBoard=vt;exports.OCommandBtn=ae;exports.OCommonBtn=Ze;exports.OContextMenu=ht;exports.ODetails=oa;exports.ODialog=$n;exports.ODivider=fe;exports.ODocToc=ls;exports.OEmojiSelect=To;exports.OExtensionDropdown=ll;exports.OHorizontalRule=na;exports.OIcon=E;exports.OImage=ra;exports.OImageViewer=Ol;exports.OInlineMathMenu=Ul;exports.OInput=Ee;exports.OLanguageDropdown=pl;exports.OLink=la;exports.OLinkBtn=wn;exports.OList=ue;exports.OListItem=ie;exports.OMainMenu=Wl;exports.OMediaInput=no;exports.OMenubarBtn=X;exports.OMetaInput=Do;exports.OModelViewer=aa;exports.ONodeView=Ce;exports.OPopover=Z;exports.OStarterKit=rm;exports.OTableCell=ia;exports.OTableCellBackground=ml;exports.OTableCellHandler=Co;exports.OTableGrid=fl;exports.OTableHeader=ca;exports.OTableWrapper=sa;exports.OTextColorBoard=_n;exports.OTextarea=$l;exports.OToast=Jt;exports.OTooltip=xe;exports.OVideo=ua;exports.Prompts=An;exports.SlashSuggestion=an;exports.StyleBlocks=yo;exports.TableBubble=Fl;exports.TableMenu=Dl;exports.YiiEditor=ma;exports.YiiEditorPlugin=im;exports.convertShortcut=cl;exports.createExtension=Eo;exports.createExtensionList=Ln;exports.extensionRegistry=pa;exports.getProviderProp=bd;exports.htmlToJSON=xn;exports.htmlToJSON0=Dc;exports.isExtensionInstance=fa;exports.removeHtmlAttributes=am;exports.systemKeymap=il;exports.toJSON=al;exports.useAi=hn;exports.useCommon=Oo;exports.useI18n=P;exports.useNodeView=tl;exports.useTable=kn;exports.useTheme=bt;exports.useTiptap=U;Object.keys(oe).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>oe[t]})});Object.keys(Jo).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>Jo[t]})});
335
71
  //# sourceMappingURL=index.cjs.map