tiptapify 0.0.18 → 0.0.19
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/tiptapify.mjs +173 -173
- package/dist/tiptapify.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/Toolbar/Index.vue +7 -6
package/dist/tiptapify.umd.js
CHANGED
|
@@ -5,7 +5,7 @@ Expected #hex, #hexa, rgb(), rgba(), hsl(), hsla(), object or number`)}function
|
|
|
5
5
|
`);u=u.replace(/([^>\n])</g,`$1
|
|
6
6
|
<`);const M=u.split(`
|
|
7
7
|
`);let m=0;return M.map(f=>{f.match(/<\//)&&(m=Math.max(0,m-1));const p=" ".repeat(m*r.indent)+f,g=f.match(/<\/?(\S+).*>/)??[];return!d.includes(g[1]??"")&&f.match(/<[^\/][^>]*>/)&&!f.match(/<.*\/>/)&&m++,p}).filter(f=>f.trim()).join(`
|
|
8
|
-
`)},V=c=>c.replace(/\n/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><");function H(){s.value=n.value.getHTML(),o.value.open()}const L=()=>{o.value.close(),n.value.commands.setContent(s.value,!0)};return C.watch(()=>i.value,()=>{s.value=i.value?l(s.value):V(s.value)}),(c,d)=>(C.openBlock(),C.createBlock(P3,{ref_key:"dialog",ref:o,module:"source","max-width":1500},{content:C.withCtx(()=>[C.createVNode(N3,null,{default:C.withCtx(()=>[C.createVNode(Ck2,{fluid:"",class:"pt-0 pl-0 pr-0"},{default:C.withCtx(()=>[C.createVNode(e3,null,{default:C.withCtx(()=>[C.createVNode(k2,null,{default:C.withCtx(()=>[C.createVNode(i1,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>i.value=u),color:`${i.value?"primary":""}`,onClick:d[1]||(d[1]=u=>i.value=!i.value)},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(a)("dialog.source.prettify")),1)]),_:1},8,["modelValue","color"])]),_:1})]),_:1})]),_:1}),C.createVNode(tF2,{modelValue:s.value,"onUpdate:modelValue":d[2]||(d[2]=u=>s.value=u),"no-resize":"",rows:"100",variant:e.variantField,class:"source-code-area"},null,8,["modelValue","variant"])]),_:1})]),actions:C.withCtx(()=>[C.createVNode(L7,null,{default:C.withCtx(()=>[C.createVNode(LC),C.createVNode(i1,{variant:e.variantBtn,onClick:d[3]||(d[3]=u=>o.value.close())},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(a)("dialog.close")),1)]),_:1},8,["variant"]),C.createVNode(i1,{variant:e.variantBtn,color:"primary",onClick:L},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(a)("dialog.apply")),1)]),_:1},8,["variant"])]),_:1})]),_:1},512))}}),[["__scopeId","data-v-f5726cfa"]]),aF2=C.defineComponent({__name:"Button",setup(e){const{t}=C.inject("tiptapifyI18n"),r=C.ref(null);function a(){r.value.showDialog()}return(n,o)=>(C.openBlock(),C.createElementBlock(C.Fragment,null,[C.createVNode(i1,{onClick:o[0]||(o[0]=i=>a()),size:"32"},{default:C.withCtx(()=>[C.createVNode(v1,{activator:"parent"},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(t)("misc.source")),1)]),_:1}),C.createVNode(f1,{icon:`mdiSvg:${Yn}`},null,8,["icon"])]),_:1}),C.createVNode(rF2,{ref_key:"dialog",ref:r},null,512)],64))}}),nF2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path fill="currentColor" d="M256 64L512 64C529.7 64 544 78.3 544 96C544 113.7 529.7 128 512 128L480 128L480 544C480 561.7 465.7 576 448 576C430.3 576 416 561.7 416 544L416 128L368 128L368 544C368 561.7 353.7 576 336 576C318.3 576 304 561.7 304 544L304 384L256 384C167.6 384 96 312.4 96 224C96 135.6 167.6 64 256 64z"/></svg>',oF2=C.defineComponent({__name:"Button",setup(e){const t=C.inject("tiptapifyEditor"),{t:r}=C.inject("tiptapifyI18n");return(a,n)=>(C.openBlock(),C.createBlock(i1,{color:C.unref(t).storage.invisibleCharacters.visibility()?"primary":"",onClick:n[0]||(n[0]=o=>C.unref(t).commands.toggleInvisibleCharacters()),size:"32"},{default:C.withCtx(()=>[C.createVNode(v1,{activator:"parent"},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(r)("misc.toggleInvisibleCharacters")),1)]),_:1}),C.createVNode(f1,{icon:nF2})]),_:1},8,["color"]))}}),iF2=C.defineComponent({__name:"Button",setup(e){const t=C.inject("tiptapifyEditor"),{t:r}=C.inject("tiptapifyI18n");return(a,n)=>(C.openBlock(),C.createBlock(i1,{disabled:!C.unref(t).can().chain().focus().unsetAllMarks().run(),onClick:n[0]||(n[0]=o=>C.unref(t).chain().focus().unsetAllMarks().clearNodes().run()),size:"32"},{default:C.withCtx(()=>[C.createVNode(v1,{activator:"parent"},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(r)("format.formatClear")),1)]),_:1}),C.createVNode(f1,{icon:`mdiSvg:${J8}`},null,8,["icon"])]),_:1},8,["disabled"]))}}),CF2={section:"misc",group:!0,components:[{name:"line",component:C.markRaw(Qk2)},{name:"pagebreak",component:C.markRaw(Yk2)},{name:"source",component:C.markRaw(aF2)},{name:"preview",component:C.markRaw(Jk2)},{name:"formatClear",component:C.markRaw(iF2)},{name:"invisibleChar",component:C.markRaw(oF2)}]},sF2=[hZ2,By2,Uy2,qk2,Ty2,kZ2,ky2,CF2],lF2={key:0,class:"tiptapify-toolbar"},VF2=C.defineComponent({__name:"Index",props:{variantBtn:{type:String,default(){return"elevated"}},variantField:{type:String,default(){return"solo"}},items:{type:Array,default(){return[]}},itemsExclude:{type:Boolean,default(){return!1}},headingLevels:{type:Array,default(){return[]}},fontMeasure:{type:String,default(){return"px"}},customFonts:{type:Array,default(){return[]}},customFontsOverride:{type:Boolean,default(){return!1}},theme:{type:String,default(){return"light"}},rounded:{type:String,default(){return"0"}},toolbarScrollable:{type:Boolean,default(){return!1}},customExtensions:{type:Array,default(){return{}}}},setup(e){const t=e,r=C.inject("tiptapifyEditor"),a=C.ref(sF2);return Object.keys(t.customExtensions).forEach(n=>{a.value.push(t.customExtensions[n])}),(n,o)=>C.unref(r)?(C.openBlock(),C.createElementBlock("div",lF2,[C.createVNode(q8,{elevation:"1",theme:e.theme,height:"auto",class:C.normalizeClass(`ps-1 pr-1 rounded-t-${e.rounded}`)},{default:C.withCtx(()=>[e.toolbarScrollable?(C.openBlock(),C.createBlock(l4,{key:0},{default:C.withCtx(()=>[C.createVNode(Kn,{items:a.value},null,8,["items"])]),_:1})):(C.openBlock(),C.createBlock(Kn,{key:1,items:a.value},null,8,["items"]))]),_:1},8,["theme","class"])])):C.createCommentVNode("",!0)}});function B2(e){this.content=e}B2.prototype={constructor:B2,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,r){var a=r&&r!=e?this.remove(r):this,n=a.find(e),o=a.content.slice();return n==-1?o.push(r||e,t):(o[n+1]=t,r&&(o[n]=r)),new B2(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var r=this.content.slice();return r.splice(t,2),new B2(r)},addToStart:function(e,t){return new B2([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new B2(r)},addBefore:function(e,t,r){var a=this.remove(t),n=a.content.slice(),o=a.find(e);return n.splice(o==-1?n.length:o,0,t,r),new B2(n)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=B2.from(e),e.size?new B2(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=B2.from(e),e.size?new B2(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=B2.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},toObject:function(){var e={};return this.forEach(function(t,r){e[t]=r}),e},get size(){return this.content.length>>1}},B2.from=function(e){if(e instanceof B2)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new B2(t)};function AC(e,t,r){for(let a=0;;a++){if(a==e.childCount||a==t.childCount)return e.childCount==t.childCount?null:r;let n=e.child(a),o=t.child(a);if(n==o){r+=n.nodeSize;continue}if(!n.sameMarkup(o))return r;if(n.isText&&n.text!=o.text){for(let i=0;n.text[i]==o.text[i];i++)r++;return r}if(n.content.size||o.content.size){let i=AC(n.content,o.content,r+1);if(i!=null)return i}r+=n.nodeSize}}function gC(e,t,r,a){for(let n=e.childCount,o=t.childCount;;){if(n==0||o==0)return n==o?null:{a:r,b:a};let i=e.child(--n),s=t.child(--o),l=i.nodeSize;if(i==s){r-=l,a-=l;continue}if(!i.sameMarkup(s))return{a:r,b:a};if(i.isText&&i.text!=s.text){let V=0,H=Math.min(i.text.length,s.text.length);for(;V<H&&i.text[i.text.length-V-1]==s.text[s.text.length-V-1];)V++,r--,a--;return{a:r,b:a}}if(i.content.size||s.content.size){let V=gC(i.content,s.content,r-1,a-1);if(V)return V}r-=l,a-=l}}class I{constructor(t,r){if(this.content=t,this.size=r||0,r==null)for(let a=0;a<t.length;a++)this.size+=t[a].nodeSize}nodesBetween(t,r,a,n=0,o){for(let i=0,s=0;s<r;i++){let l=this.content[i],V=s+l.nodeSize;if(V>t&&a(l,n+s,o||null,i)!==!1&&l.content.size){let H=s+1;l.nodesBetween(Math.max(0,t-H),Math.min(l.content.size,r-H),a,n+H)}s=V}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,r,a,n){let o="",i=!0;return this.nodesBetween(t,r,(s,l)=>{let V=s.isText?s.text.slice(Math.max(t,l)-l,r-l):s.isLeaf?n?typeof n=="function"?n(s):n:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&V||s.isTextblock)&&a&&(i?i=!1:o+=a),o+=V},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let r=this.lastChild,a=t.firstChild,n=this.content.slice(),o=0;for(r.isText&&r.sameMarkup(a)&&(n[n.length-1]=r.withText(r.text+a.text),o=1);o<t.content.length;o++)n.push(t.content[o]);return new I(n,this.size+t.size)}cut(t,r=this.size){if(t==0&&r==this.size)return this;let a=[],n=0;if(r>t)for(let o=0,i=0;i<r;o++){let s=this.content[o],l=i+s.nodeSize;l>t&&((i<t||l>r)&&(s.isText?s=s.cut(Math.max(0,t-i),Math.min(s.text.length,r-i)):s=s.cut(Math.max(0,t-i-1),Math.min(s.content.size,r-i-1))),a.push(s),n+=s.nodeSize),i=l}return new I(a,n)}cutByIndex(t,r){return t==r?I.empty:t==0&&r==this.content.length?this:new I(this.content.slice(t,r))}replaceChild(t,r){let a=this.content[t];if(a==r)return this;let n=this.content.slice(),o=this.size+r.nodeSize-a.nodeSize;return n[t]=r,new I(n,o)}addToStart(t){return new I([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new I(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let r=0;r<this.content.length;r++)if(!this.content[r].eq(t.content[r]))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(t){let r=this.content[t];if(!r)throw new RangeError("Index "+t+" out of range for "+this);return r}maybeChild(t){return this.content[t]||null}forEach(t){for(let r=0,a=0;r<this.content.length;r++){let n=this.content[r];t(n,a,r),a+=n.nodeSize}}findDiffStart(t,r=0){return AC(this,t,r)}findDiffEnd(t,r=this.size,a=t.size){return gC(this,t,r,a)}findIndex(t){if(t==0)return F9(0,t);if(t==this.size)return F9(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,a=0;;r++){let n=this.child(r),o=a+n.nodeSize;if(o>=t)return o==t?F9(r+1,o):F9(r,a);a=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,r){if(!r)return I.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return new I(r.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return I.empty;let r,a=0;for(let n=0;n<t.length;n++){let o=t[n];a+=o.nodeSize,n&&o.isText&&t[n-1].sameMarkup(o)?(r||(r=t.slice(0,n)),r[r.length-1]=o.withText(r[r.length-1].text+o.text)):r&&r.push(o)}return new I(r||t,a)}static from(t){if(!t)return I.empty;if(t instanceof I)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new I([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}I.empty=new I([],0);const Ke={index:0,offset:0};function F9(e,t){return Ke.index=e,Ke.offset=t,Ke}function w9(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(let a=0;a<e.length;a++)if(!w9(e[a],t[a]))return!1}else{for(let a in e)if(!(a in t)||!w9(e[a],t[a]))return!1;for(let a in t)if(!(a in e))return!1}return!0}let Y1=class $a{constructor(t,r){this.type=t,this.attrs=r}addToSet(t){let r,a=!1;for(let n=0;n<t.length;n++){let o=t[n];if(this.eq(o))return t;if(this.type.excludes(o.type))r||(r=t.slice(0,n));else{if(o.type.excludes(this.type))return t;!a&&o.type.rank>this.type.rank&&(r||(r=t.slice(0,n)),r.push(this),a=!0),r&&r.push(o)}}return r||(r=t.slice()),a||r.push(this),r}removeFromSet(t){for(let r=0;r<t.length;r++)if(this.eq(t[r]))return t.slice(0,r).concat(t.slice(r+1));return t}isInSet(t){for(let r=0;r<t.length;r++)if(this.eq(t[r]))return!0;return!1}eq(t){return this==t||this.type==t.type&&w9(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Mark.fromJSON");let a=t.marks[r.type];if(!a)throw new RangeError(`There is no mark type ${r.type} in this schema`);let n=a.create(r.attrs);return a.checkAttrs(n.attrs),n}static sameSet(t,r){if(t==r)return!0;if(t.length!=r.length)return!1;for(let a=0;a<t.length;a++)if(!t[a].eq(r[a]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return $a.none;if(t instanceof $a)return[t];let r=t.slice();return r.sort((a,n)=>a.type.rank-n.type.rank),r}};Y1.none=[];class E9 extends Error{}class J{constructor(t,r,a){this.content=t,this.openStart=r,this.openEnd=a}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,r){let a=vC(this.content,t+this.openStart,r);return a&&new J(a,this.openStart,this.openEnd)}removeBetween(t,r){return new J(hC(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,r){if(!r)return J.empty;let a=r.openStart||0,n=r.openEnd||0;if(typeof a!="number"||typeof n!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new J(I.fromJSON(t,r.content),a,n)}static maxOpen(t,r=!0){let a=0,n=0;for(let o=t.firstChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.firstChild)a++;for(let o=t.lastChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.lastChild)n++;return new J(t,a,n)}}J.empty=new J(I.empty,0,0);function hC(e,t,r){let{index:a,offset:n}=e.findIndex(t),o=e.maybeChild(a),{index:i,offset:s}=e.findIndex(r);if(n==t||o.isText){if(s!=r&&!e.child(i).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(r))}if(a!=i)throw new RangeError("Removing non-flat range");return e.replaceChild(a,o.copy(hC(o.content,t-n-1,r-n-1)))}function vC(e,t,r,a){let{index:n,offset:o}=e.findIndex(t),i=e.maybeChild(n);if(o==t||i.isText)return e.cut(0,t).append(r).append(e.cut(t));let s=vC(i.content,t-o-1,r);return s&&e.replaceChild(n,i.copy(s))}function HF2(e,t,r){if(r.openStart>e.depth)throw new E9("Inserted content deeper than insertion position");if(e.depth-r.openStart!=t.depth-r.openEnd)throw new E9("Inconsistent open depths");return bC(e,t,r,0)}function bC(e,t,r,a){let n=e.index(a),o=e.node(a);if(n==t.index(a)&&a<e.depth-r.openStart){let i=bC(e,t,r,a+1);return o.copy(o.content.replaceChild(n,i))}else if(r.content.size)if(!r.openStart&&!r.openEnd&&e.depth==a&&t.depth==a){let i=e.parent,s=i.content;return R3(i,s.cut(0,e.parentOffset).append(r.content).append(s.cut(t.parentOffset)))}else{let{start:i,end:s}=LF2(r,e);return R3(o,SC(e,i,s,t,a))}else return R3(o,O9(e,t,a))}function yC(e,t){if(!t.type.compatibleContent(e.type))throw new E9("Cannot join "+t.type.name+" onto "+e.type.name)}function qe(e,t,r){let a=e.node(r);return yC(a,t.node(r)),a}function B3(e,t){let r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function V4(e,t,r,a){let n=(t||e).node(r),o=0,i=t?t.index(r):n.childCount;e&&(o=e.index(r),e.depth>r?o++:e.textOffset&&(B3(e.nodeAfter,a),o++));for(let s=o;s<i;s++)B3(n.child(s),a);t&&t.depth==r&&t.textOffset&&B3(t.nodeBefore,a)}function R3(e,t){return e.type.checkContent(t),e.copy(t)}function SC(e,t,r,a,n){let o=e.depth>n&&qe(e,t,n+1),i=a.depth>n&&qe(r,a,n+1),s=[];return V4(null,e,n,s),o&&i&&t.index(n)==r.index(n)?(yC(o,i),B3(R3(o,SC(e,t,r,a,n+1)),s)):(o&&B3(R3(o,O9(e,t,n+1)),s),V4(t,r,n,s),i&&B3(R3(i,O9(r,a,n+1)),s)),V4(a,null,n,s),new I(s)}function O9(e,t,r){let a=[];if(V4(null,e,r,a),e.depth>r){let n=qe(e,t,r+1);B3(R3(n,O9(e,t,r+1)),a)}return V4(t,null,r,a),new I(a)}function LF2(e,t){let r=t.depth-e.openStart,n=t.node(r).copy(e.content);for(let o=r-1;o>=0;o--)n=t.node(o).copy(I.from(n));return{start:n.resolveNoCache(e.openStart+r),end:n.resolveNoCache(n.content.size-e.openEnd-r)}}class H4{constructor(t,r,a){this.pos=t,this.path=r,this.parentOffset=a,this.depth=r.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,r=this.index(this.depth);if(r==t.childCount)return null;let a=this.pos-this.path[this.path.length-1],n=t.child(r);return a?t.child(r).cut(a):n}get nodeBefore(){let t=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(t).cut(0,r):t==0?null:this.parent.child(t-1)}posAtIndex(t,r){r=this.resolveDepth(r);let a=this.path[r*3],n=r==0?0:this.path[r*3-1]+1;for(let o=0;o<t;o++)n+=a.child(o).nodeSize;return n}marks(){let t=this.parent,r=this.index();if(t.content.size==0)return Y1.none;if(this.textOffset)return t.child(r).marks;let a=t.maybeChild(r-1),n=t.maybeChild(r);if(!a){let s=a;a=n,n=s}let o=a.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!n||!o[i].isInSet(n.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(t){let r=this.parent.maybeChild(this.index());if(!r||!r.isInline)return null;let a=r.marks,n=t.parent.maybeChild(t.index());for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!n||!a[o].isInSet(n.marks))&&(a=a[o--].removeFromSet(a));return a}sharedDepth(t){for(let r=this.depth;r>0;r--)if(this.start(r)<=t&&this.end(r)>=t)return r;return 0}blockRange(t=this,r){if(t.pos<this.pos)return t.blockRange(this);for(let a=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);a>=0;a--)if(t.pos<=this.end(a)&&(!r||r(this.node(a))))return new T9(this,t,a);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let r=1;r<=this.depth;r++)t+=(t?"/":"")+this.node(r).type.name+"_"+this.index(r-1);return t+":"+this.parentOffset}static resolve(t,r){if(!(r>=0&&r<=t.content.size))throw new RangeError("Position "+r+" out of range");let a=[],n=0,o=r;for(let i=t;;){let{index:s,offset:l}=i.content.findIndex(o),V=o-l;if(a.push(i,s,n+l),!V||(i=i.child(s),i.isText))break;o=V-1,n+=l+1}return new H4(r,a,o)}static resolveCached(t,r){let a=ZC.get(t);if(a)for(let o=0;o<a.elts.length;o++){let i=a.elts[o];if(i.pos==r)return i}else ZC.set(t,a=new cF2);let n=a.elts[a.i]=H4.resolve(t,r);return a.i=(a.i+1)%dF2,n}}class cF2{constructor(){this.elts=[],this.i=0}}const dF2=12,ZC=new WeakMap;class T9{constructor(t,r,a){this.$from=t,this.$to=r,this.depth=a}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 uF2=Object.create(null);let t3=class Ua{constructor(t,r,a,n=Y1.none){this.type=t,this.attrs=r,this.marks=n,this.content=a||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(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,r,a,n=0){this.content.nodesBetween(t,r,a,n,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,r,a,n){return this.content.textBetween(t,r,a,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,r,a){return this.type==t&&w9(this.attrs,r||t.defaultAttrs||uF2)&&Y1.sameSet(this.marks,a||Y1.none)}copy(t=null){return t==this.content?this:new Ua(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Ua(this.type,this.attrs,this.content,t)}cut(t,r=this.content.size){return t==0&&r==this.content.size?this:this.copy(this.content.cut(t,r))}slice(t,r=this.content.size,a=!1){if(t==r)return J.empty;let n=this.resolve(t),o=this.resolve(r),i=a?0:n.sharedDepth(r),s=n.start(i),V=n.node(i).content.cut(n.pos-s,o.pos-s);return new J(V,n.depth-i,o.depth-i)}replace(t,r,a){return HF2(this.resolve(t),this.resolve(r),a)}nodeAt(t){for(let r=this;;){let{index:a,offset:n}=r.content.findIndex(t);if(r=r.maybeChild(a),!r)return null;if(n==t||r.isText)return r;t-=n+1}}childAfter(t){let{index:r,offset:a}=this.content.findIndex(t);return{node:this.content.maybeChild(r),index:r,offset:a}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:r,offset:a}=this.content.findIndex(t);if(a<t)return{node:this.content.child(r),index:r,offset:a};let n=this.content.child(r-1);return{node:n,index:r-1,offset:a-n.nodeSize}}resolve(t){return H4.resolveCached(this,t)}resolveNoCache(t){return H4.resolve(this,t)}rangeHasMark(t,r,a){let n=!1;return r>t&&this.nodesBetween(t,r,o=>(a.isInSet(o.marks)&&(n=!0),!n)),n}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),kC(this.marks,t)}contentMatchAt(t){let r=this.type.contentMatch.matchFragment(this.content,0,t);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(t,r,a=I.empty,n=0,o=a.childCount){let i=this.contentMatchAt(t).matchFragment(a,n,o),s=i&&i.matchFragment(this.content,r);if(!s||!s.validEnd)return!1;for(let l=n;l<o;l++)if(!this.type.allowsMarks(a.child(l).marks))return!1;return!0}canReplaceWith(t,r,a,n){if(n&&!this.type.allowsMarks(n))return!1;let o=this.contentMatchAt(t).matchType(a),i=o&&o.matchFragment(this.content,r);return i?i.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Y1.none;for(let r=0;r<this.marks.length;r++){let a=this.marks[r];a.type.checkAttrs(a.attrs),t=a.addToSet(t)}if(!Y1.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(r=>r.type.name)}`);this.content.forEach(r=>r.check())}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(r=>r.toJSON())),t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let a;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");a=r.marks.map(t.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(r.text,a)}let n=I.fromJSON(t,r.content),o=t.nodeType(r.type).create(r.attrs,n,a);return o.type.checkAttrs(o.attrs),o}};t3.prototype.text=void 0;class _9 extends t3{constructor(t,r,a,n){if(super(t,r,null,n),!a)throw new RangeError("Empty text nodes are not allowed");this.text=a}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,r){return this.text.slice(t,r)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new _9(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new _9(this.type,this.attrs,t,this.marks)}cut(t=0,r=this.text.length){return t==0&&r==this.text.length?this:this.withText(this.text.slice(t,r))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function kC(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}class D3{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,r){let a=new MF2(t,r);if(a.next==null)return D3.empty;let n=FC(a);a.next&&a.err("Unexpected trailing text");let o=vF2(hF2(n));return bF2(o,a),o}matchType(t){for(let r=0;r<this.next.length;r++)if(this.next[r].type==t)return this.next[r].next;return null}matchFragment(t,r=0,a=t.childCount){let n=this;for(let o=r;n&&o<a;o++)n=n.matchType(t.child(o).type);return n}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:r}=this.next[t];if(!(r.isText||r.hasRequiredAttrs()))return r}return null}compatible(t){for(let r=0;r<this.next.length;r++)for(let a=0;a<t.next.length;a++)if(this.next[r].type==t.next[a].type)return!0;return!1}fillBefore(t,r=!1,a=0){let n=[this];function o(i,s){let l=i.matchFragment(t,a);if(l&&(!r||l.validEnd))return I.from(s.map(V=>V.createAndFill()));for(let V=0;V<i.next.length;V++){let{type:H,next:L}=i.next[V];if(!(H.isText||H.hasRequiredAttrs())&&n.indexOf(L)==-1){n.push(L);let c=o(L,s.concat(H));if(c)return c}}return null}return o(this,[])}findWrapping(t){for(let a=0;a<this.wrapCache.length;a+=2)if(this.wrapCache[a]==t)return this.wrapCache[a+1];let r=this.computeWrapping(t);return this.wrapCache.push(t,r),r}computeWrapping(t){let r=Object.create(null),a=[{match:this,type:null,via:null}];for(;a.length;){let n=a.shift(),o=n.match;if(o.matchType(t)){let i=[];for(let s=n;s.type;s=s.via)i.push(s.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:s,next:l}=o.next[i];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in r)&&(!n.type||l.validEnd)&&(a.push({match:s.contentMatch,type:s,via:n}),r[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function r(a){t.push(a);for(let n=0;n<a.next.length;n++)t.indexOf(a.next[n].next)==-1&&r(a.next[n].next)}return r(this),t.map((a,n)=>{let o=n+(a.validEnd?"*":" ")+" ";for(let i=0;i<a.next.length;i++)o+=(i?", ":"")+a.next[i].type.name+"->"+t.indexOf(a.next[i].next);return o}).join(`
|
|
8
|
+
`)},V=c=>c.replace(/\n/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><");function H(){s.value=n.value.getHTML(),o.value.open()}const L=()=>{o.value.close(),n.value.commands.setContent(s.value,!0)};return C.watch(()=>i.value,()=>{s.value=i.value?l(s.value):V(s.value)}),(c,d)=>(C.openBlock(),C.createBlock(P3,{ref_key:"dialog",ref:o,module:"source","max-width":1500},{content:C.withCtx(()=>[C.createVNode(N3,null,{default:C.withCtx(()=>[C.createVNode(Ck2,{fluid:"",class:"pt-0 pl-0 pr-0"},{default:C.withCtx(()=>[C.createVNode(e3,null,{default:C.withCtx(()=>[C.createVNode(k2,null,{default:C.withCtx(()=>[C.createVNode(i1,{modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>i.value=u),color:`${i.value?"primary":""}`,onClick:d[1]||(d[1]=u=>i.value=!i.value)},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(a)("dialog.source.prettify")),1)]),_:1},8,["modelValue","color"])]),_:1})]),_:1})]),_:1}),C.createVNode(tF2,{modelValue:s.value,"onUpdate:modelValue":d[2]||(d[2]=u=>s.value=u),"no-resize":"",rows:"100",variant:e.variantField,class:"source-code-area"},null,8,["modelValue","variant"])]),_:1})]),actions:C.withCtx(()=>[C.createVNode(L7,null,{default:C.withCtx(()=>[C.createVNode(LC),C.createVNode(i1,{variant:e.variantBtn,onClick:d[3]||(d[3]=u=>o.value.close())},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(a)("dialog.close")),1)]),_:1},8,["variant"]),C.createVNode(i1,{variant:e.variantBtn,color:"primary",onClick:L},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(a)("dialog.apply")),1)]),_:1},8,["variant"])]),_:1})]),_:1},512))}}),[["__scopeId","data-v-f5726cfa"]]),aF2=C.defineComponent({__name:"Button",setup(e){const{t}=C.inject("tiptapifyI18n"),r=C.ref(null);function a(){r.value.showDialog()}return(n,o)=>(C.openBlock(),C.createElementBlock(C.Fragment,null,[C.createVNode(i1,{onClick:o[0]||(o[0]=i=>a()),size:"32"},{default:C.withCtx(()=>[C.createVNode(v1,{activator:"parent"},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(t)("misc.source")),1)]),_:1}),C.createVNode(f1,{icon:`mdiSvg:${Yn}`},null,8,["icon"])]),_:1}),C.createVNode(rF2,{ref_key:"dialog",ref:r},null,512)],64))}}),nF2='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><path fill="currentColor" d="M256 64L512 64C529.7 64 544 78.3 544 96C544 113.7 529.7 128 512 128L480 128L480 544C480 561.7 465.7 576 448 576C430.3 576 416 561.7 416 544L416 128L368 128L368 544C368 561.7 353.7 576 336 576C318.3 576 304 561.7 304 544L304 384L256 384C167.6 384 96 312.4 96 224C96 135.6 167.6 64 256 64z"/></svg>',oF2=C.defineComponent({__name:"Button",setup(e){const t=C.inject("tiptapifyEditor"),{t:r}=C.inject("tiptapifyI18n");return(a,n)=>(C.openBlock(),C.createBlock(i1,{color:C.unref(t).storage.invisibleCharacters.visibility()?"primary":"",onClick:n[0]||(n[0]=o=>C.unref(t).commands.toggleInvisibleCharacters()),size:"32"},{default:C.withCtx(()=>[C.createVNode(v1,{activator:"parent"},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(r)("misc.toggleInvisibleCharacters")),1)]),_:1}),C.createVNode(f1,{icon:nF2})]),_:1},8,["color"]))}}),iF2=C.defineComponent({__name:"Button",setup(e){const t=C.inject("tiptapifyEditor"),{t:r}=C.inject("tiptapifyI18n");return(a,n)=>(C.openBlock(),C.createBlock(i1,{disabled:!C.unref(t).can().chain().focus().unsetAllMarks().run(),onClick:n[0]||(n[0]=o=>C.unref(t).chain().focus().unsetAllMarks().clearNodes().run()),size:"32"},{default:C.withCtx(()=>[C.createVNode(v1,{activator:"parent"},{default:C.withCtx(()=>[C.createTextVNode(C.toDisplayString(C.unref(r)("format.formatClear")),1)]),_:1}),C.createVNode(f1,{icon:`mdiSvg:${J8}`},null,8,["icon"])]),_:1},8,["disabled"]))}}),CF2={section:"misc",group:!0,components:[{name:"line",component:C.markRaw(Qk2)},{name:"pagebreak",component:C.markRaw(Yk2)},{name:"source",component:C.markRaw(aF2)},{name:"preview",component:C.markRaw(Jk2)},{name:"formatClear",component:C.markRaw(iF2)},{name:"invisibleChar",component:C.markRaw(oF2)}]},sF2=[hZ2,By2,Uy2,qk2,Ty2,kZ2,ky2,CF2],lF2={key:0,class:"tiptapify-toolbar"},VF2=C.defineComponent({__name:"Index",props:{variantBtn:{type:String,default(){return"elevated"}},variantField:{type:String,default(){return"solo"}},items:{type:Array,default(){return[]}},itemsExclude:{type:Boolean,default(){return!1}},headingLevels:{type:Array,default(){return[]}},fontMeasure:{type:String,default(){return"px"}},customFonts:{type:Array,default(){return[]}},customFontsOverride:{type:Boolean,default(){return!1}},theme:{type:String,default(){return"light"}},rounded:{type:String,default(){return"0"}},toolbarScrollable:{type:Boolean,default(){return!1}},customExtensions:{type:Array,default(){return[]}}},setup(e){const t=e,r=C.inject("tiptapifyEditor"),a=[...sF2];return Object.keys(t.customExtensions).forEach(n=>{a.push(t.customExtensions[n])}),(n,o)=>C.unref(r)?(C.openBlock(),C.createElementBlock("div",lF2,[C.createVNode(q8,{elevation:"1",theme:e.theme,height:"auto",class:C.normalizeClass(`ps-1 pr-1 rounded-t-${e.rounded}`)},{default:C.withCtx(()=>[e.toolbarScrollable?(C.openBlock(),C.createBlock(l4,{key:0},{default:C.withCtx(()=>[C.createVNode(Kn,{items:a})]),_:1})):(C.openBlock(),C.createBlock(Kn,{key:1,items:a}))]),_:1},8,["theme","class"])])):C.createCommentVNode("",!0)}});function B2(e){this.content=e}B2.prototype={constructor:B2,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,r){var a=r&&r!=e?this.remove(r):this,n=a.find(e),o=a.content.slice();return n==-1?o.push(r||e,t):(o[n+1]=t,r&&(o[n]=r)),new B2(o)},remove:function(e){var t=this.find(e);if(t==-1)return this;var r=this.content.slice();return r.splice(t,2),new B2(r)},addToStart:function(e,t){return new B2([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new B2(r)},addBefore:function(e,t,r){var a=this.remove(t),n=a.content.slice(),o=a.find(e);return n.splice(o==-1?n.length:o,0,t,r),new B2(n)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=B2.from(e),e.size?new B2(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=B2.from(e),e.size?new B2(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=B2.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},toObject:function(){var e={};return this.forEach(function(t,r){e[t]=r}),e},get size(){return this.content.length>>1}},B2.from=function(e){if(e instanceof B2)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new B2(t)};function AC(e,t,r){for(let a=0;;a++){if(a==e.childCount||a==t.childCount)return e.childCount==t.childCount?null:r;let n=e.child(a),o=t.child(a);if(n==o){r+=n.nodeSize;continue}if(!n.sameMarkup(o))return r;if(n.isText&&n.text!=o.text){for(let i=0;n.text[i]==o.text[i];i++)r++;return r}if(n.content.size||o.content.size){let i=AC(n.content,o.content,r+1);if(i!=null)return i}r+=n.nodeSize}}function gC(e,t,r,a){for(let n=e.childCount,o=t.childCount;;){if(n==0||o==0)return n==o?null:{a:r,b:a};let i=e.child(--n),s=t.child(--o),l=i.nodeSize;if(i==s){r-=l,a-=l;continue}if(!i.sameMarkup(s))return{a:r,b:a};if(i.isText&&i.text!=s.text){let V=0,H=Math.min(i.text.length,s.text.length);for(;V<H&&i.text[i.text.length-V-1]==s.text[s.text.length-V-1];)V++,r--,a--;return{a:r,b:a}}if(i.content.size||s.content.size){let V=gC(i.content,s.content,r-1,a-1);if(V)return V}r-=l,a-=l}}class I{constructor(t,r){if(this.content=t,this.size=r||0,r==null)for(let a=0;a<t.length;a++)this.size+=t[a].nodeSize}nodesBetween(t,r,a,n=0,o){for(let i=0,s=0;s<r;i++){let l=this.content[i],V=s+l.nodeSize;if(V>t&&a(l,n+s,o||null,i)!==!1&&l.content.size){let H=s+1;l.nodesBetween(Math.max(0,t-H),Math.min(l.content.size,r-H),a,n+H)}s=V}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,r,a,n){let o="",i=!0;return this.nodesBetween(t,r,(s,l)=>{let V=s.isText?s.text.slice(Math.max(t,l)-l,r-l):s.isLeaf?n?typeof n=="function"?n(s):n:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&V||s.isTextblock)&&a&&(i?i=!1:o+=a),o+=V},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let r=this.lastChild,a=t.firstChild,n=this.content.slice(),o=0;for(r.isText&&r.sameMarkup(a)&&(n[n.length-1]=r.withText(r.text+a.text),o=1);o<t.content.length;o++)n.push(t.content[o]);return new I(n,this.size+t.size)}cut(t,r=this.size){if(t==0&&r==this.size)return this;let a=[],n=0;if(r>t)for(let o=0,i=0;i<r;o++){let s=this.content[o],l=i+s.nodeSize;l>t&&((i<t||l>r)&&(s.isText?s=s.cut(Math.max(0,t-i),Math.min(s.text.length,r-i)):s=s.cut(Math.max(0,t-i-1),Math.min(s.content.size,r-i-1))),a.push(s),n+=s.nodeSize),i=l}return new I(a,n)}cutByIndex(t,r){return t==r?I.empty:t==0&&r==this.content.length?this:new I(this.content.slice(t,r))}replaceChild(t,r){let a=this.content[t];if(a==r)return this;let n=this.content.slice(),o=this.size+r.nodeSize-a.nodeSize;return n[t]=r,new I(n,o)}addToStart(t){return new I([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new I(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let r=0;r<this.content.length;r++)if(!this.content[r].eq(t.content[r]))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(t){let r=this.content[t];if(!r)throw new RangeError("Index "+t+" out of range for "+this);return r}maybeChild(t){return this.content[t]||null}forEach(t){for(let r=0,a=0;r<this.content.length;r++){let n=this.content[r];t(n,a,r),a+=n.nodeSize}}findDiffStart(t,r=0){return AC(this,t,r)}findDiffEnd(t,r=this.size,a=t.size){return gC(this,t,r,a)}findIndex(t){if(t==0)return F9(0,t);if(t==this.size)return F9(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,a=0;;r++){let n=this.child(r),o=a+n.nodeSize;if(o>=t)return o==t?F9(r+1,o):F9(r,a);a=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,r){if(!r)return I.empty;if(!Array.isArray(r))throw new RangeError("Invalid input for Fragment.fromJSON");return new I(r.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return I.empty;let r,a=0;for(let n=0;n<t.length;n++){let o=t[n];a+=o.nodeSize,n&&o.isText&&t[n-1].sameMarkup(o)?(r||(r=t.slice(0,n)),r[r.length-1]=o.withText(r[r.length-1].text+o.text)):r&&r.push(o)}return new I(r||t,a)}static from(t){if(!t)return I.empty;if(t instanceof I)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new I([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}I.empty=new I([],0);const Ke={index:0,offset:0};function F9(e,t){return Ke.index=e,Ke.offset=t,Ke}function w9(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(let a=0;a<e.length;a++)if(!w9(e[a],t[a]))return!1}else{for(let a in e)if(!(a in t)||!w9(e[a],t[a]))return!1;for(let a in t)if(!(a in e))return!1}return!0}let Y1=class $a{constructor(t,r){this.type=t,this.attrs=r}addToSet(t){let r,a=!1;for(let n=0;n<t.length;n++){let o=t[n];if(this.eq(o))return t;if(this.type.excludes(o.type))r||(r=t.slice(0,n));else{if(o.type.excludes(this.type))return t;!a&&o.type.rank>this.type.rank&&(r||(r=t.slice(0,n)),r.push(this),a=!0),r&&r.push(o)}}return r||(r=t.slice()),a||r.push(this),r}removeFromSet(t){for(let r=0;r<t.length;r++)if(this.eq(t[r]))return t.slice(0,r).concat(t.slice(r+1));return t}isInSet(t){for(let r=0;r<t.length;r++)if(this.eq(t[r]))return!0;return!1}eq(t){return this==t||this.type==t.type&&w9(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Mark.fromJSON");let a=t.marks[r.type];if(!a)throw new RangeError(`There is no mark type ${r.type} in this schema`);let n=a.create(r.attrs);return a.checkAttrs(n.attrs),n}static sameSet(t,r){if(t==r)return!0;if(t.length!=r.length)return!1;for(let a=0;a<t.length;a++)if(!t[a].eq(r[a]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return $a.none;if(t instanceof $a)return[t];let r=t.slice();return r.sort((a,n)=>a.type.rank-n.type.rank),r}};Y1.none=[];class E9 extends Error{}class J{constructor(t,r,a){this.content=t,this.openStart=r,this.openEnd=a}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,r){let a=vC(this.content,t+this.openStart,r);return a&&new J(a,this.openStart,this.openEnd)}removeBetween(t,r){return new J(hC(this.content,t+this.openStart,r+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,r){if(!r)return J.empty;let a=r.openStart||0,n=r.openEnd||0;if(typeof a!="number"||typeof n!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new J(I.fromJSON(t,r.content),a,n)}static maxOpen(t,r=!0){let a=0,n=0;for(let o=t.firstChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.firstChild)a++;for(let o=t.lastChild;o&&!o.isLeaf&&(r||!o.type.spec.isolating);o=o.lastChild)n++;return new J(t,a,n)}}J.empty=new J(I.empty,0,0);function hC(e,t,r){let{index:a,offset:n}=e.findIndex(t),o=e.maybeChild(a),{index:i,offset:s}=e.findIndex(r);if(n==t||o.isText){if(s!=r&&!e.child(i).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(r))}if(a!=i)throw new RangeError("Removing non-flat range");return e.replaceChild(a,o.copy(hC(o.content,t-n-1,r-n-1)))}function vC(e,t,r,a){let{index:n,offset:o}=e.findIndex(t),i=e.maybeChild(n);if(o==t||i.isText)return e.cut(0,t).append(r).append(e.cut(t));let s=vC(i.content,t-o-1,r);return s&&e.replaceChild(n,i.copy(s))}function HF2(e,t,r){if(r.openStart>e.depth)throw new E9("Inserted content deeper than insertion position");if(e.depth-r.openStart!=t.depth-r.openEnd)throw new E9("Inconsistent open depths");return bC(e,t,r,0)}function bC(e,t,r,a){let n=e.index(a),o=e.node(a);if(n==t.index(a)&&a<e.depth-r.openStart){let i=bC(e,t,r,a+1);return o.copy(o.content.replaceChild(n,i))}else if(r.content.size)if(!r.openStart&&!r.openEnd&&e.depth==a&&t.depth==a){let i=e.parent,s=i.content;return R3(i,s.cut(0,e.parentOffset).append(r.content).append(s.cut(t.parentOffset)))}else{let{start:i,end:s}=LF2(r,e);return R3(o,SC(e,i,s,t,a))}else return R3(o,O9(e,t,a))}function yC(e,t){if(!t.type.compatibleContent(e.type))throw new E9("Cannot join "+t.type.name+" onto "+e.type.name)}function qe(e,t,r){let a=e.node(r);return yC(a,t.node(r)),a}function B3(e,t){let r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function V4(e,t,r,a){let n=(t||e).node(r),o=0,i=t?t.index(r):n.childCount;e&&(o=e.index(r),e.depth>r?o++:e.textOffset&&(B3(e.nodeAfter,a),o++));for(let s=o;s<i;s++)B3(n.child(s),a);t&&t.depth==r&&t.textOffset&&B3(t.nodeBefore,a)}function R3(e,t){return e.type.checkContent(t),e.copy(t)}function SC(e,t,r,a,n){let o=e.depth>n&&qe(e,t,n+1),i=a.depth>n&&qe(r,a,n+1),s=[];return V4(null,e,n,s),o&&i&&t.index(n)==r.index(n)?(yC(o,i),B3(R3(o,SC(e,t,r,a,n+1)),s)):(o&&B3(R3(o,O9(e,t,n+1)),s),V4(t,r,n,s),i&&B3(R3(i,O9(r,a,n+1)),s)),V4(a,null,n,s),new I(s)}function O9(e,t,r){let a=[];if(V4(null,e,r,a),e.depth>r){let n=qe(e,t,r+1);B3(R3(n,O9(e,t,r+1)),a)}return V4(t,null,r,a),new I(a)}function LF2(e,t){let r=t.depth-e.openStart,n=t.node(r).copy(e.content);for(let o=r-1;o>=0;o--)n=t.node(o).copy(I.from(n));return{start:n.resolveNoCache(e.openStart+r),end:n.resolveNoCache(n.content.size-e.openEnd-r)}}class H4{constructor(t,r,a){this.pos=t,this.path=r,this.parentOffset=a,this.depth=r.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,r=this.index(this.depth);if(r==t.childCount)return null;let a=this.pos-this.path[this.path.length-1],n=t.child(r);return a?t.child(r).cut(a):n}get nodeBefore(){let t=this.index(this.depth),r=this.pos-this.path[this.path.length-1];return r?this.parent.child(t).cut(0,r):t==0?null:this.parent.child(t-1)}posAtIndex(t,r){r=this.resolveDepth(r);let a=this.path[r*3],n=r==0?0:this.path[r*3-1]+1;for(let o=0;o<t;o++)n+=a.child(o).nodeSize;return n}marks(){let t=this.parent,r=this.index();if(t.content.size==0)return Y1.none;if(this.textOffset)return t.child(r).marks;let a=t.maybeChild(r-1),n=t.maybeChild(r);if(!a){let s=a;a=n,n=s}let o=a.marks;for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!n||!o[i].isInSet(n.marks))&&(o=o[i--].removeFromSet(o));return o}marksAcross(t){let r=this.parent.maybeChild(this.index());if(!r||!r.isInline)return null;let a=r.marks,n=t.parent.maybeChild(t.index());for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!n||!a[o].isInSet(n.marks))&&(a=a[o--].removeFromSet(a));return a}sharedDepth(t){for(let r=this.depth;r>0;r--)if(this.start(r)<=t&&this.end(r)>=t)return r;return 0}blockRange(t=this,r){if(t.pos<this.pos)return t.blockRange(this);for(let a=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);a>=0;a--)if(t.pos<=this.end(a)&&(!r||r(this.node(a))))return new T9(this,t,a);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let r=1;r<=this.depth;r++)t+=(t?"/":"")+this.node(r).type.name+"_"+this.index(r-1);return t+":"+this.parentOffset}static resolve(t,r){if(!(r>=0&&r<=t.content.size))throw new RangeError("Position "+r+" out of range");let a=[],n=0,o=r;for(let i=t;;){let{index:s,offset:l}=i.content.findIndex(o),V=o-l;if(a.push(i,s,n+l),!V||(i=i.child(s),i.isText))break;o=V-1,n+=l+1}return new H4(r,a,o)}static resolveCached(t,r){let a=ZC.get(t);if(a)for(let o=0;o<a.elts.length;o++){let i=a.elts[o];if(i.pos==r)return i}else ZC.set(t,a=new cF2);let n=a.elts[a.i]=H4.resolve(t,r);return a.i=(a.i+1)%dF2,n}}class cF2{constructor(){this.elts=[],this.i=0}}const dF2=12,ZC=new WeakMap;class T9{constructor(t,r,a){this.$from=t,this.$to=r,this.depth=a}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 uF2=Object.create(null);let t3=class Ua{constructor(t,r,a,n=Y1.none){this.type=t,this.attrs=r,this.marks=n,this.content=a||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(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,r,a,n=0){this.content.nodesBetween(t,r,a,n,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,r,a,n){return this.content.textBetween(t,r,a,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,r,a){return this.type==t&&w9(this.attrs,r||t.defaultAttrs||uF2)&&Y1.sameSet(this.marks,a||Y1.none)}copy(t=null){return t==this.content?this:new Ua(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Ua(this.type,this.attrs,this.content,t)}cut(t,r=this.content.size){return t==0&&r==this.content.size?this:this.copy(this.content.cut(t,r))}slice(t,r=this.content.size,a=!1){if(t==r)return J.empty;let n=this.resolve(t),o=this.resolve(r),i=a?0:n.sharedDepth(r),s=n.start(i),V=n.node(i).content.cut(n.pos-s,o.pos-s);return new J(V,n.depth-i,o.depth-i)}replace(t,r,a){return HF2(this.resolve(t),this.resolve(r),a)}nodeAt(t){for(let r=this;;){let{index:a,offset:n}=r.content.findIndex(t);if(r=r.maybeChild(a),!r)return null;if(n==t||r.isText)return r;t-=n+1}}childAfter(t){let{index:r,offset:a}=this.content.findIndex(t);return{node:this.content.maybeChild(r),index:r,offset:a}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:r,offset:a}=this.content.findIndex(t);if(a<t)return{node:this.content.child(r),index:r,offset:a};let n=this.content.child(r-1);return{node:n,index:r-1,offset:a-n.nodeSize}}resolve(t){return H4.resolveCached(this,t)}resolveNoCache(t){return H4.resolve(this,t)}rangeHasMark(t,r,a){let n=!1;return r>t&&this.nodesBetween(t,r,o=>(a.isInSet(o.marks)&&(n=!0),!n)),n}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),kC(this.marks,t)}contentMatchAt(t){let r=this.type.contentMatch.matchFragment(this.content,0,t);if(!r)throw new Error("Called contentMatchAt on a node with invalid content");return r}canReplace(t,r,a=I.empty,n=0,o=a.childCount){let i=this.contentMatchAt(t).matchFragment(a,n,o),s=i&&i.matchFragment(this.content,r);if(!s||!s.validEnd)return!1;for(let l=n;l<o;l++)if(!this.type.allowsMarks(a.child(l).marks))return!1;return!0}canReplaceWith(t,r,a,n){if(n&&!this.type.allowsMarks(n))return!1;let o=this.contentMatchAt(t).matchType(a),i=o&&o.matchFragment(this.content,r);return i?i.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Y1.none;for(let r=0;r<this.marks.length;r++){let a=this.marks[r];a.type.checkAttrs(a.attrs),t=a.addToSet(t)}if(!Y1.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(r=>r.type.name)}`);this.content.forEach(r=>r.check())}toJSON(){let t={type:this.type.name};for(let r in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(r=>r.toJSON())),t}static fromJSON(t,r){if(!r)throw new RangeError("Invalid input for Node.fromJSON");let a;if(r.marks){if(!Array.isArray(r.marks))throw new RangeError("Invalid mark data for Node.fromJSON");a=r.marks.map(t.markFromJSON)}if(r.type=="text"){if(typeof r.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(r.text,a)}let n=I.fromJSON(t,r.content),o=t.nodeType(r.type).create(r.attrs,n,a);return o.type.checkAttrs(o.attrs),o}};t3.prototype.text=void 0;class _9 extends t3{constructor(t,r,a,n){if(super(t,r,null,n),!a)throw new RangeError("Empty text nodes are not allowed");this.text=a}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):kC(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,r){return this.text.slice(t,r)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new _9(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new _9(this.type,this.attrs,t,this.marks)}cut(t=0,r=this.text.length){return t==0&&r==this.text.length?this:this.withText(this.text.slice(t,r))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function kC(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}class D3{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,r){let a=new MF2(t,r);if(a.next==null)return D3.empty;let n=FC(a);a.next&&a.err("Unexpected trailing text");let o=vF2(hF2(n));return bF2(o,a),o}matchType(t){for(let r=0;r<this.next.length;r++)if(this.next[r].type==t)return this.next[r].next;return null}matchFragment(t,r=0,a=t.childCount){let n=this;for(let o=r;n&&o<a;o++)n=n.matchType(t.child(o).type);return n}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:r}=this.next[t];if(!(r.isText||r.hasRequiredAttrs()))return r}return null}compatible(t){for(let r=0;r<this.next.length;r++)for(let a=0;a<t.next.length;a++)if(this.next[r].type==t.next[a].type)return!0;return!1}fillBefore(t,r=!1,a=0){let n=[this];function o(i,s){let l=i.matchFragment(t,a);if(l&&(!r||l.validEnd))return I.from(s.map(V=>V.createAndFill()));for(let V=0;V<i.next.length;V++){let{type:H,next:L}=i.next[V];if(!(H.isText||H.hasRequiredAttrs())&&n.indexOf(L)==-1){n.push(L);let c=o(L,s.concat(H));if(c)return c}}return null}return o(this,[])}findWrapping(t){for(let a=0;a<this.wrapCache.length;a+=2)if(this.wrapCache[a]==t)return this.wrapCache[a+1];let r=this.computeWrapping(t);return this.wrapCache.push(t,r),r}computeWrapping(t){let r=Object.create(null),a=[{match:this,type:null,via:null}];for(;a.length;){let n=a.shift(),o=n.match;if(o.matchType(t)){let i=[];for(let s=n;s.type;s=s.via)i.push(s.type);return i.reverse()}for(let i=0;i<o.next.length;i++){let{type:s,next:l}=o.next[i];!s.isLeaf&&!s.hasRequiredAttrs()&&!(s.name in r)&&(!n.type||l.validEnd)&&(a.push({match:s.contentMatch,type:s,via:n}),r[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function r(a){t.push(a);for(let n=0;n<a.next.length;n++)t.indexOf(a.next[n].next)==-1&&r(a.next[n].next)}return r(this),t.map((a,n)=>{let o=n+(a.validEnd?"*":" ")+" ";for(let i=0;i<a.next.length;i++)o+=(i?", ":"")+a.next[i].type.name+"->"+t.indexOf(a.next[i].next);return o}).join(`
|
|
9
9
|
`)}}D3.empty=new D3(!0);class MF2{constructor(t,r){this.string=t,this.nodeTypes=r,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function FC(e){let t=[];do t.push(mF2(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function mF2(e){let t=[];do t.push(fF2(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function fF2(e){let t=gF2(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=pF2(e,t);else break;return t}function wC(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function pF2(e,t){let r=wC(e),a=r;return e.eat(",")&&(e.next!="}"?a=wC(e):a=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:a,expr:t}}function AF2(e,t){let r=e.nodeTypes,a=r[t];if(a)return[a];let n=[];for(let o in r){let i=r[o];i.isInGroup(t)&&n.push(i)}return n.length==0&&e.err("No node type or group '"+t+"' found"),n}function gF2(e){if(e.eat("(")){let t=FC(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=AF2(e,e.next).map(r=>(e.inline==null?e.inline=r.isInline:e.inline!=r.isInline&&e.err("Mixing inline and block content"),{type:"name",value:r}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function hF2(e){let t=[[]];return n(o(e,0),r()),t;function r(){return t.push([])-1}function a(i,s,l){let V={term:l,to:s};return t[i].push(V),V}function n(i,s){i.forEach(l=>l.to=s)}function o(i,s){if(i.type=="choice")return i.exprs.reduce((l,V)=>l.concat(o(V,s)),[]);if(i.type=="seq")for(let l=0;;l++){let V=o(i.exprs[l],s);if(l==i.exprs.length-1)return V;n(V,s=r())}else if(i.type=="star"){let l=r();return a(s,l),n(o(i.expr,l),l),[a(l)]}else if(i.type=="plus"){let l=r();return n(o(i.expr,s),l),n(o(i.expr,l),l),[a(l)]}else{if(i.type=="opt")return[a(s)].concat(o(i.expr,s));if(i.type=="range"){let l=s;for(let V=0;V<i.min;V++){let H=r();n(o(i.expr,l),H),l=H}if(i.max==-1)n(o(i.expr,l),l);else for(let V=i.min;V<i.max;V++){let H=r();a(l,H),n(o(i.expr,l),H),l=H}return[a(l)]}else{if(i.type=="name")return[a(s,void 0,i.value)];throw new Error("Unknown expr type")}}}}function EC(e,t){return t-e}function OC(e,t){let r=[];return a(t),r.sort(EC);function a(n){let o=e[n];if(o.length==1&&!o[0].term)return a(o[0].to);r.push(n);for(let i=0;i<o.length;i++){let{term:s,to:l}=o[i];!s&&r.indexOf(l)==-1&&a(l)}}}function vF2(e){let t=Object.create(null);return r(OC(e,0));function r(a){let n=[];a.forEach(i=>{e[i].forEach(({term:s,to:l})=>{if(!s)return;let V;for(let H=0;H<n.length;H++)n[H][0]==s&&(V=n[H][1]);OC(e,l).forEach(H=>{V||n.push([s,V=[]]),V.indexOf(H)==-1&&V.push(H)})})});let o=t[a.join(",")]=new D3(a.indexOf(e.length-1)>-1);for(let i=0;i<n.length;i++){let s=n[i][1].sort(EC);o.next.push({type:n[i][0],next:t[s.join(",")]||r(s)})}return o}}function bF2(e,t){for(let r=0,a=[e];r<a.length;r++){let n=a[r],o=!n.validEnd,i=[];for(let s=0;s<n.next.length;s++){let{type:l,next:V}=n.next[s];i.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),a.indexOf(V)==-1&&a.push(V)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function TC(e){let t=Object.create(null);for(let r in e){let a=e[r];if(!a.hasDefault)return null;t[r]=a.default}return t}function _C(e,t){let r=Object.create(null);for(let a in e){let n=t&&t[a];if(n===void 0){let o=e[a];if(o.hasDefault)n=o.default;else throw new RangeError("No value supplied for attribute "+a)}r[a]=n}return r}function NC(e,t,r,a){for(let n in t)if(!(n in e))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let n in e){let o=e[n];o.validate&&o.validate(t[n])}}function xC(e,t){let r=Object.create(null);if(t)for(let a in t)r[a]=new SF2(e,a,t[a]);return r}let PC=class Zd{constructor(t,r,a){this.name=t,this.schema=r,this.spec=a,this.markSet=null,this.groups=a.group?a.group.split(" "):[],this.attrs=xC(t,a.attrs),this.defaultAttrs=TC(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(a.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==D3.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:_C(this.attrs,t)}create(t=null,r,a){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new t3(this,this.computeAttrs(t),I.from(r),Y1.setFrom(a))}createChecked(t=null,r,a){return r=I.from(r),this.checkContent(r),new t3(this,this.computeAttrs(t),r,Y1.setFrom(a))}createAndFill(t=null,r,a){if(t=this.computeAttrs(t),r=I.from(r),r.size){let i=this.contentMatch.fillBefore(r);if(!i)return null;r=i.append(r)}let n=this.contentMatch.matchFragment(r),o=n&&n.fillBefore(I.empty,!0);return o?new t3(this,t,r.append(o),Y1.setFrom(a)):null}validContent(t){let r=this.contentMatch.matchFragment(t);if(!r||!r.validEnd)return!1;for(let a=0;a<t.childCount;a++)if(!this.allowsMarks(t.child(a).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){NC(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let r=0;r<t.length;r++)if(!this.allowsMarkType(t[r].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let r;for(let a=0;a<t.length;a++)this.allowsMarkType(t[a].type)?r&&r.push(t[a]):r||(r=t.slice(0,a));return r?r.length?r:Y1.none:t}static compile(t,r){let a=Object.create(null);t.forEach((o,i)=>a[o]=new Zd(o,r,i));let n=r.spec.topNode||"doc";if(!a[n])throw new RangeError("Schema is missing its top node type ('"+n+"')");if(!a.text)throw new RangeError("Every schema needs a 'text' type");for(let o in a.text.attrs)throw new RangeError("The text node type should not have attributes");return a}};function yF2(e,t,r){let a=r.split("|");return n=>{let o=n===null?"null":typeof n;if(a.indexOf(o)<0)throw new RangeError(`Expected value of type ${a} for attribute ${t} on type ${e}, got ${o}`)}}class SF2{constructor(t,r,a){this.hasDefault=Object.prototype.hasOwnProperty.call(a,"default"),this.default=a.default,this.validate=typeof a.validate=="string"?yF2(t,r,a.validate):a.validate}get isRequired(){return!this.hasDefault}}class N9{constructor(t,r,a,n){this.name=t,this.rank=r,this.schema=a,this.spec=n,this.attrs=xC(t,n.attrs),this.excluded=null;let o=TC(this.attrs);this.instance=o?new Y1(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Y1(this,_C(this.attrs,t))}static compile(t,r){let a=Object.create(null),n=0;return t.forEach((o,i)=>a[o]=new N9(o,n++,r,i)),a}removeFromSet(t){for(var r=0;r<t.length;r++)t[r].type==this&&(t=t.slice(0,r).concat(t.slice(r+1)),r--);return t}isInSet(t){for(let r=0;r<t.length;r++)if(t[r].type==this)return t[r]}checkAttrs(t){NC(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class BC{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let n in t)r[n]=t[n];r.nodes=B2.from(t.nodes),r.marks=B2.from(t.marks||{}),this.nodes=PC.compile(this.spec.nodes,this),this.marks=N9.compile(this.spec.marks,this);let a=Object.create(null);for(let n in this.nodes){if(n in this.marks)throw new RangeError(n+" can not be both a node and a mark");let o=this.nodes[n],i=o.spec.content||"",s=o.spec.marks;if(o.contentMatch=a[i]||(a[i]=D3.parse(i,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=s=="_"?null:s?RC(this,s.split(" ")):s==""||!o.inlineContent?[]:null}for(let n in this.marks){let o=this.marks[n],i=o.spec.excludes;o.excluded=i==null?[o]:i==""?[]:RC(this,i.split(" "))}this.nodeFromJSON=n=>t3.fromJSON(this,n),this.markFromJSON=n=>Y1.fromJSON(this,n),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,r=null,a,n){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof PC){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(r,a,n)}text(t,r){let a=this.nodes.text;return new _9(a,a.defaultAttrs,t,Y1.setFrom(r))}mark(t,r){return typeof t=="string"&&(t=this.marks[t]),t.create(r)}nodeType(t){let r=this.nodes[t];if(!r)throw new RangeError("Unknown node type: "+t);return r}}function RC(e,t){let r=[];for(let a=0;a<t.length;a++){let n=t[a],o=e.marks[n],i=o;if(o)r.push(o);else for(let s in e.marks){let l=e.marks[s];(n=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(n)>-1)&&r.push(i=l)}if(!i)throw new SyntaxError("Unknown mark type: '"+t[a]+"'")}return r}function ZF2(e){return e.tag!=null}function kF2(e){return e.style!=null}class r3{constructor(t,r){this.schema=t,this.rules=r,this.tags=[],this.styles=[];let a=this.matchedStyles=[];r.forEach(n=>{if(ZF2(n))this.tags.push(n);else if(kF2(n)){let o=/[^=]*/.exec(n.style)[0];a.indexOf(o)<0&&a.push(o),this.styles.push(n)}}),this.normalizeLists=!this.tags.some(n=>{if(!/^(ul|ol)\b/.test(n.tag)||!n.node)return!1;let o=t.nodes[n.node];return o.contentMatch.matchType(o)})}parse(t,r={}){let a=new $C(this,r,!1);return a.addAll(t,Y1.none,r.from,r.to),a.finish()}parseSlice(t,r={}){let a=new $C(this,r,!0);return a.addAll(t,Y1.none,r.from,r.to),J.maxOpen(a.finish())}matchTag(t,r,a){for(let n=a?this.tags.indexOf(a)+1:0;n<this.tags.length;n++){let o=this.tags[n];if(EF2(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||r.matchesContext(o.context))){if(o.getAttrs){let i=o.getAttrs(t);if(i===!1)continue;o.attrs=i||void 0}return o}}}matchStyle(t,r,a,n){for(let o=n?this.styles.indexOf(n)+1:0;o<this.styles.length;o++){let i=this.styles[o],s=i.style;if(!(s.indexOf(t)!=0||i.context&&!a.matchesContext(i.context)||s.length>t.length&&(s.charCodeAt(t.length)!=61||s.slice(t.length+1)!=r))){if(i.getAttrs){let l=i.getAttrs(r);if(l===!1)continue;i.attrs=l||void 0}return i}}}static schemaRules(t){let r=[];function a(n){let o=n.priority==null?50:n.priority,i=0;for(;i<r.length;i++){let s=r[i];if((s.priority==null?50:s.priority)<o)break}r.splice(i,0,n)}for(let n in t.marks){let o=t.marks[n].spec.parseDOM;o&&o.forEach(i=>{a(i=UC(i)),i.mark||i.ignore||i.clearMark||(i.mark=n)})}for(let n in t.nodes){let o=t.nodes[n].spec.parseDOM;o&&o.forEach(i=>{a(i=UC(i)),i.node||i.ignore||i.mark||(i.node=n)})}return r}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new r3(t,r3.schemaRules(t)))}}const DC={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},FF2={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},IC={ol:!0,ul:!0},L4=1,Qe=2,c4=4;function zC(e,t,r){return t!=null?(t?L4:0)|(t==="full"?Qe:0):e&&e.whitespace=="pre"?L4|Qe:r&~c4}class x9{constructor(t,r,a,n,o,i){this.type=t,this.attrs=r,this.marks=a,this.solid=n,this.options=i,this.content=[],this.activeMarks=Y1.none,this.match=o||(i&c4?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let r=this.type.contentMatch.fillBefore(I.from(t));if(r)this.match=this.type.contentMatch.matchFragment(r);else{let a=this.type.contentMatch,n;return(n=a.findWrapping(t.type))?(this.match=a,n):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&L4)){let a=this.content[this.content.length-1],n;if(a&&a.isText&&(n=/[ \t\r\n\u000c]+$/.exec(a.text))){let o=a;a.text.length==n[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-n[0].length))}}let r=I.from(this.content);return!t&&this.match&&(r=r.append(this.match.fillBefore(I.empty,!0))),this.type?this.type.create(this.attrs,r,this.marks):r}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!DC.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class $C{constructor(t,r,a){this.parser=t,this.options=r,this.isOpen=a,this.open=0,this.localPreserveWS=!1;let n=r.topNode,o,i=zC(null,r.preserveWhitespace,0)|(a?c4:0);n?o=new x9(n.type,n.attrs,Y1.none,!0,r.topMatch||n.type.contentMatch,i):a?o=new x9(null,null,Y1.none,!0,null,i):o=new x9(t.schema.topNodeType,null,Y1.none,!0,null,i),this.nodes=[o],this.find=r.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,r){t.nodeType==3?this.addTextNode(t,r):t.nodeType==1&&this.addElement(t,r)}addTextNode(t,r){let a=t.nodeValue,n=this.top,o=n.options&Qe?"full":this.localPreserveWS||(n.options&L4)>0;if(o==="full"||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(a)){if(o)o!=="full"?a=a.replace(/\r?\n|\r/g," "):a=a.replace(/\r\n?/g,`
|
|
10
10
|
`);else if(a=a.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(a)&&this.open==this.nodes.length-1){let i=n.content[n.content.length-1],s=t.previousSibling;(!i||s&&s.nodeName=="BR"||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(a=a.slice(1))}a&&this.insertNode(this.parser.schema.text(a),r,!/\S/.test(a)),this.findInText(t)}else this.findInside(t)}addElement(t,r,a){let n=this.localPreserveWS,o=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let i=t.nodeName.toLowerCase(),s;IC.hasOwnProperty(i)&&this.parser.normalizeLists&&wF2(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,a));e:if(l?l.ignore:FF2.hasOwnProperty(i))this.findInside(t),this.ignoreFallback(t,r);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let V,H=this.needsBlock;if(DC.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),V=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,r);break e}let L=l&&l.skip?r:this.readStyles(t,r);L&&this.addAll(t,L),V&&this.sync(o),this.needsBlock=H}else{let V=this.readStyles(t,r);V&&this.addElementByRule(t,l,V,l.consuming===!1?s:void 0)}this.localPreserveWS=n}leafFallback(t,r){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
11
11
|
`),r)}ignoreFallback(t,r){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),r,!0)}readStyles(t,r){let a=t.style;if(a&&a.length)for(let n=0;n<this.parser.matchedStyles.length;n++){let o=this.parser.matchedStyles[n],i=a.getPropertyValue(o);if(i)for(let s=void 0;;){let l=this.parser.matchStyle(o,i,this,s);if(!l)break;if(l.ignore)return null;if(l.clearMark?r=r.filter(V=>!l.clearMark(V)):r=r.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)s=l;else break}}return r}addElementByRule(t,r,a,n){let o,i;if(r.node)if(i=this.parser.schema.nodes[r.node],i.isLeaf)this.insertNode(i.create(r.attrs),a,t.nodeName=="BR")||this.leafFallback(t,a);else{let l=this.enter(i,r.attrs||null,a,r.preserveWhitespace);l&&(o=!0,a=l)}else{let l=this.parser.schema.marks[r.mark];a=a.concat(l.create(r.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(t);else if(n)this.addElement(t,a,n);else if(r.getContent)this.findInside(t),r.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,a,!1));else{let l=t;typeof r.contentElement=="string"?l=t.querySelector(r.contentElement):typeof r.contentElement=="function"?l=r.contentElement(t):r.contentElement&&(l=r.contentElement),this.findAround(t,l,!0),this.addAll(l,a),this.findAround(t,l,!1)}o&&this.sync(s)&&this.open--}addAll(t,r,a,n){let o=a||0;for(let i=a?t.childNodes[a]:t.firstChild,s=n==null?null:t.childNodes[n];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i,r);this.findAtPoint(t,o)}findPlace(t,r,a){let n,o;for(let i=this.open,s=0;i>=0;i--){let l=this.nodes[i],V=l.findWrapping(t);if(V&&(!n||n.length>V.length+s)&&(n=V,o=l,!V.length))break;if(l.solid){if(a)break;s+=2}}if(!n)return null;this.sync(o);for(let i=0;i<n.length;i++)r=this.enterInner(n[i],null,r,!1);return r}insertNode(t,r,a){if(t.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(r=this.enterInner(o,null,r))}let n=this.findPlace(t,r,a);if(n){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(t.type));let i=Y1.none;for(let s of n.concat(t.marks))(o.type?o.type.allowsMarkType(s.type):jC(s.type,t.type))&&(i=s.addToSet(i));return o.content.push(t.mark(i)),!0}return!1}enter(t,r,a,n){let o=this.findPlace(t.create(r),a,!1);return o&&(o=this.enterInner(t,r,a,!0,n)),o}enterInner(t,r,a,n=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(t);let s=zC(t,o,i.options);i.options&c4&&i.content.length==0&&(s|=c4);let l=Y1.none;return a=a.filter(V=>(i.type?i.type.allowsMarkType(V.type):jC(V.type,t))?(l=V.addToSet(l),!1):!0),this.nodes.push(new x9(t,r,l,n,null,s)),this.open++,a}closeExtra(t=!1){let r=this.nodes.length-1;if(r>this.open){for(;r>this.open;r--)this.nodes[r-1].content.push(this.nodes[r].finish(t));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(t){for(let r=this.open;r>=0;r--){if(this.nodes[r]==t)return this.open=r,!0;this.localPreserveWS&&(this.nodes[r].options|=L4)}return!1}get currentPos(){this.closeExtra();let t=0;for(let r=this.open;r>=0;r--){let a=this.nodes[r].content;for(let n=a.length-1;n>=0;n--)t+=a[n].nodeSize;r&&t++}return t}findAtPoint(t,r){if(this.find)for(let a=0;a<this.find.length;a++)this.find[a].node==t&&this.find[a].offset==r&&(this.find[a].pos=this.currentPos)}findInside(t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&t.nodeType==1&&t.contains(this.find[r].node)&&(this.find[r].pos=this.currentPos)}findAround(t,r,a){if(t!=r&&this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&r.compareDocumentPosition(this.find[n].node)&(a?2:4)&&(this.find[n].pos=this.currentPos)}findInText(t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&(this.find[r].pos=this.currentPos-(t.nodeValue.length-this.find[r].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let r=t.split("/"),a=this.options.context,n=!this.isOpen&&(!a||a.parent.type==this.nodes[0].type),o=-(a?a.depth+1:0)+(n?0:1),i=(s,l)=>{for(;s>=0;s--){let V=r[s];if(V==""){if(s==r.length-1||s==0)continue;for(;l>=o;l--)if(i(s-1,l))return!0;return!1}else{let H=l>0||l==0&&n?this.nodes[l].type:a&&l>=o?a.node(l-o).type:null;if(!H||H.name!=V&&!H.isInGroup(V))return!1;l--}}return!0};return i(r.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let r=t.depth;r>=0;r--){let a=t.node(r).contentMatchAt(t.indexAfter(r)).defaultType;if(a&&a.isTextblock&&a.defaultAttrs)return a}for(let r in this.parser.schema.nodes){let a=this.parser.schema.nodes[r];if(a.isTextblock&&a.defaultAttrs)return a}}}function wF2(e){for(let t=e.firstChild,r=null;t;t=t.nextSibling){let a=t.nodeType==1?t.nodeName.toLowerCase():null;a&&IC.hasOwnProperty(a)&&r?(r.appendChild(t),t=r):a=="li"?r=t:a&&(r=null)}}function EF2(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function UC(e){let t={};for(let r in e)t[r]=e[r];return t}function jC(e,t){let r=t.schema.nodes;for(let a in r){let n=r[a];if(!n.allowsMarkType(e))continue;let o=[],i=s=>{o.push(s);for(let l=0;l<s.edgeCount;l++){let{type:V,next:H}=s.edge(l);if(V==t||o.indexOf(H)<0&&i(H))return!0}};if(i(n.contentMatch))return!0}}class I3{constructor(t,r){this.nodes=t,this.marks=r}serializeFragment(t,r={},a){a||(a=Ye(r).createDocumentFragment());let n=a,o=[];return t.forEach(i=>{if(o.length||i.marks.length){let s=0,l=0;for(;s<o.length&&l<i.marks.length;){let V=i.marks[l];if(!this.marks[V.type.name]){l++;continue}if(!V.eq(o[s][0])||V.type.spec.spanning===!1)break;s++,l++}for(;s<o.length;)n=o.pop()[1];for(;l<i.marks.length;){let V=i.marks[l++],H=this.serializeMark(V,i.isInline,r);H&&(o.push([V,n]),n.appendChild(H.dom),n=H.contentDOM||H.dom)}}n.appendChild(this.serializeNodeInner(i,r))}),a}serializeNodeInner(t,r){let{dom:a,contentDOM:n}=P9(Ye(r),this.nodes[t.type.name](t),null,t.attrs);if(n){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,r,n)}return a}serializeNode(t,r={}){let a=this.serializeNodeInner(t,r);for(let n=t.marks.length-1;n>=0;n--){let o=this.serializeMark(t.marks[n],t.isInline,r);o&&((o.contentDOM||o.dom).appendChild(a),a=o.dom)}return a}serializeMark(t,r,a={}){let n=this.marks[t.type.name];return n&&P9(Ye(a),n(t,r),null,t.attrs)}static renderSpec(t,r,a=null,n){return P9(t,r,a,n)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new I3(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let r=WC(t.nodes);return r.text||(r.text=a=>a.text),r}static marksFromSchema(t){return WC(t.marks)}}function WC(e){let t={};for(let r in e){let a=e[r].spec.toDOM;a&&(t[r]=a)}return t}function Ye(e){return e.document||window.document}const GC=new WeakMap;function OF2(e){let t=GC.get(e);return t===void 0&&GC.set(e,t=TF2(e)),t}function TF2(e){let t=null;function r(a){if(a&&typeof a=="object")if(Array.isArray(a))if(typeof a[0]=="string")t||(t=[]),t.push(a);else for(let n=0;n<a.length;n++)r(a[n]);else for(let n in a)r(a[n])}return r(e),t}function P9(e,t,r,a){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let n=t[0],o;if(typeof n!="string")throw new RangeError("Invalid array passed to renderSpec");if(a&&(o=OF2(a))&&o.indexOf(t)>-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 i=n.indexOf(" ");i>0&&(r=n.slice(0,i),n=n.slice(i+1));let s,l=r?e.createElementNS(r,n):e.createElement(n),V=t[1],H=1;if(V&&typeof V=="object"&&V.nodeType==null&&!Array.isArray(V)){H=2;for(let L in V)if(V[L]!=null){let c=L.indexOf(" ");c>0?l.setAttributeNS(L.slice(0,c),L.slice(c+1),V[L]):L=="style"&&l.style?l.style.cssText=V[L]:l.setAttribute(L,V[L])}}for(let L=H;L<t.length;L++){let c=t[L];if(c===0){if(L<t.length-1||L>H)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:d,contentDOM:u}=P9(e,c,r,a);if(l.appendChild(d),u){if(s)throw new RangeError("Multiple content holes");s=u}}}return{dom:l,contentDOM:s}}const KC=65535,qC=Math.pow(2,16);function _F2(e,t){return e+t*qC}function QC(e){return e&KC}function NF2(e){return(e-(e&KC))/qC}const YC=1,XC=2,B9=4,JC=8;class Xe{constructor(t,r,a){this.pos=t,this.delInfo=r,this.recover=a}get deleted(){return(this.delInfo&JC)>0}get deletedBefore(){return(this.delInfo&(YC|B9))>0}get deletedAfter(){return(this.delInfo&(XC|B9))>0}get deletedAcross(){return(this.delInfo&B9)>0}}class p5{constructor(t,r=!1){if(this.ranges=t,this.inverted=r,!t.length&&p5.empty)return p5.empty}recover(t){let r=0,a=QC(t);if(!this.inverted)for(let n=0;n<a;n++)r+=this.ranges[n*3+2]-this.ranges[n*3+1];return this.ranges[a*3]+r+NF2(t)}mapResult(t,r=1){return this._map(t,r,!1)}map(t,r=1){return this._map(t,r,!0)}_map(t,r,a){let n=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?n:0);if(l>t)break;let V=this.ranges[s+o],H=this.ranges[s+i],L=l+V;if(t<=L){let c=V?t==l?-1:t==L?1:r:r,d=l+n+(c<0?0:H);if(a)return d;let u=t==(r<0?l:L)?null:_F2(s/3,t-l),M=t==l?XC:t==L?YC:B9;return(r<0?t!=l:t!=L)&&(M|=JC),new Xe(d,M,u)}n+=H-V}return a?t+n:new Xe(t+n,0,null)}touches(t,r){let a=0,n=QC(r),o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?a:0);if(l>t)break;let V=this.ranges[s+o],H=l+V;if(t<=H&&s==n*3)return!0;a+=this.ranges[s+i]-V}return!1}forEach(t){let r=this.inverted?2:1,a=this.inverted?1:2;for(let n=0,o=0;n<this.ranges.length;n+=3){let i=this.ranges[n],s=i-(this.inverted?o:0),l=i+(this.inverted?0:o),V=this.ranges[n+r],H=this.ranges[n+a];t(s,s+V,l,l+H),o+=H-V}}invert(){return new p5(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?p5.empty:new p5(t<0?[0,-t,0]:[0,0,t])}}p5.empty=new p5([]);class d4{constructor(t,r,a=0,n=t?t.length:0){this.mirror=r,this.from=a,this.to=n,this._maps=t||[],this.ownData=!(t||r)}get maps(){return this._maps}slice(t=0,r=this.maps.length){return new d4(this._maps,this.mirror,t,r)}appendMap(t,r){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),r!=null&&this.setMirror(this._maps.length-1,r)}appendMapping(t){for(let r=0,a=this._maps.length;r<t._maps.length;r++){let n=t.getMirror(r);this.appendMap(t._maps[r],n!=null&&n<r?a+n:void 0)}}getMirror(t){if(this.mirror){for(let r=0;r<this.mirror.length;r++)if(this.mirror[r]==t)return this.mirror[r+(r%2?-1:1)]}}setMirror(t,r){this.mirror||(this.mirror=[]),this.mirror.push(t,r)}appendMappingInverted(t){for(let r=t.maps.length-1,a=this._maps.length+t._maps.length;r>=0;r--){let n=t.getMirror(r);this.appendMap(t._maps[r].invert(),n!=null&&n>r?a-n-1:void 0)}}invert(){let t=new d4;return t.appendMappingInverted(this),t}map(t,r=1){if(this.mirror)return this._map(t,r,!0);for(let a=this.from;a<this.to;a++)t=this._maps[a].map(t,r);return t}mapResult(t,r=1){return this._map(t,r,!1)}_map(t,r,a){let n=0;for(let o=this.from;o<this.to;o++){let i=this._maps[o],s=i.mapResult(t,r);if(s.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,t=this._maps[l].recover(s.recover);continue}}n|=s.delInfo,t=s.pos}return a?t:new Xe(t,n,null)}}const Je=Object.create(null);class $2{getMap(){return p5.empty}merge(t){return null}static fromJSON(t,r){if(!r||!r.stepType)throw new RangeError("Invalid input for Step.fromJSON");let a=Je[r.stepType];if(!a)throw new RangeError(`No step type ${r.stepType} defined`);return a.fromJSON(t,r)}static jsonID(t,r){if(t in Je)throw new RangeError("Duplicate use of step JSON ID "+t);return Je[t]=r,r.prototype.jsonID=t,r}}class v2{constructor(t,r){this.doc=t,this.failed=r}static ok(t){return new v2(t,null)}static fail(t){return new v2(null,t)}static fromReplace(t,r,a,n){try{return v2.ok(t.replace(r,a,n))}catch(o){if(o instanceof E9)return v2.fail(o.message);throw o}}}function et(e,t,r){let a=[];for(let n=0;n<e.childCount;n++){let o=e.child(n);o.content.size&&(o=o.copy(et(o.content,t,o))),o.isInline&&(o=t(o,r,n)),a.push(o)}return I.fromArray(a)}class a3 extends $2{constructor(t,r,a){super(),this.from=t,this.to=r,this.mark=a}apply(t){let r=t.slice(this.from,this.to),a=t.resolve(this.from),n=a.node(a.sharedDepth(this.to)),o=new J(et(r.content,(i,s)=>!i.isAtom||!s.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),n),r.openStart,r.openEnd);return v2.fromReplace(t,this.from,this.to,o)}invert(){return new R5(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),a=t.mapResult(this.to,-1);return r.deleted&&a.deleted||r.pos>=a.pos?null:new a3(r.pos,a.pos,this.mark)}merge(t){return t instanceof a3&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new a3(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new a3(r.from,r.to,t.markFromJSON(r.mark))}}$2.jsonID("addMark",a3);class R5 extends $2{constructor(t,r,a){super(),this.from=t,this.to=r,this.mark=a}apply(t){let r=t.slice(this.from,this.to),a=new J(et(r.content,n=>n.mark(this.mark.removeFromSet(n.marks)),t),r.openStart,r.openEnd);return v2.fromReplace(t,this.from,this.to,a)}invert(){return new a3(this.from,this.to,this.mark)}map(t){let r=t.mapResult(this.from,1),a=t.mapResult(this.to,-1);return r.deleted&&a.deleted||r.pos>=a.pos?null:new R5(r.pos,a.pos,this.mark)}merge(t){return t instanceof R5&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new R5(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new R5(r.from,r.to,t.markFromJSON(r.mark))}}$2.jsonID("removeMark",R5);class n3 extends $2{constructor(t,r){super(),this.pos=t,this.mark=r}apply(t){let r=t.nodeAt(this.pos);if(!r)return v2.fail("No node at mark step's position");let a=r.type.create(r.attrs,null,this.mark.addToSet(r.marks));return v2.fromReplace(t,this.pos,this.pos+1,new J(I.from(a),0,r.isLeaf?0:1))}invert(t){let r=t.nodeAt(this.pos);if(r){let a=this.mark.addToSet(r.marks);if(a.length==r.marks.length){for(let n=0;n<r.marks.length;n++)if(!r.marks[n].isInSet(a))return new n3(this.pos,r.marks[n]);return new n3(this.pos,this.mark)}}return new z3(this.pos,this.mark)}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new n3(r.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n3(r.pos,t.markFromJSON(r.mark))}}$2.jsonID("addNodeMark",n3);class z3 extends $2{constructor(t,r){super(),this.pos=t,this.mark=r}apply(t){let r=t.nodeAt(this.pos);if(!r)return v2.fail("No node at mark step's position");let a=r.type.create(r.attrs,null,this.mark.removeFromSet(r.marks));return v2.fromReplace(t,this.pos,this.pos+1,new J(I.from(a),0,r.isLeaf?0:1))}invert(t){let r=t.nodeAt(this.pos);return!r||!this.mark.isInSet(r.marks)?this:new n3(this.pos,this.mark)}map(t){let r=t.mapResult(this.pos,1);return r.deletedAfter?null:new z3(r.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,r){if(typeof r.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new z3(r.pos,t.markFromJSON(r.mark))}}$2.jsonID("removeNodeMark",z3);class O2 extends $2{constructor(t,r,a,n=!1){super(),this.from=t,this.to=r,this.slice=a,this.structure=n}apply(t){return this.structure&&tt(t,this.from,this.to)?v2.fail("Structure replace would overwrite content"):v2.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new p5([this.from,this.to-this.from,this.slice.size])}invert(t){return new O2(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let r=t.mapResult(this.from,1),a=t.mapResult(this.to,-1);return r.deletedAcross&&a.deletedAcross?null:new O2(r.pos,Math.max(r.pos,a.pos),this.slice,this.structure)}merge(t){if(!(t instanceof O2)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let r=this.slice.size+t.slice.size==0?J.empty:new J(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new O2(this.from,this.to+(t.to-t.from),r,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let r=this.slice.size+t.slice.size==0?J.empty:new J(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new O2(t.from,this.to,r,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new O2(r.from,r.to,J.fromJSON(t,r.slice),!!r.structure)}}$2.jsonID("replace",O2);class T2 extends $2{constructor(t,r,a,n,o,i,s=!1){super(),this.from=t,this.to=r,this.gapFrom=a,this.gapTo=n,this.slice=o,this.insert=i,this.structure=s}apply(t){if(this.structure&&(tt(t,this.from,this.gapFrom)||tt(t,this.gapTo,this.to)))return v2.fail("Structure gap-replace would overwrite content");let r=t.slice(this.gapFrom,this.gapTo);if(r.openStart||r.openEnd)return v2.fail("Gap is not a flat range");let a=this.slice.insertAt(this.insert,r.content);return a?v2.fromReplace(t,this.from,this.to,a):v2.fail("Content does not fit in gap")}getMap(){return new p5([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let r=this.gapTo-this.gapFrom;return new T2(this.from,this.from+this.slice.size+r,this.from+this.insert,this.from+this.insert+r,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let r=t.mapResult(this.from,1),a=t.mapResult(this.to,-1),n=this.from==this.gapFrom?r.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?a.pos:t.map(this.gapTo,1);return r.deletedAcross&&a.deletedAcross||n<r.pos||o>a.pos?null:new T2(r.pos,a.pos,n,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,r){if(typeof r.from!="number"||typeof r.to!="number"||typeof r.gapFrom!="number"||typeof r.gapTo!="number"||typeof r.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new T2(r.from,r.to,r.gapFrom,r.gapTo,J.fromJSON(t,r.slice),r.insert,!!r.structure)}}$2.jsonID("replaceAround",T2);function tt(e,t,r){let a=e.resolve(t),n=r-t,o=a.depth;for(;n>0&&o>0&&a.indexAfter(o)==a.node(o).childCount;)o--,n--;if(n>0){let i=a.node(o).maybeChild(a.indexAfter(o));for(;n>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,n--}}return!1}function xF2(e,t,r,a){let n=[],o=[],i,s;e.doc.nodesBetween(t,r,(l,V,H)=>{if(!l.isInline)return;let L=l.marks;if(!a.isInSet(L)&&H.type.allowsMarkType(a.type)){let c=Math.max(V,t),d=Math.min(V+l.nodeSize,r),u=a.addToSet(L);for(let M=0;M<L.length;M++)L[M].isInSet(u)||(i&&i.to==c&&i.mark.eq(L[M])?i.to=d:n.push(i=new R5(c,d,L[M])));s&&s.to==c?s.to=d:o.push(s=new a3(c,d,a))}}),n.forEach(l=>e.step(l)),o.forEach(l=>e.step(l))}function PF2(e,t,r,a){let n=[],o=0;e.doc.nodesBetween(t,r,(i,s)=>{if(!i.isInline)return;o++;let l=null;if(a instanceof N9){let V=i.marks,H;for(;H=a.isInSet(V);)(l||(l=[])).push(H),V=H.removeFromSet(V)}else a?a.isInSet(i.marks)&&(l=[a]):l=i.marks;if(l&&l.length){let V=Math.min(s+i.nodeSize,r);for(let H=0;H<l.length;H++){let L=l[H],c;for(let d=0;d<n.length;d++){let u=n[d];u.step==o-1&&L.eq(n[d].style)&&(c=u)}c?(c.to=V,c.step=o):n.push({style:L,from:Math.max(s,t),to:V,step:o})}}}),n.forEach(i=>e.step(new R5(i.from,i.to,i.style)))}function rt(e,t,r,a=r.contentMatch,n=!0){let o=e.doc.nodeAt(t),i=[],s=t+1;for(let l=0;l<o.childCount;l++){let V=o.child(l),H=s+V.nodeSize,L=a.matchType(V.type);if(!L)i.push(new O2(s,H,J.empty));else{a=L;for(let c=0;c<V.marks.length;c++)r.allowsMarkType(V.marks[c].type)||e.step(new R5(s,H,V.marks[c]));if(n&&V.isText&&r.whitespace!="pre"){let c,d=/\r?\n|\r/g,u;for(;c=d.exec(V.text);)u||(u=new J(I.from(r.schema.text(" ",r.allowedMarks(V.marks))),0,0)),i.push(new O2(s+c.index,s+c.index+c[0].length,u))}}s=H}if(!a.validEnd){let l=a.fillBefore(I.empty,!0);e.replace(s,s,new J(l,0,0))}for(let l=i.length-1;l>=0;l--)e.step(i[l])}function BF2(e,t,r){return(t==0||e.canReplace(t,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function d7(e){let r=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let a=e.depth;;--a){let n=e.$from.node(a),o=e.$from.index(a),i=e.$to.indexAfter(a);if(a<e.depth&&n.canReplace(o,i,r))return a;if(a==0||n.type.spec.isolating||!BF2(n,o,i))break}return null}function RF2(e,t,r){let{$from:a,$to:n,depth:o}=t,i=a.before(o+1),s=n.after(o+1),l=i,V=s,H=I.empty,L=0;for(let u=o,M=!1;u>r;u--)M||a.index(u)>0?(M=!0,H=I.from(a.node(u).copy(H)),L++):l--;let c=I.empty,d=0;for(let u=o,M=!1;u>r;u--)M||n.after(u+1)<n.end(u)?(M=!0,c=I.from(n.node(u).copy(c)),d++):V++;e.step(new T2(l,V,i,s,new J(H.append(c),L,d),H.size-L,!0))}function at(e,t,r=null,a=e){let n=DF2(e,t),o=n&&IF2(a,t);return o?n.map(es).concat({type:t,attrs:r}).concat(o.map(es)):null}function es(e){return{type:e,attrs:null}}function DF2(e,t){let{parent:r,startIndex:a,endIndex:n}=e,o=r.contentMatchAt(a).findWrapping(t);if(!o)return null;let i=o.length?o[0]:t;return r.canReplaceWith(a,n,i)?o:null}function IF2(e,t){let{parent:r,startIndex:a,endIndex:n}=e,o=r.child(a),i=t.contentMatch.findWrapping(o.type);if(!i)return null;let l=(i.length?i[i.length-1]:t).contentMatch;for(let V=a;l&&V<n;V++)l=l.matchType(r.child(V).type);return!l||!l.validEnd?null:i}function zF2(e,t,r){let a=I.empty;for(let i=r.length-1;i>=0;i--){if(a.size){let s=r[i].type.contentMatch.matchFragment(a);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}a=I.from(r[i].type.create(r[i].attrs,a))}let n=t.start,o=t.end;e.step(new T2(n,o,n,o,new J(a,0,0),r.length,!0))}function $F2(e,t,r,a,n){if(!a.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,r,(i,s)=>{let l=typeof n=="function"?n(i):n;if(i.isTextblock&&!i.hasMarkup(a,l)&&UF2(e.doc,e.mapping.slice(o).map(s),a)){let V=null;if(a.schema.linebreakReplacement){let d=a.whitespace=="pre",u=!!a.contentMatch.matchType(a.schema.linebreakReplacement);d&&!u?V=!1:!d&&u&&(V=!0)}V===!1&&rs(e,i,s,o),rt(e,e.mapping.slice(o).map(s,1),a,void 0,V===null);let H=e.mapping.slice(o),L=H.map(s,1),c=H.map(s+i.nodeSize,1);return e.step(new T2(L,c,L+1,c-1,new J(I.from(a.create(l,null,i.marks)),0,0),1,!0)),V===!0&&ts(e,i,s,o),!1}})}function ts(e,t,r,a){t.forEach((n,o)=>{if(n.isText){let i,s=/\r?\n|\r/g;for(;i=s.exec(n.text);){let l=e.mapping.slice(a).map(r+1+o+i.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function rs(e,t,r,a){t.forEach((n,o)=>{if(n.type==n.type.schema.linebreakReplacement){let i=e.mapping.slice(a).map(r+1+o);e.replaceWith(i,i+1,t.type.schema.text(`
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Editor } from "@tiptap/vue-3";
|
|
3
3
|
import Items from "@tiptapify/components/Toolbar/Items.vue";
|
|
4
|
-
import { defineProps, inject, PropType,
|
|
4
|
+
import { defineProps, inject, PropType, Ref } from 'vue'
|
|
5
5
|
import { toolbarSections } from '@tiptapify/types/toolbarSections'
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import items from "@tiptapify/components/Toolbar/items";
|
|
8
8
|
|
|
9
9
|
const props = defineProps({
|
|
10
10
|
variantBtn: { type: String, default () { return 'elevated' }},
|
|
@@ -18,15 +18,16 @@ const props = defineProps({
|
|
|
18
18
|
theme: { type: String, default() { return 'light' } },
|
|
19
19
|
rounded: { type: String, default() { return '0' } },
|
|
20
20
|
toolbarScrollable: { type: Boolean, default() { return false } },
|
|
21
|
-
customExtensions: { type: Array as PropType<toolbarSections>, default() { return
|
|
21
|
+
customExtensions: { type: Array as PropType<toolbarSections>, default() { return [] } },
|
|
22
22
|
})
|
|
23
23
|
|
|
24
24
|
const editor = inject('tiptapifyEditor') as Ref<Editor>
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// this prevents from overriding the default items
|
|
27
|
+
const toolbarItems = [...items]
|
|
27
28
|
|
|
28
|
-
Object.keys(props.customExtensions).forEach(
|
|
29
|
-
toolbarItems.
|
|
29
|
+
Object.keys(props.customExtensions).forEach((key: any) => {
|
|
30
|
+
toolbarItems.push(props.customExtensions[key])
|
|
30
31
|
})
|
|
31
32
|
|
|
32
33
|
</script>
|