vdc-editor 0.1.209 → 0.1.210
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/lib/{BulkSpellChecker-B64kW-FY.mjs → BulkSpellChecker-lPff4ipD.mjs} +2 -2
- package/lib/{BulkSpellChecker-B64kW-FY.mjs.map → BulkSpellChecker-lPff4ipD.mjs.map} +1 -1
- package/lib/{index-DBp0Ucy4.mjs → index-DOthRsv-.mjs} +526 -515
- package/lib/{index-DBp0Ucy4.mjs.map → index-DOthRsv-.mjs.map} +1 -1
- package/lib/src/components/editor/CoreEditorMoblie.vue.d.ts +3 -0
- package/lib/src/type.d.ts +4 -0
- package/lib/vdc-editor.mjs +1 -1
- package/lib/vdc-editor.umd.js +17 -17
- package/lib/vdc-editor.umd.js.map +1 -1
- package/package.json +1 -1
package/lib/vdc-editor.umd.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
`)}}As.empty=new As(!0);class xT{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function L2(t){let e=[];do e.push(CT(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function CT(t){let e=[];do e.push(ET(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function ET(t){let e=_T(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=kT(t,e);else break;return e}function P2(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function kT(t,e){let n=P2(t),r=n;return t.eat(",")&&(t.next!="}"?r=P2(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function ST(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let s in n){let a=n[s];a.isInGroup(e)&&o.push(a)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function _T(t){if(t.eat("(")){let e=L2(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=ST(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function TT(t){let e=[[]];return o(s(t,0),n()),e;function n(){return e.push([])-1}function r(a,l,u){let c={term:u,to:l};return e[a].push(c),c}function o(a,l){a.forEach(u=>u.to=l)}function s(a,l){if(a.type=="choice")return a.exprs.reduce((u,c)=>u.concat(s(c,l)),[]);if(a.type=="seq")for(let u=0;;u++){let c=s(a.exprs[u],l);if(u==a.exprs.length-1)return c;o(c,l=n())}else if(a.type=="star"){let u=n();return r(l,u),o(s(a.expr,u),u),[r(u)]}else if(a.type=="plus"){let u=n();return o(s(a.expr,l),u),o(s(a.expr,u),u),[r(u)]}else{if(a.type=="opt")return[r(l)].concat(s(a.expr,l));if(a.type=="range"){let u=l;for(let c=0;c<a.min;c++){let f=n();o(s(a.expr,u),f),u=f}if(a.max==-1)o(s(a.expr,u),u);else for(let c=a.min;c<a.max;c++){let f=n();r(u,f),o(s(a.expr,u),f),u=f}return[r(u)]}else{if(a.type=="name")return[r(l,void 0,a.value)];throw new Error("Unknown expr type")}}}}function D2(t,e){return e-t}function V2(t,e){let n=[];return r(e),n.sort(D2);function r(o){let s=t[o];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(o);for(let a=0;a<s.length;a++){let{term:l,to:u}=s[a];!l&&n.indexOf(u)==-1&&r(u)}}}function AT(t){let e=Object.create(null);return n(V2(t,0));function n(r){let o=[];r.forEach(a=>{t[a].forEach(({term:l,to:u})=>{if(!l)return;let c;for(let f=0;f<o.length;f++)o[f][0]==l&&(c=o[f][1]);V2(t,u).forEach(f=>{c||o.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let s=e[r.join(",")]=new As(r.indexOf(t.length-1)>-1);for(let a=0;a<o.length;a++){let l=o[a][1].sort(D2);s.next.push({type:o[a][0],next:e[l.join(",")]||n(l)})}return s}}function OT(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],s=!o.validEnd,a=[];for(let l=0;l<o.next.length;l++){let{type:u,next:c}=o.next[l];a.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(c)==-1&&r.push(c)}s&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function F2(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function $2(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let s=t[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function z2(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let s=t[o];s.validate&&s.validate(e[o])}}function H2(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new BT(t,r,e[r]);return n}let U2=class I_{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=H2(e,r.attrs),this.defaultAttrs=F2(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==As.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:$2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new eo(this,this.computeAttrs(e),de.from(n),Dt.setFrom(r))}createChecked(e=null,n,r){return n=de.from(n),this.checkContent(n),new eo(this,this.computeAttrs(e),n,Dt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=de.from(n),n.size){let a=this.contentMatch.fillBefore(n);if(!a)return null;n=a.append(n)}let o=this.contentMatch.matchFragment(n),s=o&&o.fillBefore(de.empty,!0);return s?new eo(this,e,n.append(s),Dt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){z2(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Dt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,a)=>r[s]=new I_(s,n,a));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function MT(t,e,n){let r=n.split("|");return o=>{let s=o===null?"null":typeof o;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class BT{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?MT(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Kc{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=H2(e,o.attrs),this.excluded=null;let s=F2(this.attrs);this.instance=s?new Dt(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Dt(this,$2(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((s,a)=>r[s]=new Kc(s,o++,n,a)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){z2(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class W2{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Sn.from(e.nodes),n.marks=Sn.from(e.marks||{}),this.nodes=U2.compile(this.spec.nodes,this),this.marks=Kc.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],a=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[a]||(r[a]=As.parse(a,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?j2(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],a=s.spec.excludes;s.excluded=a==null?[s]:a==""?[]:j2(this,a.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof U2){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new qc(r,r.defaultAttrs,e,Dt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return eo.fromJSON(this,e)}markFromJSON(e){return Dt.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function j2(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t.marks[o],a=s;if(s)n.push(s);else for(let l in t.marks){let u=t.marks[l];(o=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(o)>-1)&&n.push(a=u)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function IT(t){return t.tag!=null}function RT(t){return t.style!=null}let Zl=class p2{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(IT(o))this.tags.push(o);else if(RT(o)){let s=/[^=]*/.exec(o.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let s=e.nodes[o.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new X2(this,n,!1);return r.addAll(e,Dt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new X2(this,n,!0);return r.addAll(e,Dt.none,n.from,n.to),Ce.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(DT(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let a=s.getAttrs(e);if(a===!1)continue;s.attrs=a||void 0}return s}}}matchStyle(e,n,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let a=this.styles[s],l=a.style;if(!(l.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(a.getAttrs){let u=a.getAttrs(n);if(u===!1)continue;a.attrs=u||void 0}return a}}}static schemaRules(e){let n=[];function r(o){let s=o.priority==null?50:o.priority,a=0;for(;a<n.length;a++){let l=n[a];if((l.priority==null?50:l.priority)<s)break}n.splice(a,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(a=>{r(a=Y2(a)),a.mark||a.ignore||a.clearMark||(a.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(a=>{r(a=Y2(a)),a.node||a.ignore||a.mark||(a.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new p2(e,p2.schemaRules(e)))}};const q2={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},LT={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},K2={ol:!0,ul:!0},Ql=1,Qh=2,Gc=4;function G2(t,e,n){return e!=null?(e?Ql:0)|(e==="full"?Qh:0):t&&t.whitespace=="pre"?Ql|Qh:n&-5}class Xc{constructor(e,n,r,o,s,a){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=a,this.content=[],this.activeMarks=Dt.none,this.match=s||(a&Gc?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(de.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ql)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let n=de.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(de.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!q2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class X2{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,s,a=G2(null,n.preserveWhitespace,0)|(r?Gc:0);o?s=new Xc(o.type,o.attrs,Dt.none,!0,n.topMatch||o.type.contentMatch,a):r?s=new Xc(null,null,Dt.none,!0,null,a):s=new Xc(e.schema.topNodeType,null,Dt.none,!0,null,a),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,s=o.options&Qh?"full":this.localPreserveWS||(o.options&Ql)>0;if(s==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
3
3
|
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=o.content[o.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),l;K2.hasOwnProperty(a)&&this.parser.normalizeLists&&PT(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(u?u.ignore:LT.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let c,f=this.needsBlock;if(q2.hasOwnProperty(a))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let p=u&&u.skip?n:this.readStyles(e,n);p&&this.addAll(e,p),c&&this.sync(s),this.needsBlock=f}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,u,c,u.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
4
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],a=r.getPropertyValue(s);if(a)for(let l=void 0;;){let u=this.parser.matchStyle(s,a,this,l);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(c=>!u.clearMark(c)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)l=u;else break}}return n}addElementByRule(e,n,r,o){let s,a;if(n.node)if(a=this.parser.schema.nodes[n.node],a.isLeaf)this.insertNode(a.create(n.attrs),r)||this.leafFallback(e,r);else{let u=this.enter(a,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let l=this.top;if(a&&a.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(l)&&this.open--}addAll(e,n,r,o){let s=r||0;for(let a=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];a!=l;a=a.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(a,n);this.findAtPoint(e,s)}findPlace(e,n){let r,o;for(let s=this.open;s>=0;s--){let a=this.nodes[s],l=a.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,o=a,!l.length)||a.solid)break}if(!r)return null;this.sync(o);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let s=Dt.none;for(let a of r.concat(e.marks))(o.type?o.type.allowsMarkType(a.type):J2(a.type,e.type))&&(s=a.addToSet(s));return o.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let s=this.findPlace(e.create(n),r);return s&&(s=this.enterInner(e,n,r,!0,o)),s}enterInner(e,n,r,o=!1,s){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let l=G2(e,s,a.options);a.options&Gc&&a.content.length==0&&(l|=Gc);let u=Dt.none;return r=r.filter(c=>(a.type?a.type.allowsMarkType(c.type):J2(c.type,e))?(u=c.addToSet(u),!1):!0),this.nodes.push(new Xc(e,n,u,o,null,l)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ql)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),a=(l,u)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;u>=s;u--)if(a(l-1,u))return!0;return!1}else{let f=u>0||u==0&&o?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!f||f.name!=c&&!f.isInGroup(c))return!1;u--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function PT(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&K2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function DT(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Y2(t){let e={};for(let n in t)e[n]=t[n];return e}function J2(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let s=[],a=l=>{s.push(l);for(let u=0;u<l.edgeCount;u++){let{type:c,next:f}=l.edge(u);if(c==e||s.indexOf(f)<0&&a(f))return!0}};if(a(o.contentMatch))return!0}}class to{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Nh(n).createDocumentFragment());let o=r,s=[];return e.forEach(a=>{if(s.length||a.marks.length){let l=0,u=0;for(;l<s.length&&u<a.marks.length;){let c=a.marks[u];if(!this.marks[c.type.name]){u++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,u++}for(;l<s.length;)o=s.pop()[1];for(;u<a.marks.length;){let c=a.marks[u++],f=this.serializeMark(c,a.isInline,n);f&&(s.push([c,o]),o.appendChild(f.dom),o=f.contentDOM||f.dom)}}o.appendChild(this.serializeNodeInner(a,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=Yc(Nh(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&Yc(Nh(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Yc(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new to(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Z2(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Z2(e.marks)}}function Z2(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Nh(t){return t.document||window.document}const Q2=new WeakMap;function VT(t){let e=Q2.get(t);return e===void 0&&Q2.set(t,e=FT(t)),e}function FT(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function Yc(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=VT(r))&&s.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=o.indexOf(" ");a>0&&(n=o.slice(0,a),o=o.slice(a+1));let l,u=n?t.createElementNS(n,o):t.createElement(o),c=e[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let p in c)if(c[p]!=null){let m=p.indexOf(" ");m>0?u.setAttributeNS(p.slice(0,m),p.slice(m+1),c[p]):u.setAttribute(p,c[p])}}for(let p=f;p<e.length;p++){let m=e[p];if(m===0){if(p<e.length-1||p>f)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:g,contentDOM:b}=Yc(t,m,n,r);if(u.appendChild(g),b){if(l)throw new RangeError("Multiple content holes");l=b}}}return{dom:u,contentDOM:l}}const N2=65535,ey=Math.pow(2,16);function $T(t,e){return t+e*ey}function ty(t){return t&N2}function zT(t){return(t-(t&N2))/ey}const ny=1,ry=2,Jc=4,oy=8;class em{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&oy)>0}get deletedBefore(){return(this.delInfo&(ny|Jc))>0}get deletedAfter(){return(this.delInfo&(ry|Jc))>0}get deletedAcross(){return(this.delInfo&Jc)>0}}class pr{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pr.empty)return pr.empty}recover(e){let n=0,r=ty(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+zT(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,s=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?o:0);if(u>e)break;let c=this.ranges[l+s],f=this.ranges[l+a],p=u+c;if(e<=p){let m=c?e==u?-1:e==p?1:n:n,g=u+o+(m<0?0:f);if(r)return g;let b=e==(n<0?u:p)?null:$T(l/3,e-u),y=e==u?ry:e==p?ny:Jc;return(n<0?e!=u:e!=p)&&(y|=oy),new em(g,y,b)}o+=f-c}return r?e+o:new em(e+o,0,null)}touches(e,n){let r=0,o=ty(n),s=this.inverted?2:1,a=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let u=this.ranges[l]-(this.inverted?r:0);if(u>e)break;let c=this.ranges[l+s],f=u+c;if(e<=f&&l==o*3)return!0;r+=this.ranges[l+a]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let a=this.ranges[o],l=a-(this.inverted?s:0),u=a+(this.inverted?0:s),c=this.ranges[o+n],f=this.ranges[o+r];e(l,l+c,u,u+f),s+=f-c}}invert(){return new pr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?pr.empty:new pr(e<0?[0,-e,0]:[0,0,e])}}pr.empty=new pr([]);class Nl{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Nl(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new Nl;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let s=this.from;s<this.to;s++){let a=this._maps[s],l=a.mapResult(e,n);if(l.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new em(e,o,null)}}const tm=Object.create(null);class In{getMap(){return pr.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=tm[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in tm)throw new RangeError("Duplicate use of step JSON ID "+e);return tm[e]=n,n.prototype.jsonID=e,n}}class dn{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new dn(e,null)}static fail(e){return new dn(null,e)}static fromReplace(e,n,r,o){try{return dn.ok(e.replace(n,r,o))}catch(s){if(s instanceof Uc)return dn.fail(s.message);throw s}}}function nm(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let s=t.child(o);s.content.size&&(s=s.copy(nm(s.content,e,s))),s.isInline&&(s=e(s,n,o)),r.push(s)}return de.fromArray(r)}class Jo extends In{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new Ce(nm(n.content,(a,l)=>!a.isAtom||!l.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),o),n.openStart,n.openEnd);return dn.fromReplace(e,this.from,this.to,s)}invert(){return new no(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Jo(n.pos,r.pos,this.mark)}merge(e){return e instanceof Jo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Jo(n.from,n.to,e.markFromJSON(n.mark))}}In.jsonID("addMark",Jo);class no extends In{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new Ce(nm(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return dn.fromReplace(e,this.from,this.to,r)}invert(){return new Jo(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new no(n.pos,r.pos,this.mark)}merge(e){return e instanceof no&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new no(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new no(n.from,n.to,e.markFromJSON(n.mark))}}In.jsonID("removeMark",no);class Ii extends In{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return dn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return dn.fromReplace(e,this.pos,this.pos+1,new Ce(de.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Ii(this.pos,n.marks[o]);return new Ii(this.pos,this.mark)}}return new Oa(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ii(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ii(n.pos,e.markFromJSON(n.mark))}}In.jsonID("addNodeMark",Ii);class Oa extends In{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return dn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return dn.fromReplace(e,this.pos,this.pos+1,new Ce(de.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ii(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Oa(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Oa(n.pos,e.markFromJSON(n.mark))}}In.jsonID("removeNodeMark",Oa);class fn extends In{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&rm(e,this.from,this.to)?dn.fail("Structure replace would overwrite content"):dn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pr([this.from,this.to-this.from,this.slice.size])}invert(e){return new fn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new fn(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof fn)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?Ce.empty:new Ce(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new fn(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?Ce.empty:new Ce(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new fn(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new fn(n.from,n.to,Ce.fromJSON(e,n.slice),!!n.structure)}}In.jsonID("replace",fn);class vn extends In{constructor(e,n,r,o,s,a,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=a,this.structure=l}apply(e){if(this.structure&&(rm(e,this.from,this.gapFrom)||rm(e,this.gapTo,this.to)))return dn.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return dn.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?dn.fromReplace(e,this.from,this.to,r):dn.fail("Content does not fit in gap")}getMap(){return new pr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new vn(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||s>r.pos?null:new vn(n.pos,r.pos,o,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new vn(n.from,n.to,n.gapFrom,n.gapTo,Ce.fromJSON(e,n.slice),n.insert,!!n.structure)}}In.jsonID("replaceAround",vn);function rm(t,e,n){let r=t.resolve(e),o=n-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let a=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,o--}}return!1}function HT(t,e,n,r){let o=[],s=[],a,l;t.doc.nodesBetween(e,n,(u,c,f)=>{if(!u.isInline)return;let p=u.marks;if(!r.isInSet(p)&&f.type.allowsMarkType(r.type)){let m=Math.max(c,e),g=Math.min(c+u.nodeSize,n),b=r.addToSet(p);for(let y=0;y<p.length;y++)p[y].isInSet(b)||(a&&a.to==m&&a.mark.eq(p[y])?a.to=g:o.push(a=new no(m,g,p[y])));l&&l.to==m?l.to=g:s.push(l=new Jo(m,g,r))}}),o.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function UT(t,e,n,r){let o=[],s=0;t.doc.nodesBetween(e,n,(a,l)=>{if(!a.isInline)return;s++;let u=null;if(r instanceof Kc){let c=a.marks,f;for(;f=r.isInSet(c);)(u||(u=[])).push(f),c=f.removeFromSet(c)}else r?r.isInSet(a.marks)&&(u=[r]):u=a.marks;if(u&&u.length){let c=Math.min(l+a.nodeSize,n);for(let f=0;f<u.length;f++){let p=u[f],m;for(let g=0;g<o.length;g++){let b=o[g];b.step==s-1&&p.eq(o[g].style)&&(m=b)}m?(m.to=c,m.step=s):o.push({style:p,from:Math.max(l,e),to:c,step:s})}}}),o.forEach(a=>t.step(new no(a.from,a.to,a.style)))}function om(t,e,n,r=n.contentMatch,o=!0){let s=t.doc.nodeAt(e),a=[],l=e+1;for(let u=0;u<s.childCount;u++){let c=s.child(u),f=l+c.nodeSize,p=r.matchType(c.type);if(!p)a.push(new fn(l,f,Ce.empty));else{r=p;for(let m=0;m<c.marks.length;m++)n.allowsMarkType(c.marks[m].type)||t.step(new no(l,f,c.marks[m]));if(o&&c.isText&&n.whitespace!="pre"){let m,g=/\r?\n|\r/g,b;for(;m=g.exec(c.text);)b||(b=new Ce(de.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new fn(l+m.index,l+m.index+m[0].length,b))}}l=f}if(!r.validEnd){let u=r.fillBefore(de.empty,!0);t.replace(l,l,new Ce(u,0,0))}for(let u=a.length-1;u>=0;u--)t.step(a[u])}function WT(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ma(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),s=t.$from.index(r),a=t.$to.indexAfter(r);if(r<t.depth&&o.canReplace(s,a,n))return r;if(r==0||o.type.spec.isolating||!WT(o,s,a))break}return null}function jT(t,e,n){let{$from:r,$to:o,depth:s}=e,a=r.before(s+1),l=o.after(s+1),u=a,c=l,f=de.empty,p=0;for(let b=s,y=!1;b>n;b--)y||r.index(b)>0?(y=!0,f=de.from(r.node(b).copy(f)),p++):u--;let m=de.empty,g=0;for(let b=s,y=!1;b>n;b--)y||o.after(b+1)<o.end(b)?(y=!0,m=de.from(o.node(b).copy(m)),g++):c++;t.step(new vn(u,c,a,l,new Ce(f.append(m),p,g),f.size-p,!0))}function im(t,e,n=null,r=t){let o=qT(t,e),s=o&&KT(r,e);return s?o.map(iy).concat({type:e,attrs:n}).concat(s.map(iy)):null}function iy(t){return{type:t,attrs:null}}function qT(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let a=s.length?s[0]:e;return n.canReplaceWith(r,o,a)?s:null}function KT(t,e){let{parent:n,startIndex:r,endIndex:o}=t,s=n.child(r),a=e.contentMatch.findWrapping(s.type);if(!a)return null;let u=(a.length?a[a.length-1]:e).contentMatch;for(let c=r;u&&c<o;c++)u=u.matchType(n.child(c).type);return!u||!u.validEnd?null:a}function GT(t,e,n){let r=de.empty;for(let a=n.length-1;a>=0;a--){if(r.size){let l=n[a].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=de.from(n[a].type.create(n[a].attrs,r))}let o=e.start,s=e.end;t.step(new vn(o,s,o,s,new Ce(r,0,0),n.length,!0))}function XT(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(a,l)=>{let u=typeof o=="function"?o(a):o;if(a.isTextblock&&!a.hasMarkup(r,u)&&YT(t.doc,t.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let g=r.whitespace=="pre",b=!!r.contentMatch.matchType(r.schema.linebreakReplacement);g&&!b?c=!1:!g&&b&&(c=!0)}c===!1&&ay(t,a,l,s),om(t,t.mapping.slice(s).map(l,1),r,void 0,c===null);let f=t.mapping.slice(s),p=f.map(l,1),m=f.map(l+a.nodeSize,1);return t.step(new vn(p,m,p+1,m-1,new Ce(de.from(r.create(u,null,a.marks)),0,0),1,!0)),c===!0&&sy(t,a,l,s),!1}})}function sy(t,e,n,r){e.forEach((o,s)=>{if(o.isText){let a,l=/\r?\n|\r/g;for(;a=l.exec(o.text);){let u=t.mapping.slice(r).map(n+1+s+a.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function ay(t,e,n,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let a=t.mapping.slice(r).map(n+1+s);t.replaceWith(a,a+1,e.type.schema.text(`
|
|
5
|
-
`))}})}function YT(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function JT(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new vn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Ce(de.from(a),0,0),1,!0))}function hr(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,a=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!a.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,f=n-2;c>s;c--,f--){let p=o.node(c),m=o.index(c);if(p.type.spec.isolating)return!1;let g=p.content.cutByIndex(m,p.childCount),b=r&&r[f+1];b&&(g=g.replaceChild(0,b.type.create(b.attrs)));let y=r&&r[f]||p;if(!p.canReplace(m+1,p.childCount)||!y.type.validContent(g))return!1}let l=o.indexAfter(s),u=r&&r[0];return o.node(s).canReplaceWith(l,l,u?u.type:o.node(s+1).type)}function ZT(t,e,n=1,r){let o=t.doc.resolve(e),s=de.empty,a=de.empty;for(let l=o.depth,u=o.depth-n,c=n-1;l>u;l--,c--){s=de.from(o.node(l).copy(s));let f=r&&r[c];a=de.from(f?f.type.create(f.attrs,a):o.node(l).copy(a))}t.step(new fn(e,e,new Ce(s.append(a),n,n),!0))}function Ri(t,e){let n=t.resolve(e),r=n.index();return ly(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function QT(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),a=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function ly(t,e){return!!(t&&e&&!t.isLeaf&&QT(t,e))}function Zc(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,a,l=r.index(o);if(o==r.depth?(s=r.nodeBefore,a=r.nodeAfter):n>0?(s=r.node(o+1),l++,a=r.node(o).maybeChild(l)):(s=r.node(o).maybeChild(l-1),a=r.node(o+1)),s&&!s.isTextblock&&ly(s,a)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function NT(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),a=s.node().type;if(o&&a.inlineContent){let f=a.whitespace=="pre",p=!!a.contentMatch.matchType(o);f&&!p?r=!1:!f&&p&&(r=!0)}let l=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);ay(t,f.node(),f.before(),l)}a.inlineContent&&om(t,e+n-1,a,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(l),c=u.map(e-n);if(t.step(new fn(c,u.map(e+n,-1),Ce.empty,!0)),r===!0){let f=t.doc.resolve(c);sy(t,f.node(),f.before(),t.steps.length)}return t}function e7(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function uy(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let a=r.depth;a>=0;a--){let l=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,u=r.index(a)+(l>0?1:0),c=r.node(a),f=!1;if(s==1)f=c.canReplace(u,u,o);else{let p=c.contentMatchAt(u).findWrapping(o.firstChild.type);f=p&&c.canReplaceWith(u,u,p[0])}if(f)return l==0?r.pos:l<0?r.before(a+1):r.after(a+1)}return null}function Qc(t,e,n=e,r=Ce.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return cy(o,s,r)?new fn(e,n,r):new t7(o,s,r).fit()}function cy(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class t7{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=de.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=de.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,a=r.depth,l=o.depth;for(;a&&l&&s.childCount==1;)s=s.firstChild.content,a--,l--;let u=new Ce(s,a,l);return e>-1?new vn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new fn(r.pos,o.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=sm(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let a=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:u,match:c}=this.frontier[l],f,p=null;if(n==1&&(a?c.matchType(a.type)||(p=c.fillBefore(de.from(a),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:p};if(n==2&&a&&(f=c.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:f};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=sm(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new Ce(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=sm(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new Ce(eu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Ce(eu(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let y=0;y<s.length;y++)this.openFrontierNode(s[y]);let a=this.unplaced,l=r?r.content:a.content,u=a.openStart-e,c=0,f=[],{match:p,type:m}=this.frontier[n];if(o){for(let y=0;y<o.childCount;y++)f.push(o.child(y));p=p.matchFragment(o)}let g=l.size+e-(a.content.size-a.openEnd);for(;c<l.childCount;){let y=l.child(c),w=p.matchType(y.type);if(!w)break;c++,(c>1||u==0||y.content.size)&&(p=w,f.push(dy(y.mark(m.allowedMarks(y.marks)),c==1?u:0,c==l.childCount?g:-1)))}let b=c==l.childCount;b||(g=-1),this.placed=tu(this.placed,n,de.from(f)),this.frontier[n].match=p,b&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,w=l;y<g;y++){let x=w.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),w=x.content}this.unplaced=b?e==0?Ce.empty:new Ce(eu(a.content,e-1,1),e-1,g<0?a.openEnd:e-1):new Ce(eu(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!am(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),a=am(e,n,o,r,s);if(a){for(let l=n-1;l>=0;l--){let{match:u,type:c}=this.frontier[l],f=am(e,l,c,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:a,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=tu(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=tu(this.placed,this.depth,de.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(de.empty,!0);n.childCount&&(this.placed=tu(this.placed,this.frontier.length,n))}}function eu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(eu(t.firstChild.content,e-1,n)))}function tu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(tu(t.lastChild.content,e-1,n)))}function sm(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function dy(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,dy(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(de.empty,!0)))),t.copy(r)}function am(t,e,n,r,o){let s=t.node(e),a=o?t.indexAfter(e):t.index(e);if(a==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,a);return l&&!n7(n,s.content,a)?l:null}function n7(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function r7(t){return t.spec.defining||t.spec.definingForContent}function o7(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(cy(o,s,r))return t.step(new fn(e,n,r));let a=py(o,t.doc.resolve(n));a[a.length-1]==0&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let m=o.depth,g=o.pos-1;m>0;m--,g--){let b=o.node(m).type.spec;if(b.defining||b.definingAsContext||b.isolating)break;a.indexOf(m)>-1?l=m:o.before(m)==g&&a.splice(1,0,-m)}let u=a.indexOf(l),c=[],f=r.openStart;for(let m=r.content,g=0;;g++){let b=m.firstChild;if(c.push(b),g==r.openStart)break;m=b.content}for(let m=f-1;m>=0;m--){let g=c[m],b=r7(g.type);if(b&&!g.sameMarkup(o.node(Math.abs(l)-1)))f=m;else if(b||!g.type.isTextblock)break}for(let m=r.openStart;m>=0;m--){let g=(m+f+1)%(r.openStart+1),b=c[g];if(b)for(let y=0;y<a.length;y++){let w=a[(y+u)%a.length],x=!0;w<0&&(x=!1,w=-w);let E=o.node(w-1),k=o.index(w-1);if(E.canReplaceWith(k,k,b.type,b.marks))return t.replace(o.before(w),x?s.after(w):n,new Ce(fy(r.content,0,r.openStart,g),g,r.openEnd))}}let p=t.steps.length;for(let m=a.length-1;m>=0&&(t.replace(e,n,r),!(t.steps.length>p));m--){let g=a[m];g<0||(e=o.before(g),n=s.after(g))}}function fy(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(fy(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(de.empty,!0))}return t}function i7(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=e7(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new Ce(de.from(r),0,0))}function s7(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=py(r,o);for(let a=0;a<s.length;a++){let l=s[a],u=a==s.length-1;if(u&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(u||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let a=1;a<=r.depth&&a<=o.depth;a++)if(e-r.start(a)==r.depth-a&&n>r.end(a)&&o.end(a)-n!=o.depth-a&&r.start(a-1)==o.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),o.index(a-1)))return t.delete(r.before(a),n);t.delete(e,n)}function py(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class Ba extends In{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return dn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return dn.fromReplace(e,this.pos,this.pos+1,new Ce(de.from(o),0,n.isLeaf?0:1))}getMap(){return pr.empty}invert(e){return new Ba(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ba(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ba(n.pos,n.attr,n.value)}}In.jsonID("attr",Ba);class nu extends In{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return dn.ok(r)}getMap(){return pr.empty}invert(e){return new nu(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new nu(n.attr,n.value)}}In.jsonID("docAttr",nu);let Ia=class extends Error{};Ia=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Ia.prototype=Object.create(Error.prototype),Ia.prototype.constructor=Ia,Ia.prototype.name="TransformError";class lm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Nl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ia(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Ce.empty){let o=Qc(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new Ce(de.from(r),0,0))}delete(e,n){return this.replace(e,n,Ce.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return o7(this,e,n,r),this}replaceRangeWith(e,n,r){return i7(this,e,n,r),this}deleteRange(e,n){return s7(this,e,n),this}lift(e,n){return jT(this,e,n),this}join(e,n=1){return NT(this,e,n),this}wrap(e,n){return GT(this,e,n),this}setBlockType(e,n=e,r,o=null){return XT(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return JT(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Ba(e,n,r)),this}setDocAttribute(e,n){return this.step(new nu(e,n)),this}addNodeMark(e,n){return this.step(new Ii(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Dt)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Oa(e,n)),this}split(e,n=1,r){return ZT(this,e,n,r),this}addMark(e,n,r){return HT(this,e,n,r),this}removeMark(e,n,r){return UT(this,e,n,r),this}clearIncompatible(e,n,r){return om(this,e,n,r),this}}const um=Object.create(null);let De=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new hy(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Ce.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:u,$to:c}=a[l],f=e.mapping.slice(s);e.replaceRange(f.map(u.pos),f.map(c.pos),l?Ce.empty:n),l==0&&by(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],u=e.mapping.slice(r),c=u.map(a.pos),f=u.map(l.pos);s?e.deleteRange(c,f):(e.replaceRangeWith(c,f,n),by(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Te(e):Ra(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let a=n<0?Ra(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Ra(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(a)return a}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Rn(e.node(0))}static atStart(e){return Ra(e,e,0,0,1)||new Rn(e)}static atEnd(e){return Ra(e,e,e.content.size,e.childCount,-1)||new Rn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=um[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in um)throw new RangeError("Duplicate use of selection JSON ID "+e);return um[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Te.between(this.$anchor,this.$head).getBookmark()}};De.prototype.visible=!0;class hy{constructor(e,n){this.$from=e,this.$to=n}}let my=!1;function gy(t){!my&&!t.parent.inlineContent&&(my=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Te extends De{constructor(e,n=e){gy(e),gy(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return De.near(r);let o=e.resolve(n.map(this.anchor));return new Te(o.parent.inlineContent?o:r,r)}replace(e,n=Ce.empty){if(super.replace(e,n),n==Ce.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Te&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Te(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let s=De.findFrom(n,r,!0)||De.findFrom(n,-r,!0);if(s)n=s.$head;else return De.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(De.findFrom(e,-r,!0)||De.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Te(e,n)}}De.jsonID("text",Te);class Nc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Nc(e.map(this.anchor),e.map(this.head))}resolve(e){return Te.between(e.resolve(this.anchor),e.resolve(this.head))}}class Le extends De{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),s=e.resolve(o);return r?De.near(s):new Le(s)}content(){return new Ce(de.from(this.node),0,0)}eq(e){return e instanceof Le&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new cm(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Le(e.resolve(n.anchor))}static create(e,n){return new Le(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Le.prototype.visible=!1,De.jsonID("node",Le);class cm{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Nc(r,r):new cm(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Le.isSelectable(r)?new Le(n):De.near(n)}}class Rn extends De{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Ce.empty){if(n==Ce.empty){e.delete(0,e.doc.content.size);let r=De.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Rn(e)}map(e){return new Rn(e)}eq(e){return e instanceof Rn}getBookmark(){return a7}}De.jsonID("all",Rn);const a7={map(){return this},resolve(t){return new Rn(t)}};function Ra(t,e,n,r,o,s=!1){if(e.inlineContent)return Te.create(t,n);for(let a=r-(o>0?0:1);o>0?a<e.childCount:a>=0;a+=o){let l=e.child(a);if(l.isAtom){if(!s&&Le.isSelectable(l))return Le.create(t,n-(o<0?l.nodeSize:0))}else{let u=Ra(t,l,n+o,o<0?l.childCount:0,o,s);if(u)return u}n+=l.nodeSize*o}return null}function by(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof fn||o instanceof vn))return;let s=t.mapping.maps[r],a;s.forEach((l,u,c,f)=>{a==null&&(a=f)}),t.setSelection(De.near(t.doc.resolve(a),n))}const vy=1,yy=2,wy=4;class l7 extends lm{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vy)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&vy)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=yy,this}ensureMarks(e){return Dt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&yy)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Dt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let a=this.doc.resolve(n);s=r==n?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,s)),this.selection.empty||this.setSelection(De.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wy,this}get scrolledIntoView(){return(this.updated&wy)>0}}function xy(t,e){return!e||!t?t:t.bind(e)}class ru{constructor(e,n,r){this.name=e,this.init=xy(n.init,r),this.apply=xy(n.apply,r)}}const u7=[new ru("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ru("selection",{init(t,e){return t.selection||De.atStart(e.doc)},apply(t){return t.selection}}),new ru("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ru("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class dm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=u7.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ru(r.key,r.spec.state,r))})}}class La{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let a=0;a<this.config.plugins.length;a++){let l=this.config.plugins[a];if(l.spec.appendTransaction){let u=o?o[a].n:0,c=o?o[a].state:this,f=u<n.length&&l.spec.appendTransaction.call(l,u?n.slice(u):n,c,r);if(f&&r.filterTransaction(f,a)){if(f.setMeta("appendedTransaction",e),!o){o=[];for(let p=0;p<this.config.plugins.length;p++)o.push(p<a?{state:r,n:n.length}:{state:this,n:0})}n.push(f),r=r.applyInner(f),s=!0}o&&(o[a]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new La(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new l7(this)}static create(e){let n=new dm(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new La(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new dm(this.schema,e.plugins),r=n.fields,o=new La(n);for(let s=0;s<r.length;s++){let a=r[s].name;o[a]=this.hasOwnProperty(a)?this[a]:r[s].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new dm(e.schema,e.plugins),s=new La(o);return o.fields.forEach(a=>{if(a.name=="doc")s.doc=eo.fromJSON(e.schema,n.doc);else if(a.name=="selection")s.selection=De.fromJSON(s.doc,n.selection);else if(a.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let u=r[l],c=u.spec.state;if(u.key==a.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[a.name]=c.fromJSON.call(u,e,n[l],s);return}}s[a.name]=a.init(e,s)}}),s}}function Cy(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Cy(o,e,{})),n[r]=o}return n}class tt{constructor(e){this.spec=e,this.props={},e.props&&Cy(e.props,this,this.props),this.key=e.key?e.key.key:Ey("plugin")}getState(e){return e[this.key]}}const fm=Object.create(null);function Ey(t){return t in fm?t+"$"+ ++fm[t]:(fm[t]=0,t+"$")}class kt{constructor(e="key"){this.key=Ey(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const _n=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Pa=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let pm=null;const Zo=function(t,e,n){let r=pm||(pm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},c7=function(){pm=null},Os=function(t,e,n,r){return n&&(ky(t,e,n,r,-1)||ky(t,e,n,r,1))},d7=/^(img|br|input|textarea|hr)$/i;function ky(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Br(t))){let s=t.parentNode;if(!s||s.nodeType!=1||ou(t)||d7.test(t.nodeName)||t.contentEditable=="false")return!1;e=_n(t)+(o<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?Br(t):0}else return!1}}function Br(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function f7(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Br(t)}else if(t.parentNode&&!ou(t))e=_n(t),t=t.parentNode;else return null}}function p7(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ou(t))e=_n(t)+1,t=t.parentNode;else return null}}function h7(t,e,n){for(let r=e==0,o=e==Br(t);r||o;){if(t==n)return!0;let s=_n(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==Br(t)}}function ou(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ed=function(t){return t.focusNode&&Os(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ms(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function m7(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function g7(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Br(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Br(r.startContainer),r.startOffset)}}}const Eo=typeof navigator<"u"?navigator:null,Sy=typeof document<"u"?document:null,Li=Eo&&Eo.userAgent||"",hm=/Edge\/(\d+)/.exec(Li),_y=/MSIE \d/.exec(Li),mm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Li),tr=!!(_y||mm||hm),Pi=_y?document.documentMode:mm?+mm[1]:hm?+hm[1]:0,ro=!tr&&/gecko\/(\d+)/i.test(Li);ro&&+(/Firefox\/(\d+)/.exec(Li)||[0,0])[1];const gm=!tr&&/Chrome\/(\d+)/.exec(Li),Ln=!!gm,Ty=gm?+gm[1]:0,qn=!tr&&!!Eo&&/Apple Computer/.test(Eo.vendor),Da=qn&&(/Mobile\/\w+/.test(Li)||!!Eo&&Eo.maxTouchPoints>2),Ir=Da||(Eo?/Mac/.test(Eo.platform):!1),b7=Eo?/Win/.test(Eo.platform):!1,Qo=/Android \d/.test(Li),iu=!!Sy&&"webkitFontSmoothing"in Sy.documentElement.style,v7=iu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function y7(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function No(t,e){return typeof t=="number"?t:t[e]}function w7(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Ay(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let a=n||t.dom;a;){if(a.nodeType!=1){a=Pa(a);continue}let l=a,u=l==s.body,c=u?y7(s):w7(l),f=0,p=0;if(e.top<c.top+No(r,"top")?p=-(c.top-e.top+No(o,"top")):e.bottom>c.bottom-No(r,"bottom")&&(p=e.bottom-e.top>c.bottom-c.top?e.top+No(o,"top")-c.top:e.bottom-c.bottom+No(o,"bottom")),e.left<c.left+No(r,"left")?f=-(c.left-e.left+No(o,"left")):e.right>c.right-No(r,"right")&&(f=e.right-c.right+No(o,"right")),f||p)if(u)s.defaultView.scrollBy(f,p);else{let g=l.scrollLeft,b=l.scrollTop;p&&(l.scrollTop+=p),f&&(l.scrollLeft+=f);let y=l.scrollLeft-g,w=l.scrollTop-b;e={left:e.left-y,top:e.top-w,right:e.right-y,bottom:e.bottom-w}}let m=u?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(m))break;a=m=="absolute"?a.offsetParent:Pa(a)}}function x7(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,a=n+1;a<Math.min(innerHeight,e.bottom);a+=5){let l=t.root.elementFromPoint(s,a);if(!l||l==t.dom||!t.dom.contains(l))continue;let u=l.getBoundingClientRect();if(u.top>=n-20){r=l,o=u.top;break}}return{refDOM:r,refTop:o,stack:Oy(t.dom)}}function Oy(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Pa(r));return e}function C7({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;My(n,r==0?0:r-e)}function My(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Va=null;function E7(t){if(t.setActive)return t.setActive();if(Va)return t.focus(Va);let e=Oy(t);t.focus(Va==null?{get preventScroll(){return Va={preventScroll:!0},!0}}:void 0),Va||(Va=!1,My(e,0))}function By(t,e){let n,r=2e8,o,s=0,a=e.top,l=e.top,u,c;for(let f=t.firstChild,p=0;f;f=f.nextSibling,p++){let m;if(f.nodeType==1)m=f.getClientRects();else if(f.nodeType==3)m=Zo(f).getClientRects();else continue;for(let g=0;g<m.length;g++){let b=m[g];if(b.top<=a&&b.bottom>=l){a=Math.max(b.bottom,a),l=Math.min(b.top,l);let y=b.left>e.left?b.left-e.left:b.right<e.left?e.left-b.right:0;if(y<r){n=f,r=y,o=y&&n.nodeType==3?{left:b.right<e.left?b.right:b.left,top:e.top}:e,f.nodeType==1&&y&&(s=p+(e.left>=(b.left+b.right)/2?1:0));continue}}else b.top>e.top&&!u&&b.left<=e.left&&b.right>=e.left&&(u=f,c={left:Math.max(b.left,Math.min(b.right,e.left)),top:b.top});!n&&(e.left>=b.right&&e.top>=b.top||e.left>=b.left&&e.top>=b.bottom)&&(s=p+1)}}return!n&&u&&(n=u,o=c,r=0),n&&n.nodeType==3?k7(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:By(n,o)}function k7(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=Di(r,1);if(s.top!=s.bottom&&bm(e,s))return{node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function bm(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function S7(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function _7(t,e,n){let{node:r,offset:o}=By(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function T7(t,e,n,r){let o=-1;for(let s=e,a=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),u;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((u=l.dom.getBoundingClientRect()).width||u.height)&&(l.node.isBlock&&l.parent&&(!a&&u.left>r.left||u.top>r.top?o=l.posBefore:(!a&&u.right<r.left||u.bottom<r.top)&&(o=l.posAfter),a=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function Iy(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=o;;){let a=t.childNodes[s];if(a.nodeType==1){let l=a.getClientRects();for(let u=0;u<l.length;u++){let c=l[u];if(bm(e,c))return Iy(a,e,c)}}if((s=(s+1)%r)==o)break}return t}function A7(t,e){let n=t.dom.ownerDocument,r,o=0,s=g7(n,e.left,e.top);s&&({node:r,offset:o}=s);let a=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!a||!t.dom.contains(a.nodeType!=1?a.parentNode:a)){let c=t.dom.getBoundingClientRect();if(!bm(e,c)||(a=Iy(t.dom,e,c),!a))return null}if(qn)for(let c=a;r&&c;c=Pa(c))c.draggable&&(r=void 0);if(a=S7(a,e),r){if(ro&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let f=r.childNodes[o],p;f.nodeName=="IMG"&&(p=f.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&o++}let c;iu&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=T7(t,r,o,e))}l==null&&(l=_7(t,a,e));let u=t.docView.nearestDesc(a,!0);return{pos:l,inside:u?u.posAtStart-u.border:-1}}function Ry(t){return t.top<t.bottom||t.left<t.right}function Di(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ry(r))return r}return Array.prototype.find.call(n,Ry)||t.getBoundingClientRect()}const O7=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ly(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),a=iu||ro;if(r.nodeType==3)if(a&&(O7.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let u=Di(Zo(r,o,o),n);if(ro&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Di(Zo(r,o-1,o-1),-1);if(c.top==u.top){let f=Di(Zo(r,o,o+1),-1);if(f.top!=u.top)return su(f,f.left<c.left)}}return u}else{let u=o,c=o,f=n<0?1:-1;return n<0&&!o?(c++,f=-1):n>=0&&o==r.nodeValue.length?(u--,f=1):n<0?u--:c++,su(Di(Zo(r,u,c),f),f<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Br(r))){let u=r.childNodes[o-1];if(u.nodeType==1)return vm(u.getBoundingClientRect(),!1)}if(s==null&&o<Br(r)){let u=r.childNodes[o];if(u.nodeType==1)return vm(u.getBoundingClientRect(),!0)}return vm(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Br(r))){let u=r.childNodes[o-1],c=u.nodeType==3?Zo(u,Br(u)-(a?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(c)return su(Di(c,1),!1)}if(s==null&&o<Br(r)){let u=r.childNodes[o];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let c=u?u.nodeType==3?Zo(u,0,a?0:1):u.nodeType==1?u:null:null;if(c)return su(Di(c,-1),!0)}return su(Di(r.nodeType==3?Zo(r):r,-n),n>=0)}function su(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function vm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Py(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function M7(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return Py(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let a=Ly(t,o.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let u;if(l.nodeType==1)u=l.getClientRects();else if(l.nodeType==3)u=Zo(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<u.length;c++){let f=u[c];if(f.bottom>f.top+1&&(n=="up"?a.top-f.top>(f.bottom-a.top)*2:f.bottom-a.bottom>(a.bottom-f.top)*2))return!1}}return!0})}const B7=/[\u0590-\u08ac]/;function I7(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,a=o==r.parent.content.size,l=t.domSelection();return l?!B7.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:a:Py(t,e,()=>{let{focusNode:u,focusOffset:c,anchorNode:f,anchorOffset:p}=t.domSelectionRange(),m=l.caretBidiLevel;l.modify("move",n,"character");let g=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:b,focusOffset:y}=t.domSelectionRange(),w=b&&!g.contains(b.nodeType==1?b:b.parentNode)||u==b&&c==y;try{l.collapse(f,p),u&&(u!=f||c!=p)&&l.extend&&l.extend(u,c)}catch{}return m!=null&&(l.caretBidiLevel=m),w}):r.pos==r.start()||r.pos==r.end()}let Dy=null,Vy=null,Fy=!1;function R7(t,e,n){return Dy==e&&Vy==n?Fy:(Dy=e,Vy=n,Fy=n=="up"||n=="down"?M7(t,e,n):I7(t,e,n))}const Rr=0,$y=1,Bs=2,ko=3;class au{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Rr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,a;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(a)+a.size:this.posAtStart}else{let s,a;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(a):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>_n(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),a;if(s&&(!n||s.node))if(r&&(a=s.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let a=0;a<o.children.length;a++){let l=o.children[a];if(l.size){o=l;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let a=this.children[r],l=s+a.size;if(l>e||a instanceof Uy){o=e-s;break}s=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof zy&&s.side>=0;r--);if(n<=0){let s,a=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,a=!1);return s&&n&&a&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?_n(s.dom)+1:0}}else{let s,a=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,a=!1);return s&&a&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?_n(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let a=r,l=0;;l++){let u=this.children[l],c=a+u.size;if(o==-1&&e<=c){let f=a+u.border;if(e>=f&&n<=c-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=a;for(let p=l;p>0;p--){let m=this.children[p-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){o=_n(m.dom)+1;break}e-=m.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let f=l+1;f<this.children.length;f++){let p=this.children[f];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){s=_n(p.dom);break}n+=p.size}s==-1&&(s=this.contentDOM.childNodes.length);break}a=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let s=Math.min(e,n),a=Math.max(e,n);for(let g=0,b=0;g<this.children.length;g++){let y=this.children[g],w=b+y.size;if(s>b&&a<w)return y.setSelection(e-b-y.border,n-b-y.border,r,o);b=w}let l=this.domFromPos(e,e?-1:1),u=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),f=r.domSelectionRange(),p=!1;if((ro||qn)&&e==n){let{node:g,offset:b}=l;if(g.nodeType==3){if(p=!!(b&&g.nodeValue[b-1]==`
|
|
6
|
-
`),p&&b==g.nodeValue.length)for(let y=g,w;y;y=y.parentNode){if(w=y.nextSibling){w.nodeName=="BR"&&(l=u={node:w.parentNode,offset:_n(w)+1});break}let x=y.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let y=g.childNodes[b-1];p=y&&(y.nodeName=="BR"||y.contentEditable=="false")}}if(ro&&f.focusNode&&f.focusNode!=u.node&&f.focusNode.nodeType==1){let g=f.focusNode.childNodes[f.focusOffset];g&&g.contentEditable=="false"&&(o=!0)}if(!(o||p&&qn)&&Os(l.node,l.offset,f.anchorNode,f.anchorOffset)&&Os(u.node,u.offset,f.focusNode,f.focusOffset))return;let m=!1;if((c.extend||e==n)&&!p){c.collapse(l.node,l.offset);try{e!=n&&c.extend(u.node,u.offset),m=!0}catch{}}if(!m){if(e>n){let b=l;l=u,u=b}let g=document.createRange();g.setEnd(u.node,u.offset),g.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(g)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],a=r+s.size;if(r==a?e<=a&&n>=r:e<a&&n>r){let l=r+s.border,u=a-s.border;if(e>=l&&n<=u){this.dirty=e==r||n==a?Bs:$y,e==l&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ko:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Bs:ko}r=a}this.dirty=Bs}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Bs:$y;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class zy extends au{constructor(e,n,r,o){let s,a=n.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(a.nodeType!=1){let l=document.createElement("span");l.appendChild(a),a=l}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Rr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class L7 extends au{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Is extends au{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],a=s&&s(n,o,r);return(!a||!a.dom)&&(a=to.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Is(e,n,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&ko||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ko&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Rr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Rr}}slice(e,n,r){let o=Is.create(this.parent,this.mark,!0,r),s=this.children,a=this.size;n<a&&(s=wm(s,n,a,r)),e>0&&(s=wm(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Vi extends au{constructor(e,n,r,o,s,a,l,u,c){super(e,[],s,a),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,s,a){let l=s.nodeViews[n.type.name],u,c=l&&l(n,s,()=>{if(!u)return a;if(u.parent)return u.parent.posBeforeChild(u)},r,o),f=c&&c.dom,p=c&&c.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:p}=to.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!p&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let m=f;return f=qy(f,r,n),c?u=new P7(e,n,r,o,f,p||null,m,c,s,a+1):n.isText?new td(e,n,r,o,f,m,s):new Vi(e,n,r,o,f,p||null,m,s,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>de.empty)}return e}matchesNode(e,n,r){return this.dirty==Rr&&e.eq(this.node)&&nd(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,s=e.composing?this.localCompositionInfo(e,n):null,a=s&&s.pos>-1?s:null,l=s&&s.pos<0,u=new V7(this,a&&a.node,e);z7(this.node,this.innerDeco,(c,f,p)=>{c.spec.marks?u.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!p&&u.syncToMarks(f==this.node.childCount?Dt.none:this.node.child(f).marks,r,e),u.placeWidget(c,e,o)},(c,f,p,m)=>{u.syncToMarks(c.marks,r,e);let g;u.findNodeMatch(c,f,p,m)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(g=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(c,f,p,g,e)||u.updateNextNode(c,f,p,e,m,o)||u.addNode(c,f,p,e,o),o+=c.nodeSize}),u.syncToMarks([],r,e),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Bs)&&(a&&this.protectLocalComposition(e,a),Wy(this.contentDOM,this.children,e),Da&&H7(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Te)||r<n||o>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=U7(this.node.content,a,r-n,o-n);return l<0?null:{node:s,pos:l,text:a}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let a=new L7(this,s,n,o);e.input.compositionNodes.push(a),this.children=wm(this.children,r,r+o.length,e,a)}update(e,n,r,o){return this.dirty==ko||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Rr}updateOuterDeco(e){if(nd(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=jy(this.dom,this.nodeDOM,ym(this.outerDeco,this.node,n),ym(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Hy(t,e,n,r,o){qy(r,e,t);let s=new Vi(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class td extends Vi{constructor(e,n,r,o,s,a,l){super(e,n,r,o,s,null,a,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==ko||this.dirty!=Rr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Rr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Rr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),s=document.createTextNode(o.text);return new td(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ko)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Uy extends au{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Rr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class P7 extends Vi{constructor(e,n,r,o,s,a,l,u,c,f){super(e,n,r,o,s,a,l,c,f),this.spec=u}update(e,n,r,o){if(this.dirty==ko)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Wy(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let a=e[s],l=a.dom;if(l.parentNode==t){for(;l!=r;)r=Ky(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(a instanceof Is){let u=r?r.previousSibling:t.lastChild;Wy(a.contentDOM,a.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=Ky(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const lu=function(t){t&&(this.nodeName=t)};lu.prototype=Object.create(null);const Rs=[new lu];function ym(t,e,n){if(t.length==0)return Rs;let r=n?Rs[0]:new lu,o=[r];for(let s=0;s<t.length;s++){let a=t[s].type.attrs;if(a){a.nodeName&&o.push(r=new lu(a.nodeName));for(let l in a){let u=a[l];u!=null&&(n&&o.length==1&&o.push(r=new lu(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+u:l=="style"?r.style=(r.style?r.style+";":"")+u:l!="nodeName"&&(r[l]=u))}}}return o}function jy(t,e,n,r){if(n==Rs&&r==Rs)return e;let o=e;for(let s=0;s<r.length;s++){let a=r[s],l=n[s];if(s){let u;l&&l.nodeName==a.nodeName&&o!=t&&(u=o.parentNode)&&u.nodeName.toLowerCase()==a.nodeName||(u=document.createElement(a.nodeName),u.pmIsDeco=!0,u.appendChild(o),l=Rs[0]),o=u}D7(o,l||Rs[0],a)}return o}function D7(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function qy(t,e,n){return jy(t,t,Rs,ym(e,n,t.nodeType!=1))}function nd(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Ky(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class V7{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=F7(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;o<a&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=Rr,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let u=this.index;u<Math.min(this.index+3,this.top.children.length);u++){let c=this.top.children[u];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=Is.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let s=-1,a;if(o>=this.preMatch.index&&(a=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&a.matchesNode(e,n,r))s=this.top.children.indexOf(a,this.index);else for(let l=this.index,u=Math.min(this.top.children.length,l+5);l<u;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let a=this.top.children[o];return a.dirty==ko&&a.dom==a.contentDOM&&(a.dirty=Bs),a.update(e,n,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,s,a){for(let l=this.index;l<this.top.children.length;l++){let u=this.top.children[l];if(u instanceof Vi){let c=this.preMatch.matched.get(u);if(c!=null&&c!=s)return!1;let f=u.dom,p,m=this.isLocked(f)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=ko&&nd(n,u.outerDeco));if(!m&&u.update(e,n,r,o))return this.destroyBetween(this.index,l),u.dom!=f&&(this.changed=!0),this.index++,!0;if(!m&&(p=this.recreateWrapper(u,e,n,r,o,a)))return this.destroyBetween(this.index,l),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=Bs,p.updateChildren(o,a+1),p.dirty=Rr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,a){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!nd(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=Vi.create(this.top,n,r,o,s,a);if(l.contentDOM){l.children=e.children,e.children=[];for(let u of l.children)u.parent=l}return e.destroy(),l}addNode(e,n,r,o,s){let a=Vi.create(this.top,e,n,r,o,s);a.contentDOM&&a.updateChildren(o,s+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let s=new zy(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Is;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof td)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((qn||Ln)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Uy(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function F7(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,a=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Is)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=l.node;if(u){if(u!=t.child(o-1))break;--o,s.set(l,o),a.push(l)}}return{index:o,matched:s,matches:a.reverse()}}function $7(t,e){return t.type.side-e.type.side}function z7(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let f=t.child(c);r(f,o,e.forChild(s,f),c),s+=f.nodeSize}return}let a=0,l=[],u=null;for(let c=0;;){let f,p;for(;a<o.length&&o[a].to==s;){let w=o[a++];w.widget&&(f?(p||(p=[f])).push(w):f=w)}if(f)if(p){p.sort($7);for(let w=0;w<p.length;w++)n(p[w],c,!!u)}else n(f,c,!!u);let m,g;if(u)g=-1,m=u,u=null;else if(c<t.childCount)g=c,m=t.child(c++);else break;for(let w=0;w<l.length;w++)l[w].to<=s&&l.splice(w--,1);for(;a<o.length&&o[a].from<=s&&o[a].to>s;)l.push(o[a++]);let b=s+m.nodeSize;if(m.isText){let w=b;a<o.length&&o[a].from<w&&(w=o[a].from);for(let x=0;x<l.length;x++)l[x].to<w&&(w=l[x].to);w<b&&(u=m.cut(w-s),m=m.cut(0,w-s),b=w,g=-1)}else for(;a<o.length&&o[a].to<b;)a++;let y=m.isInline&&!m.isLeaf?l.filter(w=>!w.inline):l.slice();r(m,y,e.forChild(s,m),g),s=b}}function H7(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function U7(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let a=t.child(o++),l=s;if(s+=a.nodeSize,!a.isText)continue;let u=a.text;for(;o<t.childCount;){let c=t.child(o++);if(s+=c.nodeSize,!c.isText)break;u+=c.text}if(s>=n){if(s>=r&&u.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?u.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&u.length>=r+e.length-l&&u.slice(r-l,r-l+e.length)==e)return r}}return-1}function wm(t,e,n,r,o){let s=[];for(let a=0,l=0;a<t.length;a++){let u=t[a],c=l,f=l+=u.size;c>=n||f<=e?s.push(u):(c<e&&s.push(u.slice(0,e-c,r)),o&&(s.push(o),o=void 0),f>n&&s.push(u.slice(n-c,u.size,r)))}return s}function xm(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let l=r.resolve(a),u,c;if(ed(n)){for(u=a;o&&!o.node;)o=o.parent;let p=o.node;if(o&&p.isAtom&&Le.isSelectable(p)&&o.parent&&!(p.isInline&&h7(n.focusNode,n.focusOffset,o.dom))){let m=o.posBefore;c=new Le(a==m?l:r.resolve(m))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let p=a,m=a;for(let g=0;g<n.rangeCount;g++){let b=n.getRangeAt(g);p=Math.min(p,t.docView.posFromDOM(b.startContainer,b.startOffset,1)),m=Math.max(m,t.docView.posFromDOM(b.endContainer,b.endOffset,-1))}if(p<0)return null;[u,a]=m==t.state.selection.anchor?[m,p]:[p,m],l=r.resolve(a)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let f=r.resolve(u);if(!c){let p=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=Em(t,f,l,p)}return c}function Gy(t){return t.editable?t.hasFocus():e3(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ei(t,e=!1){let n=t.state.selection;if(Zy(t,n),!!Gy(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ln){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Os(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)j7(t);else{let{anchor:r,head:o}=n,s,a;Xy&&!(n instanceof Te)&&(n.$from.parent.inlineContent||(s=Yy(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=Yy(t,n.to))),t.docView.setSelection(r,o,t,e),Xy&&(s&&Jy(s),a&&Jy(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&W7(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Xy=qn||Ln&&Ty<63;function Yy(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(qn&&o&&o.contentEditable=="false")return Cm(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return Cm(o);if(s)return Cm(s)}}function Cm(t){return t.contentEditable="true",qn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Jy(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function W7(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Gy(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function j7(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,_n(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&tr&&Pi<=11&&(r.disabled=!0,r.disabled=!1)}function Zy(t,e){if(e instanceof Le){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Qy(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Qy(t)}function Qy(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Em(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Te.between(e,n,r)}function Ny(t){return t.editable&&!t.hasFocus()?!1:e3(t)}function e3(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function q7(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Os(e.node,e.offset,n.anchorNode,n.anchorOffset)}function km(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&De.findFrom(s,e)}function Fi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function t3(t,e,n){let r=t.state.selection;if(r instanceof Te)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let a=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Fi(t,new Te(r.$anchor,a))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=km(t.state,e);return o&&o instanceof Le?Fi(t,o):!1}else if(!(Ir&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,a;if(!s||s.isText)return!1;let l=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(a=t.docView.descAt(l))&&!a.contentDOM?Le.isSelectable(s)?Fi(t,new Le(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):iu?Fi(t,new Te(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Le&&r.node.isInline)return Fi(t,new Te(e>0?r.$to:r.$from));{let o=km(t.state,e);return o?Fi(t,o):!1}}}function rd(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function uu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fa(t,e){return e<0?K7(t):G7(t)}function K7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,a=!1;for(ro&&n.nodeType==1&&r<rd(n)&&uu(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(uu(l,-1))o=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(n3(n))break;{let l=n.previousSibling;for(;l&&uu(l,-1);)o=n.parentNode,s=_n(l),l=l.previousSibling;if(l)n=l,r=rd(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?Sm(t,n,r):o&&Sm(t,o,s)}function G7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=rd(n),s,a;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(uu(l,1))s=n,a=++r;else break}else{if(n3(n))break;{let l=n.nextSibling;for(;l&&uu(l,1);)s=l.parentNode,a=_n(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=rd(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&Sm(t,s,a)}function n3(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function X7(t,e){for(;t&&e==t.childNodes.length&&!ou(t);)e=_n(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Y7(t,e){for(;t&&!e&&!ou(t);)e=_n(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Sm(t,e,n){if(e.nodeType!=3){let s,a;(a=X7(e,n))?(e=a,n=0):(s=Y7(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ed(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&ei(t)},50)}function r3(t,e){let n=t.state.doc.resolve(e);if(!(Ln||b7)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>o.top&&a<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),a=(s.top+s.bottom)/2;if(a>o.top&&a<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function o3(t,e,n){let r=t.state.selection;if(r instanceof Te&&!r.empty||n.indexOf("s")>-1||Ir&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=km(t.state,e);if(a&&a instanceof Le)return Fi(t,a)}if(!o.parent.inlineContent){let a=e<0?o:s,l=r instanceof Rn?De.near(a,e):De.findFrom(a,e);return l?Fi(t,l):!1}return!1}function i3(t,e){if(!(t.state.selection instanceof Te))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let a=t.state.tr;return e<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),t.dispatch(a),!0}return!1}function s3(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function J7(t){if(!qn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;s3(t,r,"true"),setTimeout(()=>s3(t,r,"false"),20)}return!1}function Z7(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Q7(t,e){let n=e.keyCode,r=Z7(e);if(n==8||Ir&&n==72&&r=="c")return i3(t,-1)||Fa(t,-1);if(n==46&&!e.shiftKey||Ir&&n==68&&r=="c")return i3(t,1)||Fa(t,1);if(n==13||n==27)return!0;if(n==37||Ir&&n==66&&r=="c"){let o=n==37?r3(t,t.state.selection.from)=="ltr"?-1:1:-1;return t3(t,o,r)||Fa(t,o)}else if(n==39||Ir&&n==70&&r=="c"){let o=n==39?r3(t,t.state.selection.from)=="ltr"?1:-1:1;return t3(t,o,r)||Fa(t,o)}else{if(n==38||Ir&&n==80&&r=="c")return o3(t,-1,r)||Fa(t,-1);if(n==40||Ir&&n==78&&r=="c")return J7(t)||o3(t,1,r)||Fa(t,1);if(r==(Ir?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function _m(t,e){t.someProp("transformCopied",g=>{e=g(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let g=r.firstChild;n.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),r=g.content}let a=t.someProp("clipboardSerializer")||to.fromSchema(t.state.schema),l=h3(),u=l.createElement("div");u.appendChild(a.serializeFragment(r,{document:l}));let c=u.firstChild,f,p=0;for(;c&&c.nodeType==1&&(f=f3[c.nodeName.toLowerCase()]);){for(let g=f.length-1;g>=0;g--){let b=l.createElement(f[g]);for(;u.firstChild;)b.appendChild(u.firstChild);u.appendChild(b),p++}c=u.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${p?` -${p}`:""} ${JSON.stringify(n)}`);let m=t.someProp("clipboardTextSerializer",g=>g(e,t))||e.content.textBetween(0,e.content.size,`
|
|
5
|
+
`))}})}function YT(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function JT(t,e,n,r,o){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(r,null,o||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new vn(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new Ce(de.from(a),0,0),1,!0))}function hr(t,e,n=1,r){let o=t.resolve(e),s=o.depth-n,a=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!a.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,f=n-2;c>s;c--,f--){let p=o.node(c),m=o.index(c);if(p.type.spec.isolating)return!1;let g=p.content.cutByIndex(m,p.childCount),b=r&&r[f+1];b&&(g=g.replaceChild(0,b.type.create(b.attrs)));let y=r&&r[f]||p;if(!p.canReplace(m+1,p.childCount)||!y.type.validContent(g))return!1}let l=o.indexAfter(s),u=r&&r[0];return o.node(s).canReplaceWith(l,l,u?u.type:o.node(s+1).type)}function ZT(t,e,n=1,r){let o=t.doc.resolve(e),s=de.empty,a=de.empty;for(let l=o.depth,u=o.depth-n,c=n-1;l>u;l--,c--){s=de.from(o.node(l).copy(s));let f=r&&r[c];a=de.from(f?f.type.create(f.attrs,a):o.node(l).copy(a))}t.step(new fn(e,e,new Ce(s.append(a),n,n),!0))}function Ri(t,e){let n=t.resolve(e),r=n.index();return ly(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function QT(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),a=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(a),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function ly(t,e){return!!(t&&e&&!t.isLeaf&&QT(t,e))}function Zc(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let s,a,l=r.index(o);if(o==r.depth?(s=r.nodeBefore,a=r.nodeAfter):n>0?(s=r.node(o+1),l++,a=r.node(o).maybeChild(l)):(s=r.node(o).maybeChild(l-1),a=r.node(o+1)),s&&!s.isTextblock&&ly(s,a)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function NT(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,s=t.doc.resolve(e-n),a=s.node().type;if(o&&a.inlineContent){let f=a.whitespace=="pre",p=!!a.contentMatch.matchType(o);f&&!p?r=!1:!f&&p&&(r=!0)}let l=t.steps.length;if(r===!1){let f=t.doc.resolve(e+n);ay(t,f.node(),f.before(),l)}a.inlineContent&&om(t,e+n-1,a,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(l),c=u.map(e-n);if(t.step(new fn(c,u.map(e+n,-1),Ce.empty,!0)),r===!0){let f=t.doc.resolve(c);sy(t,f.node(),f.before(),t.steps.length)}return t}function e7(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,n))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,n))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function uy(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let s=0;s<n.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let a=r.depth;a>=0;a--){let l=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,u=r.index(a)+(l>0?1:0),c=r.node(a),f=!1;if(s==1)f=c.canReplace(u,u,o);else{let p=c.contentMatchAt(u).findWrapping(o.firstChild.type);f=p&&c.canReplaceWith(u,u,p[0])}if(f)return l==0?r.pos:l<0?r.before(a+1):r.after(a+1)}return null}function Qc(t,e,n=e,r=Ce.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),s=t.resolve(n);return cy(o,s,r)?new fn(e,n,r):new t7(o,s,r).fit()}function cy(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class t7{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=de.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=de.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,a=r.depth,l=o.depth;for(;a&&l&&s.childCount==1;)s=s.firstChild.content,a--,l--;let u=new Ce(s,a,l);return e>-1?new vn(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new fn(r.pos,o.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=sm(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let a=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:u,match:c}=this.frontier[l],f,p=null;if(n==1&&(a?c.matchType(a.type)||(p=c.fillBefore(de.from(a),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:p};if(n==2&&a&&(f=c.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:f};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=sm(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new Ce(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=sm(e,n);if(o.childCount<=1&&n>0){let s=e.size-n<=n+o.size;this.unplaced=new Ce(eu(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new Ce(eu(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let y=0;y<s.length;y++)this.openFrontierNode(s[y]);let a=this.unplaced,l=r?r.content:a.content,u=a.openStart-e,c=0,f=[],{match:p,type:m}=this.frontier[n];if(o){for(let y=0;y<o.childCount;y++)f.push(o.child(y));p=p.matchFragment(o)}let g=l.size+e-(a.content.size-a.openEnd);for(;c<l.childCount;){let y=l.child(c),w=p.matchType(y.type);if(!w)break;c++,(c>1||u==0||y.content.size)&&(p=w,f.push(dy(y.mark(m.allowedMarks(y.marks)),c==1?u:0,c==l.childCount?g:-1)))}let b=c==l.childCount;b||(g=-1),this.placed=tu(this.placed,n,de.from(f)),this.frontier[n].match=p,b&&g<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,w=l;y<g;y++){let x=w.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),w=x.content}this.unplaced=b?e==0?Ce.empty:new Ce(eu(a.content,e-1,1),e-1,g<0?a.openEnd:e-1):new Ce(eu(a.content,e,c),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!am(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),a=am(e,n,o,r,s);if(a){for(let l=n-1;l>=0;l--){let{match:u,type:c}=this.frontier[l],f=am(e,l,c,u,!0);if(!f||f.childCount)continue e}return{depth:n,fit:a,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=tu(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=tu(this.placed,this.depth,de.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(de.empty,!0);n.childCount&&(this.placed=tu(this.placed,this.frontier.length,n))}}function eu(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(eu(t.firstChild.content,e-1,n)))}function tu(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(tu(t.lastChild.content,e-1,n)))}function sm(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function dy(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,dy(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(de.empty,!0)))),t.copy(r)}function am(t,e,n,r,o){let s=t.node(e),a=o?t.indexAfter(e):t.index(e);if(a==s.childCount&&!n.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,a);return l&&!n7(n,s.content,a)?l:null}function n7(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function r7(t){return t.spec.defining||t.spec.definingForContent}function o7(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),s=t.doc.resolve(n);if(cy(o,s,r))return t.step(new fn(e,n,r));let a=py(o,t.doc.resolve(n));a[a.length-1]==0&&a.pop();let l=-(o.depth+1);a.unshift(l);for(let m=o.depth,g=o.pos-1;m>0;m--,g--){let b=o.node(m).type.spec;if(b.defining||b.definingAsContext||b.isolating)break;a.indexOf(m)>-1?l=m:o.before(m)==g&&a.splice(1,0,-m)}let u=a.indexOf(l),c=[],f=r.openStart;for(let m=r.content,g=0;;g++){let b=m.firstChild;if(c.push(b),g==r.openStart)break;m=b.content}for(let m=f-1;m>=0;m--){let g=c[m],b=r7(g.type);if(b&&!g.sameMarkup(o.node(Math.abs(l)-1)))f=m;else if(b||!g.type.isTextblock)break}for(let m=r.openStart;m>=0;m--){let g=(m+f+1)%(r.openStart+1),b=c[g];if(b)for(let y=0;y<a.length;y++){let w=a[(y+u)%a.length],x=!0;w<0&&(x=!1,w=-w);let E=o.node(w-1),k=o.index(w-1);if(E.canReplaceWith(k,k,b.type,b.marks))return t.replace(o.before(w),x?s.after(w):n,new Ce(fy(r.content,0,r.openStart,g),g,r.openEnd))}}let p=t.steps.length;for(let m=a.length-1;m>=0&&(t.replace(e,n,r),!(t.steps.length>p));m--){let g=a[m];g<0||(e=o.before(g),n=s.after(g))}}function fy(t,e,n,r,o){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(fy(s.content,e+1,n,r,s)))}if(e>r){let s=o.contentMatchAt(0),a=s.fillBefore(t).append(t);t=a.append(s.matchFragment(a).fillBefore(de.empty,!0))}return t}function i7(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=e7(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new Ce(de.from(r),0,0))}function s7(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),s=py(r,o);for(let a=0;a<s.length;a++){let l=s[a],u=a==s.length-1;if(u&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(u||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let a=1;a<=r.depth&&a<=o.depth;a++)if(e-r.start(a)==r.depth-a&&n>r.end(a)&&o.end(a)-n!=o.depth-a&&r.start(a-1)==o.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),o.index(a-1)))return t.delete(r.before(a),n);t.delete(e,n)}function py(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let s=t.start(o);if(s<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&n.push(o)}return n}class Ba extends In{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return dn.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return dn.fromReplace(e,this.pos,this.pos+1,new Ce(de.from(o),0,n.isLeaf?0:1))}getMap(){return pr.empty}invert(e){return new Ba(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ba(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ba(n.pos,n.attr,n.value)}}In.jsonID("attr",Ba);class nu extends In{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return dn.ok(r)}getMap(){return pr.empty}invert(e){return new nu(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new nu(n.attr,n.value)}}In.jsonID("docAttr",nu);let Ia=class extends Error{};Ia=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Ia.prototype=Object.create(Error.prototype),Ia.prototype.constructor=Ia,Ia.prototype.name="TransformError";class lm{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Nl}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Ia(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=Ce.empty){let o=Qc(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new Ce(de.from(r),0,0))}delete(e,n){return this.replace(e,n,Ce.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return o7(this,e,n,r),this}replaceRangeWith(e,n,r){return i7(this,e,n,r),this}deleteRange(e,n){return s7(this,e,n),this}lift(e,n){return jT(this,e,n),this}join(e,n=1){return NT(this,e,n),this}wrap(e,n){return GT(this,e,n),this}setBlockType(e,n=e,r,o=null){return XT(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return JT(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Ba(e,n,r)),this}setDocAttribute(e,n){return this.step(new nu(e,n)),this}addNodeMark(e,n){return this.step(new Ii(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Dt)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Oa(e,n)),this}split(e,n=1,r){return ZT(this,e,n,r),this}addMark(e,n,r){return HT(this,e,n,r),this}removeMark(e,n,r){return UT(this,e,n,r),this}clearIncompatible(e,n,r){return om(this,e,n,r),this}}const um=Object.create(null);let Ve=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new hy(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=Ce.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,a=this.ranges;for(let l=0;l<a.length;l++){let{$from:u,$to:c}=a[l],f=e.mapping.slice(s);e.replaceRange(f.map(u.pos),f.map(c.pos),l?Ce.empty:n),l==0&&by(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:a,$to:l}=o[s],u=e.mapping.slice(r),c=u.map(a.pos),f=u.map(l.pos);s?e.deleteRange(c,f):(e.replaceRangeWith(c,f,n),by(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Te(e):Ra(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let a=n<0?Ra(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Ra(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(a)return a}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Rn(e.node(0))}static atStart(e){return Ra(e,e,0,0,1)||new Rn(e)}static atEnd(e){return Ra(e,e,e.content.size,e.childCount,-1)||new Rn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=um[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in um)throw new RangeError("Duplicate use of selection JSON ID "+e);return um[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Te.between(this.$anchor,this.$head).getBookmark()}};Ve.prototype.visible=!0;class hy{constructor(e,n){this.$from=e,this.$to=n}}let my=!1;function gy(t){!my&&!t.parent.inlineContent&&(my=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Te extends Ve{constructor(e,n=e){gy(e),gy(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ve.near(r);let o=e.resolve(n.map(this.anchor));return new Te(o.parent.inlineContent?o:r,r)}replace(e,n=Ce.empty){if(super.replace(e,n),n==Ce.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Te&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Nc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Te(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let s=Ve.findFrom(n,r,!0)||Ve.findFrom(n,-r,!0);if(s)n=s.$head;else return Ve.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Ve.findFrom(e,-r,!0)||Ve.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Te(e,n)}}Ve.jsonID("text",Te);class Nc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Nc(e.map(this.anchor),e.map(this.head))}resolve(e){return Te.between(e.resolve(this.anchor),e.resolve(this.head))}}class Le extends Ve{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),s=e.resolve(o);return r?Ve.near(s):new Le(s)}content(){return new Ce(de.from(this.node),0,0)}eq(e){return e instanceof Le&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new cm(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Le(e.resolve(n.anchor))}static create(e,n){return new Le(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Le.prototype.visible=!1,Ve.jsonID("node",Le);class cm{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Nc(r,r):new cm(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Le.isSelectable(r)?new Le(n):Ve.near(n)}}class Rn extends Ve{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=Ce.empty){if(n==Ce.empty){e.delete(0,e.doc.content.size);let r=Ve.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Rn(e)}map(e){return new Rn(e)}eq(e){return e instanceof Rn}getBookmark(){return a7}}Ve.jsonID("all",Rn);const a7={map(){return this},resolve(t){return new Rn(t)}};function Ra(t,e,n,r,o,s=!1){if(e.inlineContent)return Te.create(t,n);for(let a=r-(o>0?0:1);o>0?a<e.childCount:a>=0;a+=o){let l=e.child(a);if(l.isAtom){if(!s&&Le.isSelectable(l))return Le.create(t,n-(o<0?l.nodeSize:0))}else{let u=Ra(t,l,n+o,o<0?l.childCount:0,o,s);if(u)return u}n+=l.nodeSize*o}return null}function by(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof fn||o instanceof vn))return;let s=t.mapping.maps[r],a;s.forEach((l,u,c,f)=>{a==null&&(a=f)}),t.setSelection(Ve.near(t.doc.resolve(a),n))}const vy=1,yy=2,wy=4;class l7 extends lm{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|vy)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&vy)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=yy,this}ensureMarks(e){return Dt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&yy)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Dt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let a=this.doc.resolve(n);s=r==n?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,s)),this.selection.empty||this.setSelection(Ve.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=wy,this}get scrolledIntoView(){return(this.updated&wy)>0}}function xy(t,e){return!e||!t?t:t.bind(e)}class ru{constructor(e,n,r){this.name=e,this.init=xy(n.init,r),this.apply=xy(n.apply,r)}}const u7=[new ru("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ru("selection",{init(t,e){return t.selection||Ve.atStart(e.doc)},apply(t){return t.selection}}),new ru("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ru("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class dm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=u7.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ru(r.key,r.spec.state,r))})}}class La{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let a=0;a<this.config.plugins.length;a++){let l=this.config.plugins[a];if(l.spec.appendTransaction){let u=o?o[a].n:0,c=o?o[a].state:this,f=u<n.length&&l.spec.appendTransaction.call(l,u?n.slice(u):n,c,r);if(f&&r.filterTransaction(f,a)){if(f.setMeta("appendedTransaction",e),!o){o=[];for(let p=0;p<this.config.plugins.length;p++)o.push(p<a?{state:r,n:n.length}:{state:this,n:0})}n.push(f),r=r.applyInner(f),s=!0}o&&(o[a]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new La(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new l7(this)}static create(e){let n=new dm(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new La(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new dm(this.schema,e.plugins),r=n.fields,o=new La(n);for(let s=0;s<r.length;s++){let a=r[s].name;o[a]=this.hasOwnProperty(a)?this[a]:r[s].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new dm(e.schema,e.plugins),s=new La(o);return o.fields.forEach(a=>{if(a.name=="doc")s.doc=eo.fromJSON(e.schema,n.doc);else if(a.name=="selection")s.selection=Ve.fromJSON(s.doc,n.selection);else if(a.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let u=r[l],c=u.spec.state;if(u.key==a.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){s[a.name]=c.fromJSON.call(u,e,n[l],s);return}}s[a.name]=a.init(e,s)}}),s}}function Cy(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Cy(o,e,{})),n[r]=o}return n}class tt{constructor(e){this.spec=e,this.props={},e.props&&Cy(e.props,this,this.props),this.key=e.key?e.key.key:Ey("plugin")}getState(e){return e[this.key]}}const fm=Object.create(null);function Ey(t){return t in fm?t+"$"+ ++fm[t]:(fm[t]=0,t+"$")}class kt{constructor(e="key"){this.key=Ey(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const _n=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Pa=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let pm=null;const Zo=function(t,e,n){let r=pm||(pm=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},c7=function(){pm=null},Os=function(t,e,n,r){return n&&(ky(t,e,n,r,-1)||ky(t,e,n,r,1))},d7=/^(img|br|input|textarea|hr)$/i;function ky(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Br(t))){let s=t.parentNode;if(!s||s.nodeType!=1||ou(t)||d7.test(t.nodeName)||t.contentEditable=="false")return!1;e=_n(t)+(o<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?Br(t):0}else return!1}}function Br(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function f7(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Br(t)}else if(t.parentNode&&!ou(t))e=_n(t),t=t.parentNode;else return null}}function p7(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ou(t))e=_n(t)+1,t=t.parentNode;else return null}}function h7(t,e,n){for(let r=e==0,o=e==Br(t);r||o;){if(t==n)return!0;let s=_n(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,o=o&&s==Br(t)}}function ou(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ed=function(t){return t.focusNode&&Os(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Ms(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function m7(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function g7(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Br(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Br(r.startContainer),r.startOffset)}}}const Eo=typeof navigator<"u"?navigator:null,Sy=typeof document<"u"?document:null,Li=Eo&&Eo.userAgent||"",hm=/Edge\/(\d+)/.exec(Li),_y=/MSIE \d/.exec(Li),mm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Li),tr=!!(_y||mm||hm),Pi=_y?document.documentMode:mm?+mm[1]:hm?+hm[1]:0,ro=!tr&&/gecko\/(\d+)/i.test(Li);ro&&+(/Firefox\/(\d+)/.exec(Li)||[0,0])[1];const gm=!tr&&/Chrome\/(\d+)/.exec(Li),Ln=!!gm,Ty=gm?+gm[1]:0,qn=!tr&&!!Eo&&/Apple Computer/.test(Eo.vendor),Da=qn&&(/Mobile\/\w+/.test(Li)||!!Eo&&Eo.maxTouchPoints>2),Ir=Da||(Eo?/Mac/.test(Eo.platform):!1),b7=Eo?/Win/.test(Eo.platform):!1,Qo=/Android \d/.test(Li),iu=!!Sy&&"webkitFontSmoothing"in Sy.documentElement.style,v7=iu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function y7(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function No(t,e){return typeof t=="number"?t:t[e]}function w7(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Ay(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let a=n||t.dom;a;){if(a.nodeType!=1){a=Pa(a);continue}let l=a,u=l==s.body,c=u?y7(s):w7(l),f=0,p=0;if(e.top<c.top+No(r,"top")?p=-(c.top-e.top+No(o,"top")):e.bottom>c.bottom-No(r,"bottom")&&(p=e.bottom-e.top>c.bottom-c.top?e.top+No(o,"top")-c.top:e.bottom-c.bottom+No(o,"bottom")),e.left<c.left+No(r,"left")?f=-(c.left-e.left+No(o,"left")):e.right>c.right-No(r,"right")&&(f=e.right-c.right+No(o,"right")),f||p)if(u)s.defaultView.scrollBy(f,p);else{let g=l.scrollLeft,b=l.scrollTop;p&&(l.scrollTop+=p),f&&(l.scrollLeft+=f);let y=l.scrollLeft-g,w=l.scrollTop-b;e={left:e.left-y,top:e.top-w,right:e.right-y,bottom:e.bottom-w}}let m=u?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(m))break;a=m=="absolute"?a.offsetParent:Pa(a)}}function x7(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,a=n+1;a<Math.min(innerHeight,e.bottom);a+=5){let l=t.root.elementFromPoint(s,a);if(!l||l==t.dom||!t.dom.contains(l))continue;let u=l.getBoundingClientRect();if(u.top>=n-20){r=l,o=u.top;break}}return{refDOM:r,refTop:o,stack:Oy(t.dom)}}function Oy(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Pa(r));return e}function C7({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;My(n,r==0?0:r-e)}function My(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:s}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Va=null;function E7(t){if(t.setActive)return t.setActive();if(Va)return t.focus(Va);let e=Oy(t);t.focus(Va==null?{get preventScroll(){return Va={preventScroll:!0},!0}}:void 0),Va||(Va=!1,My(e,0))}function By(t,e){let n,r=2e8,o,s=0,a=e.top,l=e.top,u,c;for(let f=t.firstChild,p=0;f;f=f.nextSibling,p++){let m;if(f.nodeType==1)m=f.getClientRects();else if(f.nodeType==3)m=Zo(f).getClientRects();else continue;for(let g=0;g<m.length;g++){let b=m[g];if(b.top<=a&&b.bottom>=l){a=Math.max(b.bottom,a),l=Math.min(b.top,l);let y=b.left>e.left?b.left-e.left:b.right<e.left?e.left-b.right:0;if(y<r){n=f,r=y,o=y&&n.nodeType==3?{left:b.right<e.left?b.right:b.left,top:e.top}:e,f.nodeType==1&&y&&(s=p+(e.left>=(b.left+b.right)/2?1:0));continue}}else b.top>e.top&&!u&&b.left<=e.left&&b.right>=e.left&&(u=f,c={left:Math.max(b.left,Math.min(b.right,e.left)),top:b.top});!n&&(e.left>=b.right&&e.top>=b.top||e.left>=b.left&&e.top>=b.bottom)&&(s=p+1)}}return!n&&u&&(n=u,o=c,r=0),n&&n.nodeType==3?k7(n,o):!n||r&&n.nodeType==1?{node:t,offset:s}:By(n,o)}function k7(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let s=Di(r,1);if(s.top!=s.bottom&&bm(e,s))return{node:t,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:t,offset:0}}function bm(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function S7(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function _7(t,e,n){let{node:r,offset:o}=By(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return t.docView.posFromDOM(r,o,s)}function T7(t,e,n,r){let o=-1;for(let s=e,a=!1;s!=t.dom;){let l=t.docView.nearestDesc(s,!0),u;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((u=l.dom.getBoundingClientRect()).width||u.height)&&(l.node.isBlock&&l.parent&&(!a&&u.left>r.left||u.top>r.top?o=l.posBefore:(!a&&u.right<r.left||u.bottom<r.top)&&(o=l.posAfter),a=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function Iy(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=o;;){let a=t.childNodes[s];if(a.nodeType==1){let l=a.getClientRects();for(let u=0;u<l.length;u++){let c=l[u];if(bm(e,c))return Iy(a,e,c)}}if((s=(s+1)%r)==o)break}return t}function A7(t,e){let n=t.dom.ownerDocument,r,o=0,s=g7(n,e.left,e.top);s&&({node:r,offset:o}=s);let a=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!a||!t.dom.contains(a.nodeType!=1?a.parentNode:a)){let c=t.dom.getBoundingClientRect();if(!bm(e,c)||(a=Iy(t.dom,e,c),!a))return null}if(qn)for(let c=a;r&&c;c=Pa(c))c.draggable&&(r=void 0);if(a=S7(a,e),r){if(ro&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let f=r.childNodes[o],p;f.nodeName=="IMG"&&(p=f.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&o++}let c;iu&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=T7(t,r,o,e))}l==null&&(l=_7(t,a,e));let u=t.docView.nearestDesc(a,!0);return{pos:l,inside:u?u.posAtStart-u.border:-1}}function Ry(t){return t.top<t.bottom||t.left<t.right}function Di(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ry(r))return r}return Array.prototype.find.call(n,Ry)||t.getBoundingClientRect()}const O7=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Ly(t,e,n){let{node:r,offset:o,atom:s}=t.docView.domFromPos(e,n<0?-1:1),a=iu||ro;if(r.nodeType==3)if(a&&(O7.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let u=Di(Zo(r,o,o),n);if(ro&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=Di(Zo(r,o-1,o-1),-1);if(c.top==u.top){let f=Di(Zo(r,o,o+1),-1);if(f.top!=u.top)return su(f,f.left<c.left)}}return u}else{let u=o,c=o,f=n<0?1:-1;return n<0&&!o?(c++,f=-1):n>=0&&o==r.nodeValue.length?(u--,f=1):n<0?u--:c++,su(Di(Zo(r,u,c),f),f<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(n<0||o==Br(r))){let u=r.childNodes[o-1];if(u.nodeType==1)return vm(u.getBoundingClientRect(),!1)}if(s==null&&o<Br(r)){let u=r.childNodes[o];if(u.nodeType==1)return vm(u.getBoundingClientRect(),!0)}return vm(r.getBoundingClientRect(),n>=0)}if(s==null&&o&&(n<0||o==Br(r))){let u=r.childNodes[o-1],c=u.nodeType==3?Zo(u,Br(u)-(a?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(c)return su(Di(c,1),!1)}if(s==null&&o<Br(r)){let u=r.childNodes[o];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let c=u?u.nodeType==3?Zo(u,0,a?0:1):u.nodeType==1?u:null:null;if(c)return su(Di(c,-1),!0)}return su(Di(r.nodeType==3?Zo(r):r,-n),n>=0)}function su(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function vm(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Py(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function M7(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return Py(t,e,()=>{let{node:s}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let a=Ly(t,o.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let u;if(l.nodeType==1)u=l.getClientRects();else if(l.nodeType==3)u=Zo(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<u.length;c++){let f=u[c];if(f.bottom>f.top+1&&(n=="up"?a.top-f.top>(f.bottom-a.top)*2:f.bottom-a.bottom>(a.bottom-f.top)*2))return!1}}return!0})}const B7=/[\u0590-\u08ac]/;function I7(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,a=o==r.parent.content.size,l=t.domSelection();return l?!B7.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?s:a:Py(t,e,()=>{let{focusNode:u,focusOffset:c,anchorNode:f,anchorOffset:p}=t.domSelectionRange(),m=l.caretBidiLevel;l.modify("move",n,"character");let g=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:b,focusOffset:y}=t.domSelectionRange(),w=b&&!g.contains(b.nodeType==1?b:b.parentNode)||u==b&&c==y;try{l.collapse(f,p),u&&(u!=f||c!=p)&&l.extend&&l.extend(u,c)}catch{}return m!=null&&(l.caretBidiLevel=m),w}):r.pos==r.start()||r.pos==r.end()}let Dy=null,Vy=null,Fy=!1;function R7(t,e,n){return Dy==e&&Vy==n?Fy:(Dy=e,Vy=n,Fy=n=="up"||n=="down"?M7(t,e,n):I7(t,e,n))}const Rr=0,$y=1,Bs=2,ko=3;class au{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Rr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,a;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(a)+a.size:this.posAtStart}else{let s,a;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((a=s.pmViewDesc)&&a.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(a):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>_n(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),a;if(s&&(!n||s.node))if(r&&(a=s.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let a=0;a<o.children.length;a++){let l=o.children[a];if(l.size){o=l;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let a=this.children[r],l=s+a.size;if(l>e||a instanceof Uy){o=e-s;break}s=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof zy&&s.side>=0;r--);if(n<=0){let s,a=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,a=!1);return s&&n&&a&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?_n(s.dom)+1:0}}else{let s,a=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,a=!1);return s&&a&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?_n(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let a=r,l=0;;l++){let u=this.children[l],c=a+u.size;if(o==-1&&e<=c){let f=a+u.border;if(e>=f&&n<=c-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,f);e=a;for(let p=l;p>0;p--){let m=this.children[p-1];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(1)){o=_n(m.dom)+1;break}e-=m.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let f=l+1;f<this.children.length;f++){let p=this.children[f];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){s=_n(p.dom);break}n+=p.size}s==-1&&(s=this.contentDOM.childNodes.length);break}a=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let s=Math.min(e,n),a=Math.max(e,n);for(let g=0,b=0;g<this.children.length;g++){let y=this.children[g],w=b+y.size;if(s>b&&a<w)return y.setSelection(e-b-y.border,n-b-y.border,r,o);b=w}let l=this.domFromPos(e,e?-1:1),u=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),f=r.domSelectionRange(),p=!1;if((ro||qn)&&e==n){let{node:g,offset:b}=l;if(g.nodeType==3){if(p=!!(b&&g.nodeValue[b-1]==`
|
|
6
|
+
`),p&&b==g.nodeValue.length)for(let y=g,w;y;y=y.parentNode){if(w=y.nextSibling){w.nodeName=="BR"&&(l=u={node:w.parentNode,offset:_n(w)+1});break}let x=y.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let y=g.childNodes[b-1];p=y&&(y.nodeName=="BR"||y.contentEditable=="false")}}if(ro&&f.focusNode&&f.focusNode!=u.node&&f.focusNode.nodeType==1){let g=f.focusNode.childNodes[f.focusOffset];g&&g.contentEditable=="false"&&(o=!0)}if(!(o||p&&qn)&&Os(l.node,l.offset,f.anchorNode,f.anchorOffset)&&Os(u.node,u.offset,f.focusNode,f.focusOffset))return;let m=!1;if((c.extend||e==n)&&!p){c.collapse(l.node,l.offset);try{e!=n&&c.extend(u.node,u.offset),m=!0}catch{}}if(!m){if(e>n){let b=l;l=u,u=b}let g=document.createRange();g.setEnd(u.node,u.offset),g.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(g)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],a=r+s.size;if(r==a?e<=a&&n>=r:e<a&&n>r){let l=r+s.border,u=a-s.border;if(e>=l&&n<=u){this.dirty=e==r||n==a?Bs:$y,e==l&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ko:s.markDirty(e-l,n-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Bs:ko}r=a}this.dirty=Bs}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Bs:$y;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class zy extends au{constructor(e,n,r,o){let s,a=n.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(a.nodeType!=1){let l=document.createElement("span");l.appendChild(a),a=l}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Rr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class L7 extends au{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Is extends au{constructor(e,n,r,o,s){super(e,[],r,o),this.mark=n,this.spec=s}static create(e,n,r,o){let s=o.nodeViews[n.type.name],a=s&&s(n,o,r);return(!a||!a.dom)&&(a=to.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Is(e,n,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&ko||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ko&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Rr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Rr}}slice(e,n,r){let o=Is.create(this.parent,this.mark,!0,r),s=this.children,a=this.size;n<a&&(s=wm(s,n,a,r)),e>0&&(s=wm(s,0,e,r));for(let l=0;l<s.length;l++)s[l].parent=o;return o.children=s,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Vi extends au{constructor(e,n,r,o,s,a,l,u,c){super(e,[],s,a),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,s,a){let l=s.nodeViews[n.type.name],u,c=l&&l(n,s,()=>{if(!u)return a;if(u.parent)return u.parent.posBeforeChild(u)},r,o),f=c&&c.dom,p=c&&c.contentDOM;if(n.isText){if(!f)f=document.createTextNode(n.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:p}=to.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!p&&!n.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),n.type.spec.draggable&&(f.draggable=!0));let m=f;return f=qy(f,r,n),c?u=new P7(e,n,r,o,f,p||null,m,c,s,a+1):n.isText?new td(e,n,r,o,f,m,s):new Vi(e,n,r,o,f,p||null,m,s,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>de.empty)}return e}matchesNode(e,n,r){return this.dirty==Rr&&e.eq(this.node)&&nd(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,s=e.composing?this.localCompositionInfo(e,n):null,a=s&&s.pos>-1?s:null,l=s&&s.pos<0,u=new V7(this,a&&a.node,e);z7(this.node,this.innerDeco,(c,f,p)=>{c.spec.marks?u.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!p&&u.syncToMarks(f==this.node.childCount?Dt.none:this.node.child(f).marks,r,e),u.placeWidget(c,e,o)},(c,f,p,m)=>{u.syncToMarks(c.marks,r,e);let g;u.findNodeMatch(c,f,p,m)||l&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(g=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(c,f,p,g,e)||u.updateNextNode(c,f,p,e,m,o)||u.addNode(c,f,p,e,o),o+=c.nodeSize}),u.syncToMarks([],r,e),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==Bs)&&(a&&this.protectLocalComposition(e,a),Wy(this.contentDOM,this.children,e),Da&&H7(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Te)||r<n||o>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=U7(this.node.content,a,r-n,o-n);return l<0?null:{node:s,pos:l,text:a}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let a=new L7(this,s,n,o);e.input.compositionNodes.push(a),this.children=wm(this.children,r,r+o.length,e,a)}update(e,n,r,o){return this.dirty==ko||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Rr}updateOuterDeco(e){if(nd(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=jy(this.dom,this.nodeDOM,ym(this.outerDeco,this.node,n),ym(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Hy(t,e,n,r,o){qy(r,e,t);let s=new Vi(void 0,t,e,n,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class td extends Vi{constructor(e,n,r,o,s,a,l){super(e,n,r,o,s,null,a,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==ko||this.dirty!=Rr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Rr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Rr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),s=document.createTextNode(o.text);return new td(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=ko)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Uy extends au{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Rr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class P7 extends Vi{constructor(e,n,r,o,s,a,l,u,c,f){super(e,n,r,o,s,a,l,c,f),this.spec=u}update(e,n,r,o){if(this.dirty==ko)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Wy(t,e,n){let r=t.firstChild,o=!1;for(let s=0;s<e.length;s++){let a=e[s],l=a.dom;if(l.parentNode==t){for(;l!=r;)r=Ky(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(a instanceof Is){let u=r?r.previousSibling:t.lastChild;Wy(a.contentDOM,a.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=Ky(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const lu=function(t){t&&(this.nodeName=t)};lu.prototype=Object.create(null);const Rs=[new lu];function ym(t,e,n){if(t.length==0)return Rs;let r=n?Rs[0]:new lu,o=[r];for(let s=0;s<t.length;s++){let a=t[s].type.attrs;if(a){a.nodeName&&o.push(r=new lu(a.nodeName));for(let l in a){let u=a[l];u!=null&&(n&&o.length==1&&o.push(r=new lu(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+u:l=="style"?r.style=(r.style?r.style+";":"")+u:l!="nodeName"&&(r[l]=u))}}}return o}function jy(t,e,n,r){if(n==Rs&&r==Rs)return e;let o=e;for(let s=0;s<r.length;s++){let a=r[s],l=n[s];if(s){let u;l&&l.nodeName==a.nodeName&&o!=t&&(u=o.parentNode)&&u.nodeName.toLowerCase()==a.nodeName||(u=document.createElement(a.nodeName),u.pmIsDeco=!0,u.appendChild(o),l=Rs[0]),o=u}D7(o,l||Rs[0],a)}return o}function D7(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&t.classList.add(o[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function qy(t,e,n){return jy(t,t,Rs,ym(e,n,t.nodeType!=1))}function nd(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Ky(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class V7{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=F7(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,s=this.stack.length>>1,a=Math.min(s,e.length);for(;o<a&&(o==s-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<s;)this.destroyRest(),this.top.dirty=Rr,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let u=this.index;u<Math.min(this.index+3,this.top.children.length);u++){let c=this.top.children[u];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=u;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let u=Is.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let s=-1,a;if(o>=this.preMatch.index&&(a=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&a.matchesNode(e,n,r))s=this.top.children.indexOf(a,this.index);else for(let l=this.index,u=Math.min(this.top.children.length,l+5);l<u;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,o,s){let a=this.top.children[o];return a.dirty==ko&&a.dom==a.contentDOM&&(a.dirty=Bs),a.update(e,n,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,s,a){for(let l=this.index;l<this.top.children.length;l++){let u=this.top.children[l];if(u instanceof Vi){let c=this.preMatch.matched.get(u);if(c!=null&&c!=s)return!1;let f=u.dom,p,m=this.isLocked(f)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=ko&&nd(n,u.outerDeco));if(!m&&u.update(e,n,r,o))return this.destroyBetween(this.index,l),u.dom!=f&&(this.changed=!0),this.index++,!0;if(!m&&(p=this.recreateWrapper(u,e,n,r,o,a)))return this.destroyBetween(this.index,l),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=Bs,p.updateChildren(o,a+1),p.dirty=Rr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,s,a){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!nd(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=Vi.create(this.top,n,r,o,s,a);if(l.contentDOM){l.children=e.children,e.children=[];for(let u of l.children)u.parent=l}return e.destroy(),l}addNode(e,n,r,o,s){let a=Vi.create(this.top,e,n,r,o,s);a.contentDOM&&a.updateChildren(o,s+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let s=new zy(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Is;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof td)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((qn||Ln)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Uy(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function F7(t,e){let n=e,r=n.children.length,o=t.childCount,s=new Map,a=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof Is)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=l.node;if(u){if(u!=t.child(o-1))break;--o,s.set(l,o),a.push(l)}}return{index:o,matched:s,matches:a.reverse()}}function $7(t,e){return t.type.side-e.type.side}function z7(t,e,n,r){let o=e.locals(t),s=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let f=t.child(c);r(f,o,e.forChild(s,f),c),s+=f.nodeSize}return}let a=0,l=[],u=null;for(let c=0;;){let f,p;for(;a<o.length&&o[a].to==s;){let w=o[a++];w.widget&&(f?(p||(p=[f])).push(w):f=w)}if(f)if(p){p.sort($7);for(let w=0;w<p.length;w++)n(p[w],c,!!u)}else n(f,c,!!u);let m,g;if(u)g=-1,m=u,u=null;else if(c<t.childCount)g=c,m=t.child(c++);else break;for(let w=0;w<l.length;w++)l[w].to<=s&&l.splice(w--,1);for(;a<o.length&&o[a].from<=s&&o[a].to>s;)l.push(o[a++]);let b=s+m.nodeSize;if(m.isText){let w=b;a<o.length&&o[a].from<w&&(w=o[a].from);for(let x=0;x<l.length;x++)l[x].to<w&&(w=l[x].to);w<b&&(u=m.cut(w-s),m=m.cut(0,w-s),b=w,g=-1)}else for(;a<o.length&&o[a].to<b;)a++;let y=m.isInline&&!m.isLeaf?l.filter(w=>!w.inline):l.slice();r(m,y,e.forChild(s,m),g),s=b}}function H7(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function U7(t,e,n,r){for(let o=0,s=0;o<t.childCount&&s<=r;){let a=t.child(o++),l=s;if(s+=a.nodeSize,!a.isText)continue;let u=a.text;for(;o<t.childCount;){let c=t.child(o++);if(s+=c.nodeSize,!c.isText)break;u+=c.text}if(s>=n){if(s>=r&&u.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?u.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&u.length>=r+e.length-l&&u.slice(r-l,r-l+e.length)==e)return r}}return-1}function wm(t,e,n,r,o){let s=[];for(let a=0,l=0;a<t.length;a++){let u=t[a],c=l,f=l+=u.size;c>=n||f<=e?s.push(u):(c<e&&s.push(u.slice(0,e-c,r)),o&&(s.push(o),o=void 0),f>n&&s.push(u.slice(n-c,u.size,r)))}return s}function xm(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),s=o&&o.size==0,a=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;let l=r.resolve(a),u,c;if(ed(n)){for(u=a;o&&!o.node;)o=o.parent;let p=o.node;if(o&&p.isAtom&&Le.isSelectable(p)&&o.parent&&!(p.isInline&&h7(n.focusNode,n.focusOffset,o.dom))){let m=o.posBefore;c=new Le(a==m?l:r.resolve(m))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let p=a,m=a;for(let g=0;g<n.rangeCount;g++){let b=n.getRangeAt(g);p=Math.min(p,t.docView.posFromDOM(b.startContainer,b.startOffset,1)),m=Math.max(m,t.docView.posFromDOM(b.endContainer,b.endOffset,-1))}if(p<0)return null;[u,a]=m==t.state.selection.anchor?[m,p]:[p,m],l=r.resolve(a)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let f=r.resolve(u);if(!c){let p=e=="pointer"||t.state.selection.head<l.pos&&!s?1:-1;c=Em(t,f,l,p)}return c}function Gy(t){return t.editable?t.hasFocus():e3(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ei(t,e=!1){let n=t.state.selection;if(Zy(t,n),!!Gy(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Ln){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&Os(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)j7(t);else{let{anchor:r,head:o}=n,s,a;Xy&&!(n instanceof Te)&&(n.$from.parent.inlineContent||(s=Yy(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=Yy(t,n.to))),t.docView.setSelection(r,o,t,e),Xy&&(s&&Jy(s),a&&Jy(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&W7(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Xy=qn||Ln&&Ty<63;function Yy(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(qn&&o&&o.contentEditable=="false")return Cm(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return Cm(o);if(s)return Cm(s)}}function Cm(t){return t.contentEditable="true",qn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Jy(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function W7(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Gy(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function j7(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,_n(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&tr&&Pi<=11&&(r.disabled=!0,r.disabled=!1)}function Zy(t,e){if(e instanceof Le){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Qy(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Qy(t)}function Qy(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Em(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Te.between(e,n,r)}function Ny(t){return t.editable&&!t.hasFocus()?!1:e3(t)}function e3(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function q7(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Os(e.node,e.offset,n.anchorNode,n.anchorOffset)}function km(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),s=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return s&&Ve.findFrom(s,e)}function Fi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function t3(t,e,n){let r=t.state.selection;if(r instanceof Te)if(n.indexOf("s")>-1){let{$head:o}=r,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let a=t.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return Fi(t,new Te(r.$anchor,a))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=km(t.state,e);return o&&o instanceof Le?Fi(t,o):!1}else if(!(Ir&&n.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,a;if(!s||s.isText)return!1;let l=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(a=t.docView.descAt(l))&&!a.contentDOM?Le.isSelectable(s)?Fi(t,new Le(e<0?t.state.doc.resolve(o.pos-s.nodeSize):o)):iu?Fi(t,new Te(t.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Le&&r.node.isInline)return Fi(t,new Te(e>0?r.$to:r.$from));{let o=km(t.state,e);return o?Fi(t,o):!1}}}function rd(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function uu(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Fa(t,e){return e<0?K7(t):G7(t)}function K7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,s,a=!1;for(ro&&n.nodeType==1&&r<rd(n)&&uu(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(n.nodeType!=1)break;{let l=n.childNodes[r-1];if(uu(l,-1))o=n,s=--r;else if(l.nodeType==3)n=l,r=n.nodeValue.length;else break}}else{if(n3(n))break;{let l=n.previousSibling;for(;l&&uu(l,-1);)o=n.parentNode,s=_n(l),l=l.previousSibling;if(l)n=l,r=rd(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?Sm(t,n,r):o&&Sm(t,o,s)}function G7(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=rd(n),s,a;for(;;)if(r<o){if(n.nodeType!=1)break;let l=n.childNodes[r];if(uu(l,1))s=n,a=++r;else break}else{if(n3(n))break;{let l=n.nextSibling;for(;l&&uu(l,1);)s=l.parentNode,a=_n(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=rd(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}s&&Sm(t,s,a)}function n3(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function X7(t,e){for(;t&&e==t.childNodes.length&&!ou(t);)e=_n(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Y7(t,e){for(;t&&!e&&!ou(t);)e=_n(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function Sm(t,e,n){if(e.nodeType!=3){let s,a;(a=X7(e,n))?(e=a,n=0):(s=Y7(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(ed(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&ei(t)},50)}function r3(t,e){let n=t.state.doc.resolve(e);if(!(Ln||b7)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),a=(s.top+s.bottom)/2;if(a>o.top&&a<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),a=(s.top+s.bottom)/2;if(a>o.top&&a<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function o3(t,e,n){let r=t.state.selection;if(r instanceof Te&&!r.empty||n.indexOf("s")>-1||Ir&&n.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let a=km(t.state,e);if(a&&a instanceof Le)return Fi(t,a)}if(!o.parent.inlineContent){let a=e<0?o:s,l=r instanceof Rn?Ve.near(a,e):Ve.findFrom(a,e);return l?Fi(t,l):!1}return!1}function i3(t,e){if(!(t.state.selection instanceof Te))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let a=t.state.tr;return e<0?a.delete(n.pos-s.nodeSize,n.pos):a.delete(n.pos,n.pos+s.nodeSize),t.dispatch(a),!0}return!1}function s3(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function J7(t){if(!qn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;s3(t,r,"true"),setTimeout(()=>s3(t,r,"false"),20)}return!1}function Z7(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Q7(t,e){let n=e.keyCode,r=Z7(e);if(n==8||Ir&&n==72&&r=="c")return i3(t,-1)||Fa(t,-1);if(n==46&&!e.shiftKey||Ir&&n==68&&r=="c")return i3(t,1)||Fa(t,1);if(n==13||n==27)return!0;if(n==37||Ir&&n==66&&r=="c"){let o=n==37?r3(t,t.state.selection.from)=="ltr"?-1:1:-1;return t3(t,o,r)||Fa(t,o)}else if(n==39||Ir&&n==70&&r=="c"){let o=n==39?r3(t,t.state.selection.from)=="ltr"?1:-1:1;return t3(t,o,r)||Fa(t,o)}else{if(n==38||Ir&&n==80&&r=="c")return o3(t,-1,r)||Fa(t,-1);if(n==40||Ir&&n==78&&r=="c")return J7(t)||o3(t,1,r)||Fa(t,1);if(r==(Ir?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function _m(t,e){t.someProp("transformCopied",g=>{e=g(e,t)});let n=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let g=r.firstChild;n.push(g.type.name,g.attrs!=g.type.defaultAttrs?g.attrs:null),r=g.content}let a=t.someProp("clipboardSerializer")||to.fromSchema(t.state.schema),l=h3(),u=l.createElement("div");u.appendChild(a.serializeFragment(r,{document:l}));let c=u.firstChild,f,p=0;for(;c&&c.nodeType==1&&(f=f3[c.nodeName.toLowerCase()]);){for(let g=f.length-1;g>=0;g--){let b=l.createElement(f[g]);for(;u.firstChild;)b.appendChild(u.firstChild);u.appendChild(b),p++}c=u.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${s}${p?` -${p}`:""} ${JSON.stringify(n)}`);let m=t.someProp("clipboardTextSerializer",g=>g(e,t))||e.content.textBetween(0,e.content.size,`
|
|
7
7
|
|
|
8
8
|
`);return{dom:u,text:m,slice:e}}function a3(t,e,n,r,o){let s=o.parent.type.spec.code,a,l;if(!n&&!e)return null;let u=e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",m=>{e=m(e,s||r,t)}),s)return e?new Ce(de.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
9
|
-
`))),0,0):Ce.empty;let p=t.someProp("clipboardTextParser",m=>m(e,o,r,t));if(p)l=p;else{let m=o.marks(),{schema:g}=t.state,b=to.fromSchema(g);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let w=a.appendChild(document.createElement("p"));y&&w.appendChild(b.serializeNode(g.text(y,m)))})}}else t.someProp("transformPastedHTML",p=>{n=p(n,t)}),a=nA(n),iu&&rA(a);let c=a&&a.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let p=+f[3];p>0;p--){let m=a.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;a=m}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Zl.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(u||f),context:o,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!N7.test(m.parentNode.nodeName)?{ignore:!0}:null}})),f)l=oA(d3(l,+f[1],+f[2]),f[4]);else if(l=Ce.maxOpen(eA(l.content,o),!0),l.openStart||l.openEnd){let p=0,m=0;for(let g=l.content.firstChild;p<l.openStart&&!g.type.spec.isolating;p++,g=g.firstChild);for(let g=l.content.lastChild;m<l.openEnd&&!g.type.spec.isolating;m++,g=g.lastChild);l=d3(l,p,m)}return t.someProp("transformPasted",p=>{l=p(l,t)}),l}const N7=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function eA(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),s,a=[];if(t.forEach(l=>{if(!a)return;let u=o.findWrapping(l.type),c;if(!u)return a=null;if(c=a.length&&s.length&&u3(u,s,l,a[a.length-1],0))a[a.length-1]=c;else{a.length&&(a[a.length-1]=c3(a[a.length-1],s.length));let f=l3(l,u);a.push(f),o=o.matchType(f.type),s=u}}),a)return de.from(a)}return t}function l3(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,de.from(t));return t}function u3(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=u3(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(de.from(l3(n,t,o+1))))}}function c3(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,c3(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(de.empty,!0);return t.copy(n.append(r))}function Tm(t,e,n,r,o,s){let a=e<0?t.firstChild:t.lastChild,l=a.content;return t.childCount>1&&(s=0),o<r-1&&(l=Tm(l,e,n,r,o+1,s)),o>=n&&(l=e<0?a.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(de.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(l))}function d3(t,e,n){return e<t.openStart&&(t=new Ce(Tm(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Ce(Tm(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const f3={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let p3=null;function h3(){return p3||(p3=document.implementation.createHTMLDocument("title"))}let Am=null;function tA(t){let e=window.trustedTypes;return e?(Am||(Am=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Am.createHTML(t)):t}function nA(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=h3().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&f3[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=tA(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function rA(t){let e=t.querySelectorAll(Ln?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function oA(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:s,openEnd:a}=t;for(let l=r.length-2;l>=0;l-=2){let u=n.nodes[r[l]];if(!u||u.hasRequiredAttrs())break;o=de.from(u.create(r[l+1],o)),s++,a++}return new Ce(o,s,a)}const Kn={},Gn={},iA={touchstart:!0,touchmove:!0};class sA{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function aA(t){for(let e in Kn){let n=Kn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{uA(t,r)&&!Mm(t,r)&&(t.editable||!(r.type in Gn))&&n(t,r)},iA[e]?{passive:!0}:void 0)}qn&&t.dom.addEventListener("input",()=>null),Om(t)}function $i(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function lA(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Om(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Mm(t,r))})}function Mm(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function uA(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function cA(t,e){!Mm(t,e)&&Kn[e.type]&&(t.editable||!(e.type in Gn))&&Kn[e.type](t,e)}Gn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!g3(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Qo&&Ln&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Da&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,Ms(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Q7(t,n)?n.preventDefault():$i(t,"key")},Gn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Gn.keypress=(t,e)=>{let n=e;if(g3(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ir&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Te)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function od(t){return{left:t.clientX,top:t.clientY}}function dA(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Bm(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(t.someProp(e,l=>a>s.depth?l(t,n,s.nodeAfter,s.before(a),o,!0):l(t,n,s.node(a),s.before(a),o,!1)))return!0;return!1}function $a(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function fA(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Le.isSelectable(r)?($a(t,new Le(n)),!0):!1}function pA(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Le&&(r=n.node);let s=t.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let l=a>s.depth?s.nodeAfter:s.node(a);if(Le.isSelectable(l)){r&&n.$from.depth>0&&a>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(a);break}}return o!=null?($a(t,Le.create(t.state.doc,o)),!0):!1}function hA(t,e,n,r,o){return Bm(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?pA(t,n):fA(t,n))}function mA(t,e,n,r){return Bm(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function gA(t,e,n,r){return Bm(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||bA(t,n,r)}function bA(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?($a(t,Te.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s),l=o.before(s);if(a.inlineContent)$a(t,Te.create(r,l+1,l+1+a.content.size));else if(Le.isSelectable(a))$a(t,Le.create(r,l));else continue;return!0}}function Im(t){return id(t)}const m3=Ir?"metaKey":"ctrlKey";Kn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Im(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&dA(n,t.input.lastClick)&&!n[m3]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s};let a=t.posAtCoords(od(n));a&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new vA(t,a,n,!!r)):(s=="doubleClick"?mA:gA)(t,a.pos,a.inside,n)?n.preventDefault():$i(t,"pointer"))};class vA{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[m3],this.allowDefault=r.shiftKey;let s,a;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),a=n.inside;else{let f=e.state.doc.resolve(n.pos);s=f.parent,a=f.depth?f.before():0}const l=o?null:r.target,u=l?e.docView.nearestDesc(l,!0):null;this.target=u&&u.dom.nodeType==1?u.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof Le&&c.from<=a&&c.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ro&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),$i(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ei(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(od(e))),this.updateAllowDefault(e),this.allowDefault||!n?$i(this.view,"pointer"):hA(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||qn&&this.mightDrag&&!this.mightDrag.node.isAtom||Ln&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?($a(this.view,De.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):$i(this.view,"pointer")}move(e){this.updateAllowDefault(e),$i(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Kn.touchstart=t=>{t.input.lastTouch=Date.now(),Im(t),$i(t,"pointer")},Kn.touchmove=t=>{t.input.lastTouch=Date.now(),$i(t,"pointer")},Kn.contextmenu=t=>Im(t);function g3(t,e){return t.composing?!0:qn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const yA=Qo?5e3:-1;Gn.compositionstart=Gn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Te&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),id(t,!0),t.markCursor=null;else if(id(t,!e.selection.empty),ro&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let a=s<0?o.lastChild:o.childNodes[s-1];if(!a)break;if(a.nodeType==3){let l=t.domSelection();l&&l.collapse(a,a.nodeValue.length);break}else o=a,s=-1}}t.input.composing=!0}b3(t,yA)},Gn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,b3(t,20))};function b3(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>id(t),e))}function v3(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=xA());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function wA(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=f7(e.focusNode,e.focusOffset),r=p7(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let a=n.pmViewDesc;if(!(!a||!a.isText(n.nodeValue)))return r}}return n||r}function xA(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function id(t,e=!1){if(!(Qo&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),v3(t),e||t.docView&&t.docView.dirty){let n=xm(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function CA(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const cu=tr&&Pi<15||Da&&v7<604;Kn.copy=Gn.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=cu?null:n.clipboardData,a=r.content(),{dom:l,text:u}=_m(t,a);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",u)):CA(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function EA(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function kA(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?du(t,r.value,null,o,e):du(t,r.textContent,r.innerHTML,o,e)},50)}function du(t,e,n,r,o){let s=a3(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,o,s||Ce.empty)))return!0;if(!s)return!1;let a=EA(s),l=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function y3(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Gn.paste=(t,e)=>{let n=e;if(t.composing&&!Qo)return;let r=cu?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&du(t,y3(r),r.getData("text/html"),o,n)?n.preventDefault():kA(t,n)};class w3{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const x3=Ir?"altKey":"ctrlKey";Kn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(od(n)),a;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof Le?o.to-1:o.to))){if(r&&r.mightDrag)a=Le.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let p=t.docView.nearestDesc(n.target,!0);p&&p.node.type.spec.draggable&&p!=t.docView&&(a=Le.create(t.state.doc,p.posBefore))}}let l=(a||t.state.selection).content(),{dom:u,text:c,slice:f}=_m(t,l);(!n.dataTransfer.files.length||!Ln||Ty>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(cu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",cu||n.dataTransfer.setData("text/plain",c),t.dragging=new w3(f,!n[x3],a)},Kn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Gn.dragover=Gn.dragenter=(t,e)=>e.preventDefault(),Gn.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(od(n));if(!o)return;let s=t.state.doc.resolve(o.pos),a=r&&r.slice;a?t.someProp("transformPasted",b=>{a=b(a,t)}):a=a3(t,y3(n.dataTransfer),cu?null:n.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&!n[x3]);if(t.someProp("handleDrop",b=>b(t,n,a||Ce.empty,l))){n.preventDefault();return}if(!a)return;n.preventDefault();let u=a?uy(t.state.doc,s.pos,a):s.pos;u==null&&(u=s.pos);let c=t.state.tr;if(l){let{node:b}=r;b?b.replace(c):c.deleteSelection()}let f=c.mapping.map(u),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,m=c.doc;if(p?c.replaceRangeWith(f,f,a.content.firstChild):c.replaceRange(f,f,a),c.doc.eq(m))return;let g=c.doc.resolve(f);if(p&&Le.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new Le(g));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((y,w,x,E)=>b=E),c.setSelection(Em(t,g,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Kn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ei(t)},20))},Kn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Kn.beforeinput=(t,e)=>{if(Ln&&Qo&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Ms(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Gn)Kn[t]=Gn[t];function fu(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class sd{constructor(e,n){this.toDOM=e,this.spec=n||Ls,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:a}=e.mapResult(n.from+o,this.side<0?-1:1);return a?null:new jt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sd&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&fu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class zi{constructor(e,n){this.attrs=e,this.spec=n||Ls}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,a=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new jt(s,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof zi&&fu(this.attrs,e.attrs)&&fu(this.spec,e.spec)}static is(e){return e.type instanceof zi}destroy(){}}class Rm{constructor(e,n){this.attrs=e,this.spec=n||Ls}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let a=e.mapResult(n.to+o,-1);return a.deleted||a.pos<=s.pos?null:new jt(s.pos-r,a.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof Rm&&fu(this.attrs,e.attrs)&&fu(this.spec,e.spec)}destroy(){}}class jt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new jt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new jt(e,e,new sd(n,r))}static inline(e,n,r,o){return new jt(e,n,new zi(r,o))}static node(e,n,r,o){return new jt(e,n,new Rm(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof zi}get widget(){return this.type instanceof sd}}const za=[],Ls={};class ft{constructor(e,n){this.local=e.length?e:za,this.children=n.length?n:za}static create(e,n){return n.length?ad(n,e,0,Ls):Pn}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let a=0;a<this.local.length;a++){let l=this.local[a];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let l=this.children[a]+1;this.children[a+2].findInner(e-l,n-l,r,o+l,s)}}map(e,n,r){return this==Pn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ls)}mapInner(e,n,r,o,s){let a;for(let l=0;l<this.local.length;l++){let u=this.local[l].map(e,r,o);u&&u.type.valid(n,u)?(a||(a=[])).push(u):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?SA(this.children,a||[],e,n,r,o,s):a?new ft(a.sort(Ps),za):Pn}add(e,n){return n.length?this==Pn?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((l,u)=>{let c=u+r,f;if(f=E3(n,l,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<u;)s+=3;o[s]==u?o[s+2]=o[s+2].addInner(l,f,c+1):o.splice(s,0,u,u+l.nodeSize,ad(f,l,c+1,Ls)),s+=3}});let a=C3(s?k3(n):n,-r);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||a.splice(l--,1);return new ft(a.length?this.local.concat(a).sort(Ps):this.local,o||this.children)}remove(e){return e.length==0||this==Pn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let a,l=r[s]+n,u=r[s+1]+n;for(let f=0,p;f<e.length;f++)(p=e[f])&&p.from>l&&p.to<u&&(e[f]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(a,l+1);c!=Pn?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,a;s<e.length;s++)if(a=e[s])for(let l=0;l<o.length;l++)o[l].eq(a,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ft(o,r):Pn}forChild(e,n){if(this==Pn)return this;if(n.isLeaf)return ft.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,a=s+n.content.size;for(let l=0;l<this.local.length;l++){let u=this.local[l];if(u.from<a&&u.to>s&&u.type instanceof zi){let c=Math.max(s,u.from)-s,f=Math.min(a,u.to)-s;c<f&&(o||(o=[])).push(u.copy(c,f))}}if(o){let l=new ft(o.sort(Ps),za);return r?new Hi([l,r]):l}return r||Pn}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Lm(this.localsInner(e))}localsInner(e){if(this==Pn)return za;if(e.inlineContent||!this.local.some(zi.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof zi||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]),ft.removeOverlap=Lm;const Pn=ft.empty;class Hi{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Ls));return Hi.from(r)}forChild(e,n){if(n.isLeaf)return ft.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Pn&&(s instanceof Hi?r=r.concat(s.members):r.push(s))}return Hi.from(r)}eq(e){if(!(e instanceof Hi)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let a=0;a<s.length;a++)n.push(s[a])}}return n?Lm(r?n:n.sort(Ps)):za}static from(e){switch(e.length){case 0:return Pn;case 1:return e[0];default:return new Hi(e.every(n=>n instanceof ft)?e:e.reduce((n,r)=>n.concat(r instanceof ft?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function SA(t,e,n,r,o,s,a){let l=t.slice();for(let c=0,f=s;c<n.maps.length;c++){let p=0;n.maps[c].forEach((m,g,b,y)=>{let w=y-b-(g-m);for(let x=0;x<l.length;x+=3){let E=l[x+1];if(E<0||m>E+f-p)continue;let k=l[x]+f-p;g>=k?l[x+1]=m<=k?-2:-1:m>=f&&w&&(l[x]+=w,l[x+1]+=w)}p+=w}),f=n.maps[c].map(f,-1)}let u=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){u=!0,l[c+1]=-1;continue}let f=n.map(t[c]+s),p=f-o;if(p<0||p>=r.content.size){u=!0;continue}let m=n.map(t[c+1]+s,-1),g=m-o,{index:b,offset:y}=r.content.findIndex(p),w=r.maybeChild(b);if(w&&y==p&&y+w.nodeSize==g){let x=l[c+2].mapInner(n,w,f+1,t[c]+s+1,a);x!=Pn?(l[c]=p,l[c+1]=g,l[c+2]=x):(l[c+1]=-2,u=!0)}else u=!0}if(u){let c=_A(l,t,e,n,o,s,a),f=ad(c,r,0,a);e=f.local;for(let p=0;p<l.length;p+=3)l[p+1]<0&&(l.splice(p,3),p-=3);for(let p=0,m=0;p<f.children.length;p+=3){let g=f.children[p];for(;m<l.length&&l[m]<g;)m+=3;l.splice(m,0,f.children[p],f.children[p+1],f.children[p+2])}}return new ft(e.sort(Ps),l)}function C3(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new jt(o.from+e,o.to+e,o.type))}return n}function _A(t,e,n,r,o,s,a){function l(u,c){for(let f=0;f<u.local.length;f++){let p=u.local[f].map(r,o,c);p?n.push(p):a.onRemove&&a.onRemove(u.local[f].spec)}for(let f=0;f<u.children.length;f+=3)l(u.children[f+2],u.children[f]+c+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&l(t[u+2],e[u]+s+1);return n}function E3(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,a;s<t.length;s++)(a=t[s])&&a.from>n&&a.to<r&&((o||(o=[])).push(a),t[s]=null);return o}function k3(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ad(t,e,n,r){let o=[],s=!1;e.forEach((l,u)=>{let c=E3(t,l,u+n);if(c){s=!0;let f=ad(c,l,n+u+1,r);f!=Pn&&o.push(u,u+l.nodeSize,f)}});let a=C3(s?k3(t):t,-n).sort(Ps);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||(r.onRemove&&r.onRemove(a[l].spec),a.splice(l--,1));return a.length||o.length?new ft(a,o):Pn}function Ps(t,e){return t.from-e.from||t.to-e.to}function Lm(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),S3(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),S3(e,o,r.copy(s.from,r.to)));break}}}return e}function S3(t,e,n){for(;e<t.length&&Ps(n,t[e])>0;)e++;t.splice(e,0,n)}function Pm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Pn&&e.push(r)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),Hi.from(e)}const TA={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AA=tr&&Pi<=11;class OA{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class MA{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new OA,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);tr&&Pi<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),AA&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,TA)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ny(this.view)){if(this.suppressingSelectionUpdates)return ei(this.view);if(tr&&Pi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Os(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Pa(s))n.add(s);for(let s=e.anchorNode;s;s=Pa(s))if(n.has(s)){r=s;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ny(e)&&!this.ignoreSelectionChange(r),s=-1,a=-1,l=!1,u=[];if(e.editable)for(let f=0;f<n.length;f++){let p=this.registerMutation(n[f],u);p&&(s=s<0?p.from:Math.min(p.from,s),a=a<0?p.to:Math.max(p.to,a),p.typeOver&&(l=!0))}if(ro&&u.length){let f=u.filter(p=>p.nodeName=="BR");if(f.length==2){let[p,m]=f;p.parentNode&&p.parentNode.parentNode==m.parentNode?m.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let m of f){let g=m.parentNode;g&&g.nodeName=="LI"&&(!p||RA(e,p)!=g)&&m.remove()}}}let c=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ed(r)&&(c=xm(e))&&c.eq(De.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ei(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,a),BA(e)),this.handleDOMChange(s,a,l,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ei(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;f<e.addedNodes.length;f++){let p=e.addedNodes[f];n.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(tr&&Pi<=11&&e.addedNodes.length)for(let f=0;f<e.addedNodes.length;f++){let{previousSibling:p,nextSibling:m}=e.addedNodes[f];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(o=p),(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(s=m)}let a=o&&o.parentNode==e.target?_n(o)+1:0,l=r.localPosFromDOM(e.target,a,-1),u=s&&s.parentNode==e.target?_n(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,u,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let _3=new WeakMap,T3=!1;function BA(t){if(!_3.has(t)&&(_3.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ro,T3)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),T3=!0}}function A3(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return Os(a.node,a.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function IA(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return A3(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?A3(t,n):null}function RA(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function LA(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:a,to:l}=t.docView.parseRange(e,n),u=t.domSelectionRange(),c,f=u.anchorNode;if(f&&t.dom.contains(f.nodeType==1?f:f.parentNode)&&(c=[{node:f,offset:u.anchorOffset}],ed(u)||c.push({node:u.focusNode,offset:u.focusOffset})),Ln&&t.input.lastKeyCode===8)for(let w=s;w>o;w--){let x=r.childNodes[w-1],E=x.pmViewDesc;if(x.nodeName=="BR"&&!E){s=w;break}if(!E||E.size)break}let p=t.state.doc,m=t.someProp("domParser")||Zl.fromSchema(t.state.schema),g=p.resolve(a),b=null,y=m.parse(r,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:o,to:s,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:PA,context:g});if(c&&c[0].pos!=null){let w=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=w),b={anchor:w+a,head:x+a}}return{doc:y,sel:b,from:a,to:l}}function PA(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(qn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||qn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const DA=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function VA(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=xm(t,I);if(M&&!t.state.selection.eq(M)){if(Ln&&Qo&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",U=>U(t,Ms(13,"Enter"))))return;let j=t.state.tr.setSelection(M);I=="pointer"?j.setMeta("pointer",!0):I=="key"&&j.scrollIntoView(),s&&j.setMeta("composition",s),t.dispatch(j)}return}let a=t.state.doc.resolve(e),l=a.sharedDepth(n);e=a.before(l+1),n=t.state.doc.resolve(n).after(l+1);let u=t.state.selection,c=LA(t,e,n),f=t.state.doc,p=f.slice(c.from,c.to),m,g;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,g="end"):(m=t.state.selection.from,g="start"),t.input.lastKeyCode=null;let b=zA(p.content,c.doc.content,c.from,m,g);if(b&&t.input.domChangeCount++,(Da&&t.input.lastIOSEnter>Date.now()-225||Qo)&&o.some(I=>I.nodeType==1&&!DA.test(I.nodeName))&&(!b||b.endA>=b.endB)&&t.someProp("handleKeyDown",I=>I(t,Ms(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!b)if(r&&u instanceof Te&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))b={start:u.from,endA:u.to,endB:u.to};else{if(c.sel){let I=O3(t,t.state.doc,c.sel);if(I&&!I.eq(t.state.selection)){let M=t.state.tr.setSelection(I);s&&M.setMeta("composition",s),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof Te&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),tr&&Pi<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>c.from&&c.doc.textBetween(b.start-c.from-1,b.start-c.from+1)==" "&&(b.start--,b.endA--,b.endB--);let y=c.doc.resolveNoCache(b.start-c.from),w=c.doc.resolveNoCache(b.endB-c.from),x=f.resolve(b.start),E=y.sameParent(w)&&y.parent.inlineContent&&x.end()>=b.endA,k;if((Da&&t.input.lastIOSEnter>Date.now()-225&&(!E||o.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!E&&y.pos<c.doc.content.size&&!y.sameParent(w)&&(k=De.findFrom(c.doc.resolve(y.pos+1),1,!0))&&k.head==w.pos)&&t.someProp("handleKeyDown",I=>I(t,Ms(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>b.start&&$A(f,b.start,b.endA,y,w)&&t.someProp("handleKeyDown",I=>I(t,Ms(8,"Backspace")))){Qo&&Ln&&t.domObserver.suppressSelectionUpdates();return}Ln&&b.endB==b.start&&(t.input.lastChromeDelete=Date.now()),Qo&&!E&&y.start()!=w.start()&&w.parentOffset==0&&y.depth==w.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==b.endA&&(b.endB-=2,w=c.doc.resolveNoCache(b.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,Ms(13,"Enter"))})},20));let C=b.start,_=b.endA,A,T,P;if(E){if(y.pos==w.pos)tr&&Pi<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ei(t),20)),A=t.state.tr.delete(C,_),T=f.resolve(b.start).marksAcross(f.resolve(b.endA));else if(b.endA==b.endB&&(P=FA(y.parent.content.cut(y.parentOffset,w.parentOffset),x.parent.content.cut(x.parentOffset,b.endA-x.start()))))A=t.state.tr,P.type=="add"?A.addMark(C,_,P.mark):A.removeMark(C,_,P.mark);else if(y.parent.child(y.index()).isText&&y.index()==w.index()-(w.textOffset?0:1)){let I=y.parent.textBetween(y.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",M=>M(t,C,_,I)))return;A=t.state.tr.insertText(I,C,_)}}if(A||(A=t.state.tr.replace(C,_,c.doc.slice(b.start-c.from,b.endB-c.from))),c.sel){let I=O3(t,A.doc,c.sel);I&&!(Ln&&t.composing&&I.empty&&(b.start!=b.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==C||I.head==A.mapping.map(_)-1)||tr&&I.empty&&I.head==C)&&A.setSelection(I)}T&&A.ensureMarks(T),s&&A.setMeta("composition",s),t.dispatch(A.scrollIntoView())}function O3(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Em(t,e.resolve(n.anchor),e.resolve(n.head))}function FA(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,a,l,u;for(let f=0;f<r.length;f++)o=r[f].removeFromSet(o);for(let f=0;f<n.length;f++)s=n[f].removeFromSet(s);if(o.length==1&&s.length==0)l=o[0],a="add",u=f=>f.mark(l.addToSet(f.marks));else if(o.length==0&&s.length==1)l=s[0],a="remove",u=f=>f.mark(l.removeFromSet(f.marks));else return null;let c=[];for(let f=0;f<e.childCount;f++)c.push(u(e.child(f)));if(de.from(c).eq(t))return{mark:l,type:a}}function $A(t,e,n,r,o){if(n-e<=o.pos-r.pos||Dm(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let a=t.resolve(Dm(s,!0,!0));return!a.parent.isTextblock||a.pos>n||Dm(a,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function Dm(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function zA(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let u=Math.max(0,s-Math.min(a,l));r-=a+u-s}if(a<s&&t.size<e.size){let u=r<=s&&r>=a?s-r:0;s-=u,s&&s<e.size&&M3(e.textBetween(s-1,s+1))&&(s+=u?1:-1),l=s+(l-a),a=s}else if(l<s){let u=r<=s&&r>=l?s-r:0;s-=u,s&&s<t.size&&M3(t.textBetween(s-1,s+1))&&(s+=u?1:-1),a=s+(a-l),l=s}return{start:s,endA:a,endB:l}}function M3(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class HA{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new sA,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(P3),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=R3(this),I3(this),this.nodeViews=L3(this),this.docView=Hy(this.state.doc,B3(this),Pm(this),this.dom,this),this.domObserver=new MA(this,(r,o,s,a)=>VA(this,r,o,s,a)),this.domObserver.start(),aA(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Om(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(P3),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(v3(this),a=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let g=L3(this);WA(g,this.nodeViews)&&(this.nodeViews=g,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Om(this),this.editable=R3(this),I3(this);let u=Pm(this),c=B3(this),f=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",p=s||!this.docView.matchesNode(e.doc,c,u);(p||!e.selection.eq(o.selection))&&(a=!0);let m=f=="preserve"&&a&&this.dom.style.overflowAnchor==null&&x7(this);if(a){this.domObserver.stop();let g=p&&(tr||Ln)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&UA(o.selection,e.selection);if(p){let b=Ln?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=wA(this)),(s||!this.docView.update(e.doc,c,u,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Hy(e.doc,c,u,this.dom,this)),b&&!this.trackWrites&&(g=!0)}g||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&q7(this))?ei(this,g):(Zy(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():m&&C7(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Le){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Ay(this,n.getBoundingClientRect(),e)}else Ay(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new w3(e.slice,e.move,o<0?void 0:Le.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let a=0;a<this.directPlugins.length;a++){let l=this.directPlugins[a].props[e];if(l!=null&&(o=n?n(l):l))return o}let s=this.state.plugins;if(s)for(let a=0;a<s.length;a++){let l=s[a].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(tr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&E7(this.dom),ei(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return A7(this,e)}coordsAtPos(e,n=1){return Ly(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return R7(this,n||this.state,e)}pasteHTML(e,n){return du(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return du(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return _m(this,e)}destroy(){this.docView&&(lA(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Pm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,c7())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cA(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?qn&&this.root.nodeType===11&&m7(this.dom.ownerDocument)==this.dom&&IA(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function B3(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[jt.node(0,t.state.doc.content.size,e)]}function I3(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:jt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function R3(t){return!t.someProp("editable",e=>e(t.state)===!1)}function UA(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function L3(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WA(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function P3(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Ui={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ld={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},jA=typeof navigator<"u"&&/Mac/.test(navigator.platform),qA=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Tn=0;Tn<10;Tn++)Ui[48+Tn]=Ui[96+Tn]=String(Tn);for(var Tn=1;Tn<=24;Tn++)Ui[Tn+111]="F"+Tn;for(var Tn=65;Tn<=90;Tn++)Ui[Tn]=String.fromCharCode(Tn+32),ld[Tn]=String.fromCharCode(Tn);for(var Vm in Ui)ld.hasOwnProperty(Vm)||(ld[Vm]=Ui[Vm]);function KA(t){var e=jA&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qA&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ld:Ui)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const GA=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function XA(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,a;for(let l=0;l<e.length-1;l++){let u=e[l];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))GA?a=!0:o=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),a&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function YA(t){let e=Object.create(null);for(let n in t)e[XA(n)]=t[n];return e}function Fm(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function JA(t){return new tt({props:{handleKeyDown:$m(t)}})}function $m(t){let e=YA(t);return function(n,r){let o=KA(r),s,a=e[Fm(o,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Fm(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(s=Ui[r.keyCode])&&s!=o){let l=e[Fm(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const pu=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function D3(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const V3=(t,e,n)=>{let r=D3(t,n);if(!r)return!1;let o=zm(r);if(!o){let a=r.blockRange(),l=a&&Ma(a);return l==null?!1:(e&&e(t.tr.lift(a,l).scrollIntoView()),!0)}let s=o.nodeBefore;if(K3(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Ha(s,"end")||Le.isSelectable(s)))for(let a=r.depth;;a--){let l=Qc(t.doc,r.before(a),r.after(a),Ce.empty);if(l&&l.slice.size<l.to-l.from){if(e){let u=t.tr.step(l);u.setSelection(Ha(s,"end")?De.findFrom(u.doc.resolve(u.mapping.map(o.pos,-1)),-1):Le.create(u.doc,o.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},ZA=(t,e,n)=>{let r=D3(t,n);if(!r)return!1;let o=zm(r);return o?F3(t,o,e):!1},QA=(t,e,n)=>{let r=z3(t,n);if(!r)return!1;let o=Hm(r);return o?F3(t,o,e):!1};function F3(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let f=o.lastChild;if(!f)return!1;o=f}let a=e.nodeAfter,l=a,u=e.pos+1;for(;!l.isTextblock;u++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=Qc(t.doc,s,u,Ce.empty);if(!c||c.from!=s||c instanceof fn&&c.slice.size>=u-s)return!1;if(n){let f=t.tr.step(c);f.setSelection(Te.create(f.doc,s)),n(f.scrollIntoView())}return!0}function Ha(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const $3=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=zm(r)}let a=s&&s.nodeBefore;return!a||!Le.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Le.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function zm(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function z3(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const H3=(t,e,n)=>{let r=z3(t,n);if(!r)return!1;let o=Hm(r);if(!o)return!1;let s=o.nodeAfter;if(K3(t,o,e,1))return!0;if(r.parent.content.size==0&&(Ha(s,"start")||Le.isSelectable(s))){let a=Qc(t.doc,r.before(),r.after(),Ce.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Ha(s,"start")?De.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):Le.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},U3=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Hm(r)}let a=s&&s.nodeAfter;return!a||!Le.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Le.create(t.doc,s.pos)).scrollIntoView()),!0)};function Hm(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const NA=(t,e)=>{let n=t.selection,r=n instanceof Le,o;if(r){if(n.node.isTextblock||!Ri(t.doc,n.from))return!1;o=n.from}else if(o=Zc(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(Le.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},e9=(t,e)=>{let n=t.selection,r;if(n instanceof Le){if(n.node.isTextblock||!Ri(t.doc,n.to))return!1;r=n.to}else if(r=Zc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},t9=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&Ma(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},W3=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
10
|
-
`).scrollIntoView()),!0)};function Um(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const n9=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),a=Um(o.contentMatchAt(s));if(!a||!o.canReplaceWith(s,s,a))return!1;if(e){let l=n.after(),u=t.tr.replaceWith(l,l,a.createAndFill());u.setSelection(De.near(u.doc.resolve(l),1)),e(u.scrollIntoView())}return!0},j3=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Rn||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=Um(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let a=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(a,s.createAndFill());l.setSelection(Te.create(l.doc,a+1)),e(l.scrollIntoView())}return!0},q3=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(hr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ma(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function r9(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Le&&e.selection.node.isBlock)return!r.parentOffset||!hr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],a,l,u=!1,c=!1;for(let g=r.depth;;g--)if(r.node(g).isBlock){u=r.end(g)==r.pos+(r.depth-g),c=r.start(g)==r.pos-(r.depth-g),l=Um(r.node(g-1).contentMatchAt(r.indexAfter(g-1))),s.unshift(u&&l?{type:l}:null),a=g;break}else{if(g==1)return!1;s.unshift(null)}let f=e.tr;(e.selection instanceof Te||e.selection instanceof Rn)&&f.deleteSelection();let p=f.mapping.map(r.pos),m=hr(f.doc,p,s.length,s);if(m||(s[0]=l?{type:l}:null,m=hr(f.doc,p,s.length,s)),f.split(p,s.length,s),!u&&c&&r.node(a).type!=l){let g=f.mapping.map(r.before(a)),b=f.doc.resolve(g);l&&r.node(a-1).canReplaceWith(b.index(),b.index()+1,l)&&f.setNodeMarkup(f.mapping.map(r.before(a)),l)}return n&&n(f.scrollIntoView()),!0}}const o9=r9(),i9=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection(Le.create(t.doc,o))),!0)},s9=(t,e)=>(e&&e(t.tr.setSelection(new Rn(t.doc))),!0);function a9(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||Ri(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function K3(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,a,l,u=o.type.spec.isolating||s.type.spec.isolating;if(!u&&a9(t,e,n))return!0;let c=!u&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(a=(l=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&l.matchType(a[0]||s.type).validEnd){if(n){let g=e.pos+s.nodeSize,b=de.empty;for(let x=a.length-1;x>=0;x--)b=de.from(a[x].create(null,b));b=de.from(o.copy(b));let y=t.tr.step(new vn(e.pos-1,g,e.pos,g,new Ce(b,1,0),a.length,!0)),w=y.doc.resolve(g+2*a.length);w.nodeAfter&&w.nodeAfter.type==o.type&&Ri(y.doc,w.pos)&&y.join(w.pos),n(y.scrollIntoView())}return!0}let f=s.type.spec.isolating||r>0&&u?null:De.findFrom(e,1),p=f&&f.$from.blockRange(f.$to),m=p&&Ma(p);if(m!=null&&m>=e.depth)return n&&n(t.tr.lift(p,m).scrollIntoView()),!0;if(c&&Ha(s,"start",!0)&&Ha(o,"end")){let g=o,b=[];for(;b.push(g),!g.isTextblock;)g=g.lastChild;let y=s,w=1;for(;!y.isTextblock;y=y.firstChild)w++;if(g.canReplace(g.childCount,g.childCount,y.content)){if(n){let x=de.empty;for(let k=b.length-1;k>=0;k--)x=de.from(b[k].copy(x));let E=t.tr.step(new vn(e.pos-b.length,e.pos+s.nodeSize,e.pos+w,e.pos+s.nodeSize-w,new Ce(x,b.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function G3(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(Te.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const l9=G3(-1),u9=G3(1);function c9(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s),l=a&&im(a,t,e);return l?(r&&r(n.tr.wrap(a,l).scrollIntoView()),!0):!1}}function X3(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(a,l,(u,c)=>{if(o)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)o=!0;else{let f=n.doc.resolve(c),p=f.index();o=f.parent.canReplaceWith(p,p+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:l},$to:{pos:u}}=n.selection.ranges[a];s.setBlockType(l,u,t,e)}r(s.scrollIntoView())}return!0}}function Wm(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Wm(pu,V3,$3),Wm(pu,H3,U3),Wm(W3,j3,q3,o9),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function d9(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s);if(!a)return!1;let l=r?n.tr:null;return f9(l,a,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function f9(t,e,n,r=null){let o=!1,s=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=a.resolve(e.start-2);s=new jc(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new jc(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=im(s,n,r,e);return l?(t&&p9(t,e,l,o,n),!0):!1}function p9(t,e,n,r,o){let s=de.empty;for(let f=n.length-1;f>=0;f--)s=de.from(n[f].type.create(n[f].attrs,s));t.step(new vn(e.start-(r?2:0),e.end,e.start,e.end,new Ce(s,0,0),n.length,!0));let a=0;for(let f=0;f<n.length;f++)n[f].type==o&&(a=f+1);let l=n.length-a,u=e.start+n.length-(r?2:0),c=e.parent;for(let f=e.startIndex,p=e.endIndex,m=!0;f<p;f++,m=!1)!m&&hr(t.doc,u,l)&&(t.split(u,l),u+=2*l),u+=c.child(f).nodeSize;return t}function h9(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,a=>a.childCount>0&&a.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?m9(e,n,t,s):g9(e,n,s):!0:!1}}function m9(t,e,n,r){let o=t.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new vn(s-1,a,s,a,new Ce(de.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new jc(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));const l=Ma(r);if(l==null)return!1;o.lift(r,l);let u=o.doc.resolve(o.mapping.map(s,-1)-1);return Ri(o.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&o.join(u.pos),e(o.scrollIntoView()),!0}function g9(t,e,n){let r=t.tr,o=n.parent;for(let g=n.end,b=n.endIndex-1,y=n.startIndex;b>y;b--)g-=o.child(b).nodeSize,r.delete(g-1,g+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,u=n.endIndex==o.childCount,c=s.node(-1),f=s.index(-1);if(!c.canReplace(f+(l?0:1),f+1,a.content.append(u?de.empty:de.from(o))))return!1;let p=s.pos,m=p+a.nodeSize;return r.step(new vn(p-(l?1:0),m+(u?1:0),p+1,m-1,new Ce((l?de.empty:de.from(o.copy(de.empty))).append(u?de.empty:de.from(o.copy(de.empty))),l?0:1,u?0:1),l?0:1)),e(r.scrollIntoView()),!0}function b9(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let l=s.parent,u=l.child(a-1);if(u.type!=t)return!1;if(n){let c=u.lastChild&&u.lastChild.type==l.type,f=de.from(c?t.create():null),p=new Ce(de.from(t.create(null,de.from(l.type.create(null,f)))),c?3:1,0),m=s.start,g=s.end;n(e.tr.step(new vn(m-(c?3:1),g,m,g,p,1,!0)).scrollIntoView())}return!0}}function ud(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}class cd{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:o}=n,{tr:s}=r,a=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,u])=>[l,(...f)=>{const p=u(...f)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(s),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:a}=o,l=[],u=!!e,c=e||s.tr,f=()=>(!u&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(c),l.every(m=>m===!0)),p={...Object.fromEntries(Object.entries(r).map(([m,g])=>[m,(...y)=>{const w=this.buildProps(c,n),x=g(...y)(w);return l.push(x),p}])),run:f};return p}createCan(e){const{rawCommands:n,state:r}=this,o=!1,s=e||r.tr,a=this.buildProps(s,o);return{...Object.fromEntries(Object.entries(n).map(([u,c])=>[u,(...f)=>c(...f)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,o)}}buildProps(e,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:a}=o,l={tr:e,editor:o,view:a,state:ud({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,c])=>[u,(...f)=>c(...f)(l)]))}};return l}}class v9{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(o=>o!==n):delete this.callbacks[e]),this}once(e,n){const r=(...o)=>{this.off(e,r),n.apply(this,o)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function Ie(t,e,n){return t.config[e]===void 0&&t.parent?Ie(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ie(t.parent,e,n):null}):t.config[e]}function dd(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Y3(t){const e=[],{nodeExtensions:n,markExtensions:r}=dd(t),o=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage,extensions:o},u=Ie(a,"addGlobalAttributes",l);if(!u)return;u().forEach(f=>{f.types.forEach(p=>{Object.entries(f.attributes).forEach(([m,g])=>{e.push({type:p,name:m,attribute:{...s,...g}})})})})}),o.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage},u=Ie(a,"addAttributes",l);if(!u)return;const c=u();Object.entries(c).forEach(([f,p])=>{const m={...s,...p};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:a.name,name:f,attribute:m})})}),e}function hn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function bt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const l=s?String(s).split(" "):[],u=r[o]?r[o].split(" "):[],c=l.filter(f=>!u.includes(f));r[o]=[...u,...c].join(" ")}else if(o==="style"){const l=s?s.split(";").map(f=>f.trim()).filter(Boolean):[],u=r[o]?r[o].split(";").map(f=>f.trim()).filter(Boolean):[],c=new Map;u.forEach(f=>{const[p,m]=f.split(":").map(g=>g.trim());c.set(p,m)}),l.forEach(f=>{const[p,m]=f.split(":").map(g=>g.trim());c.set(p,m)}),r[o]=Array.from(c.entries()).map(([f,p])=>`${f}: ${p}`).join("; ")}else r[o]=s}),r},{})}function jm(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>bt(n,r),{})}function J3(t){return typeof t=="function"}function at(t,e=void 0,...n){return J3(t)?e?t.bind(e)(...n):t(...n):t}function y9(t={}){return Object.keys(t).length===0&&t.constructor===Object}function w9(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Z3(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((s,a)=>{const l=a.attribute.parseHTML?a.attribute.parseHTML(n):w9(n.getAttribute(a.name));return l==null?s:{...s,[a.name]:l}},{});return{...r,...o}}}}function Q3(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&y9(n)?!1:n!=null))}function x9(t,e){var n;const r=Y3(t),{nodeExtensions:o,markExtensions:s}=dd(t),a=(n=o.find(c=>Ie(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(o.map(c=>{const f=r.filter(x=>x.type===c.name),p={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((x,E)=>{const k=Ie(E,"extendNodeSchema",p);return{...x,...k?k(c):{}}},{}),g=Q3({...m,content:at(Ie(c,"content",p)),marks:at(Ie(c,"marks",p)),group:at(Ie(c,"group",p)),inline:at(Ie(c,"inline",p)),atom:at(Ie(c,"atom",p)),selectable:at(Ie(c,"selectable",p)),draggable:at(Ie(c,"draggable",p)),code:at(Ie(c,"code",p)),whitespace:at(Ie(c,"whitespace",p)),linebreakReplacement:at(Ie(c,"linebreakReplacement",p)),defining:at(Ie(c,"defining",p)),isolating:at(Ie(c,"isolating",p)),attrs:Object.fromEntries(f.map(x=>{var E;return[x.name,{default:(E=x==null?void 0:x.attribute)===null||E===void 0?void 0:E.default}]}))}),b=at(Ie(c,"parseHTML",p));b&&(g.parseDOM=b.map(x=>Z3(x,f)));const y=Ie(c,"renderHTML",p);y&&(g.toDOM=x=>y({node:x,HTMLAttributes:jm(x,f)}));const w=Ie(c,"renderText",p);return w&&(g.toText=w),[c.name,g]})),u=Object.fromEntries(s.map(c=>{const f=r.filter(w=>w.type===c.name),p={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((w,x)=>{const E=Ie(x,"extendMarkSchema",p);return{...w,...E?E(c):{}}},{}),g=Q3({...m,inclusive:at(Ie(c,"inclusive",p)),excludes:at(Ie(c,"excludes",p)),group:at(Ie(c,"group",p)),spanning:at(Ie(c,"spanning",p)),code:at(Ie(c,"code",p)),attrs:Object.fromEntries(f.map(w=>{var x;return[w.name,{default:(x=w==null?void 0:w.attribute)===null||x===void 0?void 0:x.default}]}))}),b=at(Ie(c,"parseHTML",p));b&&(g.parseDOM=b.map(w=>Z3(w,f)));const y=Ie(c,"renderHTML",p);return y&&(g.toDOM=w=>y({mark:w,HTMLAttributes:jm(w,f)})),[c.name,g]}));return new W2({topNode:a,nodes:l,marks:u})}function qm(t,e){return e.nodes[t]||e.marks[t]||null}function N3(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Km(t,e){const n=to.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}const C9=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,a,l)=>{var u,c;const f=((c=(u=o.type.spec).toText)===null||c===void 0?void 0:c.call(u,{node:o,pos:s,parent:a,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?f:f.slice(0,Math.max(0,r-s))}),n};function Gm(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class fd{constructor(e){this.find=e.find,this.handler=e.handler}}const E9=(t,e)=>{if(Gm(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function pd(t){var e;const{editor:n,from:r,to:o,text:s,rules:a,plugin:l}=t,{view:u}=n;if(u.composing)return!1;const c=u.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(m=>m.type.spec.code))return!1;let f=!1;const p=C9(c)+s;return a.forEach(m=>{if(f)return;const g=E9(p,m.find);if(!g)return;const b=u.state.tr,y=ud({state:u.state,transaction:b}),w={from:r-(g[0].length-s.length),to:o},{commands:x,chain:E,can:k}=new cd({editor:n,state:y});m.handler({state:y,range:w,match:g,commands:x,chain:E,can:k})===null||!b.steps.length||(b.setMeta(l,{transform:b,from:r,to:o,text:s}),u.dispatch(b),f=!0)}),f}function k9(t){const{editor:e,rules:n}=t,r=new tt({state:{init(){return null},apply(o,s,a){const l=o.getMeta(r);if(l)return l;const u=o.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=Km(de.from(f),a.schema);const{from:p}=u,m=p+f.length;pd({editor:e,from:p,to:m,text:f,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,a,l){return pd({editor:e,from:s,to:a,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&pd({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:a}=o.state.selection;return a?pd({editor:e,from:a.pos,to:a.pos,text:`
|
|
9
|
+
`))),0,0):Ce.empty;let p=t.someProp("clipboardTextParser",m=>m(e,o,r,t));if(p)l=p;else{let m=o.marks(),{schema:g}=t.state,b=to.fromSchema(g);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let w=a.appendChild(document.createElement("p"));y&&w.appendChild(b.serializeNode(g.text(y,m)))})}}else t.someProp("transformPastedHTML",p=>{n=p(n,t)}),a=nA(n),iu&&rA(a);let c=a&&a.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let p=+f[3];p>0;p--){let m=a.firstChild;for(;m&&m.nodeType!=1;)m=m.nextSibling;if(!m)break;a=m}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Zl.fromSchema(t.state.schema)).parseSlice(a,{preserveWhitespace:!!(u||f),context:o,ruleFromNode(m){return m.nodeName=="BR"&&!m.nextSibling&&m.parentNode&&!N7.test(m.parentNode.nodeName)?{ignore:!0}:null}})),f)l=oA(d3(l,+f[1],+f[2]),f[4]);else if(l=Ce.maxOpen(eA(l.content,o),!0),l.openStart||l.openEnd){let p=0,m=0;for(let g=l.content.firstChild;p<l.openStart&&!g.type.spec.isolating;p++,g=g.firstChild);for(let g=l.content.lastChild;m<l.openEnd&&!g.type.spec.isolating;m++,g=g.lastChild);l=d3(l,p,m)}return t.someProp("transformPasted",p=>{l=p(l,t)}),l}const N7=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function eA(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),s,a=[];if(t.forEach(l=>{if(!a)return;let u=o.findWrapping(l.type),c;if(!u)return a=null;if(c=a.length&&s.length&&u3(u,s,l,a[a.length-1],0))a[a.length-1]=c;else{a.length&&(a[a.length-1]=c3(a[a.length-1],s.length));let f=l3(l,u);a.push(f),o=o.matchType(f.type),s=u}}),a)return de.from(a)}return t}function l3(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,de.from(t));return t}function u3(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let s=u3(t,e,n,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(de.from(l3(n,t,o+1))))}}function c3(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,c3(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(de.empty,!0);return t.copy(n.append(r))}function Tm(t,e,n,r,o,s){let a=e<0?t.firstChild:t.lastChild,l=a.content;return t.childCount>1&&(s=0),o<r-1&&(l=Tm(l,e,n,r,o+1,s)),o>=n&&(l=e<0?a.contentMatchAt(0).fillBefore(l,s<=o).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(de.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(l))}function d3(t,e,n){return e<t.openStart&&(t=new Ce(Tm(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new Ce(Tm(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const f3={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let p3=null;function h3(){return p3||(p3=document.implementation.createHTMLDocument("title"))}let Am=null;function tA(t){let e=window.trustedTypes;return e?(Am||(Am=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Am.createHTML(t)):t}function nA(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=h3().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&f3[r[1].toLowerCase()])&&(t=o.map(s=>"<"+s+">").join("")+t+o.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=tA(t),o)for(let s=0;s<o.length;s++)n=n.querySelector(o[s])||n;return n}function rA(t){let e=t.querySelectorAll(Ln?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function oA(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:s,openEnd:a}=t;for(let l=r.length-2;l>=0;l-=2){let u=n.nodes[r[l]];if(!u||u.hasRequiredAttrs())break;o=de.from(u.create(r[l+1],o)),s++,a++}return new Ce(o,s,a)}const Kn={},Gn={},iA={touchstart:!0,touchmove:!0};class sA{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function aA(t){for(let e in Kn){let n=Kn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{uA(t,r)&&!Mm(t,r)&&(t.editable||!(r.type in Gn))&&n(t,r)},iA[e]?{passive:!0}:void 0)}qn&&t.dom.addEventListener("input",()=>null),Om(t)}function $i(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function lA(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Om(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Mm(t,r))})}function Mm(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function uA(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function cA(t,e){!Mm(t,e)&&Kn[e.type]&&(t.editable||!(e.type in Gn))&&Kn[e.type](t,e)}Gn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!g3(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Qo&&Ln&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Da&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,Ms(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Q7(t,n)?n.preventDefault():$i(t,"key")},Gn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},Gn.keypress=(t,e)=>{let n=e;if(g3(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Ir&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Te)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function od(t){return{left:t.clientX,top:t.clientY}}function dA(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Bm(t,e,n,r,o){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let a=s.depth+1;a>0;a--)if(t.someProp(e,l=>a>s.depth?l(t,n,s.nodeAfter,s.before(a),o,!0):l(t,n,s.node(a),s.before(a),o,!1)))return!0;return!1}function $a(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function fA(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Le.isSelectable(r)?($a(t,new Le(n)),!0):!1}function pA(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Le&&(r=n.node);let s=t.state.doc.resolve(e);for(let a=s.depth+1;a>0;a--){let l=a>s.depth?s.nodeAfter:s.node(a);if(Le.isSelectable(l)){r&&n.$from.depth>0&&a>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?o=s.before(n.$from.depth):o=s.before(a);break}}return o!=null?($a(t,Le.create(t.state.doc,o)),!0):!1}function hA(t,e,n,r,o){return Bm(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(o?pA(t,n):fA(t,n))}function mA(t,e,n,r){return Bm(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function gA(t,e,n,r){return Bm(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||bA(t,n,r)}function bA(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?($a(t,Te.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s),l=o.before(s);if(a.inlineContent)$a(t,Te.create(r,l+1,l+1+a.content.size));else if(Le.isSelectable(a))$a(t,Le.create(r,l));else continue;return!0}}function Im(t){return id(t)}const m3=Ir?"metaKey":"ctrlKey";Kn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Im(t),o=Date.now(),s="singleClick";o-t.input.lastClick.time<500&&dA(n,t.input.lastClick)&&!n[m3]&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:s};let a=t.posAtCoords(od(n));a&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new vA(t,a,n,!!r)):(s=="doubleClick"?mA:gA)(t,a.pos,a.inside,n)?n.preventDefault():$i(t,"pointer"))};class vA{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[m3],this.allowDefault=r.shiftKey;let s,a;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),a=n.inside;else{let f=e.state.doc.resolve(n.pos);s=f.parent,a=f.depth?f.before():0}const l=o?null:r.target,u=l?e.docView.nearestDesc(l,!0):null;this.target=u&&u.dom.nodeType==1?u.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof Le&&c.from<=a&&c.to>a)&&(this.mightDrag={node:s,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ro&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),$i(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ei(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(od(e))),this.updateAllowDefault(e),this.allowDefault||!n?$i(this.view,"pointer"):hA(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||qn&&this.mightDrag&&!this.mightDrag.node.isAtom||Ln&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?($a(this.view,Ve.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):$i(this.view,"pointer")}move(e){this.updateAllowDefault(e),$i(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Kn.touchstart=t=>{t.input.lastTouch=Date.now(),Im(t),$i(t,"pointer")},Kn.touchmove=t=>{t.input.lastTouch=Date.now(),$i(t,"pointer")},Kn.contextmenu=t=>Im(t);function g3(t,e){return t.composing?!0:qn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const yA=Qo?5e3:-1;Gn.compositionstart=Gn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Te&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),id(t,!0),t.markCursor=null;else if(id(t,!e.selection.empty),ro&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let a=s<0?o.lastChild:o.childNodes[s-1];if(!a)break;if(a.nodeType==3){let l=t.domSelection();l&&l.collapse(a,a.nodeValue.length);break}else o=a,s=-1}}t.input.composing=!0}b3(t,yA)},Gn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,b3(t,20))};function b3(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>id(t),e))}function v3(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=xA());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function wA(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=f7(e.focusNode,e.focusOffset),r=p7(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let a=n.pmViewDesc;if(!(!a||!a.isText(n.nodeValue)))return r}}return n||r}function xA(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function id(t,e=!1){if(!(Qo&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),v3(t),e||t.docView&&t.docView.dirty){let n=xm(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function CA(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const cu=tr&&Pi<15||Da&&v7<604;Kn.copy=Gn.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let s=cu?null:n.clipboardData,a=r.content(),{dom:l,text:u}=_m(t,a);s?(n.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",u)):CA(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function EA(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function kA(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?du(t,r.value,null,o,e):du(t,r.textContent,r.innerHTML,o,e)},50)}function du(t,e,n,r,o){let s=a3(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,o,s||Ce.empty)))return!0;if(!s)return!1;let a=EA(s),l=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function y3(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Gn.paste=(t,e)=>{let n=e;if(t.composing&&!Qo)return;let r=cu?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&du(t,y3(r),r.getData("text/html"),o,n)?n.preventDefault():kA(t,n)};class w3{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const x3=Ir?"altKey":"ctrlKey";Kn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,s=o.empty?null:t.posAtCoords(od(n)),a;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof Le?o.to-1:o.to))){if(r&&r.mightDrag)a=Le.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let p=t.docView.nearestDesc(n.target,!0);p&&p.node.type.spec.draggable&&p!=t.docView&&(a=Le.create(t.state.doc,p.posBefore))}}let l=(a||t.state.selection).content(),{dom:u,text:c,slice:f}=_m(t,l);(!n.dataTransfer.files.length||!Ln||Ty>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(cu?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",cu||n.dataTransfer.setData("text/plain",c),t.dragging=new w3(f,!n[x3],a)},Kn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},Gn.dragover=Gn.dragenter=(t,e)=>e.preventDefault(),Gn.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(od(n));if(!o)return;let s=t.state.doc.resolve(o.pos),a=r&&r.slice;a?t.someProp("transformPasted",b=>{a=b(a,t)}):a=a3(t,y3(n.dataTransfer),cu?null:n.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&!n[x3]);if(t.someProp("handleDrop",b=>b(t,n,a||Ce.empty,l))){n.preventDefault();return}if(!a)return;n.preventDefault();let u=a?uy(t.state.doc,s.pos,a):s.pos;u==null&&(u=s.pos);let c=t.state.tr;if(l){let{node:b}=r;b?b.replace(c):c.deleteSelection()}let f=c.mapping.map(u),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,m=c.doc;if(p?c.replaceRangeWith(f,f,a.content.firstChild):c.replaceRange(f,f,a),c.doc.eq(m))return;let g=c.doc.resolve(f);if(p&&Le.isSelectable(a.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new Le(g));else{let b=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach((y,w,x,E)=>b=E),c.setSelection(Em(t,g,c.doc.resolve(b)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Kn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&ei(t)},20))},Kn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Kn.beforeinput=(t,e)=>{if(Ln&&Qo&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,Ms(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Gn)Kn[t]=Gn[t];function fu(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class sd{constructor(e,n){this.toDOM=e,this.spec=n||Ls,this.side=this.spec.side||0}map(e,n,r,o){let{pos:s,deleted:a}=e.mapResult(n.from+o,this.side<0?-1:1);return a?null:new jt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sd&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&fu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class zi{constructor(e,n){this.attrs=e,this.spec=n||Ls}map(e,n,r,o){let s=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,a=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=a?null:new jt(s,a,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof zi&&fu(this.attrs,e.attrs)&&fu(this.spec,e.spec)}static is(e){return e.type instanceof zi}destroy(){}}class Rm{constructor(e,n){this.attrs=e,this.spec=n||Ls}map(e,n,r,o){let s=e.mapResult(n.from+o,1);if(s.deleted)return null;let a=e.mapResult(n.to+o,-1);return a.deleted||a.pos<=s.pos?null:new jt(s.pos-r,a.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),s;return o==n.from&&!(s=e.child(r)).isText&&o+s.nodeSize==n.to}eq(e){return this==e||e instanceof Rm&&fu(this.attrs,e.attrs)&&fu(this.spec,e.spec)}destroy(){}}class jt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new jt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new jt(e,e,new sd(n,r))}static inline(e,n,r,o){return new jt(e,n,new zi(r,o))}static node(e,n,r,o){return new jt(e,n,new Rm(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof zi}get widget(){return this.type instanceof sd}}const za=[],Ls={};class ft{constructor(e,n){this.local=e.length?e:za,this.children=n.length?n:za}static create(e,n){return n.length?ad(n,e,0,Ls):Pn}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,s){for(let a=0;a<this.local.length;a++){let l=this.local[a];l.from<=n&&l.to>=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<n&&this.children[a+1]>e){let l=this.children[a]+1;this.children[a+2].findInner(e-l,n-l,r,o+l,s)}}map(e,n,r){return this==Pn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Ls)}mapInner(e,n,r,o,s){let a;for(let l=0;l<this.local.length;l++){let u=this.local[l].map(e,r,o);u&&u.type.valid(n,u)?(a||(a=[])).push(u):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?SA(this.children,a||[],e,n,r,o,s):a?new ft(a.sort(Ps),za):Pn}add(e,n){return n.length?this==Pn?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,s=0;e.forEach((l,u)=>{let c=u+r,f;if(f=E3(n,l,c)){for(o||(o=this.children.slice());s<o.length&&o[s]<u;)s+=3;o[s]==u?o[s+2]=o[s+2].addInner(l,f,c+1):o.splice(s,0,u,u+l.nodeSize,ad(f,l,c+1,Ls)),s+=3}});let a=C3(s?k3(n):n,-r);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||a.splice(l--,1);return new ft(a.length?this.local.concat(a).sort(Ps):this.local,o||this.children)}remove(e){return e.length==0||this==Pn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let a,l=r[s]+n,u=r[s+1]+n;for(let f=0,p;f<e.length;f++)(p=e[f])&&p.from>l&&p.to<u&&(e[f]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let c=r[s+2].removeInner(a,l+1);c!=Pn?r[s+2]=c:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,a;s<e.length;s++)if(a=e[s])for(let l=0;l<o.length;l++)o[l].eq(a,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new ft(o,r):Pn}forChild(e,n){if(this==Pn)return this;if(n.isLeaf)return ft.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,a=s+n.content.size;for(let l=0;l<this.local.length;l++){let u=this.local[l];if(u.from<a&&u.to>s&&u.type instanceof zi){let c=Math.max(s,u.from)-s,f=Math.min(a,u.to)-s;c<f&&(o||(o=[])).push(u.copy(c,f))}}if(o){let l=new ft(o.sort(Ps),za);return r?new Hi([l,r]):l}return r||Pn}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Lm(this.localsInner(e))}localsInner(e){if(this==Pn)return za;if(e.inlineContent||!this.local.some(zi.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof zi||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]),ft.removeOverlap=Lm;const Pn=ft.empty;class Hi{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Ls));return Hi.from(r)}forChild(e,n){if(n.isLeaf)return ft.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,n);s!=Pn&&(s instanceof Hi?r=r.concat(s.members):r.push(s))}return Hi.from(r)}eq(e){if(!(e instanceof Hi)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let a=0;a<s.length;a++)n.push(s[a])}}return n?Lm(r?n:n.sort(Ps)):za}static from(e){switch(e.length){case 0:return Pn;case 1:return e[0];default:return new Hi(e.every(n=>n instanceof ft)?e:e.reduce((n,r)=>n.concat(r instanceof ft?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function SA(t,e,n,r,o,s,a){let l=t.slice();for(let c=0,f=s;c<n.maps.length;c++){let p=0;n.maps[c].forEach((m,g,b,y)=>{let w=y-b-(g-m);for(let x=0;x<l.length;x+=3){let E=l[x+1];if(E<0||m>E+f-p)continue;let k=l[x]+f-p;g>=k?l[x+1]=m<=k?-2:-1:m>=f&&w&&(l[x]+=w,l[x+1]+=w)}p+=w}),f=n.maps[c].map(f,-1)}let u=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){u=!0,l[c+1]=-1;continue}let f=n.map(t[c]+s),p=f-o;if(p<0||p>=r.content.size){u=!0;continue}let m=n.map(t[c+1]+s,-1),g=m-o,{index:b,offset:y}=r.content.findIndex(p),w=r.maybeChild(b);if(w&&y==p&&y+w.nodeSize==g){let x=l[c+2].mapInner(n,w,f+1,t[c]+s+1,a);x!=Pn?(l[c]=p,l[c+1]=g,l[c+2]=x):(l[c+1]=-2,u=!0)}else u=!0}if(u){let c=_A(l,t,e,n,o,s,a),f=ad(c,r,0,a);e=f.local;for(let p=0;p<l.length;p+=3)l[p+1]<0&&(l.splice(p,3),p-=3);for(let p=0,m=0;p<f.children.length;p+=3){let g=f.children[p];for(;m<l.length&&l[m]<g;)m+=3;l.splice(m,0,f.children[p],f.children[p+1],f.children[p+2])}}return new ft(e.sort(Ps),l)}function C3(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new jt(o.from+e,o.to+e,o.type))}return n}function _A(t,e,n,r,o,s,a){function l(u,c){for(let f=0;f<u.local.length;f++){let p=u.local[f].map(r,o,c);p?n.push(p):a.onRemove&&a.onRemove(u.local[f].spec)}for(let f=0;f<u.children.length;f+=3)l(u.children[f+2],u.children[f]+c+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&l(t[u+2],e[u]+s+1);return n}function E3(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let s=0,a;s<t.length;s++)(a=t[s])&&a.from>n&&a.to<r&&((o||(o=[])).push(a),t[s]=null);return o}function k3(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ad(t,e,n,r){let o=[],s=!1;e.forEach((l,u)=>{let c=E3(t,l,u+n);if(c){s=!0;let f=ad(c,l,n+u+1,r);f!=Pn&&o.push(u,u+l.nodeSize,f)}});let a=C3(s?k3(t):t,-n).sort(Ps);for(let l=0;l<a.length;l++)a[l].type.valid(e,a[l])||(r.onRemove&&r.onRemove(a[l].spec),a.splice(l--,1));return a.length||o.length?new ft(a,o):Pn}function Ps(t,e){return t.from-e.from||t.to-e.to}function Lm(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[o]=s.copy(s.from,r.to),S3(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),S3(e,o,r.copy(s.from,r.to)));break}}}return e}function S3(t,e,n){for(;e<t.length&&Ps(n,t[e])>0;)e++;t.splice(e,0,n)}function Pm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Pn&&e.push(r)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),Hi.from(e)}const TA={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AA=tr&&Pi<=11;class OA{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class MA{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new OA,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);tr&&Pi<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),AA&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,TA)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ny(this.view)){if(this.suppressingSelectionUpdates)return ei(this.view);if(tr&&Pi<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Os(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let s=e.focusNode;s;s=Pa(s))n.add(s);for(let s=e.anchorNode;s;s=Pa(s))if(n.has(s)){r=s;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ny(e)&&!this.ignoreSelectionChange(r),s=-1,a=-1,l=!1,u=[];if(e.editable)for(let f=0;f<n.length;f++){let p=this.registerMutation(n[f],u);p&&(s=s<0?p.from:Math.min(p.from,s),a=a<0?p.to:Math.max(p.to,a),p.typeOver&&(l=!0))}if(ro&&u.length){let f=u.filter(p=>p.nodeName=="BR");if(f.length==2){let[p,m]=f;p.parentNode&&p.parentNode.parentNode==m.parentNode?m.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let m of f){let g=m.parentNode;g&&g.nodeName=="LI"&&(!p||RA(e,p)!=g)&&m.remove()}}}let c=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ed(r)&&(c=xm(e))&&c.eq(Ve.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ei(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,a),BA(e)),this.handleDOMChange(s,a,l,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ei(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;f<e.addedNodes.length;f++){let p=e.addedNodes[f];n.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,s=e.nextSibling;if(tr&&Pi<=11&&e.addedNodes.length)for(let f=0;f<e.addedNodes.length;f++){let{previousSibling:p,nextSibling:m}=e.addedNodes[f];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(o=p),(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(s=m)}let a=o&&o.parentNode==e.target?_n(o)+1:0,l=r.localPosFromDOM(e.target,a,-1),u=s&&s.parentNode==e.target?_n(s):e.target.childNodes.length,c=r.localPosFromDOM(e.target,u,1);return{from:l,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let _3=new WeakMap,T3=!1;function BA(t){if(!_3.has(t)&&(_3.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=ro,T3)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),T3=!0}}function A3(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,a=t.domAtPos(t.state.selection.anchor);return Os(a.node,a.offset,o,s)&&([n,r,o,s]=[o,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:s}}function IA(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return A3(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?A3(t,n):null}function RA(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function LA(t,e,n){let{node:r,fromOffset:o,toOffset:s,from:a,to:l}=t.docView.parseRange(e,n),u=t.domSelectionRange(),c,f=u.anchorNode;if(f&&t.dom.contains(f.nodeType==1?f:f.parentNode)&&(c=[{node:f,offset:u.anchorOffset}],ed(u)||c.push({node:u.focusNode,offset:u.focusOffset})),Ln&&t.input.lastKeyCode===8)for(let w=s;w>o;w--){let x=r.childNodes[w-1],E=x.pmViewDesc;if(x.nodeName=="BR"&&!E){s=w;break}if(!E||E.size)break}let p=t.state.doc,m=t.someProp("domParser")||Zl.fromSchema(t.state.schema),g=p.resolve(a),b=null,y=m.parse(r,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:o,to:s,preserveWhitespace:g.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:PA,context:g});if(c&&c[0].pos!=null){let w=c[0].pos,x=c[1]&&c[1].pos;x==null&&(x=w),b={anchor:w+a,head:x+a}}return{doc:y,sel:b,from:a,to:l}}function PA(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(qn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||qn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const DA=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function VA(t,e,n,r,o){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let I=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,M=xm(t,I);if(M&&!t.state.selection.eq(M)){if(Ln&&Qo&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",U=>U(t,Ms(13,"Enter"))))return;let j=t.state.tr.setSelection(M);I=="pointer"?j.setMeta("pointer",!0):I=="key"&&j.scrollIntoView(),s&&j.setMeta("composition",s),t.dispatch(j)}return}let a=t.state.doc.resolve(e),l=a.sharedDepth(n);e=a.before(l+1),n=t.state.doc.resolve(n).after(l+1);let u=t.state.selection,c=LA(t,e,n),f=t.state.doc,p=f.slice(c.from,c.to),m,g;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(m=t.state.selection.to,g="end"):(m=t.state.selection.from,g="start"),t.input.lastKeyCode=null;let b=zA(p.content,c.doc.content,c.from,m,g);if(b&&t.input.domChangeCount++,(Da&&t.input.lastIOSEnter>Date.now()-225||Qo)&&o.some(I=>I.nodeType==1&&!DA.test(I.nodeName))&&(!b||b.endA>=b.endB)&&t.someProp("handleKeyDown",I=>I(t,Ms(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!b)if(r&&u instanceof Te&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))b={start:u.from,endA:u.to,endB:u.to};else{if(c.sel){let I=O3(t,t.state.doc,c.sel);if(I&&!I.eq(t.state.selection)){let M=t.state.tr.setSelection(I);s&&M.setMeta("composition",s),t.dispatch(M)}}return}t.state.selection.from<t.state.selection.to&&b.start==b.endB&&t.state.selection instanceof Te&&(b.start>t.state.selection.from&&b.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?b.start=t.state.selection.from:b.endA<t.state.selection.to&&b.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(b.endB+=t.state.selection.to-b.endA,b.endA=t.state.selection.to)),tr&&Pi<=11&&b.endB==b.start+1&&b.endA==b.start&&b.start>c.from&&c.doc.textBetween(b.start-c.from-1,b.start-c.from+1)==" "&&(b.start--,b.endA--,b.endB--);let y=c.doc.resolveNoCache(b.start-c.from),w=c.doc.resolveNoCache(b.endB-c.from),x=f.resolve(b.start),E=y.sameParent(w)&&y.parent.inlineContent&&x.end()>=b.endA,k;if((Da&&t.input.lastIOSEnter>Date.now()-225&&(!E||o.some(I=>I.nodeName=="DIV"||I.nodeName=="P"))||!E&&y.pos<c.doc.content.size&&!y.sameParent(w)&&(k=Ve.findFrom(c.doc.resolve(y.pos+1),1,!0))&&k.head==w.pos)&&t.someProp("handleKeyDown",I=>I(t,Ms(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>b.start&&$A(f,b.start,b.endA,y,w)&&t.someProp("handleKeyDown",I=>I(t,Ms(8,"Backspace")))){Qo&&Ln&&t.domObserver.suppressSelectionUpdates();return}Ln&&b.endB==b.start&&(t.input.lastChromeDelete=Date.now()),Qo&&!E&&y.start()!=w.start()&&w.parentOffset==0&&y.depth==w.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==b.endA&&(b.endB-=2,w=c.doc.resolveNoCache(b.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(I){return I(t,Ms(13,"Enter"))})},20));let C=b.start,_=b.endA,A,T,P;if(E){if(y.pos==w.pos)tr&&Pi<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ei(t),20)),A=t.state.tr.delete(C,_),T=f.resolve(b.start).marksAcross(f.resolve(b.endA));else if(b.endA==b.endB&&(P=FA(y.parent.content.cut(y.parentOffset,w.parentOffset),x.parent.content.cut(x.parentOffset,b.endA-x.start()))))A=t.state.tr,P.type=="add"?A.addMark(C,_,P.mark):A.removeMark(C,_,P.mark);else if(y.parent.child(y.index()).isText&&y.index()==w.index()-(w.textOffset?0:1)){let I=y.parent.textBetween(y.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",M=>M(t,C,_,I)))return;A=t.state.tr.insertText(I,C,_)}}if(A||(A=t.state.tr.replace(C,_,c.doc.slice(b.start-c.from,b.endB-c.from))),c.sel){let I=O3(t,A.doc,c.sel);I&&!(Ln&&t.composing&&I.empty&&(b.start!=b.endB||t.input.lastChromeDelete<Date.now()-100)&&(I.head==C||I.head==A.mapping.map(_)-1)||tr&&I.empty&&I.head==C)&&A.setSelection(I)}T&&A.ensureMarks(T),s&&A.setMeta("composition",s),t.dispatch(A.scrollIntoView())}function O3(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Em(t,e.resolve(n.anchor),e.resolve(n.head))}function FA(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,s=r,a,l,u;for(let f=0;f<r.length;f++)o=r[f].removeFromSet(o);for(let f=0;f<n.length;f++)s=n[f].removeFromSet(s);if(o.length==1&&s.length==0)l=o[0],a="add",u=f=>f.mark(l.addToSet(f.marks));else if(o.length==0&&s.length==1)l=s[0],a="remove",u=f=>f.mark(l.removeFromSet(f.marks));else return null;let c=[];for(let f=0;f<e.childCount;f++)c.push(u(e.child(f)));if(de.from(c).eq(t))return{mark:l,type:a}}function $A(t,e,n,r,o){if(n-e<=o.pos-r.pos||Dm(r,!0,!1)<o.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let l=s.nodeAfter;return l!=null&&n==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let a=t.resolve(Dm(s,!0,!0));return!a.parent.isTextblock||a.pos>n||Dm(a,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function Dm(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function zA(t,e,n,r,o){let s=t.findDiffStart(e,n);if(s==null)return null;let{a,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let u=Math.max(0,s-Math.min(a,l));r-=a+u-s}if(a<s&&t.size<e.size){let u=r<=s&&r>=a?s-r:0;s-=u,s&&s<e.size&&M3(e.textBetween(s-1,s+1))&&(s+=u?1:-1),l=s+(l-a),a=s}else if(l<s){let u=r<=s&&r>=l?s-r:0;s-=u,s&&s<t.size&&M3(t.textBetween(s-1,s+1))&&(s+=u?1:-1),a=s+(a-l),l=s}return{start:s,endA:a,endB:l}}function M3(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class HA{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new sA,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(P3),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=R3(this),I3(this),this.nodeViews=L3(this),this.docView=Hy(this.state.doc,B3(this),Pm(this),this.dom,this),this.domObserver=new MA(this,(r,o,s,a)=>VA(this,r,o,s,a)),this.domObserver.start(),aA(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Om(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(P3),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,s=!1,a=!1;e.storedMarks&&this.composing&&(v3(this),a=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let g=L3(this);WA(g,this.nodeViews)&&(this.nodeViews=g,s=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Om(this),this.editable=R3(this),I3(this);let u=Pm(this),c=B3(this),f=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",p=s||!this.docView.matchesNode(e.doc,c,u);(p||!e.selection.eq(o.selection))&&(a=!0);let m=f=="preserve"&&a&&this.dom.style.overflowAnchor==null&&x7(this);if(a){this.domObserver.stop();let g=p&&(tr||Ln)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&UA(o.selection,e.selection);if(p){let b=Ln?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=wA(this)),(s||!this.docView.update(e.doc,c,u,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Hy(e.doc,c,u,this.dom,this)),b&&!this.trackWrites&&(g=!0)}g||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&q7(this))?ei(this,g):(Zy(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():m&&C7(m)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Le){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Ay(this,n.getBoundingClientRect(),e)}else Ay(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new w3(e.slice,e.move,o<0?void 0:Le.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let a=0;a<this.directPlugins.length;a++){let l=this.directPlugins[a].props[e];if(l!=null&&(o=n?n(l):l))return o}let s=this.state.plugins;if(s)for(let a=0;a<s.length;a++){let l=s[a].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(tr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&E7(this.dom),ei(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return A7(this,e)}coordsAtPos(e,n=1){return Ly(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return R7(this,n||this.state,e)}pasteHTML(e,n){return du(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return du(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return _m(this,e)}destroy(){this.docView&&(lA(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Pm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,c7())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cA(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?qn&&this.root.nodeType===11&&m7(this.dom.ownerDocument)==this.dom&&IA(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function B3(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[jt.node(0,t.state.doc.content.size,e)]}function I3(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:jt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function R3(t){return!t.someProp("editable",e=>e(t.state)===!1)}function UA(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function L3(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WA(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function P3(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Ui={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ld={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},jA=typeof navigator<"u"&&/Mac/.test(navigator.platform),qA=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Tn=0;Tn<10;Tn++)Ui[48+Tn]=Ui[96+Tn]=String(Tn);for(var Tn=1;Tn<=24;Tn++)Ui[Tn+111]="F"+Tn;for(var Tn=65;Tn<=90;Tn++)Ui[Tn]=String.fromCharCode(Tn+32),ld[Tn]=String.fromCharCode(Tn);for(var Vm in Ui)ld.hasOwnProperty(Vm)||(ld[Vm]=Ui[Vm]);function KA(t){var e=jA&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qA&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?ld:Ui)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const GA=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function XA(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,s,a;for(let l=0;l<e.length-1;l++){let u=e[l];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))GA?a=!0:o=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),a&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function YA(t){let e=Object.create(null);for(let n in t)e[XA(n)]=t[n];return e}function Fm(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function JA(t){return new tt({props:{handleKeyDown:$m(t)}})}function $m(t){let e=YA(t);return function(n,r){let o=KA(r),s,a=e[Fm(o,r)];if(a&&a(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[Fm(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(s=Ui[r.keyCode])&&s!=o){let l=e[Fm(s,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}const pu=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function D3(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const V3=(t,e,n)=>{let r=D3(t,n);if(!r)return!1;let o=zm(r);if(!o){let a=r.blockRange(),l=a&&Ma(a);return l==null?!1:(e&&e(t.tr.lift(a,l).scrollIntoView()),!0)}let s=o.nodeBefore;if(K3(t,o,e,-1))return!0;if(r.parent.content.size==0&&(Ha(s,"end")||Le.isSelectable(s)))for(let a=r.depth;;a--){let l=Qc(t.doc,r.before(a),r.after(a),Ce.empty);if(l&&l.slice.size<l.to-l.from){if(e){let u=t.tr.step(l);u.setSelection(Ha(s,"end")?Ve.findFrom(u.doc.resolve(u.mapping.map(o.pos,-1)),-1):Le.create(u.doc,o.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},ZA=(t,e,n)=>{let r=D3(t,n);if(!r)return!1;let o=zm(r);return o?F3(t,o,e):!1},QA=(t,e,n)=>{let r=z3(t,n);if(!r)return!1;let o=Hm(r);return o?F3(t,o,e):!1};function F3(t,e,n){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let f=o.lastChild;if(!f)return!1;o=f}let a=e.nodeAfter,l=a,u=e.pos+1;for(;!l.isTextblock;u++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=Qc(t.doc,s,u,Ce.empty);if(!c||c.from!=s||c instanceof fn&&c.slice.size>=u-s)return!1;if(n){let f=t.tr.step(c);f.setSelection(Te.create(f.doc,s)),n(f.scrollIntoView())}return!0}function Ha(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const $3=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=zm(r)}let a=s&&s.nodeBefore;return!a||!Le.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Le.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function zm(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function z3(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const H3=(t,e,n)=>{let r=z3(t,n);if(!r)return!1;let o=Hm(r);if(!o)return!1;let s=o.nodeAfter;if(K3(t,o,e,1))return!0;if(r.parent.content.size==0&&(Ha(s,"start")||Le.isSelectable(s))){let a=Qc(t.doc,r.before(),r.after(),Ce.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Ha(s,"start")?Ve.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):Le.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},U3=(t,e,n)=>{let{$head:r,empty:o}=t.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Hm(r)}let a=s&&s.nodeAfter;return!a||!Le.isSelectable(a)?!1:(e&&e(t.tr.setSelection(Le.create(t.doc,s.pos)).scrollIntoView()),!0)};function Hm(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const NA=(t,e)=>{let n=t.selection,r=n instanceof Le,o;if(r){if(n.node.isTextblock||!Ri(t.doc,n.from))return!1;o=n.from}else if(o=Zc(t.doc,n.from,-1),o==null)return!1;if(e){let s=t.tr.join(o);r&&s.setSelection(Le.create(s.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},e9=(t,e)=>{let n=t.selection,r;if(n instanceof Le){if(n.node.isTextblock||!Ri(t.doc,n.to))return!1;r=n.to}else if(r=Zc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},t9=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&Ma(o);return s==null?!1:(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)},W3=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
10
|
+
`).scrollIntoView()),!0)};function Um(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const n9=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),s=n.indexAfter(-1),a=Um(o.contentMatchAt(s));if(!a||!o.canReplaceWith(s,s,a))return!1;if(e){let l=n.after(),u=t.tr.replaceWith(l,l,a.createAndFill());u.setSelection(Ve.near(u.doc.resolve(l),1)),e(u.scrollIntoView())}return!0},j3=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof Rn||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=Um(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let a=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(a,s.createAndFill());l.setSelection(Te.create(l.doc,a+1)),e(l.scrollIntoView())}return!0},q3=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(hr(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ma(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function r9(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Le&&e.selection.node.isBlock)return!r.parentOffset||!hr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],a,l,u=!1,c=!1;for(let g=r.depth;;g--)if(r.node(g).isBlock){u=r.end(g)==r.pos+(r.depth-g),c=r.start(g)==r.pos-(r.depth-g),l=Um(r.node(g-1).contentMatchAt(r.indexAfter(g-1))),s.unshift(u&&l?{type:l}:null),a=g;break}else{if(g==1)return!1;s.unshift(null)}let f=e.tr;(e.selection instanceof Te||e.selection instanceof Rn)&&f.deleteSelection();let p=f.mapping.map(r.pos),m=hr(f.doc,p,s.length,s);if(m||(s[0]=l?{type:l}:null,m=hr(f.doc,p,s.length,s)),f.split(p,s.length,s),!u&&c&&r.node(a).type!=l){let g=f.mapping.map(r.before(a)),b=f.doc.resolve(g);l&&r.node(a-1).canReplaceWith(b.index(),b.index()+1,l)&&f.setNodeMarkup(f.mapping.map(r.before(a)),l)}return n&&n(f.scrollIntoView()),!0}}const o9=r9(),i9=(t,e)=>{let{$from:n,to:r}=t.selection,o,s=n.sharedDepth(r);return s==0?!1:(o=n.before(s),e&&e(t.tr.setSelection(Le.create(t.doc,o))),!0)},s9=(t,e)=>(e&&e(t.tr.setSelection(new Rn(t.doc))),!0);function a9(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||Ri(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function K3(t,e,n,r){let o=e.nodeBefore,s=e.nodeAfter,a,l,u=o.type.spec.isolating||s.type.spec.isolating;if(!u&&a9(t,e,n))return!0;let c=!u&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(a=(l=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&l.matchType(a[0]||s.type).validEnd){if(n){let g=e.pos+s.nodeSize,b=de.empty;for(let x=a.length-1;x>=0;x--)b=de.from(a[x].create(null,b));b=de.from(o.copy(b));let y=t.tr.step(new vn(e.pos-1,g,e.pos,g,new Ce(b,1,0),a.length,!0)),w=y.doc.resolve(g+2*a.length);w.nodeAfter&&w.nodeAfter.type==o.type&&Ri(y.doc,w.pos)&&y.join(w.pos),n(y.scrollIntoView())}return!0}let f=s.type.spec.isolating||r>0&&u?null:Ve.findFrom(e,1),p=f&&f.$from.blockRange(f.$to),m=p&&Ma(p);if(m!=null&&m>=e.depth)return n&&n(t.tr.lift(p,m).scrollIntoView()),!0;if(c&&Ha(s,"start",!0)&&Ha(o,"end")){let g=o,b=[];for(;b.push(g),!g.isTextblock;)g=g.lastChild;let y=s,w=1;for(;!y.isTextblock;y=y.firstChild)w++;if(g.canReplace(g.childCount,g.childCount,y.content)){if(n){let x=de.empty;for(let k=b.length-1;k>=0;k--)x=de.from(b[k].copy(x));let E=t.tr.step(new vn(e.pos-b.length,e.pos+s.nodeSize,e.pos+w,e.pos+s.nodeSize-w,new Ce(x,b.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function G3(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(n&&n(e.tr.setSelection(Te.create(e.doc,t<0?o.start(s):o.end(s)))),!0):!1}}const l9=G3(-1),u9=G3(1);function c9(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s),l=a&&im(a,t,e);return l?(r&&r(n.tr.wrap(a,l).scrollIntoView()),!0):!1}}function X3(t,e=null){return function(n,r){let o=!1;for(let s=0;s<n.selection.ranges.length&&!o;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];n.doc.nodesBetween(a,l,(u,c)=>{if(o)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)o=!0;else{let f=n.doc.resolve(c),p=f.index();o=f.parent.canReplaceWith(p,p+1,t)}})}if(!o)return!1;if(r){let s=n.tr;for(let a=0;a<n.selection.ranges.length;a++){let{$from:{pos:l},$to:{pos:u}}=n.selection.ranges[a];s.setBlockType(l,u,t,e)}r(s.scrollIntoView())}return!0}}function Wm(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}Wm(pu,V3,$3),Wm(pu,H3,U3),Wm(W3,j3,q3,o9),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function d9(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s);if(!a)return!1;let l=r?n.tr:null;return f9(l,a,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function f9(t,e,n,r=null){let o=!1,s=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=a.resolve(e.start-2);s=new jc(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new jc(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=im(s,n,r,e);return l?(t&&p9(t,e,l,o,n),!0):!1}function p9(t,e,n,r,o){let s=de.empty;for(let f=n.length-1;f>=0;f--)s=de.from(n[f].type.create(n[f].attrs,s));t.step(new vn(e.start-(r?2:0),e.end,e.start,e.end,new Ce(s,0,0),n.length,!0));let a=0;for(let f=0;f<n.length;f++)n[f].type==o&&(a=f+1);let l=n.length-a,u=e.start+n.length-(r?2:0),c=e.parent;for(let f=e.startIndex,p=e.endIndex,m=!0;f<p;f++,m=!1)!m&&hr(t.doc,u,l)&&(t.split(u,l),u+=2*l),u+=c.child(f).nodeSize;return t}function h9(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,a=>a.childCount>0&&a.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?m9(e,n,t,s):g9(e,n,s):!0:!1}}function m9(t,e,n,r){let o=t.tr,s=r.end,a=r.$to.end(r.depth);s<a&&(o.step(new vn(s-1,a,s,a,new Ce(de.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new jc(o.doc.resolve(r.$from.pos),o.doc.resolve(a),r.depth));const l=Ma(r);if(l==null)return!1;o.lift(r,l);let u=o.doc.resolve(o.mapping.map(s,-1)-1);return Ri(o.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&o.join(u.pos),e(o.scrollIntoView()),!0}function g9(t,e,n){let r=t.tr,o=n.parent;for(let g=n.end,b=n.endIndex-1,y=n.startIndex;b>y;b--)g-=o.child(b).nodeSize,r.delete(g-1,g+1);let s=r.doc.resolve(n.start),a=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,u=n.endIndex==o.childCount,c=s.node(-1),f=s.index(-1);if(!c.canReplace(f+(l?0:1),f+1,a.content.append(u?de.empty:de.from(o))))return!1;let p=s.pos,m=p+a.nodeSize;return r.step(new vn(p-(l?1:0),m+(u?1:0),p+1,m-1,new Ce((l?de.empty:de.from(o.copy(de.empty))).append(u?de.empty:de.from(o.copy(de.empty))),l?0:1,u?0:1),l?0:1)),e(r.scrollIntoView()),!0}function b9(t){return function(e,n){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!s)return!1;let a=s.startIndex;if(a==0)return!1;let l=s.parent,u=l.child(a-1);if(u.type!=t)return!1;if(n){let c=u.lastChild&&u.lastChild.type==l.type,f=de.from(c?t.create():null),p=new Ce(de.from(t.create(null,de.from(l.type.create(null,f)))),c?3:1,0),m=s.start,g=s.end;n(e.tr.step(new vn(m-(c?3:1),g,m,g,p,1,!0)).scrollIntoView())}return!0}}function ud(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}class cd{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:r}=this,{view:o}=n,{tr:s}=r,a=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,u])=>[l,(...f)=>{const p=u(...f)(a);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(s),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:a}=o,l=[],u=!!e,c=e||s.tr,f=()=>(!u&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(c),l.every(m=>m===!0)),p={...Object.fromEntries(Object.entries(r).map(([m,g])=>[m,(...y)=>{const w=this.buildProps(c,n),x=g(...y)(w);return l.push(x),p}])),run:f};return p}createCan(e){const{rawCommands:n,state:r}=this,o=!1,s=e||r.tr,a=this.buildProps(s,o);return{...Object.fromEntries(Object.entries(n).map(([u,c])=>[u,(...f)=>c(...f)({...a,dispatch:void 0})])),chain:()=>this.createChain(s,o)}}buildProps(e,n=!0){const{rawCommands:r,editor:o,state:s}=this,{view:a}=o,l={tr:e,editor:o,view:a,state:ud({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,c])=>[u,(...f)=>c(...f)(l)]))}};return l}}class v9{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(o=>o!==n):delete this.callbacks[e]),this}once(e,n){const r=(...o)=>{this.off(e,r),n.apply(this,o)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function Ie(t,e,n){return t.config[e]===void 0&&t.parent?Ie(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?Ie(t.parent,e,n):null}):t.config[e]}function dd(t){const e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function Y3(t){const e=[],{nodeExtensions:n,markExtensions:r}=dd(t),o=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage,extensions:o},u=Ie(a,"addGlobalAttributes",l);if(!u)return;u().forEach(f=>{f.types.forEach(p=>{Object.entries(f.attributes).forEach(([m,g])=>{e.push({type:p,name:m,attribute:{...s,...g}})})})})}),o.forEach(a=>{const l={name:a.name,options:a.options,storage:a.storage},u=Ie(a,"addAttributes",l);if(!u)return;const c=u();Object.entries(c).forEach(([f,p])=>{const m={...s,...p};typeof(m==null?void 0:m.default)=="function"&&(m.default=m.default()),m!=null&&m.isRequired&&(m==null?void 0:m.default)===void 0&&delete m.default,e.push({type:a.name,name:f,attribute:m})})}),e}function hn(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function bt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const l=s?String(s).split(" "):[],u=r[o]?r[o].split(" "):[],c=l.filter(f=>!u.includes(f));r[o]=[...u,...c].join(" ")}else if(o==="style"){const l=s?s.split(";").map(f=>f.trim()).filter(Boolean):[],u=r[o]?r[o].split(";").map(f=>f.trim()).filter(Boolean):[],c=new Map;u.forEach(f=>{const[p,m]=f.split(":").map(g=>g.trim());c.set(p,m)}),l.forEach(f=>{const[p,m]=f.split(":").map(g=>g.trim());c.set(p,m)}),r[o]=Array.from(c.entries()).map(([f,p])=>`${f}: ${p}`).join("; ")}else r[o]=s}),r},{})}function jm(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>bt(n,r),{})}function J3(t){return typeof t=="function"}function at(t,e=void 0,...n){return J3(t)?e?t.bind(e)(...n):t(...n):t}function y9(t={}){return Object.keys(t).length===0&&t.constructor===Object}function w9(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Z3(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const o=e.reduce((s,a)=>{const l=a.attribute.parseHTML?a.attribute.parseHTML(n):w9(n.getAttribute(a.name));return l==null?s:{...s,[a.name]:l}},{});return{...r,...o}}}}function Q3(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&y9(n)?!1:n!=null))}function x9(t,e){var n;const r=Y3(t),{nodeExtensions:o,markExtensions:s}=dd(t),a=(n=o.find(c=>Ie(c,"topNode")))===null||n===void 0?void 0:n.name,l=Object.fromEntries(o.map(c=>{const f=r.filter(x=>x.type===c.name),p={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((x,E)=>{const k=Ie(E,"extendNodeSchema",p);return{...x,...k?k(c):{}}},{}),g=Q3({...m,content:at(Ie(c,"content",p)),marks:at(Ie(c,"marks",p)),group:at(Ie(c,"group",p)),inline:at(Ie(c,"inline",p)),atom:at(Ie(c,"atom",p)),selectable:at(Ie(c,"selectable",p)),draggable:at(Ie(c,"draggable",p)),code:at(Ie(c,"code",p)),whitespace:at(Ie(c,"whitespace",p)),linebreakReplacement:at(Ie(c,"linebreakReplacement",p)),defining:at(Ie(c,"defining",p)),isolating:at(Ie(c,"isolating",p)),attrs:Object.fromEntries(f.map(x=>{var E;return[x.name,{default:(E=x==null?void 0:x.attribute)===null||E===void 0?void 0:E.default}]}))}),b=at(Ie(c,"parseHTML",p));b&&(g.parseDOM=b.map(x=>Z3(x,f)));const y=Ie(c,"renderHTML",p);y&&(g.toDOM=x=>y({node:x,HTMLAttributes:jm(x,f)}));const w=Ie(c,"renderText",p);return w&&(g.toText=w),[c.name,g]})),u=Object.fromEntries(s.map(c=>{const f=r.filter(w=>w.type===c.name),p={name:c.name,options:c.options,storage:c.storage,editor:e},m=t.reduce((w,x)=>{const E=Ie(x,"extendMarkSchema",p);return{...w,...E?E(c):{}}},{}),g=Q3({...m,inclusive:at(Ie(c,"inclusive",p)),excludes:at(Ie(c,"excludes",p)),group:at(Ie(c,"group",p)),spanning:at(Ie(c,"spanning",p)),code:at(Ie(c,"code",p)),attrs:Object.fromEntries(f.map(w=>{var x;return[w.name,{default:(x=w==null?void 0:w.attribute)===null||x===void 0?void 0:x.default}]}))}),b=at(Ie(c,"parseHTML",p));b&&(g.parseDOM=b.map(w=>Z3(w,f)));const y=Ie(c,"renderHTML",p);return y&&(g.toDOM=w=>y({mark:w,HTMLAttributes:jm(w,f)})),[c.name,g]}));return new W2({topNode:a,nodes:l,marks:u})}function qm(t,e){return e.nodes[t]||e.marks[t]||null}function N3(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Km(t,e){const n=to.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}const C9=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,s,a,l)=>{var u,c;const f=((c=(u=o.type.spec).toText)===null||c===void 0?void 0:c.call(u,{node:o,pos:s,parent:a,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?f:f.slice(0,Math.max(0,r-s))}),n};function Gm(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class fd{constructor(e){this.find=e.find,this.handler=e.handler}}const E9=(t,e)=>{if(Gm(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function pd(t){var e;const{editor:n,from:r,to:o,text:s,rules:a,plugin:l}=t,{view:u}=n;if(u.composing)return!1;const c=u.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(m=>m.type.spec.code))return!1;let f=!1;const p=C9(c)+s;return a.forEach(m=>{if(f)return;const g=E9(p,m.find);if(!g)return;const b=u.state.tr,y=ud({state:u.state,transaction:b}),w={from:r-(g[0].length-s.length),to:o},{commands:x,chain:E,can:k}=new cd({editor:n,state:y});m.handler({state:y,range:w,match:g,commands:x,chain:E,can:k})===null||!b.steps.length||(b.setMeta(l,{transform:b,from:r,to:o,text:s}),u.dispatch(b),f=!0)}),f}function k9(t){const{editor:e,rules:n}=t,r=new tt({state:{init(){return null},apply(o,s,a){const l=o.getMeta(r);if(l)return l;const u=o.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:f}=u;typeof f=="string"?f=f:f=Km(de.from(f),a.schema);const{from:p}=u,m=p+f.length;pd({editor:e,from:p,to:m,text:f,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,a,l){return pd({editor:e,from:s,to:a,text:l,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&pd({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:a}=o.state.selection;return a?pd({editor:e,from:a.pos,to:a.pos,text:`
|
|
11
11
|
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function S9(t){return Object.prototype.toString.call(t).slice(8,-1)}function hd(t){return S9(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function md(t,e){const n={...t};return hd(t)&&hd(e)&&Object.keys(e).forEach(r=>{hd(e[r])&&hd(t[r])?n[r]=md(t[r],e[r]):n[r]=e[r]}),n}class Dn{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=at(Ie(this,"addOptions",{name:this.name}))),this.storage=at(Ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Dn(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>md(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Dn(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=at(Ie(n,"addOptions",{name:n.name})),n.storage=at(Ie(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const a=o.marks();if(!!!a.find(c=>(c==null?void 0:c.type.name)===n.name))return!1;const u=a.find(c=>(c==null?void 0:c.type.name)===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}}function _9(t){return typeof t=="number"}class T9{constructor(e){this.find=e.find,this.handler=e.handler}}const A9=(t,e,n)=>{if(Gm(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=t,s.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(o.replaceWith)),s}):[]};function O9(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:a,dropEvent:l}=t,{commands:u,chain:c,can:f}=new cd({editor:e,state:n}),p=[];return n.doc.nodesBetween(r,o,(g,b)=>{if(!g.isTextblock||g.type.spec.code)return;const y=Math.max(r,b),w=Math.min(o,b+g.content.size),x=g.textBetween(y-b,w-b,void 0,"");A9(x,s.find,a).forEach(k=>{if(k.index===void 0)return;const C=y+k.index+1,_=C+k[0].length,A={from:n.tr.mapping.map(C),to:n.tr.mapping.map(_)},T=s.handler({state:n,range:A,match:k,commands:u,chain:c,can:f,pasteEvent:a,dropEvent:l});p.push(T)})}),p.every(g=>g!==null)}let gd=null;const M9=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function B9(t){const{editor:e,rules:n}=t;let r=null,o=!1,s=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const u=({state:f,from:p,to:m,rule:g,pasteEvt:b})=>{const y=f.tr,w=ud({state:f,transaction:y});if(!(!O9({editor:e,state:w,from:Math.max(p-1,0),to:m.b-1,rule:g,pasteEvent:b,dropEvent:l})||!y.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,y}};return n.map(f=>new tt({view(p){const m=b=>{var y;r=!((y=p.dom.parentElement)===null||y===void 0)&&y.contains(b.target)?p.dom.parentElement:null,r&&(gd=e)},g=()=>{gd&&(gd=null)};return window.addEventListener("dragstart",m),window.addEventListener("dragend",g),{destroy(){window.removeEventListener("dragstart",m),window.removeEventListener("dragend",g)}}},props:{handleDOMEvents:{drop:(p,m)=>{if(s=r===p.dom.parentElement,l=m,!s){const g=gd;g&&setTimeout(()=>{const b=g.state.selection;b&&g.commands.deleteRange({from:b.from,to:b.to})},10)}return!1},paste:(p,m)=>{var g;const b=(g=m.clipboardData)===null||g===void 0?void 0:g.getData("text/html");return a=m,o=!!(b!=null&&b.includes("data-pm-slice")),!1}}},appendTransaction:(p,m,g)=>{const b=p[0],y=b.getMeta("uiEvent")==="paste"&&!o,w=b.getMeta("uiEvent")==="drop"&&!s,x=b.getMeta("applyPasteRules"),E=!!x;if(!y&&!w&&!E)return;if(E){let{text:_}=x;typeof _=="string"?_=_:_=Km(de.from(_),g.schema);const{from:A}=x,T=A+_.length,P=M9(_);return u({rule:f,state:g,from:A,to:{b:T},pasteEvt:P})}const k=m.doc.content.findDiffStart(g.doc.content),C=m.doc.content.findDiffEnd(g.doc.content);if(!(!_9(k)||!C||k===C.b))return u({rule:f,state:g,from:k,to:C,pasteEvt:a})}}))}function I9(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Ua{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Ua.resolve(e),this.schema=x9(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Ua.sort(Ua.flatten(e)),r=I9(n.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},o=Ie(n,"addExtensions",r);return o?[n,...this.flatten(o())]:n}).flat(10)}static sort(e){return e.sort((r,o)=>{const s=Ie(r,"priority")||100,a=Ie(o,"priority")||100;return s>a?-1:s<a?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:qm(n.name,this.schema)},o=Ie(n,"addCommands",r);return o?{...e,...o()}:e},{})}get plugins(){const{editor:e}=this,n=Ua.sort([...this.extensions].reverse()),r=[],o=[],s=n.map(a=>{const l={name:a.name,options:a.options,storage:a.storage,editor:e,type:qm(a.name,this.schema)},u=[],c=Ie(a,"addKeyboardShortcuts",l);let f={};if(a.type==="mark"&&Ie(a,"exitable",l)&&(f.ArrowRight=()=>Dn.handleExit({editor:e,mark:a})),c){const y=Object.fromEntries(Object.entries(c()).map(([w,x])=>[w,()=>x({editor:e})]));f={...f,...y}}const p=JA(f);u.push(p);const m=Ie(a,"addInputRules",l);N3(a,e.options.enableInputRules)&&m&&r.push(...m());const g=Ie(a,"addPasteRules",l);N3(a,e.options.enablePasteRules)&&g&&o.push(...g());const b=Ie(a,"addProseMirrorPlugins",l);if(b){const y=b();u.push(...y)}return u}).flat();return[k9({editor:e,rules:r}),...B9({editor:e,rules:o}),...s]}get attributes(){return Y3(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=dd(this.extensions);return Object.fromEntries(n.filter(r=>!!Ie(r,"addNodeView")).map(r=>{const o=this.attributes.filter(u=>u.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:hn(r.name,this.schema)},a=Ie(r,"addNodeView",s);if(!a)return[];const l=(u,c,f,p,m)=>{const g=jm(u,o);return a()({node:u,view:c,getPos:f,decorations:p,innerDecorations:m,editor:e,extension:r,HTMLAttributes:g})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:qm(e.name,this.schema)};e.type==="mark"&&(!((n=at(Ie(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const o=Ie(e,"onBeforeCreate",r),s=Ie(e,"onCreate",r),a=Ie(e,"onUpdate",r),l=Ie(e,"onSelectionUpdate",r),u=Ie(e,"onTransaction",r),c=Ie(e,"onFocus",r),f=Ie(e,"onBlur",r),p=Ie(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),c&&this.editor.on("focus",c),f&&this.editor.on("blur",f),p&&this.editor.on("destroy",p)})}}class Ze{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=at(Ie(this,"addOptions",{name:this.name}))),this.storage=at(Ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Ze(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>md(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Ze({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=at(Ie(n,"addOptions",{name:n.name})),n.storage=at(Ie(n,"addStorage",{name:n.name,options:n.options})),n}}function e4(t,e,n){const{from:r,to:o}=e,{blockSeparator:s=`
|
|
12
12
|
|
|
13
|
-
`,textSerializers:a={}}=n||{};let l="";return t.nodesBetween(r,o,(u,c,f,p)=>{var m;u.isBlock&&c>r&&(l+=s);const g=a==null?void 0:a[u.type.name];if(g)return f&&(l+=g({node:u,pos:c,parent:f,index:p,range:e})),!1;u.isText&&(l+=(m=u==null?void 0:u.text)===null||m===void 0?void 0:m.slice(Math.max(r,c)-c,o-c))}),l}function Xm(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const R9=Ze.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new tt({key:new kt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,a=Math.min(...s.map(f=>f.$from.pos)),l=Math.max(...s.map(f=>f.$to.pos)),u=Xm(n);return e4(r,{from:a,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),L9=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),P9=(t=!1)=>({commands:e})=>e.setContent("",t),D9=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:a})=>{t.doc.nodesBetween(s.pos,a.pos,(l,u)=>{if(l.type.isText)return;const{doc:c,mapping:f}=e,p=c.resolve(f.map(u)),m=c.resolve(f.map(u+l.nodeSize)),g=p.blockRange(m);if(!g)return;const b=Ma(g);if(l.type.isTextblock){const{defaultType:y}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(g.start,y)}(b||b===0)&&e.lift(g,b)})}),!0},V9=t=>e=>t(e),F9=()=>({state:t,dispatch:e})=>j3(t,e),$9=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const a=r.mapping.map(e);return r.insert(a,s.content),r.setSelection(new Te(r.doc.resolve(a-1))),!0},z9=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const l=o.before(s),u=o.after(s);t.delete(l,u).scrollIntoView()}return!0}return!1},H9=t=>({tr:e,state:n,dispatch:r})=>{const o=hn(t,n.schema),s=e.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===o){if(r){const u=s.before(a),c=s.after(a);e.delete(u,c).scrollIntoView()}return!0}return!1},U9=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},W9=()=>({state:t,dispatch:e})=>pu(t,e),j9=()=>({commands:t})=>t.keyboardShortcut("Enter"),q9=()=>({state:t,dispatch:e})=>n9(t,e);function bd(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Gm(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function t4(t,e,n={}){return t.find(r=>r.type===e&&bd(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function n4(t,e,n={}){return!!t4(t,e,n)}function vd(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(f=>f.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(f=>f.type===e)||(n=n||((r=o.node.marks[0])===null||r===void 0?void 0:r.attrs),!t4([...o.node.marks],e,n)))return;let a=o.index,l=t.start()+o.offset,u=a+1,c=l+o.node.nodeSize;for(;a>0&&n4([...t.parent.child(a-1).marks],e,n);)a-=1,l-=t.parent.child(a).nodeSize;for(;u<t.parent.childCount&&n4([...t.parent.child(u).marks],e,n);)c+=t.parent.child(u).nodeSize,u+=1;return{from:l,to:c}}function Wi(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const K9=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=Wi(t,r.schema),{doc:a,selection:l}=n,{$from:u,from:c,to:f}=l;if(o){const p=vd(u,s,e);if(p&&p.from<=c&&p.to>=f){const m=Te.create(a,p.from,p.to);n.setSelection(m)}}return!0},G9=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Ym(t){return t instanceof Te}function ti(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function r4(t,e=null){if(!e)return null;const n=De.atStart(t),r=De.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?Te.create(t,ti(0,o,s),ti(t.content.size,o,s)):Te.create(t,ti(e,o,s),ti(e,o,s))}function o4(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function yd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const X9=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const a=()=>{(yd()||o4())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!Ym(n.state.selection))return a(),!0;const l=r4(o.doc,t)||n.state.selection,u=n.state.selection.eq(l);return s&&(u||o.setSelection(l),u&&o.storedMarks&&o.setStoredMarks(o.storedMarks),a()),!0},Y9=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),J9=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),i4=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&i4(r)}return t};function wd(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return i4(n)}function xd(t,e,n){if(t instanceof eo||t instanceof de)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return de.fromArray(t.map(l=>e.nodeFromJSON(l)));const a=e.nodeFromJSON(t);return n.errorOnInvalidContent&&a.check(),a}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),xd("",e,n)}if(o){if(n.errorOnInvalidContent){let a=!1,l="";const u=new W2({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(a=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Zl.fromSchema(u).parseSlice(wd(t),n.parseOptions):Zl.fromSchema(u).parse(wd(t),n.parseOptions),n.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Zl.fromSchema(e);return n.slice?s.parseSlice(wd(t),n.parseOptions).content:s.parse(wd(t),n.parseOptions)}return xd("",e,n)}function Z9(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof fn||o instanceof vn))return;const s=t.mapping.maps[r];let a=0;s.forEach((l,u,c,f)=>{a===0&&(a=f)}),t.setSelection(De.near(t.doc.resolve(a),n))}const Q9=t=>!("type"in t),N9=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var a;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;try{l=xd(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(a=n.errorOnInvalidContent)!==null&&a!==void 0?a:s.options.enableContentCheck})}catch(b){return s.emit("contentError",{editor:s,error:b,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:u,to:c}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((Q9(l)?l:[l]).forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,p=p?b.isBlock:!1}),u===c&&p){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,c+=1)}let g;if(f){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof de){let b="";e.forEach(y=>{y.text&&(b+=y.text)}),g=b}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,c)}else g=l,r.replaceWith(u,c,g);n.updateSelection&&Z9(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},eO=()=>({state:t,dispatch:e})=>NA(t,e),tO=()=>({state:t,dispatch:e})=>e9(t,e),nO=()=>({state:t,dispatch:e})=>V3(t,e),rO=()=>({state:t,dispatch:e})=>H3(t,e),oO=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},iO=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},sO=()=>({state:t,dispatch:e})=>ZA(t,e),aO=()=>({state:t,dispatch:e})=>QA(t,e);function s4(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function lO(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,a;for(let l=0;l<e.length-1;l+=1){const u=e[l];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))yd()||s4()?a=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const uO=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=lO(t).split(/-(?!$)/),a=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return u==null||u.steps.forEach(c=>{const f=c.map(r.mapping);f&&o&&r.maybeStep(f)}),!0};function hu(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,a=e?hn(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(p,m)=>{if(p.isText)return;const g=Math.max(r,m),b=Math.min(o,m+p.nodeSize);l.push({node:p,from:g,to:b})});const u=o-r,c=l.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>bd(p.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((p,m)=>p+m.to-m.from,0)>=u}const cO=(t,e={})=>({state:n,dispatch:r})=>{const o=hn(t,n.schema);return hu(n,o,e)?t9(n,r):!1},dO=()=>({state:t,dispatch:e})=>q3(t,e),fO=t=>({state:e,dispatch:n})=>{const r=hn(t,e.schema);return h9(r)(e,n)},pO=()=>({state:t,dispatch:e})=>W3(t,e);function Cd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function a4(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const hO=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,a=null;const l=Cd(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=hn(t,r.schema)),l==="mark"&&(a=Wi(t,r.schema)),o&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,f)=>{s&&s===c.type&&n.setNodeMarkup(f,void 0,a4(c.attrs,e)),a&&c.marks.length&&c.marks.forEach(p=>{a===p.type&&n.addMark(f,f+c.nodeSize,a.create(a4(p.attrs,e)))})})}),!0):!1},mO=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),gO=()=>({tr:t,dispatch:e})=>{if(e){const n=new Rn(t.doc);t.setSelection(n)}return!0},bO=()=>({state:t,dispatch:e})=>$3(t,e),vO=()=>({state:t,dispatch:e})=>U3(t,e),yO=()=>({state:t,dispatch:e})=>i9(t,e),wO=()=>({state:t,dispatch:e})=>u9(t,e),xO=()=>({state:t,dispatch:e})=>l9(t,e);function Jm(t,e,n={},r={}){return xd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const CO=(t,e=!1,n={},r={})=>({editor:o,tr:s,dispatch:a,commands:l})=>{var u,c;const{doc:f}=s;if(n.preserveWhitespace!=="full"){const p=Jm(t,o.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:o.options.enableContentCheck});return a&&s.replaceWith(0,f.content.size,p).setMeta("preventUpdate",!e),!0}return a&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:f.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck})};function Zm(t,e){const n=Wi(e,t.schema),{from:r,to:o,empty:s}=t.selection,a=[];s?(t.storedMarks&&a.push(...t.storedMarks),a.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,u=>{a.push(...u.marks)});const l=a.find(u=>u.type.name===n.name);return l?{...l.attrs}:{}}function EO(t,e){const n=new lm(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function l4(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Qm(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function u4(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function c4(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ni(t){return e=>c4(e.$from,t)}function d4(t,e){const n={from:0,to:t.content.size};return e4(t,n,e)}function kO(t,e){const n=hn(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,l=>{s.push(l)});const a=s.reverse().find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function f4(t,e){const n=Cd(typeof e=="string"?e:e.name,t.schema);return n==="node"?kO(t,e):n==="mark"?Zm(t,e):{}}function SO(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function _O(t){const e=SO(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,a)=>a!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function TO(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const a=[];if(o.ranges.length)o.forEach((l,u)=>{a.push({from:l,to:u})});else{const{from:l,to:u}=n[s];if(l===void 0||u===void 0)return;a.push({from:l,to:u})}a.forEach(({from:l,to:u})=>{const c=e.slice(s).map(l,-1),f=e.slice(s).map(u),p=e.invert().map(c,-1),m=e.invert().map(f);r.push({oldRange:{from:p,to:m},newRange:{from:c,to:f}})})}),_O(r)}function Nm(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),a=vd(s,o.type);a&&r.push({mark:o,...a})}):n.nodesBetween(t,e,(o,s)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(a=>({from:s,to:s+o.nodeSize,mark:a})))}),r}function Ed(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}function e0(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Wi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>bd(p.attrs,n,{strict:!1}));let a=0;const l=[];if(o.forEach(({$from:p,$to:m})=>{const g=p.pos,b=m.pos;t.doc.nodesBetween(g,b,(y,w)=>{if(!y.isText&&!y.marks.length)return;const x=Math.max(g,w),E=Math.min(b,w+y.nodeSize),k=E-x;a+=k,l.push(...y.marks.map(C=>({mark:C,from:x,to:E})))})}),a===0)return!1;const u=l.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>bd(p.mark.attrs,n,{strict:!1})).reduce((p,m)=>p+m.to-m.from,0),c=l.filter(p=>s?p.mark.type!==s&&p.mark.type.excludes(s):!0).reduce((p,m)=>p+m.to-m.from,0);return(u>0?u+c:u)>=a}function t0(t,e,n={}){if(!e)return hu(t,null,n)||e0(t,null,n);const r=Cd(e,t.schema);return r==="node"?hu(t,e,n):r==="mark"?e0(t,e,n):!1}function n0(t,e){const{nodeExtensions:n}=dd(e),r=n.find(a=>a.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=at(Ie(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function kd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(s=>{o!==!1&&(kd(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function p4(t){return t instanceof Le}function h4(t,e,n){const o=t.state.doc.content.size,s=ti(e,0,o),a=ti(n,0,o),l=t.coordsAtPos(s),u=t.coordsAtPos(a,-1),c=Math.min(l.top,u.top),f=Math.max(l.bottom,u.bottom),p=Math.min(l.left,u.left),m=Math.max(l.right,u.right),g=m-p,b=f-c,x={top:c,bottom:f,left:p,right:m,width:g,height:b,x:p,y:c};return{...x,toJSON:()=>x}}function AO(t,e,n){var r;const{selection:o}=e;let s=null;if(Ym(o)&&(s=o.$cursor),s){const l=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(l)||!l.some(u=>u.type.excludes(n))}const{ranges:a}=o;return a.some(({$from:l,$to:u})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,u.pos,(f,p,m)=>{if(c)return!1;if(f.isInline){const g=!m||m.type.allowsMarkType(n),b=!!n.isInSet(f.marks)||!f.marks.some(y=>y.type.excludes(n));c=g&&b}return!c}),c})}const OO=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:a,ranges:l}=s,u=Wi(t,r.schema);if(o)if(a){const c=Zm(r,u);n.addStoredMark(u.create({...c,...e}))}else l.forEach(c=>{const f=c.$from.pos,p=c.$to.pos;r.doc.nodesBetween(f,p,(m,g)=>{const b=Math.max(g,f),y=Math.min(g+m.nodeSize,p);m.marks.find(x=>x.type===u)?m.marks.forEach(x=>{u===x.type&&n.addMark(b,y,u.create({...x.attrs,...e}))}):n.addMark(b,y,u.create(e))})});return AO(r,n,u)},MO=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),BO=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=hn(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:l})=>X3(s,{...a,...e})(n)?!0:l.clearNodes()).command(({state:l})=>X3(s,{...a,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},IO=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=ti(t,0,r.content.size),s=Le.create(r,o);e.setSelection(s)}return!0},RO=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,a=Te.atStart(r).from,l=Te.atEnd(r).to,u=ti(o,a,l),c=ti(s,a,l),f=Te.create(r,u,c);e.setSelection(f)}return!0},LO=t=>({state:e,dispatch:n})=>{const r=hn(t,e.schema);return b9(r)(e,n)};function m4(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}const PO=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=o.extensionManager.attributes,f=Ed(c,l.node().type.name,l.node().attrs);if(s instanceof Le&&s.node.isBlock)return!l.parentOffset||!hr(a,l.pos)?!1:(r&&(t&&m4(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const p=u.parentOffset===u.parent.content.size,m=l.depth===0?void 0:l4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=hr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&hr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(b=!0,g=m?[{type:m,attrs:f}]:void 0),r){if(b&&(s instanceof Te&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,g),m&&!p&&!l.parentOffset&&l.parent.type!==m)){const y=e.mapping.map(l.before()),w=e.doc.resolve(y);l.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&m4(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return b},DO=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var a;const l=hn(t,r.schema),{$from:u,$to:c}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(c))return!1;const p=u.node(-1);if(p.type!==l)return!1;const m=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==l||u.index(-2)!==u.node(-2).childCount-1)return!1;if(o){let x=de.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-E;P>=u.depth-3;P-=1)x=de.from(u.node(P).copy(x));const k=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,C={...Ed(m,u.node().type.name,u.node().attrs),...e},_=((a=l.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill(C))||void 0;x=x.append(de.from(l.createAndFill(null,_)||void 0));const A=u.before(u.depth-(E-1));n.replace(A,u.after(-k),new Ce(x,4-E,0));let T=-1;n.doc.nodesBetween(A,n.doc.content.size,(P,I)=>{if(T>-1)return!1;P.isTextblock&&P.content.size===0&&(T=I+1)}),T>-1&&n.setSelection(Te.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const g=c.pos===u.end()?p.contentMatchAt(0).defaultType:null,b={...Ed(m,p.type.name,p.attrs),...e},y={...Ed(m,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,c.pos);const w=g?[{type:l,attrs:b},{type:g,attrs:y}]:[{type:l,attrs:b}];if(!hr(n.doc,u.pos,2))return!1;if(o){const{selection:x,storedMarks:E}=r,{splittableMarks:k}=s.extensionManager,C=E||x.$to.parentOffset&&x.$from.marks();if(n.split(u.pos,2,w).scrollIntoView(),!C||!o)return!0;const _=C.filter(A=>k.includes(A.type.name));n.ensureMarks(_)}return!0},r0=(t,e)=>{const n=ni(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&Ri(t.doc,n.pos)&&t.join(n.pos),!0},o0=(t,e)=>{const n=ni(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&Ri(t.doc,r)&&t.join(r),!0};var VO=Object.freeze({__proto__:null,blur:L9,clearContent:P9,clearNodes:D9,command:V9,createParagraphNear:F9,cut:$9,deleteCurrentNode:z9,deleteNode:H9,deleteRange:U9,deleteSelection:W9,enter:j9,exitCode:q9,extendMarkRange:K9,first:G9,focus:X9,forEach:Y9,insertContent:J9,insertContentAt:N9,joinBackward:nO,joinDown:tO,joinForward:rO,joinItemBackward:oO,joinItemForward:iO,joinTextblockBackward:sO,joinTextblockForward:aO,joinUp:eO,keyboardShortcut:uO,lift:cO,liftEmptyBlock:dO,liftListItem:fO,newlineInCode:pO,resetAttributes:hO,scrollIntoView:mO,selectAll:gO,selectNodeBackward:bO,selectNodeForward:vO,selectParentNode:yO,selectTextblockEnd:wO,selectTextblockStart:xO,setContent:CO,setMark:OO,setMeta:MO,setNode:BO,setNodeSelection:IO,setTextSelection:RO,sinkListItem:LO,splitBlock:PO,splitListItem:DO,toggleList:(t,e,n,r={})=>({editor:o,tr:s,state:a,dispatch:l,chain:u,commands:c,can:f})=>{const{extensions:p,splittableMarks:m}=o.extensionManager,g=hn(t,a.schema),b=hn(e,a.schema),{selection:y,storedMarks:w}=a,{$from:x,$to:E}=y,k=x.blockRange(E),C=w||y.$to.parentOffset&&y.$from.marks();if(!k)return!1;const _=ni(A=>n0(A.type.name,p))(y);if(k.depth>=1&&_&&k.depth-_.depth<=1){if(_.node.type===g)return c.liftListItem(b);if(n0(_.node.type.name,p)&&g.validContent(_.node.content)&&l)return u().command(()=>(s.setNodeMarkup(_.pos,g),!0)).command(()=>r0(s,g)).command(()=>o0(s,g)).run()}return!n||!C||!l?u().command(()=>f().wrapInList(g,r)?!0:c.clearNodes()).wrapInList(g,r).command(()=>r0(s,g)).command(()=>o0(s,g)).run():u().command(()=>{const A=f().wrapInList(g,r),T=C.filter(P=>m.includes(P.type.name));return s.ensureMarks(T),A?!0:c.clearNodes()}).wrapInList(g,r).command(()=>r0(s,g)).command(()=>o0(s,g)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,a=Wi(t,r.schema);return e0(r,a,e)?o.unsetMark(a,{extendEmptyMarkRange:s}):o.setMark(a,e)},toggleNode:(t,e,n={})=>({state:r,commands:o})=>{const s=hn(t,r.schema),a=hn(e,r.schema),l=hu(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),l?o.setNode(a,u):o.setNode(s,{...u,...n})},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const o=hn(t,n.schema);return hu(n,o,e)?r.lift(o):r.wrapIn(o,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const a=t.tr,l=s.transform;for(let u=l.steps.length-1;u>=0;u-=1)a.step(l.steps[u].invert(l.docs[u]));if(s.text){const u=a.doc.resolve(s.from).marks();a.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else a.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:a=!1}=e,{selection:l}=n,u=Wi(t,r.schema),{$from:c,empty:f,ranges:p}=l;if(!o)return!0;if(f&&a){let{from:m,to:g}=l;const b=(s=c.marks().find(w=>w.type===u))===null||s===void 0?void 0:s.attrs,y=vd(c,u,b);y&&(m=y.from,g=y.to),n.removeMark(m,g,u)}else p.forEach(m=>{n.removeMark(m.$from.pos,m.$to.pos,u)});return n.removeStoredMark(u),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,a=null;const l=Cd(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=hn(t,r.schema)),l==="mark"&&(a=Wi(t,r.schema)),o&&n.selection.ranges.forEach(u=>{const c=u.$from.pos,f=u.$to.pos;let p,m,g,b;n.selection.empty?r.doc.nodesBetween(c,f,(y,w)=>{s&&s===y.type&&(g=Math.max(w,c),b=Math.min(w+y.nodeSize,f),p=w,m=y)}):r.doc.nodesBetween(c,f,(y,w)=>{w<c&&s&&s===y.type&&(g=Math.max(w,c),b=Math.min(w+y.nodeSize,f),p=w,m=y),w>=c&&w<=f&&(s&&s===y.type&&n.setNodeMarkup(w,void 0,{...y.attrs,...e}),a&&y.marks.length&&y.marks.forEach(x=>{if(a===x.type){const E=Math.max(w,c),k=Math.min(w+y.nodeSize,f);n.addMark(E,k,a.create({...x.attrs,...e}))}}))}),m&&(p!==void 0&&n.setNodeMarkup(p,void 0,{...m.attrs,...e}),a&&m.marks.length&&m.marks.forEach(y=>{a===y.type&&n.addMark(g,b,a.create({...y.attrs,...e}))}))}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const o=hn(t,n.schema);return c9(o,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const o=hn(t,n.schema);return d9(o,e)(n,r)}});const FO=Ze.create({name:"commands",addCommands(){return{...VO}}}),$O=Ze.create({name:"drop",addProseMirrorPlugins(){return[new tt({key:new kt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),zO=Ze.create({name:"editable",addProseMirrorPlugins(){return[new tt({key:new kt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),HO=Ze.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new tt({key:new kt("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),UO=Ze.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:l})=>{const{selection:u,doc:c}=l,{empty:f,$anchor:p}=u,{pos:m,parent:g}=p,b=p.parent.isTextblock&&m>0?l.doc.resolve(m-1):p,y=b.parent.type.spec.isolating,w=p.pos-p.parentOffset,x=y&&b.parent.childCount===1?w===p.pos:De.atStart(c).from===m;return!f||!g.type.isTextblock||g.textContent.length||!x||x&&p.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return yd()||s4()?s:o},addProseMirrorPlugins(){return[new tt({key:new kt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(y=>y.getMeta("composition")))return;const r=t.some(y=>y.docChanged)&&!e.doc.eq(n.doc),o=t.some(y=>y.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:a,to:l}=e.selection,u=De.atStart(e.doc).from,c=De.atEnd(e.doc).to;if(s||!(a===u&&l===c)||!kd(n.doc))return;const m=n.tr,g=ud({state:n,transaction:m}),{commands:b}=new cd({editor:this.editor,state:g});if(b.clearNodes(),!!m.steps.length)return m}})]}}),WO=Ze.create({name:"paste",addProseMirrorPlugins(){return[new tt({key:new kt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),jO=Ze.create({name:"tabindex",addProseMirrorPlugins(){return[new tt({key:new kt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ds{get name(){return this.node.type.name}constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Ds(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ds(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Ds(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,a=this.pos+r+(s?0:1),l=this.resolvedPos.doc.resolve(a);if(!o&&l.depth<=this.depth)return;const u=new Ds(l,this.editor,o,o?n:null);o&&(u.actualDepth=this.depth+1),e.push(new Ds(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const s=o.node.attrs,a=Object.keys(n);for(let l=0;l<a.length;l+=1){const u=a[l];if(s[u]!==n[u])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(n);return this.children.forEach(a=>{r&&o.length>0||(a.node.type.name===e&&s.every(u=>n[u]===a.node.attrs[u])&&o.push(a),!(r&&o.length>0)&&(o=o.concat(a.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const qO=`.ProseMirror {
|
|
13
|
+
`,textSerializers:a={}}=n||{};let l="";return t.nodesBetween(r,o,(u,c,f,p)=>{var m;u.isBlock&&c>r&&(l+=s);const g=a==null?void 0:a[u.type.name];if(g)return f&&(l+=g({node:u,pos:c,parent:f,index:p,range:e})),!1;u.isText&&(l+=(m=u==null?void 0:u.text)===null||m===void 0?void 0:m.slice(Math.max(r,c)-c,o-c))}),l}function Xm(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const R9=Ze.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new tt({key:new kt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,a=Math.min(...s.map(f=>f.$from.pos)),l=Math.max(...s.map(f=>f.$to.pos)),u=Xm(n);return e4(r,{from:a,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),L9=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),P9=(t=!1)=>({commands:e})=>e.setContent("",t),D9=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:s,$to:a})=>{t.doc.nodesBetween(s.pos,a.pos,(l,u)=>{if(l.type.isText)return;const{doc:c,mapping:f}=e,p=c.resolve(f.map(u)),m=c.resolve(f.map(u+l.nodeSize)),g=p.blockRange(m);if(!g)return;const b=Ma(g);if(l.type.isTextblock){const{defaultType:y}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(g.start,y)}(b||b===0)&&e.lift(g,b)})}),!0},V9=t=>e=>t(e),F9=()=>({state:t,dispatch:e})=>j3(t,e),$9=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,s=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const a=r.mapping.map(e);return r.insert(a,s.content),r.setSelection(new Te(r.doc.resolve(a-1))),!0},z9=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const l=o.before(s),u=o.after(s);t.delete(l,u).scrollIntoView()}return!0}return!1},H9=t=>({tr:e,state:n,dispatch:r})=>{const o=hn(t,n.schema),s=e.selection.$anchor;for(let a=s.depth;a>0;a-=1)if(s.node(a).type===o){if(r){const u=s.before(a),c=s.after(a);e.delete(u,c).scrollIntoView()}return!0}return!1},U9=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},W9=()=>({state:t,dispatch:e})=>pu(t,e),j9=()=>({commands:t})=>t.keyboardShortcut("Enter"),q9=()=>({state:t,dispatch:e})=>n9(t,e);function bd(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Gm(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function t4(t,e,n={}){return t.find(r=>r.type===e&&bd(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function n4(t,e,n={}){return!!t4(t,e,n)}function vd(t,e,n){var r;if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if((!o.node||!o.node.marks.some(f=>f.type===e))&&(o=t.parent.childBefore(t.parentOffset)),!o.node||!o.node.marks.some(f=>f.type===e)||(n=n||((r=o.node.marks[0])===null||r===void 0?void 0:r.attrs),!t4([...o.node.marks],e,n)))return;let a=o.index,l=t.start()+o.offset,u=a+1,c=l+o.node.nodeSize;for(;a>0&&n4([...t.parent.child(a-1).marks],e,n);)a-=1,l-=t.parent.child(a).nodeSize;for(;u<t.parent.childCount&&n4([...t.parent.child(u).marks],e,n);)c+=t.parent.child(u).nodeSize,u+=1;return{from:l,to:c}}function Wi(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const K9=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const s=Wi(t,r.schema),{doc:a,selection:l}=n,{$from:u,from:c,to:f}=l;if(o){const p=vd(u,s,e);if(p&&p.from<=c&&p.to>=f){const m=Te.create(a,p.from,p.to);n.setSelection(m)}}return!0},G9=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Ym(t){return t instanceof Te}function ti(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function r4(t,e=null){if(!e)return null;const n=Ve.atStart(t),r=Ve.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const o=n.from,s=r.to;return e==="all"?Te.create(t,ti(0,o,s),ti(t.content.size,o,s)):Te.create(t,ti(e,o,s),ti(e,o,s))}function o4(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function yd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const X9=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const a=()=>{(yd()||o4())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!Ym(n.state.selection))return a(),!0;const l=r4(o.doc,t)||n.state.selection,u=n.state.selection.eq(l);return s&&(u||o.setSelection(l),u&&o.storedMarks&&o.setStoredMarks(o.storedMarks),a()),!0},Y9=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),J9=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),i4=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&i4(r)}return t};function wd(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return i4(n)}function xd(t,e,n){if(t instanceof eo||t instanceof de)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return de.fromArray(t.map(l=>e.nodeFromJSON(l)));const a=e.nodeFromJSON(t);return n.errorOnInvalidContent&&a.check(),a}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),xd("",e,n)}if(o){if(n.errorOnInvalidContent){let a=!1,l="";const u=new W2({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(a=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Zl.fromSchema(u).parseSlice(wd(t),n.parseOptions):Zl.fromSchema(u).parse(wd(t),n.parseOptions),n.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=Zl.fromSchema(e);return n.slice?s.parseSlice(wd(t),n.parseOptions).content:s.parse(wd(t),n.parseOptions)}return xd("",e,n)}function Z9(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof fn||o instanceof vn))return;const s=t.mapping.maps[r];let a=0;s.forEach((l,u,c,f)=>{a===0&&(a=f)}),t.setSelection(Ve.near(t.doc.resolve(a),n))}const Q9=t=>!("type"in t),N9=(t,e,n)=>({tr:r,dispatch:o,editor:s})=>{var a;if(o){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;try{l=xd(e,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(a=n.errorOnInvalidContent)!==null&&a!==void 0?a:s.options.enableContentCheck})}catch(b){return s.emit("contentError",{editor:s,error:b,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:u,to:c}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,p=!0;if((Q9(l)?l:[l]).forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,p=p?b.isBlock:!1}),u===c&&p){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,c+=1)}let g;if(f){if(Array.isArray(e))g=e.map(b=>b.text||"").join("");else if(e instanceof de){let b="";e.forEach(y=>{y.text&&(b+=y.text)}),g=b}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,c)}else g=l,r.replaceWith(u,c,g);n.updateSelection&&Z9(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},eO=()=>({state:t,dispatch:e})=>NA(t,e),tO=()=>({state:t,dispatch:e})=>e9(t,e),nO=()=>({state:t,dispatch:e})=>V3(t,e),rO=()=>({state:t,dispatch:e})=>H3(t,e),oO=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},iO=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Zc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},sO=()=>({state:t,dispatch:e})=>ZA(t,e),aO=()=>({state:t,dispatch:e})=>QA(t,e);function s4(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function lO(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,o,s,a;for(let l=0;l<e.length-1;l+=1){const u=e[l];if(/^(cmd|meta|m)$/i.test(u))a=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))o=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))yd()||s4()?a=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),a&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const uO=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=lO(t).split(/-(?!$)/),a=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return u==null||u.steps.forEach(c=>{const f=c.map(r.mapping);f&&o&&r.maybeStep(f)}),!0};function hu(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,a=e?hn(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(p,m)=>{if(p.isText)return;const g=Math.max(r,m),b=Math.min(o,m+p.nodeSize);l.push({node:p,from:g,to:b})});const u=o-r,c=l.filter(p=>a?a.name===p.node.type.name:!0).filter(p=>bd(p.node.attrs,n,{strict:!1}));return s?!!c.length:c.reduce((p,m)=>p+m.to-m.from,0)>=u}const cO=(t,e={})=>({state:n,dispatch:r})=>{const o=hn(t,n.schema);return hu(n,o,e)?t9(n,r):!1},dO=()=>({state:t,dispatch:e})=>q3(t,e),fO=t=>({state:e,dispatch:n})=>{const r=hn(t,e.schema);return h9(r)(e,n)},pO=()=>({state:t,dispatch:e})=>W3(t,e);function Cd(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function a4(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const hO=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,a=null;const l=Cd(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=hn(t,r.schema)),l==="mark"&&(a=Wi(t,r.schema)),o&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,f)=>{s&&s===c.type&&n.setNodeMarkup(f,void 0,a4(c.attrs,e)),a&&c.marks.length&&c.marks.forEach(p=>{a===p.type&&n.addMark(f,f+c.nodeSize,a.create(a4(p.attrs,e)))})})}),!0):!1},mO=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),gO=()=>({tr:t,dispatch:e})=>{if(e){const n=new Rn(t.doc);t.setSelection(n)}return!0},bO=()=>({state:t,dispatch:e})=>$3(t,e),vO=()=>({state:t,dispatch:e})=>U3(t,e),yO=()=>({state:t,dispatch:e})=>i9(t,e),wO=()=>({state:t,dispatch:e})=>u9(t,e),xO=()=>({state:t,dispatch:e})=>l9(t,e);function Jm(t,e,n={},r={}){return xd(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const CO=(t,e=!1,n={},r={})=>({editor:o,tr:s,dispatch:a,commands:l})=>{var u,c;const{doc:f}=s;if(n.preserveWhitespace!=="full"){const p=Jm(t,o.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:o.options.enableContentCheck});return a&&s.replaceWith(0,f.content.size,p).setMeta("preventUpdate",!e),!0}return a&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:f.content.size},t,{parseOptions:n,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:o.options.enableContentCheck})};function Zm(t,e){const n=Wi(e,t.schema),{from:r,to:o,empty:s}=t.selection,a=[];s?(t.storedMarks&&a.push(...t.storedMarks),a.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,u=>{a.push(...u.marks)});const l=a.find(u=>u.type.name===n.name);return l?{...l.attrs}:{}}function EO(t,e){const n=new lm(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function l4(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Qm(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function u4(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(o,s)=>{n(o)&&r.push({node:o,pos:s})}),r}function c4(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function ni(t){return e=>c4(e.$from,t)}function d4(t,e){const n={from:0,to:t.content.size};return e4(t,n,e)}function kO(t,e){const n=hn(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,l=>{s.push(l)});const a=s.reverse().find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function f4(t,e){const n=Cd(typeof e=="string"?e:e.name,t.schema);return n==="node"?kO(t,e):n==="mark"?Zm(t,e):{}}function SO(t,e=JSON.stringify){const n={};return t.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function _O(t){const e=SO(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,a)=>a!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function TO(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,s)=>{const a=[];if(o.ranges.length)o.forEach((l,u)=>{a.push({from:l,to:u})});else{const{from:l,to:u}=n[s];if(l===void 0||u===void 0)return;a.push({from:l,to:u})}a.forEach(({from:l,to:u})=>{const c=e.slice(s).map(l,-1),f=e.slice(s).map(u),p=e.invert().map(c,-1),m=e.invert().map(f);r.push({oldRange:{from:p,to:m},newRange:{from:c,to:f}})})}),_O(r)}function Nm(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const s=n.resolve(t),a=vd(s,o.type);a&&r.push({mark:o,...a})}):n.nodesBetween(t,e,(o,s)=>{!o||(o==null?void 0:o.nodeSize)===void 0||r.push(...o.marks.map(a=>({from:s,to:s+o.nodeSize,mark:a})))}),r}function Ed(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}function e0(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?Wi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(p=>s?s.name===p.type.name:!0).find(p=>bd(p.attrs,n,{strict:!1}));let a=0;const l=[];if(o.forEach(({$from:p,$to:m})=>{const g=p.pos,b=m.pos;t.doc.nodesBetween(g,b,(y,w)=>{if(!y.isText&&!y.marks.length)return;const x=Math.max(g,w),E=Math.min(b,w+y.nodeSize),k=E-x;a+=k,l.push(...y.marks.map(C=>({mark:C,from:x,to:E})))})}),a===0)return!1;const u=l.filter(p=>s?s.name===p.mark.type.name:!0).filter(p=>bd(p.mark.attrs,n,{strict:!1})).reduce((p,m)=>p+m.to-m.from,0),c=l.filter(p=>s?p.mark.type!==s&&p.mark.type.excludes(s):!0).reduce((p,m)=>p+m.to-m.from,0);return(u>0?u+c:u)>=a}function t0(t,e,n={}){if(!e)return hu(t,null,n)||e0(t,null,n);const r=Cd(e,t.schema);return r==="node"?hu(t,e,n):r==="mark"?e0(t,e,n):!1}function n0(t,e){const{nodeExtensions:n}=dd(e),r=n.find(a=>a.name===t);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=at(Ie(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function kd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let o=!0;return t.content.forEach(s=>{o!==!1&&(kd(s,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function p4(t){return t instanceof Le}function h4(t,e,n){const o=t.state.doc.content.size,s=ti(e,0,o),a=ti(n,0,o),l=t.coordsAtPos(s),u=t.coordsAtPos(a,-1),c=Math.min(l.top,u.top),f=Math.max(l.bottom,u.bottom),p=Math.min(l.left,u.left),m=Math.max(l.right,u.right),g=m-p,b=f-c,x={top:c,bottom:f,left:p,right:m,width:g,height:b,x:p,y:c};return{...x,toJSON:()=>x}}function AO(t,e,n){var r;const{selection:o}=e;let s=null;if(Ym(o)&&(s=o.$cursor),s){const l=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(l)||!l.some(u=>u.type.excludes(n))}const{ranges:a}=o;return a.some(({$from:l,$to:u})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,u.pos,(f,p,m)=>{if(c)return!1;if(f.isInline){const g=!m||m.type.allowsMarkType(n),b=!!n.isInSet(f.marks)||!f.marks.some(y=>y.type.excludes(n));c=g&&b}return!c}),c})}const OO=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:a,ranges:l}=s,u=Wi(t,r.schema);if(o)if(a){const c=Zm(r,u);n.addStoredMark(u.create({...c,...e}))}else l.forEach(c=>{const f=c.$from.pos,p=c.$to.pos;r.doc.nodesBetween(f,p,(m,g)=>{const b=Math.max(g,f),y=Math.min(g+m.nodeSize,p);m.marks.find(x=>x.type===u)?m.marks.forEach(x=>{u===x.type&&n.addMark(b,y,u.create({...x.attrs,...e}))}):n.addMark(b,y,u.create(e))})});return AO(r,n,u)},MO=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),BO=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const s=hn(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:l})=>X3(s,{...a,...e})(n)?!0:l.clearNodes()).command(({state:l})=>X3(s,{...a,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},IO=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,o=ti(t,0,r.content.size),s=Le.create(r,o);e.setSelection(s)}return!0},RO=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:o,to:s}=typeof t=="number"?{from:t,to:t}:t,a=Te.atStart(r).from,l=Te.atEnd(r).to,u=ti(o,a,l),c=ti(s,a,l),f=Te.create(r,u,c);e.setSelection(f)}return!0},LO=t=>({state:e,dispatch:n})=>{const r=hn(t,e.schema);return b9(r)(e,n)};function m4(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}const PO=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=o.extensionManager.attributes,f=Ed(c,l.node().type.name,l.node().attrs);if(s instanceof Le&&s.node.isBlock)return!l.parentOffset||!hr(a,l.pos)?!1:(r&&(t&&m4(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const p=u.parentOffset===u.parent.content.size,m=l.depth===0?void 0:l4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=hr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&hr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(b=!0,g=m?[{type:m,attrs:f}]:void 0),r){if(b&&(s instanceof Te&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,g),m&&!p&&!l.parentOffset&&l.parent.type!==m)){const y=e.mapping.map(l.before()),w=e.doc.resolve(y);l.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&m4(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return b},DO=(t,e={})=>({tr:n,state:r,dispatch:o,editor:s})=>{var a;const l=hn(t,r.schema),{$from:u,$to:c}=r.selection,f=r.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(c))return!1;const p=u.node(-1);if(p.type!==l)return!1;const m=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==l||u.index(-2)!==u.node(-2).childCount-1)return!1;if(o){let x=de.empty;const E=u.index(-1)?1:u.index(-2)?2:3;for(let P=u.depth-E;P>=u.depth-3;P-=1)x=de.from(u.node(P).copy(x));const k=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,C={...Ed(m,u.node().type.name,u.node().attrs),...e},_=((a=l.contentMatch.defaultType)===null||a===void 0?void 0:a.createAndFill(C))||void 0;x=x.append(de.from(l.createAndFill(null,_)||void 0));const A=u.before(u.depth-(E-1));n.replace(A,u.after(-k),new Ce(x,4-E,0));let T=-1;n.doc.nodesBetween(A,n.doc.content.size,(P,I)=>{if(T>-1)return!1;P.isTextblock&&P.content.size===0&&(T=I+1)}),T>-1&&n.setSelection(Te.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}const g=c.pos===u.end()?p.contentMatchAt(0).defaultType:null,b={...Ed(m,p.type.name,p.attrs),...e},y={...Ed(m,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,c.pos);const w=g?[{type:l,attrs:b},{type:g,attrs:y}]:[{type:l,attrs:b}];if(!hr(n.doc,u.pos,2))return!1;if(o){const{selection:x,storedMarks:E}=r,{splittableMarks:k}=s.extensionManager,C=E||x.$to.parentOffset&&x.$from.marks();if(n.split(u.pos,2,w).scrollIntoView(),!C||!o)return!0;const _=C.filter(A=>k.includes(A.type.name));n.ensureMarks(_)}return!0},r0=(t,e)=>{const n=ni(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&Ri(t.doc,n.pos)&&t.join(n.pos),!0},o0=(t,e)=>{const n=ni(a=>a.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===(o==null?void 0:o.type)&&Ri(t.doc,r)&&t.join(r),!0};var VO=Object.freeze({__proto__:null,blur:L9,clearContent:P9,clearNodes:D9,command:V9,createParagraphNear:F9,cut:$9,deleteCurrentNode:z9,deleteNode:H9,deleteRange:U9,deleteSelection:W9,enter:j9,exitCode:q9,extendMarkRange:K9,first:G9,focus:X9,forEach:Y9,insertContent:J9,insertContentAt:N9,joinBackward:nO,joinDown:tO,joinForward:rO,joinItemBackward:oO,joinItemForward:iO,joinTextblockBackward:sO,joinTextblockForward:aO,joinUp:eO,keyboardShortcut:uO,lift:cO,liftEmptyBlock:dO,liftListItem:fO,newlineInCode:pO,resetAttributes:hO,scrollIntoView:mO,selectAll:gO,selectNodeBackward:bO,selectNodeForward:vO,selectParentNode:yO,selectTextblockEnd:wO,selectTextblockStart:xO,setContent:CO,setMark:OO,setMeta:MO,setNode:BO,setNodeSelection:IO,setTextSelection:RO,sinkListItem:LO,splitBlock:PO,splitListItem:DO,toggleList:(t,e,n,r={})=>({editor:o,tr:s,state:a,dispatch:l,chain:u,commands:c,can:f})=>{const{extensions:p,splittableMarks:m}=o.extensionManager,g=hn(t,a.schema),b=hn(e,a.schema),{selection:y,storedMarks:w}=a,{$from:x,$to:E}=y,k=x.blockRange(E),C=w||y.$to.parentOffset&&y.$from.marks();if(!k)return!1;const _=ni(A=>n0(A.type.name,p))(y);if(k.depth>=1&&_&&k.depth-_.depth<=1){if(_.node.type===g)return c.liftListItem(b);if(n0(_.node.type.name,p)&&g.validContent(_.node.content)&&l)return u().command(()=>(s.setNodeMarkup(_.pos,g),!0)).command(()=>r0(s,g)).command(()=>o0(s,g)).run()}return!n||!C||!l?u().command(()=>f().wrapInList(g,r)?!0:c.clearNodes()).wrapInList(g,r).command(()=>r0(s,g)).command(()=>o0(s,g)).run():u().command(()=>{const A=f().wrapInList(g,r),T=C.filter(P=>m.includes(P.type.name));return s.ensureMarks(T),A?!0:c.clearNodes()}).wrapInList(g,r).command(()=>r0(s,g)).command(()=>o0(s,g)).run()},toggleMark:(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,a=Wi(t,r.schema);return e0(r,a,e)?o.unsetMark(a,{extendEmptyMarkRange:s}):o.setMark(a,e)},toggleNode:(t,e,n={})=>({state:r,commands:o})=>{const s=hn(t,r.schema),a=hn(e,r.schema),l=hu(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),l?o.setNode(a,u):o.setNode(s,{...u,...n})},toggleWrap:(t,e={})=>({state:n,commands:r})=>{const o=hn(t,n.schema);return hu(n,o,e)?r.lift(o):r.wrapIn(o,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const a=t.tr,l=s.transform;for(let u=l.steps.length-1;u>=0;u-=1)a.step(l.steps[u].invert(l.docs[u]));if(s.text){const u=a.doc.resolve(s.from).marks();a.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else a.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:a=!1}=e,{selection:l}=n,u=Wi(t,r.schema),{$from:c,empty:f,ranges:p}=l;if(!o)return!0;if(f&&a){let{from:m,to:g}=l;const b=(s=c.marks().find(w=>w.type===u))===null||s===void 0?void 0:s.attrs,y=vd(c,u,b);y&&(m=y.from,g=y.to),n.removeMark(m,g,u)}else p.forEach(m=>{n.removeMark(m.$from.pos,m.$to.pos,u)});return n.removeStoredMark(u),!0},updateAttributes:(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,a=null;const l=Cd(typeof t=="string"?t:t.name,r.schema);return l?(l==="node"&&(s=hn(t,r.schema)),l==="mark"&&(a=Wi(t,r.schema)),o&&n.selection.ranges.forEach(u=>{const c=u.$from.pos,f=u.$to.pos;let p,m,g,b;n.selection.empty?r.doc.nodesBetween(c,f,(y,w)=>{s&&s===y.type&&(g=Math.max(w,c),b=Math.min(w+y.nodeSize,f),p=w,m=y)}):r.doc.nodesBetween(c,f,(y,w)=>{w<c&&s&&s===y.type&&(g=Math.max(w,c),b=Math.min(w+y.nodeSize,f),p=w,m=y),w>=c&&w<=f&&(s&&s===y.type&&n.setNodeMarkup(w,void 0,{...y.attrs,...e}),a&&y.marks.length&&y.marks.forEach(x=>{if(a===x.type){const E=Math.max(w,c),k=Math.min(w+y.nodeSize,f);n.addMark(E,k,a.create({...x.attrs,...e}))}}))}),m&&(p!==void 0&&n.setNodeMarkup(p,void 0,{...m.attrs,...e}),a&&m.marks.length&&m.marks.forEach(y=>{a===y.type&&n.addMark(g,b,a.create({...y.attrs,...e}))}))}),!0):!1},wrapIn:(t,e={})=>({state:n,dispatch:r})=>{const o=hn(t,n.schema);return c9(o,e)(n,r)},wrapInList:(t,e={})=>({state:n,dispatch:r})=>{const o=hn(t,n.schema);return d9(o,e)(n,r)}});const FO=Ze.create({name:"commands",addCommands(){return{...VO}}}),$O=Ze.create({name:"drop",addProseMirrorPlugins(){return[new tt({key:new kt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),zO=Ze.create({name:"editable",addProseMirrorPlugins(){return[new tt({key:new kt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),HO=Ze.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new tt({key:new kt("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),UO=Ze.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:a})=>[()=>a.undoInputRule(),()=>a.command(({tr:l})=>{const{selection:u,doc:c}=l,{empty:f,$anchor:p}=u,{pos:m,parent:g}=p,b=p.parent.isTextblock&&m>0?l.doc.resolve(m-1):p,y=b.parent.type.spec.isolating,w=p.pos-p.parentOffset,x=y&&b.parent.childCount===1?w===p.pos:Ve.atStart(c).from===m;return!f||!g.type.isTextblock||g.textContent.length||!x||x&&p.parent.type.name==="paragraph"?!1:a.clearNodes()}),()=>a.deleteSelection(),()=>a.joinBackward(),()=>a.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:a})=>[()=>a.deleteSelection(),()=>a.deleteCurrentNode(),()=>a.joinForward(),()=>a.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:a})=>[()=>a.newlineInCode(),()=>a.createParagraphNear(),()=>a.liftEmptyBlock(),()=>a.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return yd()||s4()?s:o},addProseMirrorPlugins(){return[new tt({key:new kt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(y=>y.getMeta("composition")))return;const r=t.some(y=>y.docChanged)&&!e.doc.eq(n.doc),o=t.some(y=>y.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:a,to:l}=e.selection,u=Ve.atStart(e.doc).from,c=Ve.atEnd(e.doc).to;if(s||!(a===u&&l===c)||!kd(n.doc))return;const m=n.tr,g=ud({state:n,transaction:m}),{commands:b}=new cd({editor:this.editor,state:g});if(b.clearNodes(),!!m.steps.length)return m}})]}}),WO=Ze.create({name:"paste",addProseMirrorPlugins(){return[new tt({key:new kt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),jO=Ze.create({name:"tabindex",addProseMirrorPlugins(){return[new tt({key:new kt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Ds{get name(){return this.node.type.name}constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Ds(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ds(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Ds(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,a=this.pos+r+(s?0:1),l=this.resolvedPos.doc.resolve(a);if(!o&&l.depth<=this.depth)return;const u=new Ds(l,this.editor,o,o?n:null);o&&(u.actualDepth=this.depth+1),e.push(new Ds(l,this.editor,o,o?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){const s=o.node.attrs,a=Object.keys(n);for(let l=0;l<a.length;l+=1){const u=a[l];if(s[u]!==n[u])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(n);return this.children.forEach(a=>{r&&o.length>0||(a.node.type.name===e&&s.every(u=>n[u]===a.node.attrs[u])&&o.push(a),!(r&&o.length>0)&&(o=o.concat(a.querySelectorAll(e,n,r))))}),o}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const qO=`.ProseMirror {
|
|
14
14
|
position: relative;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -106,7 +106,7 @@ img.ProseMirror-separator {
|
|
|
106
106
|
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
107
107
|
|
|
108
108
|
`,`1) content: element.innerHTML
|
|
109
|
-
`,"2) content: () => element.cloneNode(true)"].join(" "))}var l=o.reduce(function(u,c){var f=c&&AB(c,r);return f&&u.push(f),u},[]);return Eu(t)?l[0]:l}Hs.defaultProps=gr,Hs.setDefaultProps=kB,Hs.currentInput=To,Object.assign({},w4,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});var OB={name:"sticky",defaultValue:!1,fn:function(e){var n=e.reference,r=e.popper;function o(){return e.popperInstance?e.popperInstance.state.elements.reference:n}function s(c){return e.props.sticky===!0||e.props.sticky===c}var a=null,l=null;function u(){var c=s("reference")?o().getBoundingClientRect():null,f=s("popper")?r.getBoundingClientRect():null;(c&&rw(a,c)||f&&rw(l,f))&&e.popperInstance&&e.popperInstance.update(),a=c,l=f,e.state.isMounted&&requestAnimationFrame(u)}return{onMount:function(){e.props.sticky&&u()}}}};function rw(t,e){return t&&e?t.top!==e.top||t.right!==e.right||t.bottom!==e.bottom||t.left!==e.left:!0}Hs.setDefaultProps({render:nw});class MB{constructor({editor:e,element:n,view:r,tippyOptions:o={},updateDelay:s=250,shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:l,state:u,from:c,to:f})=>{const{doc:p,selection:m}=u,{empty:g}=m,b=!p.textBetween(c,f).length&&Ym(u.selection),y=this.element.contains(document.activeElement);return!(!(l.hasFocus()||y)||g||b||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var u;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((u=this.element.parentNode)===null||u===void 0)&&u.contains(l.relatedTarget))||(l==null?void 0:l.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,u)=>{const c=!(u!=null&&u.selection.eq(l.state.selection)),f=!(u!=null&&u.doc.eq(l.state.doc));!c&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,c,f,u)},this.updateDelay))},this.updateHandler=(l,u,c,f)=>{var p,m,g;const{state:b,composing:y}=l,{selection:w}=b;if(y||!u&&!c)return;this.createTooltip();const{ranges:E}=w,k=Math.min(...E.map(A=>A.$from.pos)),C=Math.max(...E.map(A=>A.$to.pos));if(!((p=this.shouldShow)===null||p===void 0?void 0:p.call(this,{editor:this.editor,element:this.element,view:l,state:b,oldState:f,from:k,to:C}))){this.hide();return}(m=this.tippy)===null||m===void 0||m.setProps({getReferenceClientRect:((g=this.tippyOptions)===null||g===void 0?void 0:g.getReferenceClientRect)||(()=>{if(p4(b.selection)){let A=l.nodeDOM(k);if(A){const T=A.dataset.nodeViewWrapper?A:A.querySelector("[data-node-view-wrapper]");if(T&&(A=T.firstChild),A)return A.getBoundingClientRect()}}return h4(l,k,C)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=Hs(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,o=r.selection.from!==r.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,n);return}const s=!(n!=null&&n.selection.eq(e.state.selection)),a=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,s,a,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ow=t=>new tt({key:typeof t.pluginKey=="string"?new kt(t.pluginKey):t.pluginKey,view:e=>new MB({view:e,...t})});Ze.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[ow({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class BB{getTextContent(e){return d4(e,{textSerializers:Xm(this.editor.schema)})}constructor({editor:e,element:n,view:r,tippyOptions:o={},shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l})=>{const{selection:u}=l,{$anchor:c,empty:f}=u,p=c.depth===1,m=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!a.hasFocus()||!f||!p||!m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.editor=e,this.element=n,this.view=r,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=Hs(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,o,s;const{state:a}=e,{doc:l,selection:u}=a,{from:c,to:f}=u;if(n&&n.doc.eq(l)&&n.selection.eq(u))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:a,oldState:n}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:((s=this.tippyOptions)===null||s===void 0?void 0:s.getReferenceClientRect)||(()=>h4(e,c,f))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const iw=t=>new tt({key:typeof t.pluginKey=="string"?new kt(t.pluginKey):t.pluginKey,view:e=>new BB({view:e,...t})});Ze.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[iw({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const Su=i.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=i.ref(null);return i.onMounted(()=>{const{updateDelay:r,editor:o,pluginKey:s,shouldShow:a,tippyOptions:l}=t;o.registerPlugin(ow({updateDelay:r,editor:o,element:n.value,pluginKey:s,shouldShow:a,tippyOptions:l}))}),i.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=t;o.unregisterPlugin(r)}),()=>{var r;return i.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function sw(t){return i.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class ii extends GO{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=sw(this.view.state),this.reactiveExtensionStorage=sw(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),i.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const r=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const Ao=i.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=i.ref(),n=i.getCurrentInstance();return i.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&i.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const o=i.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:o}),r.createNodeViews()})}),i.onBeforeUnmount(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return i.h("div",{ref:t=>{this.rootEl=t}})}});i.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=i.ref(null);return i.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:s,shouldShow:a}=t;o.registerPlugin(iw({pluginKey:r,editor:o,element:n.value,tippyOptions:s,shouldShow:a}))}),i.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=t;o.unregisterPlugin(r)}),()=>{var r;return i.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});const aw=i.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return i.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Us=i.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return i.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}}),IB=(t={})=>{const e=i.shallowRef();return i.onMounted(()=>{e.value=new ii(t)}),i.onBeforeUnmount(()=>{var n,r,o;const s=(n=e.value)===null||n===void 0?void 0:n.options.element,a=s==null?void 0:s.cloneNode(!0);(r=s==null?void 0:s.parentNode)===null||r===void 0||r.replaceChild(a,s),(o=e.value)===null||o===void 0||o.destroy()}),e};class lw{constructor(e,{props:n={},editor:r}){this.editor=r,this.component=i.markRaw(e),this.el=document.createElement("div"),this.props=i.reactive(n),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,n,r,o;return!((n=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||n===void 0)&&n.exposed?this.renderedComponent.vNode.component.exposed:(o=(r=this.renderedComponent.vNode)===null||r===void 0?void 0:r.component)===null||o===void 0?void 0:o.proxy}renderComponent(){let e=i.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&i.render(e,this.el),{vNode:e,destroy:()=>{this.el&&i.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([n,r])=>{this.props[n]=r}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const Ws={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class RB extends XO{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},n=this.onDragStart.bind(this);this.decorationClasses=i.ref(this.getDecorationClasses());const r=i.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:o=>{var s,a;return i.provide("onDragStart",n),i.provide("decorationClasses",this.decorationClasses),(a=(s=this.component).setup)===null||a===void 0?void 0:a.call(s,o,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new lw(r,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&n>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n,r){const o=s=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(s)};if(typeof this.options.update=="function"){const s=this.node,a=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=r,this.options.update({oldNode:s,oldDecorations:a,newNode:e,newDecorations:n,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>o({node:e,decorations:n,innerDecorations:r})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===n&&this.innerDecorations===r||(this.node=e,this.decorations=n,this.innerDecorations=r,o({node:e,decorations:n,innerDecorations:r})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.map(e=>e.type.attrs.class).flat().join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function js(t,e){return n=>{if(!n.editor.contentComponent)return{};const r=typeof t=="function"&&"__vccOpts"in t?t.__vccOpts:t;return new RB(r,n,e)}}const Bd={SPACING:1,SPELLING:2},LB={NOTHING_TO_CHANGE:"NOTHING_TO_CHANGE"},oo={LOADING:"loading",HAS_ERROR:"hasError",NO_ERROR:"noError",FAIL:"fail"},Oo={EDITOR_COMMENT:"editorComment",EDITOR_CONTENT:"editorContent"},E0={ANDROID:"android",IOS:"ios"},PB="ko",Mo=200,DB=20,uw=1e5,cw=16,Id=10,Rd=10,Ld=2,VB="#262626",FB=["#000000","#262626","#595959","#8C8C8C","#BFBFBF","#D9D9D9","#E9E9E9","#F5F5F5","#FAFAFA","#FFFFFF","#F5222D","#FA541C","#FA8C16","#FADB14","#52C41A","#13C2C2","#1890FF","#2F54EB","#722ED1","#EB2F96","#FFE8E6","#FFECE0","#FFEFD1","#FCFCCA","#E4F7D2","#D3F5F0","#D4EEFC","#DEE8FC","#EFE1FA","#FAE1EB","#FFA39E","#FFBB96","#FFD591","#FFFB8F","#B7EB8F","#87E8DE","#91D5FF","#ADC6FF","#D3ADF7","#FFADD2","#FF4D4F","#FF7A45","#FFA940","#FFEC3D","#73D13D","#36CFC9","#40A9FF","#597EF7","#9254DE","#F759AB","#CF1322","#D4380D","#D46B08","#D4B106","#389E0D","#08979C","#096DD9","#1D39C4","#531DAB","#C41D7F","#820014","#871400","#873800","#614700","#135200","#00474F","#003A8C","#061178","#22075E","#780650"],k0=["10px","11px","12px","14px","16px","18px","20px","22px","24px","26px","28px","36px","48px","72px"],Ja="defaut";var Pd=(t=>(t[t["size-small"]=480]="size-small",t[t["size-medium"]=640]="size-medium",t["size-large"]="100%",t))(Pd||{});const dw="1",$B={image:["divider","image-size-small","image-size-medium","image-size-large","divider","image-left","image-center","image-right","divider","image-aspect-ratio","remove"],text:["Ai","divider","text-bubble","divider","bold","italic","underline","strike","code","link","divider","color","highlight","textAlign"],video:["video-size-small","video-size-medium","video-size-large","divider","remove"]},_u={SAVE:"ctrl+s,command+s"};var Ve=(t=>(t.COMPARE="compare",t.EDITOR="editor",t.STRAIGHT="straight",t.REPORT="report",t.PLAIN_TEXT="plainText",t.SUPER_VIEW_MOBILE="superViewMobile",t))(Ve||{}),or=(t=>(t.COMMENT="editor-comment-section",t.DISABLE_SUPER_INPUT="data-disable-super-input",t))(or||{});const zB=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","math","menu","menuitem","meta","meter","multicol","nav","nextid","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rbc","rp","rt","rtc","ruby","s","samp","script","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"],Qe={ID:"data-id",TEXT:"data-text",POSITION:"data-position",ELEMENT_ID:"data-element-id"},HB=zB;function fw(t){return t.replace(/<\/?([a-zA-Z0-9-]+)([^>]*)>/g,(e,n)=>HB.includes(n.toLowerCase())?e:e.replace(/</g,"<").replace(/>/g,">"))}const Vn=(t,e,n)=>{if(typeof t=="object")return t;if(typeof t=="string"&&(t=fw(t),n===Ve.PLAIN_TEXT&&!e))return t.replace(/\r?\n/g,"<br>");if(!e||n===Ve.PLAIN_TEXT||n===Ve.EDITOR)return t;const r=document.createElement("div");return r.innerHTML=t,UB(r),r.innerHTML};function UB(t){t.querySelectorAll("p").forEach(e=>{const n=Array.from(e.querySelectorAll("button.super-text"));if(n.length>0){const r=n.map(s=>`{${(s.getAttribute(Qe.TEXT)||"").replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p[^>]*>/g,"").trim()}}`),o=document.createElement("p");o.classList.add("text-red-500","super-text"),o.innerHTML=`${r.join("<br/>")}`,e.before(o),n.forEach(s=>s.remove())}e.innerHTML=e.innerHTML.trim()})}const pw=t=>{if(typeof t=="string"&&(t=fw(t)),typeof t=="object")return t;const e=document.createElement("div");return e.innerHTML=t,e.querySelectorAll("p").forEach(n=>{const r=n.querySelectorAll("button.super-text");if(r.length>0){const o=Array.from(r).map(s=>{const a=s.getAttribute(Qe.TEXT)||"";return String(a).replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p>/g,"")});n.innerHTML=o.join("<br/>")}else n.innerHTML=""}),e.innerHTML};var Za=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function WB(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Dd={exports:{}};/**
|
|
109
|
+
`,"2) content: () => element.cloneNode(true)"].join(" "))}var l=o.reduce(function(u,c){var f=c&&AB(c,r);return f&&u.push(f),u},[]);return Eu(t)?l[0]:l}Hs.defaultProps=gr,Hs.setDefaultProps=kB,Hs.currentInput=To,Object.assign({},w4,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});var OB={name:"sticky",defaultValue:!1,fn:function(e){var n=e.reference,r=e.popper;function o(){return e.popperInstance?e.popperInstance.state.elements.reference:n}function s(c){return e.props.sticky===!0||e.props.sticky===c}var a=null,l=null;function u(){var c=s("reference")?o().getBoundingClientRect():null,f=s("popper")?r.getBoundingClientRect():null;(c&&rw(a,c)||f&&rw(l,f))&&e.popperInstance&&e.popperInstance.update(),a=c,l=f,e.state.isMounted&&requestAnimationFrame(u)}return{onMount:function(){e.props.sticky&&u()}}}};function rw(t,e){return t&&e?t.top!==e.top||t.right!==e.right||t.bottom!==e.bottom||t.left!==e.left:!0}Hs.setDefaultProps({render:nw});class MB{constructor({editor:e,element:n,view:r,tippyOptions:o={},updateDelay:s=250,shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:l,state:u,from:c,to:f})=>{const{doc:p,selection:m}=u,{empty:g}=m,b=!p.textBetween(c,f).length&&Ym(u.selection),y=this.element.contains(document.activeElement);return!(!(l.hasFocus()||y)||g||b||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var u;if(this.preventHide){this.preventHide=!1;return}l!=null&&l.relatedTarget&&(!((u=this.element.parentNode)===null||u===void 0)&&u.contains(l.relatedTarget))||(l==null?void 0:l.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=l=>{this.blurHandler({event:l})},this.handleDebouncedUpdate=(l,u)=>{const c=!(u!=null&&u.selection.eq(l.state.selection)),f=!(u!=null&&u.doc.eq(l.state.doc));!c&&!f||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(l,c,f,u)},this.updateDelay))},this.updateHandler=(l,u,c,f)=>{var p,m,g;const{state:b,composing:y}=l,{selection:w}=b;if(y||!u&&!c)return;this.createTooltip();const{ranges:E}=w,k=Math.min(...E.map(A=>A.$from.pos)),C=Math.max(...E.map(A=>A.$to.pos));if(!((p=this.shouldShow)===null||p===void 0?void 0:p.call(this,{editor:this.editor,element:this.element,view:l,state:b,oldState:f,from:k,to:C}))){this.hide();return}(m=this.tippy)===null||m===void 0||m.setProps({getReferenceClientRect:((g=this.tippyOptions)===null||g===void 0?void 0:g.getReferenceClientRect)||(()=>{if(p4(b.selection)){let A=l.nodeDOM(k);if(A){const T=A.dataset.nodeViewWrapper?A:A.querySelector("[data-node-view-wrapper]");if(T&&(A=T.firstChild),A)return A.getBoundingClientRect()}}return h4(l,k,C)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=s,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=Hs(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){const{state:r}=e,o=r.selection.from!==r.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,n);return}const s=!(n!=null&&n.selection.eq(e.state.selection)),a=!(n!=null&&n.doc.eq(e.state.doc));this.updateHandler(e,s,a,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const ow=t=>new tt({key:typeof t.pluginKey=="string"?new kt(t.pluginKey):t.pluginKey,view:e=>new MB({view:e,...t})});Ze.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[ow({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});class BB{getTextContent(e){return d4(e,{textSerializers:Xm(this.editor.schema)})}constructor({editor:e,element:n,view:r,tippyOptions:o={},shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l})=>{const{selection:u}=l,{$anchor:c,empty:f}=u,p=c.depth===1,m=c.parent.isTextblock&&!c.parent.type.spec.code&&!c.parent.textContent&&c.parent.childCount===0&&!this.getTextContent(c.parent);return!(!a.hasFocus()||!f||!p||!m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.editor=e,this.element=n,this.view=r,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=Hs(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"right",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){var r,o,s;const{state:a}=e,{doc:l,selection:u}=a,{from:c,to:f}=u;if(n&&n.doc.eq(l)&&n.selection.eq(u))return;if(this.createTooltip(),!((r=this.shouldShow)===null||r===void 0?void 0:r.call(this,{editor:this.editor,view:e,state:a,oldState:n}))){this.hide();return}(o=this.tippy)===null||o===void 0||o.setProps({getReferenceClientRect:((s=this.tippyOptions)===null||s===void 0?void 0:s.getReferenceClientRect)||(()=>h4(e,c,f))}),this.show()}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const iw=t=>new tt({key:typeof t.pluginKey=="string"?new kt(t.pluginKey):t.pluginKey,view:e=>new BB({view:e,...t})});Ze.create({name:"floatingMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"floatingMenu",shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[iw({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,shouldShow:this.options.shouldShow})]:[]}});const Su=i.defineComponent({name:"BubbleMenu",props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=i.ref(null);return i.onMounted(()=>{const{updateDelay:r,editor:o,pluginKey:s,shouldShow:a,tippyOptions:l}=t;o.registerPlugin(ow({updateDelay:r,editor:o,element:n.value,pluginKey:s,shouldShow:a,tippyOptions:l}))}),i.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=t;o.unregisterPlugin(r)}),()=>{var r;return i.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});function sw(t){return i.customRef((e,n)=>({get(){return e(),t},set(r){t=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})}}))}class ii extends GO{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=sw(this.view.state),this.reactiveExtensionStorage=sw(this.extensionStorage),this.on("beforeTransaction",({nextState:n})=>{this.reactiveState.value=n,this.reactiveExtensionStorage.value=this.extensionStorage}),i.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,n){const r=super.registerPlugin(e,n);return this.reactiveState&&(this.reactiveState.value=r),r}unregisterPlugin(e){const n=super.unregisterPlugin(e);return this.reactiveState&&n&&(this.reactiveState.value=n),n}}const Ao=i.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(t){const e=i.ref(),n=i.getCurrentInstance();return i.watchEffect(()=>{const r=t.editor;r&&r.options.element&&e.value&&i.nextTick(()=>{if(!e.value||!r.options.element.firstChild)return;const o=i.unref(e.value);e.value.append(...r.options.element.childNodes),r.contentComponent=n.ctx._,n&&(r.appContext={...n.appContext,provides:n.provides}),r.setOptions({element:o}),r.createNodeViews()})}),i.onBeforeUnmount(()=>{const r=t.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return i.h("div",{ref:t=>{this.rootEl=t}})}});i.defineComponent({name:"FloatingMenu",props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},tippyOptions:{type:Object,default:()=>({})},shouldShow:{type:Function,default:null}},setup(t,{slots:e}){const n=i.ref(null);return i.onMounted(()=>{const{pluginKey:r,editor:o,tippyOptions:s,shouldShow:a}=t;o.registerPlugin(iw({pluginKey:r,editor:o,element:n.value,tippyOptions:s,shouldShow:a}))}),i.onBeforeUnmount(()=>{const{pluginKey:r,editor:o}=t;o.unregisterPlugin(r)}),()=>{var r;return i.h("div",{ref:n},(r=e.default)===null||r===void 0?void 0:r.call(e))}}});const aw=i.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return i.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Us=i.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var t,e;return i.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t))}}),IB=(t={})=>{const e=i.shallowRef();return i.onMounted(()=>{e.value=new ii(t)}),i.onBeforeUnmount(()=>{var n,r,o;const s=(n=e.value)===null||n===void 0?void 0:n.options.element,a=s==null?void 0:s.cloneNode(!0);(r=s==null?void 0:s.parentNode)===null||r===void 0||r.replaceChild(a,s),(o=e.value)===null||o===void 0||o.destroy()}),e};class lw{constructor(e,{props:n={},editor:r}){this.editor=r,this.component=i.markRaw(e),this.el=document.createElement("div"),this.props=i.reactive(n),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var e,n,r,o;return!((n=(e=this.renderedComponent.vNode)===null||e===void 0?void 0:e.component)===null||n===void 0)&&n.exposed?this.renderedComponent.vNode.component.exposed:(o=(r=this.renderedComponent.vNode)===null||r===void 0?void 0:r.component)===null||o===void 0?void 0:o.proxy}renderComponent(){let e=i.h(this.component,this.props);return this.editor.appContext&&(e.appContext=this.editor.appContext),typeof document<"u"&&this.el&&i.render(e,this.el),{vNode:e,destroy:()=>{this.el&&i.render(null,this.el),this.el=null,e=null},el:this.el?this.el.firstElementChild:null}}updateProps(e={}){Object.entries(e).forEach(([n,r])=>{this.props[n]=r}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}}const Ws={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}};class RB extends XO{mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},n=this.onDragStart.bind(this);this.decorationClasses=i.ref(this.getDecorationClasses());const r=i.defineComponent({extends:{...this.component},props:Object.keys(e),template:this.component.template,setup:o=>{var s,a;return i.provide("onDragStart",n),i.provide("decorationClasses",this.decorationClasses),(a=(s=this.component).setup)===null||a===void 0?void 0:a.call(s,o,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new lw(r,{editor:this.editor,props:e})}get dom(){if(!this.renderer.element||!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:n}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(e<=r&&n>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,n,r){const o=s=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(s)};if(typeof this.options.update=="function"){const s=this.node,a=this.decorations,l=this.innerDecorations;return this.node=e,this.decorations=n,this.innerDecorations=r,this.options.update({oldNode:s,oldDecorations:a,newNode:e,newDecorations:n,oldInnerDecorations:l,innerDecorations:r,updateProps:()=>o({node:e,decorations:n,innerDecorations:r})})}return e.type!==this.node.type?!1:(e===this.node&&this.decorations===n&&this.innerDecorations===r||(this.node=e,this.decorations=n,this.innerDecorations=r,o({node:e,decorations:n,innerDecorations:r})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.map(e=>e.type.attrs.class).flat().join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}function js(t,e){return n=>{if(!n.editor.contentComponent)return{};const r=typeof t=="function"&&"__vccOpts"in t?t.__vccOpts:t;return new RB(r,n,e)}}const Bd={SPACING:1,SPELLING:2},LB={NOTHING_TO_CHANGE:"NOTHING_TO_CHANGE"},oo={LOADING:"loading",HAS_ERROR:"hasError",NO_ERROR:"noError",FAIL:"fail"},Oo={EDITOR_COMMENT:"editorComment",EDITOR_CONTENT:"editorContent"},E0={ANDROID:"android",IOS:"ios"},PB="ko",Mo=200,DB=20,uw=1e5,cw=16,Id=10,Rd=10,Ld=2,VB="#262626",FB=["#000000","#262626","#595959","#8C8C8C","#BFBFBF","#D9D9D9","#E9E9E9","#F5F5F5","#FAFAFA","#FFFFFF","#F5222D","#FA541C","#FA8C16","#FADB14","#52C41A","#13C2C2","#1890FF","#2F54EB","#722ED1","#EB2F96","#FFE8E6","#FFECE0","#FFEFD1","#FCFCCA","#E4F7D2","#D3F5F0","#D4EEFC","#DEE8FC","#EFE1FA","#FAE1EB","#FFA39E","#FFBB96","#FFD591","#FFFB8F","#B7EB8F","#87E8DE","#91D5FF","#ADC6FF","#D3ADF7","#FFADD2","#FF4D4F","#FF7A45","#FFA940","#FFEC3D","#73D13D","#36CFC9","#40A9FF","#597EF7","#9254DE","#F759AB","#CF1322","#D4380D","#D46B08","#D4B106","#389E0D","#08979C","#096DD9","#1D39C4","#531DAB","#C41D7F","#820014","#871400","#873800","#614700","#135200","#00474F","#003A8C","#061178","#22075E","#780650"],k0=["10px","11px","12px","14px","16px","18px","20px","22px","24px","26px","28px","36px","48px","72px"],Ja="defaut";var Pd=(t=>(t[t["size-small"]=480]="size-small",t[t["size-medium"]=640]="size-medium",t["size-large"]="100%",t))(Pd||{});const dw="1",$B={image:["divider","image-size-small","image-size-medium","image-size-large","divider","image-left","image-center","image-right","divider","image-aspect-ratio","remove"],text:["Ai","divider","text-bubble","divider","bold","italic","underline","strike","code","link","divider","color","highlight","textAlign"],video:["video-size-small","video-size-medium","video-size-large","divider","remove"]},_u={SAVE:"ctrl+s,command+s"};var De=(t=>(t.COMPARE="compare",t.EDITOR="editor",t.STRAIGHT="straight",t.REPORT="report",t.PLAIN_TEXT="plainText",t.SUPER_VIEW_MOBILE="superViewMobile",t))(De||{}),or=(t=>(t.COMMENT="editor-comment-section",t.DISABLE_SUPER_INPUT="data-disable-super-input",t))(or||{});const zB=["a","abbr","acronym","address","applet","area","article","aside","audio","b","base","basefont","bdi","bdo","bgsound","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","command","content","data","datalist","dd","del","details","dfn","dialog","dir","div","dl","dt","element","em","embed","fieldset","figcaption","figure","font","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","image","img","input","ins","isindex","kbd","keygen","label","legend","li","link","listing","main","map","mark","marquee","math","menu","menuitem","meta","meter","multicol","nav","nextid","nobr","noembed","noframes","noscript","object","ol","optgroup","option","output","p","param","picture","plaintext","pre","progress","q","rb","rbc","rp","rt","rtc","ruby","s","samp","script","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","tt","u","ul","var","video","wbr","xmp"],Qe={ID:"data-id",TEXT:"data-text",POSITION:"data-position",ELEMENT_ID:"data-element-id"},HB=zB;function fw(t){return t.replace(/<\/?([a-zA-Z0-9-]+)([^>]*)>/g,(e,n)=>HB.includes(n.toLowerCase())?e:e.replace(/</g,"<").replace(/>/g,">"))}const Vn=(t,e,n)=>{if(typeof t=="object")return t;if(typeof t=="string"&&(t=fw(t),n===De.PLAIN_TEXT&&!e))return t.replace(/\r?\n/g,"<br>");if(!e||n===De.PLAIN_TEXT||n===De.EDITOR)return t;const r=document.createElement("div");return r.innerHTML=t,UB(r),r.innerHTML};function UB(t){t.querySelectorAll("p").forEach(e=>{const n=Array.from(e.querySelectorAll("button.super-text"));if(n.length>0){const r=n.map(s=>`{${(s.getAttribute(Qe.TEXT)||"").replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p[^>]*>/g,"").trim()}}`),o=document.createElement("p");o.classList.add("text-red-500","super-text"),o.innerHTML=`${r.join("<br/>")}`,e.before(o),n.forEach(s=>s.remove())}e.innerHTML=e.innerHTML.trim()})}const pw=t=>{if(typeof t=="string"&&(t=fw(t)),typeof t=="object")return t;const e=document.createElement("div");return e.innerHTML=t,e.querySelectorAll("p").forEach(n=>{const r=n.querySelectorAll("button.super-text");if(r.length>0){const o=Array.from(r).map(s=>{const a=s.getAttribute(Qe.TEXT)||"";return String(a).replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p>/g,"")});n.innerHTML=o.join("<br/>")}else n.innerHTML=""}),e.innerHTML};var Za=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function WB(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Dd={exports:{}};/**
|
|
110
110
|
* @license
|
|
111
111
|
* Lodash <https://lodash.com/>
|
|
112
112
|
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
@@ -158,7 +158,7 @@ ${c}`:u)}else throw a},onCacheKey:a=>AD(e,n,a)}}function vF(t){if(Se(t))return t
|
|
|
158
158
|
* vue-i18n v10.0.6
|
|
159
159
|
* (c) 2025 kazuya kawaguchi
|
|
160
160
|
* Released under the MIT License.
|
|
161
|
-
*/const AF="10.0.6";function OF(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(Qs().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(Qs().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Qs().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Qs().__INTLIFY_PROD_DEVTOOLS__=!1)}const ns={FALLBACK_TO_ROOT:YV,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_TC:11},MF={[ns.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[ns.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[ns.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[ns.DEPRECATE_TC]:"'tc' and '$tc' has been deprecated in v10. Use 't' or '$t' instead. 'tc' and '$tc’ are going to remove in v11."};function Cf(t,...e){return pf(MF[t],...e)}const $t={UNEXPECTED_RETURN_TYPE:DV,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function Jn(t,...e){return ll(t,null,process.env.NODE_ENV!=="production"?{messages:BF,args:e}:void 0)}const BF={[$t.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[$t.INVALID_ARGUMENT]:"Invalid argument",[$t.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[$t.NOT_INSTALLED]:"Need to install with `app.use` function",[$t.UNEXPECTED_ERROR]:"Unexpected error",[$t.REQUIRED_VALUE]:"Required in value: {0}",[$t.INVALID_VALUE]:"Invalid value",[$t.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[$t.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[$t.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[$t.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},A1=Vo("__translateVNode"),O1=Vo("__datetimeParts"),M1=Vo("__numberParts"),ea=Vo("__enableEmitter"),Fu=Vo("__disableEmitter"),v6=Vo("__setPluralRules"),y6=Vo("__injectWithOption"),B1=Vo("__dispose");function $u(t){if(!xt(t))return t;for(const e in t)if(co(t,e))if(!e.includes("."))xt(t[e])&&$u(t[e]);else{const n=e.split("."),r=n.length-1;let o=t,s=!1;for(let a=0;a<r;a++){if(n[a]==="__proto__")throw new Error(`unsafe key: ${n[a]}`);if(n[a]in o||(o[n[a]]=Rt()),!xt(o[n[a]])){process.env.NODE_ENV!=="production"&&Zi(Cf(ns.IGNORE_OBJ_FLATTEN,{key:n[a]})),s=!0;break}o=o[n[a]]}s||(o[n[r]]=t[e],delete t[e]),xt(o[n[r]])&&$u(o[n[r]])}return t}function I1(t,e){const{messages:n,__i18n:r,messageResolver:o,flatJson:s}=e,a=lt(n)?n:Zt(r)?Rt():{[t]:Rt()};if(Zt(r)&&r.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:u,resource:c}=l;u?(a[u]=a[u]||Rt(),gf(c,a[u])):gf(c,a)}else Se(l)&&gf(JSON.parse(l),a)}),o==null&&s)for(const l in a)co(a,l)&&$u(a[l]);return a}function w6(t){return t.type}function x6(t,e,n){let r=xt(e.messages)?e.messages:Rt();"__i18nGlobal"in n&&(r=I1(t.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const o=Object.keys(r);o.length&&o.forEach(s=>{t.mergeLocaleMessage(s,r[s])});{if(xt(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(a=>{t.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if(xt(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(a=>{t.mergeNumberFormat(a,e.numberFormats[a])})}}}function C6(t){return i.createVNode(i.Text,null,t,0)}const E6="__INTLIFY_META__",k6=()=>[],IF=()=>!1;let S6=0;function _6(t){return(e,n,r,o)=>t(n,r,i.getCurrentInstance()||void 0,o)}const RF=()=>{const t=i.getCurrentInstance();let e=null;return t&&(e=w6(t)[E6])?{[E6]:e}:null};function R1(t={}){const{__root:e,__injectWithOption:n}=t,r=e===void 0,o=t.flatJson,s=uo?i.ref:i.shallowRef;let a=Ct(t.inheritLocale)?t.inheritLocale:!0;const l=s(e&&a?e.locale.value:Se(t.locale)?t.locale:Du),u=s(e&&a?e.fallbackLocale.value:Se(t.fallbackLocale)||Zt(t.fallbackLocale)||lt(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:l.value),c=s(I1(l.value,t)),f=s(lt(t.datetimeFormats)?t.datetimeFormats:{[l.value]:{}}),p=s(lt(t.numberFormats)?t.numberFormats:{[l.value]:{}});let m=e?e.missingWarn:Ct(t.missingWarn)||al(t.missingWarn)?t.missingWarn:!0,g=e?e.fallbackWarn:Ct(t.fallbackWarn)||al(t.fallbackWarn)?t.fallbackWarn:!0,b=e?e.fallbackRoot:Ct(t.fallbackRoot)?t.fallbackRoot:!0,y=!!t.fallbackFormat,w=Ft(t.missing)?t.missing:null,x=Ft(t.missing)?_6(t.missing):null,E=Ft(t.postTranslation)?t.postTranslation:null,k=e?e.warnHtmlMessage:Ct(t.warnHtmlMessage)?t.warnHtmlMessage:!0,C=!!t.escapeParameter;const _=e?e.modifiers:lt(t.modifiers)?t.modifiers:{};let A=t.pluralRules||e&&e.pluralRules,T;T=(()=>{r&&e6(null);const D={version:AF,locale:l.value,fallbackLocale:u.value,messages:c.value,modifiers:_,pluralRules:A,missing:x===null?void 0:x,missingWarn:m,fallbackWarn:g,fallbackFormat:y,unresolving:!0,postTranslation:E===null?void 0:E,warnHtmlMessage:k,escapeParameter:C,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};D.datetimeFormats=f.value,D.numberFormats=p.value,D.__datetimeFormatters=lt(T)?T.__datetimeFormatters:void 0,D.__numberFormatters=lt(T)?T.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(D.__v_emitter=lt(T)?T.__v_emitter:void 0);const Z=iF(D);return r&&e6(Z),Z})(),Vu(T,l.value,u.value);function I(){return[l.value,u.value,c.value,f.value,p.value]}const M=i.computed({get:()=>l.value,set:D=>{l.value=D,T.locale=l.value}}),j=i.computed({get:()=>u.value,set:D=>{u.value=D,T.fallbackLocale=u.value,Vu(T,l.value,D)}}),U=i.computed(()=>c.value),q=i.computed(()=>f.value),le=i.computed(()=>p.value);function H(){return Ft(E)?E:null}function F(D){E=D,T.postTranslation=D}function L(){return w}function K(D){D!==null&&(x=_6(D)),w=D,T.missing=x}function J(D,Z){return D!=="translate"||!Z.resolvedMessage}const Y=(D,Z,ee,he,Fe,Je)=>{I();let St;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(T.fallbackContext=e?oF():void 0),St=D(T)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(T.fallbackContext=void 0)}if(ee!=="translate exists"&&ln(St)&&St===yf||ee==="translate exists"&&!St){const[Kt,vo]=Z();if(process.env.NODE_ENV!=="production"&&e&&Se(Kt)&&J(ee,vo)&&(b&&(xf(g,Kt)||n6(m,Kt))&&Zi(Cf(ns.FALLBACK_TO_ROOT,{key:Kt,type:ee})),process.env.NODE_ENV!=="production")){const{__v_emitter:ie}=T;ie&&b&&ie.emit("fallback",{type:ee,key:Kt,to:"global",groupId:`${ee}:${Kt}`})}return e&&b?he(e):Fe(Kt)}else{if(Je(St))return St;throw Jn($t.UNEXPECTED_RETURN_TYPE)}};function ne(...D){return Y(Z=>Reflect.apply(h6,null,[Z,...D]),()=>_1(...D),"translate",Z=>Reflect.apply(Z.t,Z,[...D]),Z=>Z,Z=>Se(Z))}function we(...D){const[Z,ee,he]=D;if(he&&!xt(he))throw Jn($t.INVALID_ARGUMENT);return ne(Z,ee,mn({resolvedMessage:!0},he||{}))}function xe(...D){return Y(Z=>Reflect.apply(s6,null,[Z,...D]),()=>k1(...D),"datetime format",Z=>Reflect.apply(Z.d,Z,[...D]),()=>wf,Z=>Se(Z))}function $e(...D){return Y(Z=>Reflect.apply(u6,null,[Z,...D]),()=>S1(...D),"number format",Z=>Reflect.apply(Z.n,Z,[...D]),()=>wf,Z=>Se(Z))}function Ee(D){return D.map(Z=>Se(Z)||ln(Z)||Ct(Z)?C6(String(Z)):Z)}const Q={normalize:Ee,interpolate:D=>D,type:"vnode"};function oe(...D){return Y(Z=>{let ee;const he=Z;try{he.processor=Q,ee=Reflect.apply(h6,null,[he,...D])}finally{he.processor=null}return ee},()=>_1(...D),"translate",Z=>Z[A1](...D),Z=>[C6(Z)],Z=>Zt(Z))}function ue(...D){return Y(Z=>Reflect.apply(u6,null,[Z,...D]),()=>S1(...D),"number format",Z=>Z[M1](...D),k6,Z=>Se(Z)||Zt(Z))}function ce(...D){return Y(Z=>Reflect.apply(s6,null,[Z,...D]),()=>k1(...D),"datetime format",Z=>Z[O1](...D),k6,Z=>Se(Z)||Zt(Z))}function be(D){A=D,T.pluralRules=A}function N(D,Z){return Y(()=>{if(!D)return!1;const ee=Se(Z)?Z:l.value,he=Ue(ee),Fe=T.messageResolver(he,D);return es(Fe)||zr(Fe)||Se(Fe)},()=>[D],"translate exists",ee=>Reflect.apply(ee.te,ee,[D,Z]),IF,ee=>Ct(ee))}function ve(D){let Z=null;const ee=qx(T,u.value,l.value);for(let he=0;he<ee.length;he++){const Fe=c.value[ee[he]]||{},Je=T.messageResolver(Fe,D);if(Je!=null){Z=Je;break}}return Z}function Me(D){const Z=ve(D);return Z??(e?e.tm(D)||{}:{})}function Ue(D){return c.value[D]||{}}function mt(D,Z){if(o){const ee={[D]:Z};for(const he in ee)co(ee,he)&&$u(ee[he]);Z=ee[D]}c.value[D]=Z,T.messages=c.value}function Et(D,Z){c.value[D]=c.value[D]||{};const ee={[D]:Z};if(o)for(const he in ee)co(ee,he)&&$u(ee[he]);Z=ee[D],gf(Z,c.value[D]),T.messages=c.value}function z(D){return f.value[D]||{}}function V(D,Z){f.value[D]=Z,T.datetimeFormats=f.value,l6(T,D,Z)}function se(D,Z){f.value[D]=mn(f.value[D]||{},Z),T.datetimeFormats=f.value,l6(T,D,Z)}function ge(D){return p.value[D]||{}}function Re(D,Z){p.value[D]=Z,T.numberFormats=p.value,d6(T,D,Z)}function Ne(D,Z){p.value[D]=mn(p.value[D]||{},Z),T.numberFormats=p.value,d6(T,D,Z)}S6++,e&&uo&&(i.watch(e.locale,D=>{a&&(l.value=D,T.locale=D,Vu(T,l.value,u.value))}),i.watch(e.fallbackLocale,D=>{a&&(u.value=D,T.fallbackLocale=D,Vu(T,l.value,u.value))}));const ze={id:S6,locale:M,fallbackLocale:j,get inheritLocale(){return a},set inheritLocale(D){a=D,D&&e&&(l.value=e.locale.value,u.value=e.fallbackLocale.value,Vu(T,l.value,u.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:U,get modifiers(){return _},get pluralRules(){return A||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(D){m=D,T.missingWarn=m},get fallbackWarn(){return g},set fallbackWarn(D){g=D,T.fallbackWarn=g},get fallbackRoot(){return b},set fallbackRoot(D){b=D},get fallbackFormat(){return y},set fallbackFormat(D){y=D,T.fallbackFormat=y},get warnHtmlMessage(){return k},set warnHtmlMessage(D){k=D,T.warnHtmlMessage=D},get escapeParameter(){return C},set escapeParameter(D){C=D,T.escapeParameter=D},t:ne,getLocaleMessage:Ue,setLocaleMessage:mt,mergeLocaleMessage:Et,getPostTranslationHandler:H,setPostTranslationHandler:F,getMissingHandler:L,setMissingHandler:K,[v6]:be};return ze.datetimeFormats=q,ze.numberFormats=le,ze.rt=we,ze.te=N,ze.tm=Me,ze.d=xe,ze.n=$e,ze.getDateTimeFormat=z,ze.setDateTimeFormat=V,ze.mergeDateTimeFormat=se,ze.getNumberFormat=ge,ze.setNumberFormat=Re,ze.mergeNumberFormat=Ne,ze[y6]=n,ze[A1]=oe,ze[O1]=ce,ze[M1]=ue,process.env.NODE_ENV!=="production"&&(ze[ea]=D=>{T.__v_emitter=D},ze[Fu]=()=>{T.__v_emitter=void 0}),ze}const T6="vue-i18n: composer properties",L1={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},LF={"vue-i18n-resource-inspector":"Search for scopes ..."},PF={"vue-i18n-timeline":16764185};let P1;async function DF(t,e){return new Promise((n,r)=>{try{TF({id:"vue-devtools-plugin-vue-i18n",label:L1["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[T6],app:t},o=>{P1=o,o.on.visitComponentTree(({componentInstance:a,treeNode:l})=>{VF(a,l,e)}),o.on.inspectComponent(({componentInstance:a,instanceData:l})=>{a.vnode.el&&a.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?a.vnode.el.__VUE_I18N__!==e.global.__composer&&O6(l,a.vnode.el.__VUE_I18N__):O6(l,a.vnode.el.__VUE_I18N__))}),o.addInspector({id:"vue-i18n-resource-inspector",label:L1["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:LF["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(a=>{a.app===t&&a.inspectorId==="vue-i18n-resource-inspector"&&UF(a,e)});const s=new Map;o.on.getInspectorState(async a=>{if(a.app===t&&a.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),jF(a,e),a.nodeId==="global"){if(!s.has(a.app)){const[l]=await o.getComponentInstances(a.app);s.set(a.app,l)}o.highlightElement(s.get(a.app))}else{const l=WF(a.nodeId,e);l&&o.highlightElement(l)}}),o.on.editInspectorState(a=>{a.app===t&&a.inspectorId==="vue-i18n-resource-inspector"&&KF(a,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:L1["vue-i18n-timeline"],color:PF["vue-i18n-timeline"]}),n(!0)})}catch(o){console.error(o),r(!1)}})}function A6(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function VF(t,e,n){const r=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==r){const o={label:`i18n (${A6(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function O6(t,e){const n=T6;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:D1(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function D1(t){const e={};return Object.keys(t).forEach(n=>{const r=t[n];Ft(r)&&"source"in r?e[n]=HF(r):es(r)&&r.loc&&r.loc.source?e[n]=r.loc.source:xt(r)?e[n]=D1(r):e[n]=r}),e}const FF={"<":"<",">":">",'"':""","&":"&"};function $F(t){return t.replace(/[<>"&]/g,zF)}function zF(t){return FF[t]||t}function HF(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${$F(t.source)}")`:"(?)"}`}}}function UF(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[r,o]of e.__instances){const s=e.mode==="composition"?o:o.__composer;n!==s&&t.rootNodes.push({id:s.id.toString(),label:`${A6(r)} Scope`})}}function WF(t,e){let n=null;if(t!=="global"){for(const[r,o]of e.__instances.entries())if(o.id.toString()===t){n=r;break}}return n}function M6(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(r=>r.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function jF(t,e){const n=M6(t.nodeId,e);return n&&(t.state=qF(n)),null}function qF(t){const e={},n="Locale related info",r=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=r;const o="Locale messages info",s=[{type:o,key:"messages",editable:!1,value:D1(t.messages.value)}];e[o]=s;{const a="Datetime formats info",l=[{type:a,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[a]=l;const u="Datetime formats info",c=[{type:u,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[u]=c}return e}function zu(t,e){if(P1){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),P1.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function KF(t,e){const n=M6(t.nodeId,e);if(n){const[r]=t.path;r==="locale"&&Se(t.state.value)?n.locale.value=t.state.value:r==="fallbackLocale"&&(Se(t.state.value)||Zt(t.state.value)||xt(t.state.value))?n.fallbackLocale.value=t.state.value:r==="inheritLocale"&&Ct(t.state.value)&&(n.inheritLocale=t.state.value)}}function GF(t){const e=Se(t.locale)?t.locale:Du,n=Se(t.fallbackLocale)||Zt(t.fallbackLocale)||lt(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:e,r=Ft(t.missing)?t.missing:void 0,o=Ct(t.silentTranslationWarn)||al(t.silentTranslationWarn)?!t.silentTranslationWarn:!0,s=Ct(t.silentFallbackWarn)||al(t.silentFallbackWarn)?!t.silentFallbackWarn:!0,a=Ct(t.fallbackRoot)?t.fallbackRoot:!0,l=!!t.formatFallbackMessages,u=lt(t.modifiers)?t.modifiers:{},c=t.pluralizationRules,f=Ft(t.postTranslation)?t.postTranslation:void 0,p=Se(t.warnHtmlInMessage)?t.warnHtmlInMessage!=="off":!0,m=!!t.escapeParameterHtml,g=Ct(t.sync)?t.sync:!0;let b=t.messages;if(lt(t.sharedMessages)){const _=t.sharedMessages;b=Object.keys(_).reduce((T,P)=>{const I=T[P]||(T[P]={});return mn(I,_[P]),T},b||{})}const{__i18n:y,__root:w,__injectWithOption:x}=t,E=t.datetimeFormats,k=t.numberFormats,C=t.flatJson;return{locale:e,fallbackLocale:n,messages:b,flatJson:C,datetimeFormats:E,numberFormats:k,missing:r,missingWarn:o,fallbackWarn:s,fallbackRoot:a,fallbackFormat:l,modifiers:u,pluralRules:c,postTranslation:f,warnHtmlMessage:p,escapeParameter:m,messageResolver:t.messageResolver,inheritLocale:g,__i18n:y,__root:w,__injectWithOption:x}}function V1(t={}){const e=R1(GF(t)),{__extender:n}=t,r={id:e.id,get locale(){return e.locale.value},set locale(o){e.locale.value=o},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(o){e.fallbackLocale.value=o},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(o){e.setMissingHandler(o)},get silentTranslationWarn(){return Ct(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(o){e.missingWarn=Ct(o)?!o:o},get silentFallbackWarn(){return Ct(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(o){e.fallbackWarn=Ct(o)?!o:o},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(o){e.fallbackFormat=o},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(o){e.setPostTranslationHandler(o)},get sync(){return e.inheritLocale},set sync(o){e.inheritLocale=o},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){e.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(o){e.escapeParameter=o},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...o){return Reflect.apply(e.t,e,[...o])},rt(...o){return Reflect.apply(e.rt,e,[...o])},tc(...o){const[s,a,l]=o,u={plural:1};let c=null,f=null;if(process.env.NODE_ENV!=="production"&&$x(Cf(ns.DEPRECATE_TC)),!Se(s))throw Jn($t.INVALID_ARGUMENT);const p=s;return Se(a)?u.locale=a:ln(a)?u.plural=a:Zt(a)?c=a:lt(a)&&(f=a),Se(l)?u.locale=l:Zt(l)?c=l:lt(l)&&(f=l),Reflect.apply(e.t,e,[p,c||f||{},u])},te(o,s){return e.te(o,s)},tm(o){return e.tm(o)},getLocaleMessage(o){return e.getLocaleMessage(o)},setLocaleMessage(o,s){e.setLocaleMessage(o,s)},mergeLocaleMessage(o,s){e.mergeLocaleMessage(o,s)},d(...o){return Reflect.apply(e.d,e,[...o])},getDateTimeFormat(o){return e.getDateTimeFormat(o)},setDateTimeFormat(o,s){e.setDateTimeFormat(o,s)},mergeDateTimeFormat(o,s){e.mergeDateTimeFormat(o,s)},n(...o){return Reflect.apply(e.n,e,[...o])},getNumberFormat(o){return e.getNumberFormat(o)},setNumberFormat(o,s){e.setNumberFormat(o,s)},mergeNumberFormat(o,s){e.mergeNumberFormat(o,s)}};return r.__extender=n,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=o=>{const s=e;s[ea]&&s[ea](o)},r.__disableEmitter=()=>{const o=e;o[Fu]&&o[Fu]()}),r}function XF(t,e,n){return{beforeCreate(){const r=i.getCurrentInstance();if(!r)throw Jn($t.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const s=o.i18n;if(o.__i18n&&(s.__i18n=o.__i18n),s.__root=e,this===this.$root)this.$i18n=B6(t,s);else{s.__injectWithOption=!0,s.__extender=n.__vueI18nExtend,this.$i18n=V1(s);const a=this.$i18n;a.__extender&&(a.__disposer=a.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=B6(t,o);else{this.$i18n=V1({__i18n:o.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=t;o.__i18nGlobal&&x6(e,o,o),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$tc=(...s)=>this.$i18n.tc(...s),this.$te=(s,a)=>this.$i18n.te(s,a),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),n.__setInstance(r,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const r=this.$i18n;this.$el.__VUE_I18N__=r.__composer;const o=this.__v_emitter=h1();r.__enableEmitter&&r.__enableEmitter(o),o.on("*",zu)}},unmounted(){const r=i.getCurrentInstance();if(!r)throw Jn($t.UNEXPECTED_ERROR);const o=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",zu),delete this.__v_emitter),this.$i18n&&(o.__disableEmitter&&o.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),n.__deleteInstance(r),delete this.$i18n}}}function B6(t,e){t.locale=e.locale||t.locale,t.fallbackLocale=e.fallbackLocale||t.fallbackLocale,t.missing=e.missing||t.missing,t.silentTranslationWarn=e.silentTranslationWarn||t.silentFallbackWarn,t.silentFallbackWarn=e.silentFallbackWarn||t.silentFallbackWarn,t.formatFallbackMessages=e.formatFallbackMessages||t.formatFallbackMessages,t.postTranslation=e.postTranslation||t.postTranslation,t.warnHtmlInMessage=e.warnHtmlInMessage||t.warnHtmlInMessage,t.escapeParameterHtml=e.escapeParameterHtml||t.escapeParameterHtml,t.sync=e.sync||t.sync,t.__composer[v6](e.pluralizationRules||t.pluralizationRules);const n=I1(t.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(n).forEach(r=>t.mergeLocaleMessage(r,n[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>t.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>t.mergeNumberFormat(r,e.numberFormats[r])),t}const F1={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function YF({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((r,o)=>[...r,...o.type===i.Fragment?o.children:[o]],[]):e.reduce((n,r)=>{const o=t[r];return o&&(n[r]=o()),n},Rt())}function I6(){return i.Fragment}const R6=i.defineComponent({name:"i18n-t",props:mn({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>ln(t)||!isNaN(t)}},F1),setup(t,e){const{slots:n,attrs:r}=e,o=t.i18n||Ot({useScope:t.scope,__useComponent:!0});return()=>{const s=Object.keys(n).filter(p=>p!=="_"),a=Rt();t.locale&&(a.locale=t.locale),t.plural!==void 0&&(a.plural=Se(t.plural)?+t.plural:t.plural);const l=YF(e,s),u=o[A1](t.keypath,l,a),c=mn(Rt(),r),f=Se(t.tag)||xt(t.tag)?t.tag:I6();return i.h(f,c,u)}}});function JF(t){return Zt(t)&&!Se(t[0])}function L6(t,e,n,r){const{slots:o,attrs:s}=e;return()=>{const a={part:!0};let l=Rt();t.locale&&(a.locale=t.locale),Se(t.format)?a.key=t.format:xt(t.format)&&(Se(t.format.key)&&(a.key=t.format.key),l=Object.keys(t.format).reduce((m,g)=>n.includes(g)?mn(Rt(),m,{[g]:t.format[g]}):m,Rt()));const u=r(t.value,a,l);let c=[a.key];Zt(u)?c=u.map((m,g)=>{const b=o[m.type],y=b?b({[m.type]:m.value,index:g,parts:u}):[m.value];return JF(y)&&(y[0].key=`${m.type}-${g}`),y}):Se(u)&&(c=[u]);const f=mn(Rt(),s),p=Se(t.tag)||xt(t.tag)?t.tag:I6();return i.h(p,f,c)}}const P6=i.defineComponent({name:"i18n-n",props:mn({value:{type:Number,required:!0},format:{type:[String,Object]}},F1),setup(t,e){const n=t.i18n||Ot({useScope:t.scope,__useComponent:!0});return L6(t,e,c6,(...r)=>n[M1](...r))}}),D6=i.defineComponent({name:"i18n-d",props:mn({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},F1),setup(t,e){const n=t.i18n||Ot({useScope:t.scope,__useComponent:!0});return L6(t,e,a6,(...r)=>n[O1](...r))}});function ZF(t,e){const n=t;if(t.mode==="composition")return n.__getInstance(e)||t.global;{const r=n.__getInstance(e);return r!=null?r.__composer:t.global.__composer}}function QF(t){const e=a=>{const{instance:l,value:u}=a;if(!l||!l.$)throw Jn($t.UNEXPECTED_ERROR);const c=ZF(t,l.$),f=V6(u);return[Reflect.apply(c.t,c,[...F6(f)]),c]};return{created:(a,l)=>{const[u,c]=e(l);uo&&t.global===c&&(a.__i18nWatcher=i.watch(c.locale,()=>{l.instance&&l.instance.$forceUpdate()})),a.__composer=c,a.textContent=u},unmounted:a=>{uo&&a.__i18nWatcher&&(a.__i18nWatcher(),a.__i18nWatcher=void 0,delete a.__i18nWatcher),a.__composer&&(a.__composer=void 0,delete a.__composer)},beforeUpdate:(a,{value:l})=>{if(a.__composer){const u=a.__composer,c=V6(l);a.textContent=Reflect.apply(u.t,u,[...F6(c)])}},getSSRProps:a=>{const[l]=e(a);return{textContent:l}}}}function V6(t){if(Se(t))return{path:t};if(lt(t)){if(!("path"in t))throw Jn($t.REQUIRED_VALUE,"path");return t}else throw Jn($t.INVALID_VALUE)}function F6(t){const{path:e,locale:n,args:r,choice:o,plural:s}=t,a={},l=r||{};return Se(n)&&(a.locale=n),ln(o)&&(a.plural=o),ln(s)&&(a.plural=s),[e,l,a]}function NF(t,e,...n){const r=lt(n[0])?n[0]:{};(Ct(r.globalInstall)?r.globalInstall:!0)&&([R6.name,"I18nT"].forEach(s=>t.component(s,R6)),[P6.name,"I18nN"].forEach(s=>t.component(s,P6)),[D6.name,"I18nD"].forEach(s=>t.component(s,D6))),t.directive("t",QF(e))}const e$=Vo("global-vue-i18n");function t$(t={},e){const n=__VUE_I18N_LEGACY_API__&&Ct(t.legacy)?t.legacy:__VUE_I18N_LEGACY_API__,r=Ct(t.globalInjection)?t.globalInjection:!0,o=new Map,[s,a]=n$(t,n),l=Vo(process.env.NODE_ENV!=="production"?"vue-i18n":"");function u(m){return o.get(m)||null}function c(m,g){o.set(m,g)}function f(m){o.delete(m)}const p={get mode(){return __VUE_I18N_LEGACY_API__&&n?"legacy":"composition"},async install(m,...g){if(process.env.NODE_ENV!=="production"&&(m.__VUE_I18N__=p),m.__VUE_I18N_SYMBOL__=l,m.provide(m.__VUE_I18N_SYMBOL__,p),lt(g[0])){const w=g[0];p.__composerExtend=w.__composerExtend,p.__vueI18nExtend=w.__vueI18nExtend}let b=null;!n&&r&&(b=c$(m,p.global)),__VUE_I18N_FULL_INSTALL__&&NF(m,p,...g),__VUE_I18N_LEGACY_API__&&n&&m.mixin(XF(a,a.__composer,p));const y=m.unmount;if(m.unmount=()=>{b&&b(),p.dispose(),y()},process.env.NODE_ENV!=="production"){if(!await DF(m,p))throw Jn($t.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const x=h1();if(n){const E=a;E.__enableEmitter&&E.__enableEmitter(x)}else{const E=a;E[ea]&&E[ea](x)}x.on("*",zu)}},get global(){return a},dispose(){s.stop()},__instances:o,__getInstance:u,__setInstance:c,__deleteInstance:f};return p}function Ot(t={}){const e=i.getCurrentInstance();if(e==null)throw Jn($t.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Jn($t.NOT_INSTALLED);const n=r$(e),r=i$(n),o=w6(e),s=o$(t,o);if(s==="global")return x6(r,t,o),r;if(s==="parent"){let u=s$(n,e,t.__useComponent);return u==null&&(process.env.NODE_ENV!=="production"&&Zi(Cf(ns.NOT_FOUND_PARENT_SCOPE)),u=r),u}const a=n;let l=a.__getInstance(e);if(l==null){const u=mn({},t);"__i18n"in o&&(u.__i18n=o.__i18n),r&&(u.__root=r),l=R1(u),a.__composerExtend&&(l[B1]=a.__composerExtend(l)),l$(a,e,l),a.__setInstance(e,l)}return l}function n$(t,e,n){const r=i.effectScope(),o=__VUE_I18N_LEGACY_API__&&e?r.run(()=>V1(t)):r.run(()=>R1(t));if(o==null)throw Jn($t.UNEXPECTED_ERROR);return[r,o]}function r$(t){const e=i.inject(t.isCE?e$:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Jn(t.isCE?$t.NOT_INSTALLED_WITH_PROVIDE:$t.UNEXPECTED_ERROR);return e}function o$(t,e){return hf(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function i$(t){return t.mode==="composition"?t.global:t.global.__composer}function s$(t,e,n=!1){let r=null;const o=e.root;let s=a$(e,n);for(;s!=null;){const a=t;if(t.mode==="composition")r=a.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const l=a.__getInstance(s);l!=null&&(r=l.__composer,n&&r&&!r[y6]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function a$(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function l$(t,e,n){let r=null;i.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,r=h1();const o=n;o[ea]&&o[ea](r),r.on("*",zu)}},e),i.onUnmounted(()=>{const o=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",zu),o[Fu]&&o[Fu](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const s=o[B1];s&&(s(),delete o[B1])},e)}const u$=["locale","fallbackLocale","availableLocales"],$6=["t","rt","d","n","tm","te"];function c$(t,e){const n=Object.create(null);return u$.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw Jn($t.UNEXPECTED_ERROR);const a=i.isRef(s.value)?{get(){return s.value.value},set(l){s.value.value=l}}:{get(){return s.get&&s.get()}};Object.defineProperty(n,o,a)}),t.config.globalProperties.$i18n=n,$6.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw Jn($t.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${o}`,s)}),()=>{delete t.config.globalProperties.$i18n,$6.forEach(o=>{delete t.config.globalProperties[`$${o}`]})}}if(OF(),NV(BV),eF(XV),tF(qx),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const t=Qs();t.__INTLIFY__=!0,IV(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const d$={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-1.5"},f$={class:"flex-1 flex justify-end items-center gap-x-3"},p$=i.defineComponent({__name:"Toolbar",props:{editor:{},editorComment:{},disabled:{type:Boolean,default:!1},mode:{}},setup(t){const e=i.defineAsyncComponent(()=>Promise.resolve().then(()=>mN)),{t:n}=Ot(),r=t,o=i.inject("isEditable",i.ref(!0)),s=["fontSize","fontFamily","superText","spellchecker","fontSizeIncreaseDecrease"],a=i.computed(()=>{const p=[...r.editor.extensionManager.extensions].sort((g,b)=>g.name==="superText"?1:b.name==="superText"?-1:0);let m=[];for(const g of p){const{button:b,divider:y=!1,spacer:w=!1,toolbar:x=!0}=g.options;if(!b||!_0(b)||!x)continue;const E=b({editor:r.editor,extension:g,t:i.unref(n)});if(Array.isArray(E)){const k=E.map((C,_)=>({id:`${g.name}`,button:C,divider:_===E.length-1?y:!1,spacer:_===0?w:!1}));m=[...m,...k];continue}m.push({button:E,divider:y,spacer:w,id:`${g.name}`})}if(r.mode!==Ve.EDITOR)return m.filter(g=>g.id&&s.includes(g.id));if(m=m.filter(g=>g.id!=="superText"),!o.value){m=m.map(b=>(b.button.componentProps.disabled=!0,b));const g=m.find(b=>b.id==="spellchecker");g&&(g.button.componentProps.disabled=!1)}return m}),l=f=>f.id==="spellchecker"?"!text-[#2977D9] border border-gray-300 dark:!text-white hover:!bg-gray-200 dark:hover:!bg-gray-700 rounded-none [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] p-0 w-[26px] h-[26px]":f.button.componentProps.customClass,u=f=>f.id==="spellchecker"?"Spellchecker":f.button.componentProps.icon,c=i.computed(()=>{var f;return(f=r.editor)==null?void 0:f.extensionManager.extensions.find(p=>p.name==="spellchecker")});return(f,p)=>{var m;return i.openBlock(),i.createElementBlock("div",{id:"tool-bar",class:i.normalizeClass(i.unref(ke)("z-10",i.unref(ff)()&&"top-16"))},[i.createElementVNode("div",d$,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(g,b)=>{var y;return i.openBlock(),i.createElementBlock(i.Fragment,{key:b},[g.spacer&&b!==0?(i.openBlock(),i.createBlock(i.unref(ci),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.resolveDynamicComponent(g.button.component),i.mergeProps({id:g.id,ref_for:!0},g.button.componentProps,{editor:f.editor,disabled:f.disabled||((y=g.button.componentProps)==null?void 0:y.disabled),"custom-class":l(g),icon:u(g)}),i.createSlots({_:2},[i.renderList(g.button.componentSlots,(w,x,E)=>({name:`${x}`,fn:i.withCtx(k=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(w),i.mergeProps({ref_for:!0},k==null?void 0:k.props,{id:g.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),g.divider?(i.openBlock(),i.createBlock(i.unref(ci),{key:1,orientation:"vertical",class:"mx-2 h-auto"})):i.createCommentVNode("",!0)],64)}),128)),i.createElementVNode("div",f$,[p[0]||(p[0]=i.createElementVNode("div",{id:"tool-bar-auto-save"},null,-1)),c.value?(i.openBlock(),i.createBlock(i.unref(e),{key:0,editor:f.editor,"editor-comment":f.editorComment,isEnableSpellCheckRealTime:(m=f.editor)==null?void 0:m.extensionStorage.spellchecker.spellchecker.proofreader.enabled},null,8,["editor","editor-comment","isEnableSpellCheckRealTime"])):i.createCommentVNode("",!0)])])],2)}}}),fl=i.defineComponent({__name:"Popover",props:{defaultOpen:{type:Boolean},open:{type:Boolean},modal:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(iP),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(({open:l})=>[i.renderSlot(s.$slots,"default",{open:l})]),_:3},16))}}),pl=i.defineComponent({inheritAttrs:!1,__name:"PopoverContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},side:{},sideOffset:{default:4},align:{default:"center"},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},updatePositionStrategy:{},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(aP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(cP),i.mergeProps({...i.unref(s),...a.$attrs},{class:i.unref(ke)("z-50 w-72 rounded-md border bg-ed-popover p-4 text-ed-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),$1=i.defineComponent({__name:"Tabs",props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},asChild:{type:Boolean},as:{}},emits:["update:modelValue"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(dD),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),z1=i.defineComponent({__name:"TabsList",props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(fD),i.mergeProps(n.value,{class:i.unref(ke)("inline-flex items-center justify-center rounded-md bg-ed-muted p-1 text-ed-muted-foreground",e.class)}),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),h$={class:"truncate"},Hu=i.defineComponent({__name:"TabsTrigger",props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(hD),i.mergeProps(i.unref(r),{class:i.unref(ke)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-ed-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-ed-background data-[state=active]:text-ed-foreground data-[state=active]:shadow-sm",e.class)}),{default:i.withCtx(()=>[i.createElementVNode("span",h$,[i.renderSlot(o.$slots,"default")])]),_:3},16,["class"]))}}),hl=i.defineComponent({__name:"Input",props:{defaultValue:{},modelValue:{},class:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,o=ht.useVModel(n,"modelValue",r,{passive:!0,defaultValue:n.defaultValue});return(s,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>i.isRef(o)?o.value=l:null),class:i.normalizeClass(i.unref(ke)("flex h-9 w-full rounded-md border border-ed-input bg-transparent px-3 py-1 box-border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-ed-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50",n.class))},null,2)),[[i.vModelText,i.unref(o)]])}}),Ef=i.defineComponent({__name:"Label",props:{for:{},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(rP),i.mergeProps(n.value,{class:i.unref(ke)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e.class)}),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),ml=i.defineComponent({__name:"PopoverTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(sP),i.normalizeProps(i.guardReactiveProps(e)),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16))}});let H1;function U1(){return H1===void 0&&(H1=navigator.platform.includes("Mac")),H1}function kf(t){return t.toLowerCase()==="mod"?U1()?"⌘":"Ctrl":t.toLowerCase()==="alt"?U1()?"⌥":"Alt":t.toLowerCase()==="shift"?U1()?"⇧":"Shift":t}function z6(t){return t.map(kf).join(" ")}const H6=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,U6=Kh,W1=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return U6(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=e,a=Object.keys(o).map(c=>{const f=n==null?void 0:n[c],p=s==null?void 0:s[c];if(f===null)return null;const m=H6(f)||H6(p);return o[c][m]}),l=n&&Object.entries(n).reduce((c,f)=>{let[p,m]=f;return m===void 0||(c[p]=m),c},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:p,className:m,...g}=f;return Object.entries(g).every(b=>{let[y,w]=b;return Array.isArray(w)?w.includes({...s,...l}[y]):{...s,...l}[y]===w})?[...c,p,m]:c},[]);return U6(t,a,u,n==null?void 0:n.class,n==null?void 0:n.className)},W6=i.defineComponent({__name:"Toggle",props:{defaultValue:{type:Boolean},pressed:{type:Boolean},disabled:{type:Boolean,default:!1},asChild:{type:Boolean},as:{},class:{},variant:{default:"default"},size:{default:"default"}},emits:["update:pressed"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,size:l,variant:u,...c}=n;return c}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(mD),i.mergeProps(i.unref(s),{class:i.unref(ke)(i.unref(m$)({variant:a.variant,size:a.size}),n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"]))}}),m$=W1("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-ed-muted hover:text-ed-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-ed-accent data-[state=on]:text-ed-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-ed-input bg-transparent shadow-sm hover:bg-ed-accent hover:text-ed-accent-foreground"},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-3"}},defaultVariants:{variant:"default",size:"default"}}),gl=i.defineComponent({name:"ToolTip",__name:"Tooltip",props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(yD),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),ta=i.defineComponent({inheritAttrs:!1,__name:"TooltipContent",props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},class:{}},emits:["escapeKeyDown","pointerDownOutside"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(ED),null,{default:i.withCtx(()=>[i.createVNode(i.unref(CD),i.mergeProps({...i.unref(s),...a.$attrs},{class:i.unref(ke)(`z-50 overflow-hidden rounded-md bg-ed-primary px-3 py-1.5 text-xs text-ed-primary-foreground
|
|
161
|
+
*/const AF="10.0.6";function OF(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(Qs().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(Qs().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Qs().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Qs().__INTLIFY_PROD_DEVTOOLS__=!1)}const ns={FALLBACK_TO_ROOT:YV,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_TC:11},MF={[ns.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[ns.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[ns.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[ns.DEPRECATE_TC]:"'tc' and '$tc' has been deprecated in v10. Use 't' or '$t' instead. 'tc' and '$tc’ are going to remove in v11."};function Cf(t,...e){return pf(MF[t],...e)}const $t={UNEXPECTED_RETURN_TYPE:DV,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function Jn(t,...e){return ll(t,null,process.env.NODE_ENV!=="production"?{messages:BF,args:e}:void 0)}const BF={[$t.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[$t.INVALID_ARGUMENT]:"Invalid argument",[$t.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[$t.NOT_INSTALLED]:"Need to install with `app.use` function",[$t.UNEXPECTED_ERROR]:"Unexpected error",[$t.REQUIRED_VALUE]:"Required in value: {0}",[$t.INVALID_VALUE]:"Invalid value",[$t.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[$t.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[$t.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[$t.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},A1=Vo("__translateVNode"),O1=Vo("__datetimeParts"),M1=Vo("__numberParts"),ea=Vo("__enableEmitter"),Fu=Vo("__disableEmitter"),v6=Vo("__setPluralRules"),y6=Vo("__injectWithOption"),B1=Vo("__dispose");function $u(t){if(!xt(t))return t;for(const e in t)if(co(t,e))if(!e.includes("."))xt(t[e])&&$u(t[e]);else{const n=e.split("."),r=n.length-1;let o=t,s=!1;for(let a=0;a<r;a++){if(n[a]==="__proto__")throw new Error(`unsafe key: ${n[a]}`);if(n[a]in o||(o[n[a]]=Rt()),!xt(o[n[a]])){process.env.NODE_ENV!=="production"&&Zi(Cf(ns.IGNORE_OBJ_FLATTEN,{key:n[a]})),s=!0;break}o=o[n[a]]}s||(o[n[r]]=t[e],delete t[e]),xt(o[n[r]])&&$u(o[n[r]])}return t}function I1(t,e){const{messages:n,__i18n:r,messageResolver:o,flatJson:s}=e,a=lt(n)?n:Zt(r)?Rt():{[t]:Rt()};if(Zt(r)&&r.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:u,resource:c}=l;u?(a[u]=a[u]||Rt(),gf(c,a[u])):gf(c,a)}else Se(l)&&gf(JSON.parse(l),a)}),o==null&&s)for(const l in a)co(a,l)&&$u(a[l]);return a}function w6(t){return t.type}function x6(t,e,n){let r=xt(e.messages)?e.messages:Rt();"__i18nGlobal"in n&&(r=I1(t.locale.value,{messages:r,__i18n:n.__i18nGlobal}));const o=Object.keys(r);o.length&&o.forEach(s=>{t.mergeLocaleMessage(s,r[s])});{if(xt(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(a=>{t.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if(xt(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(a=>{t.mergeNumberFormat(a,e.numberFormats[a])})}}}function C6(t){return i.createVNode(i.Text,null,t,0)}const E6="__INTLIFY_META__",k6=()=>[],IF=()=>!1;let S6=0;function _6(t){return(e,n,r,o)=>t(n,r,i.getCurrentInstance()||void 0,o)}const RF=()=>{const t=i.getCurrentInstance();let e=null;return t&&(e=w6(t)[E6])?{[E6]:e}:null};function R1(t={}){const{__root:e,__injectWithOption:n}=t,r=e===void 0,o=t.flatJson,s=uo?i.ref:i.shallowRef;let a=Ct(t.inheritLocale)?t.inheritLocale:!0;const l=s(e&&a?e.locale.value:Se(t.locale)?t.locale:Du),u=s(e&&a?e.fallbackLocale.value:Se(t.fallbackLocale)||Zt(t.fallbackLocale)||lt(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:l.value),c=s(I1(l.value,t)),f=s(lt(t.datetimeFormats)?t.datetimeFormats:{[l.value]:{}}),p=s(lt(t.numberFormats)?t.numberFormats:{[l.value]:{}});let m=e?e.missingWarn:Ct(t.missingWarn)||al(t.missingWarn)?t.missingWarn:!0,g=e?e.fallbackWarn:Ct(t.fallbackWarn)||al(t.fallbackWarn)?t.fallbackWarn:!0,b=e?e.fallbackRoot:Ct(t.fallbackRoot)?t.fallbackRoot:!0,y=!!t.fallbackFormat,w=Ft(t.missing)?t.missing:null,x=Ft(t.missing)?_6(t.missing):null,E=Ft(t.postTranslation)?t.postTranslation:null,k=e?e.warnHtmlMessage:Ct(t.warnHtmlMessage)?t.warnHtmlMessage:!0,C=!!t.escapeParameter;const _=e?e.modifiers:lt(t.modifiers)?t.modifiers:{};let A=t.pluralRules||e&&e.pluralRules,T;T=(()=>{r&&e6(null);const D={version:AF,locale:l.value,fallbackLocale:u.value,messages:c.value,modifiers:_,pluralRules:A,missing:x===null?void 0:x,missingWarn:m,fallbackWarn:g,fallbackFormat:y,unresolving:!0,postTranslation:E===null?void 0:E,warnHtmlMessage:k,escapeParameter:C,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};D.datetimeFormats=f.value,D.numberFormats=p.value,D.__datetimeFormatters=lt(T)?T.__datetimeFormatters:void 0,D.__numberFormatters=lt(T)?T.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(D.__v_emitter=lt(T)?T.__v_emitter:void 0);const Z=iF(D);return r&&e6(Z),Z})(),Vu(T,l.value,u.value);function I(){return[l.value,u.value,c.value,f.value,p.value]}const M=i.computed({get:()=>l.value,set:D=>{l.value=D,T.locale=l.value}}),j=i.computed({get:()=>u.value,set:D=>{u.value=D,T.fallbackLocale=u.value,Vu(T,l.value,D)}}),U=i.computed(()=>c.value),q=i.computed(()=>f.value),le=i.computed(()=>p.value);function H(){return Ft(E)?E:null}function F(D){E=D,T.postTranslation=D}function L(){return w}function K(D){D!==null&&(x=_6(D)),w=D,T.missing=x}function J(D,Z){return D!=="translate"||!Z.resolvedMessage}const Y=(D,Z,ee,he,Fe,Je)=>{I();let St;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(T.fallbackContext=e?oF():void 0),St=D(T)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(T.fallbackContext=void 0)}if(ee!=="translate exists"&&ln(St)&&St===yf||ee==="translate exists"&&!St){const[Kt,vo]=Z();if(process.env.NODE_ENV!=="production"&&e&&Se(Kt)&&J(ee,vo)&&(b&&(xf(g,Kt)||n6(m,Kt))&&Zi(Cf(ns.FALLBACK_TO_ROOT,{key:Kt,type:ee})),process.env.NODE_ENV!=="production")){const{__v_emitter:ie}=T;ie&&b&&ie.emit("fallback",{type:ee,key:Kt,to:"global",groupId:`${ee}:${Kt}`})}return e&&b?he(e):Fe(Kt)}else{if(Je(St))return St;throw Jn($t.UNEXPECTED_RETURN_TYPE)}};function ne(...D){return Y(Z=>Reflect.apply(h6,null,[Z,...D]),()=>_1(...D),"translate",Z=>Reflect.apply(Z.t,Z,[...D]),Z=>Z,Z=>Se(Z))}function we(...D){const[Z,ee,he]=D;if(he&&!xt(he))throw Jn($t.INVALID_ARGUMENT);return ne(Z,ee,mn({resolvedMessage:!0},he||{}))}function xe(...D){return Y(Z=>Reflect.apply(s6,null,[Z,...D]),()=>k1(...D),"datetime format",Z=>Reflect.apply(Z.d,Z,[...D]),()=>wf,Z=>Se(Z))}function $e(...D){return Y(Z=>Reflect.apply(u6,null,[Z,...D]),()=>S1(...D),"number format",Z=>Reflect.apply(Z.n,Z,[...D]),()=>wf,Z=>Se(Z))}function Ee(D){return D.map(Z=>Se(Z)||ln(Z)||Ct(Z)?C6(String(Z)):Z)}const Q={normalize:Ee,interpolate:D=>D,type:"vnode"};function oe(...D){return Y(Z=>{let ee;const he=Z;try{he.processor=Q,ee=Reflect.apply(h6,null,[he,...D])}finally{he.processor=null}return ee},()=>_1(...D),"translate",Z=>Z[A1](...D),Z=>[C6(Z)],Z=>Zt(Z))}function ue(...D){return Y(Z=>Reflect.apply(u6,null,[Z,...D]),()=>S1(...D),"number format",Z=>Z[M1](...D),k6,Z=>Se(Z)||Zt(Z))}function ce(...D){return Y(Z=>Reflect.apply(s6,null,[Z,...D]),()=>k1(...D),"datetime format",Z=>Z[O1](...D),k6,Z=>Se(Z)||Zt(Z))}function be(D){A=D,T.pluralRules=A}function N(D,Z){return Y(()=>{if(!D)return!1;const ee=Se(Z)?Z:l.value,he=Ue(ee),Fe=T.messageResolver(he,D);return es(Fe)||zr(Fe)||Se(Fe)},()=>[D],"translate exists",ee=>Reflect.apply(ee.te,ee,[D,Z]),IF,ee=>Ct(ee))}function ve(D){let Z=null;const ee=qx(T,u.value,l.value);for(let he=0;he<ee.length;he++){const Fe=c.value[ee[he]]||{},Je=T.messageResolver(Fe,D);if(Je!=null){Z=Je;break}}return Z}function Me(D){const Z=ve(D);return Z??(e?e.tm(D)||{}:{})}function Ue(D){return c.value[D]||{}}function mt(D,Z){if(o){const ee={[D]:Z};for(const he in ee)co(ee,he)&&$u(ee[he]);Z=ee[D]}c.value[D]=Z,T.messages=c.value}function Et(D,Z){c.value[D]=c.value[D]||{};const ee={[D]:Z};if(o)for(const he in ee)co(ee,he)&&$u(ee[he]);Z=ee[D],gf(Z,c.value[D]),T.messages=c.value}function z(D){return f.value[D]||{}}function V(D,Z){f.value[D]=Z,T.datetimeFormats=f.value,l6(T,D,Z)}function se(D,Z){f.value[D]=mn(f.value[D]||{},Z),T.datetimeFormats=f.value,l6(T,D,Z)}function ge(D){return p.value[D]||{}}function Re(D,Z){p.value[D]=Z,T.numberFormats=p.value,d6(T,D,Z)}function Ne(D,Z){p.value[D]=mn(p.value[D]||{},Z),T.numberFormats=p.value,d6(T,D,Z)}S6++,e&&uo&&(i.watch(e.locale,D=>{a&&(l.value=D,T.locale=D,Vu(T,l.value,u.value))}),i.watch(e.fallbackLocale,D=>{a&&(u.value=D,T.fallbackLocale=D,Vu(T,l.value,u.value))}));const ze={id:S6,locale:M,fallbackLocale:j,get inheritLocale(){return a},set inheritLocale(D){a=D,D&&e&&(l.value=e.locale.value,u.value=e.fallbackLocale.value,Vu(T,l.value,u.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:U,get modifiers(){return _},get pluralRules(){return A||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(D){m=D,T.missingWarn=m},get fallbackWarn(){return g},set fallbackWarn(D){g=D,T.fallbackWarn=g},get fallbackRoot(){return b},set fallbackRoot(D){b=D},get fallbackFormat(){return y},set fallbackFormat(D){y=D,T.fallbackFormat=y},get warnHtmlMessage(){return k},set warnHtmlMessage(D){k=D,T.warnHtmlMessage=D},get escapeParameter(){return C},set escapeParameter(D){C=D,T.escapeParameter=D},t:ne,getLocaleMessage:Ue,setLocaleMessage:mt,mergeLocaleMessage:Et,getPostTranslationHandler:H,setPostTranslationHandler:F,getMissingHandler:L,setMissingHandler:K,[v6]:be};return ze.datetimeFormats=q,ze.numberFormats=le,ze.rt=we,ze.te=N,ze.tm=Me,ze.d=xe,ze.n=$e,ze.getDateTimeFormat=z,ze.setDateTimeFormat=V,ze.mergeDateTimeFormat=se,ze.getNumberFormat=ge,ze.setNumberFormat=Re,ze.mergeNumberFormat=Ne,ze[y6]=n,ze[A1]=oe,ze[O1]=ce,ze[M1]=ue,process.env.NODE_ENV!=="production"&&(ze[ea]=D=>{T.__v_emitter=D},ze[Fu]=()=>{T.__v_emitter=void 0}),ze}const T6="vue-i18n: composer properties",L1={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},LF={"vue-i18n-resource-inspector":"Search for scopes ..."},PF={"vue-i18n-timeline":16764185};let P1;async function DF(t,e){return new Promise((n,r)=>{try{TF({id:"vue-devtools-plugin-vue-i18n",label:L1["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[T6],app:t},o=>{P1=o,o.on.visitComponentTree(({componentInstance:a,treeNode:l})=>{VF(a,l,e)}),o.on.inspectComponent(({componentInstance:a,instanceData:l})=>{a.vnode.el&&a.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?a.vnode.el.__VUE_I18N__!==e.global.__composer&&O6(l,a.vnode.el.__VUE_I18N__):O6(l,a.vnode.el.__VUE_I18N__))}),o.addInspector({id:"vue-i18n-resource-inspector",label:L1["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:LF["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(a=>{a.app===t&&a.inspectorId==="vue-i18n-resource-inspector"&&UF(a,e)});const s=new Map;o.on.getInspectorState(async a=>{if(a.app===t&&a.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),jF(a,e),a.nodeId==="global"){if(!s.has(a.app)){const[l]=await o.getComponentInstances(a.app);s.set(a.app,l)}o.highlightElement(s.get(a.app))}else{const l=WF(a.nodeId,e);l&&o.highlightElement(l)}}),o.on.editInspectorState(a=>{a.app===t&&a.inspectorId==="vue-i18n-resource-inspector"&&KF(a,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:L1["vue-i18n-timeline"],color:PF["vue-i18n-timeline"]}),n(!0)})}catch(o){console.error(o),r(!1)}})}function A6(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function VF(t,e,n){const r=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==r){const o={label:`i18n (${A6(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function O6(t,e){const n=T6;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:D1(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function D1(t){const e={};return Object.keys(t).forEach(n=>{const r=t[n];Ft(r)&&"source"in r?e[n]=HF(r):es(r)&&r.loc&&r.loc.source?e[n]=r.loc.source:xt(r)?e[n]=D1(r):e[n]=r}),e}const FF={"<":"<",">":">",'"':""","&":"&"};function $F(t){return t.replace(/[<>"&]/g,zF)}function zF(t){return FF[t]||t}function HF(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${$F(t.source)}")`:"(?)"}`}}}function UF(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[r,o]of e.__instances){const s=e.mode==="composition"?o:o.__composer;n!==s&&t.rootNodes.push({id:s.id.toString(),label:`${A6(r)} Scope`})}}function WF(t,e){let n=null;if(t!=="global"){for(const[r,o]of e.__instances.entries())if(o.id.toString()===t){n=r;break}}return n}function M6(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(r=>r.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function jF(t,e){const n=M6(t.nodeId,e);return n&&(t.state=qF(n)),null}function qF(t){const e={},n="Locale related info",r=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=r;const o="Locale messages info",s=[{type:o,key:"messages",editable:!1,value:D1(t.messages.value)}];e[o]=s;{const a="Datetime formats info",l=[{type:a,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[a]=l;const u="Datetime formats info",c=[{type:u,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[u]=c}return e}function zu(t,e){if(P1){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),P1.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function KF(t,e){const n=M6(t.nodeId,e);if(n){const[r]=t.path;r==="locale"&&Se(t.state.value)?n.locale.value=t.state.value:r==="fallbackLocale"&&(Se(t.state.value)||Zt(t.state.value)||xt(t.state.value))?n.fallbackLocale.value=t.state.value:r==="inheritLocale"&&Ct(t.state.value)&&(n.inheritLocale=t.state.value)}}function GF(t){const e=Se(t.locale)?t.locale:Du,n=Se(t.fallbackLocale)||Zt(t.fallbackLocale)||lt(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:e,r=Ft(t.missing)?t.missing:void 0,o=Ct(t.silentTranslationWarn)||al(t.silentTranslationWarn)?!t.silentTranslationWarn:!0,s=Ct(t.silentFallbackWarn)||al(t.silentFallbackWarn)?!t.silentFallbackWarn:!0,a=Ct(t.fallbackRoot)?t.fallbackRoot:!0,l=!!t.formatFallbackMessages,u=lt(t.modifiers)?t.modifiers:{},c=t.pluralizationRules,f=Ft(t.postTranslation)?t.postTranslation:void 0,p=Se(t.warnHtmlInMessage)?t.warnHtmlInMessage!=="off":!0,m=!!t.escapeParameterHtml,g=Ct(t.sync)?t.sync:!0;let b=t.messages;if(lt(t.sharedMessages)){const _=t.sharedMessages;b=Object.keys(_).reduce((T,P)=>{const I=T[P]||(T[P]={});return mn(I,_[P]),T},b||{})}const{__i18n:y,__root:w,__injectWithOption:x}=t,E=t.datetimeFormats,k=t.numberFormats,C=t.flatJson;return{locale:e,fallbackLocale:n,messages:b,flatJson:C,datetimeFormats:E,numberFormats:k,missing:r,missingWarn:o,fallbackWarn:s,fallbackRoot:a,fallbackFormat:l,modifiers:u,pluralRules:c,postTranslation:f,warnHtmlMessage:p,escapeParameter:m,messageResolver:t.messageResolver,inheritLocale:g,__i18n:y,__root:w,__injectWithOption:x}}function V1(t={}){const e=R1(GF(t)),{__extender:n}=t,r={id:e.id,get locale(){return e.locale.value},set locale(o){e.locale.value=o},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(o){e.fallbackLocale.value=o},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(o){e.setMissingHandler(o)},get silentTranslationWarn(){return Ct(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(o){e.missingWarn=Ct(o)?!o:o},get silentFallbackWarn(){return Ct(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(o){e.fallbackWarn=Ct(o)?!o:o},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(o){e.fallbackFormat=o},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(o){e.setPostTranslationHandler(o)},get sync(){return e.inheritLocale},set sync(o){e.inheritLocale=o},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(o){e.warnHtmlMessage=o!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(o){e.escapeParameter=o},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...o){return Reflect.apply(e.t,e,[...o])},rt(...o){return Reflect.apply(e.rt,e,[...o])},tc(...o){const[s,a,l]=o,u={plural:1};let c=null,f=null;if(process.env.NODE_ENV!=="production"&&$x(Cf(ns.DEPRECATE_TC)),!Se(s))throw Jn($t.INVALID_ARGUMENT);const p=s;return Se(a)?u.locale=a:ln(a)?u.plural=a:Zt(a)?c=a:lt(a)&&(f=a),Se(l)?u.locale=l:Zt(l)?c=l:lt(l)&&(f=l),Reflect.apply(e.t,e,[p,c||f||{},u])},te(o,s){return e.te(o,s)},tm(o){return e.tm(o)},getLocaleMessage(o){return e.getLocaleMessage(o)},setLocaleMessage(o,s){e.setLocaleMessage(o,s)},mergeLocaleMessage(o,s){e.mergeLocaleMessage(o,s)},d(...o){return Reflect.apply(e.d,e,[...o])},getDateTimeFormat(o){return e.getDateTimeFormat(o)},setDateTimeFormat(o,s){e.setDateTimeFormat(o,s)},mergeDateTimeFormat(o,s){e.mergeDateTimeFormat(o,s)},n(...o){return Reflect.apply(e.n,e,[...o])},getNumberFormat(o){return e.getNumberFormat(o)},setNumberFormat(o,s){e.setNumberFormat(o,s)},mergeNumberFormat(o,s){e.mergeNumberFormat(o,s)}};return r.__extender=n,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=o=>{const s=e;s[ea]&&s[ea](o)},r.__disableEmitter=()=>{const o=e;o[Fu]&&o[Fu]()}),r}function XF(t,e,n){return{beforeCreate(){const r=i.getCurrentInstance();if(!r)throw Jn($t.UNEXPECTED_ERROR);const o=this.$options;if(o.i18n){const s=o.i18n;if(o.__i18n&&(s.__i18n=o.__i18n),s.__root=e,this===this.$root)this.$i18n=B6(t,s);else{s.__injectWithOption=!0,s.__extender=n.__vueI18nExtend,this.$i18n=V1(s);const a=this.$i18n;a.__extender&&(a.__disposer=a.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=B6(t,o);else{this.$i18n=V1({__i18n:o.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=t;o.__i18nGlobal&&x6(e,o,o),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$tc=(...s)=>this.$i18n.tc(...s),this.$te=(s,a)=>this.$i18n.te(s,a),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),n.__setInstance(r,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const r=this.$i18n;this.$el.__VUE_I18N__=r.__composer;const o=this.__v_emitter=h1();r.__enableEmitter&&r.__enableEmitter(o),o.on("*",zu)}},unmounted(){const r=i.getCurrentInstance();if(!r)throw Jn($t.UNEXPECTED_ERROR);const o=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",zu),delete this.__v_emitter),this.$i18n&&(o.__disableEmitter&&o.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$tc,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),n.__deleteInstance(r),delete this.$i18n}}}function B6(t,e){t.locale=e.locale||t.locale,t.fallbackLocale=e.fallbackLocale||t.fallbackLocale,t.missing=e.missing||t.missing,t.silentTranslationWarn=e.silentTranslationWarn||t.silentFallbackWarn,t.silentFallbackWarn=e.silentFallbackWarn||t.silentFallbackWarn,t.formatFallbackMessages=e.formatFallbackMessages||t.formatFallbackMessages,t.postTranslation=e.postTranslation||t.postTranslation,t.warnHtmlInMessage=e.warnHtmlInMessage||t.warnHtmlInMessage,t.escapeParameterHtml=e.escapeParameterHtml||t.escapeParameterHtml,t.sync=e.sync||t.sync,t.__composer[v6](e.pluralizationRules||t.pluralizationRules);const n=I1(t.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(n).forEach(r=>t.mergeLocaleMessage(r,n[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>t.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>t.mergeNumberFormat(r,e.numberFormats[r])),t}const F1={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function YF({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((r,o)=>[...r,...o.type===i.Fragment?o.children:[o]],[]):e.reduce((n,r)=>{const o=t[r];return o&&(n[r]=o()),n},Rt())}function I6(){return i.Fragment}const R6=i.defineComponent({name:"i18n-t",props:mn({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>ln(t)||!isNaN(t)}},F1),setup(t,e){const{slots:n,attrs:r}=e,o=t.i18n||Ot({useScope:t.scope,__useComponent:!0});return()=>{const s=Object.keys(n).filter(p=>p!=="_"),a=Rt();t.locale&&(a.locale=t.locale),t.plural!==void 0&&(a.plural=Se(t.plural)?+t.plural:t.plural);const l=YF(e,s),u=o[A1](t.keypath,l,a),c=mn(Rt(),r),f=Se(t.tag)||xt(t.tag)?t.tag:I6();return i.h(f,c,u)}}});function JF(t){return Zt(t)&&!Se(t[0])}function L6(t,e,n,r){const{slots:o,attrs:s}=e;return()=>{const a={part:!0};let l=Rt();t.locale&&(a.locale=t.locale),Se(t.format)?a.key=t.format:xt(t.format)&&(Se(t.format.key)&&(a.key=t.format.key),l=Object.keys(t.format).reduce((m,g)=>n.includes(g)?mn(Rt(),m,{[g]:t.format[g]}):m,Rt()));const u=r(t.value,a,l);let c=[a.key];Zt(u)?c=u.map((m,g)=>{const b=o[m.type],y=b?b({[m.type]:m.value,index:g,parts:u}):[m.value];return JF(y)&&(y[0].key=`${m.type}-${g}`),y}):Se(u)&&(c=[u]);const f=mn(Rt(),s),p=Se(t.tag)||xt(t.tag)?t.tag:I6();return i.h(p,f,c)}}const P6=i.defineComponent({name:"i18n-n",props:mn({value:{type:Number,required:!0},format:{type:[String,Object]}},F1),setup(t,e){const n=t.i18n||Ot({useScope:t.scope,__useComponent:!0});return L6(t,e,c6,(...r)=>n[M1](...r))}}),D6=i.defineComponent({name:"i18n-d",props:mn({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},F1),setup(t,e){const n=t.i18n||Ot({useScope:t.scope,__useComponent:!0});return L6(t,e,a6,(...r)=>n[O1](...r))}});function ZF(t,e){const n=t;if(t.mode==="composition")return n.__getInstance(e)||t.global;{const r=n.__getInstance(e);return r!=null?r.__composer:t.global.__composer}}function QF(t){const e=a=>{const{instance:l,value:u}=a;if(!l||!l.$)throw Jn($t.UNEXPECTED_ERROR);const c=ZF(t,l.$),f=V6(u);return[Reflect.apply(c.t,c,[...F6(f)]),c]};return{created:(a,l)=>{const[u,c]=e(l);uo&&t.global===c&&(a.__i18nWatcher=i.watch(c.locale,()=>{l.instance&&l.instance.$forceUpdate()})),a.__composer=c,a.textContent=u},unmounted:a=>{uo&&a.__i18nWatcher&&(a.__i18nWatcher(),a.__i18nWatcher=void 0,delete a.__i18nWatcher),a.__composer&&(a.__composer=void 0,delete a.__composer)},beforeUpdate:(a,{value:l})=>{if(a.__composer){const u=a.__composer,c=V6(l);a.textContent=Reflect.apply(u.t,u,[...F6(c)])}},getSSRProps:a=>{const[l]=e(a);return{textContent:l}}}}function V6(t){if(Se(t))return{path:t};if(lt(t)){if(!("path"in t))throw Jn($t.REQUIRED_VALUE,"path");return t}else throw Jn($t.INVALID_VALUE)}function F6(t){const{path:e,locale:n,args:r,choice:o,plural:s}=t,a={},l=r||{};return Se(n)&&(a.locale=n),ln(o)&&(a.plural=o),ln(s)&&(a.plural=s),[e,l,a]}function NF(t,e,...n){const r=lt(n[0])?n[0]:{};(Ct(r.globalInstall)?r.globalInstall:!0)&&([R6.name,"I18nT"].forEach(s=>t.component(s,R6)),[P6.name,"I18nN"].forEach(s=>t.component(s,P6)),[D6.name,"I18nD"].forEach(s=>t.component(s,D6))),t.directive("t",QF(e))}const e$=Vo("global-vue-i18n");function t$(t={},e){const n=__VUE_I18N_LEGACY_API__&&Ct(t.legacy)?t.legacy:__VUE_I18N_LEGACY_API__,r=Ct(t.globalInjection)?t.globalInjection:!0,o=new Map,[s,a]=n$(t,n),l=Vo(process.env.NODE_ENV!=="production"?"vue-i18n":"");function u(m){return o.get(m)||null}function c(m,g){o.set(m,g)}function f(m){o.delete(m)}const p={get mode(){return __VUE_I18N_LEGACY_API__&&n?"legacy":"composition"},async install(m,...g){if(process.env.NODE_ENV!=="production"&&(m.__VUE_I18N__=p),m.__VUE_I18N_SYMBOL__=l,m.provide(m.__VUE_I18N_SYMBOL__,p),lt(g[0])){const w=g[0];p.__composerExtend=w.__composerExtend,p.__vueI18nExtend=w.__vueI18nExtend}let b=null;!n&&r&&(b=c$(m,p.global)),__VUE_I18N_FULL_INSTALL__&&NF(m,p,...g),__VUE_I18N_LEGACY_API__&&n&&m.mixin(XF(a,a.__composer,p));const y=m.unmount;if(m.unmount=()=>{b&&b(),p.dispose(),y()},process.env.NODE_ENV!=="production"){if(!await DF(m,p))throw Jn($t.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const x=h1();if(n){const E=a;E.__enableEmitter&&E.__enableEmitter(x)}else{const E=a;E[ea]&&E[ea](x)}x.on("*",zu)}},get global(){return a},dispose(){s.stop()},__instances:o,__getInstance:u,__setInstance:c,__deleteInstance:f};return p}function Ot(t={}){const e=i.getCurrentInstance();if(e==null)throw Jn($t.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Jn($t.NOT_INSTALLED);const n=r$(e),r=i$(n),o=w6(e),s=o$(t,o);if(s==="global")return x6(r,t,o),r;if(s==="parent"){let u=s$(n,e,t.__useComponent);return u==null&&(process.env.NODE_ENV!=="production"&&Zi(Cf(ns.NOT_FOUND_PARENT_SCOPE)),u=r),u}const a=n;let l=a.__getInstance(e);if(l==null){const u=mn({},t);"__i18n"in o&&(u.__i18n=o.__i18n),r&&(u.__root=r),l=R1(u),a.__composerExtend&&(l[B1]=a.__composerExtend(l)),l$(a,e,l),a.__setInstance(e,l)}return l}function n$(t,e,n){const r=i.effectScope(),o=__VUE_I18N_LEGACY_API__&&e?r.run(()=>V1(t)):r.run(()=>R1(t));if(o==null)throw Jn($t.UNEXPECTED_ERROR);return[r,o]}function r$(t){const e=i.inject(t.isCE?e$:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Jn(t.isCE?$t.NOT_INSTALLED_WITH_PROVIDE:$t.UNEXPECTED_ERROR);return e}function o$(t,e){return hf(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function i$(t){return t.mode==="composition"?t.global:t.global.__composer}function s$(t,e,n=!1){let r=null;const o=e.root;let s=a$(e,n);for(;s!=null;){const a=t;if(t.mode==="composition")r=a.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const l=a.__getInstance(s);l!=null&&(r=l.__composer,n&&r&&!r[y6]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function a$(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function l$(t,e,n){let r=null;i.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,r=h1();const o=n;o[ea]&&o[ea](r),r.on("*",zu)}},e),i.onUnmounted(()=>{const o=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",zu),o[Fu]&&o[Fu](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const s=o[B1];s&&(s(),delete o[B1])},e)}const u$=["locale","fallbackLocale","availableLocales"],$6=["t","rt","d","n","tm","te"];function c$(t,e){const n=Object.create(null);return u$.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw Jn($t.UNEXPECTED_ERROR);const a=i.isRef(s.value)?{get(){return s.value.value},set(l){s.value.value=l}}:{get(){return s.get&&s.get()}};Object.defineProperty(n,o,a)}),t.config.globalProperties.$i18n=n,$6.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw Jn($t.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${o}`,s)}),()=>{delete t.config.globalProperties.$i18n,$6.forEach(o=>{delete t.config.globalProperties[`$${o}`]})}}if(OF(),NV(BV),eF(XV),tF(qx),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const t=Qs();t.__INTLIFY__=!0,IV(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const d$={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:h-1.5"},f$={class:"flex-1 flex justify-end items-center gap-x-3"},p$=i.defineComponent({__name:"Toolbar",props:{editor:{},editorComment:{},disabled:{type:Boolean,default:!1},mode:{}},setup(t){const e=i.defineAsyncComponent(()=>Promise.resolve().then(()=>mN)),{t:n}=Ot(),r=t,o=i.inject("isEditable",i.ref(!0)),s=["fontSize","fontFamily","superText","spellchecker","fontSizeIncreaseDecrease"],a=i.computed(()=>{const p=[...r.editor.extensionManager.extensions].sort((g,b)=>g.name==="superText"?1:b.name==="superText"?-1:0);let m=[];for(const g of p){const{button:b,divider:y=!1,spacer:w=!1,toolbar:x=!0}=g.options;if(!b||!_0(b)||!x)continue;const E=b({editor:r.editor,extension:g,t:i.unref(n)});if(Array.isArray(E)){const k=E.map((C,_)=>({id:`${g.name}`,button:C,divider:_===E.length-1?y:!1,spacer:_===0?w:!1}));m=[...m,...k];continue}m.push({button:E,divider:y,spacer:w,id:`${g.name}`})}if(r.mode!==De.EDITOR)return m.filter(g=>g.id&&s.includes(g.id));if(m=m.filter(g=>g.id!=="superText"),!o.value){m=m.map(b=>(b.button.componentProps.disabled=!0,b));const g=m.find(b=>b.id==="spellchecker");g&&(g.button.componentProps.disabled=!1)}return m}),l=f=>f.id==="spellchecker"?"!text-[#2977D9] border border-gray-300 dark:!text-white hover:!bg-gray-200 dark:hover:!bg-gray-700 rounded-none [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] p-0 w-[26px] h-[26px]":f.button.componentProps.customClass,u=f=>f.id==="spellchecker"?"Spellchecker":f.button.componentProps.icon,c=i.computed(()=>{var f;return(f=r.editor)==null?void 0:f.extensionManager.extensions.find(p=>p.name==="spellchecker")});return(f,p)=>{var m;return i.openBlock(),i.createElementBlock("div",{id:"tool-bar",class:i.normalizeClass(i.unref(ke)("z-10",i.unref(ff)()&&"top-16"))},[i.createElementVNode("div",d$,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(g,b)=>{var y;return i.openBlock(),i.createElementBlock(i.Fragment,{key:b},[g.spacer&&b!==0?(i.openBlock(),i.createBlock(i.unref(ci),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.resolveDynamicComponent(g.button.component),i.mergeProps({id:g.id,ref_for:!0},g.button.componentProps,{editor:f.editor,disabled:f.disabled||((y=g.button.componentProps)==null?void 0:y.disabled),"custom-class":l(g),icon:u(g)}),i.createSlots({_:2},[i.renderList(g.button.componentSlots,(w,x,E)=>({name:`${x}`,fn:i.withCtx(k=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(w),i.mergeProps({ref_for:!0},k==null?void 0:k.props,{id:g.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),g.divider?(i.openBlock(),i.createBlock(i.unref(ci),{key:1,orientation:"vertical",class:"mx-2 h-auto"})):i.createCommentVNode("",!0)],64)}),128)),i.createElementVNode("div",f$,[p[0]||(p[0]=i.createElementVNode("div",{id:"tool-bar-auto-save"},null,-1)),c.value?(i.openBlock(),i.createBlock(i.unref(e),{key:0,editor:f.editor,"editor-comment":f.editorComment,isEnableSpellCheckRealTime:(m=f.editor)==null?void 0:m.extensionStorage.spellchecker.spellchecker.proofreader.enabled},null,8,["editor","editor-comment","isEnableSpellCheckRealTime"])):i.createCommentVNode("",!0)])])],2)}}}),fl=i.defineComponent({__name:"Popover",props:{defaultOpen:{type:Boolean},open:{type:Boolean},modal:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(iP),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(({open:l})=>[i.renderSlot(s.$slots,"default",{open:l})]),_:3},16))}}),pl=i.defineComponent({inheritAttrs:!1,__name:"PopoverContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},side:{},sideOffset:{default:4},align:{default:"center"},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},updatePositionStrategy:{},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(aP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(cP),i.mergeProps({...i.unref(s),...a.$attrs},{class:i.unref(ke)("z-50 w-72 rounded-md border bg-ed-popover p-4 text-ed-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),$1=i.defineComponent({__name:"Tabs",props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},asChild:{type:Boolean},as:{}},emits:["update:modelValue"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(dD),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),z1=i.defineComponent({__name:"TabsList",props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(fD),i.mergeProps(n.value,{class:i.unref(ke)("inline-flex items-center justify-center rounded-md bg-ed-muted p-1 text-ed-muted-foreground",e.class)}),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),h$={class:"truncate"},Hu=i.defineComponent({__name:"TabsTrigger",props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(hD),i.mergeProps(i.unref(r),{class:i.unref(ke)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-ed-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-ed-background data-[state=active]:text-ed-foreground data-[state=active]:shadow-sm",e.class)}),{default:i.withCtx(()=>[i.createElementVNode("span",h$,[i.renderSlot(o.$slots,"default")])]),_:3},16,["class"]))}}),hl=i.defineComponent({__name:"Input",props:{defaultValue:{},modelValue:{},class:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,o=ht.useVModel(n,"modelValue",r,{passive:!0,defaultValue:n.defaultValue});return(s,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{"onUpdate:modelValue":a[0]||(a[0]=l=>i.isRef(o)?o.value=l:null),class:i.normalizeClass(i.unref(ke)("flex h-9 w-full rounded-md border border-ed-input bg-transparent px-3 py-1 box-border text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-ed-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50",n.class))},null,2)),[[i.vModelText,i.unref(o)]])}}),Ef=i.defineComponent({__name:"Label",props:{for:{},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(rP),i.mergeProps(n.value,{class:i.unref(ke)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e.class)}),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),ml=i.defineComponent({__name:"PopoverTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(sP),i.normalizeProps(i.guardReactiveProps(e)),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16))}});let H1;function U1(){return H1===void 0&&(H1=navigator.platform.includes("Mac")),H1}function kf(t){return t.toLowerCase()==="mod"?U1()?"⌘":"Ctrl":t.toLowerCase()==="alt"?U1()?"⌥":"Alt":t.toLowerCase()==="shift"?U1()?"⇧":"Shift":t}function z6(t){return t.map(kf).join(" ")}const H6=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,U6=Kh,W1=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return U6(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=e,a=Object.keys(o).map(c=>{const f=n==null?void 0:n[c],p=s==null?void 0:s[c];if(f===null)return null;const m=H6(f)||H6(p);return o[c][m]}),l=n&&Object.entries(n).reduce((c,f)=>{let[p,m]=f;return m===void 0||(c[p]=m),c},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:p,className:m,...g}=f;return Object.entries(g).every(b=>{let[y,w]=b;return Array.isArray(w)?w.includes({...s,...l}[y]):{...s,...l}[y]===w})?[...c,p,m]:c},[]);return U6(t,a,u,n==null?void 0:n.class,n==null?void 0:n.className)},W6=i.defineComponent({__name:"Toggle",props:{defaultValue:{type:Boolean},pressed:{type:Boolean},disabled:{type:Boolean,default:!1},asChild:{type:Boolean},as:{},class:{},variant:{default:"default"},size:{default:"default"}},emits:["update:pressed"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,size:l,variant:u,...c}=n;return c}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(mD),i.mergeProps(i.unref(s),{class:i.unref(ke)(i.unref(m$)({variant:a.variant,size:a.size}),n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"]))}}),m$=W1("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-ed-muted hover:text-ed-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-ed-accent data-[state=on]:text-ed-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-ed-input bg-transparent shadow-sm hover:bg-ed-accent hover:text-ed-accent-foreground"},size:{default:"h-9 px-3",sm:"h-8 px-2",lg:"h-10 px-3"}},defaultVariants:{variant:"default",size:"default"}}),gl=i.defineComponent({name:"ToolTip",__name:"Tooltip",props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(yD),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),ta=i.defineComponent({inheritAttrs:!1,__name:"TooltipContent",props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},class:{}},emits:["escapeKeyDown","pointerDownOutside"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(ED),null,{default:i.withCtx(()=>[i.createVNode(i.unref(CD),i.mergeProps({...i.unref(s),...a.$attrs},{class:i.unref(ke)(`z-50 overflow-hidden rounded-md bg-ed-primary px-3 py-1.5 text-xs text-ed-primary-foreground
|
|
162
162
|
data-[state=delayed-open]:animate-in
|
|
163
163
|
data-[state=delayed-open]:fade-in-0
|
|
164
164
|
data-[state=delayed-open]:zoom-in-95
|
|
@@ -223,7 +223,7 @@ ${c}`:u)}else throw a},onCacheKey:a=>AD(e,n,a)}}function vF(t){if(Se(t))return t
|
|
|
223
223
|
</svg>
|
|
224
224
|
`,width:20,height:20}}})}hC();const pz={key:0},hz={key:1,class:"flex items-center gap-1"},mz={key:2},gz={class:"flex flex-col items-center text-center max-w-24"},bz={key:0,style:{display:"flex",gap:"4px"}},Ke=i.defineComponent({__name:"ActionButton",props:{icon:{default:void 0},iconClass:{default:""},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},hidden:{type:Boolean},shortcutKeys:{default:void 0},customClass:{default:""},customClassTooltip:{default:""},loading:{type:Boolean,default:!1},tooltipOptions:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},editor:{},variant:{default:"ghost"},class:{},id:{default:""},isPressed:{type:Boolean,default:!1}},setup(t){return(e,n)=>(i.openBlock(),i.createBlock(i.unref(vl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(gl),{"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),{class:i.normalizeClass(e.customClassTooltip)},{default:i.withCtx(()=>{var r;return[i.createVNode(i.unref(W6),{id:`action-btn-${e.id}`,size:"sm",class:i.normalizeClass(["h-[32px] active:bg-ed-accent",i.unref(ke)([e.customClass],{hidden:e.hidden})]),pressed:((r=e.isActive)==null?void 0:r.call(e))||e.isPressed,disabled:e.disabled,onClick:e.action},{default:i.withCtx(()=>[e.loading?(i.openBlock(),i.createElementBlock("div",pz,[i.createVNode(i.unref(Lt),{class:"animate-spin",name:"LoaderCircle"})])):e.icon||e.$slots.icon?(i.openBlock(),i.createElementBlock("div",hz,[e.icon?(i.openBlock(),i.createBlock(i.unref(Lt),{key:0,name:e.icon,class:i.normalizeClass(e.iconClass)},null,8,["name","class"])):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"icon")])):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default"),e.title?(i.openBlock(),i.createElementBlock("span",mz,i.toDisplayString(e.title),1)):i.createCommentVNode("",!0)]),_:3},8,["id","pressed","disabled","class","onClick"])]}),_:3},8,["class"]),e.tooltip?(i.openBlock(),i.createBlock(i.unref(ta),i.normalizeProps(i.mergeProps({key:0},e.tooltipOptions)),{default:i.withCtx(()=>[i.createElementVNode("div",gz,[i.createElementVNode("div",null,i.toDisplayString(e.tooltip),1),e.shortcutKeys&&e.shortcutKeys.length?(i.openBlock(),i.createElementBlock("div",bz,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.shortcutKeys,(r,o)=>(i.openBlock(),i.createElementBlock("span",{key:o},i.toDisplayString(i.unref(kf)(r)),1))),128))])):i.createCommentVNode("",!0)])]),_:1},16)):i.createCommentVNode("",!0)]),_:3})]),_:3}))}}),mC=(t,e)=>{const{view:n,state:{selection:{from:r}}}=t,o=document.querySelectorAll(".focus"),s=o.length,l=o[s-1];if(l&&l.getAttribute("data-type")&&l.getAttribute("data-type")===e||l&&l.classList&&l.classList.contains(e))return l;const u=n.domAtPos(r).node;let c=u;for(c.tagName||(c=u.parentElement);c&&!(c.getAttribute("data-type")&&c.getAttribute("data-type")===e)&&!c.classList.contains(e);)c=c.parentElement;return c},vz={class:"w-auto px-3 py-2 transition-all border rounded-sm shadow-sm pointer-events-auto select-none border-neutral-200 dark:border-neutral-800 bg-ed-background"},yz={class:"flex items-center flex-nowrap whitespace-nowrap h-[26px] justify-start relative gap-0.5"},wz={class:"flex items-center gap-2"},xz={class:"mt-3"},Bf=i.defineComponent({__name:"ImageBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,{t:n}=Ot(),r=i.ref("100"),o=i.ref(),s=i.ref(),a=i.ref(),l=["left","center","right"],u={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"},c=()=>document.body;function f(T){T==null||T.preventDefault(),e.editor.getAttributes("image").src&&e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:o.value?`${o.value}px`:null}).run()}function p(T){const P=Math.max(0,Math.min(100,parseInt(r.value)));e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({width:`${P}%`}).run()}const m=i.ref(!1),g=i.ref(null),b=({editor:T})=>t0(T.view.state,"image")||m.value;function y(){const T=mC(e.editor,"node-image");return T?(g.value=T,T.getBoundingClientRect()):m.value&&g.value?g.value.getBoundingClientRect():new DOMRect(-1e3,-1e3,0,0)}function w(T){e.editor.commands.updateAttributes("image",{textAlign:T})}i.watch(r,()=>{r.value&&p()}),i.watch(()=>e.editor.getAttributes("image"),T=>{T&&(o.value=Math.round(parseFloat(T.originWidth)),s.value=Math.round(parseFloat(T.originHeight)),a.value=T.originWidth/T.originHeight)});function x(){s.value&&a.value?o.value=Math.max(30,Math.round(s.value*a.value)):o.value=null}function E(){o.value&&a.value?s.value=Math.max(20,Math.round(o.value/a.value)):s.value=null}function k(T){w(T)}function C(){const T=e.editor.getAttributes("image"),{flipX:P}=T;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipX:!P}).run()}function _(){const T=e.editor.getAttributes("image"),{flipY:P}=T;e.editor.chain().focus(void 0,{scrollIntoView:!1}).updateImage({flipY:!P}).run()}function A(){const{state:T,dispatch:P}=e.editor.view;pu(T,P)}return(T,P)=>{const I=Ke,M=ci,j=ml,U=Ef,q=hl,le=Hu,H=z1,F=$1,L=pl,K=fl;return i.openBlock(),i.createBlock(i.unref(Su),{editor:T.editor,"plugin-key":"image-menus-123","should-show":b,"update-delay":0,"tippy-options":{zIndex:9999,appendTo:c,getReferenceClientRect:()=>y()}},{default:i.withCtx(()=>[i.createElementVNode("div",vz,[i.createElementVNode("div",yz,[i.createVNode(I,{tooltip:i.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:C},null,8,["tooltip"]),i.createVNode(I,{tooltip:i.unref(n)("editor.image.menu.flipY"),icon:"FlipHorizontal",action:_},null,8,["tooltip"]),i.createVNode(M,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),i.createVNode(K,{open:m.value,"onUpdate:open":P[4]||(P[4]=J=>m.value=J)},{default:i.withCtx(()=>[i.createVNode(j,null,{default:i.withCtx(()=>[i.createVNode(I,{title:i.unref(n)("editor.image.menu.size"),icon:"ImageSize"},null,8,["title"])]),_:1}),i.createVNode(L,{class:"w-84"},{default:i.withCtx(()=>[i.createElementVNode("div",wz,[i.createVNode(U,{for:"maxWidth",class:"whitespace-nowrap"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)("editor.image.menu.size.width")),1)]),_:1}),i.createVNode(q,{id:"maxWidth",modelValue:o.value,"onUpdate:modelValue":P[0]||(P[0]=J=>o.value=J),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:E,onKeyup:i.withKeys(f,["enter"])},null,8,["modelValue"]),i.createVNode(U,{for:"maxWidth",class:"whitespace-nowrap"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)("editor.image.menu.size.height")),1)]),_:1}),i.createVNode(q,{id:"maxWidth",modelValue:s.value,"onUpdate:modelValue":P[1]||(P[1]=J=>s.value=J),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:x,onKeyup:i.withKeys(f,["enter"])},null,8,["modelValue"])]),i.createElementVNode("div",xz,[i.createVNode(F,{"model-value":r.value,"onUpdate:modelValue":[P[2]||(P[2]=J=>r.value=J),P[3]||(P[3]=J=>{r.value=J})]},{default:i.withCtx(()=>[i.createVNode(H,null,{default:i.withCtx(()=>[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(["25","50","75","100"],J=>i.createVNode(le,{key:J,value:J},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(J)+"% ",1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])])]),_:1})]),_:1},8,["open"]),i.createVNode(M,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(l,(J,Y)=>i.createVNode(I,{key:Y,tooltip:i.unref(n)(`editor.textalign.${J}.tooltip`),icon:u[J],action:()=>k(J),disabled:!T.editor.can().setTextAlign(J),"is-active":()=>T.editor.isActive({textAlign:J})||!1},null,8,["tooltip","icon","action","disabled","is-active"])),64)),i.createVNode(M,{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),i.createVNode(I,{tooltip:i.unref(n)("editor.remove"),icon:"Trash2",action:A,disabled:!T.editor.isEditable},null,8,["tooltip","disabled"])])])]),_:1},8,["editor","tippy-options"])}}}),yn=i.defineComponent({name:"BaseButton",__name:"Button",props:{variant:{},size:{},class:{},asChild:{type:Boolean},as:{default:"button"}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(qe),{as:n.as,"as-child":n.asChild,class:i.normalizeClass(i.unref(ke)(i.unref(Cz)({variant:n.variant,size:n.size}),e.class))},{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},8,["as","as-child","class"]))}}),Cz=W1("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offseted-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-ed-primary text-ed-primary-foreground hover:bg-ed-primary/90",destructive:"bg-ed-destructive text-ed-destructive-foreground hover:bg-ed-destructive/90",outline:"border border-ed-border bg-ed-background text-ed-primary hover:bg-ed-accent hover:text-ed-accent-foreground",secondary:"bg-ed-secondary text-ed-secondary-foreground hover:bg-ed-secondary/80",ghost:"hover:bg-ed-accent hover:text-ed-accent-foreground active:bg-ed-accent",link:"text-ed-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",xs:"h-7 rounded px-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ez={class:"flex flex-col"},kz={class:"w-6 h-6 p-0.5 inline-block rounded-sm border cursor-pointer hover:border-ed-border hover:shadow-sm relative after:border-b-2 after:border-b-red-500 after:top-[10px] after:h-0 after:left-0 after:w-6 after:absolute after:block after:rotate-[45deg]"},Sz={style:{"background-color":"transparent"}},_z={viewBox:"0 0 18 18",style:{fill:"rgba(0, 0, 0, 0.4)",display:"none"}},Tz={class:"ml-1 text-sm"},Az={class:"w-6 h-6 p-0.5 inline-block rounded-sm border border-transparent cursor-pointer"},Oz={viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"}},Mz={class:"ml-1 text-sm"},Bz=["onClick"],Iz={key:0,viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"}},Rz={key:1,class:"absolute top-[-1px] left-[1px] w-3 h-3",viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"block"}},Lz={class:"my-1 text-sm"},Pz={class:"relative flex w-full h-auto p-0 last:pb-2"},Dz=["onClick"],Vz={viewBox:"0 0 18 18",style:{fill:"rgb(255, 255, 255)",display:"none"}},Fz={class:"relative"},gC=i.defineComponent({__name:"ColorPicker",props:{modelValue:{default:""},highlight:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","change"],setup(t,{emit:e}){const{t:n}=Ot(),r=FB.reduce((m,g,b)=>{const y=Math.floor(b/10);return m[y]||(m[y]=[]),m[y].push(g),m},[]),o=t,s=i.ref(null),a=ht.useLocalStorage(o.highlight?"recentColorsHighlight":"recentColors",[]),l=e;function u(m){const g=a.value.indexOf(m);g!==-1&&a.value.splice(g,1),a.value.unshift(m),a.value.length>10&&a.value.pop()}const c=i.computed(()=>a.value.slice(0,10));function f(m){if(m===void 0){l("update:modelValue",m),l("change",m);return}/^#([0-9A-F]{3}){1,2}$/i.test(m)&&(l("update:modelValue",m),l("change",m),u(m))}const p=()=>{var m;(m=s.value)==null||m.click()};return(m,g)=>(i.openBlock(),i.createBlock(i.unref(fl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(ml),{disabled:m.disabled},{default:i.withCtx(()=>[i.renderSlot(m.$slots,"default")]),_:3},8,["disabled"]),i.createVNode(i.unref(pl),{"hide-when-detached":"",class:"w-full h-full p-2",align:"start",side:"bottom"},{default:i.withCtx(()=>[i.createElementVNode("div",Ez,[m.highlight?(i.openBlock(),i.createElementBlock("div",{key:0,class:"flex items-center p-1 cursor-pointer rd-1 hover:bg-ed-accent",onClick:g[0]||(g[0]=b=>f(void 0))},[i.createElementVNode("span",kz,[i.createElementVNode("span",Sz,[(i.openBlock(),i.createElementBlock("svg",_z,g[3]||(g[3]=[i.createElementVNode("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"},null,-1)])))])]),i.createElementVNode("span",Tz,i.toDisplayString(i.unref(n)("editor.nofill")),1)])):(i.openBlock(),i.createElementBlock("div",{key:1,class:"flex items-center p-1 cursor-pointer rd-1 hover:bg-ed-accent",onClick:g[1]||(g[1]=b=>f(void 0))},[i.createElementVNode("span",Az,[i.createElementVNode("span",{style:i.normalizeStyle({backgroundColor:i.unref(VB)}),class:"relative w-[18px] h-[18px] block rounded-[2px] border-transparent"},[(i.openBlock(),i.createElementBlock("svg",Oz,g[4]||(g[4]=[i.createElementVNode("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"},null,-1)])))],4)]),i.createElementVNode("span",Mz,i.toDisplayString(i.unref(n)("editor.default")),1)])),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(r),(b,y)=>(i.openBlock(),i.createElementBlock("span",{key:y,class:"relative flex w-full h-auto p-0 last:pb-2"},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(b,(w,x)=>(i.openBlock(),i.createElementBlock("span",{key:x,class:"w-6 h-6 p-0.5 inline-block rounded-sm border border-transparent flex-[0 0 auto] cursor-pointer hover:border-ed-border hover:shadow-sm",onClick:E=>f(w)},[i.createElementVNode("span",{style:i.normalizeStyle({backgroundColor:w}),class:"relative w-[18px] h-[18px] block rounded-[2px] border-transparent"},[w!==m.modelValue?(i.openBlock(),i.createElementBlock("svg",Iz,g[5]||(g[5]=[i.createElementVNode("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",Rz,g[6]||(g[6]=[i.createElementVNode("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"},null,-1)])))],4)],8,Bz))),128))]))),128)),i.withDirectives(i.createElementVNode("div",null,[i.createElementVNode("div",Lz,i.toDisplayString(i.unref(n)("editor.recent")),1),i.createElementVNode("span",Pz,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(b,y)=>(i.openBlock(),i.createElementBlock("span",{key:y,class:"w-6 h-6 p-0.5 inline-block rounded-sm border border-transparent flex-[0 0 auto] cursor-pointer hover:border-ed-border hover:shadow-sm",onClick:w=>f(b)},[i.createElementVNode("span",{class:"relative w-[18px] h-[18px] block rounded-[2px] border-transparent",style:i.normalizeStyle({backgroundColor:b})},[(i.openBlock(),i.createElementBlock("svg",Vz,g[7]||(g[7]=[i.createElementVNode("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"},null,-1)])))],4)],8,Dz))),128))])],512),[[i.vShow,c.value.length]]),i.createElementVNode("div",Fz,[i.createElementVNode("div",{class:"text-sm hover:cursor-pointer hover:bg-ed-accent py-1.5 px-1.5",onClick:p},i.toDisplayString(i.unref(n)("editor.color.more"))+"... ",1),i.createElementVNode("input",{ref_key:"html5Color",ref:s,type:"color",class:"absolute left-0 top-4",style:{visibility:"hidden"},onChange:g[2]||(g[2]=b=>{f(b.target.value)})},null,544)])])]),_:1})]),_:3}))}}),$z=i.reactive({extensions:[]});function zz(){return{state:$z}}const Hz=()=>{const t=i.reactive({code:"ko",limit:1e3});function e(n){t.code=n.code??t.code,t.limit=n.limit??t.limit}return{languages:t.code,update:e,limit:t.limit}},Uz="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let pi=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Uz[n[t]&63];return e};const Wz=()=>{const t=i.reactive([]),e=ht.createEventHook(),n=ht.createEventHook();function r(u){t.push(u)}function o(u){const c=t.find(f=>f.id===u.id);c&&(c.text=u.text)}function s(u){var p,m;const c=t.findIndex(g=>g.id===u.id);if(c===-1)return;const f=t[c];((p=f.position)==null?void 0:p.top)!==((m=u.position)==null?void 0:m.top)&&t.splice(c,1,{...f,pageId:u.pageId??f.pageId,position:u.position})}function a(u){const c=t.findIndex(f=>f.id===u.id);t.splice(c,1)}function l(u,c){const f=pi(6);return t.push({id:f,text:u,position:c}),f}return{removeSuperText:a,superText:t,updateSuperText:o,updatePositionSuperText:s,addMoreSuperText:l,addSuperText:r,onUpdatePositionEvent:e.on,onUpdatePositionTrigger:e.trigger,onHoverEvent:n.on,onHoverEventTrigger:n.trigger}},jz={defaultMargin:{left:"3.18cm",right:"3.18cm",top:"2.54cm",bottom:"2.54cm"},margin:{left:"20px",right:"20px",top:"20px",bottom:"20px"},defaultOrientation:"portrait",defaultBackground:"#fff",watermark:{type:"compact",alpha:.2,fontColor:"#000",fontSize:16,fontFamily:"SimSun",fontWeight:"normal",text:""},nodesComputedOption:{types:[],nodesComputed:{}},size:{label:"default",width:"100%",height:"100%",default:!0},header:!0,footer:!0,showLineNumber:!1,showToc:!1,pagination:!0,zoomLevel:100,autoWidth:!1,preview:{enabled:!1,laserPointer:!0}},wn=ht.createGlobalState(()=>{const{state:t}=zz(),e=i.ref(jz),n=i.ref(),r=i.ref(!1),{isFullscreen:o,toggle:s}=ht.useFullscreen(document.getElementById("vdc-editor")),a=i.reactive({extensions:t.extensions??[],defaultLang:PB,color:void 0,highlight:void 0,showPreview:!1,spellCheck:!1,findAndReplace:!1,printer:!1,fontFamily:"",fontSize:"",viewSuperText:!1,zoom:i.ref([100]),editor:{text:"",html:"",json:{}},AIMenu:!1}),l=Wz(),u=Hz(),c=i.ref(null);function f(Y){n.value=Y}function p(Y){a.zoom=[Y]}function m(Y){a.fontSize=Y}function g(Y){a.fontFamily=Y}function b(Y){n.value=Y,a.editor.html=Y.getHTML(),a.editor.json=Y.getJSON(),a.editor.text=Y.getText()}function y(Y){e.value={...e.value,...Y}}function w(){a.viewSuperText=!a.viewSuperText}function x(Y){a.viewSuperText=Y}function E(){a.showPreview=!a.showPreview}function k(){a.spellCheck=!a.spellCheck}function C(Y){a.spellCheck=Y}function _(){a.findAndReplace=!a.findAndReplace}function A(){a.printer=!a.printer}i.watchEffect(()=>{a.extensions=t.extensions,a.defaultLang=t.defaultLang});const T=i.ref();function P(Y){T.value=Y}function I(){var Y;(Y=T.value)==null||Y.openDialog()}function M(){var Y;(Y=T.value)==null||Y.closeDialog()}const j=i.ref([]);function U(Y){j.value=Y}function q(Y,ne,we=!0){const $e=new DOMParser().parseFromString(ne,"text/html");return Y.forEach(({loc:Ee,elementId:We,content:Q})=>{const oe=`button.super-text[${Qe.POSITION}="${Ee}"]`,ue=$e.querySelector(oe);ue&&(ue.setAttribute(Qe.ELEMENT_ID,We||""),ue.setAttribute(Qe.TEXT,we?qB(Q):Q))}),$e.body.innerHTML}const le=Y=>c.value=Y,H=i.ref(null),F=i.ref();function L(Y){F.value=Y}const K=i.ref();function J(Y){K.value=Y}return{state:a,page:e,isFullscreen:o,toggleFullscreen:s,updateEditorState:b,setEditor:f,isReady:r,container:"#vdc-editor",editor:n,changeZoom:p,changePageOption:y,changeFontFamily:g,changeFontSize:m,toggleSuperText:w,superTextStore:l,checkSpellStore:u,viewSuperText:x,toggleFindAndReplace:_,togglePreview:E,toggleSpellCheck:k,setSpellCheck:C,togglePrinter:A,setEditorContextMenuRef:P,openSuperInput:I,closeSuperInput:M,imageAttachments:j,setImageAttachment:U,getUpdatedContentBySuperText:q,textAlert:c,setTextAlert:le,focusFirstInvalidChar:H,editorSelectedMobile:F,setEditorSelectedMobile:L,editorContentMobile:K,setEditorContentMobile:J}}),eg=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function tg(t,e,n,r){t.addEventListener?t.addEventListener(e,n,r):t.attachEvent&&t.attachEvent("on".concat(e),n)}function qu(t,e,n,r){t.removeEventListener?t.removeEventListener(e,n,r):t.detachEvent&&t.detachEvent("on".concat(e),n)}function bC(t,e){const n=e.slice(0,e.length-1);for(let r=0;r<n.length;r++)n[r]=t[n[r].toLowerCase()];return n}function vC(t){typeof t!="string"&&(t=""),t=t.replace(/\s/g,"");const e=t.split(",");let n=e.lastIndexOf("");for(;n>=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function qz(t,e){const n=t.length>=e.length?t:e,r=t.length>=e.length?e:t;let o=!0;for(let s=0;s<n.length;s++)r.indexOf(n[s])===-1&&(o=!1);return o}const Ku={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":eg?173:189,"=":eg?61:187,";":eg?59:186,"'":222,"[":219,"]":221,"\\":220},$o={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},If={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},An={16:!1,18:!1,17:!1,91:!1},Qt={};for(let t=1;t<20;t++)Ku["f".concat(t)]=111+t;let Yt=[],Gu=null,yC="all";const hi=new Map,Xu=t=>Ku[t.toLowerCase()]||$o[t.toLowerCase()]||t.toUpperCase().charCodeAt(0),Kz=t=>Object.keys(Ku).find(e=>Ku[e]===t),Gz=t=>Object.keys($o).find(e=>$o[e]===t);function wC(t){yC=t||"all"}function Yu(){return yC||"all"}function Xz(){return Yt.slice(0)}function Yz(){return Yt.map(t=>Kz(t)||Gz(t)||String.fromCharCode(t))}function Jz(){const t=[];return Object.keys(Qt).forEach(e=>{Qt[e].forEach(n=>{let{key:r,scope:o,mods:s,shortcut:a}=n;t.push({scope:o,shortcut:a,mods:s,keys:r.split("+").map(l=>Xu(l))})})}),t}function Zz(t){const e=t.target||t.srcElement,{tagName:n}=e;let r=!0;const o=n==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(e.type);return(e.isContentEditable||(o||n==="TEXTAREA"||n==="SELECT")&&!e.readOnly)&&(r=!1),r}function Qz(t){return typeof t=="string"&&(t=Xu(t)),Yt.indexOf(t)!==-1}function Nz(t,e){let n,r;t||(t=Yu());for(const o in Qt)if(Object.prototype.hasOwnProperty.call(Qt,o))for(n=Qt[o],r=0;r<n.length;)n[r].scope===t?n.splice(r,1).forEach(a=>{let{element:l}=a;return ng(l)}):r++;Yu()===t&&wC(e||"all")}function eH(t){let e=t.keyCode||t.which||t.charCode;const n=Yt.indexOf(e);if(n>=0&&Yt.splice(n,1),t.key&&t.key.toLowerCase()==="meta"&&Yt.splice(0,Yt.length),(e===93||e===224)&&(e=91),e in An){An[e]=!1;for(const r in $o)$o[r]===e&&(fo[r]=!1)}}function xC(t){if(typeof t>"u")Object.keys(Qt).forEach(o=>{Array.isArray(Qt[o])&&Qt[o].forEach(s=>Rf(s)),delete Qt[o]}),ng(null);else if(Array.isArray(t))t.forEach(o=>{o.key&&Rf(o)});else if(typeof t=="object")t.key&&Rf(t);else if(typeof t=="string"){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];let[o,s]=n;typeof o=="function"&&(s=o,o=""),Rf({key:t,scope:o,method:s,splitKey:"+"})}}const Rf=t=>{let{key:e,scope:n,method:r,splitKey:o="+"}=t;vC(e).forEach(a=>{const l=a.split(o),u=l.length,c=l[u-1],f=c==="*"?"*":Xu(c);if(!Qt[f])return;n||(n=Yu());const p=u>1?bC($o,l):[],m=[];Qt[f]=Qt[f].filter(g=>{const y=(r?g.method===r:!0)&&g.scope===n&&qz(g.mods,p);return y&&m.push(g.element),!y}),m.forEach(g=>ng(g))})};function CC(t,e,n,r){if(e.element!==r)return;let o;if(e.scope===n||e.scope==="all"){o=e.mods.length>0;for(const s in An)Object.prototype.hasOwnProperty.call(An,s)&&(!An[s]&&e.mods.indexOf(+s)>-1||An[s]&&e.mods.indexOf(+s)===-1)&&(o=!1);(e.mods.length===0&&!An[16]&&!An[18]&&!An[17]&&!An[91]||o||e.shortcut==="*")&&(e.keys=[],e.keys=e.keys.concat(Yt),e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0)))}}function EC(t,e){const n=Qt["*"];let r=t.keyCode||t.which||t.charCode;if(!fo.filter.call(this,t))return;if((r===93||r===224)&&(r=91),Yt.indexOf(r)===-1&&r!==229&&Yt.push(r),["metaKey","ctrlKey","altKey","shiftKey"].forEach(l=>{const u=If[l];t[l]&&Yt.indexOf(u)===-1?Yt.push(u):!t[l]&&Yt.indexOf(u)>-1?Yt.splice(Yt.indexOf(u),1):l==="metaKey"&&t[l]&&(Yt=Yt.filter(c=>c in If||c===r))}),r in An){An[r]=!0;for(const l in $o)$o[l]===r&&(fo[l]=!0);if(!n)return}for(const l in An)Object.prototype.hasOwnProperty.call(An,l)&&(An[l]=t[If[l]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(Yt.indexOf(17)===-1&&Yt.push(17),Yt.indexOf(18)===-1&&Yt.push(18),An[17]=!0,An[18]=!0);const o=Yu();if(n)for(let l=0;l<n.length;l++)n[l].scope===o&&(t.type==="keydown"&&n[l].keydown||t.type==="keyup"&&n[l].keyup)&&CC(t,n[l],o,e);if(!(r in Qt))return;const s=Qt[r],a=s.length;for(let l=0;l<a;l++)if((t.type==="keydown"&&s[l].keydown||t.type==="keyup"&&s[l].keyup)&&s[l].key){const u=s[l],{splitKey:c}=u,f=u.key.split(c),p=[];for(let m=0;m<f.length;m++)p.push(Xu(f[m]));p.sort().join("")===Yt.sort().join("")&&CC(t,u,o,e)}}function fo(t,e,n){Yt=[];const r=vC(t);let o=[],s="all",a=document,l=0,u=!1,c=!0,f="+",p=!1,m=!1;for(n===void 0&&typeof e=="function"&&(n=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(s=e.scope),e.element&&(a=e.element),e.keyup&&(u=e.keyup),e.keydown!==void 0&&(c=e.keydown),e.capture!==void 0&&(p=e.capture),typeof e.splitKey=="string"&&(f=e.splitKey),e.single===!0&&(m=!0)),typeof e=="string"&&(s=e),m&&xC(t,s);l<r.length;l++)t=r[l].split(f),o=[],t.length>1&&(o=bC($o,t)),t=t[t.length-1],t=t==="*"?"*":Xu(t),t in Qt||(Qt[t]=[]),Qt[t].push({keyup:u,keydown:c,scope:s,mods:o,shortcut:r[l],method:n,key:r[l],splitKey:f,element:a});if(typeof a<"u"&&window){if(!hi.has(a)){const g=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return EC(y,a)},b=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;EC(y,a),eH(y)};hi.set(a,{keydownListener:g,keyupListenr:b,capture:p}),tg(a,"keydown",g,p),tg(a,"keyup",b,p)}if(!Gu){const g=()=>{Yt=[]};Gu={listener:g,capture:p},tg(window,"focus",g,p)}}}function tH(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(Qt).forEach(n=>{Qt[n].filter(o=>o.scope===e&&o.shortcut===t).forEach(o=>{o&&o.method&&o.method()})})}function ng(t){const e=Object.values(Qt).flat();if(e.findIndex(r=>{let{element:o}=r;return o===t})<0){const{keydownListener:r,keyupListenr:o,capture:s}=hi.get(t)||{};r&&o&&(qu(t,"keyup",o,s),qu(t,"keydown",r,s),hi.delete(t))}if((e.length<=0||hi.size<=0)&&(Object.keys(hi).forEach(o=>{const{keydownListener:s,keyupListenr:a,capture:l}=hi.get(o)||{};s&&a&&(qu(o,"keyup",a,l),qu(o,"keydown",s,l),hi.delete(o))}),hi.clear(),Object.keys(Qt).forEach(o=>delete Qt[o]),Gu)){const{listener:o,capture:s}=Gu;qu(window,"focus",o,s),Gu=null}}const rg={getPressedKeyString:Yz,setScope:wC,getScope:Yu,deleteScope:Nz,getPressedKeyCodes:Xz,getAllKeyCodes:Jz,isPressed:Qz,filter:Zz,trigger:tH,unbind:xC,keyMap:Ku,modifier:$o,modifierMap:If};for(const t in rg)Object.prototype.hasOwnProperty.call(rg,t)&&(fo[t]=rg[t]);if(typeof window<"u"){const t=window.hotkeys;fo.noConflict=e=>(e&&window.hotkeys===fo&&(window.hotkeys=t),fo),window.hotkeys=fo}const Ju=(t,e)=>{fo.filter=()=>!0;const n=()=>{fo(t,o=>(o.preventDefault(),e(),!1))},r=()=>{fo.unbind(t)};return i.onBeforeUnmount(()=>{r()}),{bind:n,unbind:r}},nH=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,rH=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,oH=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,iH=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,kC=Dn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Vs({find:nH,type:this.type}),Vs({find:oH,type:this.type})]},addPasteRules(){return[ji({find:rH,type:this.type}),ji({find:iH,type:this.type})]}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.chain().focus().toggleBold().run(),isActive:()=>e.isActive("bold")||!1,disabled:!e.can().toggleBold(),icon:"Bold",shortcutKeys:["mod","B"],tooltip:n("editor.bold.tooltip")}})}}}),sH=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,aH=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,lH=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,uH=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,SC=Dn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Vs({find:sH,type:this.type}),Vs({find:lH,type:this.type})]},addPasteRules(){return[ji({find:aH,type:this.type}),ji({find:uH,type:this.type})]}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n}){return{component:Ke,componentProps:{action:()=>{e.chain().focus().toggleItalic().run()},isActive:()=>e.isActive("italic")||!1,disabled:!e.can().toggleItalic(),shortcutKeys:["mod","I"],icon:"Italic",tooltip:n("editor.italic.tooltip")}}}}}}),_C=Dn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n}){return{component:Ke,componentProps:{action:()=>e.chain().focus().toggleUnderline().run(),isActive:()=>e.isActive("underline")||!1,disabled:!e.can().toggleUnderline(),icon:"Underline",shortcutKeys:["mod","U"],tooltip:n("editor.underline.tooltip")}}}}}}),cH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,dH=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,TC=Dn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Vs({find:cH,type:this.type})]},addPasteRules(){return[ji({find:dH,type:this.type})]}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.chain().focus().toggleStrike().run(),isActive:()=>e.isActive("strike")||!1,disabled:!e.can().toggleStrike(),icon:"Strikethrough",shortcutKeys:["shift","mod","X"],tooltip:n("editor.strike.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Shift-x":()=>this.editor.commands.toggleStrike()}}}),fH=/(^|[^`])`([^`]+)`(?!`)/,pH=/(^|[^`])`([^`]+)`(?!`)/g,hH=Dn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Vs({find:fH,type:this.type})]},addPasteRules(){return[ji({find:pH,type:this.type})]}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.toggleCode(),isActive:()=>e.isActive("code")||!1,disabled:!e.can().toggleCode(),icon:"Code",shortcutKeys:["mod","E"],tooltip:n("editor.code.tooltip")}})}}}),mH=/^```([a-z]+)?[\s\n]$/,gH=/^~~~([a-z]+)?[\s\n]$/,bH=Bt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(a=>a.startsWith(n)).map(a=>a.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",bt(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
|
|
225
225
|
|
|
226
|
-
`);return!s||!a?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(
|
|
226
|
+
`);return!s||!a?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:s}=n;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const l=o.after();return l===void 0?!1:r.nodeAt(l)?t.commands.command(({tr:c})=>(c.setSelection(Ve.near(r.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[i0({find:mH,type:this.type,getAttributes:t=>({language:t[1]})}),i0({find:gH,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new tt({key:new kt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o==null?void 0:o.mode;if(!n||!s)return!1;const{tr:a,schema:l}=t.state,u=l.text(n.replace(/\r\n?/g,`
|
|
227
227
|
`));return a.replaceSelectionWith(this.type.create({language:s},u)),a.selection.$from.parent.type!==this.type&&a.setSelection(Te.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),t.dispatch(a),!0}}})]}});function vH(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function AC(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{const n=t[e],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&AC(n)}),t}let OC=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function MC(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function rs(t,...e){const n=Object.create(null);for(const r in t)n[r]=t[r];return e.forEach(function(r){for(const o in r)n[o]=r[o]}),n}const yH="</span>",BC=t=>!!t.scope,wH=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){const n=t.split(".");return[`${e}${n.shift()}`,...n.map((r,o)=>`${r}${"_".repeat(o+1)}`)].join(" ")}return`${e}${t}`};class xH{constructor(e,n){this.buffer="",this.classPrefix=n.classPrefix,e.walk(this)}addText(e){this.buffer+=MC(e)}openNode(e){if(!BC(e))return;const n=wH(e.scope,{prefix:this.classPrefix});this.span(n)}closeNode(e){BC(e)&&(this.buffer+=yH)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}}const IC=(t={})=>{const e={children:[]};return Object.assign(e,t),e};class og{constructor(){this.rootNode=IC(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const n=IC({scope:e});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,n){return typeof n=="string"?e.addText(n):n.children&&(e.openNode(n),n.children.forEach(r=>this._walk(e,r)),e.closeNode(n)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(n=>typeof n=="string")?e.children=[e.children.join("")]:e.children.forEach(n=>{og._collapse(n)}))}}class CH extends og{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,n){const r=e.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new xH(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Zu(t){return t?typeof t=="string"?t:t.source:null}function RC(t){return na("(?=",t,")")}function EH(t){return na("(?:",t,")*")}function kH(t){return na("(?:",t,")?")}function na(...t){return t.map(n=>Zu(n)).join("")}function SH(t){const e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function ig(...t){return"("+(SH(t).capture?"":"?:")+t.map(r=>Zu(r)).join("|")+")"}function LC(t){return new RegExp(t.toString()+"|").exec("").length-1}function _H(t,e){const n=t&&t.exec(e);return n&&n.index===0}const TH=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function sg(t,{joinWith:e}){let n=0;return t.map(r=>{n+=1;const o=n;let s=Zu(r),a="";for(;s.length>0;){const l=TH.exec(s);if(!l){a+=s;break}a+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+o):(a+=l[0],l[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(e)}const AH=/\b\B/,PC="[a-zA-Z]\\w*",ag="[a-zA-Z_]\\w*",DC="\\b\\d+(\\.\\d+)?",VC="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",FC="\\b(0b[01]+)",OH="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",MH=(t={})=>{const e=/^#![ ]*\//;return t.binary&&(t.begin=na(e,/.*\b/,t.binary,/\b.*/)),rs({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},t)},Qu={begin:"\\\\[\\s\\S]",relevance:0},BH={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Qu]},IH={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Qu]},RH={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Lf=function(t,e,n={}){const r=rs({scope:"comment",begin:t,end:e,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const o=ig("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:na(/[ ]+/,"(",o,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},LH=Lf("//","$"),PH=Lf("/\\*","\\*/"),DH=Lf("#","$"),VH={scope:"number",begin:DC,relevance:0},FH={scope:"number",begin:VC,relevance:0},$H={scope:"number",begin:FC,relevance:0},zH={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Qu,{begin:/\[/,end:/\]/,relevance:0,contains:[Qu]}]},HH={scope:"title",begin:PC,relevance:0},UH={scope:"title",begin:ag,relevance:0},WH={begin:"\\.\\s*"+ag,relevance:0};var Pf=Object.freeze({__proto__:null,APOS_STRING_MODE:BH,BACKSLASH_ESCAPE:Qu,BINARY_NUMBER_MODE:$H,BINARY_NUMBER_RE:FC,COMMENT:Lf,C_BLOCK_COMMENT_MODE:PH,C_LINE_COMMENT_MODE:LH,C_NUMBER_MODE:FH,C_NUMBER_RE:VC,END_SAME_AS_BEGIN:function(t){return Object.assign(t,{"on:begin":(e,n)=>{n.data._beginMatch=e[1]},"on:end":(e,n)=>{n.data._beginMatch!==e[1]&&n.ignoreMatch()}})},HASH_COMMENT_MODE:DH,IDENT_RE:PC,MATCH_NOTHING_RE:AH,METHOD_GUARD:WH,NUMBER_MODE:VH,NUMBER_RE:DC,PHRASAL_WORDS_MODE:RH,QUOTE_STRING_MODE:IH,REGEXP_MODE:zH,RE_STARTERS_RE:OH,SHEBANG:MH,TITLE_MODE:HH,UNDERSCORE_IDENT_RE:ag,UNDERSCORE_TITLE_MODE:UH});function jH(t,e){t.input[t.index-1]==="."&&e.ignoreMatch()}function qH(t,e){t.className!==void 0&&(t.scope=t.className,delete t.className)}function KH(t,e){e&&t.beginKeywords&&(t.begin="\\b("+t.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",t.__beforeBegin=jH,t.keywords=t.keywords||t.beginKeywords,delete t.beginKeywords,t.relevance===void 0&&(t.relevance=0))}function GH(t,e){Array.isArray(t.illegal)&&(t.illegal=ig(...t.illegal))}function XH(t,e){if(t.match){if(t.begin||t.end)throw new Error("begin & end are not supported with match");t.begin=t.match,delete t.match}}function YH(t,e){t.relevance===void 0&&(t.relevance=1)}const JH=(t,e)=>{if(!t.beforeMatch)return;if(t.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},t);Object.keys(t).forEach(r=>{delete t[r]}),t.keywords=n.keywords,t.begin=na(n.beforeMatch,RC(n.begin)),t.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},t.relevance=0,delete n.beforeMatch},ZH=["of","and","for","in","not","or","if","then","parent","list","value"],QH="keyword";function $C(t,e,n=QH){const r=Object.create(null);return typeof t=="string"?o(n,t.split(" ")):Array.isArray(t)?o(n,t):Object.keys(t).forEach(function(s){Object.assign(r,$C(t[s],e,s))}),r;function o(s,a){e&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const u=l.split("|");r[u[0]]=[s,NH(u[0],u[1])]})}}function NH(t,e){return e?Number(e):eU(t)?0:1}function eU(t){return ZH.includes(t.toLowerCase())}const zC={},ra=t=>{console.error(t)},HC=(t,...e)=>{console.log(`WARN: ${t}`,...e)},wl=(t,e)=>{zC[`${t}/${e}`]||(console.log(`Deprecated as of ${t}. ${e}`),zC[`${t}/${e}`]=!0)},Df=new Error;function UC(t,e,{key:n}){let r=0;const o=t[n],s={},a={};for(let l=1;l<=e.length;l++)a[l+r]=o[l],s[l+r]=!0,r+=LC(e[l-1]);t[n]=a,t[n]._emit=s,t[n]._multi=!0}function tU(t){if(Array.isArray(t.begin)){if(t.skip||t.excludeBegin||t.returnBegin)throw ra("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Df;if(typeof t.beginScope!="object"||t.beginScope===null)throw ra("beginScope must be object"),Df;UC(t,t.begin,{key:"beginScope"}),t.begin=sg(t.begin,{joinWith:""})}}function nU(t){if(Array.isArray(t.end)){if(t.skip||t.excludeEnd||t.returnEnd)throw ra("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Df;if(typeof t.endScope!="object"||t.endScope===null)throw ra("endScope must be object"),Df;UC(t,t.end,{key:"endScope"}),t.end=sg(t.end,{joinWith:""})}}function rU(t){t.scope&&typeof t.scope=="object"&&t.scope!==null&&(t.beginScope=t.scope,delete t.scope)}function oU(t){rU(t),typeof t.beginScope=="string"&&(t.beginScope={_wrap:t.beginScope}),typeof t.endScope=="string"&&(t.endScope={_wrap:t.endScope}),tU(t),nU(t)}function iU(t){function e(a,l){return new RegExp(Zu(a),"m"+(t.case_insensitive?"i":"")+(t.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,u){u.position=this.position++,this.matchIndexes[this.matchAt]=u,this.regexes.push([u,l]),this.matchAt+=LC(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(u=>u[1]);this.matcherRe=e(sg(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const u=this.matcherRe.exec(l);if(!u)return null;const c=u.findIndex((p,m)=>m>0&&p!==void 0),f=this.matchIndexes[c];return u.splice(0,c),Object.assign(u,f)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(l){if(this.multiRegexes[l])return this.multiRegexes[l];const u=new n;return this.rules.slice(l).forEach(([c,f])=>u.addRule(c,f)),u.compile(),this.multiRegexes[l]=u,u}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,u){this.rules.push([l,u]),u.type==="begin"&&this.count++}exec(l){const u=this.getMatcher(this.regexIndex);u.lastIndex=this.lastIndex;let c=u.exec(l);if(this.resumingScanAtSamePosition()&&!(c&&c.index===this.lastIndex)){const f=this.getMatcher(0);f.lastIndex=this.lastIndex+1,c=f.exec(l)}return c&&(this.regexIndex+=c.position+1,this.regexIndex===this.count&&this.considerAll()),c}}function o(a){const l=new r;return a.contains.forEach(u=>l.addRule(u.begin,{rule:u,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function s(a,l){const u=a;if(a.isCompiled)return u;[qH,XH,oU,JH].forEach(f=>f(a,l)),t.compilerExtensions.forEach(f=>f(a,l)),a.__beforeBegin=null,[KH,GH,YH].forEach(f=>f(a,l)),a.isCompiled=!0;let c=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),c=a.keywords.$pattern,delete a.keywords.$pattern),c=c||/\w+/,a.keywords&&(a.keywords=$C(a.keywords,t.case_insensitive)),u.keywordPatternRe=e(c,!0),l&&(a.begin||(a.begin=/\B|\b/),u.beginRe=e(u.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(u.endRe=e(u.end)),u.terminatorEnd=Zu(u.end)||"",a.endsWithParent&&l.terminatorEnd&&(u.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(u.illegalRe=e(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(f){return sU(f==="self"?a:f)})),a.contains.forEach(function(f){s(f,u)}),a.starts&&s(a.starts,l),u.matcher=o(u),u}if(t.compilerExtensions||(t.compilerExtensions=[]),t.contains&&t.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return t.classNameAliases=rs(t.classNameAliases||{}),s(t)}function WC(t){return t?t.endsWithParent||WC(t.starts):!1}function sU(t){return t.variants&&!t.cachedVariants&&(t.cachedVariants=t.variants.map(function(e){return rs(t,{variants:null},e)})),t.cachedVariants?t.cachedVariants:WC(t)?rs(t,{starts:t.starts?rs(t.starts):null}):Object.isFrozen(t)?rs(t):t}var aU="11.10.0";class lU extends Error{constructor(e,n){super(e),this.name="HTMLInjectionError",this.html=n}}const lg=MC,jC=rs,qC=Symbol("nomatch"),uU=7,KC=function(t){const e=Object.create(null),n=Object.create(null),r=[];let o=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:CH};function u(L){return l.noHighlightRe.test(L)}function c(L){let K=L.className+" ";K+=L.parentNode?L.parentNode.className:"";const J=l.languageDetectRe.exec(K);if(J){const Y=I(J[1]);return Y||(HC(s.replace("{}",J[1])),HC("Falling back to no-highlight mode for this block.",L)),Y?J[1]:"no-highlight"}return K.split(/\s+/).find(Y=>u(Y)||I(Y))}function f(L,K,J){let Y="",ne="";typeof K=="object"?(Y=L,J=K.ignoreIllegals,ne=K.language):(wl("10.7.0","highlight(lang, code, ...args) has been deprecated."),wl("10.7.0",`Please use highlight(code, options) instead.
|
|
228
228
|
https://github.com/highlightjs/highlight.js/issues/2277`),ne=L,Y=K),J===void 0&&(J=!0);const we={code:Y,language:ne};H("before:highlight",we);const xe=we.result?we.result:p(we.language,we.code,J);return xe.code=we.code,H("after:highlight",xe),xe}function p(L,K,J,Y){const ne=Object.create(null);function we(ee,he){return ee.keywords[he]}function xe(){if(!V.keywords){ge.addText(Re);return}let ee=0;V.keywordPatternRe.lastIndex=0;let he=V.keywordPatternRe.exec(Re),Fe="";for(;he;){Fe+=Re.substring(ee,he.index);const Je=mt.case_insensitive?he[0].toLowerCase():he[0],St=we(V,Je);if(St){const[Kt,vo]=St;if(ge.addText(Fe),Fe="",ne[Je]=(ne[Je]||0)+1,ne[Je]<=uU&&(Ne+=vo),Kt.startsWith("_"))Fe+=he[0];else{const ie=mt.classNameAliases[Kt]||Kt;We(he[0],ie)}}else Fe+=he[0];ee=V.keywordPatternRe.lastIndex,he=V.keywordPatternRe.exec(Re)}Fe+=Re.substring(ee),ge.addText(Fe)}function $e(){if(Re==="")return;let ee=null;if(typeof V.subLanguage=="string"){if(!e[V.subLanguage]){ge.addText(Re);return}ee=p(V.subLanguage,Re,!0,se[V.subLanguage]),se[V.subLanguage]=ee._top}else ee=g(Re,V.subLanguage.length?V.subLanguage:null);V.relevance>0&&(Ne+=ee.relevance),ge.__addSublanguage(ee._emitter,ee.language)}function Ee(){V.subLanguage!=null?$e():xe(),Re=""}function We(ee,he){ee!==""&&(ge.startScope(he),ge.addText(ee),ge.endScope())}function Q(ee,he){let Fe=1;const Je=he.length-1;for(;Fe<=Je;){if(!ee._emit[Fe]){Fe++;continue}const St=mt.classNameAliases[ee[Fe]]||ee[Fe],Kt=he[Fe];St?We(Kt,St):(Re=Kt,xe(),Re=""),Fe++}}function oe(ee,he){return ee.scope&&typeof ee.scope=="string"&&ge.openNode(mt.classNameAliases[ee.scope]||ee.scope),ee.beginScope&&(ee.beginScope._wrap?(We(Re,mt.classNameAliases[ee.beginScope._wrap]||ee.beginScope._wrap),Re=""):ee.beginScope._multi&&(Q(ee.beginScope,he),Re="")),V=Object.create(ee,{parent:{value:V}}),V}function ue(ee,he,Fe){let Je=_H(ee.endRe,Fe);if(Je){if(ee["on:end"]){const St=new OC(ee);ee["on:end"](he,St),St.isMatchIgnored&&(Je=!1)}if(Je){for(;ee.endsParent&&ee.parent;)ee=ee.parent;return ee}}if(ee.endsWithParent)return ue(ee.parent,he,Fe)}function ce(ee){return V.matcher.regexIndex===0?(Re+=ee[0],1):(Z=!0,0)}function be(ee){const he=ee[0],Fe=ee.rule,Je=new OC(Fe),St=[Fe.__beforeBegin,Fe["on:begin"]];for(const Kt of St)if(Kt&&(Kt(ee,Je),Je.isMatchIgnored))return ce(he);return Fe.skip?Re+=he:(Fe.excludeBegin&&(Re+=he),Ee(),!Fe.returnBegin&&!Fe.excludeBegin&&(Re=he)),oe(Fe,ee),Fe.returnBegin?0:he.length}function N(ee){const he=ee[0],Fe=K.substring(ee.index),Je=ue(V,ee,Fe);if(!Je)return qC;const St=V;V.endScope&&V.endScope._wrap?(Ee(),We(he,V.endScope._wrap)):V.endScope&&V.endScope._multi?(Ee(),Q(V.endScope,ee)):St.skip?Re+=he:(St.returnEnd||St.excludeEnd||(Re+=he),Ee(),St.excludeEnd&&(Re=he));do V.scope&&ge.closeNode(),!V.skip&&!V.subLanguage&&(Ne+=V.relevance),V=V.parent;while(V!==Je.parent);return Je.starts&&oe(Je.starts,ee),St.returnEnd?0:he.length}function ve(){const ee=[];for(let he=V;he!==mt;he=he.parent)he.scope&&ee.unshift(he.scope);ee.forEach(he=>ge.openNode(he))}let Me={};function Ue(ee,he){const Fe=he&&he[0];if(Re+=ee,Fe==null)return Ee(),0;if(Me.type==="begin"&&he.type==="end"&&Me.index===he.index&&Fe===""){if(Re+=K.slice(he.index,he.index+1),!o){const Je=new Error(`0 width match regex (${L})`);throw Je.languageName=L,Je.badRule=Me.rule,Je}return 1}if(Me=he,he.type==="begin")return be(he);if(he.type==="illegal"&&!J){const Je=new Error('Illegal lexeme "'+Fe+'" for mode "'+(V.scope||"<unnamed>")+'"');throw Je.mode=V,Je}else if(he.type==="end"){const Je=N(he);if(Je!==qC)return Je}if(he.type==="illegal"&&Fe==="")return 1;if(D>1e5&&D>he.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Re+=Fe,Fe.length}const mt=I(L);if(!mt)throw ra(s.replace("{}",L)),new Error('Unknown language: "'+L+'"');const Et=iU(mt);let z="",V=Y||Et;const se={},ge=new l.__emitter(l);ve();let Re="",Ne=0,ze=0,D=0,Z=!1;try{if(mt.__emitTokens)mt.__emitTokens(K,ge);else{for(V.matcher.considerAll();;){D++,Z?Z=!1:V.matcher.considerAll(),V.matcher.lastIndex=ze;const ee=V.matcher.exec(K);if(!ee)break;const he=K.substring(ze,ee.index),Fe=Ue(he,ee);ze=ee.index+Fe}Ue(K.substring(ze))}return ge.finalize(),z=ge.toHTML(),{language:L,value:z,relevance:Ne,illegal:!1,_emitter:ge,_top:V}}catch(ee){if(ee.message&&ee.message.includes("Illegal"))return{language:L,value:lg(K),illegal:!0,relevance:0,_illegalBy:{message:ee.message,index:ze,context:K.slice(ze-100,ze+100),mode:ee.mode,resultSoFar:z},_emitter:ge};if(o)return{language:L,value:lg(K),illegal:!1,relevance:0,errorRaised:ee,_emitter:ge,_top:V};throw ee}}function m(L){const K={value:lg(L),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return K._emitter.addText(L),K}function g(L,K){K=K||l.languages||Object.keys(e);const J=m(L),Y=K.filter(I).filter(j).map(Ee=>p(Ee,L,!1));Y.unshift(J);const ne=Y.sort((Ee,We)=>{if(Ee.relevance!==We.relevance)return We.relevance-Ee.relevance;if(Ee.language&&We.language){if(I(Ee.language).supersetOf===We.language)return 1;if(I(We.language).supersetOf===Ee.language)return-1}return 0}),[we,xe]=ne,$e=we;return $e.secondBest=xe,$e}function b(L,K,J){const Y=K&&n[K]||J;L.classList.add("hljs"),L.classList.add(`language-${Y}`)}function y(L){let K=null;const J=c(L);if(u(J))return;if(H("before:highlightElement",{el:L,language:J}),L.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",L);return}if(L.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(L)),l.throwUnescapedHTML))throw new lU("One of your code blocks includes unescaped HTML.",L.innerHTML);K=L;const Y=K.textContent,ne=J?f(Y,{language:J,ignoreIllegals:!0}):g(Y);L.innerHTML=ne.value,L.dataset.highlighted="yes",b(L,J,ne.language),L.result={language:ne.language,re:ne.relevance,relevance:ne.relevance},ne.secondBest&&(L.secondBest={language:ne.secondBest.language,relevance:ne.secondBest.relevance}),H("after:highlightElement",{el:L,result:ne,text:Y})}function w(L){l=jC(l,L)}const x=()=>{C(),wl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function E(){C(),wl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let k=!1;function C(){if(document.readyState==="loading"){k=!0;return}document.querySelectorAll(l.cssSelector).forEach(y)}function _(){k&&C()}typeof window<"u"&&window.addEventListener&&window.addEventListener("DOMContentLoaded",_,!1);function A(L,K){let J=null;try{J=K(t)}catch(Y){if(ra("Language definition for '{}' could not be registered.".replace("{}",L)),o)ra(Y);else throw Y;J=a}J.name||(J.name=L),e[L]=J,J.rawDefinition=K.bind(null,t),J.aliases&&M(J.aliases,{languageName:L})}function T(L){delete e[L];for(const K of Object.keys(n))n[K]===L&&delete n[K]}function P(){return Object.keys(e)}function I(L){return L=(L||"").toLowerCase(),e[L]||e[n[L]]}function M(L,{languageName:K}){typeof L=="string"&&(L=[L]),L.forEach(J=>{n[J.toLowerCase()]=K})}function j(L){const K=I(L);return K&&!K.disableAutodetect}function U(L){L["before:highlightBlock"]&&!L["before:highlightElement"]&&(L["before:highlightElement"]=K=>{L["before:highlightBlock"](Object.assign({block:K.el},K))}),L["after:highlightBlock"]&&!L["after:highlightElement"]&&(L["after:highlightElement"]=K=>{L["after:highlightBlock"](Object.assign({block:K.el},K))})}function q(L){U(L),r.push(L)}function le(L){const K=r.indexOf(L);K!==-1&&r.splice(K,1)}function H(L,K){const J=L;r.forEach(function(Y){Y[J]&&Y[J](K)})}function F(L){return wl("10.7.0","highlightBlock will be removed entirely in v12.0"),wl("10.7.0","Please use highlightElement now."),y(L)}Object.assign(t,{highlight:f,highlightAuto:g,highlightAll:C,highlightElement:y,highlightBlock:F,configure:w,initHighlighting:x,initHighlightingOnLoad:E,registerLanguage:A,unregisterLanguage:T,listLanguages:P,getLanguage:I,registerAliases:M,autoDetection:j,inherit:jC,addPlugin:q,removePlugin:le}),t.debugMode=function(){o=!1},t.safeMode=function(){o=!0},t.versionString=aU,t.regex={concat:na,lookahead:RC,either:ig,optional:kH,anyNumberOfTimes:EH};for(const L in Pf)typeof Pf[L]=="object"&&AC(Pf[L]);return Object.assign(t,Pf),t},xl=KC({});xl.newInstance=()=>KC({});var cU=xl;xl.HighlightJS=xl,xl.default=xl;var dU=vH(cU);function GC(t,e=[]){return t.map(n=>{const r=[...e,...n.properties?n.properties.className:[]];return n.children?GC(n.children,r):{text:n.value,classes:r}}).flat()}function XC(t){return t.value||t.children||[]}function fU(t){return!!dU.getLanguage(t)}function YC({doc:t,name:e,lowlight:n,defaultLanguage:r}){const o=[];return Qm(t,s=>s.type.name===e).forEach(s=>{var a;let l=s.pos+1;const u=s.node.attrs.language||r,c=n.listLanguages(),f=u&&(c.includes(u)||fU(u)||!((a=n.registered)===null||a===void 0)&&a.call(n,u))?XC(n.highlight(u,s.node.textContent)):XC(n.highlightAuto(s.node.textContent));GC(f).forEach(p=>{const m=l+p.text.length;if(p.classes.length){const g=jt.inline(l,m,{class:p.classes.join(" ")});o.push(g)}l=m})}),ft.create(t,o)}function pU(t){return typeof t=="function"}function hU({name:t,lowlight:e,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(o=>pU(e[o])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new tt({key:new kt("lowlight"),state:{init:(o,{doc:s})=>YC({doc:s,name:t,lowlight:e,defaultLanguage:n}),apply:(o,s,a,l)=>{const u=a.selection.$head.parent.type.name,c=l.selection.$head.parent.type.name,f=Qm(a.doc,m=>m.type.name===t),p=Qm(l.doc,m=>m.type.name===t);return o.docChanged&&([u,c].includes(t)||p.length!==f.length||o.steps.some(m=>m.from!==void 0&&m.to!==void 0&&f.some(g=>g.pos>=m.from&&g.pos+g.node.nodeSize<=m.to)))?YC({doc:o.doc,name:t,lowlight:e,defaultLanguage:n}):s.map(o.mapping,o.doc)}},props:{decorations(o){return r.getState(o)}}});return r}const mU=bH.extend({addOptions(){var t;return{...(t=this.parent)===null||t===void 0?void 0:t.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},addProseMirrorPlugins(){var t;return[...((t=this.parent)===null||t===void 0?void 0:t.call(this))||[],hU({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),gU=i.defineComponent({__name:"SelectSeparator",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(jP),i.mergeProps(n.value,{class:i.unref(ke)("-mx-1 my-1 h-px bg-ed-muted",e.class)}),null,16,["class"]))}}),bU=i.defineComponent({__name:"Select",props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},dir:{},name:{},autocomplete:{},disabled:{type:Boolean},required:{type:Boolean}},emits:["update:modelValue","update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(BP),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),vU=i.defineComponent({__name:"SelectValue",props:{placeholder:{},asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(eD),i.normalizeProps(i.guardReactiveProps(e)),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16))}});/**
|
|
229
229
|
* @license lucide-vue-next v0.439.0 - ISC
|
|
@@ -280,32 +280,32 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ne=L,Y=K),J===void 0&&
|
|
|
280
280
|
*
|
|
281
281
|
* This source code is licensed under the ISC license.
|
|
282
282
|
* See the LICENSE file in the root directory of this source tree.
|
|
283
|
-
*/const Ff=oa("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),kU=i.defineComponent({__name:"SelectTrigger",props:{disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(LP),i.mergeProps(i.unref(r),{class:i.unref(ke)("flex h-10 w-full items-center justify-between rounded-md border border-ed-input bg-ed-background px-3 py-2 text-sm ring-offset-ed-background data-[placeholder]:text-ed-muted-foreground focus:outline-none focus:ring-2 focus:ring-ed-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:truncate text-start",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default"),i.createVNode(i.unref(tD),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(Nu),{class:"w-4 h-4 opacity-50 shrink-0"})]),_:1})]),_:3},16,["class"]))}}),SU=i.defineComponent({inheritAttrs:!1,__name:"SelectContent",props:{forceMount:{type:Boolean},position:{default:"popper"},bodyLock:{type:Boolean},side:{},sideOffset:{},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},updatePositionStrategy:{},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},emits:["closeAutoFocus","escapeKeyDown","pointerDownOutside"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(PP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(WP),i.mergeProps({...i.unref(s),...a.$attrs},{class:i.unref(ke)("relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border bg-ed-popover text-ed-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a.position==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(AU)),i.createVNode(i.unref(ZP),{class:i.normalizeClass(i.unref(ke)("p-1",a.position==="popper"&&"h-[--radix-select-trigger-height] w-full min-w-[--radix-select-trigger-width]"))},{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},8,["class"]),i.createVNode(i.unref(OU))]),_:3},16,["class"])]),_:3}))}}),_U=i.defineComponent({__name:"SelectGroup",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(YP),i.mergeProps({class:i.unref(ke)("p-1 w-full",e.class)},n.value),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),TU={class:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},JC=i.defineComponent({__name:"SelectItem",props:{value:{},disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(KP),i.mergeProps(i.unref(r),{class:i.unref(ke)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-ed-accent focus:text-ed-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e.class)}),{default:i.withCtx(()=>[i.createElementVNode("span",TU,[i.createVNode(i.unref(GP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(ug),{class:"h-4 w-4"})]),_:1})]),i.createVNode(i.unref(JP),null,{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default")]),_:3})]),_:3},16,["class"]))}}),AU=i.defineComponent({__name:"SelectScrollUpButton",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(QP),i.mergeProps(i.unref(r),{class:i.unref(ke)("flex cursor-default items-center justify-center py-1",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default",{},()=>[i.createVNode(i.unref(cg),{class:"h-4 w-4"})])]),_:3},16,["class"]))}}),OU=i.defineComponent({__name:"SelectScrollDownButton",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(NP),i.mergeProps(i.unref(r),{class:i.unref(ke)("flex cursor-default items-center justify-center py-1",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default",{},()=>[i.createVNode(i.unref(Nu),{class:"h-4 w-4"})])]),_:3},16,["class"]))}}),MU=i.defineComponent({__name:"CodeBlockView",props:Ws,setup(t){const e=t,n=i.ref(e.extension.options.lowlight.listLanguages()),r=i.computed({get(){return e.node.attrs.language||"auto"},set(o){e.updateAttributes({language:o})}});return(o,s)=>{const a=gU;return i.openBlock(),i.createBlock(i.unref(Us),{class:"code-block relative"},{default:i.withCtx(()=>[i.createVNode(i.unref(bU),{modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l)},{default:i.withCtx(()=>[i.createVNode(i.unref(kU),{class:"w-[160px] h-8 absolute right-2 top-2 bg-ed-background"},{default:i.withCtx(()=>[i.createVNode(i.unref(vU),{placeholder:"Select Language"})]),_:1}),i.createVNode(i.unref(SU),null,{default:i.withCtx(()=>[i.createVNode(i.unref(_U),null,{default:i.withCtx(()=>[i.createVNode(i.unref(JC),{value:"auto"},{default:i.withCtx(()=>s[1]||(s[1]=[i.createTextVNode(" Auto ")])),_:1}),i.createVNode(a),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,(l,u)=>(i.openBlock(),i.createBlock(i.unref(JC),{key:u,value:l},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),i.createElementVNode("pre",null,[i.createElementVNode("code",null,[i.createVNode(i.unref(aw))])])]),_:1})}}}),BU=mU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),language:"auto",button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.toggleCodeBlock(),isActive:()=>e.isActive("codeBlock")||!1,disabled:!e.can().toggleCodeBlock(),icon:"Code2",tooltip:n("editor.codeblock.tooltip")}})}},addNodeView(){return js(MU)}}),IU=Bt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,bt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>i0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),ZC=i.defineComponent({__name:"DropdownMenu",props:{defaultOpen:{type:Boolean},open:{type:Boolean},dir:{},modal:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(YL),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),QC=i.defineComponent({__name:"DropdownMenuTrigger",props:{disabled:{type:Boolean},asChild:{type:Boolean},as:{}},setup(t){const n=Xn(t);return(r,o)=>(i.openBlock(),i.createBlock(i.unref(JL),i.mergeProps({class:"outline-none"},i.unref(n)),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16))}}),NC=i.defineComponent({__name:"DropdownMenuContent",props:{forceMount:{type:Boolean},loop:{type:Boolean},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},updatePositionStrategy:{},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(ZL),null,{default:i.withCtx(()=>[i.createVNode(i.unref(QL),i.mergeProps(i.unref(s),{class:i.unref(ke)("z-50 min-w-32 overflow-hidden rounded-md border bg-ed-popover p-1 text-ed-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),dg=i.defineComponent({__name:"DropdownMenuItem",props:{disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{},inset:{type:Boolean}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(NL),i.mergeProps(i.unref(r),{class:i.unref(ke)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-ed-accent focus:text-ed-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o.inset&&"pl-8",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default")]),_:3},16,["class"]))}}),RU={class:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},Cl=i.defineComponent({__name:"DropdownMenuCheckboxItem",props:{checked:{type:[Boolean,String]},disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{}},emits:["select","update:checked"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(tP),i.mergeProps(i.unref(s),{class:i.unref(ke)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-ed-accent focus:text-ed-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n.class)}),{default:i.withCtx(()=>[i.createElementVNode("span",RU,[i.createVNode(i.unref(nP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(ug),{class:"w-4 h-4"})]),_:1})]),i.renderSlot(a.$slots,"default")]),_:3},16,["class"]))}}),e8=i.defineComponent({__name:"DropdownMenuShortcut",props:{class:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass(i.unref(ke)("ml-auto text-xs tracking-widest opacity-60",e.class))},[i.renderSlot(n.$slots,"default")],2))}}),fg=i.defineComponent({__name:"DropdownMenuSeparator",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(eP),i.mergeProps(n.value,{class:i.unref(ke)("-mx-1 my-1 h-px bg-ed-muted",e.class)}),null,16,["class"]))}}),LU={class:"flex items-center justify-between w-full h-full font-normal"},PU={key:0,class:"flex-grow text-sm text-left truncate"},DU={class:"flex flex-col items-center text-center max-w-24"},VU={key:0,class:"flex"},FU=i.defineComponent({__name:"ActionMenuButton",props:{icon:{default:void 0},class:{default:""},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},id:{default:""}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(vl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(gl),{"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{id:`action-menu-${n.id}`,class:i.normalizeClass(i.unref(ke)("h-[32px] px-1.5 py-0",e.class)),variant:"ghost",disabled:n.disabled},{default:i.withCtx(()=>[i.createElementVNode("div",LU,[n.title?(i.openBlock(),i.createElementBlock("div",PU,i.toDisplayString(n.title),1)):i.createCommentVNode("",!0),n.icon?(i.openBlock(),i.createBlock(i.unref(Lt),{key:1,class:"w-[16px] h-[16px]",name:n.icon},null,8,["name"])):i.createCommentVNode("",!0),i.createVNode(i.unref(Lt),{class:"flex-shrink-0 w-3 h-3 ml-1 text-zinc-500",name:"ChevronDown"})])]),_:1},8,["id","class","disabled"])]),_:1}),n.tooltip||n.shortcutKeys&&n.shortcutKeys.length?(i.openBlock(),i.createBlock(i.unref(ta),{key:0},{default:i.withCtx(()=>[i.createElementVNode("div",DU,[i.createElementVNode("div",null,i.toDisplayString(n.tooltip),1),n.shortcutKeys&&n.shortcutKeys.length?(i.openBlock(),i.createElementBlock("div",VU,[i.createElementVNode("span",null,i.toDisplayString(i.unref(z6)(n.shortcutKeys)),1)])):i.createCommentVNode("",!0)])]),_:1})):i.createCommentVNode("",!0)]),_:1})]),_:1}))}}),ia=i.defineComponent({__name:"ActionDropdownButton",props:{icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},class:{default:""},btn_class:{default:""},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},id:{default:""}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(ZC),null,{default:i.withCtx(()=>[i.createVNode(i.unref(QC),{disabled:n.disabled},{default:i.withCtx(()=>[i.createVNode(FU,{id:n.id,class:i.normalizeClass(n.btn_class),title:n.title,icon:n.icon,tooltip:n.tooltip,disabled:n.disabled,"is-active":n.isActive},null,8,["id","class","title","icon","tooltip","disabled","is-active"])]),_:1},8,["disabled"]),i.createVNode(i.unref(NC),i.mergeProps({class:i.unref(ke)("min-w-24",e.class),align:"start",side:"bottom"},n.$attrs),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),$U=i.defineComponent({__name:"HeadingButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=i.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r}:{title:e.tooltip,level:0,isActive:()=>!1}});return(r,o)=>{var s;return i.openBlock(),i.createBlock(ia,{id:"heading",disabled:r.disabled,tooltip:r.tooltip,title:(s=n.value)==null?void 0:s.title,btn_class:"min-w-24 max-w-32"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(a,l)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:l},[i.createVNode(i.unref(Cl),{checked:n.value.title===a.title,onClick:a.action},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["h-full ml-1","heading-"+a.level])},i.toDisplayString(a.title),3),i.createVNode(i.unref(e8),{class:"pl-4"},{default:i.withCtx(()=>{var u;return[i.createTextVNode(i.toDisplayString((u=a.shortcutKeys)==null?void 0:u.map(c=>i.unref(kf)(c)).join(" ")),1)]}),_:2},1024)]),_:2},1032,["checked","onClick"]),a.level===0?(i.openBlock(),i.createBlock(i.unref(fg),{key:0})):i.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title"])}}}),t8=IU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),levels:[1,2,3,4,5,6],button({editor:e,extension:n,t:r}){var c;const{extensions:o=[]}=e.extensionManager??[],s=((c=n.options)==null?void 0:c.levels)||[],a=o.find(f=>f.name==="base-kit"),l=s.map(f=>({action:()=>e.commands.toggleHeading({level:f}),isActive:()=>e.isActive("heading",{level:f})||!1,disabled:!e.can().toggleHeading({level:f}),title:r(`editor.heading.h${f}.tooltip`),level:f,shortcutKeys:["alt","mod",`${f}`]}));a&&a.options.paragraph!==!1&&l.unshift({action:()=>e.commands.setParagraph(),isActive:()=>e.isActive("paragraph")||!1,disabled:!e.can().setParagraph(),level:0,title:r("editor.paragraph.tooltip"),shortcutKeys:["alt","mod","0"]});const u=l.filter(f=>f.disabled).length===l.length;return{component:$U,componentProps:{tooltip:r("editor.heading.tooltip"),disabled:u,items:l}}}}}}),zU=Ze.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),HU=i.defineComponent({__name:"TextAlignMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=i.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,o)=>(i.openBlock(),i.createBlock(ia,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled,class:"min-w-4 w-full flex flex-row gap-1"},{default:i.withCtx(()=>[i.createVNode(i.unref(vl),null,{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(s,a)=>(i.openBlock(),i.createBlock(i.unref(gl),{key:a},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(dg),{class:"p-0",onClick:s.action},{default:i.withCtx(()=>[i.createVNode(i.unref(W6),{size:"sm",class:"w-7 h-7 p-1",pressed:n.value.title===s.title},{default:i.withCtx(()=>[s.icon?(i.openBlock(),i.createBlock(i.unref(Lt),{key:0,name:s.icon},null,8,["name"])):i.createCommentVNode("",!0)]),_:2},1032,["pressed"])]),_:2},1032,["onClick"])]),_:2},1024),i.createVNode(i.unref(ta),{class:"flex flex-col items-center"},{default:i.withCtx(()=>{var l;return[i.createElementVNode("span",null,i.toDisplayString(s.title),1),i.createElementVNode("span",null,i.toDisplayString((l=s.shortcutKeys)==null?void 0:l.map(u=>i.unref(kf)(u)).join(" ")),1)]}),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1},8,["icon","tooltip","disabled"]))}}),n8=zU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["heading","paragraph","list_item","title"],button:e=>{var f;const{editor:n,extension:r,t:o}=e,s=((f=r.options)==null?void 0:f.alignments)||[],a={left:["mod","Shift","L"],center:["mod","Shift","E"],right:["mod","Shift","R"],justify:["mod","Shift","J"]},l={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},u=s.map(p=>({title:o(`editor.textalign.${p}.tooltip`),icon:l[p],shortcutKeys:a[p],isActive:()=>n.isActive({textAlign:p})||!1,action:()=>n.commands.setTextAlign(p),disabled:!n.can().setTextAlign(p)})),c=u.filter(p=>p.disabled).length===u.length;return{component:HU,componentProps:{icon:"AlignJustify",tooltip:o("editor.textalign.tooltip"),disabled:c,items:u}}}}}}),UU=i.defineComponent({__name:"ScrollBar",props:{orientation:{default:"vertical"},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(CP),i.mergeProps(n.value,{class:i.unref(ke)("flex touch-none select-none transition-colors",r.orientation==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",r.orientation==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(EP),{class:"relative flex-1 rounded-full bg-ed-border"})]),_:1},16,["class"]))}}),WU=i.defineComponent({__name:"ScrollArea",props:{type:{},dir:{},scrollHideDelay:{},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(fP),i.mergeProps(n.value,{class:i.unref(ke)("relative overflow-hidden",e.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(pP),{class:"h-full w-full rounded-[inherit]"},{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3}),i.createVNode(UU),i.createVNode(i.unref(SP))]),_:3},16,["class"]))}}),jU={class:"ml-1 h-full"},qU=i.defineComponent({__name:"FontSizeMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""}},setup(t){const e=t,{t:n}=Ot(),r=i.computed(()=>e.editor.extensionStorage["base-kit"].mode===Ve.EDITOR),o=i.inject("fontSize"),s=i.computed(()=>{const u={title:n("editor.fontSize.default.tooltip"),isActive:()=>!1};if(r.value)return e.items.find(p=>p.isActive()&&p.title)||u;const c=e.items.find(f=>f.title===o.value);return c||(o.value?{title:o.value}:u)}),a=ht.useEventBus("fontFamily"),l=(u,c)=>{u===n("editor.fontSize.default.tooltip")?(e.editor.commands.unsetFontSize(),o.value=null):(o.value=u,e.editor.commands.setFontSize(u),a.emit()),c()};return(u,c)=>{const f=fg;return i.openBlock(),i.createBlock(ia,{disabled:u.disabled,tooltip:u.tooltip,title:s.value.title,btn_class:`min-w-24 ${u.customClass}`},{default:i.withCtx(()=>[i.createVNode(i.unref(WU),{class:"w-32 h-96"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(p,m)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:m},[i.createVNode(i.unref(Cl),{checked:s.value.title===p.title,onClick:()=>l(p.title,p.action)},{default:i.withCtx(()=>[i.createElementVNode("div",jU,i.toDisplayString(p.title),1)]),_:2},1032,["checked","onClick"]),p.title===i.unref(n)("editor.fontSize.default.tooltip")?(i.openBlock(),i.createBlock(f,{key:0})):i.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1},8,["disabled","tooltip","title","btn_class"])}}}),r8=Ze.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:[...k0],button({editor:e,extension:n,t:r}){var l;const o=((l=n.options)==null?void 0:l.fontSizes)||[],s=[Ja,...o].map(u=>({title:u===Ja?r("editor.fontSize.default.tooltip"):String(u),isActive:()=>{const{fontSize:c}=e.getAttributes("textStyle");return u===Ja&&c===void 0?!0:e.isActive({fontSize:String(u)})||!1},action:()=>{if(u===Ja){e.commands.unsetFontSize();return}e.commands.setFontSize(String(u))},disabled:!e.can().setFontSize(String(u)),divider:u===Ja||!1,default:u===Ja||!1})),a=s.filter(u=>u.disabled).length===s.length;return{component:qU,componentProps:{editor:e,tooltip:r("editor.fontSize.tooltip"),disabled:a,items:s,maxHeight:280,customClass:"border border-gray-300 rounded-none text-gray-500 px-2.5 h-[26px]"}}}}},addGlobalAttributes(){return[{types:["paragraph","textStyle"],attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replace(/['"]+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontSize}}),KU=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,o;const s=n.getAttribute("style"),a=(o=(r=n.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||o===void 0?void 0:o.getAttribute("style");n.setAttribute("style",`${a};${s}`)})},GU=Dn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&KU(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),XU=Ze.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),YU={class:"flex items-center h-[32px] hover:bg-ed-muted rounded-md"},JU={class:"flex items-center justify-center text-sm"},ZU={width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},QU={id:"icon/字体颜色",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},NU={transform:"translate(0.000000, 0.500000)"},eW={transform:"translate(39.000000, 17.353553)"},tW=["fill"],nW=i.defineComponent({__name:"ColorActionButton",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=i.ref(void 0);function r(s){var a;(a=e.action)==null||a.call(e,s)}function o(s){var a;(a=e.action)==null||a.call(e,n.value)}return(s,a)=>(i.openBlock(),i.createElementBlock("div",YU,[i.createVNode(Ke,{id:"color",tooltip:s.tooltip,disabled:s.disabled,action:o},{icon:i.withCtx(()=>[i.createElementVNode("span",JU,[(i.openBlock(),i.createElementBlock("svg",ZU,[i.createElementVNode("g",QU,[i.createElementVNode("g",NU,[i.createElementVNode("g",eW,[i.createElementVNode("path",{id:"矩形",d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:n.value||"#000","fill-rule":"evenodd"},null,8,tW),a[1]||(a[1]=i.createElementVNode("path",{id:"路径-21",d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor","fill-rule":"nonzero"},null,-1)),a[2]||(a[2]=i.createElementVNode("path",{id:"路径-22",d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor","fill-rule":"nonzero"},null,-1))])])])]))])]),_:1},8,["tooltip","disabled"]),i.createVNode(gC,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=l=>n.value=l),disabled:s.disabled,onChange:r},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{variant:"ghost",size:"icon",class:"h-[32px] w-3 rounded-l-none hover:bg-ed-muted-foreground/20",disabled:s.disabled},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"])]))}}),o8=XU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n}){return{component:nW,componentProps:{action:r=>{typeof r>"u"&&e.chain().focus().unsetColor().run(),typeof r=="string"&&e.chain().focus().setColor(r).run()},isActive:()=>{const{color:r}=e.getAttributes("textStyle");return r&&e.isActive({color:r})||!1},editor:e,disabled:!e.can().setColor(""),tooltip:n("editor.color.tooltip")}}}}}}),rW=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,oW=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,i8=Dn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Vs({find:rW,type:this.type})]},addPasteRules(){return[ji({find:oW,type:this.type})]}}),iW=i8.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:e,t:n})=>({component:W5,componentProps:{action:r=>{typeof r=="string"&&e.chain().focus().setHighlight({color:r}).run(),typeof r>"u"&&e.chain().focus().unsetHighlight().run()},editor:e,isActive:()=>e.isActive("highlight")||!1,disabled:!e.can().setHighlight(),shortcutKeys:["⇧","mod","H"],tooltip:n("editor.highlight.tooltip")}})}}}),sW="listItem",s8="textStyle",a8=/^\s*([-+*])\s$/,aW=Bt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sW,this.editor.getAttributes(s8)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Wa({find:a8,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wa({find:a8,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(s8),editor:this.editor})),[t]}}),lW=["id"],l8=i.defineComponent({__name:"ActionDropdownButtonSplit",props:{icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},class:{default:""},shortcutKeys:{default:void 0},btnClass:{default:""},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},id:{default:""}},setup(t){const e=t;return(n,r)=>{var o;return i.openBlock(),i.createElementBlock("div",{id:`dropdown-btn-${n.id}`,class:i.normalizeClass(["flex items-center h-[32px] hover:bg-ed-muted rounded-md",[((o=n.isActive)==null?void 0:o.call(n))&&"bg-ed-muted"]])},[i.createVNode(Ke,{class:i.normalizeClass(n.btnClass),action:n.action,title:n.title,icon:n.icon,tooltip:n.tooltip,disabled:n.disabled,"shortcut-keys":n.shortcutKeys},null,8,["class","action","title","icon","tooltip","disabled","shortcut-keys"]),i.createVNode(i.unref(ZC),null,{default:i.withCtx(()=>[i.createVNode(i.unref(QC),{disabled:n.disabled},{default:i.withCtx(()=>[i.createVNode(yn,{variant:"ghost",size:"icon",class:"h-[32px] w-3 rounded-l-none hover:bg-ed-muted-foreground/20",disabled:n.disabled},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["disabled"]),i.createVNode(i.unref(NC),i.mergeProps({class:i.unref(ke)("min-w-24",e.class),align:"start",side:"bottom"},n.$attrs),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16,["class"])]),_:3})],10,lW)}}}),uW=i.defineComponent({__name:"BulletListMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},tooltip:{default:""}},setup(t){const e=t,{t:n}=Ot(),r=[{label:"editor.bulletlist.disc.tooltip",value:"disc"},{label:"editor.bulletlist.circle.tooltip",value:"circle"},{label:"editor.bulletlist.square.tooltip",value:"square"}],o=i.computed(()=>{var a;return(a=e.editor)!=null&&a.isActive("bulletList")?e.editor.getAttributes("bulletList").listStyleType:"disc"});function s(a){e.editor.isActive("bulletList")?e.editor.getAttributes("bulletList").listStyleType===a.value?e.editor.chain().focus().toggleBulletList().run():e.editor.chain().focus().updateAttributes("bulletList",{listStyleType:a.value}).run():e.editor.chain().focus().toggleBulletList().updateAttributes("bulletList",{listStyleType:a.value}).run()}return(a,l)=>(i.openBlock(),i.createBlock(l8,{id:"bullet-list",action:()=>s,disabled:a.disabled,tooltip:a.tooltip,class:"grid w-full grid-cols-3 gap-1 min-w-4"},{default:i.withCtx(()=>[i.createVNode(i.unref(vl),null,{default:i.withCtx(()=>[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(r,u=>i.createVNode(i.unref(gl),{key:u.value,"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(dg),{class:"p-0",onClick:c=>s(u)},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([[o.value===u.value?"bg-ed-accent border border-ed-accent-foreground":""],"h-[48px] flex flex-col w-[48px] box-border rounded-sm border"])},[i.createElementVNode("ol",{style:i.normalizeStyle({listStyleType:u.value,lineHeight:1}),class:"text-[10px] pl-3 flex-1 list-outside flex flex-col items-center justify-center"},[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(3,c=>i.createElementVNode("li",{key:c},l[0]||(l[0]=[i.createElementVNode("hr",{class:"border-0 bg-gray-200 h-[3px] w-6 my-1"},null,-1)]))),64))],4)],2)]),_:2},1032,["onClick"])]),_:2},1024),i.createVNode(i.unref(ta),{side:"bottom"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)(u.label)),1)]),_:2},1024)]),_:2},1024)),64))]),_:1})]),_:1},8,["action","disabled","tooltip"]))}}),cW=aW.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),listStyleType:{default:"disc",parseHTML:e=>({listStyleType:e.style["list-style-type"]??"disc"}),renderHTML:({listStyleType:e})=>({style:`list-style-type: ${(e==null?void 0:e.listStyleType)||e}`})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:uW,componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList")||!1,disabled:!e.can().toggleBulletList(),shortcutKeys:["shift","mod","8"],icon:"List",tooltip:n("editor.bulletlist.tooltip")}})}}}),pg=Bt.create({name:"clear",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.chain().focus().clearNodes().unsetAllMarks().run(),disabled:!e.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:n("editor.clear.tooltip")}})}}}),dW="listItem",u8="textStyle",c8=/^(\d+)\.\s$/,fW=Bt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(dW,this.editor.getAttributes(u8)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Wa({find:c8,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wa({find:c8,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(u8)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),pW=i.defineComponent({__name:"OrderedListMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},tooltip:{default:""},shortcutKeys:{default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,{t:n}=Ot(),r=[{label:"editor.orderedlist.decimal.tooltip",value:"decimal"},{label:"editor.orderedlist.decimalLeadingZero.tooltip",value:"decimal-leading-zero"},{label:"editor.orderedlist.lowerRoman.tooltip",value:"lower-roman"},{label:"editor.orderedlist.upperRoman.tooltip",value:"upper-roman"},{label:"editor.orderedlist.lowerLatin.tooltip",value:"lower-latin"},{label:"editor.orderedlist.upperLatin.tooltip",value:"upper-latin"},{label:"editor.orderedlist.tradChineseInformal.tooltip",value:"trad-chinese-informal"},{label:"editor.orderedlist.simpChineseFormal.tooltip",value:"simp-chinese-formal"}],o=i.computed(()=>{var a;return(a=e.editor)!=null&&a.isActive("orderedList")?e.editor.getAttributes("orderedList").listType:"decimal"});function s(a){var l,u;e.editor.isActive("orderedList")?e.editor.getAttributes("orderedList").listType===a.value?(l=e.editor.chain())==null||l.toggleOrderedList().run():(u=e.editor.chain())==null||u.updateAttributes("orderedList",{listType:a.value}).run():e.editor.chain().focus().toggleOrderedList().updateAttributes("orderedList",{listType:a.value}).run()}return(a,l)=>(i.openBlock(),i.createBlock(l8,{action:()=>s,disabled:a.disabled,tooltip:a.tooltip,"is-active":a.isActive,"shortcut-keys":a.shortcutKeys,class:"min-w-4 w-full grid grid-cols-3 gap-1"},{default:i.withCtx(()=>[i.createVNode(i.unref(vl),null,{default:i.withCtx(()=>[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(r,u=>i.createVNode(i.unref(gl),{key:u.value,"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(dg),{class:"p-0",onClick:c=>s(u)},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([[o.value===u.value?"bg-ed-accent border border-ed-accent-foreground":""],"h-[72px] flex flex-col w-[72px] box-border rounded-sm border"])},[i.createElementVNode("ol",{style:i.normalizeStyle({listStyleType:u.value,lineHeight:1}),class:"text-[12px] pl-3 flex-1 list-outside flex flex-col items-center justify-center"},[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(3,c=>i.createElementVNode("li",{key:c},l[0]||(l[0]=[i.createElementVNode("hr",{class:"border-0 bg-gray-200 h-[3px] w-6 my-1"},null,-1)]))),64))],4)],2)]),_:2},1032,["onClick"])]),_:2},1024),i.createVNode(i.unref(ta),{side:"bottom"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)(u.label)),1)]),_:2},1024)]),_:2},1024)),64))]),_:1})]),_:1},8,["action","disabled","tooltip","is-active","shortcut-keys"]))}}),hW=fW.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),listType:{default:"decimal",parseHTML:e=>{e.style.getPropertyValue("list-style-type")},renderHTML:({listType:e})=>({style:`list-style-type: ${e}`})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:pW,componentProps:{action:()=>e.commands.toggleOrderedList(),isActive:()=>e.isActive("orderedList")||!1,disabled:!e.can().toggleOrderedList(),icon:"ListOrdered",shortcutKeys:["mod","shift","7"],tooltip:n("editor.orderedlist.tooltip")}})}}}),mW=/^\s*(\[([( |x])?\])\s$/,gW=Bt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",bt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),a=document.createElement("span"),l=document.createElement("input"),u=document.createElement("div");return s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",c=>c.preventDefault()),l.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=c.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,f])=>{o.setAttribute(c,f)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,a),o.append(s,u),Object.entries(e).forEach(([c,f])=>{o.setAttribute(c,f)}),{dom:o,contentDOM:u,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,l.checked=c.attrs.checked,!0)}}},addInputRules(){return[Wa({find:mW,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),bW=Bt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.toggleTaskList(),isActive:()=>e.isActive("taskList")||!1,disabled:!e.can().toggleTaskList(),icon:"ListTodo",shortcutKeys:["shift","mod","9"],tooltip:n("editor.tasklist.tooltip")}})}},addExtensions(){return[gW.configure(this.options.taskItem)]}}),vW=/^\s*>\s$/,yW=Bt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Wa({find:vW,type:this.type})]}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote")||!1,disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:["shift","mod","B"],tooltip:n("editor.blockquote.tooltip")}})}}}),wW="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",xW="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",El=(t,e)=>{for(const n in e)t[n]=e[n];return t},hg="numeric",mg="ascii",gg="alpha",ec="asciinumeric",tc="alphanumeric",bg="domain",d8="emoji",CW="scheme",EW="slashscheme",vg="whitespace";function kW(t,e){return t in e||(e[t]=[]),e[t]}function sa(t,e,n){e[hg]&&(e[ec]=!0,e[tc]=!0),e[mg]&&(e[ec]=!0,e[gg]=!0),e[ec]&&(e[tc]=!0),e[gg]&&(e[tc]=!0),e[tc]&&(e[bg]=!0),e[d8]&&(e[bg]=!0);for(const r in e){const o=kW(r,n);o.indexOf(t)<0&&o.push(t)}}function SW(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function sr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}sr.groups={},sr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||sr.groups;let o;return e&&e.j?o=e:(o=new sr(e),n&&r&&sa(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let a=0;a<s-1;a++)o=o.tt(t[a]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||sr.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let a,l=o.go(t);if(l?(a=new sr,El(a.j,l.j),a.jr.push.apply(a.jr,l.jr),a.jd=l.jd,a.t=l.t):a=new sr,s){if(r)if(a.t&&typeof a.t=="string"){const u=El(SW(a.t,r),n);sa(s,u,r)}else n&&sa(s,n,r);a.t=s}return o.j[t]=a,a}};const ut=(t,e,n,r,o)=>t.ta(e,n,r,o),tn=(t,e,n,r,o)=>t.tr(e,n,r,o),f8=(t,e,n,r,o)=>t.ts(e,n,r,o),ye=(t,e,n,r,o)=>t.tt(e,n,r,o),mi="WORD",yg="UWORD",p8="ASCIINUMERICAL",h8="ALPHANUMERICAL",nc="LOCALHOST",wg="TLD",xg="UTLD",$f="SCHEME",kl="SLASH_SCHEME",Cg="NUM",Eg="WS",kg="NL",rc="OPENBRACE",oc="CLOSEBRACE",zf="OPENBRACKET",Hf="CLOSEBRACKET",Uf="OPENPAREN",Wf="CLOSEPAREN",jf="OPENANGLEBRACKET",qf="CLOSEANGLEBRACKET",Kf="FULLWIDTHLEFTPAREN",Gf="FULLWIDTHRIGHTPAREN",Xf="LEFTCORNERBRACKET",Yf="RIGHTCORNERBRACKET",Jf="LEFTWHITECORNERBRACKET",Zf="RIGHTWHITECORNERBRACKET",Qf="FULLWIDTHLESSTHAN",Nf="FULLWIDTHGREATERTHAN",ep="AMPERSAND",Sg="APOSTROPHE",tp="ASTERISK",is="AT",np="BACKSLASH",rp="BACKTICK",op="CARET",ss="COLON",_g="COMMA",ip="DOLLAR",zo="DOT",sp="EQUALS",Tg="EXCLAMATION",Hr="HYPHEN",ic="PERCENT",ap="PIPE",lp="PLUS",up="POUND",sc="QUERY",Ag="QUOTE",m8="FULLWIDTHMIDDLEDOT",Og="SEMI",Ho="SLASH",ac="TILDE",cp="UNDERSCORE",g8="EMOJI",dp="SYM";var b8=Object.freeze({__proto__:null,WORD:mi,UWORD:yg,ASCIINUMERICAL:p8,ALPHANUMERICAL:h8,LOCALHOST:nc,TLD:wg,UTLD:xg,SCHEME:$f,SLASH_SCHEME:kl,NUM:Cg,WS:Eg,NL:kg,OPENBRACE:rc,CLOSEBRACE:oc,OPENBRACKET:zf,CLOSEBRACKET:Hf,OPENPAREN:Uf,CLOSEPAREN:Wf,OPENANGLEBRACKET:jf,CLOSEANGLEBRACKET:qf,FULLWIDTHLEFTPAREN:Kf,FULLWIDTHRIGHTPAREN:Gf,LEFTCORNERBRACKET:Xf,RIGHTCORNERBRACKET:Yf,LEFTWHITECORNERBRACKET:Jf,RIGHTWHITECORNERBRACKET:Zf,FULLWIDTHLESSTHAN:Qf,FULLWIDTHGREATERTHAN:Nf,AMPERSAND:ep,APOSTROPHE:Sg,ASTERISK:tp,AT:is,BACKSLASH:np,BACKTICK:rp,CARET:op,COLON:ss,COMMA:_g,DOLLAR:ip,DOT:zo,EQUALS:sp,EXCLAMATION:Tg,HYPHEN:Hr,PERCENT:ic,PIPE:ap,PLUS:lp,POUND:up,QUERY:sc,QUOTE:Ag,FULLWIDTHMIDDLEDOT:m8,SEMI:Og,SLASH:Ho,TILDE:ac,UNDERSCORE:cp,EMOJI:g8,SYM:dp});const gi=/[a-z]/,lc=new RegExp("\\p{L}","u"),Mg=new RegExp("\\p{Emoji}","u"),bi=/\d/,Bg=/\s/,v8="\r",Ig=`
|
|
283
|
+
*/const Ff=oa("XIcon",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),kU=i.defineComponent({__name:"SelectTrigger",props:{disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(LP),i.mergeProps(i.unref(r),{class:i.unref(ke)("flex h-10 w-full items-center justify-between rounded-md border border-ed-input bg-ed-background px-3 py-2 text-sm ring-offset-ed-background data-[placeholder]:text-ed-muted-foreground focus:outline-none focus:ring-2 focus:ring-ed-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:truncate text-start",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default"),i.createVNode(i.unref(tD),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(Nu),{class:"w-4 h-4 opacity-50 shrink-0"})]),_:1})]),_:3},16,["class"]))}}),SU=i.defineComponent({inheritAttrs:!1,__name:"SelectContent",props:{forceMount:{type:Boolean},position:{default:"popper"},bodyLock:{type:Boolean},side:{},sideOffset:{},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},updatePositionStrategy:{},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},emits:["closeAutoFocus","escapeKeyDown","pointerDownOutside"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(PP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(WP),i.mergeProps({...i.unref(s),...a.$attrs},{class:i.unref(ke)("relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border bg-ed-popover text-ed-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a.position==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(AU)),i.createVNode(i.unref(ZP),{class:i.normalizeClass(i.unref(ke)("p-1",a.position==="popper"&&"h-[--radix-select-trigger-height] w-full min-w-[--radix-select-trigger-width]"))},{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},8,["class"]),i.createVNode(i.unref(OU))]),_:3},16,["class"])]),_:3}))}}),_U=i.defineComponent({__name:"SelectGroup",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(YP),i.mergeProps({class:i.unref(ke)("p-1 w-full",e.class)},n.value),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),TU={class:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},JC=i.defineComponent({__name:"SelectItem",props:{value:{},disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(KP),i.mergeProps(i.unref(r),{class:i.unref(ke)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-ed-accent focus:text-ed-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e.class)}),{default:i.withCtx(()=>[i.createElementVNode("span",TU,[i.createVNode(i.unref(GP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(ug),{class:"h-4 w-4"})]),_:1})]),i.createVNode(i.unref(JP),null,{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default")]),_:3})]),_:3},16,["class"]))}}),AU=i.defineComponent({__name:"SelectScrollUpButton",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(QP),i.mergeProps(i.unref(r),{class:i.unref(ke)("flex cursor-default items-center justify-center py-1",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default",{},()=>[i.createVNode(i.unref(cg),{class:"h-4 w-4"})])]),_:3},16,["class"]))}}),OU=i.defineComponent({__name:"SelectScrollDownButton",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(NP),i.mergeProps(i.unref(r),{class:i.unref(ke)("flex cursor-default items-center justify-center py-1",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default",{},()=>[i.createVNode(i.unref(Nu),{class:"h-4 w-4"})])]),_:3},16,["class"]))}}),MU=i.defineComponent({__name:"CodeBlockView",props:Ws,setup(t){const e=t,n=i.ref(e.extension.options.lowlight.listLanguages()),r=i.computed({get(){return e.node.attrs.language||"auto"},set(o){e.updateAttributes({language:o})}});return(o,s)=>{const a=gU;return i.openBlock(),i.createBlock(i.unref(Us),{class:"code-block relative"},{default:i.withCtx(()=>[i.createVNode(i.unref(bU),{modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l)},{default:i.withCtx(()=>[i.createVNode(i.unref(kU),{class:"w-[160px] h-8 absolute right-2 top-2 bg-ed-background"},{default:i.withCtx(()=>[i.createVNode(i.unref(vU),{placeholder:"Select Language"})]),_:1}),i.createVNode(i.unref(SU),null,{default:i.withCtx(()=>[i.createVNode(i.unref(_U),null,{default:i.withCtx(()=>[i.createVNode(i.unref(JC),{value:"auto"},{default:i.withCtx(()=>s[1]||(s[1]=[i.createTextVNode(" Auto ")])),_:1}),i.createVNode(a),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(n.value,(l,u)=>(i.openBlock(),i.createBlock(i.unref(JC),{key:u,value:l},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),i.createElementVNode("pre",null,[i.createElementVNode("code",null,[i.createVNode(i.unref(aw))])])]),_:1})}}}),BU=mU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),language:"auto",button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.toggleCodeBlock(),isActive:()=>e.isActive("codeBlock")||!1,disabled:!e.can().toggleCodeBlock(),icon:"Code2",tooltip:n("editor.codeblock.tooltip")}})}},addNodeView(){return js(MU)}}),IU=Bt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,bt(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>i0({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),ZC=i.defineComponent({__name:"DropdownMenu",props:{defaultOpen:{type:Boolean},open:{type:Boolean},dir:{},modal:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(YL),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),QC=i.defineComponent({__name:"DropdownMenuTrigger",props:{disabled:{type:Boolean},asChild:{type:Boolean},as:{}},setup(t){const n=Xn(t);return(r,o)=>(i.openBlock(),i.createBlock(i.unref(JL),i.mergeProps({class:"outline-none"},i.unref(n)),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16))}}),NC=i.defineComponent({__name:"DropdownMenuContent",props:{forceMount:{type:Boolean},loop:{type:Boolean},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},updatePositionStrategy:{},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(ZL),null,{default:i.withCtx(()=>[i.createVNode(i.unref(QL),i.mergeProps(i.unref(s),{class:i.unref(ke)("z-50 min-w-32 overflow-hidden rounded-md border bg-ed-popover p-1 text-ed-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),dg=i.defineComponent({__name:"DropdownMenuItem",props:{disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{},inset:{type:Boolean}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(NL),i.mergeProps(i.unref(r),{class:i.unref(ke)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-ed-accent focus:text-ed-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o.inset&&"pl-8",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default")]),_:3},16,["class"]))}}),RU={class:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center"},Cl=i.defineComponent({__name:"DropdownMenuCheckboxItem",props:{checked:{type:[Boolean,String]},disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{}},emits:["select","update:checked"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(tP),i.mergeProps(i.unref(s),{class:i.unref(ke)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-ed-accent focus:text-ed-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n.class)}),{default:i.withCtx(()=>[i.createElementVNode("span",RU,[i.createVNode(i.unref(nP),null,{default:i.withCtx(()=>[i.createVNode(i.unref(ug),{class:"w-4 h-4"})]),_:1})]),i.renderSlot(a.$slots,"default")]),_:3},16,["class"]))}}),e8=i.defineComponent({__name:"DropdownMenuShortcut",props:{class:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass(i.unref(ke)("ml-auto text-xs tracking-widest opacity-60",e.class))},[i.renderSlot(n.$slots,"default")],2))}}),fg=i.defineComponent({__name:"DropdownMenuSeparator",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(eP),i.mergeProps(n.value,{class:i.unref(ke)("-mx-1 my-1 h-px bg-ed-muted",e.class)}),null,16,["class"]))}}),LU={class:"flex items-center justify-between w-full h-full font-normal"},PU={key:0,class:"flex-grow text-sm text-left truncate"},DU={class:"flex flex-col items-center text-center max-w-24"},VU={key:0,class:"flex"},FU=i.defineComponent({__name:"ActionMenuButton",props:{icon:{default:void 0},class:{default:""},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},id:{default:""}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(vl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(gl),{"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{id:`action-menu-${n.id}`,class:i.normalizeClass(i.unref(ke)("h-[32px] px-1.5 py-0",e.class)),variant:"ghost",disabled:n.disabled},{default:i.withCtx(()=>[i.createElementVNode("div",LU,[n.title?(i.openBlock(),i.createElementBlock("div",PU,i.toDisplayString(n.title),1)):i.createCommentVNode("",!0),n.icon?(i.openBlock(),i.createBlock(i.unref(Lt),{key:1,class:"w-[16px] h-[16px]",name:n.icon},null,8,["name"])):i.createCommentVNode("",!0),i.createVNode(i.unref(Lt),{class:"flex-shrink-0 w-3 h-3 ml-1 text-zinc-500",name:"ChevronDown"})])]),_:1},8,["id","class","disabled"])]),_:1}),n.tooltip||n.shortcutKeys&&n.shortcutKeys.length?(i.openBlock(),i.createBlock(i.unref(ta),{key:0},{default:i.withCtx(()=>[i.createElementVNode("div",DU,[i.createElementVNode("div",null,i.toDisplayString(n.tooltip),1),n.shortcutKeys&&n.shortcutKeys.length?(i.openBlock(),i.createElementBlock("div",VU,[i.createElementVNode("span",null,i.toDisplayString(i.unref(z6)(n.shortcutKeys)),1)])):i.createCommentVNode("",!0)])]),_:1})):i.createCommentVNode("",!0)]),_:1})]),_:1}))}}),ia=i.defineComponent({__name:"ActionDropdownButton",props:{icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},class:{default:""},btn_class:{default:""},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},id:{default:""}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(ZC),null,{default:i.withCtx(()=>[i.createVNode(i.unref(QC),{disabled:n.disabled},{default:i.withCtx(()=>[i.createVNode(FU,{id:n.id,class:i.normalizeClass(n.btn_class),title:n.title,icon:n.icon,tooltip:n.tooltip,disabled:n.disabled,"is-active":n.isActive},null,8,["id","class","title","icon","tooltip","disabled","is-active"])]),_:1},8,["disabled"]),i.createVNode(i.unref(NC),i.mergeProps({class:i.unref(ke)("min-w-24",e.class),align:"start",side:"bottom"},n.$attrs),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),$U=i.defineComponent({__name:"HeadingButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=i.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r}:{title:e.tooltip,level:0,isActive:()=>!1}});return(r,o)=>{var s;return i.openBlock(),i.createBlock(ia,{id:"heading",disabled:r.disabled,tooltip:r.tooltip,title:(s=n.value)==null?void 0:s.title,btn_class:"min-w-24 max-w-32"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(a,l)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:l},[i.createVNode(i.unref(Cl),{checked:n.value.title===a.title,onClick:a.action},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["h-full ml-1","heading-"+a.level])},i.toDisplayString(a.title),3),i.createVNode(i.unref(e8),{class:"pl-4"},{default:i.withCtx(()=>{var u;return[i.createTextVNode(i.toDisplayString((u=a.shortcutKeys)==null?void 0:u.map(c=>i.unref(kf)(c)).join(" ")),1)]}),_:2},1024)]),_:2},1032,["checked","onClick"]),a.level===0?(i.openBlock(),i.createBlock(i.unref(fg),{key:0})):i.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title"])}}}),t8=IU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),levels:[1,2,3,4,5,6],button({editor:e,extension:n,t:r}){var c;const{extensions:o=[]}=e.extensionManager??[],s=((c=n.options)==null?void 0:c.levels)||[],a=o.find(f=>f.name==="base-kit"),l=s.map(f=>({action:()=>e.commands.toggleHeading({level:f}),isActive:()=>e.isActive("heading",{level:f})||!1,disabled:!e.can().toggleHeading({level:f}),title:r(`editor.heading.h${f}.tooltip`),level:f,shortcutKeys:["alt","mod",`${f}`]}));a&&a.options.paragraph!==!1&&l.unshift({action:()=>e.commands.setParagraph(),isActive:()=>e.isActive("paragraph")||!1,disabled:!e.can().setParagraph(),level:0,title:r("editor.paragraph.tooltip"),shortcutKeys:["alt","mod","0"]});const u=l.filter(f=>f.disabled).length===l.length;return{component:$U,componentProps:{tooltip:r("editor.heading.tooltip"),disabled:u,items:l}}}}}}),zU=Ze.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),HU=i.defineComponent({__name:"TextAlignMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=i.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,o)=>(i.openBlock(),i.createBlock(ia,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled,class:"min-w-4 w-full flex flex-row gap-1"},{default:i.withCtx(()=>[i.createVNode(i.unref(vl),null,{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(s,a)=>(i.openBlock(),i.createBlock(i.unref(gl),{key:a},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(dg),{class:"p-0",onClick:s.action},{default:i.withCtx(()=>[i.createVNode(i.unref(W6),{size:"sm",class:"w-7 h-7 p-1",pressed:n.value.title===s.title},{default:i.withCtx(()=>[s.icon?(i.openBlock(),i.createBlock(i.unref(Lt),{key:0,name:s.icon},null,8,["name"])):i.createCommentVNode("",!0)]),_:2},1032,["pressed"])]),_:2},1032,["onClick"])]),_:2},1024),i.createVNode(i.unref(ta),{class:"flex flex-col items-center"},{default:i.withCtx(()=>{var l;return[i.createElementVNode("span",null,i.toDisplayString(s.title),1),i.createElementVNode("span",null,i.toDisplayString((l=s.shortcutKeys)==null?void 0:l.map(u=>i.unref(kf)(u)).join(" ")),1)]}),_:2},1024)]),_:2},1024))),128))]),_:1})]),_:1},8,["icon","tooltip","disabled"]))}}),n8=zU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["heading","paragraph","list_item","title"],button:e=>{var f;const{editor:n,extension:r,t:o}=e,s=((f=r.options)==null?void 0:f.alignments)||[],a={left:["mod","Shift","L"],center:["mod","Shift","E"],right:["mod","Shift","R"],justify:["mod","Shift","J"]},l={left:"AlignLeft",center:"AlignCenter",right:"AlignRight",justify:"AlignJustify"},u=s.map(p=>({title:o(`editor.textalign.${p}.tooltip`),icon:l[p],shortcutKeys:a[p],isActive:()=>n.isActive({textAlign:p})||!1,action:()=>n.commands.setTextAlign(p),disabled:!n.can().setTextAlign(p)})),c=u.filter(p=>p.disabled).length===u.length;return{component:HU,componentProps:{icon:"AlignJustify",tooltip:o("editor.textalign.tooltip"),disabled:c,items:u}}}}}}),UU=i.defineComponent({__name:"ScrollBar",props:{orientation:{default:"vertical"},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(CP),i.mergeProps(n.value,{class:i.unref(ke)("flex touch-none select-none transition-colors",r.orientation==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-px",r.orientation==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-px",e.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(EP),{class:"relative flex-1 rounded-full bg-ed-border"})]),_:1},16,["class"]))}}),WU=i.defineComponent({__name:"ScrollArea",props:{type:{},dir:{},scrollHideDelay:{},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(fP),i.mergeProps(n.value,{class:i.unref(ke)("relative overflow-hidden",e.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(pP),{class:"h-full w-full rounded-[inherit]"},{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3}),i.createVNode(UU),i.createVNode(i.unref(SP))]),_:3},16,["class"]))}}),jU={class:"ml-1 h-full"},qU=i.defineComponent({__name:"FontSizeMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""}},setup(t){const e=t,{t:n}=Ot(),r=i.computed(()=>e.editor.extensionStorage["base-kit"].mode===De.EDITOR),o=i.inject("fontSize"),s=i.computed(()=>{const u={title:n("editor.fontSize.default.tooltip"),isActive:()=>!1};if(r.value)return e.items.find(p=>p.isActive()&&p.title)||u;const c=e.items.find(f=>f.title===o.value);return c||(o.value?{title:o.value}:u)}),a=ht.useEventBus("fontFamily"),l=(u,c)=>{u===n("editor.fontSize.default.tooltip")?(e.editor.commands.unsetFontSize(),o.value=null):(o.value=u,e.editor.commands.setFontSize(u),a.emit()),c()};return(u,c)=>{const f=fg;return i.openBlock(),i.createBlock(ia,{disabled:u.disabled,tooltip:u.tooltip,title:s.value.title,btn_class:`min-w-24 ${u.customClass}`},{default:i.withCtx(()=>[i.createVNode(i.unref(WU),{class:"w-32 h-96"},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(p,m)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:m},[i.createVNode(i.unref(Cl),{checked:s.value.title===p.title,onClick:()=>l(p.title,p.action)},{default:i.withCtx(()=>[i.createElementVNode("div",jU,i.toDisplayString(p.title),1)]),_:2},1032,["checked","onClick"]),p.title===i.unref(n)("editor.fontSize.default.tooltip")?(i.openBlock(),i.createBlock(f,{key:0})):i.createCommentVNode("",!0)],64))),128))]),_:1})]),_:1},8,["disabled","tooltip","title","btn_class"])}}}),r8=Ze.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:[...k0],button({editor:e,extension:n,t:r}){var l;const o=((l=n.options)==null?void 0:l.fontSizes)||[],s=[Ja,...o].map(u=>({title:u===Ja?r("editor.fontSize.default.tooltip"):String(u),isActive:()=>{const{fontSize:c}=e.getAttributes("textStyle");return u===Ja&&c===void 0?!0:e.isActive({fontSize:String(u)})||!1},action:()=>{if(u===Ja){e.commands.unsetFontSize();return}e.commands.setFontSize(String(u))},disabled:!e.can().setFontSize(String(u)),divider:u===Ja||!1,default:u===Ja||!1})),a=s.filter(u=>u.disabled).length===s.length;return{component:qU,componentProps:{editor:e,tooltip:r("editor.fontSize.tooltip"),disabled:a,items:s,maxHeight:280,customClass:"border border-gray-300 rounded-none text-gray-500 px-2.5 h-[26px]"}}}}},addGlobalAttributes(){return[{types:["paragraph","textStyle"],attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replace(/['"]+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontSize}}),KU=t=>{if(!t.children.length)return;const e=t.querySelectorAll("span");e&&e.forEach(n=>{var r,o;const s=n.getAttribute("style"),a=(o=(r=n.parentElement)===null||r===void 0?void 0:r.closest("span"))===null||o===void 0?void 0:o.getAttribute("style");n.setAttribute("style",`${a};${s}`)})},GU=Dn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&KU(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,r)=>{if(n.isTextblock)return!0;n.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(s=>!!s))||t.removeMark(r,r+n.nodeSize,this.type)}),!0}}}}),XU=Ze.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:t=>{var e;return(e=t.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),YU={class:"flex items-center h-[32px] hover:bg-ed-muted rounded-md"},JU={class:"flex items-center justify-center text-sm"},ZU={width:"18px",height:"18px",viewBox:"0 0 240 240",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},QU={id:"icon/字体颜色",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},NU={transform:"translate(0.000000, 0.500000)"},eW={transform:"translate(39.000000, 17.353553)"},tW=["fill"],nW=i.defineComponent({__name:"ColorActionButton",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=i.ref(void 0);function r(s){var a;(a=e.action)==null||a.call(e,s)}function o(s){var a;(a=e.action)==null||a.call(e,n.value)}return(s,a)=>(i.openBlock(),i.createElementBlock("div",YU,[i.createVNode(Ke,{id:"color",tooltip:s.tooltip,disabled:s.disabled,action:o},{icon:i.withCtx(()=>[i.createElementVNode("span",JU,[(i.openBlock(),i.createElementBlock("svg",ZU,[i.createElementVNode("g",QU,[i.createElementVNode("g",NU,[i.createElementVNode("g",eW,[i.createElementVNode("path",{id:"矩形",d:"M11,201.146447 L167,201.146447 C173.075132,201.146447 178,206.071314 178,212.146447 C178,218.221579 173.075132,223.146447 167,223.146447 L11,223.146447 C4.92486775,223.146447 7.43989126e-16,218.221579 0,212.146447 C-7.43989126e-16,206.071314 4.92486775,201.146447 11,201.146447 Z",fill:n.value||"#000","fill-rule":"evenodd"},null,8,tW),a[1]||(a[1]=i.createElementVNode("path",{id:"路径-21",d:"M72.3425855,16.8295583 C75.799482,7.50883712 86.1577877,2.75526801 95.4785089,6.21216449 C100.284516,7.99463061 104.096358,11.7387855 105.968745,16.4968188 L106.112518,16.8745422 L159.385152,161.694068 C161.291848,166.877345 158.635655,172.624903 153.452378,174.531599 C148.358469,176.405421 142.719567,173.872338 140.716873,168.864661 L140.614848,168.598825 L89.211,28.86 L37.3759214,168.623816 C35.4885354,173.712715 29.8981043,176.351047 24.7909589,174.617647 L24.5226307,174.522368 C19.4337312,172.634982 16.7953993,167.044551 18.5287999,161.937406 L18.6240786,161.669077 L72.3425855,16.8295583 Z",fill:"currentColor","fill-rule":"nonzero"},null,-1)),a[2]||(a[2]=i.createElementVNode("path",{id:"路径-22",d:"M121,103.146447 C126.522847,103.146447 131,107.623599 131,113.146447 C131,118.575687 126.673329,122.994378 121.279905,123.142605 L121,123.146447 L55,123.146447 C49.4771525,123.146447 45,118.669294 45,113.146447 C45,107.717207 49.3266708,103.298515 54.7200952,103.150288 L55,103.146447 L121,103.146447 Z",fill:"currentColor","fill-rule":"nonzero"},null,-1))])])])]))])]),_:1},8,["tooltip","disabled"]),i.createVNode(gC,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=l=>n.value=l),disabled:s.disabled,onChange:r},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{variant:"ghost",size:"icon",class:"h-[32px] w-3 rounded-l-none hover:bg-ed-muted-foreground/20",disabled:s.disabled},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"])]))}}),o8=XU.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,t:n}){return{component:nW,componentProps:{action:r=>{typeof r>"u"&&e.chain().focus().unsetColor().run(),typeof r=="string"&&e.chain().focus().setColor(r).run()},isActive:()=>{const{color:r}=e.getAttributes("textStyle");return r&&e.isActive({color:r})||!1},editor:e,disabled:!e.can().setColor(""),tooltip:n("editor.color.tooltip")}}}}}}),rW=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,oW=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,i8=Dn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:t=>t.getAttribute("data-color")||t.style.backgroundColor,renderHTML:t=>t.color?{"data-color":t.color,style:`background-color: ${t.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:t}){return["mark",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHighlight:t=>({commands:e})=>e.setMark(this.name,t),toggleHighlight:t=>({commands:e})=>e.toggleMark(this.name,t),unsetHighlight:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Vs({find:rW,type:this.type})]},addPasteRules(){return[ji({find:oW,type:this.type})]}}),iW=i8.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),multicolor:!0,button:({editor:e,t:n})=>({component:W5,componentProps:{action:r=>{typeof r=="string"&&e.chain().focus().setHighlight({color:r}).run(),typeof r>"u"&&e.chain().focus().unsetHighlight().run()},editor:e,isActive:()=>e.isActive("highlight")||!1,disabled:!e.can().setHighlight(),shortcutKeys:["⇧","mod","H"],tooltip:n("editor.highlight.tooltip")}})}}}),sW="listItem",s8="textStyle",a8=/^\s*([-+*])\s$/,aW=Bt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sW,this.editor.getAttributes(s8)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Wa({find:a8,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wa({find:a8,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(s8),editor:this.editor})),[t]}}),lW=["id"],l8=i.defineComponent({__name:"ActionDropdownButtonSplit",props:{icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},class:{default:""},shortcutKeys:{default:void 0},btnClass:{default:""},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},id:{default:""}},setup(t){const e=t;return(n,r)=>{var o;return i.openBlock(),i.createElementBlock("div",{id:`dropdown-btn-${n.id}`,class:i.normalizeClass(["flex items-center h-[32px] hover:bg-ed-muted rounded-md",[((o=n.isActive)==null?void 0:o.call(n))&&"bg-ed-muted"]])},[i.createVNode(Ke,{class:i.normalizeClass(n.btnClass),action:n.action,title:n.title,icon:n.icon,tooltip:n.tooltip,disabled:n.disabled,"shortcut-keys":n.shortcutKeys},null,8,["class","action","title","icon","tooltip","disabled","shortcut-keys"]),i.createVNode(i.unref(ZC),null,{default:i.withCtx(()=>[i.createVNode(i.unref(QC),{disabled:n.disabled},{default:i.withCtx(()=>[i.createVNode(yn,{variant:"ghost",size:"icon",class:"h-[32px] w-3 rounded-l-none hover:bg-ed-muted-foreground/20",disabled:n.disabled},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["disabled"]),i.createVNode(i.unref(NC),i.mergeProps({class:i.unref(ke)("min-w-24",e.class),align:"start",side:"bottom"},n.$attrs),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16,["class"])]),_:3})],10,lW)}}}),uW=i.defineComponent({__name:"BulletListMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},tooltip:{default:""}},setup(t){const e=t,{t:n}=Ot(),r=[{label:"editor.bulletlist.disc.tooltip",value:"disc"},{label:"editor.bulletlist.circle.tooltip",value:"circle"},{label:"editor.bulletlist.square.tooltip",value:"square"}],o=i.computed(()=>{var a;return(a=e.editor)!=null&&a.isActive("bulletList")?e.editor.getAttributes("bulletList").listStyleType:"disc"});function s(a){e.editor.isActive("bulletList")?e.editor.getAttributes("bulletList").listStyleType===a.value?e.editor.chain().focus().toggleBulletList().run():e.editor.chain().focus().updateAttributes("bulletList",{listStyleType:a.value}).run():e.editor.chain().focus().toggleBulletList().updateAttributes("bulletList",{listStyleType:a.value}).run()}return(a,l)=>(i.openBlock(),i.createBlock(l8,{id:"bullet-list",action:()=>s,disabled:a.disabled,tooltip:a.tooltip,class:"grid w-full grid-cols-3 gap-1 min-w-4"},{default:i.withCtx(()=>[i.createVNode(i.unref(vl),null,{default:i.withCtx(()=>[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(r,u=>i.createVNode(i.unref(gl),{key:u.value,"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(dg),{class:"p-0",onClick:c=>s(u)},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([[o.value===u.value?"bg-ed-accent border border-ed-accent-foreground":""],"h-[48px] flex flex-col w-[48px] box-border rounded-sm border"])},[i.createElementVNode("ol",{style:i.normalizeStyle({listStyleType:u.value,lineHeight:1}),class:"text-[10px] pl-3 flex-1 list-outside flex flex-col items-center justify-center"},[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(3,c=>i.createElementVNode("li",{key:c},l[0]||(l[0]=[i.createElementVNode("hr",{class:"border-0 bg-gray-200 h-[3px] w-6 my-1"},null,-1)]))),64))],4)],2)]),_:2},1032,["onClick"])]),_:2},1024),i.createVNode(i.unref(ta),{side:"bottom"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)(u.label)),1)]),_:2},1024)]),_:2},1024)),64))]),_:1})]),_:1},8,["action","disabled","tooltip"]))}}),cW=aW.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),listStyleType:{default:"disc",parseHTML:e=>({listStyleType:e.style["list-style-type"]??"disc"}),renderHTML:({listStyleType:e})=>({style:`list-style-type: ${(e==null?void 0:e.listStyleType)||e}`})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:uW,componentProps:{action:()=>e.commands.toggleBulletList(),isActive:()=>e.isActive("bulletList")||!1,disabled:!e.can().toggleBulletList(),shortcutKeys:["shift","mod","8"],icon:"List",tooltip:n("editor.bulletlist.tooltip")}})}}}),pg=Bt.create({name:"clear",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.chain().focus().clearNodes().unsetAllMarks().run(),disabled:!e.can().chain().focus().clearNodes().unsetAllMarks().run(),icon:"Eraser",tooltip:n("editor.clear.tooltip")}})}}}),dW="listItem",u8="textStyle",c8=/^(\d+)\.\s$/,fW=Bt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(dW,this.editor.getAttributes(u8)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Wa({find:c8,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Wa({find:c8,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(u8)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),pW=i.defineComponent({__name:"OrderedListMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},tooltip:{default:""},shortcutKeys:{default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,{t:n}=Ot(),r=[{label:"editor.orderedlist.decimal.tooltip",value:"decimal"},{label:"editor.orderedlist.decimalLeadingZero.tooltip",value:"decimal-leading-zero"},{label:"editor.orderedlist.lowerRoman.tooltip",value:"lower-roman"},{label:"editor.orderedlist.upperRoman.tooltip",value:"upper-roman"},{label:"editor.orderedlist.lowerLatin.tooltip",value:"lower-latin"},{label:"editor.orderedlist.upperLatin.tooltip",value:"upper-latin"},{label:"editor.orderedlist.tradChineseInformal.tooltip",value:"trad-chinese-informal"},{label:"editor.orderedlist.simpChineseFormal.tooltip",value:"simp-chinese-formal"}],o=i.computed(()=>{var a;return(a=e.editor)!=null&&a.isActive("orderedList")?e.editor.getAttributes("orderedList").listType:"decimal"});function s(a){var l,u;e.editor.isActive("orderedList")?e.editor.getAttributes("orderedList").listType===a.value?(l=e.editor.chain())==null||l.toggleOrderedList().run():(u=e.editor.chain())==null||u.updateAttributes("orderedList",{listType:a.value}).run():e.editor.chain().focus().toggleOrderedList().updateAttributes("orderedList",{listType:a.value}).run()}return(a,l)=>(i.openBlock(),i.createBlock(l8,{action:()=>s,disabled:a.disabled,tooltip:a.tooltip,"is-active":a.isActive,"shortcut-keys":a.shortcutKeys,class:"min-w-4 w-full grid grid-cols-3 gap-1"},{default:i.withCtx(()=>[i.createVNode(i.unref(vl),null,{default:i.withCtx(()=>[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(r,u=>i.createVNode(i.unref(gl),{key:u.value,"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(i.unref(bl),{"as-child":""},{default:i.withCtx(()=>[i.createVNode(i.unref(dg),{class:"p-0",onClick:c=>s(u)},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([[o.value===u.value?"bg-ed-accent border border-ed-accent-foreground":""],"h-[72px] flex flex-col w-[72px] box-border rounded-sm border"])},[i.createElementVNode("ol",{style:i.normalizeStyle({listStyleType:u.value,lineHeight:1}),class:"text-[12px] pl-3 flex-1 list-outside flex flex-col items-center justify-center"},[(i.openBlock(),i.createElementBlock(i.Fragment,null,i.renderList(3,c=>i.createElementVNode("li",{key:c},l[0]||(l[0]=[i.createElementVNode("hr",{class:"border-0 bg-gray-200 h-[3px] w-6 my-1"},null,-1)]))),64))],4)],2)]),_:2},1032,["onClick"])]),_:2},1024),i.createVNode(i.unref(ta),{side:"bottom"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)(u.label)),1)]),_:2},1024)]),_:2},1024)),64))]),_:1})]),_:1},8,["action","disabled","tooltip","is-active","shortcut-keys"]))}}),hW=fW.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),listType:{default:"decimal",parseHTML:e=>{e.style.getPropertyValue("list-style-type")},renderHTML:({listType:e})=>({style:`list-style-type: ${e}`})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:pW,componentProps:{action:()=>e.commands.toggleOrderedList(),isActive:()=>e.isActive("orderedList")||!1,disabled:!e.can().toggleOrderedList(),icon:"ListOrdered",shortcutKeys:["mod","shift","7"],tooltip:n("editor.orderedlist.tooltip")}})}}}),mW=/^\s*(\[([( |x])?\])\s$/,gW=Bt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",bt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),a=document.createElement("span"),l=document.createElement("input"),u=document.createElement("div");return s.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",c=>c.preventDefault()),l.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:f}=c.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,f])=>{o.setAttribute(c,f)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,s.append(l,a),o.append(s,u),Object.entries(e).forEach(([c,f])=>{o.setAttribute(c,f)}),{dom:o,contentDOM:u,update:c=>c.type!==this.type?!1:(o.dataset.checked=c.attrs.checked,l.checked=c.attrs.checked,!0)}}},addInputRules(){return[Wa({find:mW,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),bW=Bt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.toggleTaskList(),isActive:()=>e.isActive("taskList")||!1,disabled:!e.can().toggleTaskList(),icon:"ListTodo",shortcutKeys:["shift","mod","9"],tooltip:n("editor.tasklist.tooltip")}})}},addExtensions(){return[gW.configure(this.options.taskItem)]}}),vW=/^\s*>\s$/,yW=Bt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Wa({find:vW,type:this.type})]}}).extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"blockquote"},button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.toggleBlockquote(),isActive:()=>e.isActive("blockquote")||!1,disabled:!e.can().toggleBlockquote(),icon:"TextQuote",shortcutKeys:["shift","mod","B"],tooltip:n("editor.blockquote.tooltip")}})}}}),wW="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",xW="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",El=(t,e)=>{for(const n in e)t[n]=e[n];return t},hg="numeric",mg="ascii",gg="alpha",ec="asciinumeric",tc="alphanumeric",bg="domain",d8="emoji",CW="scheme",EW="slashscheme",vg="whitespace";function kW(t,e){return t in e||(e[t]=[]),e[t]}function sa(t,e,n){e[hg]&&(e[ec]=!0,e[tc]=!0),e[mg]&&(e[ec]=!0,e[gg]=!0),e[ec]&&(e[tc]=!0),e[gg]&&(e[tc]=!0),e[tc]&&(e[bg]=!0),e[d8]&&(e[bg]=!0);for(const r in e){const o=kW(r,n);o.indexOf(t)<0&&o.push(t)}}function SW(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function sr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}sr.groups={},sr.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||sr.groups;let o;return e&&e.j?o=e:(o=new sr(e),n&&r&&sa(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this;const s=t.length;if(!s)return o;for(let a=0;a<s-1;a++)o=o.tt(t[a]);return o.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||sr.groups;const o=this;if(e&&e.j)return o.j[t]=e,e;const s=e;let a,l=o.go(t);if(l?(a=new sr,El(a.j,l.j),a.jr.push.apply(a.jr,l.jr),a.jd=l.jd,a.t=l.t):a=new sr,s){if(r)if(a.t&&typeof a.t=="string"){const u=El(SW(a.t,r),n);sa(s,u,r)}else n&&sa(s,n,r);a.t=s}return o.j[t]=a,a}};const ut=(t,e,n,r,o)=>t.ta(e,n,r,o),tn=(t,e,n,r,o)=>t.tr(e,n,r,o),f8=(t,e,n,r,o)=>t.ts(e,n,r,o),ye=(t,e,n,r,o)=>t.tt(e,n,r,o),mi="WORD",yg="UWORD",p8="ASCIINUMERICAL",h8="ALPHANUMERICAL",nc="LOCALHOST",wg="TLD",xg="UTLD",$f="SCHEME",kl="SLASH_SCHEME",Cg="NUM",Eg="WS",kg="NL",rc="OPENBRACE",oc="CLOSEBRACE",zf="OPENBRACKET",Hf="CLOSEBRACKET",Uf="OPENPAREN",Wf="CLOSEPAREN",jf="OPENANGLEBRACKET",qf="CLOSEANGLEBRACKET",Kf="FULLWIDTHLEFTPAREN",Gf="FULLWIDTHRIGHTPAREN",Xf="LEFTCORNERBRACKET",Yf="RIGHTCORNERBRACKET",Jf="LEFTWHITECORNERBRACKET",Zf="RIGHTWHITECORNERBRACKET",Qf="FULLWIDTHLESSTHAN",Nf="FULLWIDTHGREATERTHAN",ep="AMPERSAND",Sg="APOSTROPHE",tp="ASTERISK",is="AT",np="BACKSLASH",rp="BACKTICK",op="CARET",ss="COLON",_g="COMMA",ip="DOLLAR",zo="DOT",sp="EQUALS",Tg="EXCLAMATION",Hr="HYPHEN",ic="PERCENT",ap="PIPE",lp="PLUS",up="POUND",sc="QUERY",Ag="QUOTE",m8="FULLWIDTHMIDDLEDOT",Og="SEMI",Ho="SLASH",ac="TILDE",cp="UNDERSCORE",g8="EMOJI",dp="SYM";var b8=Object.freeze({__proto__:null,WORD:mi,UWORD:yg,ASCIINUMERICAL:p8,ALPHANUMERICAL:h8,LOCALHOST:nc,TLD:wg,UTLD:xg,SCHEME:$f,SLASH_SCHEME:kl,NUM:Cg,WS:Eg,NL:kg,OPENBRACE:rc,CLOSEBRACE:oc,OPENBRACKET:zf,CLOSEBRACKET:Hf,OPENPAREN:Uf,CLOSEPAREN:Wf,OPENANGLEBRACKET:jf,CLOSEANGLEBRACKET:qf,FULLWIDTHLEFTPAREN:Kf,FULLWIDTHRIGHTPAREN:Gf,LEFTCORNERBRACKET:Xf,RIGHTCORNERBRACKET:Yf,LEFTWHITECORNERBRACKET:Jf,RIGHTWHITECORNERBRACKET:Zf,FULLWIDTHLESSTHAN:Qf,FULLWIDTHGREATERTHAN:Nf,AMPERSAND:ep,APOSTROPHE:Sg,ASTERISK:tp,AT:is,BACKSLASH:np,BACKTICK:rp,CARET:op,COLON:ss,COMMA:_g,DOLLAR:ip,DOT:zo,EQUALS:sp,EXCLAMATION:Tg,HYPHEN:Hr,PERCENT:ic,PIPE:ap,PLUS:lp,POUND:up,QUERY:sc,QUOTE:Ag,FULLWIDTHMIDDLEDOT:m8,SEMI:Og,SLASH:Ho,TILDE:ac,UNDERSCORE:cp,EMOJI:g8,SYM:dp});const gi=/[a-z]/,lc=new RegExp("\\p{L}","u"),Mg=new RegExp("\\p{Emoji}","u"),bi=/\d/,Bg=/\s/,v8="\r",Ig=`
|
|
284
284
|
`,_W="️",TW="",Rg="";let fp=null,pp=null;function AW(t=[]){const e={};sr.groups=e;const n=new sr;fp==null&&(fp=w8(wW)),pp==null&&(pp=w8(xW)),ye(n,"'",Sg),ye(n,"{",rc),ye(n,"}",oc),ye(n,"[",zf),ye(n,"]",Hf),ye(n,"(",Uf),ye(n,")",Wf),ye(n,"<",jf),ye(n,">",qf),ye(n,"(",Kf),ye(n,")",Gf),ye(n,"「",Xf),ye(n,"」",Yf),ye(n,"『",Jf),ye(n,"』",Zf),ye(n,"<",Qf),ye(n,">",Nf),ye(n,"&",ep),ye(n,"*",tp),ye(n,"@",is),ye(n,"`",rp),ye(n,"^",op),ye(n,":",ss),ye(n,",",_g),ye(n,"$",ip),ye(n,".",zo),ye(n,"=",sp),ye(n,"!",Tg),ye(n,"-",Hr),ye(n,"%",ic),ye(n,"|",ap),ye(n,"+",lp),ye(n,"#",up),ye(n,"?",sc),ye(n,'"',Ag),ye(n,"/",Ho),ye(n,";",Og),ye(n,"~",ac),ye(n,"_",cp),ye(n,"\\",np),ye(n,"・",m8);const r=tn(n,bi,Cg,{[hg]:!0});tn(r,bi,r);const o=tn(r,gi,p8,{[ec]:!0}),s=tn(r,lc,h8,{[tc]:!0}),a=tn(n,gi,mi,{[mg]:!0});tn(a,bi,o),tn(a,gi,a),tn(o,bi,o),tn(o,gi,o);const l=tn(n,lc,yg,{[gg]:!0});tn(l,gi),tn(l,bi,s),tn(l,lc,l),tn(s,bi,s),tn(s,gi),tn(s,lc,s);const u=ye(n,Ig,kg,{[vg]:!0}),c=ye(n,v8,Eg,{[vg]:!0}),f=tn(n,Bg,Eg,{[vg]:!0});ye(n,Rg,f),ye(c,Ig,u),ye(c,Rg,f),tn(c,Bg,f),ye(f,v8),ye(f,Ig),tn(f,Bg,f),ye(f,Rg,f);const p=tn(n,Mg,g8,{[d8]:!0});ye(p,"#"),tn(p,Mg,p),ye(p,_W,p);const m=ye(p,TW);ye(m,"#"),tn(m,Mg,p);const g=[[gi,a],[bi,o]],b=[[gi,null],[lc,l],[bi,s]];for(let y=0;y<fp.length;y++)as(n,fp[y],wg,mi,g);for(let y=0;y<pp.length;y++)as(n,pp[y],xg,yg,b);sa(wg,{tld:!0,ascii:!0},e),sa(xg,{utld:!0,alpha:!0},e),as(n,"file",$f,mi,g),as(n,"mailto",$f,mi,g),as(n,"http",kl,mi,g),as(n,"https",kl,mi,g),as(n,"ftp",kl,mi,g),as(n,"ftps",kl,mi,g),sa($f,{scheme:!0,ascii:!0},e),sa(kl,{slashscheme:!0,ascii:!0},e),t=t.sort((y,w)=>y[0]>w[0]?1:-1);for(let y=0;y<t.length;y++){const w=t[y][0],E=t[y][1]?{[CW]:!0}:{[EW]:!0};w.indexOf("-")>=0?E[bg]=!0:gi.test(w)?bi.test(w)?E[ec]=!0:E[mg]=!0:E[hg]=!0,f8(n,w,w,E)}return f8(n,"localhost",nc,{ascii:!0}),n.jd=new sr(dp),{start:n,tokens:El({groups:e},b8)}}function y8(t,e){const n=OW(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[];let s=0,a=0;for(;a<r;){let l=t,u=null,c=0,f=null,p=-1,m=-1;for(;a<r&&(u=l.go(n[a]));)l=u,l.accepts()?(p=0,m=0,f=l):p>=0&&(p+=n[a].length,m++),c+=n[a].length,s+=n[a].length,a++;s-=p,a-=m,c-=p,o.push({t:f.t,v:e.slice(s-c,s),s:s-c,e:s})}return o}function OW(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),s,a=o<55296||o>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(a),r+=a.length}return e}function as(t,e,n,r,o){let s;const a=e.length;for(let l=0;l<a-1;l++){const u=e[l];t.j[u]?s=t.j[u]:(s=new sr(r),s.jr=o.slice(),t.j[u]=s),t=s}return s=new sr(n),s.jr=o.slice(),t.j[e[a-1]]=s,s}function w8(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let s=0;for(;o.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let a=parseInt(t.substring(r,r+s),10);a>0;a--)n.pop();r+=s}else n.push(t[r]),r++}return e}const uc={defaultProtocol:"http",events:null,format:x8,formatHref:x8,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Lg(t,e=null){let n=El({},uc);t&&(n=El(n,t instanceof Lg?t.o:t));const r=n.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}Lg.prototype={o:uc,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:uc[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function x8(t){return t}function C8(t,e){this.t="token",this.v=t,this.tk=e}C8.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=uc.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),s=this.toFormattedString(t),a={},l=t.get("className",n,e),u=t.get("target",n,e),c=t.get("rel",n,e),f=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return a.href=r,l&&(a.class=l),u&&(a.target=u),c&&(a.rel=c),f&&El(a,f),{tagName:o,attributes:a,content:s,eventListeners:p}}};function hp(t,e){class n extends C8{constructor(o,s){super(o,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const E8=hp("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),k8=hp("text"),MW=hp("nl"),mp=hp("url",{isLink:!0,toHref(t=uc.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==nc&&t[1].t===ss}}),Ur=t=>new sr(t);function BW({groups:t}){const e=t.domain.concat([ep,tp,is,np,rp,op,ip,sp,Hr,Cg,ic,ap,lp,up,Ho,dp,ac,cp]),n=[ss,_g,zo,Tg,ic,sc,Ag,Og,jf,qf,rc,oc,Hf,zf,Uf,Wf,Kf,Gf,Xf,Yf,Jf,Zf,Qf,Nf],r=[ep,Sg,tp,np,rp,op,ip,sp,Hr,rc,oc,ic,ap,lp,up,sc,Ho,dp,ac,cp],o=Ur(),s=ye(o,ac);ut(s,r,s),ut(s,t.domain,s);const a=Ur(),l=Ur(),u=Ur();ut(o,t.domain,a),ut(o,t.scheme,l),ut(o,t.slashscheme,u),ut(a,r,s),ut(a,t.domain,a);const c=ye(a,is);ye(s,is,c),ye(l,is,c),ye(u,is,c);const f=ye(s,zo);ut(f,r,s),ut(f,t.domain,s);const p=Ur();ut(c,t.domain,p),ut(p,t.domain,p);const m=ye(p,zo);ut(m,t.domain,p);const g=Ur(E8);ut(m,t.tld,g),ut(m,t.utld,g),ye(c,nc,g);const b=ye(p,Hr);ye(b,Hr,b),ut(b,t.domain,p),ut(g,t.domain,p),ye(g,zo,m),ye(g,Hr,b);const y=ye(g,ss);ut(y,t.numeric,E8);const w=ye(a,Hr),x=ye(a,zo);ye(w,Hr,w),ut(w,t.domain,a),ut(x,r,s),ut(x,t.domain,a);const E=Ur(mp);ut(x,t.tld,E),ut(x,t.utld,E),ut(E,t.domain,a),ut(E,r,s),ye(E,zo,x),ye(E,Hr,w),ye(E,is,c);const k=ye(E,ss),C=Ur(mp);ut(k,t.numeric,C);const _=Ur(mp),A=Ur();ut(_,e,_),ut(_,n,A),ut(A,e,_),ut(A,n,A),ye(E,Ho,_),ye(C,Ho,_);const T=ye(l,ss),P=ye(u,ss),I=ye(P,Ho),M=ye(I,Ho);ut(l,t.domain,a),ye(l,zo,x),ye(l,Hr,w),ut(u,t.domain,a),ye(u,zo,x),ye(u,Hr,w),ut(T,t.domain,_),ye(T,Ho,_),ye(T,sc,_),ut(M,t.domain,_),ut(M,e,_),ye(M,Ho,_);const j=[[rc,oc],[zf,Hf],[Uf,Wf],[jf,qf],[Kf,Gf],[Xf,Yf],[Jf,Zf],[Qf,Nf]];for(let U=0;U<j.length;U++){const[q,le]=j[U],H=ye(_,q);ye(A,q,H),ye(H,le,_);const F=Ur(mp);ut(H,e,F);const L=Ur();ut(H,n),ut(F,e,F),ut(F,n,L),ut(L,e,F),ut(L,n,L),ye(F,le,_),ye(L,le,_)}return ye(o,nc,E),ye(o,kg,MW),{start:o,tokens:b8}}function IW(t,e,n){let r=n.length,o=0,s=[],a=[];for(;o<r;){let l=t,u=null,c=null,f=0,p=null,m=-1;for(;o<r&&!(u=l.go(n[o].t));)a.push(n[o++]);for(;o<r&&(c=u||l.go(n[o].t));)u=null,l=c,l.accepts()?(m=0,p=l):m>=0&&m++,o++,f++;if(m<0)o-=f,o<r&&(a.push(n[o]),o++);else{a.length>0&&(s.push(Pg(k8,e,a)),a=[]),o-=m,f-=m;const g=p.t,b=n.slice(o-f,o);s.push(Pg(g,e,b))}}return a.length>0&&s.push(Pg(k8,e,a)),s}function Pg(t,e,n){const r=n[0].s,o=n[n.length-1].e,s=e.slice(r,o);return new t(s,n)}const RW=typeof console<"u"&&console&&console.warn||(()=>{}),LW="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",qt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function PW(){return sr.groups={},qt.scanner=null,qt.parser=null,qt.tokenQueue=[],qt.pluginQueue=[],qt.customSchemes=[],qt.initialized=!1,qt}function S8(t,e=!1){if(qt.initialized&&RW(`linkifyjs: already initialized - will not register custom scheme "${t}" ${LW}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
285
285
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
286
286
|
2. Cannot start or end with "-"
|
|
287
|
-
3. "-" cannot repeat`);qt.customSchemes.push([t,e])}function DW(){qt.scanner=AW(qt.customSchemes);for(let t=0;t<qt.tokenQueue.length;t++)qt.tokenQueue[t][1]({scanner:qt.scanner});qt.parser=BW(qt.scanner.tokens);for(let t=0;t<qt.pluginQueue.length;t++)qt.pluginQueue[t][1]({scanner:qt.scanner,parser:qt.parser});return qt.initialized=!0,qt}function Dg(t){return qt.initialized||DW(),IW(qt.parser.start,t,y8(qt.scanner.start,t))}Dg.scan=y8;function _8(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Lg(n),o=Dg(t),s=[];for(let a=0;a<o.length;a++){const l=o[a];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}function VW(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function FW(t){return new tt({key:new kt("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!o||s)return;const{tr:a}=r,l=EO(n.doc,[...e]);if(TO(l).forEach(({newRange:c})=>{const f=u4(r.doc,c,g=>g.isTextblock);let p,m;if(f.length>1?(p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(p=f[0],m=r.doc.textBetween(p.pos,c.to,void 0," ")),p&&m){const g=m.split(" ").filter(x=>x!=="");if(g.length<=0)return!1;const b=g[g.length-1],y=p.pos+m.lastIndexOf(b);if(!b)return!1;const w=Dg(b).map(x=>x.toObject(t.defaultProtocol));if(!VW(w))return!1;w.filter(x=>x.isLink).map(x=>({...x,from:y+x.start+1,to:y+x.end+1})).filter(x=>r.schema.marks.code?!r.doc.rangeHasMark(x.from,x.to,r.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{Nm(x.from,x.to,r.doc).some(E=>E.mark.type===t.type)||a.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!a.steps.length)return a}})}function $W(t){return new tt({key:new kt("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let a=r.target;const l=[];for(;a.nodeName!=="DIV";)l.push(a),a=a.parentNode;if(!l.find(m=>m.nodeName==="A"))return!1;const u=f4(e.state,t.type.name),c=r.target,f=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:u.href,p=(s=c==null?void 0:c.target)!==null&&s!==void 0?s:u.target;return c&&f?(window.open(f,p),!0):!1}}})}function zW(t){return new tt({key:new kt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:s}=o,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const u=_8(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}const HW=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function aa(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(HW,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const UW=Dn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){S8(t);return}S8(t.scheme,t.optionalSlashes)})},onDestroy(){PW()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!aa(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!aa(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!aa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!aa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ji({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=_8(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!aa(a,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(FW({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!aa(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push($W({type:this.type})),this.options.linkOnPaste&&t.push(zW({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),WW={class:"flex w-full max-w-sm items-center gap-1.5"},jW={class:"relative w-full max-w-sm items-center"},qW={class:"flex w-full max-w-sm items-center gap-1.5"},KW={class:"relative w-full max-w-sm items-center"},GW={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},T8=i.defineComponent({__name:"LinkEditBlock",props:{editor:{}},emits:["onSetLink","onClickOutside"],setup(t,{emit:e}){const n=t,r=e,{t:o}=Ot();let s=i.reactive({text:"",link:""});const a=i.ref(null),{focused:l}=ht.useFocus(a),u=i.ref(!0),c=i.ref(null);ht.onClickOutside(c,m=>r("onClickOutside",m)),i.watchEffect(()=>{const{href:m,target:g}=n.editor.getAttributes("link"),{from:b,to:y}=n.editor.state.selection,w=n.editor.state.doc.textBetween(b,y," ");s={link:m,text:w}});function f(){const m=p(s.link);r("onSetLink",m,s.text,u.value)}function p(m){if(!m)return m;const g=m.trim();return/^https?:\/\//i.test(g)||/^[a-zA-Z][a-zA-Z0-9+.\-]*:/i.test(g)?g:"http://"+g}return i.onMounted(()=>{l.value=!0}),(m,g)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"target",ref:c,class:"p-2 bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800"},[i.createElementVNode("form",{class:"flex flex-col gap-2",onSubmit:i.withModifiers(f,["prevent"])},[i.createVNode(i.unref(Ef),null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.link.dialog.text")),1)]),_:1}),i.createElementVNode("div",WW,[i.createElementVNode("div",jW,[i.createVNode(i.unref(hl),{modelValue:i.unref(s).text,"onUpdate:modelValue":g[0]||(g[0]=b=>i.unref(s).text=b),type:"text",required:"",placeholder:"텍스트"},null,8,["modelValue"])])]),i.createVNode(i.unref(Ef),null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.link.dialog.link")),1)]),_:1}),i.createElementVNode("div",qW,[i.createElementVNode("div",KW,[i.createVNode(i.unref(hl),{ref_key:"inputRef",ref:a,modelValue:i.unref(s).link,"onUpdate:modelValue":g[1]||(g[1]=b=>i.unref(s).link=b),type:"text",required:"",class:"pl-10"},null,8,["modelValue"]),i.createElementVNode("span",GW,[i.createVNode(i.unref(Lt),{class:"size-5 text-ed-muted-foreground",name:"Link"})])])]),i.createVNode(i.unref(yn),{class:"mt-2 self-end"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.link.dialog.button.apply")),1)]),_:1})],32)],512))}}),XW=i.defineComponent({__name:"LinkEditPopover",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},isActive:{type:Function,default:void 0},action:{type:Function,default:void 0}},setup(t){const e=t;function n(r,o,s){e.action&&e.action({link:r,text:o,openInNewTab:s})}return(r,o)=>(i.openBlock(),i.createBlock(i.unref(fl),null,{default:i.withCtx(({open:s})=>[i.createVNode(i.unref(ml),{disabled:r.disabled},{default:i.withCtx(()=>[i.createVNode(Ke,{icon:r.icon,tooltip:r.tooltip,"is-active":r.isActive,"is-pressed":s,disabled:r.disabled},null,8,["icon","tooltip","is-active","is-pressed","disabled"])]),_:2},1032,["disabled"]),i.createVNode(i.unref(pl),{"as-child":"",class:"w-80",align:"start",side:"bottom"},{default:i.withCtx(()=>[i.createVNode(T8,{editor:r.editor,onOnSetLink:n},null,8,["editor"])]),_:1})]),_:1}))}}),Vg=UW.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:t}){return["a",bt(this.options.HTMLAttributes,t,{class:"link"}),0]},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),openOnClick:!0,button:({editor:e,t:n})=>({component:XW,componentProps:{action:r=>{const{link:o,text:s,openInNewTab:a}=r;e.chain().extendMarkRange("link").insertContent({type:"text",text:s,marks:[{type:"link",attrs:{href:o,target:a?"_blank":""}}]}).setLink({href:o}).focus().run()},isActive:()=>e.isActive("link")||!1,disabled:!e.can().setLink({href:""}),icon:"Link",tooltip:n("editor.link.tooltip")}})}},addProseMirrorPlugins(){return[new tt({props:{handleClick:(t,e)=>{const{schema:n,doc:r,tr:o}=t.state,s=vd(r.resolve(e),n.marks.link);if(!s)return!1;const a=r.resolve(s.from),l=r.resolve(s.to),u=o.setSelection(new Te(a,l));t.dispatch(u)}}})]}}),YW=Bt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",bt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:o}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):p4(n)?s.insertContentAt(o.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:a,dispatch:l})=>{var u;if(l){const{$to:c}=a.selection,f=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?a.setSelection(Te.create(a.doc,c.pos+1)):c.nodeAfter.isBlock?a.setSelection(Le.create(a.doc,c.pos)):a.setSelection(Te.create(a.doc,c.pos));else{const p=(u=c.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();p&&(a.insert(f,p),a.setSelection(Te.create(a.doc,f+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[g4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}).extend({renderHTML(){return["div",bt(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.setHorizontalRule(),disabled:!e.can().setHorizontalRule(),icon:"Minus",shortcutKeys:["mod","alt","S"],tooltip:n("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}}});var gp=200,xn=function(){};xn.prototype.append=function(e){return e.length?(e=xn.from(e),!this.length&&e||e.length<gp&&this.leafAppend(e)||this.length<gp&&e.leafPrepend(this)||this.appendInner(e)):this},xn.prototype.prepend=function(e){return e.length?xn.from(e).append(this):this},xn.prototype.appendInner=function(e){return new JW(this,e)},xn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?xn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},xn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},xn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)},xn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,a){return o.push(e(s,a))},n,r),o},xn.from=function(e){return e instanceof xn?e:e&&e.length?new A8(e):xn.empty};var A8=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,a,l){for(var u=s;u<a;u++)if(o(this.values[u],l+u)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,a,l){for(var u=s-1;u>=a;u--)if(o(this.values[u],l+u)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=gp)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=gp)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(xn);xn.empty=new A8([]);var JW=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,a){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(s,l),a)===!1||s>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,s)-l,a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,a){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(s,l)-l,a+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(o,l),s,a)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(xn);const ZW=500;class po{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let a=e.tr,l,u,c=[],f=[];return this.items.forEach((p,m)=>{if(!p.step){o||(o=this.remapping(r,m+1),s=o.maps.length),s--,f.push(p);return}if(o){f.push(new Uo(p.map));let g=p.step.map(o.slice(s)),b;g&&a.maybeStep(g).doc&&(b=a.mapping.maps[a.mapping.maps.length-1],c.push(new Uo(b,void 0,void 0,c.length+f.length))),s--,b&&o.appendMap(b,s)}else a.maybeStep(p.step);if(p.selection)return l=o?p.selection.map(o.slice(s)):p.selection,u=new po(this.items.slice(0,r).append(f.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:a,selection:l}}addTransform(e,n,r,o){let s=[],a=this.eventCount,l=this.items,u=!o&&l.length?l.get(l.length-1):null;for(let f=0;f<e.steps.length;f++){let p=e.steps[f].invert(e.docs[f]),m=new Uo(e.mapping.maps[f],p,n),g;(g=u&&u.merge(m))&&(m=g,f?s.pop():l=l.slice(0,l.length-1)),s.push(m),n&&(a++,n=void 0),o||(u=m)}let c=a-r.depth;return c>NW&&(l=QW(l,c),a-=c),new po(l.append(s),a)}remapping(e,n){let r=new Nl;return this.items.forEach((o,s)=>{let a=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,a)},e,n),r}addMaps(e){return this.eventCount==0?this:new po(this.items.append(e.map(n=>new Uo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,a=e.steps.length,l=this.eventCount;this.items.forEach(m=>{m.selection&&l--},o);let u=n;this.items.forEach(m=>{let g=s.getMirror(--u);if(g==null)return;a=Math.min(a,g);let b=s.maps[g];if(m.step){let y=e.steps[g].invert(e.docs[g]),w=m.selection&&m.selection.map(s.slice(u+1,g));w&&l++,r.push(new Uo(b,y,w))}else r.push(new Uo(b))},o);let c=[];for(let m=n;m<a;m++)c.push(new Uo(s.maps[m]));let f=this.items.slice(0,o).append(c).append(r),p=new po(f,l);return p.emptyItemCount()>ZW&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],s=0;return this.items.forEach((a,l)=>{if(l>=e)o.push(a),a.selection&&s++;else if(a.step){let u=a.step.map(n.slice(r)),c=u&&u.getMap();if(r--,c&&n.appendMap(c,r),u){let f=a.selection&&a.selection.map(n.slice(r));f&&s++;let p=new Uo(c.invert(),u,f),m,g=o.length-1;(m=o.length&&o[g].merge(p))?o[g]=m:o.push(p)}}else a.map&&r--},this.items.length,0),new po(xn.from(o.reverse()),s)}}po.empty=new po(xn.empty,0);function QW(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Uo{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Uo(n.getMap().invert(),n,this.selection)}}}class ls{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const NW=20;function ej(t,e,n,r){let o=n.getMeta(la),s;if(o)return o.historyState;n.getMeta(rj)&&(t=new ls(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(la))return a.getMeta(la).redo?new ls(t.done.addTransform(n,void 0,r,bp(e)),t.undone,O8(n.mapping.maps),t.prevTime,t.prevComposition):new ls(t.done,t.undone.addTransform(n,void 0,r,bp(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),u=t.prevTime==0||!a&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!tj(n,t.prevRanges)),c=a?Fg(t.prevRanges,n.mapping):O8(n.mapping.maps);return new ls(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,bp(e)),po.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new ls(t.done.rebased(n,s),t.undone.rebased(n,s),Fg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ls(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Fg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function tj(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function O8(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,a)=>e.push(s,a));return e}function Fg(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function nj(t,e,n){let r=bp(e),o=la.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let a=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),u=new ls(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(a).setMeta(la,{redo:n,historyState:u})}let $g=!1,M8=null;function bp(t){let e=t.plugins;if(M8!=e){$g=!1,M8=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){$g=!0;break}}return $g}const la=new kt("history"),rj=new kt("closeHistory");function oj(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new tt({key:la,state:{init(){return new ls(po.empty,po.empty,null,0,-1)},apply(e,n,r){return ej(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?I8:r=="historyRedo"?R8:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function B8(t,e){return(n,r)=>{let o=la.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=nj(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const I8=B8(!1,!0),R8=B8(!0,!0),ij=Ze.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>I8(t,e),redo:()=>({state:t,dispatch:e})=>R8(t,e)}},addProseMirrorPlugins(){return[oj(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),L8={HISTORY_TRANSACTION:"history$",ADD_TO_HISTORY_TRANSACTION:"addToHistory"},zg=ij.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),depth:10,button:({editor:e,t:n})=>["undo","redo"].map(o=>({component:Ke,componentProps:{action:()=>{o==="undo"&&e.commands.undo(),o==="redo"&&e.commands.redo()},shortcutKeys:o==="undo"?["mod","Z"]:["shift","mod","Z"],disabled:!e.can()[o](),icon:o==="undo"?"Undo2":"Redo2",tooltip:n(`editor.${o}.tooltip`)}}))}}}),{isFullscreen:Hg,toggleFullscreen:Ug}=wn(),sj=Ze.create({name:"fullscreen",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{tooltip:Hg.value?r("editor.fullscreen.tooltip.exit"):r("editor.fullscreen.tooltip.fullscreen"),action:()=>Ug(),icon:Hg.value?"Minimize":"Maximize",isActive:()=>Hg.value}})}},addKeyboardShortcuts(){return{F11:()=>(Ug(),!0),"Mod-F11":()=>(Ug(),!0)}}}),aj=Ze.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new tt({key:new kt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const a=s-o,l=0,u=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,u);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,u=s-r,c=l-u,f=l;return e.deleteRange(c,f),!(this.storage.characters({node:e.doc})>r)}})]}});function lj(t={}){return new tt({view(e){return new uj(e,t)}})}class uj{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=a=>{this[o](a)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let l=e.nodeBefore,u=e.nodeAfter;if(l||u){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let f=c.getBoundingClientRect(),p=l?f.bottom:f.top;l&&u&&(p=(p+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:f.left,right:f.right,top:p-this.width/2,bottom:p+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let s,a;if(!o||o==document.body&&getComputedStyle(o).position=="static")s=-pageXOffset,a=-pageYOffset;else{let l=o.getBoundingClientRect();s=l.left-o.scrollLeft,a=l.top-o.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-a+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!s){let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=uy(this.editorView.state.doc,a,this.editorView.dragging.slice);l!=null&&(a=l)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const cj=Ze.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[lj(this.options)]}}),dj=Ze.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new tt({key:new kt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return ft.create(t,[]);let a=0;this.options.mode==="deepest"&&t.descendants((u,c)=>{if(u.isText)return;if(!(o>=c&&o<=c+u.nodeSize-1))return!1;a+=1});let l=0;return t.descendants((u,c)=>{if(u.isText||!(o>=c&&o<=c+u.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&a-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(jt.node(c,c+u.nodeSize,{class:this.options.className}))}),ft.create(t,s)}}})]}});class nn extends De{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return nn.valid(r)?new nn(r):De.near(r)}content(){return Ce.empty}eq(e){return e instanceof nn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new nn(e.resolve(n.pos))}getBookmark(){return new Wg(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!fj(e)||!pj(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&nn.valid(e))return e;let o=e.pos,s=null;for(let a=e.depth;;a--){let l=e.node(a);if(n>0?e.indexAfter(a)<l.childCount:e.index(a)>0){s=l.child(n>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;o+=n;let u=e.doc.resolve(o);if(nn.valid(u))return u}for(;;){let a=n>0?s.firstChild:s.lastChild;if(!a){if(s.isAtom&&!s.isText&&!Le.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=a,o+=n;let l=e.doc.resolve(o);if(nn.valid(l))return l}return null}}}nn.prototype.visible=!1,nn.findFrom=nn.findGapCursorFrom,De.jsonID("gapcursor",nn);class Wg{constructor(e){this.pos=e}map(e){return new Wg(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return nn.valid(n)?new nn(n):De.near(n)}}function fj(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function pj(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function hj(){return new tt({props:{decorations:vj,createSelectionBetween(t,e,n){return e.pos==n.pos&&nn.valid(n)?new nn(n):null},handleClick:gj,handleKeyDown:mj,handleDOMEvents:{beforeinput:bj}}})}const mj=$m({ArrowLeft:vp("horiz",-1),ArrowRight:vp("horiz",1),ArrowUp:vp("vert",-1),ArrowDown:vp("vert",1)});function vp(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let a=r.selection,l=e>0?a.$to:a.$from,u=a.empty;if(a instanceof Te){if(!s.endOfTextblock(n)||l.depth==0)return!1;u=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=nn.findGapCursorFrom(l,e,u);return c?(o&&o(r.tr.setSelection(new nn(c))),!0):!1}}function gj(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!nn.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Le.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new nn(r))),!0)}function bj(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof nn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=de.empty;for(let a=r.length-1;a>=0;a--)o=de.from(r[a].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new Ce(o,0,0));return s.setSelection(Te.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function vj(t){if(!(t.selection instanceof nn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ft.create(t.doc,[jt.widget(t.selection.head,e,{key:"gapcursor"})])}const yj=Ze.create({name:"gapCursor",addProseMirrorPlugins(){return[hj()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=at(Ie(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),P8=Bt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",bt(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
287
|
+
3. "-" cannot repeat`);qt.customSchemes.push([t,e])}function DW(){qt.scanner=AW(qt.customSchemes);for(let t=0;t<qt.tokenQueue.length;t++)qt.tokenQueue[t][1]({scanner:qt.scanner});qt.parser=BW(qt.scanner.tokens);for(let t=0;t<qt.pluginQueue.length;t++)qt.pluginQueue[t][1]({scanner:qt.scanner,parser:qt.parser});return qt.initialized=!0,qt}function Dg(t){return qt.initialized||DW(),IW(qt.parser.start,t,y8(qt.scanner.start,t))}Dg.scan=y8;function _8(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Lg(n),o=Dg(t),s=[];for(let a=0;a<o.length;a++){const l=o[a];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}function VW(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function FW(t){return new tt({key:new kt("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(c=>c.docChanged)&&!n.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!o||s)return;const{tr:a}=r,l=EO(n.doc,[...e]);if(TO(l).forEach(({newRange:c})=>{const f=u4(r.doc,c,g=>g.isTextblock);let p,m;if(f.length>1?(p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(p=f[0],m=r.doc.textBetween(p.pos,c.to,void 0," ")),p&&m){const g=m.split(" ").filter(x=>x!=="");if(g.length<=0)return!1;const b=g[g.length-1],y=p.pos+m.lastIndexOf(b);if(!b)return!1;const w=Dg(b).map(x=>x.toObject(t.defaultProtocol));if(!VW(w))return!1;w.filter(x=>x.isLink).map(x=>({...x,from:y+x.start+1,to:y+x.end+1})).filter(x=>r.schema.marks.code?!r.doc.rangeHasMark(x.from,x.to,r.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{Nm(x.from,x.to,r.doc).some(E=>E.mark.type===t.type)||a.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!a.steps.length)return a}})}function $W(t){return new tt({key:new kt("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let a=r.target;const l=[];for(;a.nodeName!=="DIV";)l.push(a),a=a.parentNode;if(!l.find(m=>m.nodeName==="A"))return!1;const u=f4(e.state,t.type.name),c=r.target,f=(o=c==null?void 0:c.href)!==null&&o!==void 0?o:u.href,p=(s=c==null?void 0:c.target)!==null&&s!==void 0?s:u.target;return c&&f?(window.open(f,p),!0):!1}}})}function zW(t){return new tt({key:new kt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:s}=o,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const u=_8(l,{defaultProtocol:t.defaultProtocol}).find(c=>c.isLink&&c.value===l);return!l||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}const HW=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function aa(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(HW,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const UW=Dn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){S8(t);return}S8(t.scheme,t.optionalSlashes)})},onDestroy(){PW()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!aa(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!aa(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!aa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!aa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!aa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[ji({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=_8(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:a=>!!aa(a,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(FW({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!aa(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push($W({type:this.type})),this.options.linkOnPaste&&t.push(zW({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),WW={class:"flex w-full max-w-sm items-center gap-1.5"},jW={class:"relative w-full max-w-sm items-center"},qW={class:"flex w-full max-w-sm items-center gap-1.5"},KW={class:"relative w-full max-w-sm items-center"},GW={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2"},T8=i.defineComponent({__name:"LinkEditBlock",props:{editor:{}},emits:["onSetLink","onClickOutside"],setup(t,{emit:e}){const n=t,r=e,{t:o}=Ot();let s=i.reactive({text:"",link:""});const a=i.ref(null),{focused:l}=ht.useFocus(a),u=i.ref(!0),c=i.ref(null);ht.onClickOutside(c,m=>r("onClickOutside",m)),i.watchEffect(()=>{const{href:m,target:g}=n.editor.getAttributes("link"),{from:b,to:y}=n.editor.state.selection,w=n.editor.state.doc.textBetween(b,y," ");s={link:m,text:w}});function f(){const m=p(s.link);r("onSetLink",m,s.text,u.value)}function p(m){if(!m)return m;const g=m.trim();return/^https?:\/\//i.test(g)||/^[a-zA-Z][a-zA-Z0-9+.\-]*:/i.test(g)?g:"http://"+g}return i.onMounted(()=>{l.value=!0}),(m,g)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"target",ref:c,class:"p-2 bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800"},[i.createElementVNode("form",{class:"flex flex-col gap-2",onSubmit:i.withModifiers(f,["prevent"])},[i.createVNode(i.unref(Ef),null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.link.dialog.text")),1)]),_:1}),i.createElementVNode("div",WW,[i.createElementVNode("div",jW,[i.createVNode(i.unref(hl),{modelValue:i.unref(s).text,"onUpdate:modelValue":g[0]||(g[0]=b=>i.unref(s).text=b),type:"text",required:"",placeholder:"텍스트"},null,8,["modelValue"])])]),i.createVNode(i.unref(Ef),null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.link.dialog.link")),1)]),_:1}),i.createElementVNode("div",qW,[i.createElementVNode("div",KW,[i.createVNode(i.unref(hl),{ref_key:"inputRef",ref:a,modelValue:i.unref(s).link,"onUpdate:modelValue":g[1]||(g[1]=b=>i.unref(s).link=b),type:"text",required:"",class:"pl-10"},null,8,["modelValue"]),i.createElementVNode("span",GW,[i.createVNode(i.unref(Lt),{class:"size-5 text-ed-muted-foreground",name:"Link"})])])]),i.createVNode(i.unref(yn),{class:"mt-2 self-end"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.link.dialog.button.apply")),1)]),_:1})],32)],512))}}),XW=i.defineComponent({__name:"LinkEditPopover",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},isActive:{type:Function,default:void 0},action:{type:Function,default:void 0}},setup(t){const e=t;function n(r,o,s){e.action&&e.action({link:r,text:o,openInNewTab:s})}return(r,o)=>(i.openBlock(),i.createBlock(i.unref(fl),null,{default:i.withCtx(({open:s})=>[i.createVNode(i.unref(ml),{disabled:r.disabled},{default:i.withCtx(()=>[i.createVNode(Ke,{icon:r.icon,tooltip:r.tooltip,"is-active":r.isActive,"is-pressed":s,disabled:r.disabled},null,8,["icon","tooltip","is-active","is-pressed","disabled"])]),_:2},1032,["disabled"]),i.createVNode(i.unref(pl),{"as-child":"",class:"w-80",align:"start",side:"bottom"},{default:i.withCtx(()=>[i.createVNode(T8,{editor:r.editor,onOnSetLink:n},null,8,["editor"])]),_:1})]),_:1}))}}),Vg=UW.extend({inclusive:!1,parseHTML(){return[{tag:'a[href]:not([data-type="button"]):not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:t}){return["a",bt(this.options.HTMLAttributes,t,{class:"link"}),0]},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),openOnClick:!0,button:({editor:e,t:n})=>({component:XW,componentProps:{action:r=>{const{link:o,text:s,openInNewTab:a}=r;e.chain().extendMarkRange("link").insertContent({type:"text",text:s,marks:[{type:"link",attrs:{href:o,target:a?"_blank":""}}]}).setLink({href:o}).focus().run()},isActive:()=>e.isActive("link")||!1,disabled:!e.can().setLink({href:""}),icon:"Link",tooltip:n("editor.link.tooltip")}})}},addProseMirrorPlugins(){return[new tt({props:{handleClick:(t,e)=>{const{schema:n,doc:r,tr:o}=t.state,s=vd(r.resolve(e),n.marks.link);if(!s)return!1;const a=r.resolve(s.from),l=r.resolve(s.to),u=o.setSelection(new Te(a,l));t.dispatch(u)}}})]}}),YW=Bt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",bt(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:o}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name}):p4(n)?s.insertContentAt(o.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:a,dispatch:l})=>{var u;if(l){const{$to:c}=a.selection,f=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?a.setSelection(Te.create(a.doc,c.pos+1)):c.nodeAfter.isBlock?a.setSelection(Le.create(a.doc,c.pos)):a.setSelection(Te.create(a.doc,c.pos));else{const p=(u=c.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();p&&(a.insert(f,p),a.setSelection(Te.create(a.doc,f+1)))}a.scrollIntoView()}return!0}).run()}}},addInputRules(){return[g4({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}).extend({renderHTML(){return["div",bt(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,t:n})=>({component:Ke,componentProps:{action:()=>e.commands.setHorizontalRule(),disabled:!e.can().setHorizontalRule(),icon:"Minus",shortcutKeys:["mod","alt","S"],tooltip:n("editor.horizontalrule.tooltip")}})}},addKeyboardShortcuts(){return{"Mod-Alt-s":()=>this.editor.commands.setHorizontalRule()}}});var gp=200,xn=function(){};xn.prototype.append=function(e){return e.length?(e=xn.from(e),!this.length&&e||e.length<gp&&this.leafAppend(e)||this.length<gp&&e.leafPrepend(this)||this.appendInner(e)):this},xn.prototype.prepend=function(e){return e.length?xn.from(e).append(this):this},xn.prototype.appendInner=function(e){return new JW(this,e)},xn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?xn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},xn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},xn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)},xn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,a){return o.push(e(s,a))},n,r),o},xn.from=function(e){return e instanceof xn?e:e&&e.length?new A8(e):xn.empty};var A8=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,a,l){for(var u=s;u<a;u++)if(o(this.values[u],l+u)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,a,l){for(var u=s-1;u>=a;u--)if(o(this.values[u],l+u)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=gp)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=gp)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(xn);xn.empty=new A8([]);var JW=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,a){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(s,l),a)===!1||s>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,s)-l,a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,a){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(s,l)-l,a+l)===!1||s<l&&this.left.forEachInvertedInner(r,Math.min(o,l),s,a)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(xn);const ZW=500;class po{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,s;n&&(o=this.remapping(r,this.items.length),s=o.maps.length);let a=e.tr,l,u,c=[],f=[];return this.items.forEach((p,m)=>{if(!p.step){o||(o=this.remapping(r,m+1),s=o.maps.length),s--,f.push(p);return}if(o){f.push(new Uo(p.map));let g=p.step.map(o.slice(s)),b;g&&a.maybeStep(g).doc&&(b=a.mapping.maps[a.mapping.maps.length-1],c.push(new Uo(b,void 0,void 0,c.length+f.length))),s--,b&&o.appendMap(b,s)}else a.maybeStep(p.step);if(p.selection)return l=o?p.selection.map(o.slice(s)):p.selection,u=new po(this.items.slice(0,r).append(f.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:a,selection:l}}addTransform(e,n,r,o){let s=[],a=this.eventCount,l=this.items,u=!o&&l.length?l.get(l.length-1):null;for(let f=0;f<e.steps.length;f++){let p=e.steps[f].invert(e.docs[f]),m=new Uo(e.mapping.maps[f],p,n),g;(g=u&&u.merge(m))&&(m=g,f?s.pop():l=l.slice(0,l.length-1)),s.push(m),n&&(a++,n=void 0),o||(u=m)}let c=a-r.depth;return c>NW&&(l=QW(l,c),a-=c),new po(l.append(s),a)}remapping(e,n){let r=new Nl;return this.items.forEach((o,s)=>{let a=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,a)},e,n),r}addMaps(e){return this.eventCount==0?this:new po(this.items.append(e.map(n=>new Uo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),s=e.mapping,a=e.steps.length,l=this.eventCount;this.items.forEach(m=>{m.selection&&l--},o);let u=n;this.items.forEach(m=>{let g=s.getMirror(--u);if(g==null)return;a=Math.min(a,g);let b=s.maps[g];if(m.step){let y=e.steps[g].invert(e.docs[g]),w=m.selection&&m.selection.map(s.slice(u+1,g));w&&l++,r.push(new Uo(b,y,w))}else r.push(new Uo(b))},o);let c=[];for(let m=n;m<a;m++)c.push(new Uo(s.maps[m]));let f=this.items.slice(0,o).append(c).append(r),p=new po(f,l);return p.emptyItemCount()>ZW&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],s=0;return this.items.forEach((a,l)=>{if(l>=e)o.push(a),a.selection&&s++;else if(a.step){let u=a.step.map(n.slice(r)),c=u&&u.getMap();if(r--,c&&n.appendMap(c,r),u){let f=a.selection&&a.selection.map(n.slice(r));f&&s++;let p=new Uo(c.invert(),u,f),m,g=o.length-1;(m=o.length&&o[g].merge(p))?o[g]=m:o.push(p)}}else a.map&&r--},this.items.length,0),new po(xn.from(o.reverse()),s)}}po.empty=new po(xn.empty,0);function QW(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}class Uo{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Uo(n.getMap().invert(),n,this.selection)}}}class ls{constructor(e,n,r,o,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const NW=20;function ej(t,e,n,r){let o=n.getMeta(la),s;if(o)return o.historyState;n.getMeta(rj)&&(t=new ls(t.done,t.undone,null,0,-1));let a=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(a&&a.getMeta(la))return a.getMeta(la).redo?new ls(t.done.addTransform(n,void 0,r,bp(e)),t.undone,O8(n.mapping.maps),t.prevTime,t.prevComposition):new ls(t.done,t.undone.addTransform(n,void 0,r,bp(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),u=t.prevTime==0||!a&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!tj(n,t.prevRanges)),c=a?Fg(t.prevRanges,n.mapping):O8(n.mapping.maps);return new ls(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,bp(e)),po.empty,c,n.time,l??t.prevComposition)}else return(s=n.getMeta("rebased"))?new ls(t.done.rebased(n,s),t.undone.rebased(n,s),Fg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new ls(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Fg(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function tj(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(n=!0)}),n}function O8(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,s,a)=>e.push(s,a));return e}function Fg(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),s=e.map(t[r+1],-1);o<=s&&n.push(o,s)}return n}function nj(t,e,n){let r=bp(e),o=la.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let a=s.selection.resolve(s.transform.doc),l=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),u=new ls(n?l:s.remaining,n?s.remaining:l,null,0,-1);return s.transform.setSelection(a).setMeta(la,{redo:n,historyState:u})}let $g=!1,M8=null;function bp(t){let e=t.plugins;if(M8!=e){$g=!1,M8=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){$g=!0;break}}return $g}const la=new kt("history"),rj=new kt("closeHistory");function oj(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new tt({key:la,state:{init(){return new ls(po.empty,po.empty,null,0,-1)},apply(e,n,r){return ej(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?I8:r=="historyRedo"?R8:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function B8(t,e){return(n,r)=>{let o=la.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let s=nj(o,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const I8=B8(!1,!0),R8=B8(!0,!0),ij=Ze.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>I8(t,e),redo:()=>({state:t,dispatch:e})=>R8(t,e)}},addProseMirrorPlugins(){return[oj(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),L8={HISTORY_TRANSACTION:"history$",ADD_TO_HISTORY_TRANSACTION:"addToHistory"},zg=ij.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),depth:10,button:({editor:e,t:n})=>["undo","redo"].map(o=>({component:Ke,componentProps:{action:()=>{o==="undo"&&e.commands.undo(),o==="redo"&&e.commands.redo()},shortcutKeys:o==="undo"?["mod","Z"]:["shift","mod","Z"],disabled:!e.can()[o](),icon:o==="undo"?"Undo2":"Redo2",tooltip:n(`editor.${o}.tooltip`)}}))}}}),{isFullscreen:Hg,toggleFullscreen:Ug}=wn(),sj=Ze.create({name:"fullscreen",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{tooltip:Hg.value?r("editor.fullscreen.tooltip.exit"):r("editor.fullscreen.tooltip.fullscreen"),action:()=>Ug(),icon:Hg.value?"Minimize":"Maximize",isActive:()=>Hg.value}})}},addKeyboardShortcuts(){return{F11:()=>(Ug(),!0),"Mod-F11":()=>(Ug(),!0)}}}),aj=Ze.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc;if(((t==null?void 0:t.mode)||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=(t==null?void 0:t.node)||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new tt({key:new kt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const o=this.options.limit;if(o==null||o===0){t=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const a=s-o,l=0,u=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(l,u);return t=!0,c}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:n.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,u=s-r,c=l-u,f=l;return e.deleteRange(c,f),!(this.storage.characters({node:e.doc})>r)}})]}});function lj(t={}){return new tt({view(e){return new uj(e,t)}})}class uj{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=a=>{this[o](a)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let l=e.nodeBefore,u=e.nodeAfter;if(l||u){let c=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(c){let f=c.getBoundingClientRect(),p=l?f.bottom:f.top;l&&u&&(p=(p+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:f.left,right:f.right,top:p-this.width/2,bottom:p+this.width/2}}}}if(!r){let l=this.editorView.coordsAtPos(this.cursorPos);r={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let s,a;if(!o||o==document.body&&getComputedStyle(o).position=="static")s=-pageXOffset,a=-pageYOffset;else{let l=o.getBoundingClientRect();s=l.left-o.scrollLeft,a=l.top-o.scrollTop}this.element.style.left=r.left-s+"px",this.element.style.top=r.top-a+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!s){let a=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=uy(this.editorView.state.doc,a,this.editorView.dragging.slice);l!=null&&(a=l)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const cj=Ze.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[lj(this.options)]}}),dj=Ze.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new tt({key:new kt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!n||!r)return ft.create(t,[]);let a=0;this.options.mode==="deepest"&&t.descendants((u,c)=>{if(u.isText)return;if(!(o>=c&&o<=c+u.nodeSize-1))return!1;a+=1});let l=0;return t.descendants((u,c)=>{if(u.isText||!(o>=c&&o<=c+u.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&a-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";s.push(jt.node(c,c+u.nodeSize,{class:this.options.className}))}),ft.create(t,s)}}})]}});class nn extends Ve{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return nn.valid(r)?new nn(r):Ve.near(r)}content(){return Ce.empty}eq(e){return e instanceof nn&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new nn(e.resolve(n.pos))}getBookmark(){return new Wg(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!fj(e)||!pj(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&nn.valid(e))return e;let o=e.pos,s=null;for(let a=e.depth;;a--){let l=e.node(a);if(n>0?e.indexAfter(a)<l.childCount:e.index(a)>0){s=l.child(n>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;o+=n;let u=e.doc.resolve(o);if(nn.valid(u))return u}for(;;){let a=n>0?s.firstChild:s.lastChild;if(!a){if(s.isAtom&&!s.isText&&!Le.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*n),r=!1;continue e}break}s=a,o+=n;let l=e.doc.resolve(o);if(nn.valid(l))return l}return null}}}nn.prototype.visible=!1,nn.findFrom=nn.findGapCursorFrom,Ve.jsonID("gapcursor",nn);class Wg{constructor(e){this.pos=e}map(e){return new Wg(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return nn.valid(n)?new nn(n):Ve.near(n)}}function fj(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function pj(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function hj(){return new tt({props:{decorations:vj,createSelectionBetween(t,e,n){return e.pos==n.pos&&nn.valid(n)?new nn(n):null},handleClick:gj,handleKeyDown:mj,handleDOMEvents:{beforeinput:bj}}})}const mj=$m({ArrowLeft:vp("horiz",-1),ArrowRight:vp("horiz",1),ArrowUp:vp("vert",-1),ArrowDown:vp("vert",1)});function vp(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let a=r.selection,l=e>0?a.$to:a.$from,u=a.empty;if(a instanceof Te){if(!s.endOfTextblock(n)||l.depth==0)return!1;u=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=nn.findGapCursorFrom(l,e,u);return c?(o&&o(r.tr.setSelection(new nn(c))),!0):!1}}function gj(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!nn.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Le.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new nn(r))),!0)}function bj(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof nn))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=de.empty;for(let a=r.length-1;a>=0;a--)o=de.from(r[a].createAndFill(null,o));let s=t.state.tr.replace(n.pos,n.pos,new Ce(o,0,0));return s.setSelection(Te.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function vj(t){if(!(t.selection instanceof nn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ft.create(t.doc,[jt.widget(t.selection.head,e,{key:"gapcursor"})])}const yj=Ze.create({name:"gapCursor",addProseMirrorPlugins(){return[hj()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=at(Ie(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),P8=Bt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",bt(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
288
288
|
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:o,storedMarks:s}=n;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:l}=r.extensionManager,u=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:f})=>{if(f&&u&&a){const p=u.filter(m=>l.includes(m.type.name));c.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),wj=Bt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",bt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),D8=Bt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),V8=Ze.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new tt({key:new kt("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const s=this.editor.isEmpty;return t.descendants((a,l)=>{const u=r>=l&&r<=l+a.nodeSize,c=!a.isLeaf&&kd(a);if((u||!this.options.showOnlyCurrent)&&c){const f=[this.options.emptyNodeClass];s&&f.push(this.options.emptyEditorClass);const p=jt.node(l,l+a.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:l,hasAnchor:u}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),ft.create(t,o)}}})]}}),F8=Bt.create({name:"text",group:"inline"}),$8=Bt.create({name:"doc",topNode:!0,content:"block+"}),z8=$8.extend({content(){var e;return!!((e=this.editor)!=null&&e.options.extensions.find(n=>n.name==="columns"))?"(block|columns)+":"block+"}}),xj=Ze.create({name:"selection",addProseMirrorPlugins(){const{editor:t}=this;return[new tt({key:new kt("selection"),props:{decorations(e){return e.selection.empty?null:ft.create(e.doc,[jt.inline(e.selection.from,e.selection.to,{class:"selection"})])}}})]}}),Cj=t=>{const e=["size-small","size-medium","size-large"],n=["SizeS","SizeM","SizeL"];return e.map((r,o)=>({type:`video-${r}`,component:Ke,componentProps:{tooltip:`editor.${r.replace("-",".")}.tooltip`,icon:n[o],action:()=>t.commands.updateVideo({width:Pd[r]}),isActive:()=>t.isActive("video",{width:Pd[r]})}}))},Ej=t=>[...Cj(t),{type:"remove",component:Ke,componentProps:{tooltip:"editor.remove",icon:"Trash2",action:()=>{const{state:e,dispatch:n}=t.view;pu(e,n)}}}],kj=(t,e,{editor:n,extension:r,t:o})=>{const{extensions:s=[]}=n.extensionManager,a={};for(const l of Object.keys(t)){const u=t[l];if(!u)continue;const c=[];for(const m of u){if(m==="divider"){const y=c[c.length-1];if((y==null?void 0:y.type)==="divider")continue;c.push({type:"divider",component:void 0,componentProps:{}});continue}const g=e.find(y=>y.type===m);if(g){c.push({...g,componentProps:{...g.componentProps,tooltip:g.componentProps.tooltip?o(g.componentProps.tooltip):void 0},componentSlots:g.componentSlots});continue}const b=s.find(y=>y.name===m);if(b){const{button:y}=b.options,w=y({editor:n,extension:b,t:o});c.push({type:m,component:w.component,componentProps:w.componentProps,componentSlots:w.componentSlots});continue}}const f=c[c.length-1],p=c[0];(f==null?void 0:f.type)==="divider"&&c.pop(),(p==null?void 0:p.type)==="divider"&&c.shift(),a[l]=c}return a},Sj=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),_j=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var jg;const Tj=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Aj=(jg=String.fromCodePoint)!==null&&jg!==void 0?jg:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function Oj(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=Tj.get(t))!==null&&e!==void 0?e:t}var Cn;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Cn||(Cn={}));const Mj=32;var us;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(us||(us={}));function qg(t){return t>=Cn.ZERO&&t<=Cn.NINE}function Bj(t){return t>=Cn.UPPER_A&&t<=Cn.UPPER_F||t>=Cn.LOWER_A&&t<=Cn.LOWER_F}function Ij(t){return t>=Cn.UPPER_A&&t<=Cn.UPPER_Z||t>=Cn.LOWER_A&&t<=Cn.LOWER_Z||qg(t)}function Rj(t){return t===Cn.EQUALS||Ij(t)}var En;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(En||(En={}));var cs;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(cs||(cs={}));class Lj{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=En.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=cs.Strict}startEntity(e){this.decodeMode=e,this.state=En.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case En.EntityStart:return e.charCodeAt(n)===Cn.NUM?(this.state=En.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=En.NamedEntity,this.stateNamedEntity(e,n));case En.NumericStart:return this.stateNumericStart(e,n);case En.NumericDecimal:return this.stateNumericDecimal(e,n);case En.NumericHex:return this.stateNumericHex(e,n);case En.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|Mj)===Cn.LOWER_X?(this.state=En.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=En.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,o){if(n!==r){const s=r-n;this.result=this.result*Math.pow(o,s)+Number.parseInt(e.substr(n,s),o),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const o=e.charCodeAt(n);if(qg(o)||Bj(o))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(o,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const o=e.charCodeAt(n);if(qg(o))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(o,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Cn.SEMI)this.consumed+=1;else if(this.decodeMode===cs.Strict)return 0;return this.emitCodePoint(Oj(this.result),this.consumed),this.errors&&(e!==Cn.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let o=r[this.treeIndex],s=(o&us.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const a=e.charCodeAt(n);if(this.treeIndex=Pj(r,o,this.treeIndex+Math.max(1,s),a),this.treeIndex<0)return this.result===0||this.decodeMode===cs.Attribute&&(s===0||Rj(a))?0:this.emitNotTerminatedNamedEntity();if(o=r[this.treeIndex],s=(o&us.VALUE_LENGTH)>>14,s!==0){if(a===Cn.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==cs.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,o=(r[n]&us.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,o,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:o}=this;return this.emitCodePoint(n===1?o[e]&~us.VALUE_LENGTH:o[e+1],r),n===3&&this.emitCodePoint(o[e+2],r),r}end(){var e;switch(this.state){case En.NamedEntity:return this.result!==0&&(this.decodeMode!==cs.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case En.NumericDecimal:return this.emitNumericEntity(0,2);case En.NumericHex:return this.emitNumericEntity(0,3);case En.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case En.EntityStart:return 0}}}function H8(t){let e="";const n=new Lj(t,r=>e+=Aj(r));return function(o,s){let a=0,l=0;for(;(l=o.indexOf("&",l))>=0;){e+=o.slice(a,l),n.startEntity(s);const c=n.write(o,l+1);if(c<0){a=l+n.end();break}a=l+c,l=c===0?a+1:a}const u=e+o.slice(a);return e="",u}}function Pj(t,e,n,r){const o=(e&us.BRANCH_LENGTH)>>7,s=e&us.JUMP_TABLE;if(o===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=o?-1:t[n+u]-1}let a=n,l=a+o-1;for(;a<=l;){const u=a+l>>>1,c=t[u];if(c<r)a=u+1;else if(c>r)l=u-1;else return t[u+o]}return-1}const Dj=H8(Sj);H8(_j);function Vj(t,e=cs.Legacy){return Dj(t,e)}var Nt;(function(t){t.Attribute="attribute",t.Pseudo="pseudo",t.PseudoElement="pseudo-element",t.Tag="tag",t.Universal="universal",t.Adjacent="adjacent",t.Child="child",t.Descendant="descendant",t.Parent="parent",t.Sibling="sibling",t.ColumnCombinator="column-combinator"})(Nt||(Nt={}));var Wr;(function(t){t.Any="any",t.Element="element",t.End="end",t.Equals="equals",t.Exists="exists",t.Hyphen="hyphen",t.Not="not",t.Start="start"})(Wr||(Wr={}));const U8=/^[^\\#]?(?:\\(?:[\da-f]{1,6}\s?|.)|[\w\-\u00b0-\uFFFF])+/,Fj=/\\([\da-f]{1,6}\s?|(\s)|.)/gi,$j=new Map([[126,Wr.Element],[94,Wr.Start],[36,Wr.End],[42,Wr.Any],[33,Wr.Not],[124,Wr.Hyphen]]),zj=new Set(["has","not","matches","is","where","host","host-context"]);function Hj(t){switch(t.type){case Nt.Adjacent:case Nt.Child:case Nt.Descendant:case Nt.Parent:case Nt.Sibling:case Nt.ColumnCombinator:return!0;default:return!1}}const Uj=new Set(["contains","icontains"]);function Wj(t,e,n){const r=parseInt(e,16)-65536;return r!==r||n?e:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)}function cc(t){return t.replace(Fj,Wj)}function Kg(t){return t===39||t===34}function W8(t){return t===32||t===9||t===10||t===12||t===13}function jj(t){const e=[],n=j8(e,`${t}`,0);if(n<t.length)throw new Error(`Unmatched selector: ${t.slice(n)}`);return e}function j8(t,e,n){let r=[];function o(m){const g=e.slice(n+m).match(U8);if(!g)throw new Error(`Expected name, found ${e.slice(n)}`);const[b]=g;return n+=m+b.length,cc(b)}function s(m){for(n+=m;n<e.length&&W8(e.charCodeAt(n));)n++}function a(){n+=1;const m=n;let g=1;for(;g>0&&n<e.length;n++)e.charCodeAt(n)===40&&!l(n)?g++:e.charCodeAt(n)===41&&!l(n)&&g--;if(g)throw new Error("Parenthesis not matched");return cc(e.slice(m,n-1))}function l(m){let g=0;for(;e.charCodeAt(--m)===92;)g++;return(g&1)===1}function u(){if(r.length>0&&Hj(r[r.length-1]))throw new Error("Did not expect successive traversals.")}function c(m){if(r.length>0&&r[r.length-1].type===Nt.Descendant){r[r.length-1].type=m;return}u(),r.push({type:m})}function f(m,g){r.push({type:Nt.Attribute,name:m,action:g,value:o(1),namespace:null,ignoreCase:"quirks"})}function p(){if(r.length&&r[r.length-1].type===Nt.Descendant&&r.pop(),r.length===0)throw new Error("Empty sub-selector");t.push(r)}if(s(0),e.length===n)return n;e:for(;n<e.length;){const m=e.charCodeAt(n);switch(m){case 32:case 9:case 10:case 12:case 13:{(r.length===0||r[0].type!==Nt.Descendant)&&(u(),r.push({type:Nt.Descendant})),s(1);break}case 62:{c(Nt.Child),s(1);break}case 60:{c(Nt.Parent),s(1);break}case 126:{c(Nt.Sibling),s(1);break}case 43:{c(Nt.Adjacent),s(1);break}case 46:{f("class",Wr.Element);break}case 35:{f("id",Wr.Equals);break}case 91:{s(1);let g,b=null;e.charCodeAt(n)===124?g=o(1):e.startsWith("*|",n)?(b="*",g=o(2)):(g=o(0),e.charCodeAt(n)===124&&e.charCodeAt(n+1)!==61&&(b=g,g=o(1))),s(0);let y=Wr.Exists;const w=$j.get(e.charCodeAt(n));if(w){if(y=w,e.charCodeAt(n+1)!==61)throw new Error("Expected `=`");s(2)}else e.charCodeAt(n)===61&&(y=Wr.Equals,s(1));let x="",E=null;if(y!=="exists"){if(Kg(e.charCodeAt(n))){const _=e.charCodeAt(n);let A=n+1;for(;A<e.length&&(e.charCodeAt(A)!==_||l(A));)A+=1;if(e.charCodeAt(A)!==_)throw new Error("Attribute value didn't end");x=cc(e.slice(n+1,A)),n=A+1}else{const _=n;for(;n<e.length&&(!W8(e.charCodeAt(n))&&e.charCodeAt(n)!==93||l(n));)n+=1;x=cc(e.slice(_,n))}s(0);const C=e.charCodeAt(n)|32;C===115?(E=!1,s(1)):C===105&&(E=!0,s(1))}if(e.charCodeAt(n)!==93)throw new Error("Attribute selector didn't terminate");n+=1;const k={type:Nt.Attribute,name:g,action:y,value:x,namespace:b,ignoreCase:E};r.push(k);break}case 58:{if(e.charCodeAt(n+1)===58){r.push({type:Nt.PseudoElement,name:o(2).toLowerCase(),data:e.charCodeAt(n)===40?a():null});continue}const g=o(1).toLowerCase();let b=null;if(e.charCodeAt(n)===40)if(zj.has(g)){if(Kg(e.charCodeAt(n+1)))throw new Error(`Pseudo-selector ${g} cannot be quoted`);if(b=[],n=j8(b,e,n+1),e.charCodeAt(n)!==41)throw new Error(`Missing closing parenthesis in :${g} (${e})`);n+=1}else{if(b=a(),Uj.has(g)){const y=b.charCodeAt(0);y===b.charCodeAt(b.length-1)&&Kg(y)&&(b=b.slice(1,-1))}b=cc(b)}r.push({type:Nt.Pseudo,name:g,data:b});break}case 44:{p(),r=[],s(1);break}default:{if(e.startsWith("/*",n)){const y=e.indexOf("*/",n+2);if(y<0)throw new Error("Comment was not terminated");n=y+2,r.length===0&&s(0);break}let g=null,b;if(m===42)n+=1,b="*";else if(m===124){if(b="",e.charCodeAt(n+1)===124){c(Nt.ColumnCombinator),s(2);break}}else if(U8.test(e.slice(n)))b=o(0);else break e;e.charCodeAt(n)===124&&e.charCodeAt(n+1)!==124&&(g=b,e.charCodeAt(n+1)===42?(b="*",n+=2):b=o(1)),r.push(b==="*"?{type:Nt.Universal,namespace:g}:{type:Nt.Tag,name:b,namespace:g})}}}return p(),n}function Gg(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\xA0/g," ").replace(/\xAD/g,"­")}var q8=t=>Vj(t);function qj(t,e,n,r){if(typeof e=="function")return e({props:{...n,children:r},attrs:n,children:r,h:t.h,context:t});{let o=!0,s;if(e?e.toLowerCase()==="fragment"?(s=t.document.createDocumentFragment(),o=!1):s=t.document.createElement(e):s=t.document.createElement("div"),n&&o){const a=s;for(let[l,u]of Object.entries(n)){l=l.toString();const c=l.toLowerCase();c==="classname"?a.className=u:c==="on"?Object.entries(u).forEach(([f,p])=>{a.setAttribute(`on${f}`,String(p))}):u!==!1&&u!=null&&(u===!0?a.setAttribute(l,l):a.setAttribute(l,u.toString()))}}if(r)for(const a of r){const l=Array.isArray(a)?[...a]:[a];for(const u of l)u&&u!==!1&&u!=null&&(typeof u!="object"?s.appendChild(t.document.createTextNode(u.toString())):s.appendChild(u))}return s}}function K8(t,e,...n){return typeof t=="object"&&(t="fragment",n=t.children,e=t.attrs),Array.isArray(e)?(n=[e],e={}):e?e.attrs&&(e={...e.attrs,...e},delete e.attrs):e={},{tag:t,attrs:e,children:typeof n[0]=="string"?n:n.flat(Number.POSITIVE_INFINITY)}}function Kj(t){return t.h=function(n,r,...o){const{tag:s,attrs:a,children:l}=K8(n,r,o);return qj(t,s,a,l)},t.h}var G8={};function Gj(t){let e=G8[t];return e==null&&(e=jj(t),G8[t]=e),e}function Xj(t,e,{debug:n=!1}={}){for(const r of Gj(t)){const o=(s,a)=>{var u,c,f,p;let l=!1;for(const m of a){const{type:g,name:b,action:y,value:w,_ignoreCase:x=!0,data:E}=m;if(g==="attribute")y==="equals"?l=s.getAttribute(b)===w:y==="start"?l=!!((u=s.getAttribute(b))!=null&&u.startsWith(w)):y==="end"?l=!!((c=s.getAttribute(b))!=null&&c.endsWith(w)):y==="element"?b==="class"?l=s.classList.contains(w):l=!!((f=s.getAttribute(b))!=null&&f.includes(w)):y==="exists"?l=s.hasAttribute(b):y==="any"?l=!!((p=s.getAttribute(b))!=null&&p.includes(w)):console.warn("Unknown CSS selector action",y);else if(g==="tag")l=s.tagName===b.toUpperCase();else if(g==="universal")l=!0;else if(g==="pseudo"){if(b==="not"){let k=!0;E.forEach(C=>{o(s,C)||(k=!1)}),l=!k}}else console.warn("Unknown CSS selector type",g,t,a);if(!l)break}return l};if(o(e,r))return!0}return!1}var Yj=Symbol.for("nodejs.util.inspect.custom"),X8={fontWeight:"bold"},Y8={fontStyle:"italic"},J8={backgroundColor:"rgb(255, 250, 165)"},Z8={textDecorations:"underline"},Xg={textDecorations:"line-through"},Jj={b:X8,strong:X8,em:Y8,i:Y8,mark:J8,u:Z8,a:Z8,s:Xg,del:Xg,ins:J8,strike:Xg};function Q8(t){return t.toLowerCase().replace(/[^a-z0-9]+(.)/gi,(e,n)=>n.toUpperCase())}var vi=class jh{constructor(){this.append=this.appendChild,this._parentNode=null,this._childNodes=[]}get nodeType(){return console.error("Subclasses should define nodeType!"),0}get nodeName(){return console.error("Subclasses should define nodeName!"),""}get nodeValue(){return null}cloneNode(e=!1){const n=new this.constructor;return e&&(n._childNodes=this._childNodes.map(r=>r.cloneNode(!0)),n._fixChildNodesParent()),n}_fixChildNodesParent(){this._childNodes.forEach(e=>e._parentNode=this)}insertBefore(e,n){if(e!==n){let r=n?this._childNodes.indexOf(n):0;r<0&&(r=0),this._childNodes.splice(r,0,e),this._fixChildNodesParent()}}appendChild(e){if(e!=null){if(e===this){console.warn("Cannot appendChild to self");return}if(e instanceof Jg&&console.warn("No defined how to append a document to a node!",e),e instanceof Yg)for(const n of[...e._childNodes])this.appendChild(n);else if(Array.isArray(e))for(const n of[...e])this.appendChild(n);else if(e instanceof jh)e.remove(),this._childNodes.push(e);else try{const n=typeof e=="string"?e:JSON.stringify(e,null,2);this._childNodes.push(new Sl(n))}catch(n){console.error(`The data ${e} to be added to ${this.render()} is problematic: ${n}`)}this._fixChildNodesParent()}}removeChild(e){const n=this._childNodes.indexOf(e);n>=0&&(e._parentNode=null,this._childNodes.splice(n,1),this._fixChildNodesParent())}remove(){var e;return(e=this==null?void 0:this.parentNode)==null||e.removeChild(this),this}replaceChildren(...e){this._childNodes=e.map(n=>typeof n=="string"?new Sl(n):n.remove()),this._fixChildNodesParent()}replaceWith(...e){const n=this._parentNode;if(n){const r=this._indexInParent();r>=0&&(e=e.map(o=>typeof o=="string"?new Sl(o):o.remove()),n._childNodes.splice(r,1,...e),this._parentNode=null,n._fixChildNodesParent())}}_indexInParent(){return this._parentNode?this._parentNode.childNodes.indexOf(this):-1}get parentNode(){return this._parentNode}get childNodes(){return this._childNodes||[]}get children(){return this._childNodes||[]}get firstChild(){return this._childNodes[0]}get lastChild(){return this._childNodes[this._childNodes.length-1]}get nextSibling(){const e=this._indexInParent();return e!=null&&this.parentNode.childNodes[e+1]||null}get previousSibling(){const e=this._indexInParent();return e>0&&this.parentNode.childNodes[e-1]||null}flatten(){const e=[];this instanceof ho&&e.push(this);for(const n of this._childNodes)e.push(...n.flatten());return e}flattenNodes(){const e=[];e.push(this);for(const n of this._childNodes)e.push(...n.flattenNodes());return e}render(){return""}get textContent(){return this._childNodes.map(e=>e.textContent).join("")}set textContent(e){this._childNodes=[],e&&this.appendChild(new Sl(e.toString()))}contains(e){return e===this?!0:this._childNodes.some(n=>n.contains(e))}get ownerDocument(){var e;return this.nodeType===jh.DOCUMENT_NODE||this.nodeType===jh.DOCUMENT_FRAGMENT_NODE?this:(e=this==null?void 0:this._parentNode)==null?void 0:e.ownerDocument}toString(){return`${this.nodeName}`}[Yj](){return`${this.constructor.name} "${this.render()}"`}};vi.ELEMENT_NODE=1,vi.TEXT_NODE=3,vi.CDATA_SECTION_NODE=4,vi.PROCESSING_INSTRUCTION_NODE=7,vi.COMMENT_NODE=8,vi.DOCUMENT_NODE=9,vi.DOCUMENT_TYPE_NODE=10,vi.DOCUMENT_FRAGMENT_NODE=11;var ds=vi,Sl=class extends ds{get nodeType(){return ds.TEXT_NODE}get nodeName(){return"#text"}get nodeValue(){return this._text||""}get textContent(){return this.nodeValue}constructor(t=""){super(),this._text=t}render(){var e;const t=(e=this.parentNode)==null?void 0:e.tagName;return t==="SCRIPT"||t==="STYLE"?this._text:Gg(this._text)}cloneNode(t=!1){const e=super.cloneNode(t);return e._text=this._text,e}},N8=class extends ds{getElementById(t){return this.flatten().find(e=>e._attributes.id===t)}getElementsByClassName(t){return this.flatten().filter(e=>e.classList.contains(t))}matches(t){return Xj(t,this)}querySelectorAll(t){return this.flatten().filter(e=>e.matches(t))}querySelector(t){return this.flatten().find(e=>e.matches(t))}parent(t){var e;return this.matches(t)?this:this.parentNode==null?null:(e=this.parentNode)==null?void 0:e.parent(t)}handle(t,e){let n=0;for(const r of this.querySelectorAll(t))e(r,n++)}},ho=class extends N8{get nodeType(){return ds.ELEMENT_NODE}get nodeName(){return this._nodeName}constructor(t="div",e={}){super(),this._originalTagName=t,this._nodeName=(t||"").toUpperCase(),this._attributes=e||{}}cloneNode(t=!1){const e=super.cloneNode(t);return e._originalTagName=this._originalTagName,e._nodeName=this._nodeName,e._attributes=Object.assign({},this._attributes),e}get attributes(){return Object.entries(this._attributes).map(([t,e])=>({name:t,value:e}))}get attributesObject(){return{...this._attributes}}_findAttributeName(t){const e=t.toLowerCase();return Object.keys(this._attributes).find(n=>e===n.toLowerCase())||null}setAttribute(t,e){this.removeAttribute(t),this._attributes[t]=e,this._styles=void 0,this._dataset=void 0}getAttribute(t){const e=this._findAttributeName(t),n=e?this._attributes[e]:null;return n==null?null:typeof n=="string"?n:""}removeAttribute(t){this._findAttributeName(String(t))&&delete this._attributes[t]}hasAttribute(t){const e=this._findAttributeName(t);return e?this._attributes[e]!=null:!1}get style(){if(this._styles==null){const t={};let e=0;const n=this.getAttribute("style");if(n){let r;const o=/\s*([\w-]+)\s*:\s*((url\(.*?\)[^;]*|[^;]+))/gi;for(;r=o.exec(n);){++e;const s=r[1],a=r[2].trim();t[s]=a,t[Q8(s)]=a}}this._styles={get length(){return e},getPropertyValue(r){return t[r]},...Jj[this.tagName.toLowerCase()],...t}}return this._styles}get dataset(){if(this._dataset==null){const t={};for(const[e,n]of Object.entries(this._attributes))e.startsWith("data-")&&(t[e.slice(5)]=n,t[Q8(e.slice(5))]=n);this._dataset=t}return this._dataset}get tagName(){return this._nodeName}setTagName(t){this._nodeName=t.toUpperCase()}get id(){return this._attributes.id||null}set id(t){t==null?delete this._attributes.id:this._attributes.id=t}get src(){return this._attributes.src}set src(t){t==null?delete this._attributes.src:this._attributes.src=t}getElementsByTagName(t){t=t.toUpperCase();const e=this.flatten();return t!=="*"?e.filter(n=>n.tagName===t):e}setInnerHTML(t){}get innerHTML(){return this._childNodes.map(t=>t.render(yp)).join("")}set innerHTML(t){this.setInnerHTML(t)}get outerHTML(){return this.render(wp)}get className(){return this._attributes.class||""}set className(t){Array.isArray(t)?t=t.filter(e=>!!e).join(" "):typeof t=="object"&&(t=Object.entries(t).filter(([e,n])=>!!n).map(([e,n])=>e).join(" ")),this._attributes.class=t}get classList(){const t=String(this.className??"").trim().split(/\s+/g)||[];return{contains(e){return t.includes(e)},add:e=>{t.includes(e)||(t.push(e),this.className=t)},remove:e=>{const n=t.indexOf(e);n>=0&&(t.splice(n,1),this.className=t)}}}render(t=wp){return t(this._originalTagName||this.tagName,this._attributes,this._childNodes.map(e=>e.render(t)).join(""))}},eE=class R_ extends ds{get nodeName(){return super.nodeName}get nodeValue(){return super.nodeValue}get nodeType(){return R_.DOCUMENT_TYPE_NODE}render(){return"<!DOCTYPE html>"}},Yg=class L_ extends N8{get nodeType(){return ds.DOCUMENT_FRAGMENT_NODE}get nodeName(){return"#document-fragment"}render(e=wp){return this._childNodes.map(n=>n.render(e)||[]).join("")}get innerHTML(){return this._childNodes.map(e=>e.render(yp)).join("")}createElement(e,n={}){return new ho(e,n)}createDocumentFragment(){return new L_}createTextNode(e){return new Sl(e)}},Jg=class extends Yg{get nodeType(){return ds.DOCUMENT_NODE}get nodeName(){return"#document"}get documentElement(){return this.firstChild}render(t=wp){let e=super.render(t);return this.docType&&(e=this.docType.render()+e),e}},tE=class extends Jg{constructor(t=!1){if(super(),this.docType=new eE,!t){const e=new ho("html"),n=new ho("body"),r=new ho("head"),o=new ho("title");e.appendChild(r),r.appendChild(o),e.appendChild(n),this.appendChild(e)}}get body(){let t=this.querySelector("body");if(!t){let e=this.querySelector("html");e||(e=new ho("html"),this.appendChild(e)),t=new ho("body"),e.appendChild(e)}return t}get title(){var t;return((t=this.querySelector("title"))==null?void 0:t.textContent)||""}set title(t){const e=this.querySelector("title");e&&(e.textContent=t)}get head(){let t=this.querySelector("head");if(!t){let e=this.querySelector("html");e||(e=new ho("html"),this.appendChild(e)),t=new ho("head"),e.insertBefore(e)}return t}};function Zj(){return new Jg}function Qj(){return new tE}var nE=Zj();Kj({document:nE});var Nj={},eq=Nj.hasOwnProperty;function rE(t,e){return eq.call(t,e)}var oE=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr","command"];function iE(t,e,n={},r){const o=!(typeof r=="string"&&r===""||Array.isArray(r)&&(r.length===0||r.length===1&&r[0]==="")||r==null),s=[];if(e=e.replace(/__/g,":"),e!=="noop"&&e!==""){e!=="cdata"?s.push(`<${e}`):s.push("<![CDATA[");for(let a in n)if(a&&rE(n,a)){const l=n[a];if(a==="html")continue;a.toLowerCase()==="classname"&&(a="class"),a=a.replace(/__/g,":"),l===!0?s.push(` ${a}`):a==="style"&&typeof l=="object"?s.push(` ${a}="${Object.keys(l).filter(u=>l[u]!=null).map(u=>{let c=l[u];return c=typeof c=="number"?`${c}px`:c,`${u.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}:${c}`}).join(";")}"`):l!==!1&&l!=null&&s.push(` ${a}="${Gg(l.toString())}"`)}if(e!=="cdata"){if(t&&!o)return s.push(" />"),s.join("");s.push(">")}if(!t&&oE.includes(e))return s.join("")}if(o){if(typeof r=="string")s.push(r);else if(r&&r.length>0){for(let a of r)if(a!=null&&a!==!1){Array.isArray(a)||(a=[a]);for(const l of a)l.startsWith("<")&&l.endsWith(">")||e==="script"||e==="style"?s.push(l):s.push(Gg(l.toString()))}}}return n.html&&s.push(n.html),e!=="noop"&&e!==""&&(e!=="cdata"?s.push(`</${e}>`):s.push("]]>")),s.join("")}function yp(t,e,...n){const{tag:r,attrs:o,children:s}=K8(t,e,n);return iE(!1,r,o,s)}var wp=iE.bind(null,!1);yp.firstLine="<!DOCTYPE html>",yp.html=!0;var tq=/([^=\s]+)(\s*=\s*(("([^"]*)")|('([^']*)')|[^>\s]+))?/g,nq=/^<\/([^>\s]+)[^>]*>/m,rq=/^<([^>\s/]+)((\s+[^=>\s]+(\s*=\s*(("[^"]*")|('[^']*')|[^>\s]+))?)*)\s*(?:\/\s*)?>/m,oq=/\s*\/\s*>\s*$/m,iq=class{constructor(t={}){this.attrRe=tq,this.endTagRe=nq,this.startTagRe=rq,this.defaults={ignoreWhitespaceText:!1},t.scanner&&(this.scanner=t.scanner),this.options=Object.assign({},this.defaults,t)}parse(t){let e=!1,n,r,o;for(;t.length;){if(t.substring(0,4)==="<!--")n=t.indexOf("-->"),n!==-1?(this.scanner.comment(t.substring(4,n)),t=t.substring(n+3),e=!1):e=!0;else if(t.substring(0,2)==="</")r=this.endTagRe.exec(t),r?(t=RegExp.rightContext,e=!1,this.parseEndTag(RegExp.lastMatch,r[1])):e=!0;else if(t.charAt(0)==="<")if(r=this.startTagRe.exec(t),r){t=RegExp.rightContext,e=!1;const s=this.parseStartTag(RegExp.lastMatch,r[1],r);(s==="script"||s==="style")&&(n=t.search(new RegExp(`</${s}`,"i")),n!==-1?(this.scanner.characters(t.substring(0,n)),t=t.substring(n),e=!1):e=!0)}else e=!0;if(e){n=t.indexOf("<");let s=n;n===0&&(n=t.substring(1).indexOf("<"),s=s+1),n===-1?(o=t,t=""):(o=t.substring(0,s),t=t.substring(s)),(!this.options.ignoreWhitespaceText||!/^\s*$/.test(o))&&this.scanner.characters(o)}e=!0,r=null}}parseStartTag(t,e,n){const r=oq.test(t);let o=n[2];r&&(o=o.replace(/\s*\/\s*$/,""));const s=this.parseAttributes(e,o);return this.scanner.startElement(e,s,r,n[0]),e.toLocaleLowerCase()}parseEndTag(t,e){this.scanner.endElement(e)}parseAttributes(t,e){const n={};return e.replace(this.attrRe,(...r)=>{const[o,s,a,l,u,c,f,p]=r;n[s]=p??c??l??!0}),n}};function sq(t){if(typeof t!="string")throw console.error("parseHTML requires string, found",t),new Error("parseHTML requires string");const e=t.indexOf("<!")===0?new tE(!0):new Yg,n=[e];return new iq({scanner:{startElement(o,s,a){if(o.toLowerCase()==="!doctype"){e.docType=new eE;return}for(const c in s)if(rE(s,c)){const f=s[c];typeof f=="string"&&(s[c]=q8(f))}const u=n[n.length-1];if(u){const c=nE.createElement(o,s);u.appendChild(c),oE.includes(o.toLowerCase())||a||n.push(c)}},endElement(o){n.pop()},characters(o){var a;o=q8(o);const s=n[n.length-1];((a=s==null?void 0:s.lastChild)==null?void 0:a.nodeType)===ds.TEXT_NODE?s.lastChild._text+=o:s&&s.appendChild(new Sl(o))},comment(o){}}}).parse(t),e}ho.prototype.setInnerHTML=function(t){const e=sq(t);this._childNodes=e._childNodes,this._fixChildNodesParent()};function aq(t,e,n){return to.fromSchema(e).serializeFragment(t.content,{document:Qj()}).render()}function lq(t,e){const n=eo.fromJSON(e,t);return aq(n,e)}function uq(t,e){const n=document.getElementById(t.attrs.id)??Zg.getElementById(t.attrs.id);if(!n)return null;const r=sE(n),{lastChild:o}=t,{childCount:s}=t,a=t.content.content.slice(0,s);if(!o)return!1;o.isText&&a.push(e.text("gg"));const l=lq(cq(t.type.create(t.attrs,a,t.marks)),e);return fq(l,t.attrs.id,!1)>r}function cq(t){return{type:"doc",content:[t.toJSON()]}}let dq=null,Zg=null;const Qg=new Map;function fq(t,e,n=!0){if(n&&Qg.has(t))return Qg.get(t);const r=Zg.getElementById("computeddiv");if(r){r.innerHTML=`<p> </p>${t}`;const o=Zg.getElementById(e),{height:s}=sE(o);return r.innerHTML=" ",n&&Qg.set(t,s),s}return 0}function sE(t){const e=window.getComputedStyle(t)||dq.contentWindow.getComputedStyle(t),n=e.getPropertyValue("margin-top"),r=e.getPropertyValue("margin-bottom"),o=parseFloat(n)+parseFloat(r),{height:s}=t.getBoundingClientRect();return{margin:o,height:o+t.offsetHeight+parseFloat(e.borderWidth)}}function Ng(){return pi(10)}const xp="paragraph",jr="page",aE="Extend",_l="Node",pq=_l+aE,hq="CC",eb="heading",Cp="bulletList",tb="listItem",lE="taskList",mq="taskItem",Ep="orderedList",fs="table",nb="tableHeader",rb="tableRow",gq="tableCell",ob="column",ua="columns",ib="textBox",ps="image",hs="imageUpload",bq="iframe",vq="file",sb="codeBlock",ab="blockquote",yq="audio",wq="toc",uE="video",xq="horizontalrule",lb="pagination",Cq=[fs,Ep,Cp,lE],Eq=[uE,ps],dc="link",kq="placeholder",Sq="focus",_q="text",Tq="text-bubble",Aq="gapCursor",Oq="dropCursor",Mq="characterCount",Bq="hardBreak",Iq="textStyle",Rq="selection",cE="superText",ub="configPlan",Lq="fontSize",Pq="fontFamily",Dq="bold",Vq="italic",Fq="underline",$q="strike",zq="color",Hq="highlight",Uq="moreMark",Wq="textAlign",jq="indent",qq="lineHeight",Kq="painter",Gq="clear",fc="spellchecker",dE="fontSizeIncreaseDecrease",Xq=Object.freeze(Object.defineProperty({__proto__:null,AUDIO:yq,BLOCKQUOTE:ab,BOLD:Dq,BULLETLIST:Cp,CASSIE_BLOCK:_l,CASSIE_BLOCK_EXTEND:pq,CC:hq,CHARACTER_COUNT:Mq,CLEAR:Gq,CODE_BLOCK:sb,COLOR:zq,COLUMN:ob,COLUMNS:ua,CONFIG_PLAN:ub,DROP_CURSOR:Oq,EXTEND:aE,FILE:vq,FOCUS:Sq,FONTSIZEINCREASEDECREASE:dE,FONT_FAMILY:Pq,FONT_SIZE:Lq,GAP_CURSOR:Aq,HARD_BREAK:Bq,HEADING:eb,HIGHLIGHT:Hq,HORIZONTALRULE:xq,IFRAME:bq,IMAGE:ps,IMAGE_UPLOAD:hs,INDENT:jq,ITALIC:Vq,LINE_HEIGHT:qq,LINK:dc,LISTITEM:tb,LIST_MEDIA:Eq,LIST_TYPE:Cq,MORE_MARK:Uq,ORDEREDLIST:Ep,PAGE:jr,PAGEBREAK:lb,PAINTER:Kq,PARAGRAPH:xp,PLACEHOLDER:kq,SELECTION:Rq,SPELLCHECKER:fc,STRIKE:$q,SUPER_TEXT:cE,TABLE:fs,TABLEHEADER:nb,TABLE_CELL:gq,TABLE_ROW:rb,TASKITEM:mq,TASKLIST:lE,TEXT:_q,TEXT_ALIGN:Wq,TEXT_BOX:ib,TEXT_BUBBLE:Tq,TEXT_STYLE:Iq,TOC:wq,UNDERLINE:Fq,VIDEO:uE},Symbol.toStringTag,{value:"Module"})),cb=i.defineComponent({__name:"ContextMenu",props:{dir:{},modal:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(WL),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),db=i.defineComponent({__name:"ContextMenuContent",props:{forceMount:{type:Boolean},loop:{type:Boolean},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},sticky:{},hideWhenDetached:{type:Boolean},prioritizePosition:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(qL),null,{default:i.withCtx(()=>[i.createVNode(i.unref(KL),i.mergeProps(i.unref(s),{class:i.unref(ke)("z-50 min-w-32 overflow-hidden rounded-md border bg-ed-popover p-1 text-ed-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),fb=i.defineComponent({__name:"ContextMenuItem",props:{disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{},inset:{type:Boolean}},emits:["select"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(GL),i.mergeProps(i.unref(s),{class:i.unref(ke)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-ed-accent focus:text-ed-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n.inset&&"pl-8",n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"]))}}),pb=i.defineComponent({__name:"ContextMenuTrigger",props:{disabled:{type:Boolean},asChild:{type:Boolean},as:{}},setup(t){const n=Xn(t);return(r,o)=>(i.openBlock(),i.createBlock(i.unref(jL),i.normalizeProps(i.guardReactiveProps(i.unref(n))),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16))}}),kp=i.defineComponent({__name:"Dialog",props:{open:{type:Boolean},defaultOpen:{type:Boolean},modal:{type:Boolean}},emits:["update:open"],setup(t,{emit:e}){const o=It(t,e);return(s,a)=>(i.openBlock(),i.createBlock(i.unref(RR),i.normalizeProps(i.guardReactiveProps(i.unref(o))),{default:i.withCtx(()=>[i.renderSlot(s.$slots,"default")]),_:3},16))}}),Sp=i.defineComponent({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{},class:{},isOverlayTransparent:{type:Boolean}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{isOverlayTransparent:a,class:l,...u}=n;return u}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(Z0),null,{default:i.withCtx(()=>[i.createVNode(i.unref(r1),{class:i.normalizeClass(i.unref(ke)("fixed inset-0 z-[60] bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a.isOverlayTransparent&&"bg-transparent"))},null,8,["class"]),i.createVNode(i.unref(nL),i.mergeProps(i.unref(s),{class:i.unref(ke)("fixed left-1/2 top-1/2 z-[60] grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 border bg-ed-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n.class)}),{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default")]),_:3},16,["class"])]),_:3}))}}),hb=i.defineComponent({__name:"DialogFooter",props:{class:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(ke)("flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-x-2",e.class))},[i.renderSlot(n.$slots,"default")],2))}}),_p=i.defineComponent({__name:"DialogHeader",props:{class:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(ke)("flex flex-col gap-y-1.5 text-center sm:text-left",e.class))},[i.renderSlot(n.$slots,"default")],2))}}),Tp=i.defineComponent({__name:"DialogClose",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(oL),i.normalizeProps(i.guardReactiveProps(e)),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16))}}),Ap=i.defineComponent({__name:"DialogTitle",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(iL),i.mergeProps(i.unref(r),{class:i.unref(ke)("text-lg font-semibold leading-none tracking-tight",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default")]),_:3},16,["class"]))}}),Yq={class:"sr-only"},Jq={class:"m-2.5 p-2.5 space-y-2.5"},Zq=i.defineComponent({__name:"SuperInputDialogAlert",props:{open:{type:Boolean}},emits:["close"],setup(t,{emit:e}){const n=e,{t:r}=Ot(),o=wn(),s=t,a=i.computed(()=>r(o.textAlert.value||"editor.alert")),l=i.reactive({x:0,y:0}),u=i.ref(!1),c={x:0,y:0},f=()=>{n("close")},p=b=>{u.value=!0,c.x=b.clientX-l.x,c.y=b.clientY-l.y,document.addEventListener("mousemove",m),document.addEventListener("mouseup",g)},m=b=>{u.value&&(l.x=b.clientX-c.x,l.y=b.clientY-c.y)},g=()=>{u.value=!1,document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g)};return i.watch(()=>s.open,async b=>{if(b){await i.nextTick();const y=document.querySelector(".draggable-dialog");if(y){const{width:w,height:x}=y.getBoundingClientRect(),E=window.innerWidth,k=window.innerHeight;l.x=(E-w)/2+250,l.y=(k-x)/2-50}}},{immediate:!0}),i.onUnmounted(()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g)}),(b,y)=>{const w=Ap,x=Tp,E=_p,k=hb,C=Sp,_=kp;return i.openBlock(),i.createBlock(_,{open:b.open},{default:i.withCtx(()=>[i.createVNode(i.unref(Z0),null,{default:i.withCtx(()=>[i.createVNode(i.unref(r1),{class:"!pointer-events-none bg-black/30"}),i.createVNode(C,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none","as-child":""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:i.normalizeStyle({transform:`translate(${i.unref(l).x}px, ${i.unref(l).y}px)`,top:"0px",left:"0px"})},[i.createVNode(E,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:i.withModifiers(p,["prevent"])},{default:i.withCtx(()=>[i.createVNode(w,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.alertConfirm")),1)]),_:1}),i.createVNode(x,{class:"absolute right-3 top-3 text-white",onClick:f},{default:i.withCtx(()=>[i.createVNode(i.unref(Ff),{class:"w-5 h-5"}),i.createElementVNode("span",Yq,i.toDisplayString(b.$t("editor.close")),1)]),_:1})]),_:1}),i.createElementVNode("div",Jq,i.toDisplayString(i.unref(a)),1),i.createVNode(k,{class:"sm:justify-center pb-3.5 pt-1"},{default:i.withCtx(()=>[i.createVNode(yn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:f},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.alertYes")),1)]),_:1})]),_:1})],4)]),_:1})]),_:1})]),_:1},8,["open"])}}}),fE=i.defineComponent({__name:"Checkbox",props:{defaultChecked:{type:Boolean},checked:{type:[Boolean,String]},disabled:{type:Boolean},required:{type:Boolean},name:{},value:{},id:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,...l}=n;return l}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(cL),i.mergeProps(i.unref(s),{class:i.unref(ke)("peer h-5 w-5 shrink-0 rounded-sm border border-ed-border shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50 text-ed-blue",n.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(dL),{class:"flex h-full w-full items-center justify-center"},{default:i.withCtx(()=>[i.renderSlot(a.$slots,"default",{},()=>[i.createVNode(i.unref(N1),{icon:"fa-solid:check"})])]),_:3})]),_:3},16,["class"]))}}),mb=i.defineComponent({__name:"SimpleEditor",props:{modelValue:{default:""},parentEditor:{},isReadOnly:{type:Boolean},autofocus:{type:[String,Number,Boolean,null],default:"start"},spellcheckEnabled:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.inject("isMobile",!1),a=i.inject("minCharSuperInput",0),l=[$8,D8,F8,P8,V8.configure({placeholder:"수퍼를 입력하세요"})],u=i.ref(r.spellcheckEnabled),c=i.computed(()=>{var T;return(T=r.parentEditor)==null?void 0:T.extensionManager.extensions.find(P=>P.name==="spellchecker")}),f=i.computed(()=>{var T,P,I,M,j,U,q;return i5.configure({proofreader:new U5({api:(P=(T=c.value)==null?void 0:T.options.proofreader)==null?void 0:P.api,limit:(M=(I=c.value)==null?void 0:I.options.proofreader)==null?void 0:M.limit,transfer:(U=(j=c.value)==null?void 0:j.options.proofreader)==null?void 0:U.transfer,enabled:u.value}),uiStrings:(q=c.value)==null?void 0:q.options.uiStrings})}),p=new ii({enablePasteRules:!1,enableInputRules:!1,content:r.modelValue,extensions:l.concat(f.value),editable:!r.isReadOnly,autofocus:r.autofocus,onUpdate:({editor:T})=>{o("update:modelValue",T.getHTML())},parseOptions:{preserveWhitespace:"full"}});i.watch(()=>r.isReadOnly,T=>{var P;p.setEditable(!T),(P=p==null?void 0:p.commands)!=null&&P.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(!T)},{immediate:!0});function m(T){const{view:P}=p,{from:I}=P.state.selection;p.commands.insertContentAt(I,T),p.commands.focus()}function g(){var T;u.value=!u.value,p.commands.handleActiveSpellCheck(u.value),(T=p==null?void 0:p.commands)!=null&&T.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(u.value)}const{contentInner:b,measuredMinWidth:y,measure:w}=Vd({minChars:a,fontSize:"",editor:p});i.watch(()=>r.modelValue,()=>{w(),p&&p.getHTML()!==r.modelValue&&p.commands.setContent(r.modelValue??"",!1)});const x=i.computed(()=>s?{}:{width:`${y.value}px`}),k=document.createElement("canvas").getContext("2d");function C(){if(!y.value||!(b.value instanceof Element)||!k)return;const T=p.getText({blockSeparator:`
|
|
289
289
|
`}),P=getComputedStyle(b.value);k.font=P.font;const I=20,M=()=>Math.max(0,(y.value||0)-I);function j(H,F){let L=1,K=H.length,J=0;for(;L<=K;){const Y=Math.floor((L+K)/2);k.measureText(H.slice(0,Y)).width<=F?(J=Y,L=Y+1):K=Y-1}return J}let U="";const q=[];for(const H of T){if(H===`
|
|
290
|
-
`){q.push(U),U="";continue}if(U+=H,k.measureText(U).width>M())for(;k.measureText(U).width>M();){const F=j(U,M());F<=0?(q.push(U.charAt(0)),U=U.slice(1)):(q.push(U.slice(0,F)),U=U.slice(F))}}return q.push(U),q.map(H=>`<p>${H}</p>`).join("")}const{isScrolling:_,handleScroll:A}=xc();return e({insertSpecialCharater:m,isChecked:u,toggleSpellCheck:g,wrapText:C}),(T,P)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"contentInner",ref:b,style:i.normalizeStyle(i.unref(x)),onScroll:P[0]||(P[0]=(...I)=>i.unref(A)&&i.unref(A)(...I)),class:i.normalizeClass(i.unref(ke)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5",T.isReadOnly&&"border-none",i.unref(s)&&"h-auto min-h-20 max-h-44 border-ed-gray rounded-md px-4 py-2.5",i.unref(s)&&!i.unref(_)&&"scrollbar-thumb-transparent"))},[i.createVNode(i.unref(Ao),{id:"editor-panel",editor:i.unref(p),class:i.normalizeClass(i.unref(ke)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),Qq={class:"sr-only"},Nq={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},eK={class:"grid grid-cols-[70px,1fr] gap-x-2"},tK={class:"flex gap-x-7"},nK={class:"flex items-center space-x-2 text-xs font-normal"},rK={for:"spellcheck",class:"select-none whitespace-nowrap"},oK={class:"flex gap-x-1"},iK={class:"grid grid-cols-[70px,1fr] gap-x-2"},sK={class:"text-right text-sm p-2"},aK={class:"grid grid-cols-[70px,1fr] gap-x-2"},pc=i.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){var j,U;const n=e,r=t,{t:o}=Ot(),s=i.ref(""),a=i.ref(""),l=i.ref(null),u=i.ref(!1),c=i.reactive({x:0,y:0}),f=i.ref(!1),p={x:0,y:0},m=i.ref(!1),g=i.ref(!1),b=q=>{f.value=!0,p.x=q.clientX-c.x,p.y=q.clientY-c.y,document.addEventListener("mousemove",y),document.addEventListener("mouseup",w)},y=q=>{f.value&&(c.x=q.clientX-p.x,c.y=q.clientY-p.y)},w=()=>{f.value=!1,document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",w)};i.watch(()=>r.open,async q=>{if(q){g.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await i.nextTick();const le=document.querySelector(".draggable-dialog");if(le){const{width:H,height:F}=le.getBoundingClientRect(),L=window.innerHeight;c.x=0,c.y=(L-F)/2}}},{immediate:!0});const x=()=>{n("close"),s.value="",a.value="",u.value=!1},E=()=>{s.value=l.value.wrapText(),a.value="",g.value?m.value=!0:n("close"),n("save",s.value),s.value=""},k=()=>{m.value=!1,n("close")},C=(U=(j=r.editor)==null?void 0:j.extensionManager.extensions.find(q=>q.name==="superText"))==null?void 0:U.options.specialCharModal,_=ht.useLocalStorage("recentSpecialChars",[]),A=q=>{if(!q)return;const le=(_.value??[]).filter(H=>H!==q);le.unshift(q),_.value=le.slice(0,5)},T=q=>{var le;(le=l.value)==null||le.insertSpecialCharater(q)},P=(q,le)=>{var H;le&&((H=l.value)==null||H.insertSpecialCharater(q),A(q))},I=i.computed(()=>{var q;return(q=l.value)==null?void 0:q.isChecked}),M=()=>{var q;(q=l.value)==null||q.toggleSpellCheck()};return i.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",w)}),i.watch(s,q=>{!r.superTextElementId||r.superTextElementId===""||(g.value=q!==(r.superTextInit??""))}),(q,le)=>{const H=Ap,F=Tp,L=_p,K=hb,J=Sp,Y=kp,ne=Zq;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Y,{open:q.open},{default:i.withCtx(()=>[i.createVNode(i.unref(Z0),null,{default:i.withCtx(()=>[i.createVNode(i.unref(r1),{class:"!pointer-events-none bg-black/30"}),i.createVNode(J,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:i.withCtx(()=>{var we,xe,$e;return[i.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:i.normalizeStyle({transform:`translate(${c.x}px, ${c.y}px)`,top:"0px",left:"auto",right:"15px"})},[i.createVNode(L,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:i.withModifiers(b,["prevent"])},{default:i.withCtx(()=>[i.createVNode(H,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.superinput")),1)]),_:1}),i.createVNode(F,{class:"absolute right-3 top-3 text-white",onClick:x},{default:i.withCtx(()=>[i.createVNode(i.unref(Ff),{class:"w-5 h-5"}),i.createElementVNode("span",Qq,i.toDisplayString(q.$t("editor.close")),1)]),_:1})]),_:1}),i.createElementVNode("div",Nq,[i.createElementVNode("div",eK,[le[4]||(le[4]=i.createElementVNode("label",null," ",-1)),i.createElementVNode("div",tK,[i.createVNode(yn,{class:"text-[#65558F] bg-[#ECE6F0] hover:bg-[#ECE6F0]/90 shadow text-xs rounded font-normal h-[25px] px-3",onClick:le[0]||(le[0]=Ee=>u.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.insert.symbol")),1)]),_:1}),i.createElementVNode("div",nK,[i.createVNode(fE,{id:"spellcheck",checked:i.unref(I),"onUpdate:checked":M},null,8,["checked"]),i.createElementVNode("label",rK,i.toDisplayString(i.unref(o)("editor.menubar.menu.spellCheck")),1)]),i.createElementVNode("div",oK,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(_),Ee=>(i.openBlock(),i.createBlock(yn,{key:Ee,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:We=>T(Ee)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(Ee),1)]),_:2},1032,["onClick"]))),128))])]),u.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent((we=i.unref(C))==null?void 0:we.component),{key:0,"custom-class":"!z-[70] !pointer-events-auto",class:i.normalizeClass(($e=(xe=i.unref(C))==null?void 0:xe.componentProps)==null?void 0:$e.class),onSelectedChar:P,onClose:le[1]||(le[1]=Ee=>u.value=!1)},null,40,["class"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",iK,[i.createElementVNode("label",sK,i.toDisplayString(i.unref(o)("editor.detail")),1),i.createVNode(mb,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":le[2]||(le[2]=Ee=>s.value=Ee),"parent-editor":q.editor,class:""},null,8,["modelValue","parent-editor"])]),i.createElementVNode("div",aK,[le[5]||(le[5]=i.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),i.createVNode(hl,{modelValue:a.value,"onUpdate:modelValue":le[3]||(le[3]=Ee=>a.value=Ee),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),i.createVNode(K,{class:"sm:justify-center pb-3.5 pt-1"},{default:i.withCtx(()=>[i.createVNode(yn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:E},{default:i.withCtx(()=>[i.createVNode(i.unref(ug),{class:"w-5 h-5 mr-2"}),i.createTextVNode(" "+i.toDisplayString(i.unref(o)("editor.check")),1)]),_:1}),i.createVNode(yn,{as:"button",variant:"destructive",onClick:x},{default:i.withCtx(()=>[i.createVNode(i.unref(Ff),{class:"w-5 h-5 mr-2"}),i.createTextVNode(" "+i.toDisplayString(q.$t("editor.close")),1)]),_:1})]),_:1})],4)]}),_:1})]),_:1})]),_:1},8,["open"]),i.createVNode(ne,{open:m.value,onClose:k},null,8,["open"])],64)}}}),gb=i.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Ot(),o=i.ref(!1),s=i.reactive({from:0,to:0,text:""}),a=i.inject("isEditable",i.ref(!0)),l=i.inject("canEditSuper",i.ref(!0)),u=i.computed(()=>n.mode===Ve.EDITOR||n.mode===Ve.PLAIN_TEXT||!l.value||n.disableSuperInput);function c(){if(!n.editor)return"";const{from:E,to:k}=n.editor.state.selection,C=n.editor.state.doc.cut(E,k),A=to.fromSchema(n.editor.schema).serializeFragment(C.content),T=document.createElement("div");return T.appendChild(A),T.innerHTML}const f=()=>{const{view:E}=n.editor,{from:k,to:C}=E.state.selection,_=c();s.text=_,s.from=k,s.to=C},p=()=>o.value=!o.value,m=()=>{u.value||(o.value=!0,f())},g=()=>o.value=!1,b=E=>{const k=n==null?void 0:n.superTextStore.addMoreSuperText(E);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":k,"data-text":E}}),o.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},y=i.ref(!1),w=async E=>{var k,C;if(E){const _=await((C=(k=n.editor).hasClipboard)==null?void 0:C.call(k));y.value=!!_}},x=()=>{if(u.value||!n.editor)return;const{view:E,state:k}=n.editor,{from:C,to:_}=k.selection;s.from=C,s.to=_,s.text="",E.dom.blur(),o.value=!0};return e({toggleDialog:p,openDialog:m,closeDialog:g}),(E,k)=>{const C=pc,_=pb,A=fb,T=db,P=cb;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(C,{open:o.value,editor:E.editor,"super-text-init":s.text,onClose:p,onSave:b},null,8,["open","editor","super-text-init"]),i.createVNode(P,{"onUpdate:open":w},{default:i.withCtx(()=>[i.createVNode(_,{as:"template",class:"relative",disabled:i.unref(u),onDblclick:i.withModifiers(x,["prevent","stop"])},{default:i.withCtx(()=>[i.renderSlot(E.$slots,"default")]),_:3},8,["disabled"]),i.createVNode(T,null,{default:i.withCtx(()=>[E.disableSuperInput?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(A,{key:0,onSelect:m},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.inputSuper")),1)]),_:1})),i.unref(a)?(i.openBlock(),i.createBlock(A,{key:1,onSelect:k[0]||(k[0]=I=>{var M;return(M=E.editor)==null?void 0:M.commands.cutContent()})},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.cut")),1)]),_:1})):i.createCommentVNode("",!0),i.unref(a)?(i.openBlock(),i.createBlock(A,{key:2,onSelect:k[1]||(k[1]=I=>{var M;return(M=E.editor)==null?void 0:M.commands.copyContent()})},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.copy")),1)]),_:1})):i.createCommentVNode("",!0),i.unref(a)?(i.openBlock(),i.createBlock(A,{key:3,disabled:!y.value,onSelect:k[2]||(k[2]=I=>{var M;return(M=E.editor)==null?void 0:M.commands.pasteContent()})},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),_:1})]),_:3})],64)}}});var ar=(t=>(t.TOGGLE_SUPER_TEXT="toggle-super-text",t.SUPER_TEXT_UPDATE_POSITION="SUPER_TEXT_UPDATE_POSITION",t.RENDER_SUPER_TEXT="RENDER_SUPER_TEXT",t.SUPER_VIEW_PAGE="SUPER_VIEW_PAGE",t.INCREASE_DECREASE_FONTSIZE="increase-decrease-fontsize",t))(ar||{});const lK={id:"editor-panel",class:"flex relative w-full h-full"},uK=Bo(i.defineComponent({__name:"PageNode",props:Ws,setup(t){const{state:e,page:n,superTextStore:r}=wn(),{size:o,pagination:s,margin:a}=n.value,l=i.ref(null),u=i.ref(t.node.attrs.viewSuperTextArea),c=i.computed(()=>u.value&&t.editor.storage.page.mode!=="editor"),f=i.computed(()=>t.editor.storage.page.mode===Ve.REPORT),{width:p,height:m}=o,g=i.computed(()=>s?`calc(${m} - ${(a==null?void 0:a.top)??0} - ${(a==null?void 0:a.bottom)??0}`:"max-content"),b=ht.useEventBus(ar.SUPER_VIEW_PAGE);return i.watch(()=>t.node.attrs,y=>{b.emit(y.pageNumber)},{immediate:!0}),(y,w)=>{var E,k,C,_;const x=gb;return i.openBlock(),i.createBlock(i.unref(Us),{id:y.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":y.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:i.normalizeStyle({"--umo-page-margin-top":((E=i.unref(a))==null?void 0:E.top)??"0","--umo-page-margin-bottom":((k=i.unref(a))==null?void 0:k.bottom)??"0","--umo-page-margin-left":((C=i.unref(a))==null?void 0:C.left)??"0","--umo-page-margin-right":((_=i.unref(a))==null?void 0:_.right)??"0","--umo-page-width":i.unref(p),"--umo-page-height":i.unref(m),"--empty-node-left":"0px",left:100,"min-height":typeof i.unref(m)=="number"?`${i.unref(m)}px`:i.unref(m),height:f.value?typeof i.unref(m)=="number"?`${i.unref(m)}px`:i.unref(m):"auto"})},{default:i.withCtx(()=>[i.createElementVNode("div",lK,[i.createVNode(x,{mode:c.value?i.unref(Ve).REPORT:i.unref(Ve).EDITOR,editor:y.editor,"super-text-store":i.unref(r)},{default:i.withCtx(()=>[i.createVNode(i.unref(aw),{class:"umo-page-node-content",style:i.normalizeStyle({height:g.value})},null,8,["style"])]),_:1},8,["mode","editor","super-text-store"])])]),_:1},8,["id","page-number","style"])}}}),[["__scopeId","data-v-7d55d7ea"]]);function pE(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}const cK=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=o.extensionManager.attributes,f=Op(c,l.node().type.name,l.node().attrs);if(f.id=Ng(),f.extend&&(f.extend=!1),s instanceof Le&&s.node.isBlock)return!l.parentOffset||!hr(a,l.pos)?!1:(r&&(t&&pE(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const p=u.parentOffset===u.parent.content.size;s instanceof Te&&e.deleteSelection();const m=l.depth===0?void 0:l4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=hr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&hr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(b=!0,g=m?[{type:m,attrs:f}]:void 0),b&&(g||(g=[{type:l.node().type,attrs:f}]),e.split(e.mapping.map(l.pos),1,g),m&&!p&&!l.parentOffset&&l.parent.type!==m)){const y=e.mapping.map(l.before()),w=e.doc.resolve(y);l.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&pE(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},dK=t=>({tr:e,state:n,dispatch:r,editor:o})=>{var y;const s=hn(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection instanceof Le?n.selection.node:null;if(u!=null&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const c=a.node(-1);if(c.type!==s)return!1;const f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let w=de.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-x;T>=a.depth-3;T-=1)w=de.from(a.node(T).copy(w));const E=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Op(f,a.node().type.name,a.node().attrs),C=((y=s.contentMatch.defaultType)==null?void 0:y.createAndFill(k))??void 0;w=w.append(de.from(s.createAndFill(null,C)??void 0));const _=a.before(a.depth-(x-1));e.replace(_,a.after(-E),new Ce(w,4-x,0));let A=-1;e.doc.nodesBetween(_,e.doc.content.size,(T,P)=>{if(A>-1)return!1;T.isTextblock&&T.content.size===0&&(A=P+1)}),A>-1&&e.setSelection(Te.near(e.doc.resolve(A))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,m=Op(f,c.type.name,c.attrs),g=Op(f,a.node().type.name,a.node().attrs);m.id=Ng(),g.id=Ng(),e.delete(a.pos,l.pos);const b=p?[{type:s,attrs:m},{type:p,attrs:g}]:[{type:s,attrs:m}];if(!hr(e.doc,a.pos,2))return!1;if(r){const{selection:w,storedMarks:x}=n,{splittableMarks:E}=o.extensionManager,k=x??(w.$to.parentOffset&&w.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!k||!r)return!0;const C=k.filter(_=>E.includes(_.type.name));e.ensureMarks(C)}return!0},fK=[eb,xp,Cp,tb,Ep,fs,rb,_l,ib,ab,ob,ua,ps,hs,sb,lb,nb,jr],pK=Bt.create({priority:200,name:`${jr}`,content:"block*",group:`${jr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:js(uK),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:pi(10)},pageNumber:{default:1},force:{default:!1},viewSuperTextArea:{default:!0},slots:{default:this.options.slots,renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){return["div",{...bt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:cK,splitListItem:dK,autoPaging:(t=!0)=>({tr:e,state:n,dispatch:r,editor:o})=>(r&&e.setMeta("runState",t),!0),setPageBreak:()=>({tr:t,state:e,dispatch:n,editor:r})=>(n&&t.setMeta("splitPage",!0),!0),togglePagePlugin:t=>({tr:e,dispatch:n})=>(e.setMeta("disablePage",t),n&&n(e),!0)}},addGlobalAttributes(){return[{types:fK.concat(this.options.types||[]),attributes:{id:{default:null},extend:{default:!1}}}]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:r})=>[()=>r.undoInputRule(),()=>r.command(({tr:o})=>{const{selection:s,doc:a}=o,{empty:l,$anchor:u}=s,{pos:c,parent:f}=u,p=De.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>hE(r),()=>r.joinBackward(),()=>r.selectNodeBackward(),()=>r.command(({editor:o,tr:s})=>{const{selection:a,doc:l}=s,{$anchor:u}=a,{pos:c}=u;if(l.childCount===1)return!1;if(De.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(jr);const f=ni(p=>p.type.name===jr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(jr);const p=f.node.firstChild.type;if(f.start+De.atStart(f.node).from===c){const g=Te.create(l,f.start-2,f.start-2),b=ni(y=>y.type.name===jr)(g);if(b){const y=De.atEnd(b.node).from+b.start,w=Te.create(l,y,y);if(p===b.node.lastChild.type){const{parent:x}=w.$anchor;return uq(x,o.schema)?s.setSelection(w):s.step(new fn(y,c,Ce.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>hE(r),()=>r.command(({tr:o})=>{const{selection:s,doc:a}=o,{$anchor:l}=s,u=l.node(),c=ni(f=>f.type.name===_l)(s);return c&&c.start+De.atStart(c.node).from===l.pos&&c.node.childCount===1&&u.content.size===0?!0:r.joinForward()}),()=>r.selectNodeForward(),()=>r.command(({tr:o})=>{const{selection:s,doc:a}=o,{$anchor:l}=s,{pos:u}=l;if(a.childCount===1)return!1;if(De.atEnd(a).from===u)return r.deleteNode(jr);const c=ni(f=>f.type.name===jr)(s);if(c&&c.start+De.atEnd(c.node).from===u){const p=Te.create(a,u+2,u+2),m=ni(g=>g.type.name===jr)(p);if(m){const g=De.atStart(m.node).from+m.start,b=Te.create(a,g,g);if(ni(w=>w.attrs.extend)(b))return o.step(new fn(u,g,Ce.empty)),!0}}return!1})]),Tab:()=>this.editor.commands.first(({commands:r})=>[()=>!0]),"Mod-Enter":()=>this.editor.commands.setPageBreak()}},addNodeView(){return this.options.View}});function Op(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}const hE=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,o=u4(r,{from:n.from,to:n.to},s=>s.type.name===_l);for(const s of o){const a=s.pos+s.node.nodeSize;if(n.from<s.pos||n.to>a)return!0}return t.deleteSelection()}),hK=Ze.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),mK=["data-font"],gK=i.defineComponent({__name:"FontFamilyMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""}},setup(t){const e=t,n=i.computed(()=>e.editor.extensionStorage["base-kit"].mode===Ve.EDITOR),{t:r}=Ot(),o=[{label:r("editor.fontFamily.gulim"),value:"Gulim"},{label:r("editor.fontFamily.dotum"),value:"Dotum"},{label:r("editor.fontFamily.gungsuh"),value:"Gungsuh"}],s=i.inject("fontFamily"),a=i.computed(()=>{const p=e.editor.extensionManager.extensions.find(g=>g.name==="fontFamily").options;return rt.isEmpty(p.fontFamilyMap)&&(p.fontFamilyMap=o),[{label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")},...p.fontFamilyMap]}),l=i.computed(()=>{const p={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?Zm(e.editor.state,"textStyle").fontFamily||p.value:s.value||p.value}),u=ht.useEventBus("fontFamily");function c(p){p.value===l.value||p.value===r("editor.fontFamily.default")?(e.editor.commands.unsetFontFamily(),s.value=null):(s.value=p.value,e.editor.commands.setFontFamily(p.value),u.emit())}const f=i.computed(()=>{var p;return(p=a.value.find(m=>m.value===l.value))==null?void 0:p.label});return(p,m)=>(i.openBlock(),i.createBlock(ia,{disabled:p.disabled,tooltip:p.tooltip,title:f.value,btn_class:`min-w-24 ${p.customClass}`},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(g,b)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b},[i.createVNode(i.unref(Cl),{checked:l.value===g.value,onClick:y=>c(g)},{default:i.withCtx(()=>[i.createElementVNode("span",{class:"ml-1 h-full","data-font":g.label,style:i.normalizeStyle({fontFamily:g.value??void 0})},i.toDisplayString(g.label),13,mK)]),_:2},1032,["checked","onClick"]),g.label===i.unref(r)("editor.fontFamily.default")?(i.openBlock(),i.createBlock(i.unref(fg),{key:0})):i.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),mE=hK.extend({name:"fontFamily",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontFamilyMap:[],button({editor:e,extension:n,t:r}){return{component:gK,componentProps:{editor:e,disabled:!e.can().setFontFamily(""),tooltip:r("editor.fontFamily.tooltip"),customClass:"border border-gray-300 rounded-none text-gray-500 px-2.5 h-[26px]"}}}}},addGlobalAttributes(){return[{types:["paragraph","heading","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.style.fontFamily||null,renderHTML:t=>t.style?{style:`font-family: ${t.style}`}:{}},fontFamily:{default:null,parseHTML:t=>t.style.fontFamily.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily}}),bK={class:"flex gap-2"},vK=["disabled"],yK=Bo(i.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=i.inject("fontSize"),n=i.computed(()=>e.value?parseInt(e.value)===parseInt(k0[0])||parseInt(e.value)<parseInt(k0[0]):!1),r=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE),o=s=>{r.emit(s)};return(s,a)=>{const l=bl,u=gl,c=vl;return i.openBlock(),i.createElementBlock("div",bK,[i.createVNode(c,null,{default:i.withCtx(()=>[i.createVNode(u,{"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(l,null,{default:i.withCtx(()=>[i.createElementVNode("button",{class:"btn",onClick:a[0]||(a[0]=f=>o(!0))},[i.createVNode(i.unref(Lt),{name:"Plus",class:"w-6 h-6"})])]),_:1}),i.createVNode(i.unref(ta),null,{default:i.withCtx(()=>a[2]||(a[2]=[i.createTextVNode(" 글꼴 크기 크게 ")])),_:1})]),_:1})]),_:1}),i.createVNode(c,null,{default:i.withCtx(()=>[i.createVNode(u,{"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(l,null,{default:i.withCtx(()=>[i.createElementVNode("button",{class:"btn",onClick:a[1]||(a[1]=f=>o(!1)),disabled:i.unref(n)},[i.createVNode(i.unref(Lt),{name:"Minus",class:"w-6 h-6"})],8,vK)]),_:1}),i.createVNode(i.unref(ta),null,{default:i.withCtx(()=>a[3]||(a[3]=[i.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),wK=Dn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:yK,componentProps:{editor:t}}}}},addAttributes(){return{size:{default:this.options.defaultSize,parseHTML:t=>t.style.fontSize||this.options.defaultSize,renderHTML:t=>t.size?{style:`font-size: ${t.size}`}:{}}}},addCommands(){return{setFontSizeIncreaseDecrease:t=>({commands:e})=>e.setMark("textStyle",{fontSize:t})}}}),bb=Ze.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{action:()=>{e.commands.setPainter(e==null?void 0:e.state.selection.$head.marks())},icon:"PaintRoller",tooltip:r("editor.format")}})}},addCommands(){return{setPainter:t=>({view:{dispatch:e,state:{tr:n},dom:r}})=>{const a=`url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M9 22v-6H4V7q0-1.65 1.175-2.825T8 3h12v13h-5v6zM6 10h12V5h-1v4h-2V5h-1v2h-2V5H8q-.825 0-1.412.588T6 7zm0 4h12v-2H6zm0 0v-2z"/></svg>')}"), auto`;return r.style.cursor=a,e(n.setMeta("painterAction",{type:"start",marks:t})),!0}}},addProseMirrorPlugins(){return[new tt({key:new kt("format-painter"),state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta("painterAction");return n&&n.type==="start"?e=n.marks:n&&n.type==="end"&&(e=[]),e}},props:{handleDOMEvents:{mousedown(t,e){const n=this.getState(t.state);if(!n||n.length==0)return t.dom.style.cursor="",!1;const r=()=>{document.removeEventListener("mouseup",r);const{dispatch:o,state:{selection:s},dom:a}=t;let l=t.state.tr;a.style.cursor="",l=l.removeMark(s.from,s.to);for(const u of n)u.type.name!="link"&&(l=l.addMark(s.from,s.to,u));o(l.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}}),vb=()=>pi(10),gE=new kt("attrkey"),xK=t=>new tt({key:gE,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,o){const{tr:s}=o;let a=!1;const l=gE.getState(o);if(n.some(c=>c.getMeta("composition")))return null;if(l||n.some(c=>c.docChanged)){const c=[];o.doc.descendants((f,p,m,g)=>{const{attrs:b}=f,y=c.includes(b.id)?vb():b.id||vb();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...b,id:y,"number-line":g+1}),a=!0),c.push(y)})}return a?s:null}}),bE=[eb,xp,Cp,tb,Ep,fs,rb,_l,ib,ab,ob,ua,ps,hs,sb,lb,nb,jr],CK=Ze.create({name:"autoId",addGlobalAttributes(){return[{types:bE.concat(this.options.types||[]),attributes:{id:{default:vb()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[xK(bE.concat(this.options.types||[]))]}}),EK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,kK=Bt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",bt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[g4({find:EK,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),SK=["src","alt"],_K={key:0,class:"image-resizer"},TK=["onMousedown","onTouchstart"],AK=i.defineComponent({__name:"ImageView",props:{...Ws,selected:{type:Boolean,required:!0}},setup(t){const e=t,n={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},r=i.ref({width:uw,height:uw}),o=i.ref({width:0,height:0}),s=i.ref(!1),a=i.ref({x:0,y:0,w:0,h:0,dir:""}),l=i.computed(()=>{const{src:k,alt:C,width:_,height:A,flipX:T,flipY:P}=e.node.attrs,I=[];T&&I.push("rotateX(180deg)"),P&&I.push("rotateY(180deg)");const M=I.join(" ");return{src:k||void 0,alt:C||void 0,style:{width:S0(_)?`${_}px`:_,height:S0(A)?`${A}px`:A,transform:M||"none"}}});i.computed(()=>({width:i.unref(l).style.width==="100%"?"100%":void 0}));const u=i.ref(null),c=new ResizeObserver(k=>{for(const C of k){const{width:_,height:A}=C.contentRect;o.value={width:_,height:A},e.updateAttributes({originWidth:_,originHeight:A})}});function f(){const{editor:k,getPos:C}=e;k.commands.setNodeSelection(C())}const p=rt.throttle(()=>{const{editor:k}=e;r.value.width=parseInt(getComputedStyle(k.view.dom).width,10)},cw);function m(k,C){k.preventDefault(),k.stopPropagation();let _=0,A=0;const T=document.querySelector(".image-resizer");if(T&&(T.style.borderColor="#3b82f6"),"touches"in k&&k.touches.length>0)_=k.touches[0].clientX,A=k.touches[0].clientY;else if("clientX"in k)_=k.clientX,A=k.clientY;else return;const{width:P,height:I}=i.unref(o),M=P/I;let j=Number(e.node.attrs.width)||P,U=Number(e.node.attrs.height)||Math.round(j/M);const q=i.unref(r).width;j=Math.min(j>q?q:j,q),U=Math.round(j/M),Object.assign(a.value,{x:_,y:A,w:j,h:U,dir:C}),s.value=!0,y()}const g=rt.throttle(k=>{if(!i.unref(s))return;let C=0;if("touches"in k&&k.touches.length>0)C=k.touches[0].clientX;else if("clientX"in k)C=k.clientX;else return;const{x:_,w:A,dir:T}=i.unref(a),P=(C-_)*(/l/.test(T)?-1:1),I=jB(A+P,DB,i.unref(r).width);e.updateAttributes({width:I})},cw),b=k=>{k.preventDefault(),k.stopPropagation();const C=document.querySelector(".image-resizer");C&&(C.style.borderColor=""),i.unref(s)&&(s.value=!1,Object.assign(a.value,{x:0,y:0,w:0,h:0,dir:""}),w(),f())};function y(){document.addEventListener("mousemove",g,!0),document.addEventListener("mouseup",b,!0),document.addEventListener("touchmove",g,!0),document.addEventListener("touchend",b,!0)}function w(){document.removeEventListener("mousemove",g,!0),document.removeEventListener("mouseup",b,!0),document.removeEventListener("touchmove",g,!0),document.removeEventListener("touchend",b,!0)}const x=new ResizeObserver(p),E=i.computed(()=>{const{textAlign:k}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[k]||""});return i.onMounted(()=>{u.value&&c.observe(u.value),x.observe(e.editor.view.dom)}),i.onBeforeUnmount(()=>{w(),c.disconnect(),x.disconnect()}),(k,C)=>(i.openBlock(),i.createBlock(i.unref(Us),{class:"node-image"},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"image-view",style:i.normalizeStyle([{width:l.value.style.width,height:l.value.style.height},E.value])},[i.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:i.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":s.value},"image-view__body"])},[i.createElementVNode("img",{ref_key:"imageRef",ref:u,src:l.value.src,alt:l.value.alt,class:"block w-full image-view__body__image",style:i.normalizeStyle([{transform:l.value.style.transform}]),onClick:f},null,12,SK),k.editor.view.editable?i.withDirectives((i.openBlock(),i.createElementBlock("div",_K,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Object.values(n),_=>(i.openBlock(),i.createElementBlock("span",{key:_,class:i.normalizeClass([`image-resizer__handler--${_}`,"image-resizer__handler"]),onMousedown:A=>m(A,_),onTouchstart:i.withModifiers(A=>m(A,_),["prevent"])},null,42,TK))),128))],512)),[[i.vShow,t.selected||s.value]]):i.createCommentVNode("",!0)],2)],4)]),_:1}))}}),OK=Bo(AK,[["__scopeId","data-v-6435a6f3"]]),yb=kK.extend({group:"block",defining:!0,isolating:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:e=>e.style.textAlign||e.getAttribute("textAlign")||null,renderHTML:e=>({textAlign:e.textAlign})},width:{default:"100%",parseHTML:e=>{const n=e.style.width||e.getAttribute("width")||null;return n&&n.endsWith("%")?n:n==null?null:parseInt(n,10)},renderHTML:e=>({width:e.width})},class:{default:"",parseHTML:e=>e.getAttribute("class")||"",renderHTML:e=>({class:e.class})},"data-memo":{default:"",parseHTML:e=>e.getAttribute("data-memo")||"",renderHTML:e=>({"data-memo":e["data-memo"]})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this)}},addNodeView(){return js(OK)},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),updateImage:e=>({commands:n,editor:r})=>n.updateAttributes(this.name,e)}},renderHTML({node:t,HTMLAttributes:e}){const{textAlign:n,flipX:r,flipY:o}=t.attrs,l=`${{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[n]||""} ${r||o?`transform: rotateX(${r?"180":"0"}deg) rotateY(${o?"180":"0"}deg);`:""}`;return["img",bt({height:"auto",style:l},this.options.HTMLAttributes,e)]},parseHTML(){return[{tag:"img[src]"}]},addProseMirrorPlugins(){return[new tt({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof Le&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof Le&&e.node.type.name==="image"}}})]}}),MK=["paragraph","heading","list_item","todo_item"];function BK(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Te||n instanceof Rn))return t;const{from:o,to:s}=n,a=[],l=e&&e!==dw?e:null;return r.nodesBetween(o,s,(u,c)=>{const f=u.type;return MK.includes(f.name)?((u.attrs.lineHeight||null)!==l&&a.push({node:u,pos:c,nodeType:f}),f.name!=="list_item"&&f.name!=="todo_item"):!0}),a.length&&a.forEach(u=>{const{node:c,pos:f,nodeType:p}=u;let{attrs:m}=c;m={...m,lineHeight:l},t=t.setNodeMarkup(f,p,m,c.marks)}),t}function IK(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:o}=e;return o=o.setSelection(r),o=BK(o,t),o.docChanged?(n&&n(o),!0):!1}}const RK=i.defineComponent({__name:"LineHeightDropdown",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const{t:e}=Ot();function n(l){return parseFloat(l.replace("%",""))/100}const r=i.computed(()=>{const c=s.editor.extensionManager.extensions.find(f=>f.name==="lineHeight").options.lineHeights.map(f=>({label:n(f),value:f}));return c.unshift({label:i.unref(e)("editor.default"),value:"default"}),c}),o=i.ref("default"),s=t;function a(l){l==="default"?s.editor.commands.unsetLineHeight():s.editor.commands.setLineHeight(l),o.value=l}return(l,u)=>(i.openBlock(),i.createBlock(ia,{icon:l.icon,tooltip:l.tooltip,disabled:l.disabled},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(c,f)=>(i.openBlock(),i.createBlock(i.unref(Cl),{key:f,checked:c.value===o.value,onClick:p=>a(c.value)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.label),1)]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),vE=Ze.create({name:"lineHeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:dw,button({editor:e,t:n}){return{component:RK,componentProps:{editor:e,icon:"LineHeight",tooltip:n("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight||this.options.defaultHeight,renderHTML:t=>t.lineHeight===this.options.defaultHeight||!t.lineHeight?{}:{style:`line-height: ${t.lineHeight}`}}}}]},addCommands(){return{setLineHeight:t=>IK(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),LK=Bt.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",bt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var ca=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(ca||{});const wb=Bt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),layout:"two-column"}},addAttributes(){return{layout:{default:"two-column"}}},addCommands(){return{setColumns:()=>({commands:t})=>(t.insertContent('<div data-type="columns"><div data-type="column" data-position="left"><p></p></div><div data-type="column" data-position="right"><p></p></div></div>'),!0),setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addExtensions(){return[LK.configure(this.options.columnOptions)]}});function PK(t){let e=t;for(;e&&e!==document.body;){if(e.nodeType===1){const n=e;if(n.id==="editor-panel")return n}e=e.parentNode}return null}const Mp=t=>{var n;if(!t)return!0;const e=document.createElement("div");return e.innerHTML=t,((n=e==null?void 0:e.textContent)==null?void 0:n.trim())===""},DK=t=>{if(!t)return"";const{from:e,to:n}=t.state.selection,r=t.state.doc.cut(e,n),s=to.fromSchema(t.schema).serializeFragment(r.content),a=document.createElement("div");return a.appendChild(s),a.innerHTML},yE=8;function VK(t){const e=i.ref(!1);let n=!1,r=null,o=null,s=null,a=null,l=0,u=0;function c(x){const E=x.cloneNode(!0);return E.style.position="fixed",E.style.pointerEvents="none",E.style.opacity="0.9",E.style.zIndex="9999",E.style.transform="translate(-50%, -50%)",E.style.left="0px",E.style.top="0px",document.body.appendChild(E),E}function f(){o&&o.parentElement&&o.parentElement.removeChild(o),o=null}function p(){try{if(typeof t.getPos=="function"){const x=t.getPos();if(typeof x=="number"&&x>=0)return x}}catch{}return null}function m(x,E){e.value||(a=p(),document.body.style.userSelect="none",document.body.style.touchAction="none",E&&(o=c(E),o.style.left=`${x.clientX}px`,o.style.top=`${x.clientY}px`),e.value=!0,n=!1,s=null)}function g(){r=null,a=null,s=null,n=!1,e.value=!1,f(),document.body.style.userSelect="",document.body.style.touchAction=""}function b(x){if(e.value)return;const E=x.changedTouches[0];r=E.identifier,l=E.clientX,u=E.clientY,n=!0,a=null,s=null}function y(x){var A;if(!n&&!e.value||r===null)return;const E=Array.from(x.changedTouches).find(T=>T.identifier===r);if(!E)return;const k=E.clientX-l,C=E.clientY-u,_=k*k+C*C;if(!e.value&&n&&_>=yE*yE){const T=x.currentTarget||x.target||null;m(E,T)}if(e.value){o&&(o.style.left=`${E.clientX}px`,o.style.top=`${E.clientY}px`);try{const T=(A=t.editor)==null?void 0:A.view;if(!T){s=null;return}const P=T.posAtCoords({left:E.clientX,top:E.clientY});P&&typeof P.pos=="number"?s=P.pos:s=null}catch{s=null}}}async function w(x){var E;if(e.value){if(document.body.style.userSelect="",document.body.style.touchAction="",f(),e.value=!1,a===null||s===null){g();return}const k=(E=t.editor)==null?void 0:E.view;if(!k){g();return}const C=k.state.doc.nodeAt(a);if(!C){g();return}const _=C.nodeSize,A=a,T=A+_,P=s;if(P>=A&&P<=T){g();return}let I=P;P>A&&(I=P-_);const M=k.state.doc.content.size;I<0&&(I=0),I>M&&(I=M);const j=C.type.create(C.attrs),U=k.state.tr;U.delete(A,T),U.insert(I,j),k.dispatch(U),g();return}if(n){g();return}}return{onTouchStart:b,onTouchMove:y,onTouchEnd:w}}function FK(...t){return k2(Kh(t))}const $K=["innerHTML"],zK=["book-mark-node-id","book-mark-content","node-id","element-id","line-id"],HK=i.defineComponent({__name:"SuperText",props:Ws,setup(t){const e=t,n=i.ref(!1),r=i.inject("isMobile",!1),o=ht.useEventBus(ar.RENDER_SUPER_TEXT),{onTouchStart:s,onTouchMove:a,onTouchEnd:l}=VK(e),u=i.computed(()=>{const k=e.getPos(),C=e.editor.state.doc.resolve(k);for(let _=C.depth;_>0;_--){const A=C.node(_);if(A.type.name==="paragraph")return A}return null}),c=i.computed(()=>{var k;return((k=u.value)==null?void 0:k.attrs.id)||""}),f=i.inject("canEditSuper",i.ref(!0));function p(k){var I,M;if(Mp(k)){b();return}const C=e.getPos(),_=(I=e.editor)==null?void 0:I.state.doc.nodeAt(C),A=k.trim(),{[Qe.ELEMENT_ID]:T,...P}=(_==null?void 0:_.attrs)||{};(M=e.editor)==null||M.view.dispatch(e.editor.state.tr.setNodeMarkup(C,void 0,{...P,[Qe.TEXT]:A})),requestAnimationFrame(()=>{e.editor.commands.setTextSelection(C+1),e.editor.view.focus()})}function m(k){const C=e.node.attrs[Qe.TEXT],_=e.node.attrs[Qe.ID],T={lineId:k.target.querySelector(`[node-id="${_}"]`).getAttribute("line-id"),dataId:_,text:C};o.emit({action:"hover",payload:T})}function g(k){const C=e.node.attrs[Qe.ID],A={lineId:k.target.querySelector(`[node-id="${C}"]`).getAttribute("line-id"),dataId:C,text:""};o.emit({action:"hover",payload:A})}function b(){const{getPos:k,node:C,editor:_}=e,A=k(),T=A+1;_.commands.deleteRange({from:A,to:T})}function y(){if(!f.value)return;const{attributes:k}=e.editor.options.editorProps;if(k&&k.id===or.COMMENT){const C=document.getElementById(or.COMMENT);if((C==null?void 0:C.getAttribute(or.DISABLE_SUPER_INPUT))==="true")return}e.editor.view.dom.blur(),n.value=!0}function w(){e.editor.commands.setSuperTextContent(e.node.attrs[Qe.TEXT],e.node.attrs[Qe.POSITION]),e.editor.commands.toggleSuperInputMoblie()}const x=i.computed(()=>e.editor.storage.superText.enable);i.watch(x,k=>{e.editor.setEditable(!k),k?e.editor.view.dom.classList.add("super-text-view-mode"):e.editor.view.dom.classList.remove("super-text-view-mode")});const E=i.computed(()=>`{${e.node.attrs[Qe.TEXT].replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p[^>]*>/g,"").trim()}}`);return(k,C)=>{const _=yn,A=pb,T=fb,P=db,I=cb,M=pc;return i.openBlock(),i.createBlock(i.unref(Us),{as:"span",class:i.normalizeClass(i.unref(FK)("text-inherit super-text shrink-0 inline-flex items-center justify-center",i.unref(r)&&x.value&&"block")),"data-drag-handle":"",draggable:i.unref(f),onPointerdown:C[2]||(C[2]=i.withModifiers(()=>{},["stop"])),onTouchstartPassive:i.unref(s),onTouchmovePassive:i.unref(a),onTouchendPassive:i.unref(l),onTouchcancelPassive:i.unref(l)},{default:i.withCtx(()=>[i.unref(r)&&!x.value?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:i.withModifiers(w,["stop"]),class:"w-5 inline-flex justify-center rounded text-ed-red-500 active:bg-ed-accent"},[i.createVNode(i.unref(Lt),{name:"fileEdit2"})])):i.createCommentVNode("",!0),i.unref(r)&&x.value?(i.openBlock(),i.createElementBlock("div",{key:1,innerHTML:E.value,onClick:i.withModifiers(w,["stop"]),class:"super-text-view-mode-item"},null,8,$K)):i.createCommentVNode("",!0),i.unref(r)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(I,{key:2},{default:i.withCtx(()=>[i.createVNode(A,{as:"template",class:"relative",disabled:!i.unref(f)},{default:i.withCtx(()=>[i.createVNode(_,{class:i.normalizeClass([{"pointer-events-none":!i.unref(f)},"!p-0 !m-0 !h-fit"]),variant:"ghost",onDblclick:i.withModifiers(y,["stop"]),onMouseenter:m,onMouseleave:g},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{name:"fileEdit"}),i.createElementVNode("div",{ref:"bookMarkRef","book-mark-node-id":e.node.attrs[i.unref(Qe).ID],"book-mark-content":e.node.attrs[i.unref(Qe).TEXT],"node-id":e.node.attrs[i.unref(Qe).ID],"element-id":e.node.attrs[i.unref(Qe).ELEMENT_ID],"line-id":c.value},null,8,zK)]),_:1},8,["class"])]),_:1},8,["disabled"]),i.createVNode(P,null,{default:i.withCtx(()=>[i.createVNode(T,{onSelect:C[0]||(C[0]=j=>n.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(k.$t("editor.super.edit")),1)]),_:1}),i.createVNode(T,{onSelect:b},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(k.$t("editor.super.delete")),1)]),_:1})]),_:1})]),_:1})),i.unref(r)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(M,{key:3,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[i.unref(Qe).TEXT],"super-text-element-id":e.node.attrs[i.unref(Qe).ELEMENT_ID],onClose:C[1]||(C[1]=j=>n.value=!1),onSave:p},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class","draggable","onTouchstartPassive","onTouchmovePassive","onTouchendPassive","onTouchcancelPassive"])}}}),UK=new tt({props:{handleKeyDown(t,e){var n;if(e.key==="Backspace"){const{state:r,dispatch:o}=t,{$from:s}=r.selection;if(s.parentOffset===1){const u=s.nodeAfter;if(u&&u.type.name==="superText"){const c=r.tr;c.delete(s.pos-1,s.pos);const f=r.schema.text("");return c.insert(s.pos-1,de.from(f)),c.setSelection(Te.create(c.doc,s.pos)),o(c),e.preventDefault(),!0}}const a=s.nodeBefore,l=s.nodeAfter;if(a&&a.isText&&((n=a.text)==null?void 0:n.length)===1&&l&&l.type.name==="superText"){const u=s.parent.childBefore(s.parentOffset-1).node;if(u&&u.type.name==="superText"){const c=r.tr;return c.delete(s.pos-1,s.pos),c.setSelection(Te.create(c.doc,s.pos-1)),o(c),e.preventDefault(),!0}}}return!1}}}),WK=new tt({appendTransaction(t,e,n){const r=new Set;let o=n.tr,s=!1;return n.doc.descendants((a,l)=>{if(a.type.name===hc){const u=a.attrs[Qe.ID];if(!u||r.has(u)){const c=pi();o=o.setNodeMarkup(l,void 0,{...a.attrs,[Qe.ID]:c}),s=!0,r.add(c)}else r.add(u)}}),s?o:null}}),hc="superText",wE={UPDATE:"superTextUpdate"},xE=Bt.create({name:"superText",inline:!0,group:"inline",selectable:!1,defining:!0,draggable:!0,addStorage(){return{enable:!0,isShowSuperInputMoblie:!1,view:!0,items:[],toggleSuperViewMobileCallBack:this.options.toggleSuperViewMobileCallBack,bottomSheetComponent:this.options.bottomSheetComponent,addToast:this.options.addToast,superTextContent:"",superTextPosition:""}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>n?[{component:Ke,componentProps:{action:()=>{t.commands.toggleSuperInputMoblie()},isActive:()=>{},icon:"fileEdit",title:e("editor.menubar.menu.insertSuper"),tooltip:e("editor.menubar.menu.insertSuper"),customClass:"whitespace-nowrap !bg-ed-blue active:!bg-ed-blue/90 !transition-none !text-white !font-normal rounded-[3px] h-[26px] ml-auto",customClassTooltip:"ml-auto"}}]:[{component:Ke,componentProps:{action:()=>t.commands.toggleSuperTextView(),isActive:()=>t.storage.superText.enable,title:e("editor.menubar.menu.superView"),customClass:`whitespace-nowrap !text-white !font-normal rounded-[3px] h-[26px]
|
|
290
|
+
`){q.push(U),U="";continue}if(U+=H,k.measureText(U).width>M())for(;k.measureText(U).width>M();){const F=j(U,M());F<=0?(q.push(U.charAt(0)),U=U.slice(1)):(q.push(U.slice(0,F)),U=U.slice(F))}}return q.push(U),q.map(H=>`<p>${H}</p>`).join("")}const{isScrolling:_,handleScroll:A}=xc();return e({insertSpecialCharater:m,isChecked:u,toggleSpellCheck:g,wrapText:C}),(T,P)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"contentInner",ref:b,style:i.normalizeStyle(i.unref(x)),onScroll:P[0]||(P[0]=(...I)=>i.unref(A)&&i.unref(A)(...I)),class:i.normalizeClass(i.unref(ke)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5",T.isReadOnly&&"border-none",i.unref(s)&&"h-auto min-h-20 max-h-44 border-ed-gray rounded-md px-4 py-2.5",i.unref(s)&&!i.unref(_)&&"scrollbar-thumb-transparent"))},[i.createVNode(i.unref(Ao),{id:"editor-panel",editor:i.unref(p),class:i.normalizeClass(i.unref(ke)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),Qq={class:"sr-only"},Nq={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},eK={class:"grid grid-cols-[70px,1fr] gap-x-2"},tK={class:"flex gap-x-7"},nK={class:"flex items-center space-x-2 text-xs font-normal"},rK={for:"spellcheck",class:"select-none whitespace-nowrap"},oK={class:"flex gap-x-1"},iK={class:"grid grid-cols-[70px,1fr] gap-x-2"},sK={class:"text-right text-sm p-2"},aK={class:"grid grid-cols-[70px,1fr] gap-x-2"},pc=i.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){var j,U;const n=e,r=t,{t:o}=Ot(),s=i.ref(""),a=i.ref(""),l=i.ref(null),u=i.ref(!1),c=i.reactive({x:0,y:0}),f=i.ref(!1),p={x:0,y:0},m=i.ref(!1),g=i.ref(!1),b=q=>{f.value=!0,p.x=q.clientX-c.x,p.y=q.clientY-c.y,document.addEventListener("mousemove",y),document.addEventListener("mouseup",w)},y=q=>{f.value&&(c.x=q.clientX-p.x,c.y=q.clientY-p.y)},w=()=>{f.value=!1,document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",w)};i.watch(()=>r.open,async q=>{if(q){g.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await i.nextTick();const le=document.querySelector(".draggable-dialog");if(le){const{width:H,height:F}=le.getBoundingClientRect(),L=window.innerHeight;c.x=0,c.y=(L-F)/2}}},{immediate:!0});const x=()=>{n("close"),s.value="",a.value="",u.value=!1},E=()=>{s.value=l.value.wrapText(),a.value="",g.value?m.value=!0:n("close"),n("save",s.value),s.value=""},k=()=>{m.value=!1,n("close")},C=(U=(j=r.editor)==null?void 0:j.extensionManager.extensions.find(q=>q.name==="superText"))==null?void 0:U.options.specialCharModal,_=ht.useLocalStorage("recentSpecialChars",[]),A=q=>{if(!q)return;const le=(_.value??[]).filter(H=>H!==q);le.unshift(q),_.value=le.slice(0,5)},T=q=>{var le;(le=l.value)==null||le.insertSpecialCharater(q)},P=(q,le)=>{var H;le&&((H=l.value)==null||H.insertSpecialCharater(q),A(q))},I=i.computed(()=>{var q;return(q=l.value)==null?void 0:q.isChecked}),M=()=>{var q;(q=l.value)==null||q.toggleSpellCheck()};return i.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",w)}),i.watch(s,q=>{!r.superTextElementId||r.superTextElementId===""||(g.value=q!==(r.superTextInit??""))}),(q,le)=>{const H=Ap,F=Tp,L=_p,K=hb,J=Sp,Y=kp,ne=Zq;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Y,{open:q.open},{default:i.withCtx(()=>[i.createVNode(i.unref(Z0),null,{default:i.withCtx(()=>[i.createVNode(i.unref(r1),{class:"!pointer-events-none bg-black/30"}),i.createVNode(J,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:i.withCtx(()=>{var we,xe,$e;return[i.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:i.normalizeStyle({transform:`translate(${c.x}px, ${c.y}px)`,top:"0px",left:"auto",right:"15px"})},[i.createVNode(L,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:i.withModifiers(b,["prevent"])},{default:i.withCtx(()=>[i.createVNode(H,null,{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.superinput")),1)]),_:1}),i.createVNode(F,{class:"absolute right-3 top-3 text-white",onClick:x},{default:i.withCtx(()=>[i.createVNode(i.unref(Ff),{class:"w-5 h-5"}),i.createElementVNode("span",Qq,i.toDisplayString(q.$t("editor.close")),1)]),_:1})]),_:1}),i.createElementVNode("div",Nq,[i.createElementVNode("div",eK,[le[4]||(le[4]=i.createElementVNode("label",null," ",-1)),i.createElementVNode("div",tK,[i.createVNode(yn,{class:"text-[#65558F] bg-[#ECE6F0] hover:bg-[#ECE6F0]/90 shadow text-xs rounded font-normal h-[25px] px-3",onClick:le[0]||(le[0]=Ee=>u.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.insert.symbol")),1)]),_:1}),i.createElementVNode("div",nK,[i.createVNode(fE,{id:"spellcheck",checked:i.unref(I),"onUpdate:checked":M},null,8,["checked"]),i.createElementVNode("label",rK,i.toDisplayString(i.unref(o)("editor.menubar.menu.spellCheck")),1)]),i.createElementVNode("div",oK,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(_),Ee=>(i.openBlock(),i.createBlock(yn,{key:Ee,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:We=>T(Ee)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(Ee),1)]),_:2},1032,["onClick"]))),128))])]),u.value?(i.openBlock(),i.createBlock(i.resolveDynamicComponent((we=i.unref(C))==null?void 0:we.component),{key:0,"custom-class":"!z-[70] !pointer-events-auto",class:i.normalizeClass(($e=(xe=i.unref(C))==null?void 0:xe.componentProps)==null?void 0:$e.class),onSelectedChar:P,onClose:le[1]||(le[1]=Ee=>u.value=!1)},null,40,["class"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",iK,[i.createElementVNode("label",sK,i.toDisplayString(i.unref(o)("editor.detail")),1),i.createVNode(mb,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":le[2]||(le[2]=Ee=>s.value=Ee),"parent-editor":q.editor,class:""},null,8,["modelValue","parent-editor"])]),i.createElementVNode("div",aK,[le[5]||(le[5]=i.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),i.createVNode(hl,{modelValue:a.value,"onUpdate:modelValue":le[3]||(le[3]=Ee=>a.value=Ee),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),i.createVNode(K,{class:"sm:justify-center pb-3.5 pt-1"},{default:i.withCtx(()=>[i.createVNode(yn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:E},{default:i.withCtx(()=>[i.createVNode(i.unref(ug),{class:"w-5 h-5 mr-2"}),i.createTextVNode(" "+i.toDisplayString(i.unref(o)("editor.check")),1)]),_:1}),i.createVNode(yn,{as:"button",variant:"destructive",onClick:x},{default:i.withCtx(()=>[i.createVNode(i.unref(Ff),{class:"w-5 h-5 mr-2"}),i.createTextVNode(" "+i.toDisplayString(q.$t("editor.close")),1)]),_:1})]),_:1})],4)]}),_:1})]),_:1})]),_:1},8,["open"]),i.createVNode(ne,{open:m.value,onClose:k},null,8,["open"])],64)}}}),gb=i.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Ot(),o=i.ref(!1),s=i.reactive({from:0,to:0,text:""}),a=i.inject("isEditable",i.ref(!0)),l=i.inject("canEditSuper",i.ref(!0)),u=i.computed(()=>n.mode===De.EDITOR||n.mode===De.PLAIN_TEXT||!l.value||n.disableSuperInput);function c(){if(!n.editor)return"";const{from:E,to:k}=n.editor.state.selection,C=n.editor.state.doc.cut(E,k),A=to.fromSchema(n.editor.schema).serializeFragment(C.content),T=document.createElement("div");return T.appendChild(A),T.innerHTML}const f=()=>{const{view:E}=n.editor,{from:k,to:C}=E.state.selection,_=c();s.text=_,s.from=k,s.to=C},p=()=>o.value=!o.value,m=()=>{u.value||(o.value=!0,f())},g=()=>o.value=!1,b=E=>{const k=n==null?void 0:n.superTextStore.addMoreSuperText(E);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":k,"data-text":E}}),o.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},y=i.ref(!1),w=async E=>{var k,C;if(E){const _=await((C=(k=n.editor).hasClipboard)==null?void 0:C.call(k));y.value=!!_}},x=()=>{if(u.value||!n.editor)return;const{view:E,state:k}=n.editor,{from:C,to:_}=k.selection;s.from=C,s.to=_,s.text="",E.dom.blur(),o.value=!0};return e({toggleDialog:p,openDialog:m,closeDialog:g}),(E,k)=>{const C=pc,_=pb,A=fb,T=db,P=cb;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(C,{open:o.value,editor:E.editor,"super-text-init":s.text,onClose:p,onSave:b},null,8,["open","editor","super-text-init"]),i.createVNode(P,{"onUpdate:open":w},{default:i.withCtx(()=>[i.createVNode(_,{as:"template",class:"relative",disabled:i.unref(u),onDblclick:i.withModifiers(x,["prevent","stop"])},{default:i.withCtx(()=>[i.renderSlot(E.$slots,"default")]),_:3},8,["disabled"]),i.createVNode(T,null,{default:i.withCtx(()=>[E.disableSuperInput?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(A,{key:0,onSelect:m},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.inputSuper")),1)]),_:1})),i.unref(a)?(i.openBlock(),i.createBlock(A,{key:1,onSelect:k[0]||(k[0]=I=>{var M;return(M=E.editor)==null?void 0:M.commands.cutContent()})},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.cut")),1)]),_:1})):i.createCommentVNode("",!0),i.unref(a)?(i.openBlock(),i.createBlock(A,{key:2,onSelect:k[1]||(k[1]=I=>{var M;return(M=E.editor)==null?void 0:M.commands.copyContent()})},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.copy")),1)]),_:1})):i.createCommentVNode("",!0),i.unref(a)?(i.openBlock(),i.createBlock(A,{key:3,disabled:!y.value,onSelect:k[2]||(k[2]=I=>{var M;return(M=E.editor)==null?void 0:M.commands.pasteContent()})},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),_:1})]),_:3})],64)}}});var ar=(t=>(t.TOGGLE_SUPER_TEXT="toggle-super-text",t.SUPER_TEXT_UPDATE_POSITION="SUPER_TEXT_UPDATE_POSITION",t.RENDER_SUPER_TEXT="RENDER_SUPER_TEXT",t.SUPER_VIEW_PAGE="SUPER_VIEW_PAGE",t.INCREASE_DECREASE_FONTSIZE="increase-decrease-fontsize",t))(ar||{});const lK={id:"editor-panel",class:"flex relative w-full h-full"},uK=Bo(i.defineComponent({__name:"PageNode",props:Ws,setup(t){const{state:e,page:n,superTextStore:r}=wn(),{size:o,pagination:s,margin:a}=n.value,l=i.ref(null),u=i.ref(t.node.attrs.viewSuperTextArea),c=i.computed(()=>u.value&&t.editor.storage.page.mode!=="editor"),f=i.computed(()=>t.editor.storage.page.mode===De.REPORT),{width:p,height:m}=o,g=i.computed(()=>s?`calc(${m} - ${(a==null?void 0:a.top)??0} - ${(a==null?void 0:a.bottom)??0}`:"max-content"),b=ht.useEventBus(ar.SUPER_VIEW_PAGE);return i.watch(()=>t.node.attrs,y=>{b.emit(y.pageNumber)},{immediate:!0}),(y,w)=>{var E,k,C,_;const x=gb;return i.openBlock(),i.createBlock(i.unref(Us),{id:y.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":y.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:i.normalizeStyle({"--umo-page-margin-top":((E=i.unref(a))==null?void 0:E.top)??"0","--umo-page-margin-bottom":((k=i.unref(a))==null?void 0:k.bottom)??"0","--umo-page-margin-left":((C=i.unref(a))==null?void 0:C.left)??"0","--umo-page-margin-right":((_=i.unref(a))==null?void 0:_.right)??"0","--umo-page-width":i.unref(p),"--umo-page-height":i.unref(m),"--empty-node-left":"0px",left:100,"min-height":typeof i.unref(m)=="number"?`${i.unref(m)}px`:i.unref(m),height:f.value?typeof i.unref(m)=="number"?`${i.unref(m)}px`:i.unref(m):"auto"})},{default:i.withCtx(()=>[i.createElementVNode("div",lK,[i.createVNode(x,{mode:c.value?i.unref(De).REPORT:i.unref(De).EDITOR,editor:y.editor,"super-text-store":i.unref(r)},{default:i.withCtx(()=>[i.createVNode(i.unref(aw),{class:"umo-page-node-content",style:i.normalizeStyle({height:g.value})},null,8,["style"])]),_:1},8,["mode","editor","super-text-store"])])]),_:1},8,["id","page-number","style"])}}}),[["__scopeId","data-v-7d55d7ea"]]);function pE(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(o=>e==null?void 0:e.includes(o.type.name));t.tr.ensureMarks(r)}}const cK=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=o.extensionManager.attributes,f=Op(c,l.node().type.name,l.node().attrs);if(f.id=Ng(),f.extend&&(f.extend=!1),s instanceof Le&&s.node.isBlock)return!l.parentOffset||!hr(a,l.pos)?!1:(r&&(t&&pE(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const p=u.parentOffset===u.parent.content.size;s instanceof Te&&e.deleteSelection();const m=l.depth===0?void 0:l4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=hr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&hr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(b=!0,g=m?[{type:m,attrs:f}]:void 0),b&&(g||(g=[{type:l.node().type,attrs:f}]),e.split(e.mapping.map(l.pos),1,g),m&&!p&&!l.parentOffset&&l.parent.type!==m)){const y=e.mapping.map(l.before()),w=e.doc.resolve(y);l.node(-1).canReplaceWith(w.index(),w.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&pE(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},dK=t=>({tr:e,state:n,dispatch:r,editor:o})=>{var y;const s=hn(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection instanceof Le?n.selection.node:null;if(u!=null&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const c=a.node(-1);if(c.type!==s)return!1;const f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let w=de.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-x;T>=a.depth-3;T-=1)w=de.from(a.node(T).copy(w));const E=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Op(f,a.node().type.name,a.node().attrs),C=((y=s.contentMatch.defaultType)==null?void 0:y.createAndFill(k))??void 0;w=w.append(de.from(s.createAndFill(null,C)??void 0));const _=a.before(a.depth-(x-1));e.replace(_,a.after(-E),new Ce(w,4-x,0));let A=-1;e.doc.nodesBetween(_,e.doc.content.size,(T,P)=>{if(A>-1)return!1;T.isTextblock&&T.content.size===0&&(A=P+1)}),A>-1&&e.setSelection(Te.near(e.doc.resolve(A))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,m=Op(f,c.type.name,c.attrs),g=Op(f,a.node().type.name,a.node().attrs);m.id=Ng(),g.id=Ng(),e.delete(a.pos,l.pos);const b=p?[{type:s,attrs:m},{type:p,attrs:g}]:[{type:s,attrs:m}];if(!hr(e.doc,a.pos,2))return!1;if(r){const{selection:w,storedMarks:x}=n,{splittableMarks:E}=o.extensionManager,k=x??(w.$to.parentOffset&&w.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!k||!r)return!0;const C=k.filter(_=>E.includes(_.type.name));e.ensureMarks(C)}return!0},fK=[eb,xp,Cp,tb,Ep,fs,rb,_l,ib,ab,ob,ua,ps,hs,sb,lb,nb,jr],pK=Bt.create({priority:200,name:`${jr}`,content:"block*",group:`${jr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:js(uK),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:pi(10)},pageNumber:{default:1},force:{default:!1},viewSuperTextArea:{default:!0},slots:{default:this.options.slots,renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){return["div",{...bt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:cK,splitListItem:dK,autoPaging:(t=!0)=>({tr:e,state:n,dispatch:r,editor:o})=>(r&&e.setMeta("runState",t),!0),setPageBreak:()=>({tr:t,state:e,dispatch:n,editor:r})=>(n&&t.setMeta("splitPage",!0),!0),togglePagePlugin:t=>({tr:e,dispatch:n})=>(e.setMeta("disablePage",t),n&&n(e),!0)}},addGlobalAttributes(){return[{types:fK.concat(this.options.types||[]),attributes:{id:{default:null},extend:{default:!1}}}]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:r})=>[()=>r.undoInputRule(),()=>r.command(({tr:o})=>{const{selection:s,doc:a}=o,{empty:l,$anchor:u}=s,{pos:c,parent:f}=u,p=Ve.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>hE(r),()=>r.joinBackward(),()=>r.selectNodeBackward(),()=>r.command(({editor:o,tr:s})=>{const{selection:a,doc:l}=s,{$anchor:u}=a,{pos:c}=u;if(l.childCount===1)return!1;if(Ve.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(jr);const f=ni(p=>p.type.name===jr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(jr);const p=f.node.firstChild.type;if(f.start+Ve.atStart(f.node).from===c){const g=Te.create(l,f.start-2,f.start-2),b=ni(y=>y.type.name===jr)(g);if(b){const y=Ve.atEnd(b.node).from+b.start,w=Te.create(l,y,y);if(p===b.node.lastChild.type){const{parent:x}=w.$anchor;return uq(x,o.schema)?s.setSelection(w):s.step(new fn(y,c,Ce.empty)),!0}s.setSelection(w)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>hE(r),()=>r.command(({tr:o})=>{const{selection:s,doc:a}=o,{$anchor:l}=s,u=l.node(),c=ni(f=>f.type.name===_l)(s);return c&&c.start+Ve.atStart(c.node).from===l.pos&&c.node.childCount===1&&u.content.size===0?!0:r.joinForward()}),()=>r.selectNodeForward(),()=>r.command(({tr:o})=>{const{selection:s,doc:a}=o,{$anchor:l}=s,{pos:u}=l;if(a.childCount===1)return!1;if(Ve.atEnd(a).from===u)return r.deleteNode(jr);const c=ni(f=>f.type.name===jr)(s);if(c&&c.start+Ve.atEnd(c.node).from===u){const p=Te.create(a,u+2,u+2),m=ni(g=>g.type.name===jr)(p);if(m){const g=Ve.atStart(m.node).from+m.start,b=Te.create(a,g,g);if(ni(w=>w.attrs.extend)(b))return o.step(new fn(u,g,Ce.empty)),!0}}return!1})]),Tab:()=>this.editor.commands.first(({commands:r})=>[()=>!0]),"Mod-Enter":()=>this.editor.commands.setPageBreak()}},addNodeView(){return this.options.View}});function Op(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const o=t.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}const hE=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,o=u4(r,{from:n.from,to:n.to},s=>s.type.name===_l);for(const s of o){const a=s.pos+s.node.nodeSize;if(n.from<s.pos||n.to>a)return!0}return t.deleteSelection()}),hK=Ze.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),mK=["data-font"],gK=i.defineComponent({__name:"FontFamilyMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""}},setup(t){const e=t,n=i.computed(()=>e.editor.extensionStorage["base-kit"].mode===De.EDITOR),{t:r}=Ot(),o=[{label:r("editor.fontFamily.gulim"),value:"Gulim"},{label:r("editor.fontFamily.dotum"),value:"Dotum"},{label:r("editor.fontFamily.gungsuh"),value:"Gungsuh"}],s=i.inject("fontFamily"),a=i.computed(()=>{const p=e.editor.extensionManager.extensions.find(g=>g.name==="fontFamily").options;return rt.isEmpty(p.fontFamilyMap)&&(p.fontFamilyMap=o),[{label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")},...p.fontFamilyMap]}),l=i.computed(()=>{const p={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?Zm(e.editor.state,"textStyle").fontFamily||p.value:s.value||p.value}),u=ht.useEventBus("fontFamily");function c(p){p.value===l.value||p.value===r("editor.fontFamily.default")?(e.editor.commands.unsetFontFamily(),s.value=null):(s.value=p.value,e.editor.commands.setFontFamily(p.value),u.emit())}const f=i.computed(()=>{var p;return(p=a.value.find(m=>m.value===l.value))==null?void 0:p.label});return(p,m)=>(i.openBlock(),i.createBlock(ia,{disabled:p.disabled,tooltip:p.tooltip,title:f.value,btn_class:`min-w-24 ${p.customClass}`},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(g,b)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b},[i.createVNode(i.unref(Cl),{checked:l.value===g.value,onClick:y=>c(g)},{default:i.withCtx(()=>[i.createElementVNode("span",{class:"ml-1 h-full","data-font":g.label,style:i.normalizeStyle({fontFamily:g.value??void 0})},i.toDisplayString(g.label),13,mK)]),_:2},1032,["checked","onClick"]),g.label===i.unref(r)("editor.fontFamily.default")?(i.openBlock(),i.createBlock(i.unref(fg),{key:0})):i.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),mE=hK.extend({name:"fontFamily",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontFamilyMap:[],button({editor:e,extension:n,t:r}){return{component:gK,componentProps:{editor:e,disabled:!e.can().setFontFamily(""),tooltip:r("editor.fontFamily.tooltip"),customClass:"border border-gray-300 rounded-none text-gray-500 px-2.5 h-[26px]"}}}}},addGlobalAttributes(){return[{types:["paragraph","heading","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.style.fontFamily||null,renderHTML:t=>t.style?{style:`font-family: ${t.style}`}:{}},fontFamily:{default:null,parseHTML:t=>t.style.fontFamily.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily}}),bK={class:"flex gap-2"},vK=["disabled"],yK=Bo(i.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=i.inject("fontSize"),n=i.computed(()=>e.value?parseInt(e.value)===parseInt(k0[0])||parseInt(e.value)<parseInt(k0[0]):!1),r=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE),o=s=>{r.emit(s)};return(s,a)=>{const l=bl,u=gl,c=vl;return i.openBlock(),i.createElementBlock("div",bK,[i.createVNode(c,null,{default:i.withCtx(()=>[i.createVNode(u,{"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(l,null,{default:i.withCtx(()=>[i.createElementVNode("button",{class:"btn",onClick:a[0]||(a[0]=f=>o(!0))},[i.createVNode(i.unref(Lt),{name:"Plus",class:"w-6 h-6"})])]),_:1}),i.createVNode(i.unref(ta),null,{default:i.withCtx(()=>a[2]||(a[2]=[i.createTextVNode(" 글꼴 크기 크게 ")])),_:1})]),_:1})]),_:1}),i.createVNode(c,null,{default:i.withCtx(()=>[i.createVNode(u,{"delay-duration":0},{default:i.withCtx(()=>[i.createVNode(l,null,{default:i.withCtx(()=>[i.createElementVNode("button",{class:"btn",onClick:a[1]||(a[1]=f=>o(!1)),disabled:i.unref(n)},[i.createVNode(i.unref(Lt),{name:"Minus",class:"w-6 h-6"})],8,vK)]),_:1}),i.createVNode(i.unref(ta),null,{default:i.withCtx(()=>a[3]||(a[3]=[i.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),wK=Dn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:yK,componentProps:{editor:t}}}}},addAttributes(){return{size:{default:this.options.defaultSize,parseHTML:t=>t.style.fontSize||this.options.defaultSize,renderHTML:t=>t.size?{style:`font-size: ${t.size}`}:{}}}},addCommands(){return{setFontSizeIncreaseDecrease:t=>({commands:e})=>e.setMark("textStyle",{fontSize:t})}}}),bb=Ze.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{action:()=>{e.commands.setPainter(e==null?void 0:e.state.selection.$head.marks())},icon:"PaintRoller",tooltip:r("editor.format")}})}},addCommands(){return{setPainter:t=>({view:{dispatch:e,state:{tr:n},dom:r}})=>{const a=`url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M9 22v-6H4V7q0-1.65 1.175-2.825T8 3h12v13h-5v6zM6 10h12V5h-1v4h-2V5h-1v2h-2V5H8q-.825 0-1.412.588T6 7zm0 4h12v-2H6zm0 0v-2z"/></svg>')}"), auto`;return r.style.cursor=a,e(n.setMeta("painterAction",{type:"start",marks:t})),!0}}},addProseMirrorPlugins(){return[new tt({key:new kt("format-painter"),state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta("painterAction");return n&&n.type==="start"?e=n.marks:n&&n.type==="end"&&(e=[]),e}},props:{handleDOMEvents:{mousedown(t,e){const n=this.getState(t.state);if(!n||n.length==0)return t.dom.style.cursor="",!1;const r=()=>{document.removeEventListener("mouseup",r);const{dispatch:o,state:{selection:s},dom:a}=t;let l=t.state.tr;a.style.cursor="",l=l.removeMark(s.from,s.to);for(const u of n)u.type.name!="link"&&(l=l.addMark(s.from,s.to,u));o(l.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}}),vb=()=>pi(10),gE=new kt("attrkey"),xK=t=>new tt({key:gE,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,o){const{tr:s}=o;let a=!1;const l=gE.getState(o);if(n.some(c=>c.getMeta("composition")))return null;if(l||n.some(c=>c.docChanged)){const c=[];o.doc.descendants((f,p,m,g)=>{const{attrs:b}=f,y=c.includes(b.id)?vb():b.id||vb();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...b,id:y,"number-line":g+1}),a=!0),c.push(y)})}return a?s:null}}),bE=[eb,xp,Cp,tb,Ep,fs,rb,_l,ib,ab,ob,ua,ps,hs,sb,lb,nb,jr],CK=Ze.create({name:"autoId",addGlobalAttributes(){return[{types:bE.concat(this.options.types||[]),attributes:{id:{default:vb()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[xK(bE.concat(this.options.types||[]))]}}),EK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,kK=Bt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",bt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[g4({find:EK,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),SK=["src","alt"],_K={key:0,class:"image-resizer"},TK=["onMousedown","onTouchstart"],AK=i.defineComponent({__name:"ImageView",props:{...Ws,selected:{type:Boolean,required:!0}},setup(t){const e=t,n={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},r=i.ref({width:uw,height:uw}),o=i.ref({width:0,height:0}),s=i.ref(!1),a=i.ref({x:0,y:0,w:0,h:0,dir:""}),l=i.computed(()=>{const{src:k,alt:C,width:_,height:A,flipX:T,flipY:P}=e.node.attrs,I=[];T&&I.push("rotateX(180deg)"),P&&I.push("rotateY(180deg)");const M=I.join(" ");return{src:k||void 0,alt:C||void 0,style:{width:S0(_)?`${_}px`:_,height:S0(A)?`${A}px`:A,transform:M||"none"}}});i.computed(()=>({width:i.unref(l).style.width==="100%"?"100%":void 0}));const u=i.ref(null),c=new ResizeObserver(k=>{for(const C of k){const{width:_,height:A}=C.contentRect;o.value={width:_,height:A},e.updateAttributes({originWidth:_,originHeight:A})}});function f(){const{editor:k,getPos:C}=e;k.commands.setNodeSelection(C())}const p=rt.throttle(()=>{const{editor:k}=e;r.value.width=parseInt(getComputedStyle(k.view.dom).width,10)},cw);function m(k,C){k.preventDefault(),k.stopPropagation();let _=0,A=0;const T=document.querySelector(".image-resizer");if(T&&(T.style.borderColor="#3b82f6"),"touches"in k&&k.touches.length>0)_=k.touches[0].clientX,A=k.touches[0].clientY;else if("clientX"in k)_=k.clientX,A=k.clientY;else return;const{width:P,height:I}=i.unref(o),M=P/I;let j=Number(e.node.attrs.width)||P,U=Number(e.node.attrs.height)||Math.round(j/M);const q=i.unref(r).width;j=Math.min(j>q?q:j,q),U=Math.round(j/M),Object.assign(a.value,{x:_,y:A,w:j,h:U,dir:C}),s.value=!0,y()}const g=rt.throttle(k=>{if(!i.unref(s))return;let C=0;if("touches"in k&&k.touches.length>0)C=k.touches[0].clientX;else if("clientX"in k)C=k.clientX;else return;const{x:_,w:A,dir:T}=i.unref(a),P=(C-_)*(/l/.test(T)?-1:1),I=jB(A+P,DB,i.unref(r).width);e.updateAttributes({width:I})},cw),b=k=>{k.preventDefault(),k.stopPropagation();const C=document.querySelector(".image-resizer");C&&(C.style.borderColor=""),i.unref(s)&&(s.value=!1,Object.assign(a.value,{x:0,y:0,w:0,h:0,dir:""}),w(),f())};function y(){document.addEventListener("mousemove",g,!0),document.addEventListener("mouseup",b,!0),document.addEventListener("touchmove",g,!0),document.addEventListener("touchend",b,!0)}function w(){document.removeEventListener("mousemove",g,!0),document.removeEventListener("mouseup",b,!0),document.removeEventListener("touchmove",g,!0),document.removeEventListener("touchend",b,!0)}const x=new ResizeObserver(p),E=i.computed(()=>{const{textAlign:k}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[k]||""});return i.onMounted(()=>{u.value&&c.observe(u.value),x.observe(e.editor.view.dom)}),i.onBeforeUnmount(()=>{w(),c.disconnect(),x.disconnect()}),(k,C)=>(i.openBlock(),i.createBlock(i.unref(Us),{class:"node-image"},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"image-view",style:i.normalizeStyle([{width:l.value.style.width,height:l.value.style.height},E.value])},[i.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:i.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":s.value},"image-view__body"])},[i.createElementVNode("img",{ref_key:"imageRef",ref:u,src:l.value.src,alt:l.value.alt,class:"block w-full image-view__body__image",style:i.normalizeStyle([{transform:l.value.style.transform}]),onClick:f},null,12,SK),k.editor.view.editable?i.withDirectives((i.openBlock(),i.createElementBlock("div",_K,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(Object.values(n),_=>(i.openBlock(),i.createElementBlock("span",{key:_,class:i.normalizeClass([`image-resizer__handler--${_}`,"image-resizer__handler"]),onMousedown:A=>m(A,_),onTouchstart:i.withModifiers(A=>m(A,_),["prevent"])},null,42,TK))),128))],512)),[[i.vShow,t.selected||s.value]]):i.createCommentVNode("",!0)],2)],4)]),_:1}))}}),OK=Bo(AK,[["__scopeId","data-v-6435a6f3"]]),yb=kK.extend({group:"block",defining:!0,isolating:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:e=>e.style.textAlign||e.getAttribute("textAlign")||null,renderHTML:e=>({textAlign:e.textAlign})},width:{default:"100%",parseHTML:e=>{const n=e.style.width||e.getAttribute("width")||null;return n&&n.endsWith("%")?n:n==null?null:parseInt(n,10)},renderHTML:e=>({width:e.width})},class:{default:"",parseHTML:e=>e.getAttribute("class")||"",renderHTML:e=>({class:e.class})},"data-memo":{default:"",parseHTML:e=>e.getAttribute("data-memo")||"",renderHTML:e=>({"data-memo":e["data-memo"]})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this)}},addNodeView(){return js(OK)},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),updateImage:e=>({commands:n,editor:r})=>n.updateAttributes(this.name,e)}},renderHTML({node:t,HTMLAttributes:e}){const{textAlign:n,flipX:r,flipY:o}=t.attrs,l=`${{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[n]||""} ${r||o?`transform: rotateX(${r?"180":"0"}deg) rotateY(${o?"180":"0"}deg);`:""}`;return["img",bt({height:"auto",style:l},this.options.HTMLAttributes,e)]},parseHTML(){return[{tag:"img[src]"}]},addProseMirrorPlugins(){return[new tt({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof Le&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof Le&&e.node.type.name==="image"}}})]}}),MK=["paragraph","heading","list_item","todo_item"];function BK(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Te||n instanceof Rn))return t;const{from:o,to:s}=n,a=[],l=e&&e!==dw?e:null;return r.nodesBetween(o,s,(u,c)=>{const f=u.type;return MK.includes(f.name)?((u.attrs.lineHeight||null)!==l&&a.push({node:u,pos:c,nodeType:f}),f.name!=="list_item"&&f.name!=="todo_item"):!0}),a.length&&a.forEach(u=>{const{node:c,pos:f,nodeType:p}=u;let{attrs:m}=c;m={...m,lineHeight:l},t=t.setNodeMarkup(f,p,m,c.marks)}),t}function IK(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:o}=e;return o=o.setSelection(r),o=BK(o,t),o.docChanged?(n&&n(o),!0):!1}}const RK=i.defineComponent({__name:"LineHeightDropdown",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const{t:e}=Ot();function n(l){return parseFloat(l.replace("%",""))/100}const r=i.computed(()=>{const c=s.editor.extensionManager.extensions.find(f=>f.name==="lineHeight").options.lineHeights.map(f=>({label:n(f),value:f}));return c.unshift({label:i.unref(e)("editor.default"),value:"default"}),c}),o=i.ref("default"),s=t;function a(l){l==="default"?s.editor.commands.unsetLineHeight():s.editor.commands.setLineHeight(l),o.value=l}return(l,u)=>(i.openBlock(),i.createBlock(ia,{icon:l.icon,tooltip:l.tooltip,disabled:l.disabled},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(c,f)=>(i.openBlock(),i.createBlock(i.unref(Cl),{key:f,checked:c.value===o.value,onClick:p=>a(c.value)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.label),1)]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),vE=Ze.create({name:"lineHeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:dw,button({editor:e,t:n}){return{component:RK,componentProps:{editor:e,icon:"LineHeight",tooltip:n("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight||this.options.defaultHeight,renderHTML:t=>t.lineHeight===this.options.defaultHeight||!t.lineHeight?{}:{style:`line-height: ${t.lineHeight}`}}}}]},addCommands(){return{setLineHeight:t=>IK(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),LK=Bt.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",bt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var ca=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(ca||{});const wb=Bt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),layout:"two-column"}},addAttributes(){return{layout:{default:"two-column"}}},addCommands(){return{setColumns:()=>({commands:t})=>(t.insertContent('<div data-type="columns"><div data-type="column" data-position="left"><p></p></div><div data-type="column" data-position="right"><p></p></div></div>'),!0),setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addExtensions(){return[LK.configure(this.options.columnOptions)]}});function PK(t){let e=t;for(;e&&e!==document.body;){if(e.nodeType===1){const n=e;if(n.id==="editor-panel")return n}e=e.parentNode}return null}const Mp=t=>{var n;if(!t)return!0;const e=document.createElement("div");return e.innerHTML=t,((n=e==null?void 0:e.textContent)==null?void 0:n.trim())===""},DK=t=>{if(!t)return"";const{from:e,to:n}=t.state.selection,r=t.state.doc.cut(e,n),s=to.fromSchema(t.schema).serializeFragment(r.content),a=document.createElement("div");return a.appendChild(s),a.innerHTML},yE=8;function VK(t){const e=i.ref(!1);let n=!1,r=null,o=null,s=null,a=null,l=0,u=0;function c(x){const E=x.cloneNode(!0);return E.style.position="fixed",E.style.pointerEvents="none",E.style.opacity="0.9",E.style.zIndex="9999",E.style.transform="translate(-50%, -50%)",E.style.left="0px",E.style.top="0px",document.body.appendChild(E),E}function f(){o&&o.parentElement&&o.parentElement.removeChild(o),o=null}function p(){try{if(typeof t.getPos=="function"){const x=t.getPos();if(typeof x=="number"&&x>=0)return x}}catch{}return null}function m(x,E){e.value||(a=p(),document.body.style.userSelect="none",document.body.style.touchAction="none",E&&(o=c(E),o.style.left=`${x.clientX}px`,o.style.top=`${x.clientY}px`),e.value=!0,n=!1,s=null)}function g(){r=null,a=null,s=null,n=!1,e.value=!1,f(),document.body.style.userSelect="",document.body.style.touchAction=""}function b(x){if(e.value)return;const E=x.changedTouches[0];r=E.identifier,l=E.clientX,u=E.clientY,n=!0,a=null,s=null}function y(x){var A;if(!n&&!e.value||r===null)return;const E=Array.from(x.changedTouches).find(T=>T.identifier===r);if(!E)return;const k=E.clientX-l,C=E.clientY-u,_=k*k+C*C;if(!e.value&&n&&_>=yE*yE){const T=x.currentTarget||x.target||null;m(E,T)}if(e.value){o&&(o.style.left=`${E.clientX}px`,o.style.top=`${E.clientY}px`);try{const T=(A=t.editor)==null?void 0:A.view;if(!T){s=null;return}const P=T.posAtCoords({left:E.clientX,top:E.clientY});P&&typeof P.pos=="number"?s=P.pos:s=null}catch{s=null}}}async function w(x){var E;if(e.value){if(document.body.style.userSelect="",document.body.style.touchAction="",f(),e.value=!1,a===null||s===null){g();return}const k=(E=t.editor)==null?void 0:E.view;if(!k){g();return}const C=k.state.doc.nodeAt(a);if(!C){g();return}const _=C.nodeSize,A=a,T=A+_,P=s;if(P>=A&&P<=T){g();return}let I=P;P>A&&(I=P-_);const M=k.state.doc.content.size;I<0&&(I=0),I>M&&(I=M);const j=C.type.create(C.attrs),U=k.state.tr;U.delete(A,T),U.insert(I,j),k.dispatch(U),g();return}if(n){g();return}}return{onTouchStart:b,onTouchMove:y,onTouchEnd:w}}function FK(...t){return k2(Kh(t))}const $K=["innerHTML"],zK=["book-mark-node-id","book-mark-content","node-id","element-id","line-id"],HK=i.defineComponent({__name:"SuperText",props:Ws,setup(t){const e=t,n=i.ref(!1),r=i.inject("isMobile",!1),o=ht.useEventBus(ar.RENDER_SUPER_TEXT),{onTouchStart:s,onTouchMove:a,onTouchEnd:l}=VK(e),u=i.computed(()=>{const k=e.getPos(),C=e.editor.state.doc.resolve(k);for(let _=C.depth;_>0;_--){const A=C.node(_);if(A.type.name==="paragraph")return A}return null}),c=i.computed(()=>{var k;return((k=u.value)==null?void 0:k.attrs.id)||""}),f=i.inject("canEditSuper",i.ref(!0));function p(k){var I,M;if(Mp(k)){b();return}const C=e.getPos(),_=(I=e.editor)==null?void 0:I.state.doc.nodeAt(C),A=k.trim(),{[Qe.ELEMENT_ID]:T,...P}=(_==null?void 0:_.attrs)||{};(M=e.editor)==null||M.view.dispatch(e.editor.state.tr.setNodeMarkup(C,void 0,{...P,[Qe.TEXT]:A})),requestAnimationFrame(()=>{e.editor.commands.setTextSelection(C+1),e.editor.view.focus()})}function m(k){const C=e.node.attrs[Qe.TEXT],_=e.node.attrs[Qe.ID],T={lineId:k.target.querySelector(`[node-id="${_}"]`).getAttribute("line-id"),dataId:_,text:C};o.emit({action:"hover",payload:T})}function g(k){const C=e.node.attrs[Qe.ID],A={lineId:k.target.querySelector(`[node-id="${C}"]`).getAttribute("line-id"),dataId:C,text:""};o.emit({action:"hover",payload:A})}function b(){const{getPos:k,node:C,editor:_}=e,A=k(),T=A+1;_.commands.deleteRange({from:A,to:T})}function y(){if(!f.value)return;const{attributes:k}=e.editor.options.editorProps;if(k&&k.id===or.COMMENT){const C=document.getElementById(or.COMMENT);if((C==null?void 0:C.getAttribute(or.DISABLE_SUPER_INPUT))==="true")return}e.editor.view.dom.blur(),n.value=!0}function w(){e.editor.commands.setSuperTextContent(e.node.attrs[Qe.TEXT],e.node.attrs[Qe.POSITION]),e.editor.commands.toggleSuperInputMoblie()}const x=i.computed(()=>e.editor.storage.superText.enable);i.watch(x,k=>{e.editor.setEditable(!k),k?e.editor.view.dom.classList.add("super-text-view-mode"):e.editor.view.dom.classList.remove("super-text-view-mode")});const E=i.computed(()=>`{${e.node.attrs[Qe.TEXT].replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p[^>]*>/g,"").trim()}}`);return(k,C)=>{const _=yn,A=pb,T=fb,P=db,I=cb,M=pc;return i.openBlock(),i.createBlock(i.unref(Us),{as:"span",class:i.normalizeClass(i.unref(FK)("text-inherit super-text shrink-0 inline-flex items-center justify-center",i.unref(r)&&x.value&&"block")),"data-drag-handle":"",draggable:i.unref(f)||!x.value,onPointerdown:C[2]||(C[2]=i.withModifiers(()=>{},["stop"])),onTouchstartPassive:i.unref(s),onTouchmovePassive:i.unref(a),onTouchendPassive:i.unref(l),onTouchcancelPassive:i.unref(l)},{default:i.withCtx(()=>[i.unref(r)&&!x.value?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:i.withModifiers(w,["stop"]),class:"w-5 inline-flex justify-center rounded text-ed-red-500 active:bg-ed-accent"},[i.createVNode(i.unref(Lt),{name:"fileEdit2"})])):i.createCommentVNode("",!0),i.unref(r)&&x.value?(i.openBlock(),i.createElementBlock("div",{key:1,innerHTML:E.value,onClick:i.withModifiers(w,["stop"]),class:"super-text-view-mode-item"},null,8,$K)):i.createCommentVNode("",!0),i.unref(r)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(I,{key:2},{default:i.withCtx(()=>[i.createVNode(A,{as:"template",class:"relative",disabled:!i.unref(f)},{default:i.withCtx(()=>[i.createVNode(_,{class:i.normalizeClass([{"pointer-events-none":!i.unref(f)},"!p-0 !m-0 !h-fit"]),variant:"ghost",onDblclick:i.withModifiers(y,["stop"]),onMouseenter:m,onMouseleave:g},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{name:"fileEdit"}),i.createElementVNode("div",{ref:"bookMarkRef","book-mark-node-id":e.node.attrs[i.unref(Qe).ID],"book-mark-content":e.node.attrs[i.unref(Qe).TEXT],"node-id":e.node.attrs[i.unref(Qe).ID],"element-id":e.node.attrs[i.unref(Qe).ELEMENT_ID],"line-id":c.value},null,8,zK)]),_:1},8,["class"])]),_:1},8,["disabled"]),i.createVNode(P,null,{default:i.withCtx(()=>[i.createVNode(T,{onSelect:C[0]||(C[0]=j=>n.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(k.$t("editor.super.edit")),1)]),_:1}),i.createVNode(T,{onSelect:b},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(k.$t("editor.super.delete")),1)]),_:1})]),_:1})]),_:1})),i.unref(r)?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(M,{key:3,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[i.unref(Qe).TEXT],"super-text-element-id":e.node.attrs[i.unref(Qe).ELEMENT_ID],onClose:C[1]||(C[1]=j=>n.value=!1),onSave:p},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class","draggable","onTouchstartPassive","onTouchmovePassive","onTouchendPassive","onTouchcancelPassive"])}}}),UK=new tt({props:{handleKeyDown(t,e){var n;if(e.key==="Backspace"){const{state:r,dispatch:o}=t,{$from:s}=r.selection;if(s.parentOffset===1){const u=s.nodeAfter;if(u&&u.type.name==="superText"){const c=r.tr;c.delete(s.pos-1,s.pos);const f=r.schema.text("");return c.insert(s.pos-1,de.from(f)),c.setSelection(Te.create(c.doc,s.pos)),o(c),e.preventDefault(),!0}}const a=s.nodeBefore,l=s.nodeAfter;if(a&&a.isText&&((n=a.text)==null?void 0:n.length)===1&&l&&l.type.name==="superText"){const u=s.parent.childBefore(s.parentOffset-1).node;if(u&&u.type.name==="superText"){const c=r.tr;return c.delete(s.pos-1,s.pos),c.setSelection(Te.create(c.doc,s.pos-1)),o(c),e.preventDefault(),!0}}}return!1}}}),WK=new tt({appendTransaction(t,e,n){const r=new Set;let o=n.tr,s=!1;return n.doc.descendants((a,l)=>{if(a.type.name===hc){const u=a.attrs[Qe.ID];if(!u||r.has(u)){const c=pi();o=o.setNodeMarkup(l,void 0,{...a.attrs,[Qe.ID]:c}),s=!0,r.add(c)}else r.add(u)}}),s?o:null}}),hc="superText",wE={UPDATE:"superTextUpdate"},xE=Bt.create({name:"superText",inline:!0,group:"inline",selectable:!1,defining:!0,draggable:!0,addStorage(){return{enable:!0,isShowSuperInputMoblie:!1,view:!0,items:[],toggleSuperViewMobileCallBack:this.options.toggleSuperViewMobileCallBack,bottomSheetComponent:this.options.bottomSheetComponent,addToast:this.options.addToast,superTextContent:"",superTextPosition:""}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>n?[{component:Ke,componentProps:{action:()=>{t.commands.toggleSuperInputMoblie()},isActive:()=>{},icon:"fileEdit",title:e("editor.menubar.menu.insertSuper"),tooltip:e("editor.menubar.menu.insertSuper"),customClass:"whitespace-nowrap !bg-ed-blue active:!bg-ed-blue/90 !transition-none !text-white !font-normal rounded-[3px] h-[26px] ml-auto",customClassTooltip:"ml-auto"}}]:[{component:Ke,componentProps:{action:()=>t.commands.toggleSuperTextView(),isActive:()=>t.storage.superText.enable,title:e("editor.menubar.menu.superView"),customClass:`whitespace-nowrap !text-white !font-normal rounded-[3px] h-[26px]
|
|
291
291
|
${t.storage.superText.enable?"!bg-blue-700":"!bg-blue-500"}
|
|
292
|
-
`,tooltip:"수퍼 보기"}}]}},addAttributes(){return{[Qe.ID]:{default:null},[Qe.TEXT]:{default:""},[Qe.POSITION]:{default:"0"},[Qe.ELEMENT_ID]:{default:""}}},addCommands(){return{toggleSuperTextView:()=>({editor:t})=>t.storage.superText.enable=!t.storage.superText.enable,toggleSuperInputMoblie:()=>({editor:t})=>t.storage.superText.bottomSheetComponent?t.storage.superText.isShowSuperInputMoblie=!t.storage.superText.isShowSuperInputMoblie:(console.error("Please configure bottomSheetComponent!"),!1),setSuperTextContent:(t,e)=>({editor:n})=>(n.storage.superText.superTextContent=t,n.storage.superText.superTextPosition=e,!!t)}},parseHTML(){return[{tag:"button.super-text"}]},renderHTML({HTMLAttributes:t}){return["button",bt(t,{class:"super-text"})]},addNodeView(){return js(HK)},addProseMirrorPlugins(){return[new tt({appendTransaction(t,e,n){let r=n.tr,o=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="superText"){const l=s.attrs[Qe.POSITION],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,[Qe.POSITION]:u}),o=!0)}}),o?r:null}}),new tt({filterTransaction(t,e){return t.steps.some(r=>{if(r.toJSON&&r.toJSON().stepType==="replace"){const o=r.toJSON();return o.slice&&o.slice.content&&o.slice.content.some(s=>s.type===hc)}return!1})&&t.setMeta(wE.UPDATE,!0),!0}}),UK,WK]}}),CE=i.defineComponent({__name:"DialogDescription",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(sL),i.mergeProps(i.unref(r),{class:i.unref(ke)("text-sm text-ed-muted-foreground",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default")]),_:3},16,["class"]))}}),jK={class:"flex gap-x-2 items-center"},qK={class:"sr-only"},KK={class:"flex justify-end gap-x-2.5 flex-1"},GK=["disabled"],EE=Bo(i.defineComponent({__name:"SuperInputDialogMoblie",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextId:{},superTextElementId:{},isViewMode:{type:Boolean},title:{}},emits:["close","save","delete"],setup(t,{emit:e}){const n=e,r=t,{t:o}=Ot(),s=i.ref(""),a=i.ref(!1),l=i.ref(r.isViewMode??!1),u=i.ref(!1);i.watch(()=>r.isViewMode,g=>{l.value=g,g||(s.value="")});const c=i.computed(()=>{var b;if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,((b=g==null?void 0:g.textContent)==null?void 0:b.trim())===""});i.watch(()=>r.open,()=>{r.open&&r.superTextInit&&(s.value=r.superTextInit)});const f=()=>{n("close"),a.value=!1,l.value=!0,u.value=!1},p=()=>{n("save",s.value),s.value="",l.value=!0,u.value=!1},m=()=>{u.value=!0,l.value=!1};return(g,b)=>{const y=Ap,w=Tp,x=_p,E=CE,k=hb,C=Sp,_=kp;return i.openBlock(),i.createBlock(_,{open:g.open},{default:i.withCtx(()=>[i.createVNode(C,{isOverlayTransparent:"",class:"p-2.5 gap-0 gap-y-2.5 border-none w-[calc(100%-40px)] !shadow-ed rounded-[5px]"},{default:i.withCtx(()=>[i.createVNode(x,{class:"text-left flex-row justify-between"},{default:i.withCtx(()=>[i.createVNode(y,{class:"text-base font-normal"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(g.title?g.title:i.unref(o)("editor.superinput")),1)]),_:1}),i.createElementVNode("div",jK,[i.withDirectives(i.createElementVNode("button",{onClick:m},[i.createVNode(i.unref(N1),{icon:"lucide:edit-2"})],512),[[i.vShow,l.value]]),i.createVNode(w,{class:"outline-none",onClick:f},{default:i.withCtx(()=>[i.createVNode(i.unref(Ff),{class:"w-5 h-5"}),i.createElementVNode("span",qK,i.toDisplayString(i.unref(o)("editor.close")),1)]),_:1})])]),_:1}),i.createVNode(E,{class:"hidden"}),i.createVNode(mb,{isReadOnly:l.value,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=A=>s.value=A),"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["isReadOnly","modelValue","parent-editor"]),i.createVNode(k,{class:"flex-row justify-between"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("button",{onClick:b[1]||(b[1]=A=>n("delete"))},i.toDisplayString(i.unref(o)("editor.delete")),513),[[i.vShow,u.value]]),i.withDirectives(i.createElementVNode("div",KK,[i.createElementVNode("button",{onClick:f},i.toDisplayString(i.unref(o)("editor.menubar.menu.cancel")),1),i.createElementVNode("button",{onClick:p,disabled:i.unref(c),class:i.normalizeClass({"cursor-not-allowed":i.unref(c)})},i.toDisplayString(i.unref(o)("editor.menubar.menu.save")),11,GK)],512),[[i.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-2f4982a0"]]),XK=["innerHTML"],YK=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],JK=i.defineComponent({__name:"ConfigPlan",props:Ws,setup(t){const e=t,n=i.ref(!1),r=i.ref(null),{selection:o,doc:s}=e.editor.state,a=i.inject("isMobile"),l=i.ref(!1),u=ht.useEventBus(ar.RENDER_SUPER_TEXT),c=i.computed(()=>{var _,A;const x=s.resolve(o.from),E=x==null?void 0:x.node(-1),k=(_=E==null?void 0:E.attrs)==null?void 0:_.id,C=(A=E==null?void 0:E.attrs)==null?void 0:A.pageNumber;return{pageId:k,pageNumber:C}}),f=i.computed(()=>{const x=e.getPos(),E=e.editor.state.doc.resolve(x);for(let k=E.depth;k>0;k--){const C=E.node(k);if(C.type.name==="paragraph")return C}return null}),p=i.computed(()=>{var x;return((x=f.value)==null?void 0:x.attrs.id)||""});function m(x){e.updateAttributes({"data-text":x}),n.value=!1}function g(x){const E=e.node.attrs[Qe.TEXT],k=e.node.attrs[Qe.ID],_={lineId:x.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:E};u.emit({action:"hover",payload:_})}function b(x){const E=e.node.attrs[Qe.ID],C={lineId:x.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:C})}function y(){const{getPos:x,node:E,editor:k}=e,C=x(),_=C+1;k.commands.deleteRange({from:C,to:_})}function w(){n.value=!0,a&&(l.value=!0)}return(x,E)=>{const k=yn,C=pb,_=fb,A=db,T=cb,P=pc;return i.openBlock(),i.createBlock(i.unref(Us),{as:"span",class:i.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":i.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:i.withCtx(()=>[i.createVNode(T,null,{default:i.withCtx(()=>[i.createVNode(C,{as:"template",class:"relative"},{default:i.withCtx(()=>[i.createVNode(k,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:w,onMouseenter:g,onMouseleave:b},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{name:"plan",class:i.normalizeClass({"w-[18px] h-auto pr-1":i.unref(a)})},null,8,["class"]),E[3]||(E[3]=i.createTextVNode(" [")),i.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[i.unref(Qe).TEXT]},null,8,XK),E[4]||(E[4]=i.createTextVNode("] ")),i.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[i.unref(Qe).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[i.unref(Qe).TEXT],"node-id":e.node.attrs[i.unref(Qe).ID],"line-id":p.value},null,8,YK)]),_:1})]),_:1}),i.createVNode(A,null,{default:i.withCtx(()=>[i.createVNode(_,{onSelect:E[0]||(E[0]=I=>n.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(x.$t("editor.configPlan.edit")),1)]),_:1}),i.createVNode(_,{onSelect:y},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(x.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),i.unref(a)?(i.openBlock(),i.createBlock(EE,{key:1,title:x.$t("editor.configPlan"),open:n.value,"is-view-mode":l.value,editor:e.editor,"super-text-init":e.node.attrs[i.unref(Qe).TEXT],"super-text-id":e.node.attrs[i.unref(Qe).ID],onClose:E[2]||(E[2]=I=>n.value=!1),onSave:m,onDelete:y},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(i.openBlock(),i.createBlock(P,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[i.unref(Qe).TEXT],"super-text-element-id":e.node.attrs[i.unref(Qe).ELEMENT_ID],onClose:E[1]||(E[1]=I=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),kE=Bt.create({name:"configPlan",inline:!0,group:"inline",atom:!0,draggable:!0,addStorage(){return{isShowConfigPlanInput:!1}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>[...n?[{component:Ke,componentProps:{action:()=>{t.commands.toggleConfigPlanInput()},isActive:()=>{},icon:"plan",title:e("editor.insertConfigPlan"),tooltip:e("editor.insertConfigPlan"),customClass:"whitespace-nowrap !bg-ed-blue !text-white !font-normal rounded-[3px] h-[26px] gap-x-1 ml-auto",customClassTooltip:"ml-auto"}}]:[]]}},addAttributes(){return{"data-id":{default:null},"data-text":{default:""},"data-position":{default:"0"}}},addCommands(){return{toggleConfigPlanInput:()=>({editor:t})=>t.storage.configPlan.isShowConfigPlanInput=!t.storage.configPlan.isShowConfigPlanInput}},parseHTML(){return[{tag:"button.config-plan"}]},renderHTML({HTMLAttributes:t}){return["button",bt(t,{class:"config-plan"})]},addNodeView(){return js(JK)},addProseMirrorPlugins(){return[new tt({appendTransaction(t,e,n){let r=n.tr,o=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="configPlan"){const l=s.attrs["data-position"],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,"data-position":u}),o=!0)}}),o?r:null}})]}});var xb,Cb;if(typeof WeakMap<"u"){let t=new WeakMap;xb=e=>t.get(e),Cb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;xb=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},Cb=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var rn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,a=o+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;a<this.height&&this.map[e+this.width*l]==n;l++)a++;return{left:r,top:o,right:s,bottom:a}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:s,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[s*this.width+(n<0?r-1:o)]:(n<0?s==0:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:s}=this.findCell(t),{left:a,right:l,top:u,bottom:c}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(o,u),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const s=r*this.width+o,a=this.map[s];n[a]||(n[a]=!0,!(o==t.left&&o&&this.map[s-1]==a||r==t.top&&r&&this.map[s-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const s=o+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const l=(t+1)*this.width;for(;a<l&&this.map[a]<o;)a++;return a==l?s-1:this.map[a]}o=s}}static get(t){return xb(t)||Cb(t,ZK(t))}};function ZK(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=QK(t),n=t.childCount,r=[];let o=0,s=null;const a=[];for(let c=0,f=e*n;c<f;c++)r[c]=0;for(let c=0,f=0;c<n;c++){const p=t.child(c);f++;for(let b=0;;b++){for(;o<r.length&&r[o]!=0;)o++;if(b==p.childCount)break;const y=p.child(b),{colspan:w,rowspan:x,colwidth:E}=y.attrs;for(let k=0;k<x;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:x-k});break}const C=o+k*e;for(let _=0;_<w;_++){r[C+_]==0?r[C+_]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:w-_});const A=E&&E[_];if(A){const T=(C+_)%e*2,P=a[T];P==null||P!=A&&a[T+1]==1?(a[T]=A,a[T+1]=1):P==A&&a[T+1]++}}}o+=w,f+=y.nodeSize}const m=(c+1)*e;let g=0;for(;o<m;)r[o++]==0&&g++;g&&(s||(s=[])).push({type:"missing",row:c,n:g}),f++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new rn(e,n,r,s);let u=!1;for(let c=0;!u&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(u=!0);return u&&NK(l,a,t),l}function QK(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let s=0;if(n)for(let a=0;a<r;a++){const l=t.child(a);for(let u=0;u<l.childCount;u++){const c=l.child(u);a+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let a=0;a<o.childCount;a++){const l=o.child(a);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function NK(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const s=t.map[o];if(r[s])continue;r[s]=!0;const a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let l=null;const u=a.attrs;for(let c=0;c<u.colspan;c++){const f=(o+c)%t.width,p=e[f*2];p!=null&&(!u.colwidth||u.colwidth[c]!=p)&&((l||(l=eG(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function eG(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function zn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var ms=new kt("selectingCells");function Tl(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function tG(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function mo(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Bp(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Tl(e.$head)||nG(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function nG(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Eb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function rG(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function kb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function SE(t,e,n){const r=t.node(-1),o=rn.get(r),s=t.start(-1),a=o.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function da(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function _E(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function oG(t,e,n){const r=zn(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var zt=class Oi extends De{constructor(e,n=e){const r=e.node(-1),o=rn.get(r),s=e.start(-1),a=o.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=o.cellsInRect(a).filter(f=>f!=n.pos-s);u.unshift(n.pos-s);const c=u.map(f=>{const p=r.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=s+f+1;return new hy(l.resolve(m),l.resolve(m+p.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(Eb(r)&&Eb(o)&&kb(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Oi.rowSelection(r,o):s&&this.isColSelection()?Oi.colSelection(r,o):new Oi(r,o)}return Te.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=rn.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let u=o.top;u<o.bottom;u++){const c=[];for(let f=u*n.width+o.left,p=o.left;p<o.right;p++,f++){const m=n.map[f];if(s[m])continue;s[m]=!0;const g=n.findCell(m);let b=e.nodeAt(m);if(!b)throw RangeError(`No cell with offset ${m} found`);const y=o.left-g.left,w=g.right-o.right;if(y>0||w>0){let x=b.attrs;if(y>0&&(x=da(x,0,y)),w>0&&(x=da(x,x.colspan-w,w)),g.left<o.left){if(b=b.type.createAndFill(x),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else b=b.type.create(x,b.content)}if(g.top<o.top||g.bottom>o.bottom){const x={...b.attrs,rowspan:Math.min(g.bottom,o.bottom)-Math.max(g.top,o.top)};g.top<o.top?b=b.type.createAndFill(x):b=b.type.create(x,b.content)}c.push(b)}a.push(e.child(u).copy(de.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new Ce(de.from(l),1,1)}replace(e,n=Ce.empty){const r=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){const{$from:l,$to:u}=o[a],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(u.pos),a?Ce.empty:n)}const s=De.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Ce(de.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=rn.get(n),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let a=0;a<s.length;a++)e(n.nodeAt(s[a]),o+s[a])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=rn.get(r),s=e.start(-1),a=o.findCell(e.pos-s),l=o.findCell(n.pos-s),u=e.node(0);return a.top<=l.top?(a.top>0&&(e=u.resolve(s+o.map[a.left])),l.bottom<o.height&&(n=u.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+o.map[l.left])),a.bottom<o.height&&(e=u.resolve(s+o.map[o.width*(o.height-1)+a.right-1]))),new Oi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=rn.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const a=o+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,l)==n.width}eq(e){return e instanceof Oi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=rn.get(r),s=e.start(-1),a=o.findCell(e.pos-s),l=o.findCell(n.pos-s),u=e.node(0);return a.left<=l.left?(a.left>0&&(e=u.resolve(s+o.map[a.top*o.width])),l.right<o.width&&(n=u.resolve(s+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+o.map[l.top*o.width])),a.right<o.width&&(e=u.resolve(s+o.map[o.width*(a.top+1)-1]))),new Oi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Oi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Oi(e.resolve(n),e.resolve(r))}getBookmark(){return new iG(this.$anchorCell.pos,this.$headCell.pos)}};zt.prototype.visible=!1,De.jsonID("cell",zt);var iG=class P_{constructor(e,n){this.anchor=e,this.head=n}map(e){return new P_(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&kb(n,r)?new zt(n,r):De.near(r,1)}};function sG(t){if(!(t.selection instanceof zt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(jt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ft.create(t.doc,e)}function aG({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function lG({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const s=t.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let o=e.depth;o>0;o--){const s=e.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function uG(t,e,n){const r=(e||t).selection,o=(e||t).doc;let s,a;if(r instanceof Le&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=zt.create(o,r.from);else if(a=="row"){const l=o.resolve(r.from+1);s=zt.rowSelection(l,l)}else if(!n){const l=rn.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=zt.create(o,u+1,c)}}else r instanceof Te&&aG(r)?s=Te.create(o,r.from):r instanceof Te&&lG(r)&&(s=Te.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var cG=new kt("fix-tables");function TE(t,e,n,r){const o=t.childCount,s=e.childCount;e:for(let a=0,l=0;a<s;a++){const u=e.child(a);for(let c=l,f=Math.min(o,a+3);c<f;c++)if(t.child(c)==u){l=c+1,n+=u.nodeSize;continue e}r(u,n),l<o&&t.child(l).sameMarkup(u)?TE(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function AE(t,e){let n;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(n=dG(t,o,s,n))};return e?e.doc!=t.doc&&TE(e.doc,t.doc,0,r):t.doc.descendants(r),n}function dG(t,e,n,r){const o=rn.get(e);if(!o.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<o.height;u++)s.push(0);for(let u=0;u<o.problems.length;u++){const c=o.problems[u];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const p=f.attrs;for(let m=0;m<p.rowspan;m++)s[c.row+m]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,da(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const f=r.mapping.map(n);r.delete(f,f+e.nodeSize)}}let a,l;for(let u=0;u<s.length;u++)s[u]&&(a==null&&(a=u),l=u);for(let u=0,c=n+1;u<o.height;u++){const f=e.child(u),p=c+f.nodeSize,m=s[u];if(m>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const b=[];for(let w=0;w<m;w++){const x=zn(t.schema)[g].createAndFill();x&&b.push(x)}const y=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(y),b)}c=p}return r.setMeta(cG,{fixTables:!0})}function Wo(t){const e=t.selection,n=Bp(t),r=n.node(-1),o=n.start(-1),s=rn.get(r);return{...e instanceof zt?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(n.pos-o),tableStart:o,map:s,table:r}}function OE(t,{map:e,tableStart:n,table:r},o){let s=o>0?-1:0;oG(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let a=0;a<e.height;a++){const l=a*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],c=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,_E(c.attrs,o-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?zn(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(a,o,r);t.insert(t.mapping.map(n+c),u.createAndFill())}}return t}function fG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(OE(t.tr,n,n.left))}return!0}function pG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(OE(t.tr,n,n.right))}return!0}function hG(t,{map:e,table:n,tableStart:r},o){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const l=a*e.width+o,u=e.map[l],c=n.nodeAt(u),f=c.attrs;if(o>0&&e.map[l-1]==u||o<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,da(f,o-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=f.rowspan}}function mG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;hG(r,n,o),o!=n.left;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=rn.get(s)}e(r)}return!0}function gG(t,e,n){var r;const o=zn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))==null?void 0:r.type)!=o)return!1;return!0}function ME(t,{map:e,tableStart:n,table:r},o){var s;let a=n;for(let c=0;c<o;c++)a+=r.child(c).nodeSize;const l=[];let u=o>0?-1:0;gG(e,r,o+u)&&(u=o==0||o==e.height?null:0);for(let c=0,f=e.width*o;c<e.width;c++,f++)if(o>0&&o<e.height&&e.map[f]==e.map[f-e.width]){const p=e.map[f],m=r.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...m,rowspan:m.rowspan+1}),c+=m.colspan-1}else{const p=u==null?zn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,m=p==null?void 0:p.createAndFill();m&&l.push(m)}return t.insert(a,zn(r.type.schema).row.create(null,l)),t}function bG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(ME(t.tr,n,n.top))}return!0}function vG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(ME(t.tr,n,n.bottom))}return!0}function yG(t,{map:e,table:n,tableStart:r},o){let s=0;for(let c=0;c<o;c++)s+=n.child(c).nodeSize;const a=s+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(s+r,a+r);const u=new Set;for(let c=0,f=o*e.width;c<e.width;c++,f++){const p=e.map[f];if(!u.has(p)){if(u.add(p),o>0&&p==e.map[f-e.width]){const m=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m,rowspan:m.rowspan-1}),c+=m.colspan-1}else if(o<e.height&&p==e.map[f+e.width]){const m=n.nodeAt(p),g=m.attrs,b=m.type.create({...g,rowspan:m.attrs.rowspan-1},m.content),y=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(l).map(r+y),b),c+=g.colspan-1}}}}function wG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;yG(r,n,o),o!=n.top;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=rn.get(n.table)}e(r)}return!0}function BE(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function xG({width:t,height:e,map:n},r){let o=r.top*t+r.left,s=o,a=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[a]==n[a+t])return!0;o++,a++}return!1}function IE(t,e){const n=t.selection;if(!(n instanceof zt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Wo(t),{map:o}=r;if(xG(o,r))return!1;if(e){const s=t.tr,a={};let l=de.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const m=o.map[f*o.width+p],g=r.table.nodeAt(m);if(!(a[m]||!g))if(a[m]=!0,u==null)u=m,c=g;else{BE(g)||(l=l.append(g.content));const b=s.mapping.map(m+r.tableStart);s.delete(b,b+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{..._E(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=u+1+c.content.size,p=BE(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new zt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function RE(t,e){const n=zn(t.schema);return CG(({node:r})=>n[r.type.spec.tableRole])(t,e)}function CG(t){return(e,n)=>{var r;const o=e.selection;let s,a;if(o instanceof zt){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;s=o.$anchorCell.nodeAfter,a=o.$anchorCell.pos}else{if(s=tG(o.$from),!s)return!1;a=(r=Tl(o.$from))==null?void 0:r.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const u=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=Wo(e),p=e.tr;for(let g=0;g<f.right-f.left;g++)u.push(c?{...l,colwidth:c&&c[g]?[c[g]]:null}:l);let m;for(let g=f.top;g<f.bottom;g++){let b=f.map.positionAt(g,f.left,f.table);g==f.top&&(b+=s.nodeSize);for(let y=f.left,w=0;y<f.right;y++,w++)y==f.left&&g==f.top||p.insert(m=p.mapping.map(b+f.tableStart,1),t({node:s,row:g,col:y}).createAndFill(u[w]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),o instanceof zt&&p.setSelection(new zt(p.doc.resolve(o.$anchorCell.pos),m?p.doc.resolve(m):void 0)),n(p)}return!0}}function EG(t,e){return function(n,r){if(!mo(n))return!1;const o=Bp(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof zt?n.selection.forEachCell((a,l)=>{a.attrs[t]!==e&&s.setNodeMarkup(l,null,{...a.attrs,[t]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function kG(t){return function(e,n){if(!mo(e))return!1;if(n){const r=zn(e.schema),o=Wo(e),s=e.tr,a=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=a.map(u=>o.table.nodeAt(u));for(let u=0;u<a.length;u++)l[u].type==r.header_cell&&s.setNodeMarkup(o.tableStart+a[u],r.cell,l[u].attrs);if(s.steps.length==0)for(let u=0;u<a.length;u++)s.setNodeMarkup(o.tableStart+a[u],r.header_cell,l[u].attrs);n(s)}return!0}}function LE(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==n.header_cell)return!1}return!0}function mc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?kG(t):function(n,r){if(!mo(n))return!1;if(r){const o=zn(n.schema),s=Wo(n),a=n.tr,l=LE("row",s,o),u=LE("column",s,o),f=(t==="column"?l:t==="row"?u:!1)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;s.map.cellsInRect(p).forEach(g=>{const b=g+s.tableStart,y=a.doc.nodeAt(b);y&&a.setNodeMarkup(b,m,y.attrs)}),r(a)}return!0}}mc("row",{useDeprecatedLogic:!0}),mc("column",{useDeprecatedLogic:!0});var SG=mc("cell",{useDeprecatedLogic:!0});function _G(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const s=t.node(-1).child(r),a=s.lastChild;if(a)return o-1-a.nodeSize;o-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function PE(t){return function(e,n){if(!mo(e))return!1;const r=_G(Bp(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(Te.between(o,rG(o))).scrollIntoView())}return!0}}function TG(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ip(t,e){const n=t.selection;if(!(n instanceof zt))return!1;if(e){const r=t.tr,o=zn(t.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(o)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new Ce(o,0,0))}),r.docChanged&&e(r)}return!0}function AG(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,a=o.type.schema,l=[];if(s=="row")for(let u=0;u<e.childCount;u++){let c=e.child(u).content;const f=u?0:Math.max(0,n-1),p=u<e.childCount-1?0:Math.max(0,r-1);(f||p)&&(c=Sb(zn(a).row,new Ce(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Sb(zn(a).row,new Ce(e,n,r)).content:e);else return null;return OG(a,l)}function OG(t,e){const n=[];for(let o=0;o<e.length;o++){const s=e[o];for(let a=s.childCount-1;a>=0;a--){const{rowspan:l,colspan:u}=s.child(a).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+u}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(de.empty),n[o]<r){const s=zn(t).cell.createAndFill(),a=[];for(let l=n[o];l<r;l++)a.push(s);e[o]=e[o].append(de.from(a))}return{height:e.length,width:r,rows:e}}function Sb(t,e){const n=t.createAndFill();return new lm(n).replace(0,n.content.size,e).doc}function MG({width:t,height:e,rows:n},r,o){if(t!=r){const s=[],a=[];for(let l=0;l<n.length;l++){const u=n[l],c=[];for(let f=s[l]||0,p=0;f<r;p++){let m=u.child(p%u.childCount);f+m.attrs.colspan>r&&(m=m.type.createChecked(da(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),c.push(m),f+=m.attrs.colspan;for(let g=1;g<m.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+m.attrs.colspan}a.push(de.from(c))}n=a,t=r}if(e!=o){const s=[];for(let a=0,l=0;a<o;a++,l++){const u=[],c=n[l%e];for(let f=0;f<c.childCount;f++){let p=c.child(f);a+p.attrs.rowspan>o&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,o-p.attrs.rowspan)},p.content)),u.push(p)}s.push(de.from(u))}n=s,e=o}return{width:t,height:e,rows:n}}function BG(t,e,n,r,o,s,a){const l=t.doc.type.schema,u=zn(l);let c,f;if(o>e.width)for(let p=0,m=0;p<e.height;p++){const g=n.child(p);m+=g.nodeSize;const b=[];let y;g.lastChild==null||g.lastChild.type==u.cell?y=c||(c=u.cell.createAndFill()):y=f||(f=u.header_cell.createAndFill());for(let w=e.width;w<o;w++)b.push(y);t.insert(t.mapping.slice(a).map(m-1+r),b)}if(s>e.height){const p=[];for(let b=0,y=(e.height-1)*e.width;b<Math.max(e.width,o);b++){const w=b>=e.width?!1:n.nodeAt(e.map[y+b]).type==u.header_cell;p.push(w?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const m=u.row.create(null,de.from(p)),g=[];for(let b=e.height;b<s;b++)g.push(m);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function DE(t,e,n,r,o,s,a,l){if(a==0||a==e.height)return!1;let u=!1;for(let c=o;c<s;c++){const f=a*e.width+c,p=e.map[f];if(e.map[f-e.width]==p){u=!0;const m=n.nodeAt(p),{top:g,left:b}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m.attrs,rowspan:a-g}),t.insert(t.mapping.slice(l).map(e.positionAt(a,b,n)),m.type.createAndFill({...m.attrs,rowspan:g+m.attrs.rowspan-a})),c+=m.attrs.colspan-1}}return u}function VE(t,e,n,r,o,s,a,l){if(a==0||a==e.width)return!1;let u=!1;for(let c=o;c<s;c++){const f=c*e.width+a,p=e.map[f];if(e.map[f-1]==p){u=!0;const m=n.nodeAt(p),g=e.colCount(p),b=t.mapping.slice(l).map(p+r);t.setNodeMarkup(b,null,da(m.attrs,a-g,m.attrs.colspan-(a-g))),t.insert(b+m.nodeSize,m.type.createAndFill(da(m.attrs,0,a-g))),c+=m.attrs.rowspan-1}}return u}function FE(t,e,n,r,o){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let a=rn.get(s);const{top:l,left:u}=r,c=u+o.width,f=l+o.height,p=t.tr;let m=0;function g(){if(s=n?p.doc.nodeAt(n-1):p.doc,!s)throw new Error("No table found");a=rn.get(s),m=p.mapping.maps.length}BG(p,a,s,n,c,f,m)&&g(),DE(p,a,s,n,u,c,l,m)&&g(),DE(p,a,s,n,u,c,f,m)&&g(),VE(p,a,s,n,l,f,u,m)&&g(),VE(p,a,s,n,l,f,c,m)&&g();for(let b=l;b<f;b++){const y=a.positionAt(b,u,s),w=a.positionAt(b,c,s);p.replace(p.mapping.slice(m).map(y+n),p.mapping.slice(m).map(w+n),new Ce(o.rows[b-l],0,0))}g(),p.setSelection(new zt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var IG=$m({ArrowLeft:Lp("horiz",-1),ArrowRight:Lp("horiz",1),ArrowUp:Lp("vert",-1),ArrowDown:Lp("vert",1),"Shift-ArrowLeft":Pp("horiz",-1),"Shift-ArrowRight":Pp("horiz",1),"Shift-ArrowUp":Pp("vert",-1),"Shift-ArrowDown":Pp("vert",1),Backspace:Ip,"Mod-Backspace":Ip,Delete:Ip,"Mod-Delete":Ip});function Rp(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Lp(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof zt)return Rp(n,r,De.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=$E(o,t,e);if(a==null)return!1;if(t=="horiz")return Rp(n,r,De.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=SE(l,t,e);let c;return u?c=De.near(u,1):e<0?c=De.near(n.doc.resolve(l.before(-1)),-1):c=De.near(n.doc.resolve(l.after(-1)),1),Rp(n,r,c)}}}function Pp(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;let a;if(s instanceof zt)a=s;else{const u=$E(o,t,e);if(u==null)return!1;a=new zt(n.doc.resolve(u))}const l=SE(a.$headCell,t,e);return l?Rp(n,r,new zt(a.$anchorCell,l)):!1}}function RG(t,e){const n=t.state.doc,r=Tl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new zt(r))),!0):!1}function LG(t,e,n){if(!mo(t.state))return!1;let r=AG(n);const o=t.state.selection;if(o instanceof zt){r||(r={width:1,height:1,rows:[de.from(Sb(zn(t.state.schema).cell,n))]});const s=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),l=rn.get(s).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=MG(r,l.right-l.left,l.bottom-l.top),FE(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Bp(t.state),a=s.start(-1);return FE(t.state,t.dispatch,a,rn.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function PG(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=zE(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof zt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Tl(t.state.selection.$anchor))!=null&&((n=_b(t,e))==null?void 0:n.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(u,c){let f=_b(t,c);const p=ms.getState(t.state)==null;if(!f||!kb(u,f))if(p)f=u;else return;const m=new zt(u,f);if(p||!t.state.selection.eq(m)){const g=t.state.tr.setSelection(m);p&&g.setMeta(ms,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),ms.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ms,-1))}function l(u){const c=u,f=ms.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if(zE(t,c.target)!=r&&(p=_b(t,e),!p))return a();p&&s(p,c)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",l)}function $E(t,e,n){if(!(t.state.selection instanceof Te))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(o),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?l:null}}return null}function zE(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function _b(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Tl(t.state.doc.resolve(n.pos)):null}var DG=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Tb(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Tb(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Tb(t,e,n,r,o,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f){for(let p=0,m=0;p<f.childCount;p++){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let y=0;y<g;y++,m++){const w=o==m?s:b&&b[y],x=w?w+"px":"";if(l+=w||r,w||(u=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const E=document.createElement("col");E.style.width=x,e.appendChild(E)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)==null||a.removeChild(c),c=p}u?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var xr=new kt("tableColumnResizing");function VG({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=DG,lastColumnResizable:o=!0}={}){const s=new tt({key:xr,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=zn(l.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new FG(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=xr.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{$G(a,l,t,o)},mouseleave:a=>{zG(a)},mousedown:(a,l)=>{HG(a,l,e,n)}},decorations:a=>{const l=xr.getState(a);if(l&&l.activeHandle>-1)return KG(a,l.activeHandle)},nodeViews:{}}});return s}var FG=class qh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(xr);if(r&&r.setHandle!=null)return new qh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new qh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Eb(e.doc.resolve(o))||(o=-1),new qh(o,n.dragging)}return n}};function $G(t,e,n,r){if(!t.editable)return;const o=xr.getState(t.state);if(o&&!o.dragging){const s=WG(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=HE(t,e,"left",n):u-e.clientX<=n&&(a=HE(t,e,"right",n))}if(a!=o.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=rn.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}WE(t,a)}}}function zG(t){if(!t.editable)return;const e=xr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&WE(t,-1)}function HG(t,e,n,r){var o;if(!t.editable)return!1;const s=(o=t.dom.ownerDocument.defaultView)!=null?o:window,a=xr.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=UG(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(xr,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=xr.getState(t.state);m!=null&&m.dragging&&(jG(t,m.activeHandle,UE(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(xr,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=xr.getState(t.state);if(m&&m.dragging){const g=UE(m.dragging,p,n);jE(t,m.activeHandle,g,r)}}return jE(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function UG(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],u--);return l/u}function WG(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function HE(t,e,n,r){const o=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:a}=s,l=Tl(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=rn.get(l.node(-1)),c=l.start(-1),f=u.map.indexOf(l.pos-c);return f%u.width==0?-1:c+u.map[f-1]}function UE(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function WE(t,e){t.dispatch(t.state.tr.setMeta(xr,{setHandle:e}))}function jG(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),s=rn.get(o),a=r.start(-1),l=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let c=0;c<s.height;c++){const f=c*s.width+l;if(c&&s.map[f]==s.map[f-s.width])continue;const p=s.map[f],m=o.nodeAt(p).attrs,g=m.colspan==1?0:l-s.colCount(p);if(m.colwidth&&m.colwidth[g]==n)continue;const b=m.colwidth?m.colwidth.slice():qG(m.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...m,colwidth:b})}u.docChanged&&t.dispatch(u)}function jE(t,e,n,r){const o=t.state.doc.resolve(e),s=o.node(-1),a=o.start(-1),l=rn.get(s).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let u=t.domAtPos(o.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&Tb(s,u.firstChild,u,r,l,n)}function qG(t){return Array(t).fill(0)}function KG(t,e){var n;const r=[],o=t.doc.resolve(e),s=o.node(-1);if(!s)return ft.empty;const a=rn.get(s),l=o.start(-1),u=a.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<a.height;c++){const f=u+c*a.width;if((u==a.width-1||a.map[f]!=a.map[f+1])&&(c==0||a.map[f]!=a.map[f-a.width])){const p=a.map[f],m=l+p+s.nodeAt(p).nodeSize-1,g=document.createElement("div");g.className="column-resize-handle",(n=xr.getState(t))!=null&&n.dragging&&r.push(jt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(jt.widget(m,g))}}return ft.create(t.doc,r)}function GG({allowTableNodeSelection:t=!1}={}){return new tt({key:ms,state:{init(){return null},apply(e,n){const r=e.getMeta(ms);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:s}=e.mapping.mapResult(n);return o?null:s}},props:{decorations:sG,handleDOMEvents:{mousedown:PG},createSelectionBetween(e){return ms.getState(e.state)!=null?e.state.selection:null},handleTripleClick:RG,handleKeyDown:IG,handlePaste:LG},appendTransaction(e,n,r){return uG(r,AE(r,n),t)}})}const XG=(t,e,n)=>{if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r||n===r.attrs.backgroundColor)return t;const o={...r.attrs,backgroundColor:n};return t.setNodeMarkup(e,r.type,o,r.marks)},YG=(t,e,n)=>{const{doc:r,selection:o}=t;return!r||!o||!(o instanceof zt)||o.forEachCell((s,a)=>{t=XG(t,a,n)}),t},qE=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=r;return n=n.setSelection(s),n=YG(n,e,t),n.docChanged?(o==null||o(n),!0):!1},JG=Ze.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>qE(t,this.options),unsetTableCellBackground:()=>qE("",this.options)}}}),ZG=Bt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",bt(this.options.HTMLAttributes,t),0]}}),QG=Bt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}}),NG=Bt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",bt(this.options.HTMLAttributes,t),0]}});function Ab(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function KE(t,e,n,r,o,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f!==null)for(let p=0,m=0;p<f.childCount;p+=1){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let y=0;y<g;y+=1,m+=1){const w=o===m?s:b&&b[y],x=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==x){const[E,k]=Ab(r,w);c.style.setProperty(E,k)}c=c.nextSibling}else{const E=document.createElement("col"),[k,C]=Ab(r,w);E.style.setProperty(k,C),e.appendChild(E)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)===null||a===void 0||a.removeChild(c),c=p}u?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class eX{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),KE(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,KE(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function tX(t,e,n,r){let o=0,s=!0;const a=[],l=t.firstChild;if(!l)return{};for(let p=0,m=0;p<l.childCount;p+=1){const{colspan:g,colwidth:b}=l.child(p).attrs;for(let y=0;y<g;y+=1,m+=1){const w=n===m?r:b&&b[y];o+=w||e,w||(s=!1);const[x,E]=Ab(e,w);a.push(["col",{style:`${x}: ${E}`}])}}const u=s?`${o}px`:"",c=s?"":`${o}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function GE(t,e){return t.createAndFill()}function nX(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function rX(t,e,n,r,o){const s=nX(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=GE(s.cell);if(f&&l.push(f),r){const p=GE(s.header_cell);p&&a.push(p)}}const u=[];for(let c=0;c<e;c+=1)u.push(s.row.createChecked(null,r&&c===0?a:l));return s.table.createChecked(null,u)}function oX(t){return t instanceof zt}const Dp=({editor:t})=>{const{selection:e}=t.state;if(!oX(e))return!1;let n=0;const r=c4(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},iX=Bt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:eX,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:o}=tX(t,this.options.cellMinWidth);return["table",bt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const a=rX(s.schema,t,e,n);if(o){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Te.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>fG(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>pG(t,e),deleteColumn:()=>({state:t,dispatch:e})=>mG(t,e),addRowBefore:()=>({state:t,dispatch:e})=>bG(t,e),addRowAfter:()=>({state:t,dispatch:e})=>vG(t,e),deleteRow:()=>({state:t,dispatch:e})=>wG(t,e),deleteTable:()=>({state:t,dispatch:e})=>TG(t,e),mergeCells:()=>({state:t,dispatch:e})=>IE(t,e),splitCell:()=>({state:t,dispatch:e})=>RE(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>mc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>mc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>SG(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>IE(t,e)?!0:RE(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>EG(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>PE(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>PE(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&AE(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=zt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Dp,"Mod-Backspace":Dp,Delete:Dp,"Mod-Delete":Dp}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[VG({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],GG({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:at(Ie(t,"tableRole",e))}}}),sX=["disabled"],aX={"content-class":"table-grid-size-editor","content-style":"padding:0"},lX={class:"flex flex-col flex-wrap gap-1 justify-between"},uX=["onMouseover","onMousedown"],cX={class:"text-center text-sm text-zinc-600 mt-2"},dX=i.defineComponent({__name:"CreateTablePopover",props:{disabled:{type:Boolean,default:!1}},emits:["create-table"],setup(t,{emit:e}){const n=e,r=i.ref(!1),o=i.ref(!0),s=i.reactive({rows:ff()?Rd:Id,cols:ff()?Rd:Id}),a=i.reactive({rows:Ld,cols:Ld});function l(f,p){f===s.rows&&(s.rows=Math.min(f+1,Rd)),p===s.cols&&(s.cols=Math.min(p+1,Rd)),a.rows=f,a.cols=p}function u(f,p){n("create-table",{rows:f,cols:p,withHeaderRow:i.unref(o)}),c()}function c(){r.value=!1,o.value=!1,s.rows=Id,s.cols=Id,a.rows=Ld,a.cols=Ld}return(f,p)=>(i.openBlock(),i.createBlock(i.unref(fl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(ml),{"as-child":""},{default:i.withCtx(()=>[i.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[i.renderSlot(f.$slots,"trigger")],8,sX)]),_:3}),i.createVNode(i.unref(pl),{class:"w-full",align:"start",side:"bottom"},{default:i.withCtx(()=>[i.createElementVNode("div",aX,[i.createElementVNode("div",lX,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.rows,m=>(i.openBlock(),i.createElementBlock("div",{key:"r"+m,class:"flex gap-1"},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.cols,g=>(i.openBlock(),i.createElementBlock("div",{key:"c"+g,class:i.normalizeClass([[g<=a.cols&&m<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:b=>l(m,g),onMousedown:b=>u(m,g)},p[0]||(p[0]=[i.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,uX))),128))]))),128))]),i.createElementVNode("div",cX,i.toDisplayString(a.rows)+" x "+i.toDisplayString(a.cols),1)])]),_:1})]),_:3}))}}),fX={style:{display:"flex"}},pX=i.defineComponent({__name:"TableActionButton",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t;function n(r){e.editor.isActive("table")||e.editor.chain().focus().insertTable({...r,withHeaderRow:!1}).run()}return(r,o)=>(i.openBlock(),i.createBlock(dX,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:i.withCtx(()=>[i.createElementVNode("div",fX,[i.createVNode(Ke,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled,color:r.color,action:r.action,"is-active":r.isActive},null,8,["icon","tooltip","disabled","color","action","is-active"])])]),_:1},8,["disabled"]))}}),Ob=iX.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toggleTableEditor:e=>({editor:n})=>n.storage.table?(n.storage.table.isTableEditorOpen=e,!0):!1}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({component:pX,componentProps:{icon:"Table",tooltip:n("editor.table.tooltip"),action:()=>{var o;const r=((o=e.storage.table)==null?void 0:o.isTableEditorOpen)??!1;e.commands.toggleTableEditor(!r)}}})}},addExtensions(){return[QG.configure(this.options.tableRow),ZG.configure(this.options.tableHeader),NG.configure(this.options.tableCell),JG.configure(this.options.tableCellBackground)]}}),hX={class:"flex items-center gap-2 px-2"},mX=i.defineComponent({__name:"TextDropdown",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""}},setup(t){const e=t,{t:n}=Ot(),r=i.computed(()=>[{name:"paragraph",label:n("editor.paragraph.tooltip"),iconName:"Paragraph",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:n("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:n("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:n("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:n("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:n("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:n("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:n("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()},{name:"codeBlock",label:n("editor.codeblock.tooltip"),isActive:()=>e.editor.isActive("codeBlock"),iconName:"Code2",action:()=>e.editor.chain().focus().clearNodes().toggleCodeBlock().run()}]),o=i.computed(()=>r.value.filter(s=>s.isActive()).pop()??{label:n("editor.modify")});return(s,a)=>{var l;return i.openBlock(),i.createBlock(ia,{title:(l=o.value)==null?void 0:l.label,"side-offset":5},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(u,c)=>{var f;return i.openBlock(),i.createBlock(i.unref(Cl),{key:c,class:"cursor-pointer",checked:((f=u.isActive)==null?void 0:f.call(u))||!1,onClick:u.action},{default:i.withCtx(()=>[i.createElementVNode("div",hX,[i.createVNode(i.unref(Lt),{name:u.iconName,class:"h3 w-3"},null,8,["name"]),i.createElementVNode("span",null,i.toDisplayString(u.label),1)])]),_:2},1032,["checked","onClick"])}),128))]),_:1},8,["title"])}}}),gX=Ze.create({name:"text-bubble",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:()=>({component:mX,componentProps:{}})}}}),bX=[{label:"복합 표현 - 요일과 시간대",examples:["다음 월요일 저녁","이번 토요일 오전"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"시각 표현",examples:["오전 10시","오후 3시 30분","정오","자정","새벽 2시"],pattern:"((오전|오후|새벽|밤|저녁)\\s?\\d{1,2}(시(\\s?\\d{1,2}분)?)?|정오|자정)"},{label:"시간 표현 - 이른/늦은",examples:["이른 아침","늦은 밤"],pattern:"(이른\\s아침|늦은\\s밤)"},{label:"연도+월",examples:["2019년 6월","2025년12월","2024년 01월"],pattern:"\\d{4}년\\s?\\d{1,2}월"},{label:"오늘/내일/어제",examples:["오늘","내일","모레","어제","그제","그끄제"],pattern:"(오늘|내일|모레|어제|그제|그끄제)"},{label:"상대적 주 단위",examples:["이번 주","다음 주","지난 주"],pattern:"(이번|다음|지난)\\s?주"},{label:"상대적 월 단위",examples:["이번 달","다음 달","지난 달"],pattern:"(이번|다음|지난)\\s?달"},{label:"상대적 연도",examples:["올해","내년","작년","재작년","내후년"],pattern:"(올해|내년|작년|재작년|내후년)"},{label:"복합 표현 - 날짜와 시간대",examples:["1월 1일 오전","12월25일 저녁","다음 주 금요일 오전"],pattern:"(내년|올해|작년)?\\s?\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"정확한 날짜",examples:["1월1일","1월 1일","12월 25일","01월 01일"],pattern:"\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일"},{label:"요일",examples:["월요일","화요일","이번 금요일","다음 화요일"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일"},{label:"시간대",examples:["오전","오후","저녁","밤","새벽"],pattern:"(오전|오후|저녁|밤|새벽)"},{label:"짧은 시간 표현",examples:["방금","조금 전","금방","곧","잠시 후"],pattern:"(방금|조금\\s전|금방|곧|잠시\\s후)"},{label:"연도",examples:["2015년","2024년","1998년"],pattern:"\\d{4}년"}],vX=t=>{const e=[...t||[],...bX.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},yX=Ze.create({name:"time-highlighter",addOptions(){return{additionalTimeWords:[]}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null}},addProseMirrorPlugins(){return[new tt({props:{decorations:t=>{const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=vX(this.options.additionalTimeWords)),t.doc.descendants((n,r)=>{if(!n.isText)return;let o;const s=this.storage.cachedRegex;for(;o=s.exec(n.text||"");){const a=r+o.index,l=a+o[0].length;e.push(jt.inline(a,l,{class:"time-highlight"}))}}),ft.create(t.doc,e)}}})]}}),wX=Ze.create({name:"invalidCharFocus",addOptions(){return{invalidChars:["{","}"]}},addCommands(){return{focusInvalidChar:()=>({state:t,dispatch:e,view:n})=>{let r=null;if(t.doc.descendants((s,a)=>{if(!s.isText)return!0;const l=s.text??"";for(let u=0;u<l.length;u++)if(this.options.invalidChars.includes(l[u])){const c=a+u+1;(r==null||c<r)&&(r=c)}return!0}),r==null)return!1;const o=t.tr.setSelection(Te.create(t.doc,r));return e&&e(o.scrollIntoView()),n&&n.focus(),!0}}}});function Mb(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function xX(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var o;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="CLIPBOARD_STATE"&&t(!!((o=r.data)!=null&&o.hasClipboard))},Mb({type:"REQUEST_CLIPBOARD_STATE"})})}function CX(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var o;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="PASTE_RESULT"&&t(((o=r.data)==null?void 0:o.text)??null)},Mb({type:"PASTE"})})}function EX(t,e){Mb({type:"COPY",data:{html:t,text:e}})}async function kX(t,e){try{const n=new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});await navigator.clipboard.write([n])}catch(n){console.error("navigator clipboard write failed:",n)}}async function SX(){try{if("read"in navigator.clipboard){const t=await navigator.clipboard.read();for(const e of t){if(e.types.includes("text/html"))return await(await e.getType("text/html")).text();if(e.types.includes("text/plain"))return await(await e.getType("text/plain")).text()}}}catch(t){console.warn("navigator clipboard read failed:",t)}}const _X=Ze.create({name:"clipboard",addCommands(){return{copyContent:()=>({editor:t,state:e})=>{const{from:n,to:r}=e.selection;return n===r?!1:((async()=>{try{const o=e.doc.slice(n,r),a=to.fromSchema(t.schema).serializeFragment(o.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
|
|
293
|
-
`);t.storage.deviceEnv.isMobile?EX(u,c):await kX(u,c)}catch(o){console.warn("[clipboard] copy failed",o)}})(),!0)},cutContent:()=>({editor:t})=>((async()=>{try{await t.commands.copyContent(),t.chain().focus().deleteSelection().run()}catch(e){console.warn("[clipboard] cut failed",e)}})(),!0),pasteContent:()=>({editor:t})=>((async()=>{try{t.chain().focus().run();const e=t.storage.deviceEnv.isMobile?await CX():await SX();if(!e)return;const n=new DataTransfer;n.setData("text/html",e),n.setData("text/plain",e);const r=new ClipboardEvent("paste",{bubbles:!0,cancelable:!0});Object.defineProperty(r,"clipboardData",{value:n}),t.view.dom.dispatchEvent(r)}catch(e){console.warn("Clipboard paste failed:",e)}})(),!0)}},onCreate(){const t=this.editor;t.hasClipboard=async()=>{try{return!!(t.storage.deviceEnv.isMobile?await xX():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),TX=Ze.create({name:"deviceEnv",addOptions(){return{initial:!1}},addStorage(){return{isMobile:this.options.initial}},addCommands(){return{setIsMobile:t=>({editor:e})=>{var n;return e.storage.deviceEnv.isMobile=t,(n=e.storage.spellchecker)==null||n.spellchecker.setIsMobile(t),!0}}}}),Vp=i.defineComponent({__name:"TabsContent",props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(pD),i.mergeProps({class:i.unref(ke)("mt-2 ring-offset-ed-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2",e.class)},n.value),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),AX={class:"flex items-center w-full p-3 my-3 hover:bg-ed-accent border border-ed-border text-ed-muted-foreground cursor-pointer rounded-sm transition-all"},OX={key:0,class:"flex justify-center items-center gap-3 text-s"},MX={key:1,class:"flex justify-between items-center w-full"},BX={class:"flex justify-center items-center gap-3"},IX={class:"text-sm"},RX={class:"flex items-center gap-2"},LX=i.defineComponent({__name:"VideoUploader",props:{...Ws},setup(t){const e=t,n=i.ref(""),r=i.ref(!1),o=i.ref(),{t:s}=Ot();function a(f){var y;r.value=!0;const p=f.target,m=Array.from((p==null?void 0:p.files)||[]),g=(y=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload"))==null?void 0:y.options;if(!e.editor||e.editor.isDestroyed||m.length===0||typeof(g==null?void 0:g.upload)!="function")return;const b=m[0];g.upload(b).then(w=>{e.editor.chain().setVideo({src:w}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run(),r.value=!1})}function l(){e.editor.chain().setVideo({src:n.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){var f;(f=o.value)==null||f.click()}return(f,p)=>(i.openBlock(),i.createBlock(i.unref(Us),{as:"div","data-drag-handle":""},{default:i.withCtx(()=>[i.createVNode(i.unref(fl),{"default-open":""},{default:i.withCtx(()=>[i.createVNode(i.unref(ml),{"as-child":""},{default:i.withCtx(()=>[i.createElementVNode("div",AX,[r.value?(i.openBlock(),i.createElementBlock("div",OX,[i.createVNode(i.unref(Lt),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),i.createElementVNode("span",null,i.toDisplayString(i.unref(s)("editor.video.dialog.uploading"))+"...",1)])):(i.openBlock(),i.createElementBlock("div",MX,[i.createElementVNode("div",BX,[i.createVNode(i.unref(Lt),{name:"Video",class:"w-6 h-6"}),i.createElementVNode("span",IX,i.toDisplayString(i.unref(s)("editor.video.dialog.title")),1)]),i.createVNode(i.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:i.withModifiers(u,["stop"])})]))])]),_:1}),i.createVNode(i.unref(pl),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:i.withCtx(()=>[i.createVNode(i.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:i.withCtx(()=>[i.createVNode(i.unref(z1),{class:"grid w-full grid-cols-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(Hu),{value:"upload"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1}),i.createVNode(i.unref(Hu),{value:"link",disabled:r.value},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),i.createVNode(i.unref(Vp),{value:"upload"},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{class:"w-full mt-1",size:"sm",disabled:r.value,onClick:c},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),i.createElementVNode("input",{ref_key:"fileInput",ref:o,type:"file",accept:"video/*",hidden:"",onChange:a},null,544)]),_:1}),i.createVNode(i.unref(Vp),{value:"link"},{default:i.withCtx(()=>[i.createElementVNode("div",RX,[i.createVNode(i.unref(hl),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:i.unref(s)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),i.createVNode(i.unref(yn),{onClick:l},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1})]),_:1}))}}),XE=Bt.create({name:"videoUpload",isolating:!0,defining:!0,group:"block",draggable:!0,selectable:!1,inline:!1,parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setVideoUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return js(LX)},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("link video not found"),button:({editor:e,t:n})=>{var r,o;return{component:Ke,componentProps:{action:()=>e.commands.setVideoUpload(),isActive:()=>e.isActive("video")||!1,disabled:!((o=(r=e.can()).setVideo)!=null&&o.call(r,{})),icon:"Video",tooltip:n("editor.video.tooltip")}}}}}});function PX(t){return t=t.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),t=t.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(t)&&(t=t.replace(/\?.*$/i,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),t.includes("drive.google.com")&&(t=t.replace("/view","/preview")),t}function DX(t){return t?t.includes("youtube.com/embed")||t.includes("player.vimeo.com")||t.includes("player.bilibili.com")||t.includes("drive.google.com"):!1}const YE=Bt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:Pd["size-medium"],controls:!0,autoplay:!1,HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}},addAttributes(){return{src:{default:null,renderHTML:({src:t})=>({src:t?PX(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:an(t)})},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},controls:{default:this.options.controls}}},parseHTML(){return[{tag:"video"},{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){const{src:e,width:n,controls:r,allowfullscreen:o}=t??{},s=`max-width: ${an(n)};`;return DX(e)?["iframe",{src:e,style:s,...o&&{allowfullscreen:o}}]:["video",{src:e?e.replace(/\\/g,"/"):"",style:s,...r&&{controls:r}}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateVideo:t=>({commands:e})=>e.updateAttributes(this.name,t)}}}),Al=new kt("upload-image"),VX=()=>new tt({key:Al,state:{init(){return ft.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Al);return n!=null&&n.add?n.add.forEach(({id:r,pos:o,src:s})=>{const a=FX(s),l=jt.widget(o,a,{id:r});e=e.add(t.doc,[l])}):n!=null&&n.remove&&n.remove.forEach(r=>{e=e.remove(e.find(void 0,void 0,o=>o.id===r))}),e}},props:{decorations(t){return this.getState(t)}}});function FX(t){const e=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=t,n.onload=()=>{e.setAttribute("class","img-placeholder")},e.appendChild(n),e}function $X(t,e){var o;const r=Al.getState(t).find(void 0,void 0,s=>s.id===e);return r.length?(o=r[0])==null?void 0:o.from:null}const JE=({validateFn:t,onUpload:e})=>(n,r,o,s)=>{n.forEach(a=>{if(t&&!t(a))return;s||(s=pi(6));const l=r.state.tr;l.selection.empty||l.deleteSelection();let u=null;r.state.doc.descendants((p,m)=>{p.type.name===hs&&p.attrs.id===s&&(u=m)});const c=URL.createObjectURL(a);l.setMeta(Al,{add:[{id:s,pos:o,src:c}]}),r.dispatch(l);const f=$X(r.state,s)||u;e(a).then(p=>{var E,k;const{schema:m}=r.state;if(f===null)throw new Error("Not found placeholderPos");const g=typeof p=="object"?c:p,b=(E=m.nodes.image)==null?void 0:E.create({src:g}),y=(k=m.nodes.paragraph)==null?void 0:k.create();if(!b||!y)return;const w=r.state.tr.replaceWith(f,f,b).insert(f+b.nodeSize,y).setMeta(Al,{remove:[s]}),x=f+b.nodeSize+1;w.setSelection(Te.create(w.doc,x)),r.dispatch(w),r.focus()},()=>{const p=r.state.tr.delete(o,o).setMeta(Al,{remove:[s]});r.dispatch(p)})})},zX=(t,e,n)=>{var o;const r=Array.from(((o=e.clipboardData)==null?void 0:o.files)||[]);if(r.length){e.preventDefault();const s=t.state.selection.from;return n(r,t,s+1),!0}return!1},HX=(t,e,n,r)=>{var s;const o=Array.from(((s=e.dataTransfer)==null?void 0:s.files)||[]);if(!n&&o.length){e.preventDefault();const a=t.posAtCoords({left:e.clientX,top:e.clientY});if(a)return r(o,t,a.pos+1),!0}return!1},UX={class:"flex items-center w-full p-3 my-3 transition-all border rounded-sm cursor-pointer hover:bg-ed-accent border-ed-border text-ed-muted-foreground"},WX={class:"flex items-center justify-between w-full"},jX={class:"flex items-center justify-center gap-3"},qX={class:"text-sm"},KX={class:"flex items-center gap-2"},GX=i.defineComponent({__name:"ImageUploader",props:{...Ws},setup(t){const e=t,n=i.ref(""),r=i.ref(),{t:o}=Ot(),s=i.inject("isEditable",i.ref(!0));function a(f){var y,w;const p=(y=f==null?void 0:f.target)==null?void 0:y.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=p[0],g=(w=e.editor.extensionManager.extensions.find(x=>x.name==="imageUpload"))==null?void 0:w.options;JE({validateFn:x=>!0,onUpload:g.upload})([m],e.editor.view,e.getPos(),e.node.attrs.id)}function l(){e.editor.chain().setImage({src:n.value}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){s.value&&e.deleteNode()}function c(){var f;(f=r.value)==null||f.click()}return(f,p)=>(i.openBlock(),i.createBlock(i.unref(Us),{id:f.node.attrs.id,class:"p-0 m-0","data-drag-handle":""},{default:i.withCtx(()=>[i.createVNode(i.unref(fl),{"default-open":""},{default:i.withCtx(()=>[i.createVNode(i.unref(ml),{"as-child":""},{default:i.withCtx(()=>[i.createElementVNode("div",UX,[i.createElementVNode("div",WX,[i.createElementVNode("div",jX,[i.createVNode(i.unref(Lt),{name:"ImageUp",class:"w-6 h-6"}),i.createElementVNode("span",qX,i.toDisplayString(i.unref(o)("editor.image.dialog.title")),1)]),i.createVNode(i.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:i.withModifiers(u,["stop"])})])])]),_:1}),i.unref(s)?(i.openBlock(),i.createBlock(i.unref(pl),{key:0,"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:i.withCtx(()=>[i.createVNode(i.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:i.withCtx(()=>[i.createVNode(i.unref(z1),{class:"grid w-full grid-cols-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(Hu),{value:"upload"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.tab.upload")),1)]),_:1}),i.createVNode(i.unref(Hu),{value:"link"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),i.createVNode(i.unref(Vp),{value:"upload"},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{class:"w-full mt-1",size:"sm",onClick:c},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.tab.upload")),1)]),_:1}),i.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",multiple:"",hidden:"",onChange:a},null,544)]),_:1}),i.createVNode(i.unref(Vp),{value:"link"},{default:i.withCtx(()=>[i.createElementVNode("div",KX,[i.createVNode(i.unref(hl),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:i.unref(o)("editor.image.dialog.placeholder")},null,8,["modelValue","placeholder"]),i.createVNode(i.unref(yn),{onClick:l},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])):i.createCommentVNode("",!0)]),_:1})]),_:1},8,["id"]))}}),XX=1,YX=1e6,yi={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Bb=0;function JX(){return Bb=(Bb+1)%Number.MAX_VALUE,Bb.toString()}const Ib=new Map;function ZE(t){if(Ib.has(t))return;const e=setTimeout(()=>{Ib.delete(t),gc({type:yi.REMOVE_TOAST,toastId:t})},YX);Ib.set(t,e)}const go=i.ref({toasts:[]});function gc(t){switch(t.type){case yi.ADD_TOAST:go.value.toasts=[t.toast,...go.value.toasts].slice(0,XX);break;case yi.UPDATE_TOAST:go.value.toasts=go.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case yi.DISMISS_TOAST:{const{toastId:e}=t;e?ZE(e):go.value.toasts.forEach(n=>{ZE(n.id)}),go.value.toasts=go.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case yi.REMOVE_TOAST:t.toastId===void 0?go.value.toasts=[]:go.value.toasts=go.value.toasts.filter(e=>e.id!==t.toastId);break}}function Rb(){return{toasts:i.computed(()=>go.value.toasts),toast:ZX,dismiss:t=>gc({type:yi.DISMISS_TOAST,toastId:t})}}function ZX(t){const e=JX(),n=o=>gc({type:yi.UPDATE_TOAST,toast:{...o,id:e}}),r=()=>gc({type:yi.DISMISS_TOAST,toastId:e});return gc({type:yi.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:o=>{o||r()}}}),{id:e,dismiss:r,update:n}}const QX={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},NX=t=>`${(t/1024/1024).toFixed(2)}MB`,QE=Bt.create({name:"imageUpload",isolating:!0,defining:!0,group:"block",draggable:!1,selectable:!1,inline:!1,onCreate(){if(typeof this.options.upload!="function")throw new Error("Image upload function should be a function")},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addAttributes(){return{id:{default:pi(6),parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},addCommands(){return{setImageUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return js(GX)},addOptions(){var t;return{...QX,...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:n,t:r})=>{var o,s;return{component:Ke,componentProps:{action:()=>e.commands.setImageUpload(),disabled:!((s=(o=e.can()).setImage)!=null&&s.call(o,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip")}}}}},addProseMirrorPlugins(){const{toast:t}=Rb(),{t:e}=Ot(),r=JE({validateFn:o=>this.options.acceptMimes.includes(o.type)?o.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${NX(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new tt({props:{handlePaste:(o,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:zX(o,s,r),handleDrop:(o,s,a,l)=>(!(s instanceof DragEvent)||!s.dataTransfer||HX(o,s,l,r),!1)}}),VX()]}}),eY=Ze.create({name:"searchHighlight",addGlobalAttributes(){return[{types:["textStyle"],attributes:{searchHighlight:{default:null,parseHTML:t=>{const e=t,n=e.style.color,r=e.style.backgroundColor;return!n||!r?null:{color:n,backgroundColor:r}},renderHTML:t=>{if(!t.searchHighlight)return{};const{color:e,backgroundColor:n}=t.searchHighlight;return{style:`color: ${e}; background-color: ${n}`}}}}}]}}),NE=Ze.create({name:"base-kit",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),timeHighlighter:{additionalTimeWords:[]},bubble:{list:$B,defaultBubbleList:Ej,button:({editor:e,extension:n,t:r})=>{var l;const{list:o={},defaultBubbleList:s}=((l=n.options)==null?void 0:l.bubble)??{},a=(s==null?void 0:s(e))??[];return kj(o,a,{editor:e,extension:n,t:r})}}}},addExtensions(){var n,r,o;const{t}=Ot(),e=[];this.options.placeholder!==!1&&e.push(V8.configure({placeholder:({node:s,pos:a})=>{var u;const l=(u=s==null?void 0:s.type)==null?void 0:u.name;return l==="heading"?`${t(`editor.heading.h${s.attrs.level}.tooltip`)}`:l==="table"||l==="codeBlock"?"":a===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(dj.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(z8.configure().extend({content:"page+"})),e.push(pK.configure({types:((r=(n=this.options.page)==null?void 0:n.nodesComputedOption)==null?void 0:r.types)??[],slots:i.useSlots()}))):e.push(z8.configure())),this.options.dropcursor!==!1&&e.push(cj.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(aj.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(D8.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(P8.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(wj.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(GU.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(QE.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(YE.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(XE.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(zg.configure(this.options.history)),this.options.fontSize!==!1&&e.push(r8.configure(this.options.fontSize)),this.options.fontFamily!==!1&&e.push(mE.configure(this.options.fontFamily)),this.options.mode!==Ve.EDITOR&&e.push(wK),this.options.superText!==!1&&this.options.mode!==Ve.PLAIN_TEXT&&(typeof this.options.superText=="boolean"?e.push(xE.configure()):e.push(xE.configure(this.options.superText))),this.options.mode===Ve.EDITOR&&(this.options.image!==!1&&e.push(yb.configure()),e.push(t8.configure({spacer:!0}),SC,kC,_C,Vg,Ob,TC,o8.configure({spacer:!0}),n8.configure({types:["heading","paragraph"],spacer:!0}),vE)),this.options.mode!==Ve.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Ve.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(kE.configure()):e.push(kE.configure({specialCharModal:(o=this.options.configPlan)==null?void 0:o.specialCharModal}))),this.options.mode!==Ve.EDITOR&&this.options.mode!==Ve.PLAIN_TEXT&&e.push(CK),(this.options.mode===Ve.STRAIGHT||this.options.mode===Ve.REPORT||this.options.mode===Ve.EDITOR)&&this.options.timeHighlighter&&e.push(yX.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(wX.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(eY),e.push(xj,F8.configure(),gX.configure(),yj.configure(),wb,bb,pg,_X,TX,i8.configure({multicolor:!0}));for(const s in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,s)&&this.options.excludes[s]&&rt.remove(e,({name:l})=>l===s);return e},addStorage(){return{mode:this.options.mode}}}),e5=Dn.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),t5=Dn.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),tY=Ze.create({name:"subAndSuperScript",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>{const o=n.options.subscript,s=n.options.superscript,a={component:Ke,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Ke,componentProps:{action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",tooltip:r("editor.superscript.tooltip")}},u=[];return o!==!1&&u.push(a),s!==!1&&u.push(l),u}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(e5.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(t5.configure(this.options.superscript)),t}}),nY={class:"ml-1"},rY=i.defineComponent({__name:"ActionMoreButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=i.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,o)=>(i.openBlock(),i.createBlock(ia,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(s,a)=>(i.openBlock(),i.createBlock(i.unref(Cl),{key:a,checked:n.value.title===s.title,disabled:s.disabled,class:"flex gap-3 items-center",onClick:s.action},{default:i.withCtx(()=>[s.icon?(i.openBlock(),i.createBlock(i.unref(Lt),{key:0,name:s.icon},null,8,["name"])):i.createCommentVNode("",!0),i.createElementVNode("span",nY,i.toDisplayString(s.title),1),s.shortcutKeys?(i.openBlock(),i.createBlock(i.unref(e8),{key:1,class:"ml-auto"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(z6)(s.shortcutKeys)),1)]),_:2},1024)):i.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),oY=Ze.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,extension:n,t:r}){const o=n.options.subscript,s=n.options.superscript,a={action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",title:r("editor.subscript.tooltip"),shortcutKeys:["mod","."]},l={action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",title:r("editor.superscript.tooltip"),shortcutKeys:["mod",","]},u=T0(e,"code"),c=[];if(o!==!1&&c.push(a),s!==!1&&c.push(l),u){const f={action:()=>e.commands.toggleCode(),isActive:()=>e.isActive("code")||!1,disabled:!e.can().toggleCode(),icon:"Code",title:r("editor.code.tooltip"),shortcutKeys:["mod","E"]};u&&c.push(f)}return{component:rY,componentProps:{icon:"Type",tooltip:r("editor.moremark"),disabled:!e.isEditable||c.every(f=>f.disabled),items:c}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(e5.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(t5.configure(this.options.superscript)),t}});var fa=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(fa||{});function iY(t,e,n){return t<e?e:t>n?n:t}function sY(t,e,n,r){const{doc:o,selection:s}=t;if(!o||!s||!(s instanceof Te||s instanceof Rn))return t;const{from:a,to:l}=s;return o.nodesBetween(a,l,(u,c)=>{const f=u.type;return n.includes(f.name)?(t=aY(t,c,e),!1):!n0(u.type.name,r.extensionManager.extensions)}),t}function aY(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=iY((r.attrs.indent||0)+n,0,7);if(a===r.attrs.indent)return t;const l={...r.attrs,indent:a};return t.setNodeMarkup(e,r.type,l,r.marks)}function n5({delta:t,types:e}){return({state:n,dispatch:r,editor:o})=>{const{selection:s}=n;let{tr:a}=n;return a=a.setSelection(s),a=sY(a,t,e,o),a.docChanged?(r&&r(a),!0):!1}}const lY=Ze.create({name:"indent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:fa.min,maxIndent:fa.max,button({editor:e,t:n}){var s,a;const{selection:r}=e.state,o=r.$anchor.parent;return[{component:Ke,componentProps:{action:()=>{e.commands.indent()},disabled:((s=o==null?void 0:o.attrs)==null?void 0:s.indent)>=fa.max||!e.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:Ke,componentProps:{action:()=>{e.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:((a=o==null?void 0:o.attrs)==null?void 0:a.indent)<=fa.min||!e.can().outdent(),icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.getAttribute("data-indent");return(e?parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>n5({delta:fa.more,types:this.options.types}),outdent:()=>n5({delta:fa.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function uY(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!o,c=YO(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",m=o?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${m}]*`,"gm"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const y=l.pos-b.length,w=Array.from(b.matchAll(g)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const x=w.input.slice(Math.max(0,w.index-1),w.index),E=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(x);if(s!==null&&!E)return null;const k=y+w.index;let C=k+w[0].length;return u&&f.test(b.slice(C-1,C+1))&&(w[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:w[0].slice(n.length),text:w[0]}:null}const cY=new kt("suggestion");function dY({pluginKey:t=cY,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:s=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:u="suggestion",command:c=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=uY}){let b;const y=p==null?void 0:p(),w=new tt({key:t,view(){return{update:async(x,E)=>{var k,C,_,A,T,P,I;const M=(k=this.key)===null||k===void 0?void 0:k.getState(E),j=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),U=M.active&&j.active&&M.range.from!==j.range.from,q=!M.active&&j.active,le=M.active&&!j.active,H=!q&&!le&&M.query!==j.query,F=q||U&&H,L=H||U,K=le||U&&H;if(!F&&!L&&!K)return;const J=K&&!F?M:j,Y=x.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);b={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:ne=>c({editor:e,range:J.range,props:ne}),decorationNode:Y,clientRect:Y?()=>{var ne;const{decorationId:we}=(ne=this.key)===null||ne===void 0?void 0:ne.getState(e.state),xe=x.dom.querySelector(`[data-decoration-id="${we}"]`);return(xe==null?void 0:xe.getBoundingClientRect())||null}:null},F&&((_=y==null?void 0:y.onBeforeStart)===null||_===void 0||_.call(y,b)),L&&((A=y==null?void 0:y.onBeforeUpdate)===null||A===void 0||A.call(y,b)),(L||F)&&(b.items=await f({editor:e,query:J.query})),K&&((T=y==null?void 0:y.onExit)===null||T===void 0||T.call(y,b)),L&&((P=y==null?void 0:y.onUpdate)===null||P===void 0||P.call(y,b)),F&&((I=y==null?void 0:y.onStart)===null||I===void 0||I.call(y,b))},destroy:()=>{var x;b&&((x=y==null?void 0:y.onExit)===null||x===void 0||x.call(y,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,E,k,C){const{isEditable:_}=e,{composing:A}=e.view,{selection:T}=x,{empty:P,from:I}=T,M={...E};if(M.composing=A,_&&(P||e.view.composing)){(I<E.range.from||I>E.range.to)&&!A&&!E.composing&&(M.active=!1);const j=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:a,$position:T.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;j&&m({editor:e,state:C,range:j.range,isActive:E.active})?(M.active=!0,M.decorationId=E.decorationId?E.decorationId:U,M.range=j.range,M.query=j.query,M.text=j.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(x,E){var k;const{active:C,range:_}=w.getState(x.state);return C&&((k=y==null?void 0:y.onKeyDown)===null||k===void 0?void 0:k.call(y,{view:x,event:E,range:_}))||!1},decorations(x){const{active:E,range:k,decorationId:C}=w.getState(x);return E?ft.create(x.doc,[jt.inline(k.from,k.to,{nodeName:l,class:u,"data-decoration-id":C})]):null}}});return w}const fY=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],pY=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],hY=[{label:"墨刀",value:"modao",icon:"Modao"},{label:"蓝湖",value:"lanhu",icon:"Lanhu"},{label:"Figma",value:"figma",icon:"Figma"},{label:"Canva",value:"canva",icon:"Canva"},{label:"ProcessOn",value:"processon",icon:"Processon"}],mY=[{label:"CodePen",value:"codepen",icon:"Codepen"}],gY=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],bY=[],vY=[...fY,...pY,...hY,...mY,...gY,...bY];function yY(t){const{t:e}=Ot(),n=[{name:"format",title:e("editor.slash.format"),commands:[{name:"paragraph",label:e("editor.paragraph.tooltip"),aliases:["paragraph","zw"],iconName:"Paragraph",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading1",label:e("editor.heading.h1.tooltip"),aliases:["h1","bt","bt1"],iconName:"Heading1",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading2",label:e("editor.heading.h2.tooltip"),aliases:["h2","bt","bt2"],iconName:"Heading2",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setNode("heading",{level:2}).run()}},{name:"heading3",label:e("editor.heading.h3.tooltip"),aliases:["h3","bt","bt3","heading3"],iconName:"Heading3",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setNode("heading",{level:3}).run()}},{name:"bulletList",label:e("editor.bulletlist.tooltip"),aliases:["ul","yxlb","bulletList"],iconName:"List",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).toggleBulletList().run()}},{name:"numberedList",label:e("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).toggleOrderedList().run()}},{name:"codeBlock",label:e("editor.codeblock.tooltip"),iconName:"Code2",aliases:["codeBlock"],description:"Code block with syntax highlighting",shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setCodeBlock().run()}},{name:"blockquote",label:e("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setBlockquote().run()}},{name:"horizontalrule",label:e("editor.horizontalrule.tooltip"),aliases:["fgx","horizontalRule"],iconName:"Minus",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setHorizontalRule().run()}},{name:"link",label:e("editor.link.tooltip"),aliases:["link","lianjie","lj"],iconName:"Link",action:({editor:o,range:s})=>{o.chain().deleteRange(s).extendMarkRange("link").insertContent({type:"text",text:"link",marks:[{type:"link",attrs:{href:"",target:"_blank"}}]}).setLink({href:""}).focus().run()}}]},{name:"insert",title:e("editor.slash.insert"),commands:[{name:"image",label:e("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setImageUpload().run()}},{name:"table",label:e("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}},{name:"video",label:e("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setVideoUpload().run()}},{name:"taskList",label:e("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).toggleTaskList().run()}},{name:"columns",label:e("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",aliases:["columns","cols","2cols"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().deleteRange(s).setColumns().focus(o.state.selection.head-1).run()}}]}];if(T0(t,"iframes")){const o=vY;n.push({name:"others",title:e("editor.slash.embed"),commands:o.map(s=>({name:s.value,label:s.label,iconName:s.icon,aliases:[s.value,s.label],shouldBeHidden:a=>a.isActive("columns"),action:({editor:a,range:l})=>{a.chain().deleteRange(l).focus().setIframe({src:"",service:s.value}).run()}}))})}return n}const wY={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},xY={className:"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-2 font-semibold tracking-wider select-none uppercase first:mt-0.5"},CY=["onClick"],EY=["src"],kY={key:1,class:"p-3"},SY={class:"text-xs text-gray-800 dark:text-gray-400"},_Y=i.defineComponent({__name:"CommandsList",props:{editor:{},items:{default:void 0},command:{type:Function,default:void 0}},setup(t,{expose:e}){const n=i.ref(0),r=i.ref(0),o=i.ref(null),{t:s}=Ot(),a=i.ref([]),l=t;e({onKeyDown:u}),i.watch([()=>n.value,()=>r.value],async()=>{if(!o.value)return;await i.nextTick();const y=r.value*1e3+n.value,w=a.value[y];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:y}){return y.key==="ArrowUp"?(c(),!0):y.key==="ArrowDown"?(f(),!0):y.key==="Enter"?(p(),!0):!1}function c(){var x;if(!l.items.length)return!1;let y=n.value-1,w=r.value;y<0&&(w=r.value-1,y=((x=l.items[w])==null?void 0:x.commands.length)-1||0),w<0&&(w=l.items.length-1,y=l.items[w].commands.length-1),n.value=y,r.value=w}function f(){if(!l.items.length)return!1;const y=l.items[r.value].commands;let w=n.value+1,x=r.value;y.length-1<w&&(w=0,x=r.value+1),l.items.length-1<x&&(x=0),n.value=w,r.value=x}function p(){if(!l.items.length||r.value===-1||n.value===-1)return!1;m(r.value,n.value)}function m(y,w){const x=l.items[y].commands[w];l.command(x)}function g(y,w){m(y,w)}function b(y,w,x){a.value[y*1e3+w]=x}return(y,w)=>{var x;return i.openBlock(),i.createElementBlock("div",{ref_key:"scrollContainer",ref:o,class:"bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800 text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-1"},[(x=y.items)!=null&&x.length?(i.openBlock(),i.createElementBlock("div",wY,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(y.items,(E,k)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:E.title},[i.createElementVNode("div",xY,i.toDisplayString(E.title),1),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(E.commands,(C,_)=>(i.openBlock(),i.createElementBlock("button",{ref_for:!0,ref:A=>b(k,_,A),key:_,class:i.normalizeClass(["flex items-center gap-3 px-2 py-1.5 text-sm text-neutral-800 dark:text-neutral-200 text-left w-full rounded-sm outline-none transition-colors",[r.value===k&&n.value===_?"bg-ed-accent text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200":"hover:bg-ed-accent hover:text-neutral-800 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"]]),onClick:A=>g(k,_)},[C.iconUrl?(i.openBlock(),i.createElementBlock("img",{key:0,class:"w-6 h-6",src:C.iconUrl},null,8,EY)):i.createCommentVNode("",!0),C.iconName?(i.openBlock(),i.createBlock(i.unref(Lt),{key:1,name:C.iconName,class:"mr-1 text-lg"},null,8,["name"])):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(C.label),1)],10,CY))),128))],64))),128))])):(i.openBlock(),i.createElementBlock("div",kY,[i.createElementVNode("span",SY,i.toDisplayString(i.unref(s)("editor.slash.empty")),1)]))],512)}}}),pa="slashCommand";let Pt;const TY=Ze.create({name:pa,priority:200,onCreate(){Pt=Hs("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[dY({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new kt(pa),allow:({state:t,range:e})=>{var c,f,p;const n=t.doc.resolve(e.from),r=n.depth===1,o=n.parent.type.name==="paragraph",s=((c=n.parent.textContent)==null?void 0:c.charAt(0))==="/",a=this.editor.isActive("column"),l=(p=n.parent.textContent)==null?void 0:p.substring((f=n.parent.textContent)==null?void 0:f.indexOf("/")),u=!(l!=null&&l.endsWith(" "));return(r&&o&&s||a&&o&&s)&&u},command:({editor:t,range:e,props:n})=>{const{view:r}=t;n.action({editor:t,range:e}),r.focus()},items:({query:t})=>yY(this.editor).map(s=>({...s,commands:s.commands.filter(a=>{const l=a.label.toLowerCase().trim(),u=t.toLowerCase().trim();if(a.aliases){const c=a.aliases.map(m=>m.toLowerCase().trim()),f=l.match(u),p=c.some(m=>m.match(u));return f||p}return l.match(u)}).filter(a=>a.shouldBeHidden?!a.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(a=>({...a,isEnabled:!0}))})),render:()=>{let t,e=null;return{onStart:n=>{var s;t=new lw(_Y,{props:n,editor:n.editor});const{view:r}=n.editor,o=()=>{if(!n.clientRect)return n.editor.storage[pa].rect;const a=n.clientRect();if(!a)return n.editor.storage[pa].rect;let l=a.y;if(t.element instanceof HTMLElement&&a.top+t.element.offsetHeight+40>window.innerHeight){const u=a.top+t.element.offsetHeight-window.innerHeight+40;l=a.y-u}return new DOMRect(a.x,l,a.width,a.height)};e=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:o})},(s=r.dom.parentElement)==null||s.addEventListener("scroll",e),t.element&&(Pt==null||Pt[0].setProps({getReferenceClientRect:o,appendTo:()=>document.body,content:t.element})),Pt==null||Pt[0].show()},onUpdate(n){var a;t.updateProps(n);const{view:r}=n.editor,o=()=>{if(!n.clientRect)return n.editor.storage[pa].rect;const l=n.clientRect();return l?new DOMRect(l.x,l.y,l.width,l.height):n.editor.storage[pa].rect},s=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:o})};(a=r.dom.parentElement)==null||a.addEventListener("scroll",s),n.editor.storage[pa].rect=n.clientRect?o():{width:0,height:0,left:0,top:0,right:0,bottom:0},Pt==null||Pt[0].setProps({getReferenceClientRect:o})},onKeyDown(n){var r;return n.event.key==="Escape"?(Pt==null||Pt[0].hide(),!0):(Pt!=null&&Pt[0].state.isShown||Pt==null||Pt[0].show(),(r=t.ref)==null?void 0:r.onKeyDown(n))},onExit(n){var r;if(Pt==null||Pt[0].hide(),e){const{view:o}=n.editor;(r=o.dom.parentElement)==null||r.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),AY=i.defineComponent({__name:"AIButton",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},customClass:{default:""},loading:{type:Boolean,default:!1},tooltipOptions:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=wn(),{toast:r}=Rb();function o(){var a,l,u;const s=(l=(a=e.editor.extensionManager.extensions.find(c=>c.name==="AI"))==null?void 0:a.options)==null?void 0:l.completions;if(typeof s!="function"){r({title:"AI completions method is not set or is not a valid function",variant:"destructive"});return}if(s.constructor.name!=="AsyncFunction"){r({title:"AI completions method must be an asynchronous function",variant:"destructive"});return}n.state.AIMenu=!0,(u=e.editor)==null||u.commands.focus()}return(s,a)=>(i.openBlock(),i.createBlock(Ke,{action:o,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),OY=Bt.create({name:"AI",group:"block",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:({editor:e,t:n})=>({component:AY,componentProps:{icon:"Sparkles",tooltip:n("editor.AI.ask")}})}}});function MY(t,e){const n=atob(t.split(",")[1]),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);const o=new Uint8Array(r);return new Blob([o],{type:e})}function BY(t,e){return new File([t],e,{type:t.type})}const IY=Ze.create({name:"importWord",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{action:()=>{var o;return(o=e.commands)==null?void 0:o.toggleImportWord()},disabled:!e.can().setHorizontalRule(),icon:"Word",tooltip:r("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=Rb(),{t:r}=Ot();async function o(u){var g;const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(T0(e,"image")){const b=(g=e.extensionManager.extensions.find(y=>y.name==="importWord"))==null?void 0:g.options;if(b&&typeof b.upload=="function"){const y=[];for(const x of p){const E=x.getAttribute("src"),k=MY(E,"image/jpeg"),C=BY(k,"image.jpeg");y.push(C)}const w=await b.upload(y);for(let x=0;x<p.length;x++){const E=p[x];E.setAttribute("src",w[x].src);const k=E.parentElement;(k==null?void 0:k.tagName)==="P"&&(k.insertAdjacentElement("beforebegin",E),!k.hasChildNodes()&&k.textContent===""&&k.remove())}return f.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),f.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),f.body.innerHTML}async function s(u){const c=await o(u);e.chain().setContent(c.toString(),!0).run(),n({title:r("editor.importWord.success")})}const{open:a,onChange:l}=ht.useFileDialog({accept:".docx",reset:!0,multiple:!1});return a(),l(async u=>{const[c]=Array.from(u??[]);if(c){if(c.size>this.options.limit){n({title:r("editor.importWord.fileTooLarge"),variant:"destructive"});return}if(this.options.convert){const f=await this.options.convert(c);s(f)}else{const f=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});f.append("config",p),f.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:f}).then(m=>m.json()).then(async m=>{s(m.html)}).catch(m=>{n({title:r("editor.importWord.error"),variant:"destructive"}),console.error("Error:",m)})}}}),!1}}}}),Lb=wn(),RY=Ze.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{icon:"Eye",action:()=>{Lb.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>Lb.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Lb.togglePreview(),!0)}}}),r5=wn(),LY=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function PY(t,e,n,r){const o=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ft.empty,results:[]};t==null||t.descendants((u,c)=>{u.isText?a[l]?a[l]={text:a[l].text+u.text,pos:a[l].pos}:a[l]={text:`${u.text}`,pos:c}:l+=1}),a=a.filter(Boolean);for(const u of a){const{text:c,pos:f}=u,p=Array.from(c.matchAll(e)).filter(([m])=>m.trim());for(const m of p){if(m[0]==="")break;m.index!==void 0&&s.push({from:f+m.index,to:f+m.index+m[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],f=u===r?`${n} ${n}-current`:n,p=jt.inline(c.from,c.to,{class:f});o.push(p)}return{decorationsToReturn:ft.create(t,o),results:s}}const DY=(t,e,{state:n,dispatch:r})=>{if(!e[0])return;const{from:s,to:a}=e[0];r&&r(n.tr.insertText(t,s,a))},VY=(t,e,n,r)=>{const o=e+1;if(!r[o])return null;const{from:s,to:a}=r[e],l=a-s-t.length+n,{from:u,to:c}=r[o];return r[o]={to:c-l,from:u-l},[l,r]},FY=(t,e,{tr:n,dispatch:r})=>{let o=0,s=e.slice();if(s.length){for(let a=0;a<s.length;a+=1){const{from:l,to:u}=s[a];n.insertText(t,l,u);const c=VY(t,a,o,s);c&&(o=c[0],s=c[1])}r&&r(n)}},$Y=new kt("findAndReplacePlugin"),zY=Ze.create({name:"findAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{icon:"DocSearch",tooltip:r("editor.findAndReplace.tooltip"),action:()=>{r5.toggleFindAndReplace()},isActive:()=>r5.state.findAndReplace}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e})=>(e.storage.findAndReplace.searchTerm=t,!1),setReplaceTerm:t=>({editor:e})=>(e.storage.findAndReplace.replaceTerm=t,!1),setCaseSensitive:t=>({editor:e})=>(e.storage.findAndReplace.caseSensitive=t,!1),resetIndex:()=>({editor:t})=>(t.storage.findAndReplace.resultIndex=0,!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n+1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n-1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:n})=>{const{replaceTerm:r,results:o}=t.storage.findAndReplace;return DY(r,o,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:o}=t.storage.findAndReplace;return FY(r,o,{tr:e,dispatch:n}),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:n}=this.options,r=a=>t.storage.findAndReplace.lastSearchTerm=a,o=a=>t.storage.findAndReplace.lastCaseSensitive=a,s=a=>t.storage.findAndReplace.lastResultIndex=a;return[new tt({key:$Y,state:{init:()=>ft.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&b===g)return u;if(r(c),o(p),s(g),!c)return t.storage.findAndReplace.results=[],ft.empty;const{decorationsToReturn:y,results:w}=PY(a,LY(c,n,p),e,g);return t.storage.findAndReplace.results=w,y}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:HY,state:UY}=wn(),WY=Ze.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{tooltip:e("editor.printer.tooltip"),action:()=>HY(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>UY.printer}})}}}),Pb="spell-check";class jY{constructor(e,n,r,o=1e3){Xt(this,"debouncedGetMatchAndSetDecorations",rt.debounce(this.getMatchAndSetDecorations.bind(this),300));Xt(this,"debouncedGetMatchAndSetDecorationsList",rt.debounce(this.getMatchAndSetDecorationsList.bind(this),300));Xt(this,"debouncedClickEventsListener",rt.debounce(this.clickEventsListener.bind(this),0));Xt(this,"debouncedAcceptSuggestionEventsListener",rt.debounce(this.acceptSuggestionListener.bind(this),0));Xt(this,"debouncedProofreadChangedNodes",rt.debounce(this.proofreadChangedNodes.bind(this),300));Xt(this,"proofreader");Xt(this,"uiStrings");Xt(this,"showSuggestionsEvent");Xt(this,"decorationSet");Xt(this,"editorView");Xt(this,"isInitialProofreadingDone",!1);Xt(this,"lastOriginalFrom",0);Xt(this,"lastClickedDecoration",null);Xt(this,"suggestionBox");Xt(this,"isEnableSuggestion");Xt(this,"isMobile");Xt(this,"limit",1e3);Xt(this,"_debouncedProofreadDoc",rt.debounce((e,n)=>{this.proofreadDoc(e),n&&n()},500));Xt(this,"_debouncedHandleEnterKey",rt.debounce((e,n,r)=>{this.handleEnterKey(e,n),r&&r()},500));this.proofreader=e,this.uiStrings=n,this.showSuggestionsEvent=r,this.decorationSet=ft.empty,this.limit=o,this.suggestionBox=document.createElement("div"),this.suggestionBox.id="suggestions-box",this.suggestionBox.tabIndex=0,this.isEnableSuggestion=!0,this.isMobile=!1,this.hideSuggestionBox()}get completeProofreadingDone(){return this.isInitialProofreadingDone}getProofreader(){return this.proofreader}toggleIsEnabledSpellCheck(){this.proofreader.toggleIsEnabled()}setEnabledProofreadText(e){this.proofreader.setEnabled(e)}getIsEnabledSpellCheck(){return this.proofreader.getIsEnabled()}setDecorationSet(e){this.decorationSet=e}getDecorationSet(){return this.decorationSet}setEditorView(e){this.editorView=e}getEditorView(){return this.editorView}getSuggestionBox(){return this.suggestionBox}hideSuggestionBox(){this.suggestionBox.textContent="",this.suggestionBox.style.display="none"}setIsEnableSuggestion(e){if(this.isEnableSuggestion=e,this.isEnableSuggestion){this.addEventListenersToDecorations();return}this.hideSuggestionBox(),this.removeEventListenersFromDecorations()}setIsMobile(e){this.isMobile=e}getChangedNodesFromTransaction(e,n=!1,r=!1){const o=[],s=new Set;let a=!1;return e.steps.forEach(l=>{var p,m,g;const u=l;if(u.from===void 0||u.to===void 0||n&&u.structure)return;((m=(p=u.slice)==null?void 0:p.content[0])==null?void 0:m.type.name)===hc&&(a=!0);const c=u.from-(r?1:0);let f=Math.max(u.to,u.from+(((g=u.slice)==null?void 0:g.size)||0))-(r?1:0);f>e.doc.content.size&&(f=e.doc.content.size),e.doc.nodesBetween(c,f,(b,y)=>{b&&(b.isText&&!s.has(y)&&(o.push({node:b,pos:y}),s.add(y)),b.type.name===hc&&(a=!0))})}),{changedNodes:o,isChangedSuperText:a}}debouncedProofreadDoc(e,n){this._debouncedProofreadDoc(e,n)}isSuperTextAlone(e,n){let r=!1;return e.descendants((o,s,a)=>o===n?(a&&a.type.name==="paragraph"&&a.childCount===1&&a.firstChild===n&&(r=!0),!1):!0),r}proofreadDoc(e){let n=[],r=0;e==null||e.descendants((u,c)=>{if(u.isText){const f={text:u.text??"",from:c,to:c+u.nodeSize};return n[r]&&(f.text=n[r].text+f.text,f.from=n[r].from),n[r]=f,r+=1,!1}return u.type.name!==hc}),n=n.filter(Boolean);let o="",s=1;for(const{text:u,from:c,to:f}of n){const p=c-s;p>0&&(o+=Array(p+1).join(`
|
|
292
|
+
`,tooltip:"수퍼 보기"}}]}},addAttributes(){return{[Qe.ID]:{default:null},[Qe.TEXT]:{default:""},[Qe.POSITION]:{default:"0"},[Qe.ELEMENT_ID]:{default:""}}},addCommands(){return{toggleSuperTextView:()=>({editor:t})=>t.storage.superText.enable=!t.storage.superText.enable,toggleSuperInputMoblie:()=>({editor:t})=>t.storage.superText.bottomSheetComponent?t.storage.superText.isShowSuperInputMoblie=!t.storage.superText.isShowSuperInputMoblie:(console.error("Please configure bottomSheetComponent!"),!1),setSuperTextContent:(t,e)=>({editor:n})=>(n.storage.superText.superTextContent=t,n.storage.superText.superTextPosition=e,!!t)}},parseHTML(){return[{tag:"button.super-text"}]},renderHTML({HTMLAttributes:t}){return["button",bt(t,{class:"super-text"})]},addNodeView(){return js(HK)},addProseMirrorPlugins(){return[new tt({appendTransaction(t,e,n){let r=n.tr,o=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="superText"){const l=s.attrs[Qe.POSITION],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,[Qe.POSITION]:u}),o=!0)}}),o?r:null}}),new tt({filterTransaction(t,e){return t.steps.some(r=>{if(r.toJSON&&r.toJSON().stepType==="replace"){const o=r.toJSON();return o.slice&&o.slice.content&&o.slice.content.some(s=>s.type===hc)}return!1})&&t.setMeta(wE.UPDATE,!0),!0}}),UK,WK]}}),CE=i.defineComponent({__name:"DialogDescription",props:{asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:o,...s}=e;return s}),r=Xn(n);return(o,s)=>(i.openBlock(),i.createBlock(i.unref(sL),i.mergeProps(i.unref(r),{class:i.unref(ke)("text-sm text-ed-muted-foreground",e.class)}),{default:i.withCtx(()=>[i.renderSlot(o.$slots,"default")]),_:3},16,["class"]))}}),jK={class:"flex gap-x-2 items-center"},qK={class:"sr-only"},KK={class:"flex justify-end gap-x-2.5 flex-1"},GK=["disabled"],EE=Bo(i.defineComponent({__name:"SuperInputDialogMoblie",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextId:{},superTextElementId:{},isViewMode:{type:Boolean},title:{}},emits:["close","save","delete"],setup(t,{emit:e}){const n=e,r=t,{t:o}=Ot(),s=i.ref(""),a=i.ref(!1),l=i.ref(r.isViewMode??!1),u=i.ref(!1);i.watch(()=>r.isViewMode,g=>{l.value=g,g||(s.value="")});const c=i.computed(()=>{var b;if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,((b=g==null?void 0:g.textContent)==null?void 0:b.trim())===""});i.watch(()=>r.open,()=>{r.open&&r.superTextInit&&(s.value=r.superTextInit)});const f=()=>{n("close"),a.value=!1,l.value=!0,u.value=!1},p=()=>{n("save",s.value),s.value="",l.value=!0,u.value=!1},m=()=>{u.value=!0,l.value=!1};return(g,b)=>{const y=Ap,w=Tp,x=_p,E=CE,k=hb,C=Sp,_=kp;return i.openBlock(),i.createBlock(_,{open:g.open},{default:i.withCtx(()=>[i.createVNode(C,{isOverlayTransparent:"",class:"p-2.5 gap-0 gap-y-2.5 border-none w-[calc(100%-40px)] !shadow-ed rounded-[5px]"},{default:i.withCtx(()=>[i.createVNode(x,{class:"text-left flex-row justify-between"},{default:i.withCtx(()=>[i.createVNode(y,{class:"text-base font-normal"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(g.title?g.title:i.unref(o)("editor.superinput")),1)]),_:1}),i.createElementVNode("div",jK,[i.withDirectives(i.createElementVNode("button",{onClick:m},[i.createVNode(i.unref(N1),{icon:"lucide:edit-2"})],512),[[i.vShow,l.value]]),i.createVNode(w,{class:"outline-none",onClick:f},{default:i.withCtx(()=>[i.createVNode(i.unref(Ff),{class:"w-5 h-5"}),i.createElementVNode("span",qK,i.toDisplayString(i.unref(o)("editor.close")),1)]),_:1})])]),_:1}),i.createVNode(E,{class:"hidden"}),i.createVNode(mb,{isReadOnly:l.value,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=A=>s.value=A),"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["isReadOnly","modelValue","parent-editor"]),i.createVNode(k,{class:"flex-row justify-between"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("button",{onClick:b[1]||(b[1]=A=>n("delete"))},i.toDisplayString(i.unref(o)("editor.delete")),513),[[i.vShow,u.value]]),i.withDirectives(i.createElementVNode("div",KK,[i.createElementVNode("button",{onClick:f},i.toDisplayString(i.unref(o)("editor.menubar.menu.cancel")),1),i.createElementVNode("button",{onClick:p,disabled:i.unref(c),class:i.normalizeClass({"cursor-not-allowed":i.unref(c)})},i.toDisplayString(i.unref(o)("editor.menubar.menu.save")),11,GK)],512),[[i.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-2f4982a0"]]),XK=["innerHTML"],YK=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],JK=i.defineComponent({__name:"ConfigPlan",props:Ws,setup(t){const e=t,n=i.ref(!1),r=i.ref(null),{selection:o,doc:s}=e.editor.state,a=i.inject("isMobile"),l=i.ref(!1),u=ht.useEventBus(ar.RENDER_SUPER_TEXT),c=i.computed(()=>{var _,A;const x=s.resolve(o.from),E=x==null?void 0:x.node(-1),k=(_=E==null?void 0:E.attrs)==null?void 0:_.id,C=(A=E==null?void 0:E.attrs)==null?void 0:A.pageNumber;return{pageId:k,pageNumber:C}}),f=i.computed(()=>{const x=e.getPos(),E=e.editor.state.doc.resolve(x);for(let k=E.depth;k>0;k--){const C=E.node(k);if(C.type.name==="paragraph")return C}return null}),p=i.computed(()=>{var x;return((x=f.value)==null?void 0:x.attrs.id)||""});function m(x){e.updateAttributes({"data-text":x}),n.value=!1}function g(x){const E=e.node.attrs[Qe.TEXT],k=e.node.attrs[Qe.ID],_={lineId:x.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:E};u.emit({action:"hover",payload:_})}function b(x){const E=e.node.attrs[Qe.ID],C={lineId:x.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:C})}function y(){const{getPos:x,node:E,editor:k}=e,C=x(),_=C+1;k.commands.deleteRange({from:C,to:_})}function w(){n.value=!0,a&&(l.value=!0)}return(x,E)=>{const k=yn,C=pb,_=fb,A=db,T=cb,P=pc;return i.openBlock(),i.createBlock(i.unref(Us),{as:"span",class:i.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":i.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:i.withCtx(()=>[i.createVNode(T,null,{default:i.withCtx(()=>[i.createVNode(C,{as:"template",class:"relative"},{default:i.withCtx(()=>[i.createVNode(k,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:w,onMouseenter:g,onMouseleave:b},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{name:"plan",class:i.normalizeClass({"w-[18px] h-auto pr-1":i.unref(a)})},null,8,["class"]),E[3]||(E[3]=i.createTextVNode(" [")),i.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[i.unref(Qe).TEXT]},null,8,XK),E[4]||(E[4]=i.createTextVNode("] ")),i.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[i.unref(Qe).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[i.unref(Qe).TEXT],"node-id":e.node.attrs[i.unref(Qe).ID],"line-id":p.value},null,8,YK)]),_:1})]),_:1}),i.createVNode(A,null,{default:i.withCtx(()=>[i.createVNode(_,{onSelect:E[0]||(E[0]=I=>n.value=!0)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(x.$t("editor.configPlan.edit")),1)]),_:1}),i.createVNode(_,{onSelect:y},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(x.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),i.unref(a)?(i.openBlock(),i.createBlock(EE,{key:1,title:x.$t("editor.configPlan"),open:n.value,"is-view-mode":l.value,editor:e.editor,"super-text-init":e.node.attrs[i.unref(Qe).TEXT],"super-text-id":e.node.attrs[i.unref(Qe).ID],onClose:E[2]||(E[2]=I=>n.value=!1),onSave:m,onDelete:y},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(i.openBlock(),i.createBlock(P,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[i.unref(Qe).TEXT],"super-text-element-id":e.node.attrs[i.unref(Qe).ELEMENT_ID],onClose:E[1]||(E[1]=I=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),kE=Bt.create({name:"configPlan",inline:!0,group:"inline",atom:!0,draggable:!0,addStorage(){return{isShowConfigPlanInput:!1}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>[...n?[{component:Ke,componentProps:{action:()=>{t.commands.toggleConfigPlanInput()},isActive:()=>{},icon:"plan",title:e("editor.insertConfigPlan"),tooltip:e("editor.insertConfigPlan"),customClass:"whitespace-nowrap !bg-ed-blue !text-white !font-normal rounded-[3px] h-[26px] gap-x-1 ml-auto",customClassTooltip:"ml-auto"}}]:[]]}},addAttributes(){return{"data-id":{default:null},"data-text":{default:""},"data-position":{default:"0"}}},addCommands(){return{toggleConfigPlanInput:()=>({editor:t})=>t.storage.configPlan.isShowConfigPlanInput=!t.storage.configPlan.isShowConfigPlanInput}},parseHTML(){return[{tag:"button.config-plan"}]},renderHTML({HTMLAttributes:t}){return["button",bt(t,{class:"config-plan"})]},addNodeView(){return js(JK)},addProseMirrorPlugins(){return[new tt({appendTransaction(t,e,n){let r=n.tr,o=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="configPlan"){const l=s.attrs["data-position"],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,"data-position":u}),o=!0)}}),o?r:null}})]}});var xb,Cb;if(typeof WeakMap<"u"){let t=new WeakMap;xb=e=>t.get(e),Cb=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;xb=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},Cb=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var rn=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,a=o+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;a<this.height&&this.map[e+this.width*l]==n;l++)a++;return{left:r,top:o,right:s,bottom:a}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:o,top:s,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[s*this.width+(n<0?r-1:o)]:(n<0?s==0:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(t,e){const{left:n,right:r,top:o,bottom:s}=this.findCell(t),{left:a,right:l,top:u,bottom:c}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(o,u),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){const s=r*this.width+o,a=this.map[s];n[a]||(n[a]=!0,!(o==t.left&&o&&this.map[s-1]==a||r==t.top&&r&&this.map[s-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){const s=o+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const l=(t+1)*this.width;for(;a<l&&this.map[a]<o;)a++;return a==l?s-1:this.map[a]}o=s}}static get(t){return xb(t)||Cb(t,ZK(t))}};function ZK(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=QK(t),n=t.childCount,r=[];let o=0,s=null;const a=[];for(let c=0,f=e*n;c<f;c++)r[c]=0;for(let c=0,f=0;c<n;c++){const p=t.child(c);f++;for(let b=0;;b++){for(;o<r.length&&r[o]!=0;)o++;if(b==p.childCount)break;const y=p.child(b),{colspan:w,rowspan:x,colwidth:E}=y.attrs;for(let k=0;k<x;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:x-k});break}const C=o+k*e;for(let _=0;_<w;_++){r[C+_]==0?r[C+_]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:w-_});const A=E&&E[_];if(A){const T=(C+_)%e*2,P=a[T];P==null||P!=A&&a[T+1]==1?(a[T]=A,a[T+1]=1):P==A&&a[T+1]++}}}o+=w,f+=y.nodeSize}const m=(c+1)*e;let g=0;for(;o<m;)r[o++]==0&&g++;g&&(s||(s=[])).push({type:"missing",row:c,n:g}),f++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new rn(e,n,r,s);let u=!1;for(let c=0;!u&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(u=!0);return u&&NK(l,a,t),l}function QK(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const o=t.child(r);let s=0;if(n)for(let a=0;a<r;a++){const l=t.child(a);for(let u=0;u<l.childCount;u++){const c=l.child(u);a+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let a=0;a<o.childCount;a++){const l=o.child(a);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function NK(t,e,n){t.problems||(t.problems=[]);const r={};for(let o=0;o<t.map.length;o++){const s=t.map[o];if(r[s])continue;r[s]=!0;const a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let l=null;const u=a.attrs;for(let c=0;c<u.colspan;c++){const f=(o+c)%t.width,p=e[f*2];p!=null&&(!u.colwidth||u.colwidth[c]!=p)&&((l||(l=eG(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function eG(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function zn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var ms=new kt("selectingCells");function Tl(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function tG(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function mo(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Bp(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Tl(e.$head)||nG(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function nG(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Eb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function rG(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function kb(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function SE(t,e,n){const r=t.node(-1),o=rn.get(r),s=t.start(-1),a=o.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function da(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function _E(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function oG(t,e,n){const r=zn(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var zt=class Oi extends Ve{constructor(e,n=e){const r=e.node(-1),o=rn.get(r),s=e.start(-1),a=o.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=o.cellsInRect(a).filter(f=>f!=n.pos-s);u.unshift(n.pos-s);const c=u.map(f=>{const p=r.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=s+f+1;return new hy(l.resolve(m),l.resolve(m+p.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(Eb(r)&&Eb(o)&&kb(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Oi.rowSelection(r,o):s&&this.isColSelection()?Oi.colSelection(r,o):new Oi(r,o)}return Te.between(r,o)}content(){const e=this.$anchorCell.node(-1),n=rn.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let u=o.top;u<o.bottom;u++){const c=[];for(let f=u*n.width+o.left,p=o.left;p<o.right;p++,f++){const m=n.map[f];if(s[m])continue;s[m]=!0;const g=n.findCell(m);let b=e.nodeAt(m);if(!b)throw RangeError(`No cell with offset ${m} found`);const y=o.left-g.left,w=g.right-o.right;if(y>0||w>0){let x=b.attrs;if(y>0&&(x=da(x,0,y)),w>0&&(x=da(x,x.colspan-w,w)),g.left<o.left){if(b=b.type.createAndFill(x),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else b=b.type.create(x,b.content)}if(g.top<o.top||g.bottom>o.bottom){const x={...b.attrs,rowspan:Math.min(g.bottom,o.bottom)-Math.max(g.top,o.top)};g.top<o.top?b=b.type.createAndFill(x):b=b.type.create(x,b.content)}c.push(b)}a.push(e.child(u).copy(de.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new Ce(de.from(l),1,1)}replace(e,n=Ce.empty){const r=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){const{$from:l,$to:u}=o[a],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(u.pos),a?Ce.empty:n)}const s=Ve.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Ce(de.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=rn.get(n),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let a=0;a<s.length;a++)e(n.nodeAt(s[a]),o+s[a])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),o=rn.get(r),s=e.start(-1),a=o.findCell(e.pos-s),l=o.findCell(n.pos-s),u=e.node(0);return a.top<=l.top?(a.top>0&&(e=u.resolve(s+o.map[a.left])),l.bottom<o.height&&(n=u.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+o.map[l.left])),a.bottom<o.height&&(e=u.resolve(s+o.map[o.width*(o.height-1)+a.right-1]))),new Oi(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=rn.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const a=o+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,l)==n.width}eq(e){return e instanceof Oi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),o=rn.get(r),s=e.start(-1),a=o.findCell(e.pos-s),l=o.findCell(n.pos-s),u=e.node(0);return a.left<=l.left?(a.left>0&&(e=u.resolve(s+o.map[a.top*o.width])),l.right<o.width&&(n=u.resolve(s+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+o.map[l.top*o.width])),a.right<o.width&&(e=u.resolve(s+o.map[o.width*(a.top+1)-1]))),new Oi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Oi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Oi(e.resolve(n),e.resolve(r))}getBookmark(){return new iG(this.$anchorCell.pos,this.$headCell.pos)}};zt.prototype.visible=!1,Ve.jsonID("cell",zt);var iG=class P_{constructor(e,n){this.anchor=e,this.head=n}map(e){return new P_(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&kb(n,r)?new zt(n,r):Ve.near(r,1)}};function sG(t){if(!(t.selection instanceof zt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(jt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ft.create(t.doc,e)}function aG({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function lG({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){const s=t.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let o=e.depth;o>0;o--){const s=e.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function uG(t,e,n){const r=(e||t).selection,o=(e||t).doc;let s,a;if(r instanceof Le&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=zt.create(o,r.from);else if(a=="row"){const l=o.resolve(r.from+1);s=zt.rowSelection(l,l)}else if(!n){const l=rn.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=zt.create(o,u+1,c)}}else r instanceof Te&&aG(r)?s=Te.create(o,r.from):r instanceof Te&&lG(r)&&(s=Te.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var cG=new kt("fix-tables");function TE(t,e,n,r){const o=t.childCount,s=e.childCount;e:for(let a=0,l=0;a<s;a++){const u=e.child(a);for(let c=l,f=Math.min(o,a+3);c<f;c++)if(t.child(c)==u){l=c+1,n+=u.nodeSize;continue e}r(u,n),l<o&&t.child(l).sameMarkup(u)?TE(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function AE(t,e){let n;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(n=dG(t,o,s,n))};return e?e.doc!=t.doc&&TE(e.doc,t.doc,0,r):t.doc.descendants(r),n}function dG(t,e,n,r){const o=rn.get(e);if(!o.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<o.height;u++)s.push(0);for(let u=0;u<o.problems.length;u++){const c=o.problems[u];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const p=f.attrs;for(let m=0;m<p.rowspan;m++)s[c.row+m]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,da(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const f=r.mapping.map(n);r.delete(f,f+e.nodeSize)}}let a,l;for(let u=0;u<s.length;u++)s[u]&&(a==null&&(a=u),l=u);for(let u=0,c=n+1;u<o.height;u++){const f=e.child(u),p=c+f.nodeSize,m=s[u];if(m>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const b=[];for(let w=0;w<m;w++){const x=zn(t.schema)[g].createAndFill();x&&b.push(x)}const y=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(y),b)}c=p}return r.setMeta(cG,{fixTables:!0})}function Wo(t){const e=t.selection,n=Bp(t),r=n.node(-1),o=n.start(-1),s=rn.get(r);return{...e instanceof zt?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(n.pos-o),tableStart:o,map:s,table:r}}function OE(t,{map:e,tableStart:n,table:r},o){let s=o>0?-1:0;oG(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let a=0;a<e.height;a++){const l=a*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],c=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,_E(c.attrs,o-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?zn(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(a,o,r);t.insert(t.mapping.map(n+c),u.createAndFill())}}return t}function fG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(OE(t.tr,n,n.left))}return!0}function pG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(OE(t.tr,n,n.right))}return!0}function hG(t,{map:e,table:n,tableStart:r},o){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const l=a*e.width+o,u=e.map[l],c=n.nodeAt(u),f=c.attrs;if(o>0&&e.map[l-1]==u||o<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,da(f,o-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=f.rowspan}}function mG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;hG(r,n,o),o!=n.left;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=rn.get(s)}e(r)}return!0}function gG(t,e,n){var r;const o=zn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))==null?void 0:r.type)!=o)return!1;return!0}function ME(t,{map:e,tableStart:n,table:r},o){var s;let a=n;for(let c=0;c<o;c++)a+=r.child(c).nodeSize;const l=[];let u=o>0?-1:0;gG(e,r,o+u)&&(u=o==0||o==e.height?null:0);for(let c=0,f=e.width*o;c<e.width;c++,f++)if(o>0&&o<e.height&&e.map[f]==e.map[f-e.width]){const p=e.map[f],m=r.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...m,rowspan:m.rowspan+1}),c+=m.colspan-1}else{const p=u==null?zn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,m=p==null?void 0:p.createAndFill();m&&l.push(m)}return t.insert(a,zn(r.type.schema).row.create(null,l)),t}function bG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(ME(t.tr,n,n.top))}return!0}function vG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t);e(ME(t.tr,n,n.bottom))}return!0}function yG(t,{map:e,table:n,tableStart:r},o){let s=0;for(let c=0;c<o;c++)s+=n.child(c).nodeSize;const a=s+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(s+r,a+r);const u=new Set;for(let c=0,f=o*e.width;c<e.width;c++,f++){const p=e.map[f];if(!u.has(p)){if(u.add(p),o>0&&p==e.map[f-e.width]){const m=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m,rowspan:m.rowspan-1}),c+=m.colspan-1}else if(o<e.height&&p==e.map[f+e.width]){const m=n.nodeAt(p),g=m.attrs,b=m.type.create({...g,rowspan:m.attrs.rowspan-1},m.content),y=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(l).map(r+y),b),c+=g.colspan-1}}}}function wG(t,e){if(!mo(t))return!1;if(e){const n=Wo(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;yG(r,n,o),o!=n.top;o--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=rn.get(n.table)}e(r)}return!0}function BE(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function xG({width:t,height:e,map:n},r){let o=r.top*t+r.left,s=o,a=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[a]==n[a+t])return!0;o++,a++}return!1}function IE(t,e){const n=t.selection;if(!(n instanceof zt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Wo(t),{map:o}=r;if(xG(o,r))return!1;if(e){const s=t.tr,a={};let l=de.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const m=o.map[f*o.width+p],g=r.table.nodeAt(m);if(!(a[m]||!g))if(a[m]=!0,u==null)u=m,c=g;else{BE(g)||(l=l.append(g.content));const b=s.mapping.map(m+r.tableStart);s.delete(b,b+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{..._E(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=u+1+c.content.size,p=BE(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new zt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function RE(t,e){const n=zn(t.schema);return CG(({node:r})=>n[r.type.spec.tableRole])(t,e)}function CG(t){return(e,n)=>{var r;const o=e.selection;let s,a;if(o instanceof zt){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;s=o.$anchorCell.nodeAfter,a=o.$anchorCell.pos}else{if(s=tG(o.$from),!s)return!1;a=(r=Tl(o.$from))==null?void 0:r.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const u=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=Wo(e),p=e.tr;for(let g=0;g<f.right-f.left;g++)u.push(c?{...l,colwidth:c&&c[g]?[c[g]]:null}:l);let m;for(let g=f.top;g<f.bottom;g++){let b=f.map.positionAt(g,f.left,f.table);g==f.top&&(b+=s.nodeSize);for(let y=f.left,w=0;y<f.right;y++,w++)y==f.left&&g==f.top||p.insert(m=p.mapping.map(b+f.tableStart,1),t({node:s,row:g,col:y}).createAndFill(u[w]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),o instanceof zt&&p.setSelection(new zt(p.doc.resolve(o.$anchorCell.pos),m?p.doc.resolve(m):void 0)),n(p)}return!0}}function EG(t,e){return function(n,r){if(!mo(n))return!1;const o=Bp(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof zt?n.selection.forEachCell((a,l)=>{a.attrs[t]!==e&&s.setNodeMarkup(l,null,{...a.attrs,[t]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function kG(t){return function(e,n){if(!mo(e))return!1;if(n){const r=zn(e.schema),o=Wo(e),s=e.tr,a=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=a.map(u=>o.table.nodeAt(u));for(let u=0;u<a.length;u++)l[u].type==r.header_cell&&s.setNodeMarkup(o.tableStart+a[u],r.cell,l[u].attrs);if(s.steps.length==0)for(let u=0;u<a.length;u++)s.setNodeMarkup(o.tableStart+a[u],r.header_cell,l[u].attrs);n(s)}return!0}}function LE(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==n.header_cell)return!1}return!0}function mc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?kG(t):function(n,r){if(!mo(n))return!1;if(r){const o=zn(n.schema),s=Wo(n),a=n.tr,l=LE("row",s,o),u=LE("column",s,o),f=(t==="column"?l:t==="row"?u:!1)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;s.map.cellsInRect(p).forEach(g=>{const b=g+s.tableStart,y=a.doc.nodeAt(b);y&&a.setNodeMarkup(b,m,y.attrs)}),r(a)}return!0}}mc("row",{useDeprecatedLogic:!0}),mc("column",{useDeprecatedLogic:!0});var SG=mc("cell",{useDeprecatedLogic:!0});function _G(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){const s=t.node(-1).child(r),a=s.lastChild;if(a)return o-1-a.nodeSize;o-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function PE(t){return function(e,n){if(!mo(e))return!1;const r=_G(Bp(e),t);if(r==null)return!1;if(n){const o=e.doc.resolve(r);n(e.tr.setSelection(Te.between(o,rG(o))).scrollIntoView())}return!0}}function TG(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ip(t,e){const n=t.selection;if(!(n instanceof zt))return!1;if(e){const r=t.tr,o=zn(t.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(o)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new Ce(o,0,0))}),r.docChanged&&e(r)}return!0}function AG(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,a=o.type.schema,l=[];if(s=="row")for(let u=0;u<e.childCount;u++){let c=e.child(u).content;const f=u?0:Math.max(0,n-1),p=u<e.childCount-1?0:Math.max(0,r-1);(f||p)&&(c=Sb(zn(a).row,new Ce(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Sb(zn(a).row,new Ce(e,n,r)).content:e);else return null;return OG(a,l)}function OG(t,e){const n=[];for(let o=0;o<e.length;o++){const s=e[o];for(let a=s.childCount-1;a>=0;a--){const{rowspan:l,colspan:u}=s.child(a).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+u}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(de.empty),n[o]<r){const s=zn(t).cell.createAndFill(),a=[];for(let l=n[o];l<r;l++)a.push(s);e[o]=e[o].append(de.from(a))}return{height:e.length,width:r,rows:e}}function Sb(t,e){const n=t.createAndFill();return new lm(n).replace(0,n.content.size,e).doc}function MG({width:t,height:e,rows:n},r,o){if(t!=r){const s=[],a=[];for(let l=0;l<n.length;l++){const u=n[l],c=[];for(let f=s[l]||0,p=0;f<r;p++){let m=u.child(p%u.childCount);f+m.attrs.colspan>r&&(m=m.type.createChecked(da(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),c.push(m),f+=m.attrs.colspan;for(let g=1;g<m.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+m.attrs.colspan}a.push(de.from(c))}n=a,t=r}if(e!=o){const s=[];for(let a=0,l=0;a<o;a++,l++){const u=[],c=n[l%e];for(let f=0;f<c.childCount;f++){let p=c.child(f);a+p.attrs.rowspan>o&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,o-p.attrs.rowspan)},p.content)),u.push(p)}s.push(de.from(u))}n=s,e=o}return{width:t,height:e,rows:n}}function BG(t,e,n,r,o,s,a){const l=t.doc.type.schema,u=zn(l);let c,f;if(o>e.width)for(let p=0,m=0;p<e.height;p++){const g=n.child(p);m+=g.nodeSize;const b=[];let y;g.lastChild==null||g.lastChild.type==u.cell?y=c||(c=u.cell.createAndFill()):y=f||(f=u.header_cell.createAndFill());for(let w=e.width;w<o;w++)b.push(y);t.insert(t.mapping.slice(a).map(m-1+r),b)}if(s>e.height){const p=[];for(let b=0,y=(e.height-1)*e.width;b<Math.max(e.width,o);b++){const w=b>=e.width?!1:n.nodeAt(e.map[y+b]).type==u.header_cell;p.push(w?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const m=u.row.create(null,de.from(p)),g=[];for(let b=e.height;b<s;b++)g.push(m);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function DE(t,e,n,r,o,s,a,l){if(a==0||a==e.height)return!1;let u=!1;for(let c=o;c<s;c++){const f=a*e.width+c,p=e.map[f];if(e.map[f-e.width]==p){u=!0;const m=n.nodeAt(p),{top:g,left:b}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m.attrs,rowspan:a-g}),t.insert(t.mapping.slice(l).map(e.positionAt(a,b,n)),m.type.createAndFill({...m.attrs,rowspan:g+m.attrs.rowspan-a})),c+=m.attrs.colspan-1}}return u}function VE(t,e,n,r,o,s,a,l){if(a==0||a==e.width)return!1;let u=!1;for(let c=o;c<s;c++){const f=c*e.width+a,p=e.map[f];if(e.map[f-1]==p){u=!0;const m=n.nodeAt(p),g=e.colCount(p),b=t.mapping.slice(l).map(p+r);t.setNodeMarkup(b,null,da(m.attrs,a-g,m.attrs.colspan-(a-g))),t.insert(b+m.nodeSize,m.type.createAndFill(da(m.attrs,0,a-g))),c+=m.attrs.rowspan-1}}return u}function FE(t,e,n,r,o){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let a=rn.get(s);const{top:l,left:u}=r,c=u+o.width,f=l+o.height,p=t.tr;let m=0;function g(){if(s=n?p.doc.nodeAt(n-1):p.doc,!s)throw new Error("No table found");a=rn.get(s),m=p.mapping.maps.length}BG(p,a,s,n,c,f,m)&&g(),DE(p,a,s,n,u,c,l,m)&&g(),DE(p,a,s,n,u,c,f,m)&&g(),VE(p,a,s,n,l,f,u,m)&&g(),VE(p,a,s,n,l,f,c,m)&&g();for(let b=l;b<f;b++){const y=a.positionAt(b,u,s),w=a.positionAt(b,c,s);p.replace(p.mapping.slice(m).map(y+n),p.mapping.slice(m).map(w+n),new Ce(o.rows[b-l],0,0))}g(),p.setSelection(new zt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var IG=$m({ArrowLeft:Lp("horiz",-1),ArrowRight:Lp("horiz",1),ArrowUp:Lp("vert",-1),ArrowDown:Lp("vert",1),"Shift-ArrowLeft":Pp("horiz",-1),"Shift-ArrowRight":Pp("horiz",1),"Shift-ArrowUp":Pp("vert",-1),"Shift-ArrowDown":Pp("vert",1),Backspace:Ip,"Mod-Backspace":Ip,Delete:Ip,"Mod-Delete":Ip});function Rp(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Lp(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;if(s instanceof zt)return Rp(n,r,Ve.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=$E(o,t,e);if(a==null)return!1;if(t=="horiz")return Rp(n,r,Ve.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=SE(l,t,e);let c;return u?c=Ve.near(u,1):e<0?c=Ve.near(n.doc.resolve(l.before(-1)),-1):c=Ve.near(n.doc.resolve(l.after(-1)),1),Rp(n,r,c)}}}function Pp(t,e){return(n,r,o)=>{if(!o)return!1;const s=n.selection;let a;if(s instanceof zt)a=s;else{const u=$E(o,t,e);if(u==null)return!1;a=new zt(n.doc.resolve(u))}const l=SE(a.$headCell,t,e);return l?Rp(n,r,new zt(a.$anchorCell,l)):!1}}function RG(t,e){const n=t.state.doc,r=Tl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new zt(r))),!0):!1}function LG(t,e,n){if(!mo(t.state))return!1;let r=AG(n);const o=t.state.selection;if(o instanceof zt){r||(r={width:1,height:1,rows:[de.from(Sb(zn(t.state.schema).cell,n))]});const s=o.$anchorCell.node(-1),a=o.$anchorCell.start(-1),l=rn.get(s).rectBetween(o.$anchorCell.pos-a,o.$headCell.pos-a);return r=MG(r,l.right-l.left,l.bottom-l.top),FE(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Bp(t.state),a=s.start(-1);return FE(t.state,t.dispatch,a,rn.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function PG(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=zE(t,e.target);let o;if(e.shiftKey&&t.state.selection instanceof zt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Tl(t.state.selection.$anchor))!=null&&((n=_b(t,e))==null?void 0:n.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(u,c){let f=_b(t,c);const p=ms.getState(t.state)==null;if(!f||!kb(u,f))if(p)f=u;else return;const m=new zt(u,f);if(p||!t.state.selection.eq(m)){const g=t.state.tr.setSelection(m);p&&g.setMeta(ms,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),ms.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(ms,-1))}function l(u){const c=u,f=ms.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if(zE(t,c.target)!=r&&(p=_b(t,e),!p))return a();p&&s(p,c)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",l)}function $E(t,e,n){if(!(t.state.selection instanceof Te))return null;const{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(o),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?l:null}}return null}function zE(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function _b(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Tl(t.state.doc.resolve(n.pos)):null}var DG=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Tb(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Tb(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Tb(t,e,n,r,o,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f){for(let p=0,m=0;p<f.childCount;p++){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let y=0;y<g;y++,m++){const w=o==m?s:b&&b[y],x=w?w+"px":"";if(l+=w||r,w||(u=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const E=document.createElement("col");E.style.width=x,e.appendChild(E)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)==null||a.removeChild(c),c=p}u?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var xr=new kt("tableColumnResizing");function VG({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=DG,lastColumnResizable:o=!0}={}){const s=new tt({key:xr,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=zn(l.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new FG(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=xr.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{$G(a,l,t,o)},mouseleave:a=>{zG(a)},mousedown:(a,l)=>{HG(a,l,e,n)}},decorations:a=>{const l=xr.getState(a);if(l&&l.activeHandle>-1)return KG(a,l.activeHandle)},nodeViews:{}}});return s}var FG=class qh{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(xr);if(r&&r.setHandle!=null)return new qh(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new qh(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Eb(e.doc.resolve(o))||(o=-1),new qh(o,n.dragging)}return n}};function $G(t,e,n,r){if(!t.editable)return;const o=xr.getState(t.state);if(o&&!o.dragging){const s=WG(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=HE(t,e,"left",n):u-e.clientX<=n&&(a=HE(t,e,"right",n))}if(a!=o.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=rn.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}WE(t,a)}}}function zG(t){if(!t.editable)return;const e=xr.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&WE(t,-1)}function HG(t,e,n,r){var o;if(!t.editable)return!1;const s=(o=t.dom.ownerDocument.defaultView)!=null?o:window,a=xr.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=UG(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(xr,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=xr.getState(t.state);m!=null&&m.dragging&&(jG(t,m.activeHandle,UE(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(xr,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=xr.getState(t.state);if(m&&m.dragging){const g=UE(m.dragging,p,n);jE(t,m.activeHandle,g,r)}}return jE(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function UG(t,e,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],u--);return l/u}function WG(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function HE(t,e,n,r){const o=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:a}=s,l=Tl(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=rn.get(l.node(-1)),c=l.start(-1),f=u.map.indexOf(l.pos-c);return f%u.width==0?-1:c+u.map[f-1]}function UE(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function WE(t,e){t.dispatch(t.state.tr.setMeta(xr,{setHandle:e}))}function jG(t,e,n){const r=t.state.doc.resolve(e),o=r.node(-1),s=rn.get(o),a=r.start(-1),l=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let c=0;c<s.height;c++){const f=c*s.width+l;if(c&&s.map[f]==s.map[f-s.width])continue;const p=s.map[f],m=o.nodeAt(p).attrs,g=m.colspan==1?0:l-s.colCount(p);if(m.colwidth&&m.colwidth[g]==n)continue;const b=m.colwidth?m.colwidth.slice():qG(m.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...m,colwidth:b})}u.docChanged&&t.dispatch(u)}function jE(t,e,n,r){const o=t.state.doc.resolve(e),s=o.node(-1),a=o.start(-1),l=rn.get(s).colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;let u=t.domAtPos(o.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&Tb(s,u.firstChild,u,r,l,n)}function qG(t){return Array(t).fill(0)}function KG(t,e){var n;const r=[],o=t.doc.resolve(e),s=o.node(-1);if(!s)return ft.empty;const a=rn.get(s),l=o.start(-1),u=a.colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;for(let c=0;c<a.height;c++){const f=u+c*a.width;if((u==a.width-1||a.map[f]!=a.map[f+1])&&(c==0||a.map[f]!=a.map[f-a.width])){const p=a.map[f],m=l+p+s.nodeAt(p).nodeSize-1,g=document.createElement("div");g.className="column-resize-handle",(n=xr.getState(t))!=null&&n.dragging&&r.push(jt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(jt.widget(m,g))}}return ft.create(t.doc,r)}function GG({allowTableNodeSelection:t=!1}={}){return new tt({key:ms,state:{init(){return null},apply(e,n){const r=e.getMeta(ms);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:o,pos:s}=e.mapping.mapResult(n);return o?null:s}},props:{decorations:sG,handleDOMEvents:{mousedown:PG},createSelectionBetween(e){return ms.getState(e.state)!=null?e.state.selection:null},handleTripleClick:RG,handleKeyDown:IG,handlePaste:LG},appendTransaction(e,n,r){return uG(r,AE(r,n),t)}})}const XG=(t,e,n)=>{if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r||n===r.attrs.backgroundColor)return t;const o={...r.attrs,backgroundColor:n};return t.setNodeMarkup(e,r.type,o,r.marks)},YG=(t,e,n)=>{const{doc:r,selection:o}=t;return!r||!o||!(o instanceof zt)||o.forEachCell((s,a)=>{t=XG(t,a,n)}),t},qE=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=r;return n=n.setSelection(s),n=YG(n,e,t),n.docChanged?(o==null||o(n),!0):!1},JG=Ze.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>qE(t,this.options),unsetTableCellBackground:()=>qE("",this.options)}}}),ZG=Bt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",bt(this.options.HTMLAttributes,t),0]}}),QG=Bt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}}),NG=Bt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",bt(this.options.HTMLAttributes,t),0]}});function Ab(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function KE(t,e,n,r,o,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f!==null)for(let p=0,m=0;p<f.childCount;p+=1){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let y=0;y<g;y+=1,m+=1){const w=o===m?s:b&&b[y],x=w?`${w}px`:"";if(l+=w||r,w||(u=!1),c){if(c.style.width!==x){const[E,k]=Ab(r,w);c.style.setProperty(E,k)}c=c.nextSibling}else{const E=document.createElement("col"),[k,C]=Ab(r,w);E.style.setProperty(k,C),e.appendChild(E)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)===null||a===void 0||a.removeChild(c),c=p}u?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class eX{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),KE(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,KE(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function tX(t,e,n,r){let o=0,s=!0;const a=[],l=t.firstChild;if(!l)return{};for(let p=0,m=0;p<l.childCount;p+=1){const{colspan:g,colwidth:b}=l.child(p).attrs;for(let y=0;y<g;y+=1,m+=1){const w=n===m?r:b&&b[y];o+=w||e,w||(s=!1);const[x,E]=Ab(e,w);a.push(["col",{style:`${x}: ${E}`}])}}const u=s?`${o}px`:"",c=s?"":`${o}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function GE(t,e){return t.createAndFill()}function nX(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function rX(t,e,n,r,o){const s=nX(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=GE(s.cell);if(f&&l.push(f),r){const p=GE(s.header_cell);p&&a.push(p)}}const u=[];for(let c=0;c<e;c+=1)u.push(s.row.createChecked(null,r&&c===0?a:l));return s.table.createChecked(null,u)}function oX(t){return t instanceof zt}const Dp=({editor:t})=>{const{selection:e}=t.state;if(!oX(e))return!1;let n=0;const r=c4(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},iX=Bt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:eX,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:o}=tX(t,this.options.cellMinWidth);return["table",bt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const a=rX(s.schema,t,e,n);if(o){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Te.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>fG(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>pG(t,e),deleteColumn:()=>({state:t,dispatch:e})=>mG(t,e),addRowBefore:()=>({state:t,dispatch:e})=>bG(t,e),addRowAfter:()=>({state:t,dispatch:e})=>vG(t,e),deleteRow:()=>({state:t,dispatch:e})=>wG(t,e),deleteTable:()=>({state:t,dispatch:e})=>TG(t,e),mergeCells:()=>({state:t,dispatch:e})=>IE(t,e),splitCell:()=>({state:t,dispatch:e})=>RE(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>mc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>mc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>SG(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>IE(t,e)?!0:RE(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>EG(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>PE(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>PE(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&AE(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=zt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Dp,"Mod-Backspace":Dp,Delete:Dp,"Mod-Delete":Dp}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[VG({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],GG({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:at(Ie(t,"tableRole",e))}}}),sX=["disabled"],aX={"content-class":"table-grid-size-editor","content-style":"padding:0"},lX={class:"flex flex-col flex-wrap gap-1 justify-between"},uX=["onMouseover","onMousedown"],cX={class:"text-center text-sm text-zinc-600 mt-2"},dX=i.defineComponent({__name:"CreateTablePopover",props:{disabled:{type:Boolean,default:!1}},emits:["create-table"],setup(t,{emit:e}){const n=e,r=i.ref(!1),o=i.ref(!0),s=i.reactive({rows:ff()?Rd:Id,cols:ff()?Rd:Id}),a=i.reactive({rows:Ld,cols:Ld});function l(f,p){f===s.rows&&(s.rows=Math.min(f+1,Rd)),p===s.cols&&(s.cols=Math.min(p+1,Rd)),a.rows=f,a.cols=p}function u(f,p){n("create-table",{rows:f,cols:p,withHeaderRow:i.unref(o)}),c()}function c(){r.value=!1,o.value=!1,s.rows=Id,s.cols=Id,a.rows=Ld,a.cols=Ld}return(f,p)=>(i.openBlock(),i.createBlock(i.unref(fl),null,{default:i.withCtx(()=>[i.createVNode(i.unref(ml),{"as-child":""},{default:i.withCtx(()=>[i.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[i.renderSlot(f.$slots,"trigger")],8,sX)]),_:3}),i.createVNode(i.unref(pl),{class:"w-full",align:"start",side:"bottom"},{default:i.withCtx(()=>[i.createElementVNode("div",aX,[i.createElementVNode("div",lX,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.rows,m=>(i.openBlock(),i.createElementBlock("div",{key:"r"+m,class:"flex gap-1"},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.cols,g=>(i.openBlock(),i.createElementBlock("div",{key:"c"+g,class:i.normalizeClass([[g<=a.cols&&m<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:b=>l(m,g),onMousedown:b=>u(m,g)},p[0]||(p[0]=[i.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,uX))),128))]))),128))]),i.createElementVNode("div",cX,i.toDisplayString(a.rows)+" x "+i.toDisplayString(a.cols),1)])]),_:1})]),_:3}))}}),fX={style:{display:"flex"}},pX=i.defineComponent({__name:"TableActionButton",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t;function n(r){e.editor.isActive("table")||e.editor.chain().focus().insertTable({...r,withHeaderRow:!1}).run()}return(r,o)=>(i.openBlock(),i.createBlock(dX,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:i.withCtx(()=>[i.createElementVNode("div",fX,[i.createVNode(Ke,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled,color:r.color,action:r.action,"is-active":r.isActive},null,8,["icon","tooltip","disabled","color","action","is-active"])])]),_:1},8,["disabled"]))}}),Ob=iX.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toggleTableEditor:e=>({editor:n})=>n.storage.table?(n.storage.table.isTableEditorOpen=e,!0):!1}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({component:pX,componentProps:{icon:"Table",tooltip:n("editor.table.tooltip"),action:()=>{var o;const r=((o=e.storage.table)==null?void 0:o.isTableEditorOpen)??!1;e.commands.toggleTableEditor(!r)}}})}},addExtensions(){return[QG.configure(this.options.tableRow),ZG.configure(this.options.tableHeader),NG.configure(this.options.tableCell),JG.configure(this.options.tableCellBackground)]}}),hX={class:"flex items-center gap-2 px-2"},mX=i.defineComponent({__name:"TextDropdown",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""}},setup(t){const e=t,{t:n}=Ot(),r=i.computed(()=>[{name:"paragraph",label:n("editor.paragraph.tooltip"),iconName:"Paragraph",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:n("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:n("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:n("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:n("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:n("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:n("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:n("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()},{name:"codeBlock",label:n("editor.codeblock.tooltip"),isActive:()=>e.editor.isActive("codeBlock"),iconName:"Code2",action:()=>e.editor.chain().focus().clearNodes().toggleCodeBlock().run()}]),o=i.computed(()=>r.value.filter(s=>s.isActive()).pop()??{label:n("editor.modify")});return(s,a)=>{var l;return i.openBlock(),i.createBlock(ia,{title:(l=o.value)==null?void 0:l.label,"side-offset":5},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(u,c)=>{var f;return i.openBlock(),i.createBlock(i.unref(Cl),{key:c,class:"cursor-pointer",checked:((f=u.isActive)==null?void 0:f.call(u))||!1,onClick:u.action},{default:i.withCtx(()=>[i.createElementVNode("div",hX,[i.createVNode(i.unref(Lt),{name:u.iconName,class:"h3 w-3"},null,8,["name"]),i.createElementVNode("span",null,i.toDisplayString(u.label),1)])]),_:2},1032,["checked","onClick"])}),128))]),_:1},8,["title"])}}}),gX=Ze.create({name:"text-bubble",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:()=>({component:mX,componentProps:{}})}}}),bX=[{label:"복합 표현 - 요일과 시간대",examples:["다음 월요일 저녁","이번 토요일 오전"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"시각 표현",examples:["오전 10시","오후 3시 30분","정오","자정","새벽 2시"],pattern:"((오전|오후|새벽|밤|저녁)\\s?\\d{1,2}(시(\\s?\\d{1,2}분)?)?|정오|자정)"},{label:"시간 표현 - 이른/늦은",examples:["이른 아침","늦은 밤"],pattern:"(이른\\s아침|늦은\\s밤)"},{label:"연도+월",examples:["2019년 6월","2025년12월","2024년 01월"],pattern:"\\d{4}년\\s?\\d{1,2}월"},{label:"오늘/내일/어제",examples:["오늘","내일","모레","어제","그제","그끄제"],pattern:"(오늘|내일|모레|어제|그제|그끄제)"},{label:"상대적 주 단위",examples:["이번 주","다음 주","지난 주"],pattern:"(이번|다음|지난)\\s?주"},{label:"상대적 월 단위",examples:["이번 달","다음 달","지난 달"],pattern:"(이번|다음|지난)\\s?달"},{label:"상대적 연도",examples:["올해","내년","작년","재작년","내후년"],pattern:"(올해|내년|작년|재작년|내후년)"},{label:"복합 표현 - 날짜와 시간대",examples:["1월 1일 오전","12월25일 저녁","다음 주 금요일 오전"],pattern:"(내년|올해|작년)?\\s?\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"정확한 날짜",examples:["1월1일","1월 1일","12월 25일","01월 01일"],pattern:"\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일"},{label:"요일",examples:["월요일","화요일","이번 금요일","다음 화요일"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일"},{label:"시간대",examples:["오전","오후","저녁","밤","새벽"],pattern:"(오전|오후|저녁|밤|새벽)"},{label:"짧은 시간 표현",examples:["방금","조금 전","금방","곧","잠시 후"],pattern:"(방금|조금\\s전|금방|곧|잠시\\s후)"},{label:"연도",examples:["2015년","2024년","1998년"],pattern:"\\d{4}년"}],vX=t=>{const e=[...t||[],...bX.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},yX=Ze.create({name:"time-highlighter",addOptions(){return{additionalTimeWords:[]}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null}},addProseMirrorPlugins(){return[new tt({props:{decorations:t=>{const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=vX(this.options.additionalTimeWords)),t.doc.descendants((n,r)=>{if(!n.isText)return;let o;const s=this.storage.cachedRegex;for(;o=s.exec(n.text||"");){const a=r+o.index,l=a+o[0].length;e.push(jt.inline(a,l,{class:"time-highlight"}))}}),ft.create(t.doc,e)}}})]}}),wX=Ze.create({name:"invalidCharFocus",addOptions(){return{invalidChars:["{","}"]}},addCommands(){return{focusInvalidChar:()=>({state:t,dispatch:e,view:n})=>{let r=null;if(t.doc.descendants((s,a)=>{if(!s.isText)return!0;const l=s.text??"";for(let u=0;u<l.length;u++)if(this.options.invalidChars.includes(l[u])){const c=a+u+1;(r==null||c<r)&&(r=c)}return!0}),r==null)return!1;const o=t.tr.setSelection(Te.create(t.doc,r));return e&&e(o.scrollIntoView()),n&&n.focus(),!0}}}});function Mb(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function xX(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var o;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="CLIPBOARD_STATE"&&t(!!((o=r.data)!=null&&o.hasClipboard))},Mb({type:"REQUEST_CLIPBOARD_STATE"})})}function CX(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var o;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="PASTE_RESULT"&&t(((o=r.data)==null?void 0:o.text)??null)},Mb({type:"PASTE"})})}function EX(t,e){Mb({type:"COPY",data:{html:t,text:e}})}async function kX(t,e){try{const n=new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});await navigator.clipboard.write([n])}catch(n){console.error("navigator clipboard write failed:",n)}}async function SX(){try{if("read"in navigator.clipboard){const t=await navigator.clipboard.read();for(const e of t){if(e.types.includes("text/html"))return await(await e.getType("text/html")).text();if(e.types.includes("text/plain"))return await(await e.getType("text/plain")).text()}}}catch(t){console.warn("navigator clipboard read failed:",t)}}const _X=Ze.create({name:"clipboard",addCommands(){return{copyContent:()=>({editor:t,state:e})=>{const{from:n,to:r}=e.selection;return n===r?!1:((async()=>{try{const o=e.doc.slice(n,r),a=to.fromSchema(t.schema).serializeFragment(o.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
|
|
293
|
+
`);t.storage.deviceEnv.isMobile?EX(u,c):await kX(u,c)}catch(o){console.warn("[clipboard] copy failed",o)}})(),!0)},cutContent:()=>({editor:t})=>((async()=>{try{await t.commands.copyContent(),t.chain().focus().deleteSelection().run()}catch(e){console.warn("[clipboard] cut failed",e)}})(),!0),pasteContent:()=>({editor:t})=>((async()=>{try{t.chain().focus().run();const e=t.storage.deviceEnv.isMobile?await CX():await SX();if(!e)return;const n=new DataTransfer;n.setData("text/html",e),n.setData("text/plain",e);const r=new ClipboardEvent("paste",{bubbles:!0,cancelable:!0});Object.defineProperty(r,"clipboardData",{value:n}),t.view.dom.dispatchEvent(r)}catch(e){console.warn("Clipboard paste failed:",e)}})(),!0)}},onCreate(){const t=this.editor;t.hasClipboard=async()=>{try{return!!(t.storage.deviceEnv.isMobile?await xX():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),TX=Ze.create({name:"deviceEnv",addOptions(){return{initial:!1}},addStorage(){return{isMobile:this.options.initial}},addCommands(){return{setIsMobile:t=>({editor:e})=>{var n;return e.storage.deviceEnv.isMobile=t,(n=e.storage.spellchecker)==null||n.spellchecker.setIsMobile(t),!0}}}}),Vp=i.defineComponent({__name:"TabsContent",props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=i.computed(()=>{const{class:r,...o}=e;return o});return(r,o)=>(i.openBlock(),i.createBlock(i.unref(pD),i.mergeProps({class:i.unref(ke)("mt-2 ring-offset-ed-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2",e.class)},n.value),{default:i.withCtx(()=>[i.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),AX={class:"flex items-center w-full p-3 my-3 hover:bg-ed-accent border border-ed-border text-ed-muted-foreground cursor-pointer rounded-sm transition-all"},OX={key:0,class:"flex justify-center items-center gap-3 text-s"},MX={key:1,class:"flex justify-between items-center w-full"},BX={class:"flex justify-center items-center gap-3"},IX={class:"text-sm"},RX={class:"flex items-center gap-2"},LX=i.defineComponent({__name:"VideoUploader",props:{...Ws},setup(t){const e=t,n=i.ref(""),r=i.ref(!1),o=i.ref(),{t:s}=Ot();function a(f){var y;r.value=!0;const p=f.target,m=Array.from((p==null?void 0:p.files)||[]),g=(y=e.editor.extensionManager.extensions.find(w=>w.name==="videoUpload"))==null?void 0:y.options;if(!e.editor||e.editor.isDestroyed||m.length===0||typeof(g==null?void 0:g.upload)!="function")return;const b=m[0];g.upload(b).then(w=>{e.editor.chain().setVideo({src:w}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run(),r.value=!1})}function l(){e.editor.chain().setVideo({src:n.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){var f;(f=o.value)==null||f.click()}return(f,p)=>(i.openBlock(),i.createBlock(i.unref(Us),{as:"div","data-drag-handle":""},{default:i.withCtx(()=>[i.createVNode(i.unref(fl),{"default-open":""},{default:i.withCtx(()=>[i.createVNode(i.unref(ml),{"as-child":""},{default:i.withCtx(()=>[i.createElementVNode("div",AX,[r.value?(i.openBlock(),i.createElementBlock("div",OX,[i.createVNode(i.unref(Lt),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),i.createElementVNode("span",null,i.toDisplayString(i.unref(s)("editor.video.dialog.uploading"))+"...",1)])):(i.openBlock(),i.createElementBlock("div",MX,[i.createElementVNode("div",BX,[i.createVNode(i.unref(Lt),{name:"Video",class:"w-6 h-6"}),i.createElementVNode("span",IX,i.toDisplayString(i.unref(s)("editor.video.dialog.title")),1)]),i.createVNode(i.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:i.withModifiers(u,["stop"])})]))])]),_:1}),i.createVNode(i.unref(pl),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:i.withCtx(()=>[i.createVNode(i.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:i.withCtx(()=>[i.createVNode(i.unref(z1),{class:"grid w-full grid-cols-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(Hu),{value:"upload"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1}),i.createVNode(i.unref(Hu),{value:"link",disabled:r.value},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),i.createVNode(i.unref(Vp),{value:"upload"},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{class:"w-full mt-1",size:"sm",disabled:r.value,onClick:c},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),i.createElementVNode("input",{ref_key:"fileInput",ref:o,type:"file",accept:"video/*",hidden:"",onChange:a},null,544)]),_:1}),i.createVNode(i.unref(Vp),{value:"link"},{default:i.withCtx(()=>[i.createElementVNode("div",RX,[i.createVNode(i.unref(hl),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:i.unref(s)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),i.createVNode(i.unref(yn),{onClick:l},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(s)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1})]),_:1}))}}),XE=Bt.create({name:"videoUpload",isolating:!0,defining:!0,group:"block",draggable:!0,selectable:!1,inline:!1,parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setVideoUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return js(LX)},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("link video not found"),button:({editor:e,t:n})=>{var r,o;return{component:Ke,componentProps:{action:()=>e.commands.setVideoUpload(),isActive:()=>e.isActive("video")||!1,disabled:!((o=(r=e.can()).setVideo)!=null&&o.call(r,{})),icon:"Video",tooltip:n("editor.video.tooltip")}}}}}});function PX(t){return t=t.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),t=t.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(t)&&(t=t.replace(/\?.*$/i,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),t.includes("drive.google.com")&&(t=t.replace("/view","/preview")),t}function DX(t){return t?t.includes("youtube.com/embed")||t.includes("player.vimeo.com")||t.includes("player.bilibili.com")||t.includes("drive.google.com"):!1}const YE=Bt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:Pd["size-medium"],controls:!0,autoplay:!1,HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}},addAttributes(){return{src:{default:null,renderHTML:({src:t})=>({src:t?PX(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:an(t)})},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},controls:{default:this.options.controls}}},parseHTML(){return[{tag:"video"},{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){const{src:e,width:n,controls:r,allowfullscreen:o}=t??{},s=`max-width: ${an(n)};`;return DX(e)?["iframe",{src:e,style:s,...o&&{allowfullscreen:o}}]:["video",{src:e?e.replace(/\\/g,"/"):"",style:s,...r&&{controls:r}}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateVideo:t=>({commands:e})=>e.updateAttributes(this.name,t)}}}),Al=new kt("upload-image"),VX=()=>new tt({key:Al,state:{init(){return ft.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Al);return n!=null&&n.add?n.add.forEach(({id:r,pos:o,src:s})=>{const a=FX(s),l=jt.widget(o,a,{id:r});e=e.add(t.doc,[l])}):n!=null&&n.remove&&n.remove.forEach(r=>{e=e.remove(e.find(void 0,void 0,o=>o.id===r))}),e}},props:{decorations(t){return this.getState(t)}}});function FX(t){const e=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=t,n.onload=()=>{e.setAttribute("class","img-placeholder")},e.appendChild(n),e}function $X(t,e){var o;const r=Al.getState(t).find(void 0,void 0,s=>s.id===e);return r.length?(o=r[0])==null?void 0:o.from:null}const JE=({validateFn:t,onUpload:e})=>(n,r,o,s)=>{n.forEach(a=>{if(t&&!t(a))return;s||(s=pi(6));const l=r.state.tr;l.selection.empty||l.deleteSelection();let u=null;r.state.doc.descendants((p,m)=>{p.type.name===hs&&p.attrs.id===s&&(u=m)});const c=URL.createObjectURL(a);l.setMeta(Al,{add:[{id:s,pos:o,src:c}]}),r.dispatch(l);const f=$X(r.state,s)||u;e(a).then(p=>{var E,k;const{schema:m}=r.state;if(f===null)throw new Error("Not found placeholderPos");const g=typeof p=="object"?c:p,b=(E=m.nodes.image)==null?void 0:E.create({src:g}),y=(k=m.nodes.paragraph)==null?void 0:k.create();if(!b||!y)return;const w=r.state.tr.replaceWith(f,f,b).insert(f+b.nodeSize,y).setMeta(Al,{remove:[s]}),x=f+b.nodeSize+1;w.setSelection(Te.create(w.doc,x)),r.dispatch(w),r.focus()},()=>{const p=r.state.tr.delete(o,o).setMeta(Al,{remove:[s]});r.dispatch(p)})})},zX=(t,e,n)=>{var o;const r=Array.from(((o=e.clipboardData)==null?void 0:o.files)||[]);if(r.length){e.preventDefault();const s=t.state.selection.from;return n(r,t,s+1),!0}return!1},HX=(t,e,n,r)=>{var s;const o=Array.from(((s=e.dataTransfer)==null?void 0:s.files)||[]);if(!n&&o.length){e.preventDefault();const a=t.posAtCoords({left:e.clientX,top:e.clientY});if(a)return r(o,t,a.pos+1),!0}return!1},UX={class:"flex items-center w-full p-3 my-3 transition-all border rounded-sm cursor-pointer hover:bg-ed-accent border-ed-border text-ed-muted-foreground"},WX={class:"flex items-center justify-between w-full"},jX={class:"flex items-center justify-center gap-3"},qX={class:"text-sm"},KX={class:"flex items-center gap-2"},GX=i.defineComponent({__name:"ImageUploader",props:{...Ws},setup(t){const e=t,n=i.ref(""),r=i.ref(),{t:o}=Ot(),s=i.inject("isEditable",i.ref(!0));function a(f){var y,w;const p=(y=f==null?void 0:f.target)==null?void 0:y.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=p[0],g=(w=e.editor.extensionManager.extensions.find(x=>x.name==="imageUpload"))==null?void 0:w.options;JE({validateFn:x=>!0,onUpload:g.upload})([m],e.editor.view,e.getPos(),e.node.attrs.id)}function l(){e.editor.chain().setImage({src:n.value}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){s.value&&e.deleteNode()}function c(){var f;(f=r.value)==null||f.click()}return(f,p)=>(i.openBlock(),i.createBlock(i.unref(Us),{id:f.node.attrs.id,class:"p-0 m-0","data-drag-handle":""},{default:i.withCtx(()=>[i.createVNode(i.unref(fl),{"default-open":""},{default:i.withCtx(()=>[i.createVNode(i.unref(ml),{"as-child":""},{default:i.withCtx(()=>[i.createElementVNode("div",UX,[i.createElementVNode("div",WX,[i.createElementVNode("div",jX,[i.createVNode(i.unref(Lt),{name:"ImageUp",class:"w-6 h-6"}),i.createElementVNode("span",qX,i.toDisplayString(i.unref(o)("editor.image.dialog.title")),1)]),i.createVNode(i.unref(Lt),{name:"Trash2",class:"hover:text-ed-foreground",onClick:i.withModifiers(u,["stop"])})])])]),_:1}),i.unref(s)?(i.openBlock(),i.createBlock(i.unref(pl),{key:0,"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:i.withCtx(()=>[i.createVNode(i.unref($1),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:i.withCtx(()=>[i.createVNode(i.unref(z1),{class:"grid w-full grid-cols-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(Hu),{value:"upload"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.tab.upload")),1)]),_:1}),i.createVNode(i.unref(Hu),{value:"link"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),i.createVNode(i.unref(Vp),{value:"upload"},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{class:"w-full mt-1",size:"sm",onClick:c},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.tab.upload")),1)]),_:1}),i.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",multiple:"",hidden:"",onChange:a},null,544)]),_:1}),i.createVNode(i.unref(Vp),{value:"link"},{default:i.withCtx(()=>[i.createElementVNode("div",KX,[i.createVNode(i.unref(hl),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:i.unref(o)("editor.image.dialog.placeholder")},null,8,["modelValue","placeholder"]),i.createVNode(i.unref(yn),{onClick:l},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)("editor.image.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])):i.createCommentVNode("",!0)]),_:1})]),_:1},8,["id"]))}}),XX=1,YX=1e6,yi={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Bb=0;function JX(){return Bb=(Bb+1)%Number.MAX_VALUE,Bb.toString()}const Ib=new Map;function ZE(t){if(Ib.has(t))return;const e=setTimeout(()=>{Ib.delete(t),gc({type:yi.REMOVE_TOAST,toastId:t})},YX);Ib.set(t,e)}const go=i.ref({toasts:[]});function gc(t){switch(t.type){case yi.ADD_TOAST:go.value.toasts=[t.toast,...go.value.toasts].slice(0,XX);break;case yi.UPDATE_TOAST:go.value.toasts=go.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case yi.DISMISS_TOAST:{const{toastId:e}=t;e?ZE(e):go.value.toasts.forEach(n=>{ZE(n.id)}),go.value.toasts=go.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case yi.REMOVE_TOAST:t.toastId===void 0?go.value.toasts=[]:go.value.toasts=go.value.toasts.filter(e=>e.id!==t.toastId);break}}function Rb(){return{toasts:i.computed(()=>go.value.toasts),toast:ZX,dismiss:t=>gc({type:yi.DISMISS_TOAST,toastId:t})}}function ZX(t){const e=JX(),n=o=>gc({type:yi.UPDATE_TOAST,toast:{...o,id:e}}),r=()=>gc({type:yi.DISMISS_TOAST,toastId:e});return gc({type:yi.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:o=>{o||r()}}}),{id:e,dismiss:r,update:n}}const QX={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},NX=t=>`${(t/1024/1024).toFixed(2)}MB`,QE=Bt.create({name:"imageUpload",isolating:!0,defining:!0,group:"block",draggable:!1,selectable:!1,inline:!1,onCreate(){if(typeof this.options.upload!="function")throw new Error("Image upload function should be a function")},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addAttributes(){return{id:{default:pi(6),parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},addCommands(){return{setImageUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return js(GX)},addOptions(){var t;return{...QX,...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:n,t:r})=>{var o,s;return{component:Ke,componentProps:{action:()=>e.commands.setImageUpload(),disabled:!((s=(o=e.can()).setImage)!=null&&s.call(o,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip")}}}}},addProseMirrorPlugins(){const{toast:t}=Rb(),{t:e}=Ot(),r=JE({validateFn:o=>this.options.acceptMimes.includes(o.type)?o.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${NX(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new tt({props:{handlePaste:(o,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:zX(o,s,r),handleDrop:(o,s,a,l)=>(!(s instanceof DragEvent)||!s.dataTransfer||HX(o,s,l,r),!1)}}),VX()]}}),eY=Ze.create({name:"searchHighlight",addGlobalAttributes(){return[{types:["textStyle"],attributes:{searchHighlight:{default:null,parseHTML:t=>{const e=t,n=e.style.color,r=e.style.backgroundColor;return!n||!r?null:{color:n,backgroundColor:r}},renderHTML:t=>{if(!t.searchHighlight)return{};const{color:e,backgroundColor:n}=t.searchHighlight;return{style:`color: ${e}; background-color: ${n}`}}}}}]}}),NE=Ze.create({name:"base-kit",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),timeHighlighter:{additionalTimeWords:[]},bubble:{list:$B,defaultBubbleList:Ej,button:({editor:e,extension:n,t:r})=>{var l;const{list:o={},defaultBubbleList:s}=((l=n.options)==null?void 0:l.bubble)??{},a=(s==null?void 0:s(e))??[];return kj(o,a,{editor:e,extension:n,t:r})}}}},addExtensions(){var n,r,o;const{t}=Ot(),e=[];this.options.placeholder!==!1&&e.push(V8.configure({placeholder:({node:s,pos:a})=>{var u;const l=(u=s==null?void 0:s.type)==null?void 0:u.name;return l==="heading"?`${t(`editor.heading.h${s.attrs.level}.tooltip`)}`:l==="table"||l==="codeBlock"?"":a===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(dj.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(z8.configure().extend({content:"page+"})),e.push(pK.configure({types:((r=(n=this.options.page)==null?void 0:n.nodesComputedOption)==null?void 0:r.types)??[],slots:i.useSlots()}))):e.push(z8.configure())),this.options.dropcursor!==!1&&e.push(cj.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(aj.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(D8.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(P8.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(wj.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(GU.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(QE.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(YE.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(XE.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(zg.configure(this.options.history)),this.options.fontSize!==!1&&e.push(r8.configure(this.options.fontSize)),this.options.fontFamily!==!1&&e.push(mE.configure(this.options.fontFamily)),this.options.mode!==De.EDITOR&&e.push(wK),this.options.superText!==!1&&this.options.mode!==De.PLAIN_TEXT&&(typeof this.options.superText=="boolean"?e.push(xE.configure()):e.push(xE.configure(this.options.superText))),this.options.mode===De.EDITOR&&(this.options.image!==!1&&e.push(yb.configure()),e.push(t8.configure({spacer:!0}),SC,kC,_C,Vg,Ob,TC,o8.configure({spacer:!0}),n8.configure({types:["heading","paragraph"],spacer:!0}),vE)),this.options.mode!==De.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==De.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(kE.configure()):e.push(kE.configure({specialCharModal:(o=this.options.configPlan)==null?void 0:o.specialCharModal}))),this.options.mode!==De.EDITOR&&this.options.mode!==De.PLAIN_TEXT&&e.push(CK),(this.options.mode===De.STRAIGHT||this.options.mode===De.REPORT||this.options.mode===De.EDITOR)&&this.options.timeHighlighter&&e.push(yX.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(wX.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(eY),e.push(xj,F8.configure(),gX.configure(),yj.configure(),wb,bb,pg,_X,TX,i8.configure({multicolor:!0}));for(const s in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,s)&&this.options.excludes[s]&&rt.remove(e,({name:l})=>l===s);return e},addStorage(){return{mode:this.options.mode}}}),e5=Dn.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),t5=Dn.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),tY=Ze.create({name:"subAndSuperScript",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>{const o=n.options.subscript,s=n.options.superscript,a={component:Ke,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Ke,componentProps:{action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",tooltip:r("editor.superscript.tooltip")}},u=[];return o!==!1&&u.push(a),s!==!1&&u.push(l),u}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(e5.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(t5.configure(this.options.superscript)),t}}),nY={class:"ml-1"},rY=i.defineComponent({__name:"ActionMoreButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=i.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,o)=>(i.openBlock(),i.createBlock(ia,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.items,(s,a)=>(i.openBlock(),i.createBlock(i.unref(Cl),{key:a,checked:n.value.title===s.title,disabled:s.disabled,class:"flex gap-3 items-center",onClick:s.action},{default:i.withCtx(()=>[s.icon?(i.openBlock(),i.createBlock(i.unref(Lt),{key:0,name:s.icon},null,8,["name"])):i.createCommentVNode("",!0),i.createElementVNode("span",nY,i.toDisplayString(s.title),1),s.shortcutKeys?(i.openBlock(),i.createBlock(i.unref(e8),{key:1,class:"ml-auto"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(z6)(s.shortcutKeys)),1)]),_:2},1024)):i.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),oY=Ze.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,extension:n,t:r}){const o=n.options.subscript,s=n.options.superscript,a={action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",title:r("editor.subscript.tooltip"),shortcutKeys:["mod","."]},l={action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",title:r("editor.superscript.tooltip"),shortcutKeys:["mod",","]},u=T0(e,"code"),c=[];if(o!==!1&&c.push(a),s!==!1&&c.push(l),u){const f={action:()=>e.commands.toggleCode(),isActive:()=>e.isActive("code")||!1,disabled:!e.can().toggleCode(),icon:"Code",title:r("editor.code.tooltip"),shortcutKeys:["mod","E"]};u&&c.push(f)}return{component:rY,componentProps:{icon:"Type",tooltip:r("editor.moremark"),disabled:!e.isEditable||c.every(f=>f.disabled),items:c}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(e5.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(t5.configure(this.options.superscript)),t}});var fa=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(fa||{});function iY(t,e,n){return t<e?e:t>n?n:t}function sY(t,e,n,r){const{doc:o,selection:s}=t;if(!o||!s||!(s instanceof Te||s instanceof Rn))return t;const{from:a,to:l}=s;return o.nodesBetween(a,l,(u,c)=>{const f=u.type;return n.includes(f.name)?(t=aY(t,c,e),!1):!n0(u.type.name,r.extensionManager.extensions)}),t}function aY(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=iY((r.attrs.indent||0)+n,0,7);if(a===r.attrs.indent)return t;const l={...r.attrs,indent:a};return t.setNodeMarkup(e,r.type,l,r.marks)}function n5({delta:t,types:e}){return({state:n,dispatch:r,editor:o})=>{const{selection:s}=n;let{tr:a}=n;return a=a.setSelection(s),a=sY(a,t,e,o),a.docChanged?(r&&r(a),!0):!1}}const lY=Ze.create({name:"indent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:fa.min,maxIndent:fa.max,button({editor:e,t:n}){var s,a;const{selection:r}=e.state,o=r.$anchor.parent;return[{component:Ke,componentProps:{action:()=>{e.commands.indent()},disabled:((s=o==null?void 0:o.attrs)==null?void 0:s.indent)>=fa.max||!e.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:Ke,componentProps:{action:()=>{e.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:((a=o==null?void 0:o.attrs)==null?void 0:a.indent)<=fa.min||!e.can().outdent(),icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.getAttribute("data-indent");return(e?parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>n5({delta:fa.more,types:this.options.types}),outdent:()=>n5({delta:fa.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function uY(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!o,c=YO(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",m=o?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${m}]*`,"gm"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const y=l.pos-b.length,w=Array.from(b.matchAll(g)).pop();if(!w||w.input===void 0||w.index===void 0)return null;const x=w.input.slice(Math.max(0,w.index-1),w.index),E=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(x);if(s!==null&&!E)return null;const k=y+w.index;let C=k+w[0].length;return u&&f.test(b.slice(C-1,C+1))&&(w[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:w[0].slice(n.length),text:w[0]}:null}const cY=new kt("suggestion");function dY({pluginKey:t=cY,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:s=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:u="suggestion",command:c=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=uY}){let b;const y=p==null?void 0:p(),w=new tt({key:t,view(){return{update:async(x,E)=>{var k,C,_,A,T,P,I;const M=(k=this.key)===null||k===void 0?void 0:k.getState(E),j=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),U=M.active&&j.active&&M.range.from!==j.range.from,q=!M.active&&j.active,le=M.active&&!j.active,H=!q&&!le&&M.query!==j.query,F=q||U&&H,L=H||U,K=le||U&&H;if(!F&&!L&&!K)return;const J=K&&!F?M:j,Y=x.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);b={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:ne=>c({editor:e,range:J.range,props:ne}),decorationNode:Y,clientRect:Y?()=>{var ne;const{decorationId:we}=(ne=this.key)===null||ne===void 0?void 0:ne.getState(e.state),xe=x.dom.querySelector(`[data-decoration-id="${we}"]`);return(xe==null?void 0:xe.getBoundingClientRect())||null}:null},F&&((_=y==null?void 0:y.onBeforeStart)===null||_===void 0||_.call(y,b)),L&&((A=y==null?void 0:y.onBeforeUpdate)===null||A===void 0||A.call(y,b)),(L||F)&&(b.items=await f({editor:e,query:J.query})),K&&((T=y==null?void 0:y.onExit)===null||T===void 0||T.call(y,b)),L&&((P=y==null?void 0:y.onUpdate)===null||P===void 0||P.call(y,b)),F&&((I=y==null?void 0:y.onStart)===null||I===void 0||I.call(y,b))},destroy:()=>{var x;b&&((x=y==null?void 0:y.onExit)===null||x===void 0||x.call(y,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,E,k,C){const{isEditable:_}=e,{composing:A}=e.view,{selection:T}=x,{empty:P,from:I}=T,M={...E};if(M.composing=A,_&&(P||e.view.composing)){(I<E.range.from||I>E.range.to)&&!A&&!E.composing&&(M.active=!1);const j=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:s,startOfLine:a,$position:T.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;j&&m({editor:e,state:C,range:j.range,isActive:E.active})?(M.active=!0,M.decorationId=E.decorationId?E.decorationId:U,M.range=j.range,M.query=j.query,M.text=j.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(x,E){var k;const{active:C,range:_}=w.getState(x.state);return C&&((k=y==null?void 0:y.onKeyDown)===null||k===void 0?void 0:k.call(y,{view:x,event:E,range:_}))||!1},decorations(x){const{active:E,range:k,decorationId:C}=w.getState(x);return E?ft.create(x.doc,[jt.inline(k.from,k.to,{nodeName:l,class:u,"data-decoration-id":C})]):null}}});return w}const fY=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],pY=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],hY=[{label:"墨刀",value:"modao",icon:"Modao"},{label:"蓝湖",value:"lanhu",icon:"Lanhu"},{label:"Figma",value:"figma",icon:"Figma"},{label:"Canva",value:"canva",icon:"Canva"},{label:"ProcessOn",value:"processon",icon:"Processon"}],mY=[{label:"CodePen",value:"codepen",icon:"Codepen"}],gY=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],bY=[],vY=[...fY,...pY,...hY,...mY,...gY,...bY];function yY(t){const{t:e}=Ot(),n=[{name:"format",title:e("editor.slash.format"),commands:[{name:"paragraph",label:e("editor.paragraph.tooltip"),aliases:["paragraph","zw"],iconName:"Paragraph",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading1",label:e("editor.heading.h1.tooltip"),aliases:["h1","bt","bt1"],iconName:"Heading1",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading2",label:e("editor.heading.h2.tooltip"),aliases:["h2","bt","bt2"],iconName:"Heading2",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setNode("heading",{level:2}).run()}},{name:"heading3",label:e("editor.heading.h3.tooltip"),aliases:["h3","bt","bt3","heading3"],iconName:"Heading3",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setNode("heading",{level:3}).run()}},{name:"bulletList",label:e("editor.bulletlist.tooltip"),aliases:["ul","yxlb","bulletList"],iconName:"List",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).toggleBulletList().run()}},{name:"numberedList",label:e("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).toggleOrderedList().run()}},{name:"codeBlock",label:e("editor.codeblock.tooltip"),iconName:"Code2",aliases:["codeBlock"],description:"Code block with syntax highlighting",shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setCodeBlock().run()}},{name:"blockquote",label:e("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setBlockquote().run()}},{name:"horizontalrule",label:e("editor.horizontalrule.tooltip"),aliases:["fgx","horizontalRule"],iconName:"Minus",action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setHorizontalRule().run()}},{name:"link",label:e("editor.link.tooltip"),aliases:["link","lianjie","lj"],iconName:"Link",action:({editor:o,range:s})=>{o.chain().deleteRange(s).extendMarkRange("link").insertContent({type:"text",text:"link",marks:[{type:"link",attrs:{href:"",target:"_blank"}}]}).setLink({href:""}).focus().run()}}]},{name:"insert",title:e("editor.slash.insert"),commands:[{name:"image",label:e("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setImageUpload().run()}},{name:"table",label:e("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}},{name:"video",label:e("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).setVideoUpload().run()}},{name:"taskList",label:e("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:o,range:s})=>{o.chain().focus().deleteRange(s).toggleTaskList().run()}},{name:"columns",label:e("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",aliases:["columns","cols","2cols"],shouldBeHidden:o=>o.isActive("columns"),action:({editor:o,range:s})=>{o.chain().deleteRange(s).setColumns().focus(o.state.selection.head-1).run()}}]}];if(T0(t,"iframes")){const o=vY;n.push({name:"others",title:e("editor.slash.embed"),commands:o.map(s=>({name:s.value,label:s.label,iconName:s.icon,aliases:[s.value,s.label],shouldBeHidden:a=>a.isActive("columns"),action:({editor:a,range:l})=>{a.chain().deleteRange(l).focus().setIframe({src:"",service:s.value}).run()}}))})}return n}const wY={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},xY={className:"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-2 font-semibold tracking-wider select-none uppercase first:mt-0.5"},CY=["onClick"],EY=["src"],kY={key:1,class:"p-3"},SY={class:"text-xs text-gray-800 dark:text-gray-400"},_Y=i.defineComponent({__name:"CommandsList",props:{editor:{},items:{default:void 0},command:{type:Function,default:void 0}},setup(t,{expose:e}){const n=i.ref(0),r=i.ref(0),o=i.ref(null),{t:s}=Ot(),a=i.ref([]),l=t;e({onKeyDown:u}),i.watch([()=>n.value,()=>r.value],async()=>{if(!o.value)return;await i.nextTick();const y=r.value*1e3+n.value,w=a.value[y];w&&w.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:y}){return y.key==="ArrowUp"?(c(),!0):y.key==="ArrowDown"?(f(),!0):y.key==="Enter"?(p(),!0):!1}function c(){var x;if(!l.items.length)return!1;let y=n.value-1,w=r.value;y<0&&(w=r.value-1,y=((x=l.items[w])==null?void 0:x.commands.length)-1||0),w<0&&(w=l.items.length-1,y=l.items[w].commands.length-1),n.value=y,r.value=w}function f(){if(!l.items.length)return!1;const y=l.items[r.value].commands;let w=n.value+1,x=r.value;y.length-1<w&&(w=0,x=r.value+1),l.items.length-1<x&&(x=0),n.value=w,r.value=x}function p(){if(!l.items.length||r.value===-1||n.value===-1)return!1;m(r.value,n.value)}function m(y,w){const x=l.items[y].commands[w];l.command(x)}function g(y,w){m(y,w)}function b(y,w,x){a.value[y*1e3+w]=x}return(y,w)=>{var x;return i.openBlock(),i.createElementBlock("div",{ref_key:"scrollContainer",ref:o,class:"bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800 text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-1"},[(x=y.items)!=null&&x.length?(i.openBlock(),i.createElementBlock("div",wY,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(y.items,(E,k)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:E.title},[i.createElementVNode("div",xY,i.toDisplayString(E.title),1),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(E.commands,(C,_)=>(i.openBlock(),i.createElementBlock("button",{ref_for:!0,ref:A=>b(k,_,A),key:_,class:i.normalizeClass(["flex items-center gap-3 px-2 py-1.5 text-sm text-neutral-800 dark:text-neutral-200 text-left w-full rounded-sm outline-none transition-colors",[r.value===k&&n.value===_?"bg-ed-accent text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200":"hover:bg-ed-accent hover:text-neutral-800 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"]]),onClick:A=>g(k,_)},[C.iconUrl?(i.openBlock(),i.createElementBlock("img",{key:0,class:"w-6 h-6",src:C.iconUrl},null,8,EY)):i.createCommentVNode("",!0),C.iconName?(i.openBlock(),i.createBlock(i.unref(Lt),{key:1,name:C.iconName,class:"mr-1 text-lg"},null,8,["name"])):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(C.label),1)],10,CY))),128))],64))),128))])):(i.openBlock(),i.createElementBlock("div",kY,[i.createElementVNode("span",SY,i.toDisplayString(i.unref(s)("editor.slash.empty")),1)]))],512)}}}),pa="slashCommand";let Pt;const TY=Ze.create({name:pa,priority:200,onCreate(){Pt=Hs("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[dY({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new kt(pa),allow:({state:t,range:e})=>{var c,f,p;const n=t.doc.resolve(e.from),r=n.depth===1,o=n.parent.type.name==="paragraph",s=((c=n.parent.textContent)==null?void 0:c.charAt(0))==="/",a=this.editor.isActive("column"),l=(p=n.parent.textContent)==null?void 0:p.substring((f=n.parent.textContent)==null?void 0:f.indexOf("/")),u=!(l!=null&&l.endsWith(" "));return(r&&o&&s||a&&o&&s)&&u},command:({editor:t,range:e,props:n})=>{const{view:r}=t;n.action({editor:t,range:e}),r.focus()},items:({query:t})=>yY(this.editor).map(s=>({...s,commands:s.commands.filter(a=>{const l=a.label.toLowerCase().trim(),u=t.toLowerCase().trim();if(a.aliases){const c=a.aliases.map(m=>m.toLowerCase().trim()),f=l.match(u),p=c.some(m=>m.match(u));return f||p}return l.match(u)}).filter(a=>a.shouldBeHidden?!a.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(a=>({...a,isEnabled:!0}))})),render:()=>{let t,e=null;return{onStart:n=>{var s;t=new lw(_Y,{props:n,editor:n.editor});const{view:r}=n.editor,o=()=>{if(!n.clientRect)return n.editor.storage[pa].rect;const a=n.clientRect();if(!a)return n.editor.storage[pa].rect;let l=a.y;if(t.element instanceof HTMLElement&&a.top+t.element.offsetHeight+40>window.innerHeight){const u=a.top+t.element.offsetHeight-window.innerHeight+40;l=a.y-u}return new DOMRect(a.x,l,a.width,a.height)};e=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:o})},(s=r.dom.parentElement)==null||s.addEventListener("scroll",e),t.element&&(Pt==null||Pt[0].setProps({getReferenceClientRect:o,appendTo:()=>document.body,content:t.element})),Pt==null||Pt[0].show()},onUpdate(n){var a;t.updateProps(n);const{view:r}=n.editor,o=()=>{if(!n.clientRect)return n.editor.storage[pa].rect;const l=n.clientRect();return l?new DOMRect(l.x,l.y,l.width,l.height):n.editor.storage[pa].rect},s=()=>{Pt==null||Pt[0].setProps({getReferenceClientRect:o})};(a=r.dom.parentElement)==null||a.addEventListener("scroll",s),n.editor.storage[pa].rect=n.clientRect?o():{width:0,height:0,left:0,top:0,right:0,bottom:0},Pt==null||Pt[0].setProps({getReferenceClientRect:o})},onKeyDown(n){var r;return n.event.key==="Escape"?(Pt==null||Pt[0].hide(),!0):(Pt!=null&&Pt[0].state.isShown||Pt==null||Pt[0].show(),(r=t.ref)==null?void 0:r.onKeyDown(n))},onExit(n){var r;if(Pt==null||Pt[0].hide(),e){const{view:o}=n.editor;(r=o.dom.parentElement)==null||r.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),AY=i.defineComponent({__name:"AIButton",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},customClass:{default:""},loading:{type:Boolean,default:!1},tooltipOptions:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=wn(),{toast:r}=Rb();function o(){var a,l,u;const s=(l=(a=e.editor.extensionManager.extensions.find(c=>c.name==="AI"))==null?void 0:a.options)==null?void 0:l.completions;if(typeof s!="function"){r({title:"AI completions method is not set or is not a valid function",variant:"destructive"});return}if(s.constructor.name!=="AsyncFunction"){r({title:"AI completions method must be an asynchronous function",variant:"destructive"});return}n.state.AIMenu=!0,(u=e.editor)==null||u.commands.focus()}return(s,a)=>(i.openBlock(),i.createBlock(Ke,{action:o,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),OY=Bt.create({name:"AI",group:"block",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:({editor:e,t:n})=>({component:AY,componentProps:{icon:"Sparkles",tooltip:n("editor.AI.ask")}})}}});function MY(t,e){const n=atob(t.split(",")[1]),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);const o=new Uint8Array(r);return new Blob([o],{type:e})}function BY(t,e){return new File([t],e,{type:t.type})}const IY=Ze.create({name:"importWord",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{action:()=>{var o;return(o=e.commands)==null?void 0:o.toggleImportWord()},disabled:!e.can().setHorizontalRule(),icon:"Word",tooltip:r("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=Rb(),{t:r}=Ot();async function o(u){var g;const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(T0(e,"image")){const b=(g=e.extensionManager.extensions.find(y=>y.name==="importWord"))==null?void 0:g.options;if(b&&typeof b.upload=="function"){const y=[];for(const x of p){const E=x.getAttribute("src"),k=MY(E,"image/jpeg"),C=BY(k,"image.jpeg");y.push(C)}const w=await b.upload(y);for(let x=0;x<p.length;x++){const E=p[x];E.setAttribute("src",w[x].src);const k=E.parentElement;(k==null?void 0:k.tagName)==="P"&&(k.insertAdjacentElement("beforebegin",E),!k.hasChildNodes()&&k.textContent===""&&k.remove())}return f.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),f.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),f.body.innerHTML}async function s(u){const c=await o(u);e.chain().setContent(c.toString(),!0).run(),n({title:r("editor.importWord.success")})}const{open:a,onChange:l}=ht.useFileDialog({accept:".docx",reset:!0,multiple:!1});return a(),l(async u=>{const[c]=Array.from(u??[]);if(c){if(c.size>this.options.limit){n({title:r("editor.importWord.fileTooLarge"),variant:"destructive"});return}if(this.options.convert){const f=await this.options.convert(c);s(f)}else{const f=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});f.append("config",p),f.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:f}).then(m=>m.json()).then(async m=>{s(m.html)}).catch(m=>{n({title:r("editor.importWord.error"),variant:"destructive"}),console.error("Error:",m)})}}}),!1}}}}),Lb=wn(),RY=Ze.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{icon:"Eye",action:()=>{Lb.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>Lb.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(Lb.togglePreview(),!0)}}}),r5=wn(),LY=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function PY(t,e,n,r){const o=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ft.empty,results:[]};t==null||t.descendants((u,c)=>{u.isText?a[l]?a[l]={text:a[l].text+u.text,pos:a[l].pos}:a[l]={text:`${u.text}`,pos:c}:l+=1}),a=a.filter(Boolean);for(const u of a){const{text:c,pos:f}=u,p=Array.from(c.matchAll(e)).filter(([m])=>m.trim());for(const m of p){if(m[0]==="")break;m.index!==void 0&&s.push({from:f+m.index,to:f+m.index+m[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],f=u===r?`${n} ${n}-current`:n,p=jt.inline(c.from,c.to,{class:f});o.push(p)}return{decorationsToReturn:ft.create(t,o),results:s}}const DY=(t,e,{state:n,dispatch:r})=>{if(!e[0])return;const{from:s,to:a}=e[0];r&&r(n.tr.insertText(t,s,a))},VY=(t,e,n,r)=>{const o=e+1;if(!r[o])return null;const{from:s,to:a}=r[e],l=a-s-t.length+n,{from:u,to:c}=r[o];return r[o]={to:c-l,from:u-l},[l,r]},FY=(t,e,{tr:n,dispatch:r})=>{let o=0,s=e.slice();if(s.length){for(let a=0;a<s.length;a+=1){const{from:l,to:u}=s[a];n.insertText(t,l,u);const c=VY(t,a,o,s);c&&(o=c[0],s=c[1])}r&&r(n)}},$Y=new kt("findAndReplacePlugin"),zY=Ze.create({name:"findAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:e,extension:n,t:r})=>({component:Ke,componentProps:{icon:"DocSearch",tooltip:r("editor.findAndReplace.tooltip"),action:()=>{r5.toggleFindAndReplace()},isActive:()=>r5.state.findAndReplace}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e})=>(e.storage.findAndReplace.searchTerm=t,!1),setReplaceTerm:t=>({editor:e})=>(e.storage.findAndReplace.replaceTerm=t,!1),setCaseSensitive:t=>({editor:e})=>(e.storage.findAndReplace.caseSensitive=t,!1),resetIndex:()=>({editor:t})=>(t.storage.findAndReplace.resultIndex=0,!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n+1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n-1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:n})=>{const{replaceTerm:r,results:o}=t.storage.findAndReplace;return DY(r,o,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:o}=t.storage.findAndReplace;return FY(r,o,{tr:e,dispatch:n}),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:n}=this.options,r=a=>t.storage.findAndReplace.lastSearchTerm=a,o=a=>t.storage.findAndReplace.lastCaseSensitive=a,s=a=>t.storage.findAndReplace.lastResultIndex=a;return[new tt({key:$Y,state:{init:()=>ft.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&b===g)return u;if(r(c),o(p),s(g),!c)return t.storage.findAndReplace.results=[],ft.empty;const{decorationsToReturn:y,results:w}=PY(a,LY(c,n,p),e,g);return t.storage.findAndReplace.results=w,y}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:HY,state:UY}=wn(),WY=Ze.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ke,componentProps:{tooltip:e("editor.printer.tooltip"),action:()=>HY(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>UY.printer}})}}}),Pb="spell-check";class jY{constructor(e,n,r,o=1e3){Xt(this,"debouncedGetMatchAndSetDecorations",rt.debounce(this.getMatchAndSetDecorations.bind(this),300));Xt(this,"debouncedGetMatchAndSetDecorationsList",rt.debounce(this.getMatchAndSetDecorationsList.bind(this),300));Xt(this,"debouncedClickEventsListener",rt.debounce(this.clickEventsListener.bind(this),0));Xt(this,"debouncedAcceptSuggestionEventsListener",rt.debounce(this.acceptSuggestionListener.bind(this),0));Xt(this,"debouncedProofreadChangedNodes",rt.debounce(this.proofreadChangedNodes.bind(this),300));Xt(this,"proofreader");Xt(this,"uiStrings");Xt(this,"showSuggestionsEvent");Xt(this,"decorationSet");Xt(this,"editorView");Xt(this,"isInitialProofreadingDone",!1);Xt(this,"lastOriginalFrom",0);Xt(this,"lastClickedDecoration",null);Xt(this,"suggestionBox");Xt(this,"isEnableSuggestion");Xt(this,"isMobile");Xt(this,"limit",1e3);Xt(this,"_debouncedProofreadDoc",rt.debounce((e,n)=>{this.proofreadDoc(e),n&&n()},500));Xt(this,"_debouncedHandleEnterKey",rt.debounce((e,n,r)=>{this.handleEnterKey(e,n),r&&r()},500));this.proofreader=e,this.uiStrings=n,this.showSuggestionsEvent=r,this.decorationSet=ft.empty,this.limit=o,this.suggestionBox=document.createElement("div"),this.suggestionBox.id="suggestions-box",this.suggestionBox.tabIndex=0,this.isEnableSuggestion=!0,this.isMobile=!1,this.hideSuggestionBox()}get completeProofreadingDone(){return this.isInitialProofreadingDone}getProofreader(){return this.proofreader}toggleIsEnabledSpellCheck(){this.proofreader.toggleIsEnabled()}setEnabledProofreadText(e){this.proofreader.setEnabled(e)}getIsEnabledSpellCheck(){return this.proofreader.getIsEnabled()}setDecorationSet(e){this.decorationSet=e}getDecorationSet(){return this.decorationSet}setEditorView(e){this.editorView=e}getEditorView(){return this.editorView}getSuggestionBox(){return this.suggestionBox}hideSuggestionBox(){this.suggestionBox.textContent="",this.suggestionBox.style.display="none"}setIsEnableSuggestion(e){if(this.isEnableSuggestion=e,this.isEnableSuggestion){this.addEventListenersToDecorations();return}this.hideSuggestionBox(),this.removeEventListenersFromDecorations()}setIsMobile(e){this.isMobile=e}getChangedNodesFromTransaction(e,n=!1,r=!1){const o=[],s=new Set;let a=!1;return e.steps.forEach(l=>{var p,m,g;const u=l;if(u.from===void 0||u.to===void 0||n&&u.structure)return;((m=(p=u.slice)==null?void 0:p.content[0])==null?void 0:m.type.name)===hc&&(a=!0);const c=u.from-(r?1:0);let f=Math.max(u.to,u.from+(((g=u.slice)==null?void 0:g.size)||0))-(r?1:0);f>e.doc.content.size&&(f=e.doc.content.size),e.doc.nodesBetween(c,f,(b,y)=>{b&&(b.isText&&!s.has(y)&&(o.push({node:b,pos:y}),s.add(y)),b.type.name===hc&&(a=!0))})}),{changedNodes:o,isChangedSuperText:a}}debouncedProofreadDoc(e,n){this._debouncedProofreadDoc(e,n)}isSuperTextAlone(e,n){let r=!1;return e.descendants((o,s,a)=>o===n?(a&&a.type.name==="paragraph"&&a.childCount===1&&a.firstChild===n&&(r=!0),!1):!0),r}proofreadDoc(e){let n=[],r=0;e==null||e.descendants((u,c)=>{if(u.isText){const f={text:u.text??"",from:c,to:c+u.nodeSize};return n[r]&&(f.text=n[r].text+f.text,f.from=n[r].from),n[r]=f,r+=1,!1}return u.type.name!==hc}),n=n.filter(Boolean);let o="",s=1;for(const{text:u,from:c,to:f}of n){const p=c-s;p>0&&(o+=Array(p+1).join(`
|
|
294
294
|
`)),s=f,o+=u}const a=mw(o,this.limit),l=this.getMatchAndSetDecorationsList(a.map(u=>({text:u.text,originalFrom:u.offset+1})));this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(Hn.LOADING_TRANSACTION,!0)),l.then(()=>{this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(Hn.LOADING_TRANSACTION,!1))}),this.isInitialProofreadingDone=!0}async proofreadChangedNodes(e){const n=this.isMobile?1:2,o=e.reduce((s,a)=>{if(s.length===0)return s.push({changedNode:a,time:1}),s;const l=s[s.length-1];return a.pos===l.changedNode.pos+l.changedNode.node.nodeSize+n*(l.time-1)?(l.changedNode.node.text+=a.node.text,l.time+=1):s.push({changedNode:a,time:1}),s},[]).map(({changedNode:s})=>{var c;const a=((c=s.node)==null?void 0:c.textContent)||"",l=s.pos;return mw(a,this.limit).map(f=>({text:f.text,originalFrom:l+f.offset}))});this.debouncedGetMatchAndSetDecorationsList(o.flat())}async getMatchAndSetDecorationsList(e){const n=e.map(r=>this.getMatchAndSetDecorations(r.text,r.originalFrom));await Promise.all(n)}async getMatchAndSetDecorations(e,n){const r=await this.proofreader.proofreadText(this.proofreader.normalizeTextForLanguage(e)),o=[];for(const l of r){const u=l.startIndex+n,c=u+l.length,f=await this.proofreader.getSuggestions(l.wrongWord),p={length:l.length,wrongWord:l.wrongWord,suggestions:f};o.push(jt.inline(u,c,{class:"spell-error",nodeName:"span",[Pb]:JSON.stringify(p)}))}const s=this.decorationSet.find(n,n+e.length);let a=this.decorationSet.remove(s);this.editorView&&(a=a.add(this.editorView.state.doc,o)),this.setDecorationSet(a),this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(Hn.SPELLCHECKER_TRANSACTION,!0)),this.addEventListenersToDecorations()}removeEventListenersFromDecorations(){var r;const e=(r=this.editorView)==null?void 0:r.domAtPos(this.lastOriginalFrom).node,n=(e==null?void 0:e.querySelectorAll("span.spell-error"))||[];n.length&&n.forEach(o=>{o.removeEventListener("click",this.debouncedClickEventsListener)})}addEventListenersToDecorations(){var e;if(this.isEnableSuggestion)try{const n=(e=this.editorView)==null?void 0:e.domAtPos(this.lastOriginalFrom).node,r=(n==null?void 0:n.querySelectorAll("span.spell-error"))||[];if(!r.length)return;r.forEach(o=>{o.addEventListener("click",this.debouncedClickEventsListener)})}catch{}}addEventListenersToSuggestionBox(){const e=this.suggestionBox.querySelectorAll("li");e.length&&e.forEach(n=>{n.addEventListener("mousedown",this.debouncedAcceptSuggestionEventsListener)})}dispatch(e){this.editorView&&this.editorView.dispatch(e)}findChangedTextNodes(e,n,r,o){if(!e.isBlock)return!1;if(!e.isTextblock)return e.descendants((u,c)=>{this.findChangedTextNodes(u,c,r,o)}),!1;const[s,a]=[n,n+e.nodeSize];if(!(s<=r&&o<=a))return;const l={node:e,pos:n};this.onNodeChanged(l.node.textContent,l.pos+1)}onNodeChanged(e,n){n!==this.lastOriginalFrom?this.getMatchAndSetDecorations(e,n):this.debouncedGetMatchAndSetDecorations(e,n),this.lastOriginalFrom=n}async clickEventsListener(e){var c,f;if(!e.target)return;let n=e.target;for(;n&&!n.classList.contains("spell-error");)n=n.parentElement;if(!n||!n.classList.contains("spell-error"))return;this.lastClickedDecoration=n;const r=(c=n.getAttribute(Pb))==null?void 0:c.trim();if(!r){console.error("No match string provided",{spellCheckerAttributes:r});return}const{length:o,wrongWord:s,suggestions:a}=JSON.parse(r),l=((f=this.editorView)==null?void 0:f.posAtDOM(n,0))??0,u=l+o;if(this.editorView){this.addSuggestionsList(a,l,u),this.suggestionBox.style.display="";const p=PK(n);if(!p)return;const m=n.getBoundingClientRect(),g=p.getBoundingClientRect(),b=window.getComputedStyle(p).padding,y=m.left-g.left+3-parseInt(b),w=m.top-g.top+30-parseInt(b);this.suggestionBox.style.left=y+"px",this.suggestionBox.style.top=w+"px",this.showSuggestionsEvent&&this.showSuggestionsEvent(this.proofreader.normalizeTextForLanguage(s))}return this.addEventListenersToSuggestionBox(),!1}acceptSuggestionListener(e){var s;if(!e||!e.target)return;e.preventDefault(),e.stopPropagation();const n=e.target;let r=0,o=0;if(this.lastClickedDecoration&&this.editorView){const a=(s=this.lastClickedDecoration.getAttribute(Pb))==null?void 0:s.trim();if(a){const{length:l}=JSON.parse(a);r=this.editorView.posAtDOM(this.lastClickedDecoration,0),o=r+l}}this.editorView&&r>=0&&o>r&&(this.dispatch(this.editorView.state.tr.setMeta(Hn.ACCEPT_SUGGESTION,!0)),this.dispatch(this.editorView.state.tr.insertText(n.textContent||"",r,o))),this.hideSuggestionBox(),this.lastClickedDecoration&&(this.lastClickedDecoration.removeEventListener("click",this.debouncedClickEventsListener),this.lastClickedDecoration=null)}addSuggestionsList(e,n,r){if(this.suggestionBox.textContent="",e.length>0){const o=document.createElement("ul");o.className="suggestion-list",e.forEach(s=>{const a=document.createElement("li");a.innerText=s,a.dataset.from=n+"",a.dataset.to=r+"",o.appendChild(a)}),this.suggestionBox.appendChild(o)}if(e.length===0){const o=document.createElement("b"),s=this.uiStrings&&this.uiStrings.noSuggestions?this.uiStrings.noSuggestions:"No suggestions found";o.textContent=s,this.suggestionBox.appendChild(o)}}isUndoRedo(e,n){return e.getMeta(L8.ADD_TO_HISTORY_TRANSACTION)===!1||e.getMeta(Hn.APPENDED)===!0||n.isUndoRedoOperation}handleUndoRedo(e,n){var s;const r=(s=e.getMeta(L8.HISTORY_TRANSACTION))==null?void 0:s.redo;if(n.isUndoRedoOperation=!1,r)return this.debouncedProofreadDoc(e.doc),this.getDecorationSet();const{changedNodes:o}=this.getChangedNodesFromTransaction(e,!0);return o.length===0?this.getDecorationSet():o.length===1?(this.debouncedProofreadChangedNodes(o),this.getDecorationSet()):(this.debouncedProofreadDoc(e.doc),this.getDecorationSet())}isTextContentChangedOrDeleted(e){let n=!1;return{isTextContentChanged:e.steps.some(o=>{var a,l;const s=(a=o.toJSON)==null?void 0:a.call(o);return(s==null?void 0:s.stepType)==="replace"&&((l=s==null?void 0:s.slice)!=null&&l.content)?s.slice.content.some(u=>u.type==="paragraph"&&u.content&&u.content.length>0):(s==null?void 0:s.stepType)==="replace"&&(!s.slice||!s.slice.content||s.slice.content.length===0)?(n=!0,s.from!==s.to):!1}),isDeleteAction:n}}handleEnterKey(e,n){if(n)return this.debouncedProofreadDoc(e.doc),this.getDecorationSet();const r=e.getMeta(Hn.APPENDED_TRANSACTION);if(!r)return this.getDecorationSet();const s=r.steps[0].to,a=r.before.nodeAt(s-1);if(!(a!=null&&a.isText))return this.getDecorationSet();let l=0;return r.before.descendants((c,f)=>{c.textContent===(a==null?void 0:a.textContent)&&(l=f)}),l+((a==null?void 0:a.nodeSize)||0)===s?this.getDecorationSet():(this.debouncedProofreadDoc(e.doc),this.getDecorationSet())}handleEnterKeyDebounced(e,n,r){this._debouncedHandleEnterKey(e,n,r)}}const o5=wn(),Hn={SPELLCHECKER_TRANSACTION:"spellcheckerTransaction",IS_ACTIVE_SPELLCHECK:"isActiveSpellCheck",LOADING_TRANSACTION:"loading",PREVENT_UPDATE:"preventUpdate",APPENDED:"appended",APPENDED_TRANSACTION:"appendedTransaction",ACCEPT_SUGGESTION:"acceptSuggestion",SKIP_SPELLCHECK:"skipSpellcheck",UI_EVENT:"uiEvent"},qY={DROP:"drop"},i5=Ze.create({name:"spellchecker",addOptions(){return{proofreader:void 0,uiStrings:{noSuggestions:""},button:({editor:t,t:e,isMobile:n})=>({component:Ke,componentProps:{action:()=>t.commands.handleActiveSpellCheck(),isActive:()=>{var r,o,s,a;return((a=(s=(o=(r=t==null?void 0:t.extensionStorage)==null?void 0:r.spellchecker)==null?void 0:o.spellchecker)==null?void 0:s.proofreader)==null?void 0:a.enabled)||!1},icon:"SpellCheck",tooltip:"맞춤법 검사",title:n?e("editor.menubar.menu.spelling"):""}})}},addStorage(){return{didPaste:!1,spellchecker:void 0,isUndoRedoOperation:!1,pendingSpellCheck:!1,enterKeyPressed:!1}},addCommands(){return{checkSpelling:()=>({tr:t})=>(this.storage.spellchecker.proofreadDoc(t.doc),!0),selectAll:()=>({state:t,dispatch:e})=>(s9(t,e),!0),copy:()=>()=>(document.execCommand("copy"),!0),handleActiveSpellCheck:(t=!0)=>({editor:e})=>{const n=e.extensionStorage.spellchecker.spellchecker;return n.toggleIsEnabledSpellCheck(),e.view.dispatch(e.state.tr.setMeta(Hn.IS_ACTIVE_SPELLCHECK,n.getIsEnabledSpellCheck())),t&&o5.setSpellCheck(n.getIsEnabledSpellCheck()),!0},setIsEnableSuggestion:t=>()=>(this.storage.spellchecker.setIsEnableSuggestion(t),!0)}},addProseMirrorPlugins(){return[new tt({key:new kt("skipMarkPlugin"),view:e=>{const n=e.dispatch;return e.dispatch=r=>(r.steps.some(s=>s instanceof Jo||s instanceof no)&&r.setMeta(Hn.SKIP_SPELLCHECK,!0),n.call(e,r)),{}}}),new tt({key:new kt("spellcheckerPlugin"),props:{decorations(e){return this.getState(e)},handlePaste:()=>{this.storage.didPaste=!0},handleClick:()=>{this.storage.spellchecker.hideSuggestionBox()},handleKeyDown:(e,n)=>((n.ctrlKey||n.metaKey)&&(n.key==="z"||n.key==="y")&&(this.storage.isUndoRedoOperation=!0,this.storage.pendingSpellCheck=!0),this.storage.enterKeyPressed&&(this.storage.pendingSpellCheck=!0),n.key==="Enter"&&(this.storage.enterKeyPressed=!0),!1)},state:{init:(e,n)=>{var o,s;const r=new jY(this.options.proofreader,this.options.uiStrings,this.options.onShowSuggestionsEvent,(o=this.options.proofreader)==null?void 0:o.limit);return this.storage.spellchecker=r,r.setDecorationSet(ft.create(n.doc,[])),o5.setSpellCheck(r.getIsEnabledSpellCheck()),(s=this.options.proofreader)!=null&&s.enabled&&r.proofreadDoc(n.doc),r.getDecorationSet()},apply:(e,n)=>{var s;if(e.getMeta(Hn.SKIP_SPELLCHECK))return n;const r=this.storage.spellchecker,o=e.getMeta(Hn.IS_ACTIVE_SPELLCHECK);if(o!==void 0)return o?r.proofreadDoc(e.doc):r.setDecorationSet(ft.empty),r.getDecorationSet();if(e.getMeta(Hn.SPELLCHECKER_TRANSACTION))return r.getDecorationSet();if(e.docChanged&&e.doc.nodeSize){const l=r.getDecorationSet().map(e.mapping,e.doc);if(r.setDecorationSet(l),e.getMeta(Hn.UI_EVENT)===qY.DROP)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();if(r.isUndoRedo(e,this.storage))return r.handleUndoRedo(e,this.storage);const{isTextContentChanged:u,isDeleteAction:c}=r.isTextContentChangedOrDeleted(e);if(c){const{changedNodes:g}=r.getChangedNodesFromTransaction(e,!1,!0);return g.length>0&&r.debouncedProofreadChangedNodes([g[0]]),r.getDecorationSet()}if(this.storage.enterKeyPressed)return r.handleEnterKeyDebounced(e,this.storage.pendingSpellCheck,()=>{this.storage.enterKeyPressed=!1,this.storage.pendingSpellCheck=!1}),r.getDecorationSet();if(this.storage.pendingSpellCheck||u)return r.debouncedProofreadDoc(e.doc,()=>{this.storage.pendingSpellCheck=!1}),r.getDecorationSet();if(e.getMeta(wE.UPDATE)||e.updated===0&&((s=e.steps[0])==null?void 0:s.structure)===!0)return r.getDecorationSet();if(e.getMeta(Hn.PREVENT_UPDATE)===!0&&e.before.textContent.length===0)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();this.storage.didPaste&&(this.storage.didPaste=!1);const{changedNodes:p,isChangedSuperText:m}=r.getChangedNodesFromTransaction(e);if(m)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();p.length>0&&r.debouncedProofreadChangedNodes(p)}return r.getDecorationSet()}},view:()=>({update:e=>{var r,o;const n=this.storage.spellchecker;n.setEditorView(e),(o=(r=e==null?void 0:e.dom)==null?void 0:r.parentNode)==null||o.appendChild(n.getSuggestionBox())}})})]}});function s5(t,e){return function(){return t.apply(e,arguments)}}const{toString:KY}=Object.prototype,{getPrototypeOf:Db}=Object,Fp=(t=>e=>{const n=KY.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),bo=t=>(t=t.toLowerCase(),e=>Fp(e)===t),$p=t=>e=>typeof e===t,{isArray:Ol}=Array,bc=$p("undefined");function GY(t){return t!==null&&!bc(t)&&t.constructor!==null&&!bc(t.constructor)&&Cr(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const a5=bo("ArrayBuffer");function XY(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&a5(t.buffer),e}const YY=$p("string"),Cr=$p("function"),l5=$p("number"),zp=t=>t!==null&&typeof t=="object",JY=t=>t===!0||t===!1,Hp=t=>{if(Fp(t)!=="object")return!1;const e=Db(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},ZY=bo("Date"),QY=bo("File"),NY=bo("Blob"),eJ=bo("FileList"),tJ=t=>zp(t)&&Cr(t.pipe),nJ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Cr(t.append)&&((e=Fp(t))==="formdata"||e==="object"&&Cr(t.toString)&&t.toString()==="[object FormData]"))},rJ=bo("URLSearchParams"),[oJ,iJ,sJ,aJ]=["ReadableStream","Request","Response","Headers"].map(bo),lJ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function vc(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,o;if(typeof t!="object"&&(t=[t]),Ol(t))for(r=0,o=t.length;r<o;r++)e.call(null,t[r],r,t);else{const s=n?Object.getOwnPropertyNames(t):Object.keys(t),a=s.length;let l;for(r=0;r<a;r++)l=s[r],e.call(null,t[l],l,t)}}function u5(t,e){e=e.toLowerCase();const n=Object.keys(t);let r=n.length,o;for(;r-- >0;)if(o=n[r],e===o.toLowerCase())return o;return null}const ha=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,c5=t=>!bc(t)&&t!==ha;function Vb(){const{caseless:t}=c5(this)&&this||{},e={},n=(r,o)=>{const s=t&&u5(e,o)||o;Hp(e[s])&&Hp(r)?e[s]=Vb(e[s],r):Hp(r)?e[s]=Vb({},r):Ol(r)?e[s]=r.slice():e[s]=r};for(let r=0,o=arguments.length;r<o;r++)arguments[r]&&vc(arguments[r],n);return e}const uJ=(t,e,n,{allOwnKeys:r}={})=>(vc(e,(o,s)=>{n&&Cr(o)?t[s]=s5(o,n):t[s]=o},{allOwnKeys:r}),t),cJ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),dJ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},fJ=(t,e,n,r)=>{let o,s,a;const l={};if(e=e||{},t==null)return e;do{for(o=Object.getOwnPropertyNames(t),s=o.length;s-- >0;)a=o[s],(!r||r(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=n!==!1&&Db(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},pJ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},hJ=t=>{if(!t)return null;if(Ol(t))return t;let e=t.length;if(!l5(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},mJ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Db(Uint8Array)),gJ=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let o;for(;(o=r.next())&&!o.done;){const s=o.value;e.call(t,s[0],s[1])}},bJ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},vJ=bo("HTMLFormElement"),yJ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,o){return r.toUpperCase()+o}),d5=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),wJ=bo("RegExp"),f5=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};vc(n,(o,s)=>{let a;(a=e(o,s,t))!==!1&&(r[s]=a||o)}),Object.defineProperties(t,r)},xJ=t=>{f5(t,(e,n)=>{if(Cr(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Cr(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},CJ=(t,e)=>{const n={},r=o=>{o.forEach(s=>{n[s]=!0})};return Ol(t)?r(t):r(String(t).split(e)),n},EJ=()=>{},kJ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function SJ(t){return!!(t&&Cr(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const _J=t=>{const e=new Array(10),n=(r,o)=>{if(zp(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[o]=r;const s=Ol(r)?[]:{};return vc(r,(a,l)=>{const u=n(a,o+1);!bc(u)&&(s[l]=u)}),e[o]=void 0,s}}return r};return n(t,0)},TJ=bo("AsyncFunction"),AJ=t=>t&&(zp(t)||Cr(t))&&Cr(t.then)&&Cr(t.catch),p5=((t,e)=>t?setImmediate:e?((n,r)=>(ha.addEventListener("message",({source:o,data:s})=>{o===ha&&s===n&&r.length&&r.shift()()},!1),o=>{r.push(o),ha.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Cr(ha.postMessage)),OJ=typeof queueMicrotask<"u"?queueMicrotask.bind(ha):typeof process<"u"&&process.nextTick||p5,re={isArray:Ol,isArrayBuffer:a5,isBuffer:GY,isFormData:nJ,isArrayBufferView:XY,isString:YY,isNumber:l5,isBoolean:JY,isObject:zp,isPlainObject:Hp,isReadableStream:oJ,isRequest:iJ,isResponse:sJ,isHeaders:aJ,isUndefined:bc,isDate:ZY,isFile:QY,isBlob:NY,isRegExp:wJ,isFunction:Cr,isStream:tJ,isURLSearchParams:rJ,isTypedArray:mJ,isFileList:eJ,forEach:vc,merge:Vb,extend:uJ,trim:lJ,stripBOM:cJ,inherits:dJ,toFlatObject:fJ,kindOf:Fp,kindOfTest:bo,endsWith:pJ,toArray:hJ,forEachEntry:gJ,matchAll:bJ,isHTMLForm:vJ,hasOwnProperty:d5,hasOwnProp:d5,reduceDescriptors:f5,freezeMethods:xJ,toObjectSet:CJ,toCamelCase:yJ,noop:EJ,toFiniteNumber:kJ,findKey:u5,global:ha,isContextDefined:c5,isSpecCompliantForm:SJ,toJSONObject:_J,isAsyncFn:TJ,isThenable:AJ,setImmediate:p5,asap:OJ};function ot(t,e,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o,this.status=o.status?o.status:null)}re.inherits(ot,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:re.toJSONObject(this.config),code:this.code,status:this.status}}});const h5=ot.prototype,m5={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{m5[t]={value:t}}),Object.defineProperties(ot,m5),Object.defineProperty(h5,"isAxiosError",{value:!0}),ot.from=(t,e,n,r,o,s)=>{const a=Object.create(h5);return re.toFlatObject(t,a,function(u){return u!==Error.prototype},l=>l!=="isAxiosError"),ot.call(a,t.message,e,n,r,o),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const MJ=null;function Fb(t){return re.isPlainObject(t)||re.isArray(t)}function g5(t){return re.endsWith(t,"[]")?t.slice(0,-2):t}function b5(t,e,n){return t?t.concat(e).map(function(o,s){return o=g5(o),!n&&s?"["+o+"]":o}).join(n?".":""):e}function BJ(t){return re.isArray(t)&&!t.some(Fb)}const IJ=re.toFlatObject(re,{},null,function(e){return/^is[A-Z]/.test(e)});function Up(t,e,n){if(!re.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=re.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,w){return!re.isUndefined(w[y])});const r=n.metaTokens,o=n.visitor||f,s=n.dots,a=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&re.isSpecCompliantForm(e);if(!re.isFunction(o))throw new TypeError("visitor must be a function");function c(b){if(b===null)return"";if(re.isDate(b))return b.toISOString();if(!u&&re.isBlob(b))throw new ot("Blob is not supported. Use a Buffer instead.");return re.isArrayBuffer(b)||re.isTypedArray(b)?u&&typeof Blob=="function"?new Blob([b]):Buffer.from(b):b}function f(b,y,w){let x=b;if(b&&!w&&typeof b=="object"){if(re.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=JSON.stringify(b);else if(re.isArray(b)&&BJ(b)||(re.isFileList(b)||re.endsWith(y,"[]"))&&(x=re.toArray(b)))return y=g5(y),x.forEach(function(k,C){!(re.isUndefined(k)||k===null)&&e.append(a===!0?b5([y],C,s):a===null?y:y+"[]",c(k))}),!1}return Fb(b)?!0:(e.append(b5(w,y,s),c(b)),!1)}const p=[],m=Object.assign(IJ,{defaultVisitor:f,convertValue:c,isVisitable:Fb});function g(b,y){if(!re.isUndefined(b)){if(p.indexOf(b)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(b),re.forEach(b,function(x,E){(!(re.isUndefined(x)||x===null)&&o.call(e,x,re.isString(E)?E.trim():E,y,m))===!0&&g(x,y?y.concat(E):[E])}),p.pop()}}if(!re.isObject(t))throw new TypeError("data must be an object");return g(t),e}function v5(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function $b(t,e){this._pairs=[],t&&Up(t,this,e)}const y5=$b.prototype;y5.append=function(e,n){this._pairs.push([e,n])},y5.toString=function(e){const n=e?function(r){return e.call(this,r,v5)}:v5;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function RJ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function w5(t,e,n){if(!e)return t;const r=n&&n.encode||RJ;re.isFunction(n)&&(n={serialize:n});const o=n&&n.serialize;let s;if(o?s=o(e,n):s=re.isURLSearchParams(e)?e.toString():new $b(e,n).toString(r),s){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class x5{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){re.forEach(this.handlers,function(r){r!==null&&e(r)})}}const C5={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},LJ={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:$b,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},zb=typeof window<"u"&&typeof document<"u",Hb=typeof navigator=="object"&&navigator||void 0,PJ=zb&&(!Hb||["ReactNative","NativeScript","NS"].indexOf(Hb.product)<0),DJ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",VJ=zb&&window.location.href||"http://localhost",Un={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zb,hasStandardBrowserEnv:PJ,hasStandardBrowserWebWorkerEnv:DJ,navigator:Hb,origin:VJ},Symbol.toStringTag,{value:"Module"})),...LJ};function FJ(t,e){return Up(t,new Un.classes.URLSearchParams,Object.assign({visitor:function(n,r,o,s){return Un.isNode&&re.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function $J(t){return re.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function zJ(t){const e={},n=Object.keys(t);let r;const o=n.length;let s;for(r=0;r<o;r++)s=n[r],e[s]=t[s];return e}function E5(t){function e(n,r,o,s){let a=n[s++];if(a==="__proto__")return!0;const l=Number.isFinite(+a),u=s>=n.length;return a=!a&&re.isArray(o)?o.length:a,u?(re.hasOwnProp(o,a)?o[a]=[o[a],r]:o[a]=r,!l):((!o[a]||!re.isObject(o[a]))&&(o[a]=[]),e(n,r,o[a],s)&&re.isArray(o[a])&&(o[a]=zJ(o[a])),!l)}if(re.isFormData(t)&&re.isFunction(t.entries)){const n={};return re.forEachEntry(t,(r,o)=>{e($J(r),o,n,0)}),n}return null}function HJ(t,e,n){if(re.isString(t))try{return(e||JSON.parse)(t),re.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const yc={transitional:C5,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",o=r.indexOf("application/json")>-1,s=re.isObject(e);if(s&&re.isHTMLForm(e)&&(e=new FormData(e)),re.isFormData(e))return o?JSON.stringify(E5(e)):e;if(re.isArrayBuffer(e)||re.isBuffer(e)||re.isStream(e)||re.isFile(e)||re.isBlob(e)||re.isReadableStream(e))return e;if(re.isArrayBufferView(e))return e.buffer;if(re.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return FJ(e,this.formSerializer).toString();if((l=re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const u=this.env&&this.env.FormData;return Up(l?{"files[]":e}:e,u&&new u,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),HJ(e)):e}],transformResponse:[function(e){const n=this.transitional||yc.transitional,r=n&&n.forcedJSONParsing,o=this.responseType==="json";if(re.isResponse(e)||re.isReadableStream(e))return e;if(e&&re.isString(e)&&(r&&!this.responseType||o)){const a=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(e)}catch(l){if(a)throw l.name==="SyntaxError"?ot.from(l,ot.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Un.classes.FormData,Blob:Un.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};re.forEach(["delete","get","head","post","put","patch"],t=>{yc.headers[t]={}});const UJ=re.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),WJ=t=>{const e={};let n,r,o;return t&&t.split(`
|
|
295
295
|
`).forEach(function(a){o=a.indexOf(":"),n=a.substring(0,o).trim().toLowerCase(),r=a.substring(o+1).trim(),!(!n||e[n]&&UJ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},k5=Symbol("internals");function wc(t){return t&&String(t).trim().toLowerCase()}function Wp(t){return t===!1||t==null?t:re.isArray(t)?t.map(Wp):String(t)}function jJ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const qJ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Ub(t,e,n,r,o){if(re.isFunction(r))return r.call(this,e,n);if(o&&(e=n),!!re.isString(e)){if(re.isString(r))return e.indexOf(r)!==-1;if(re.isRegExp(r))return r.test(e)}}function KJ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function GJ(t,e){const n=re.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(o,s,a){return this[r].call(this,e,o,s,a)},configurable:!0})})}let lr=class{constructor(e){e&&this.set(e)}set(e,n,r){const o=this;function s(l,u,c){const f=wc(u);if(!f)throw new Error("header name must be a non-empty string");const p=re.findKey(o,f);(!p||o[p]===void 0||c===!0||c===void 0&&o[p]!==!1)&&(o[p||u]=Wp(l))}const a=(l,u)=>re.forEach(l,(c,f)=>s(c,f,u));if(re.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(re.isString(e)&&(e=e.trim())&&!qJ(e))a(WJ(e),n);else if(re.isHeaders(e))for(const[l,u]of e.entries())s(u,l,r);else e!=null&&s(n,e,r);return this}get(e,n){if(e=wc(e),e){const r=re.findKey(this,e);if(r){const o=this[r];if(!n)return o;if(n===!0)return jJ(o);if(re.isFunction(n))return n.call(this,o,r);if(re.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=wc(e),e){const r=re.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||Ub(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let o=!1;function s(a){if(a=wc(a),a){const l=re.findKey(r,a);l&&(!n||Ub(r,r[l],l,n))&&(delete r[l],o=!0)}}return re.isArray(e)?e.forEach(s):s(e),o}clear(e){const n=Object.keys(this);let r=n.length,o=!1;for(;r--;){const s=n[r];(!e||Ub(this,this[s],s,e,!0))&&(delete this[s],o=!0)}return o}normalize(e){const n=this,r={};return re.forEach(this,(o,s)=>{const a=re.findKey(r,s);if(a){n[a]=Wp(o),delete n[s];return}const l=e?KJ(s):String(s).trim();l!==s&&delete n[s],n[l]=Wp(o),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return re.forEach(this,(r,o)=>{r!=null&&r!==!1&&(n[o]=e&&re.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
|
|
296
296
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(o=>r.set(o)),r}static accessor(e){const r=(this[k5]=this[k5]={accessors:{}}).accessors,o=this.prototype;function s(a){const l=wc(a);r[l]||(GJ(o,a),r[l]=!0)}return re.isArray(e)?e.forEach(s):s(e),this}};lr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),re.reduceDescriptors(lr.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),re.freezeMethods(lr);function Wb(t,e){const n=this||yc,r=e||n,o=lr.from(r.headers);let s=r.data;return re.forEach(t,function(l){s=l.call(n,s,o.normalize(),e?e.status:void 0)}),o.normalize(),s}function S5(t){return!!(t&&t.__CANCEL__)}function Ml(t,e,n){ot.call(this,t??"canceled",ot.ERR_CANCELED,e,n),this.name="CanceledError"}re.inherits(Ml,ot,{__CANCEL__:!0});function _5(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new ot("Request failed with status code "+n.status,[ot.ERR_BAD_REQUEST,ot.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function XJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function YJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let o=0,s=0,a;return e=e!==void 0?e:1e3,function(u){const c=Date.now(),f=r[s];a||(a=c),n[o]=u,r[o]=c;let p=s,m=0;for(;p!==o;)m+=n[p++],p=p%t;if(o=(o+1)%t,o===s&&(s=(s+1)%t),c-a<e)return;const g=f&&c-f;return g?Math.round(m*1e3/g):void 0}}function JJ(t,e){let n=0,r=1e3/e,o,s;const a=(c,f=Date.now())=>{n=f,o=null,s&&(clearTimeout(s),s=null),t.apply(null,c)};return[(...c)=>{const f=Date.now(),p=f-n;p>=r?a(c,f):(o=c,s||(s=setTimeout(()=>{s=null,a(o)},r-p)))},()=>o&&a(o)]}const jp=(t,e,n=3)=>{let r=0;const o=YJ(50,250);return JJ(s=>{const a=s.loaded,l=s.lengthComputable?s.total:void 0,u=a-r,c=o(u),f=a<=l;r=a;const p={loaded:a,total:l,progress:l?a/l:void 0,bytes:u,rate:c||void 0,estimated:c&&l&&f?(l-a)/c:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(p)},n)},T5=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},A5=t=>(...e)=>re.asap(()=>t(...e)),ZJ=Un.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Un.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Un.origin),Un.navigator&&/(msie|trident)/i.test(Un.navigator.userAgent)):()=>!0,QJ=Un.hasStandardBrowserEnv?{write(t,e,n,r,o,s){const a=[t+"="+encodeURIComponent(e)];re.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),re.isString(r)&&a.push("path="+r),re.isString(o)&&a.push("domain="+o),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function NJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function eZ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function O5(t,e,n){let r=!NJ(e);return t&&(r||n==!1)?eZ(t,e):e}const M5=t=>t instanceof lr?{...t}:t;function ma(t,e){e=e||{};const n={};function r(c,f,p,m){return re.isPlainObject(c)&&re.isPlainObject(f)?re.merge.call({caseless:m},c,f):re.isPlainObject(f)?re.merge({},f):re.isArray(f)?f.slice():f}function o(c,f,p,m){if(re.isUndefined(f)){if(!re.isUndefined(c))return r(void 0,c,p,m)}else return r(c,f,p,m)}function s(c,f){if(!re.isUndefined(f))return r(void 0,f)}function a(c,f){if(re.isUndefined(f)){if(!re.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function l(c,f,p){if(p in e)return r(c,f);if(p in t)return r(void 0,c)}const u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(c,f,p)=>o(M5(c),M5(f),p,!0)};return re.forEach(Object.keys(Object.assign({},t,e)),function(f){const p=u[f]||o,m=p(t[f],e[f],f);re.isUndefined(m)&&p!==l||(n[f]=m)}),n}const B5=t=>{const e=ma({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:l}=e;e.headers=a=lr.from(a),e.url=w5(O5(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let u;if(re.isFormData(n)){if(Un.hasStandardBrowserEnv||Un.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[c,...f]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...f].join("; "))}}if(Un.hasStandardBrowserEnv&&(r&&re.isFunction(r)&&(r=r(e)),r||r!==!1&&ZJ(e.url))){const c=o&&s&&QJ.read(s);c&&a.set(o,c)}return e},tZ=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const o=B5(t);let s=o.data;const a=lr.from(o.headers).normalize();let{responseType:l,onUploadProgress:u,onDownloadProgress:c}=o,f,p,m,g,b;function y(){g&&g(),b&&b(),o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let w=new XMLHttpRequest;w.open(o.method.toUpperCase(),o.url,!0),w.timeout=o.timeout;function x(){if(!w)return;const k=lr.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),_={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:k,config:t,request:w};_5(function(T){n(T),y()},function(T){r(T),y()},_),w=null}"onloadend"in w?w.onloadend=x:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(x)},w.onabort=function(){w&&(r(new ot("Request aborted",ot.ECONNABORTED,t,w)),w=null)},w.onerror=function(){r(new ot("Network Error",ot.ERR_NETWORK,t,w)),w=null},w.ontimeout=function(){let C=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const _=o.transitional||C5;o.timeoutErrorMessage&&(C=o.timeoutErrorMessage),r(new ot(C,_.clarifyTimeoutError?ot.ETIMEDOUT:ot.ECONNABORTED,t,w)),w=null},s===void 0&&a.setContentType(null),"setRequestHeader"in w&&re.forEach(a.toJSON(),function(C,_){w.setRequestHeader(_,C)}),re.isUndefined(o.withCredentials)||(w.withCredentials=!!o.withCredentials),l&&l!=="json"&&(w.responseType=o.responseType),c&&([m,b]=jp(c,!0),w.addEventListener("progress",m)),u&&w.upload&&([p,g]=jp(u),w.upload.addEventListener("progress",p),w.upload.addEventListener("loadend",g)),(o.cancelToken||o.signal)&&(f=k=>{w&&(r(!k||k.type?new Ml(null,t,w):k),w.abort(),w=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));const E=XJ(o.url);if(E&&Un.protocols.indexOf(E)===-1){r(new ot("Unsupported protocol "+E+":",ot.ERR_BAD_REQUEST,t));return}w.send(s||null)})},nZ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,o;const s=function(c){if(!o){o=!0,l();const f=c instanceof Error?c:this.reason;r.abort(f instanceof ot?f:new Ml(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,s(new ot(`timeout ${e} of ms exceeded`,ot.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),t=null)};t.forEach(c=>c.addEventListener("abort",s));const{signal:u}=r;return u.unsubscribe=()=>re.asap(l),u}},rZ=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,o;for(;r<n;)o=r+e,yield t.slice(r,o),r=o},oZ=async function*(t,e){for await(const n of iZ(t))yield*rZ(n,e)},iZ=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},I5=(t,e,n,r)=>{const o=oZ(t,e);let s=0,a,l=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:c,value:f}=await o.next();if(c){l(),u.close();return}let p=f.byteLength;if(n){let m=s+=p;n(m)}u.enqueue(new Uint8Array(f))}catch(c){throw l(c),c}},cancel(u){return l(u),o.return()}},{highWaterMark:2})},qp=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",R5=qp&&typeof ReadableStream=="function",sZ=qp&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),L5=(t,...e)=>{try{return!!t(...e)}catch{return!1}},aZ=R5&&L5(()=>{let t=!1;const e=new Request(Un.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),P5=64*1024,jb=R5&&L5(()=>re.isReadableStream(new Response("").body)),Kp={stream:jb&&(t=>t.body)};qp&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Kp[e]&&(Kp[e]=re.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new ot(`Response type '${e}' is not supported`,ot.ERR_NOT_SUPPORT,r)})})})(new Response);const lZ=async t=>{if(t==null)return 0;if(re.isBlob(t))return t.size;if(re.isSpecCompliantForm(t))return(await new Request(Un.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(re.isArrayBufferView(t)||re.isArrayBuffer(t))return t.byteLength;if(re.isURLSearchParams(t)&&(t=t+""),re.isString(t))return(await sZ(t)).byteLength},uZ=async(t,e)=>{const n=re.toFiniteNumber(t.getContentLength());return n??lZ(e)},qb={http:MJ,xhr:tZ,fetch:qp&&(async t=>{let{url:e,method:n,data:r,signal:o,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:u,responseType:c,headers:f,withCredentials:p="same-origin",fetchOptions:m}=B5(t);c=c?(c+"").toLowerCase():"text";let g=nZ([o,s&&s.toAbortSignal()],a),b;const y=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let w;try{if(u&&aZ&&n!=="get"&&n!=="head"&&(w=await uZ(f,r))!==0){let _=new Request(e,{method:"POST",body:r,duplex:"half"}),A;if(re.isFormData(r)&&(A=_.headers.get("content-type"))&&f.setContentType(A),_.body){const[T,P]=T5(w,jp(A5(u)));r=I5(_.body,P5,T,P)}}re.isString(p)||(p=p?"include":"omit");const x="credentials"in Request.prototype;b=new Request(e,{...m,signal:g,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:x?p:void 0});let E=await fetch(b);const k=jb&&(c==="stream"||c==="response");if(jb&&(l||k&&y)){const _={};["status","statusText","headers"].forEach(I=>{_[I]=E[I]});const A=re.toFiniteNumber(E.headers.get("content-length")),[T,P]=l&&T5(A,jp(A5(l),!0))||[];E=new Response(I5(E.body,P5,T,()=>{P&&P(),y&&y()}),_)}c=c||"text";let C=await Kp[re.findKey(Kp,c)||"text"](E,t);return!k&&y&&y(),await new Promise((_,A)=>{_5(_,A,{data:C,headers:lr.from(E.headers),status:E.status,statusText:E.statusText,config:t,request:b})})}catch(x){throw y&&y(),x&&x.name==="TypeError"&&/fetch/i.test(x.message)?Object.assign(new ot("Network Error",ot.ERR_NETWORK,t,b),{cause:x.cause||x}):ot.from(x,x&&x.code,t,b)}})};re.forEach(qb,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const D5=t=>`- ${t}`,cZ=t=>re.isFunction(t)||t===null||t===!1,V5={getAdapter:t=>{t=re.isArray(t)?t:[t];const{length:e}=t;let n,r;const o={};for(let s=0;s<e;s++){n=t[s];let a;if(r=n,!cZ(n)&&(r=qb[(a=String(n)).toLowerCase()],r===void 0))throw new ot(`Unknown adapter '${a}'`);if(r)break;o[a||"#"+s]=r}if(!r){const s=Object.entries(o).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since :
|
|
297
297
|
`+s.map(D5).join(`
|
|
298
298
|
`):" "+D5(s[0]):"as no adapter specified";throw new ot("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:qb};function Kb(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Ml(null,t)}function F5(t){return Kb(t),t.headers=lr.from(t.headers),t.data=Wb.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),V5.getAdapter(t.adapter||yc.adapter)(t).then(function(r){return Kb(t),r.data=Wb.call(t,t.transformResponse,r),r.headers=lr.from(r.headers),r},function(r){return S5(r)||(Kb(t),r&&r.response&&(r.response.data=Wb.call(t,t.transformResponse,r.response),r.response.headers=lr.from(r.response.headers))),Promise.reject(r)})}const $5="1.8.4",Gp={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Gp[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const z5={};Gp.transitional=function(e,n,r){function o(s,a){return"[Axios v"+$5+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,l)=>{if(e===!1)throw new ot(o(a," has been removed"+(n?" in "+n:"")),ot.ERR_DEPRECATED);return n&&!z5[a]&&(z5[a]=!0,console.warn(o(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,a,l):!0}},Gp.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function dZ(t,e,n){if(typeof t!="object")throw new ot("options must be an object",ot.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let o=r.length;for(;o-- >0;){const s=r[o],a=e[s];if(a){const l=t[s],u=l===void 0||a(l,s,t);if(u!==!0)throw new ot("option "+s+" must be "+u,ot.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ot("Unknown option "+s,ot.ERR_BAD_OPTION)}}const Xp={assertOptions:dZ,validators:Gp},jo=Xp.validators;let ga=class{constructor(e){this.defaults=e,this.interceptors={request:new x5,response:new x5}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let o={};Error.captureStackTrace?Error.captureStackTrace(o):o=new Error;const s=o.stack?o.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
299
299
|
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=ma(this.defaults,n);const{transitional:r,paramsSerializer:o,headers:s}=n;r!==void 0&&Xp.assertOptions(r,{silentJSONParsing:jo.transitional(jo.boolean),forcedJSONParsing:jo.transitional(jo.boolean),clarifyTimeoutError:jo.transitional(jo.boolean)},!1),o!=null&&(re.isFunction(o)?n.paramsSerializer={serialize:o}:Xp.assertOptions(o,{encode:jo.function,serialize:jo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Xp.assertOptions(n,{baseUrl:jo.spelling("baseURL"),withXsrfToken:jo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&re.merge(s.common,s[n.method]);s&&re.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),n.headers=lr.concat(a,s);const l=[];let u=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(u=u&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const c=[];this.interceptors.response.forEach(function(y){c.push(y.fulfilled,y.rejected)});let f,p=0,m;if(!u){const b=[F5.bind(this),void 0];for(b.unshift.apply(b,l),b.push.apply(b,c),m=b.length,f=Promise.resolve(n);p<m;)f=f.then(b[p++],b[p++]);return f}m=l.length;let g=n;for(p=0;p<m;){const b=l[p++],y=l[p++];try{g=b(g)}catch(w){y.call(this,w);break}}try{f=F5.call(this,g)}catch(b){return Promise.reject(b)}for(p=0,m=c.length;p<m;)f=f.then(c[p++],c[p++]);return f}getUri(e){e=ma(this.defaults,e);const n=O5(e.baseURL,e.url,e.allowAbsoluteUrls);return w5(n,e.params,e.paramsSerializer)}};re.forEach(["delete","get","head","options"],function(e){ga.prototype[e]=function(n,r){return this.request(ma(r||{},{method:e,url:n,data:(r||{}).data}))}}),re.forEach(["post","put","patch"],function(e){function n(r){return function(s,a,l){return this.request(ma(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}ga.prototype[e]=n(),ga.prototype[e+"Form"]=n(!0)});let fZ=class D_{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(o=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](o);r._listeners=null}),this.promise.then=o=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(o);return a.cancel=function(){r.unsubscribe(s)},a},e(function(s,a,l){r.reason||(r.reason=new Ml(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new D_(function(o){e=o}),cancel:e}}};function pZ(t){return function(n){return t.apply(null,n)}}function hZ(t){return re.isObject(t)&&t.isAxiosError===!0}const Gb={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Gb).forEach(([t,e])=>{Gb[e]=t});function H5(t){const e=new ga(t),n=s5(ga.prototype.request,e);return re.extend(n,ga.prototype,e,{allOwnKeys:!0}),re.extend(n,e,null,{allOwnKeys:!0}),n.create=function(o){return H5(ma(t,o))},n}const on=H5(yc);on.Axios=ga,on.CanceledError=Ml,on.CancelToken=fZ,on.isCancel=S5,on.VERSION=$5,on.toFormData=Up,on.AxiosError=ot,on.Cancel=on.CanceledError,on.all=function(e){return Promise.all(e)},on.spread=pZ,on.isAxiosError=hZ,on.mergeConfig=ma,on.AxiosHeaders=lr,on.formToJSON=t=>E5(re.isHTMLForm(t)?new FormData(t):t),on.getAdapter=V5.getAdapter,on.HttpStatusCode=Gb,on.default=on;const{Axios:_ae,AxiosError:Tae,CanceledError:Aae,isCancel:Oae,CancelToken:Mae,VERSION:Bae,all:Iae,Cancel:Rae,isAxiosError:Lae,spread:Pae,toFormData:Dae,AxiosHeaders:Vae,HttpStatusCode:Fae,formToJSON:$ae,getAdapter:zae,mergeConfig:Hae}=on,mZ=async function(t){let e=[];try{if(this.enabled===!1||t.length===0||t.trim()==="")return e;if(this.limit&&t.length>this.limit)throw new Error("Text is too long");const n=await on.post(this.getApi(),{value:t}),r=this.transfer(n.data);e=(r==null?void 0:r.map(o=>o.errorText))||[],this!=null&&this.setSuggestions&&this.setSuggestions(r)}catch(n){console.error(n)}return e};class U5{constructor({api:e,limit:n,transfer:r,enabled:o}){Xt(this,"suggestions",[]);Xt(this,"api","");Xt(this,"enabled",!0);Xt(this,"limit");Xt(this,"transfer");this.suggestions=[],this.api=e,this.limit=n,this.transfer=r,this.enabled=o??!0}setSuggestions(e){this.suggestions=e}getSuggestions(e){var n;return Promise.resolve(((n=this.suggestions.find(r=>r.errorText.wrongWord===e))==null?void 0:n.spellData.correctWord)??[])}getApi(){return this.api}normalizeTextForLanguage(e){return e}proofreadText(e){return Promise.resolve(mZ.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const gZ=Object.freeze(Object.defineProperty({__proto__:null,AI:OY,BaseKit:NE,Blockquote:yW,Bold:kC,BulletList:cW,Clear:pg,Code:hH,CodeBlock:BU,Color:o8,Columns:wb,FindAndReplace:zY,FontFamily:mE,FontSize:r8,FormatPainter:bb,Fullscreen:sj,Heading:t8,Highlight:iW,History:zg,HorizontalRule:YW,Image:yb,ImageUpload:QE,ImportWord:IY,Indent:lY,Italic:SC,LineHeight:vE,Link:Vg,MoreMark:oY,OrderedList:hW,Preview:RY,Printer:WY,Proofreader:U5,SlashCommand:TY,SpellcheckerExtension:i5,Strike:TC,SubAndSuperScript:tY,Table:Ob,TaskList:bW,TextAlign:n8,Underline:_C,Video:YE,VideoUpload:XE},Symbol.toStringTag,{value:"Module"})),bZ='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend=""false""><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend=""false"">MyMy Editor is open-source document editor based on Vue3 and Tiptap. MyMy Editor provides comprehensive document editing capabilities, supports pagination, supports Markdown syntax, offers basic rich text editing functions, allows for the insertion of various node types in multiple formats, provides a variety of practical tools, and supports setting page styles. It also supports exporting in various formats, printing and print preview, block-level document editing, adding custom extensions, multi-language settings, and a dark theme.</p><h1 id="jm9johtz" extend=""false""><strong>소개(국문)</strong></h1><p id="0qei01hl" extend=""false"">마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.</p><blockquote class="blockquote"><p id="nekf7yi0" extend="false"><span style="color: rgb(115, 209, 61)"><strong><em>Make by VDC</em></strong></span></p></blockquote></page>';function vZ(){const t=window.localStorage.getItem("content"),e=i.ref(t||bZ),n=i.computed(()=>[NE.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:5e4},excludes:{}}),zg,wb,bb,pg,Vg,yb,Ob]),r=ht.useEventBus(ar.RENDER_SUPER_TEXT);function o(s,a){const l={action:"status",payload:{id:s,status:a}};r.emit(l)}return{defaultExtensions:n,content:e,dispatchUpdateStatusSuperText:o}}function yZ(){const t=i.ref(!1);return{hasEverFocused:t,markAsFocused:()=>{t.value=!0},insertHtml:(r,o)=>{const{state:s}=r,{doc:a,selection:l}=s,u=l.$from,c=a.firstChild,f=r.isEmpty;if(!t.value){if(f&&c){r.chain().insertContentAt({from:0,to:c.nodeSize},o).focus().run();return}const m=a.content.size;r.chain().insertContentAt(m,o).focus().run();return}const p=u.parent;if(p.type.name==="paragraph"&&p.textContent.trim().length===0){const m=u.before();r.chain().insertContentAt({from:m,to:m+p.nodeSize},o).focus().run();return}if(u.parentOffset===0&&p.type.name==="paragraph"&&p.content.size>0){const m=u.before();r.chain().insertContentAt(m,o).focus().run();return}r.chain().insertContentAt(r.state.selection,o).focus().run()}}}function xc(t=250){const e=i.ref(!1);let n=null;const r=()=>{e.value=!0,n&&clearTimeout(n),n=setTimeout(()=>{e.value=!1},t)};return i.onUnmounted(()=>{n&&clearTimeout(n)}),{isScrolling:e,handleScroll:r}}const wZ={class:"flex items-center h-[32px] hover:bg-ed-muted rounded-md"},xZ={class:"text-sm flex items-center justify-center"},CZ={width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},EZ={id:"icon/填充色",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},kZ={id:"icon/背景颜色"},SZ=["fill"],W5=i.defineComponent({__name:"HighlightActionButton",props:{editor:{},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},tooltipOptions:{default:void 0}},setup(t){const e=t,n=i.ref(void 0),{state:r}=wn();function o(a){var l;(l=e.action)==null||l.call(e,a)}function s(a){var l;(l=e.action)==null||l.call(e,n.value)}return i.watchEffect(()=>{const{color:a}=e.editor.getAttributes("highlight");r.highlight=a}),(a,l)=>(i.openBlock(),i.createElementBlock("div",wZ,[i.createVNode(Ke,{id:"highlight",tooltip:a.tooltip,disabled:a.disabled,action:s,"tooltip-options":a.tooltipOptions},{icon:i.withCtx(()=>[i.createElementVNode("span",xZ,[(i.openBlock(),i.createElementBlock("svg",CZ,[i.createElementVNode("g",EZ,[i.createElementVNode("g",kZ,[l[1]||(l[1]=i.createElementVNode("g",{id:"编组",fill:"currentColor"},[i.createElementVNode("g",{id:"矩形",transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)"},[i.createElementVNode("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z","fill-rule":"nonzero"}),i.createElementVNode("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z","fill-rule":"evenodd"}),i.createElementVNode("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z","fill-rule":"nonzero"})])],-1)),i.createElementVNode("path",{id:"矩形",d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:n.value||"#FBDE28"},null,8,SZ)])])]))])]),_:1},8,["tooltip","disabled","tooltip-options"]),i.createVNode(gC,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=u=>n.value=u),highlight:"",disabled:a.disabled,onChange:o},{default:i.withCtx(()=>[i.createVNode(i.unref(yn),{variant:"ghost",size:"icon",class:"w-3 h-[32px] rounded-l-none hover:bg-ed-muted-foreground/20",disabled:a.disabled},{default:i.withCtx(()=>[i.createVNode(i.unref(Lt),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"])]))}}),_Z={class:"h-full w-fit min-w-32 flex items-center leading-none gap-0.5 p-2 bg-ed-background rounded-lg shadow-sm border border-ed-border"},Yp=i.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:w})=>{var x;return w.isActive("table")&&(((x=w.storage.table)==null?void 0:x.isTableEditorOpen)??!1)},{t:o}=Ot();function s(){e.editor.chain().focus().addColumnBefore().run()}function a(){e.editor.chain().focus().addColumnAfter().run()}function l(){e.editor.chain().focus().deleteColumn().run()}function u(){e.editor.chain().focus().addRowBefore().run()}function c(){e.editor.chain().focus().addRowAfter().run()}function f(){e.editor.chain().focus().deleteRow().run()}function p(){e.editor.chain().focus().mergeCells().run()}function m(){var w;(w=e.editor)==null||w.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function b(w){e.editor.chain().focus().setTableCellBackground(w).run()}const y=()=>{const w=document.querySelector(".vdc-editor");if(!w)return new DOMRect(-1e3,-1e3,0,0);const x=w.getBoundingClientRect();return new DOMRect(x.left,x.top+10,x.width,0)};return(w,x)=>(i.openBlock(),i.createBlock(i.unref(Su),{editor:w.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:y,appendTo:n}},{default:i.withCtx(()=>{var E,k,C,_,A,T,P,I,M;return[i.createElementVNode("div",_Z,[i.createVNode(Ke,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:i.unref(o)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!((E=w.editor)!=null&&E.can().addColumnBefore())},null,8,["tooltip","disabled"]),i.createVNode(Ke,{icon:"TablerColumnInsertRight",tooltip:i.unref(o)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!((k=w.editor)!=null&&k.can().addColumnAfter())},null,8,["tooltip","disabled"]),i.createVNode(Ke,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:i.unref(o)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!((C=w.editor)!=null&&C.can().deleteColumn())},null,8,["tooltip","disabled"]),i.createVNode(i.unref(ci),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),i.createVNode(Ke,{icon:"TablerRowInsertTop",action:u,"icon-class":"w-5 h-5",tooltip:i.unref(o)("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!((_=w.editor)!=null&&_.can().addRowBefore())},null,8,["tooltip","disabled"]),i.createVNode(Ke,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:i.unref(o)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!((A=w.editor)!=null&&A.can().addRowAfter())},null,8,["tooltip","disabled"]),i.createVNode(Ke,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:i.unref(o)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!((T=w.editor)!=null&&T.can().deleteRow())},null,8,["tooltip","disabled"]),i.createVNode(i.unref(ci),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),i.createVNode(Ke,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:i.unref(o)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!((P=w.editor)!=null&&P.can().mergeCells())},null,8,["tooltip","disabled"]),i.createVNode(Ke,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:i.unref(o)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((I=w.editor)!=null&&I.can().splitCell())},null,8,["tooltip","disabled"]),i.createVNode(i.unref(ci),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),i.createVNode(W5,{editor:w.editor,tooltip:i.unref(o)("editor.table.menu.setCellsBgColor"),action:b,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),i.createVNode(Ke,{icon:"Trash2",tooltip:i.unref(o)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!((M=w.editor)!=null&&M.can().deleteTable())},null,8,["tooltip","disabled"])])]}),_:1},8,["editor","tippy-options"]))}}),TZ={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},AZ={class:"flex items-center gap-1"},Jp=i.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>t0(l.view.state,"columns"),r=()=>{const l=mC(e.editor,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},o=()=>{e.editor.chain().focus().setLayout(ca.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(ca.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(ca.TwoColumn).run()};return(l,u)=>(i.openBlock(),i.createBlock(i.unref(Su),{editor:l.editor,"plugin-key":"columns","should-show":n,"update-delay":0,"tippy-options":{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,plugins:[i.unref(OB)],sticky:"popper"}},{default:i.withCtx(()=>[i.createElementVNode("div",TZ,[i.createElementVNode("div",AZ,[i.createVNode(Ke,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:o,"is-active":()=>l.editor.isActive("columns",{layout:i.unref(ca).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),i.createVNode(Ke,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:i.unref(ca).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),i.createVNode(Ke,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:i.unref(ca).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),OZ={class:"flex items-center gap-2 p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},MZ=["href"],BZ={class:"flex flex-nowrap"},IZ=i.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=Ot(),r=e;function o(){r("clear")}function s(){r("edit")}return(a,l)=>(i.openBlock(),i.createElementBlock("div",OZ,[i.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},i.toDisplayString(i.unref(rt.truncate)(a.link,{length:50,omission:"…"})),9,MZ),a.link?(i.openBlock(),i.createBlock(i.unref(ci),{key:0,orientation:"vertical",class:"h-4"})):i.createCommentVNode("",!0),i.createElementVNode("div",BZ,[i.createVNode(Ke,{icon:"Pencil",tooltip:i.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),i.createVNode(Ke,{icon:"Unlink",tooltip:i.unref(n)("editor.link.unlink.tooltip"),action:o,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),Zp=i.defineComponent({__name:"LinkBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=i.ref(!1),r=i.ref(),o={width:-2,height:16},s=i.computed(()=>{const{href:f}=e.editor.getAttributes("link");return f}),a=i.computed(()=>e.editor.isActive("link")),l=i.computed(()=>{var y;if(!n.value)return{};const f=e.editor.state.selection,p=e.editor.view.coordsAtPos(f.from),m=(y=r.value)==null?void 0:y.getBoundingClientRect(),g=p.left+((m==null?void 0:m.width)??0)+o.width>window.innerWidth,b=p.top+((m==null?void 0:m.height)??0)+o.height>window.innerHeight;return g||b?{left:g?`${p.left-((m==null?void 0:m.width)??0)-o.width}px`:`${p.left}px`,top:b?`${p.top-((m==null?void 0:m.height)??0)-o.height}px`:`${p.top}px`}:{left:`${p.left}px`,top:`${p.bottom+o.height}px`}});function u(f,p,m){e.editor.chain().extendMarkRange("link").insertContent({type:"text",text:p,marks:[{type:"link",attrs:{href:f,target:m?"_blank":""}}]}).setLink({href:f}).focus().run(),n.value=!1}function c(){e.editor.chain().extendMarkRange("link").unsetLink().focus().run(),n.value=!1}return(f,p)=>i.withDirectives((i.openBlock(),i.createBlock(i.unref(Su),{editor:f.editor,"update-delay":0,"tippy-options":{popperOptions:{modifiers:[{name:"flip",enabled:!0}]},appendTo:"parent",placement:"bottom-start",offset:[o.width,o.height],zIndex:9999,onHidden:()=>{n.value=!1}}},{default:i.withCtx(()=>[n.value?(i.openBlock(),i.createBlock(i.Teleport,{key:0,to:"#vdc-editor"},[i.createElementVNode("div",{ref_key:"editFormRef",ref:r,class:"fixed z-50",style:i.normalizeStyle(l.value)},[i.createVNode(T8,{class:"p-4",editor:f.editor,onOnSetLink:u},null,8,["editor"])],4)])):i.createCommentVNode("",!0),n.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(IZ,{key:1,editor:f.editor,link:s.value,onClear:c,onEdit:p[0]||(p[0]=m=>n.value=!0)},null,8,["editor","link"]))]),_:1},8,["editor","tippy-options"])),[[i.vShow,a.value]])}}),Xb=i.defineComponent({__name:"Badge",props:{variant:{},class:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(ke)(i.unref(RZ)({variant:e.variant}),e.class))},[i.renderSlot(n.$slots,"default")],2))}}),RZ=W1("inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-ed-primary text-ed-primary-foreground hover:bg-ed-primary/80",secondary:"border-transparent bg-ed-secondary text-ed-secondary-foreground hover:bg-ed-secondary/80",destructive:"border-transparent bg-ed-destructive text-ed-destructive-foreground hover:bg-ed-destructive/80",outline:"text-ed-foreground"}},defaultVariants:{variant:"default"}}),j5=(t,e,n,r,o)=>{const s=i.ref(0),a=ht.useEventBus(ar.RENDER_SUPER_TEXT),l=_=>{if(!e.value||!t)return;const A=e.value.index,T=e.value.id,{state:P}=t,{tr:I}=P;let M=!1;P.doc.descendants((j,U)=>{var q,le;if(((q=j.attrs)==null?void 0:q[Qe.ID])===T){(le=j.attrs[Qe.TEXT])!=null&&le.trim();const H=_.trim();if(Mp(H))return I.delete(U,U+1),M=!0,!1;const{[Qe.ELEMENT_ID]:F,...L}=j.attrs;return I.setNodeMarkup(U,void 0,{...L,[Qe.TEXT]:H}),M=!0,!1}return!0}),M&&t&&t.view.dispatch(I),A!==-1&&(n.value[A].text=_,n.value[A].textOriginal=_)},u=i.ref(new Map),c=()=>{if(!(t!=null&&t.view.dom))return[];const _=[],A=t==null?void 0:t.view.dom.querySelectorAll("[node-id]"),T=new Map;return u.value.clear(),A.forEach(P=>{const I=P.getBoundingClientRect().top;T.set(I,P),u.value.set(P.getAttribute("node-id")||"unknown",0)}),_.push(...T.values()),_},f=_=>{const A=_.closest(`#${r}`);if(!A)return;const T=A.getBoundingClientRect().top,P=A==null?void 0:A.scrollTop;return _.getBoundingClientRect().top-(T-P)},p=(_,A)=>{const T=n.value.findIndex(P=>P.id===_);T>-1&&(n.value[T].status=A)},m=_=>_.replace(/<p><\/p>/g,"<p> </p>"),g=()=>{if(!n.value||n.value.length===0){s.value=0,u.value.clear();return}if(!o.value||o.value.length===0)return;const _=o.value,A=new Set(n.value.map(I=>I.id)),T=_.map(I=>({isHidden:I.classList.contains("hidden"),isTruncated:I.classList.contains("super-text-truncate")}));_.forEach(I=>{I.classList.remove("hidden"),I.classList.remove("super-text-truncate")});for(const I of u.value.keys())A.has(I)||u.value.delete(I);_.forEach(I=>{const M=I.getAttribute("book-mark-id");if(!M)return;const j=I.offsetTop+I.offsetHeight,U=u.value.get(M)||0;u.value.set(M,Math.max(j,U))}),_.forEach((I,M)=>{T[M].isHidden&&I.classList.add("hidden"),T[M].isTruncated&&I.classList.add("super-text-truncate")});let P=0;for(const I of u.value.values())I>P&&(P=I);s.value=P},b=async()=>{await i.nextTick();const A=c().map(T=>{const P=T.getAttribute("node-id"),I=T.getAttribute("book-mark-content"),M=T.getAttribute("page-id"),j=T.getAttribute("page-number"),U=T.getBoundingClientRect(),q=T.getAttribute("line-id"),le=T.getAttribute("element-id");return{position:U,text:m(I),id:P,pageId:M,pageNumber:j,visiblePosition:f(T),status:0,lineId:q,elementId:le,textOriginal:m(I)}});n.value=A},y=(_,A)=>{const T=_.bottom<=A.top,P=_.top>=A.bottom;return!(T||P)};async function w(){const _=o.value;if(!_||_.length===0){g();return}_.sort((A,T)=>{const P=Number(A.getAttribute("index")),I=Number(T.getAttribute("index"));return P-I}),_.forEach(A=>A.classList.remove("super-text-truncate")),_.forEach((A,T)=>{const P=A.getBoundingClientRect();_.slice(T+1).forEach(I=>{const M=I.getBoundingClientRect();y(P,M)&&A.classList.add("super-text-truncate")})}),g()}const x=async _=>{await i.nextTick();const A=t==null?void 0:t.view.dom.querySelector(`[node-id='${_.dataId}']`),T=o.value.find(M=>{const j=M.getBoundingClientRect().top,U=A==null?void 0:A.getBoundingClientRect().top;if(U==null)return!1;const q=U-j;return Math.abs(q-9)<=2});if(!T)return;const P=Number(T.getAttribute("index"));if(!_.text){T.querySelector(".super-text-lines").innerHTML=n.value[P].textOriginal,o.value.forEach(M=>M.classList.remove("hidden")),w();return}T.querySelector(".super-text-lines").innerHTML=m(_.text),T.classList.remove("super-text-truncate");const I=T.getBoundingClientRect();o.value.forEach((M,j)=>{if(j!==P){const U=M.getBoundingClientRect();y(I,U)&&M.classList.add("hidden")}}),g()},E=_=>{switch(_.action){case"hover":x(_.payload);break;case"status":p(_.payload.id,_.payload.status);break;case"render":b();break;default:console.log("There is no action")}},k=(_,A)=>{const T=_.currentTarget;T.classList.remove("super-text-truncate");const P=T.getBoundingClientRect();o.value.forEach((I,M)=>{if(M!==A){const j=I.getBoundingClientRect();y(P,j)&&I.classList.add("hidden")}}),g()},C=()=>{o.value.forEach(_=>_.classList.remove("hidden")),w()};return i.onBeforeMount(()=>{a.on(E),window.addEventListener("resize",b)}),i.onBeforeUnmount(()=>{a.off(E),window.removeEventListener("resize",b)}),i.watch(()=>n,async()=>{await i.nextTick(),w()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:w,eventListener:E,handleMouseOver:k,handleMouseLeave:C,wrapperMinHeight:s}},LZ=["index","book-mark-id","line-id","onMouseover"],PZ=["innerHTML"],DZ=Bo(i.defineComponent({__name:"SuperTextView",props:{editor:{},superPreviewCustomClass:{},minChars:{},fontSize:{}},setup(t,{expose:e}){const n=t,r=i.ref([]),o=i.ref([]),s=i.ref(!1),a=i.ref(!1),l=i.ref(null),u=i.inject("isMobile",!1),c=i.inject("canEditSuper",i.ref(!0)),{onUpdate:f,handleMouseOver:p,handleMouseLeave:m,wrapperMinHeight:g}=j5(n.editor,l,o,"editor-container",r),b=(k,C)=>{c.value&&(l.value={id:k.id,text:k.text,elementId:k.elementId,index:C},s.value=!0,u&&(a.value=!0))},y=k=>{var C,_;return $c(k?((C=n.superPreviewCustomClass)==null?void 0:C.completedSuper)??"bg-black":((_=n.superPreviewCustomClass)==null?void 0:_.unproducedSuper)??"bg-red-500")},w=i.computed(()=>n.fontSize??""),{contentInner:x,measuredMinWidth:E}=Vd({minChars:n.minChars,fontSize:w});return e({measuredMinWidthComment:E}),(k,C)=>{var A;const _=Lt;return i.openBlock(),i.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:x,style:i.normalizeStyle({width:`${Number(i.unref(E))+25}px`,minHeight:`${i.unref(g)}px`}),class:i.normalizeClass(i.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((A=k.superPreviewCustomClass)==null?void 0:A.overall)??"bg-ed-gray-50"))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(T,P)=>{var I,M,j;return i.openBlock(),i.createElementBlock("div",{key:T.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:P,"book-mark-id":T.id,"line-id":T.lineId,class:i.normalizeClass(i.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:i.normalizeStyle({top:`${T.visiblePosition||((I=T.position)==null?void 0:I.top)}px`}),onMouseover:U=>i.unref(p)(U,P),onMouseleave:C[0]||(C[0]=(...U)=>i.unref(m)&&i.unref(m)(...U))},[i.createVNode(i.unref(Xb),{role:"text",variant:"outline",class:i.normalizeClass(i.unref(ke)("wrap-anywhere whitespace-normal w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",T.elementId?((M=k.superPreviewCustomClass)==null?void 0:M.completedSuper)??"bg-black":((j=k.superPreviewCustomClass)==null?void 0:j.unproducedSuper)??"bg-red-500",{"cursor-default":!i.unref(c)})),onDblclick:U=>b(T,P)},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"super-text-lines",innerHTML:T.text},null,8,PZ),i.createVNode(_,{name:"triangle",class:i.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",y(T.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,LZ)}),128)),!i.unref(u)&&l.value?(i.openBlock(),i.createBlock(pc,{key:0,open:s.value,editor:n.editor,"super-text-init":l.value.text,"super-text-element-id":l.value.elementId,onClose:C[1]||(C[1]=T=>s.value=!1),onSave:i.unref(f)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):i.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-18e941f3"]]),VZ=["index","book-mark-id","line-id","onMouseover"],FZ=["innerHTML"],$Z=Bo(i.defineComponent({__name:"SuperTextViewComment",props:{editor:{},disableSuperInput:{type:Boolean},superPreviewCustomClass:{}},setup(t){const e=t,n=i.ref([]),r=i.ref([]),o=i.ref(!1),s=i.ref(!1),a=i.ref(null),l=i.inject("isMobile",!1),u=i.inject("isEditable",i.ref(!0)),{onUpdate:c,handleMouseOver:f,handleMouseLeave:p,wrapperMinHeight:m}=j5(e.editor,a,r,"editor-container-comment",n),g=(w,x)=>{u.value&&(a.value={id:w.id,text:w.text,elementId:w.elementId,index:x},e.disableSuperInput||(o.value=!0),l&&(s.value=!0))},b=w=>{var x,E;return $c(w?((x=e.superPreviewCustomClass)==null?void 0:x.completedSuper)??"bg-black":((E=e.superPreviewCustomClass)==null?void 0:E.unproducedSuper)??"bg-red-500")},y=i.inject("measuredMinWidthComment",0);return(w,x)=>{var k;const E=Lt;return i.openBlock(),i.createElementBlock("div",{id:"super-text-view-wrapper",style:i.normalizeStyle({width:`${Number(i.unref(y))+25}px`,minHeight:`${i.unref(m)}px`}),class:i.normalizeClass(i.unref(ke)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((k=w.superPreviewCustomClass)==null?void 0:k.overall)??"bg-ed-gray-50"))},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(C,_)=>{var A,T,P;return i.openBlock(),i.createElementBlock("div",{key:C.id,ref_for:!0,ref_key:"superTextRefs",ref:n,index:_,"book-mark-id":C.id,"line-id":C.lineId,class:i.normalizeClass(i.unref(ke)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:i.normalizeStyle({top:`${C.visiblePosition||((A=C.position)==null?void 0:A.top)}px`}),onMouseover:I=>i.unref(f)(I,_),onMouseleave:x[0]||(x[0]=(...I)=>i.unref(p)&&i.unref(p)(...I))},[i.createVNode(i.unref(Xb),{role:"text",variant:"outline",class:i.normalizeClass(i.unref(ke)("wrap-anywhere whitespace-normal w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",C.elementId?((T=w.superPreviewCustomClass)==null?void 0:T.completedSuper)??"bg-black":((P=w.superPreviewCustomClass)==null?void 0:P.unproducedSuper)??"bg-red-500",{"cursor-default":!i.unref(u)})),onDblclick:I=>g(C,_)},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"super-text-lines",innerHTML:C.text},null,8,FZ),i.createVNode(E,{name:"triangle",class:i.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",b(C.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,VZ)}),128)),!i.unref(l)&&a.value&&!w.disableSuperInput?(i.openBlock(),i.createBlock(pc,{key:0,open:o.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:x[1]||(x[1]=C=>o.value=!1),onSave:i.unref(c)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):i.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-9e49a79c"]]),q5=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
|
|
300
|
-
`).split(/\r?\n/),o=[];for(const a of r){const l=a.trim();if(l==="")o.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();o.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();o.push(`<p>${u}</p>`)}else/^<(?!p\b)[^>]+>/i.test(l)?o.push(`<p>${l}</p>`):o.push(l)}let s=o.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},zZ=wn(),Qp=t=>{const e=i.computed(()=>zZ.state.spellCheck);i.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Hn.IS_ACTIVE_SPELLCHECK,n))},{immediate:!0})},HZ={id:"editor-container-comment",class:"flex flex-col"},UZ={class:"flex flex-1"},WZ={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},jZ=i.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=ht.useEventBus(ar.RENDER_SUPER_TEXT),a=i.useAttrs(),l=wn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g}=l,b=i.inject("isEditable",i.ref(!0)),y=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled),editorProps:{attributes:{id:or.COMMENT,[or.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:rt.throttle((C,_)=>_.key==="Enter"&&a.enter&&!_.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:C=>q5(C),handlePaste:(C,_)=>{const A=_.clipboardData;if(!A)return!1;const T=r.mode,P=A.getData("text/plain")||"",I=Array.from(A.items).some(M=>M.type.startsWith("image/"));return(T===Ve.STRAIGHT||T===Ve.REPORT)&&I?(_.preventDefault(),!0):T===Ve.PLAIN_TEXT?(_.preventDefault(),C.dispatch(C.state.tr.insertText(P,C.state.selection.from)),!0):!1},clipboardTextParser:(C,_)=>{const A=C.split(/(?:\r\n?|\n)/),T=[];A.forEach(I=>{let M={type:"paragraph"};I.length>0&&(M.content=[{type:"text",text:I}]);let j=eo.fromJSON(_.doc.type.schema,M);T.push(j)});const P=de.fromArray(T);return Ce.maxOpen(P)}},onCreate:({editor:C})=>{f(C)},onUpdate:rt.throttle(({editor:C})=>{u.value=!0;const _=x(C,r.output);o("update:modelValue",_),o("change",{editor:C,output:_}),f(C),w()},Mo),extensions:r.extensions,editable:b.value,onFocus:()=>{g(E.value)}});i.computed(()=>r.mode===Ve.EDITOR);async function w(){await i.nextTick(),s.emit({action:"render"})}function x(C,_){if(!C)return"";if(C.isEmpty)return _==="json"?{}:"";switch(_){case"html":return C.getHTML();case"json":return C.getJSON();case"text":return C.getText();default:return""}}i.watch(()=>r.disableSuperInput,()=>{const C=document.getElementById(or.COMMENT);C==null||C.setAttribute(or.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),i.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),i.watch(()=>r.modelValue,C=>{if(!y||rt.isEqual(x(y,r.output),C))return;const{from:_,to:A}=y.state.selection;y.commands.setTextSelection({from:_,to:A}),y.commands.setContent(Vn(C,r.disabled),!1),w()},{deep:!0}),i.watch(()=>b.value,C=>{var _;y==null||y.setEditable(C),(_=y==null?void 0:y.commands)!=null&&_.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(C)},{immediate:!0}),i.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:C})=>{o("changed:selection",{editor:C})})}),i.onUnmounted(()=>y==null?void 0:y.destroy()),Ju(_u.SAVE,()=>{localStorage.setItem("comment",x(y,"html"))});const E=i.ref(null);function k(C){C===Ve.REPORT&&g(E.value)}return i.onMounted(()=>{k(r.mode)}),i.watch(()=>r.mode,C=>{k(C)}),Qp(y),e({editor:y}),(C,_)=>(i.openBlock(),i.createElementBlock("div",HZ,[i.createElementVNode("div",UZ,[i.withDirectives(i.createVNode($Z,{"disable-super-input":C.disableSuperInput,editor:i.unref(y),"super-preview-custom-class":C.superPreviewCustomClass},null,8,["disable-super-input","editor","super-preview-custom-class"]),[[i.vShow,C.isOpenSuperView]]),i.createElementVNode("div",WZ,[i.createVNode(gb,{ref_key:"selectContextMenuRef",ref:E,"disable-super-input":C.disableSuperInput,editor:i.unref(y),mode:C.mode,"super-text-store":i.unref(p)},{default:i.withCtx(()=>[i.createVNode(i.unref(Ao),{editor:i.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function qZ(t,e,n=!1,r=200){const{height:o}=ht.useElementSize(t),s=i.ref(0),a=i.ref(0),l=i.ref(r),u=i.ref(0),c=async()=>{await i.nextTick();const f=o.value-8;e.value===Ve.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":o.value)};return n||i.watch(()=>o.value,c),i.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}const KZ={class:"flex flex-1"},Np=i.defineComponent({__name:"CoreEditorV2",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},titleBarComment:{},titleBarContent:{},fieldNameComment:{default:null},fieldNameCommentCuesheet:{default:null},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean,default:!1},textAlert:{},toolBarClass:{default:void 0},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean,default:!1},autoFocus:{type:Boolean},superPreviewCustomClass:{default:()=>({overall:"bg-ed-gray-50",unproducedSuper:"bg-red-500",completedSuper:"bg-black"})},minChar:{default:()=>({superPreview:29,content:26})},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=ht.useEventBus(ar.RENDER_SUPER_TEXT),a=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE),l=i.useAttrs(),u=wn(),{state:c,isFullscreen:f,isReady:p,editor:m,updateEditorState:g,superTextStore:b,checkSpellStore:y,setEditorContextMenuRef:w}=u,x=i.computed(()=>!(r.disabled||r.readonly));i.provide("isEditable",x);const E=i.computed(()=>x.value?!0:r.canEditSuperReadOnly);i.provide("canEditSuper",E);const k=i.computed(()=>[...c.extensions,...rt.differenceBy(r.extensions,c.extensions,"name")].map((ve,Me)=>{var Ue;return((Ue=ve.configure)==null?void 0:Ue.call(ve,{sort:Me}))||ve})),C=i.computed(()=>r.mode===Ve.EDITOR),_=i.ref(r.fontSizeDefault),A=i.ref(r.fontFamilyDefault);i.provide("fontSize",_),i.provide("fontFamily",A);const T=i.computed(()=>{const N={height:"auto",minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,overflowY:"auto"};return C.value&&!r.autoHeight?{}:C.value&&r.autoHeight?N:!C.value&&r.autoHeight?{...N,fontFamily:A.value,fontSize:_.value}:{fontFamily:A.value,fontSize:_.value}});i.watch(()=>[T.value,r.disabled],async()=>{L()}),i.onMounted(()=>{L()});const P=N=>{const ve=parseInt(_.value||"16px"),Me=N?ve+2:ve-2;_.value=Me+"px"};i.onBeforeMount(()=>{r.disabled||a.on(P)}),i.onBeforeUnmount(()=>{r.disabled||a.off(P)});const I=i.computed(()=>({...i.unref(f)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),M=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:rt.throttle((N,ve)=>ve.key==="Enter"&&l.enter&&!ve.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:N=>q5(N),handlePaste:(N,ve)=>{const Me=ve.clipboardData;if(!Me)return!1;const Ue=r.mode,mt=Array.from(Me.items),Et=mt.some(V=>V.type.startsWith("image/")),z=mt.some(V=>V.type.startsWith("video/"));return(Ue===Ve.STRAIGHT||Ue===Ve.REPORT)&&(Et||z)?(ve.preventDefault(),!0):z?(ve.preventDefault(),J(["video"])&&mt.forEach(async V=>{var ze;if(!V.type.startsWith("video/"))return;const se=V.getAsFile();if(!se)return;const ge=M.extensionManager.extensions.find(D=>D.name==="video"),Re=(ze=ge==null?void 0:ge.options)==null?void 0:ze.upload,Ne=Re?await Re(se):URL.createObjectURL(se);M.commands.focus(),M.commands.setVideo({src:Ne})}),!0):!1},clipboardTextParser:(N,ve)=>{const Me=N.split(/(?:\r\n?|\n)/),Ue=[];Me.forEach(Et=>{let z={type:"paragraph"};Et.length>0&&(z.content=[{type:"text",text:Et}]);let V=eo.fromJSON(ve.doc.type.schema,z);Ue.push(V)});const mt=de.fromArray(Ue);return Ce.maxOpen(mt)}},onCreate:({editor:N})=>{g(N)},onUpdate:rt.throttle(({editor:N})=>{p.value=!0;const ve=K(N,r.output);o("update:modelValue",ve),o("change",{editor:N,output:ve}),g(N),L(),q()},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(k)),"name"),editable:x.value,onFocus:N=>{w(Q.value),o("onFocus",N)},onBlur:N=>o("onBlur",N),parseOptions:{preserveWhitespace:"full"}});i.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:j,measuredMinWidth:U,measure:q}=Vd({minChars:r.minChar.content,fontSize:_,editor:M}),le=i.ref(null),H=i.computed(()=>{var N;return(N=le.value)==null?void 0:N.measuredMinWidthComment});i.provide("measuredMinWidthComment",H);const F=i.computed(()=>C.value?0:Y.value?Number(U==null?void 0:U.value)+Number(H==null?void 0:H.value)+30:Number(U==null?void 0:U.value));async function L(){await i.nextTick(),s.emit({action:"render"})}function K(N,ve){if(!N)return"";if(N.isEmpty)return ve==="json"?{}:"";if(r.mode===Ve.PLAIN_TEXT)return N.getText({blockSeparator:`
|
|
300
|
+
`).split(/\r?\n/),o=[];for(const a of r){const l=a.trim();if(l==="")o.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();o.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();o.push(`<p>${u}</p>`)}else/^<(?!p\b)[^>]+>/i.test(l)?o.push(`<p>${l}</p>`):o.push(l)}let s=o.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},zZ=wn(),Qp=t=>{const e=i.computed(()=>zZ.state.spellCheck);i.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(Hn.IS_ACTIVE_SPELLCHECK,n))},{immediate:!0})},HZ={id:"editor-container-comment",class:"flex flex-col"},UZ={class:"flex flex-1"},WZ={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},jZ=i.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=ht.useEventBus(ar.RENDER_SUPER_TEXT),a=i.useAttrs(),l=wn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g}=l,b=i.inject("isEditable",i.ref(!0)),y=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled),editorProps:{attributes:{id:or.COMMENT,[or.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:rt.throttle((C,_)=>_.key==="Enter"&&a.enter&&!_.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:C=>q5(C),handlePaste:(C,_)=>{const A=_.clipboardData;if(!A)return!1;const T=r.mode,P=A.getData("text/plain")||"",I=Array.from(A.items).some(M=>M.type.startsWith("image/"));return(T===De.STRAIGHT||T===De.REPORT)&&I?(_.preventDefault(),!0):T===De.PLAIN_TEXT?(_.preventDefault(),C.dispatch(C.state.tr.insertText(P,C.state.selection.from)),!0):!1},clipboardTextParser:(C,_)=>{const A=C.split(/(?:\r\n?|\n)/),T=[];A.forEach(I=>{let M={type:"paragraph"};I.length>0&&(M.content=[{type:"text",text:I}]);let j=eo.fromJSON(_.doc.type.schema,M);T.push(j)});const P=de.fromArray(T);return Ce.maxOpen(P)}},onCreate:({editor:C})=>{f(C)},onUpdate:rt.throttle(({editor:C})=>{u.value=!0;const _=x(C,r.output);o("update:modelValue",_),o("change",{editor:C,output:_}),f(C),w()},Mo),extensions:r.extensions,editable:b.value,onFocus:()=>{g(E.value)}});i.computed(()=>r.mode===De.EDITOR);async function w(){await i.nextTick(),s.emit({action:"render"})}function x(C,_){if(!C)return"";if(C.isEmpty)return _==="json"?{}:"";switch(_){case"html":return C.getHTML();case"json":return C.getJSON();case"text":return C.getText();default:return""}}i.watch(()=>r.disableSuperInput,()=>{const C=document.getElementById(or.COMMENT);C==null||C.setAttribute(or.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),i.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),i.watch(()=>r.modelValue,C=>{if(!y||rt.isEqual(x(y,r.output),C))return;const{from:_,to:A}=y.state.selection;y.commands.setTextSelection({from:_,to:A}),y.commands.setContent(Vn(C,r.disabled),!1),w()},{deep:!0}),i.watch(()=>b.value,C=>{var _;y==null||y.setEditable(C),(_=y==null?void 0:y.commands)!=null&&_.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(C)},{immediate:!0}),i.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:C})=>{o("changed:selection",{editor:C})})}),i.onUnmounted(()=>y==null?void 0:y.destroy()),Ju(_u.SAVE,()=>{localStorage.setItem("comment",x(y,"html"))});const E=i.ref(null);function k(C){C===De.REPORT&&g(E.value)}return i.onMounted(()=>{k(r.mode)}),i.watch(()=>r.mode,C=>{k(C)}),Qp(y),e({editor:y}),(C,_)=>(i.openBlock(),i.createElementBlock("div",HZ,[i.createElementVNode("div",UZ,[i.withDirectives(i.createVNode($Z,{"disable-super-input":C.disableSuperInput,editor:i.unref(y),"super-preview-custom-class":C.superPreviewCustomClass},null,8,["disable-super-input","editor","super-preview-custom-class"]),[[i.vShow,C.isOpenSuperView]]),i.createElementVNode("div",WZ,[i.createVNode(gb,{ref_key:"selectContextMenuRef",ref:E,"disable-super-input":C.disableSuperInput,editor:i.unref(y),mode:C.mode,"super-text-store":i.unref(p)},{default:i.withCtx(()=>[i.createVNode(i.unref(Ao),{editor:i.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function qZ(t,e,n=!1,r=200){const{height:o}=ht.useElementSize(t),s=i.ref(0),a=i.ref(0),l=i.ref(r),u=i.ref(0),c=async()=>{await i.nextTick();const f=o.value-8;e.value===De.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":o.value)};return n||i.watch(()=>o.value,c),i.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}const KZ={class:"flex flex-1"},Np=i.defineComponent({__name:"CoreEditorV2",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{default:null},fieldNameCommentCuesheet:{default:null},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean,default:!1},textAlert:{},toolBarClass:{default:void 0},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean,default:!1},autoFocus:{type:Boolean},superPreviewCustomClass:{default:()=>({overall:"bg-ed-gray-50",unproducedSuper:"bg-red-500",completedSuper:"bg-black"})},minChar:{default:()=>({superPreview:29,content:26})},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=ht.useEventBus(ar.RENDER_SUPER_TEXT),a=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE),l=i.useAttrs(),u=wn(),{state:c,isFullscreen:f,isReady:p,editor:m,updateEditorState:g,superTextStore:b,checkSpellStore:y,setEditorContextMenuRef:w}=u,x=i.computed(()=>!(r.disabled||r.readonly));i.provide("isEditable",x);const E=i.computed(()=>x.value?!0:r.canEditSuperReadOnly);i.provide("canEditSuper",E);const k=i.computed(()=>[...c.extensions,...rt.differenceBy(r.extensions,c.extensions,"name")].map((ve,Me)=>{var Ue;return((Ue=ve.configure)==null?void 0:Ue.call(ve,{sort:Me}))||ve})),C=i.computed(()=>r.mode===De.EDITOR),_=i.ref(r.fontSizeDefault),A=i.ref(r.fontFamilyDefault);i.provide("fontSize",_),i.provide("fontFamily",A);const T=i.computed(()=>{const N={height:"auto",minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,overflowY:"auto"};return C.value&&!r.autoHeight?{}:C.value&&r.autoHeight?N:!C.value&&r.autoHeight?{...N,fontFamily:A.value,fontSize:_.value}:{fontFamily:A.value,fontSize:_.value}});i.watch(()=>[T.value,r.disabled],async()=>{L()}),i.onMounted(()=>{L()});const P=N=>{const ve=parseInt(_.value||"16px"),Me=N?ve+2:ve-2;_.value=Me+"px"};i.onBeforeMount(()=>{r.disabled||a.on(P)}),i.onBeforeUnmount(()=>{r.disabled||a.off(P)});const I=i.computed(()=>({...i.unref(f)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),M=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:rt.throttle((N,ve)=>ve.key==="Enter"&&l.enter&&!ve.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:N=>q5(N),handlePaste:(N,ve)=>{const Me=ve.clipboardData;if(!Me)return!1;const Ue=r.mode,mt=Array.from(Me.items),Et=mt.some(V=>V.type.startsWith("image/")),z=mt.some(V=>V.type.startsWith("video/"));return(Ue===De.STRAIGHT||Ue===De.REPORT)&&(Et||z)?(ve.preventDefault(),!0):z?(ve.preventDefault(),J(["video"])&&mt.forEach(async V=>{var ze;if(!V.type.startsWith("video/"))return;const se=V.getAsFile();if(!se)return;const ge=M.extensionManager.extensions.find(D=>D.name==="video"),Re=(ze=ge==null?void 0:ge.options)==null?void 0:ze.upload,Ne=Re?await Re(se):URL.createObjectURL(se);M.commands.focus(),M.commands.setVideo({src:Ne})}),!0):!1},clipboardTextParser:(N,ve)=>{const Me=N.split(/(?:\r\n?|\n)/),Ue=[];Me.forEach(Et=>{let z={type:"paragraph"};Et.length>0&&(z.content=[{type:"text",text:Et}]);let V=eo.fromJSON(ve.doc.type.schema,z);Ue.push(V)});const mt=de.fromArray(Ue);return Ce.maxOpen(mt)}},onCreate:({editor:N})=>{g(N)},onUpdate:rt.throttle(({editor:N})=>{p.value=!0;const ve=K(N,r.output);o("update:modelValue",ve),o("change",{editor:N,output:ve}),g(N),L(),q()},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(k)),"name"),editable:x.value,onFocus:N=>{w(Q.value),o("onFocus",N)},onBlur:N=>o("onBlur",N),parseOptions:{preserveWhitespace:"full"}});i.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:j,measuredMinWidth:U,measure:q}=Vd({minChars:r.minChar.content,fontSize:_,editor:M}),le=i.ref(null),H=i.computed(()=>{var N;return(N=le.value)==null?void 0:N.measuredMinWidthComment});i.provide("measuredMinWidthComment",H);const F=i.computed(()=>C.value?0:Y.value?Number(U==null?void 0:U.value)+Number(H==null?void 0:H.value)+30:Number(U==null?void 0:U.value));async function L(){await i.nextTick(),s.emit({action:"render"})}function K(N,ve){if(!N)return"";if(N.isEmpty)return ve==="json"?{}:"";if(r.mode===De.PLAIN_TEXT)return N.getText({blockSeparator:`
|
|
301
301
|
`});switch(ve){case"html":return N.getHTML();case"json":return N.getJSON();case"text":return N.getText({blockSeparator:`
|
|
302
|
-
`});default:return""}}function J(N){return N.every(ve=>M==null?void 0:M.extensionManager.extensions.find(Me=>Me.name===ve))}i.watch(()=>y.languages,()=>{M.commands.checkSpelling()}),i.watch(()=>r.modelValue,N=>{if(!M||rt.isEqual(K(M,r.output),N))return;const{from:ve,to:Me}=M.state.selection;M.commands.setTextSelection({from:ve,to:Me}),M.commands.setContent(Vn(N,r.disabled,r.mode),!1,{preserveWhitespace:"full"}),L()},{deep:!0}),i.watch(()=>x.value,N=>{var ve;M==null||M.setEditable(N),(ve=M==null?void 0:M.commands)!=null&&ve.setIsEnableSuggestion&&M.commands.setIsEnableSuggestion(N)},{immediate:!0}),i.watch(()=>m.value,()=>{m.value&&m.value.on("selectionUpdate",({editor:N})=>{o("changed:selection",{editor:N})})}),i.onUnmounted(()=>M==null?void 0:M.destroy()),Ju(_u.SAVE,()=>{localStorage.setItem("content",K(M,"html"))});const Y=i.computed(()=>{var Ue;if(!((Ue=M==null?void 0:M.storage)!=null&&Ue.superText))return!1;const{enable:N}=M.storage.superText,ve=[Ve.EDITOR,Ve.PLAIN_TEXT].includes(r.mode),Me=r.disabled;return N&&!ve&&!Me}),ne=i.ref(null),we=i.computed(()=>r.mode),{commentHeight:xe,contentHeight:$e,minHeight:Ee,minHeightComment:We}=qZ(ne,we,r.autoHeight,typeof r.minHeight=="string"?parseInt(r.minHeight):r.minHeight),Q=i.ref(null);function oe(N){N===Ve.STRAIGHT&&w(Q.value)}i.onMounted(()=>{oe(r.mode)}),i.watch(()=>r.mode,N=>{oe(N)});const ue=i.ref(null),ce=()=>{var ve;(ve=ue.value)!=null&&ve.editor.commands.focusInvalidChar()||M.commands.focusInvalidChar()};u.focusFirstInvalidChar.value=ce,i.onActivated(()=>{u.focusFirstInvalidChar.value=ce});const be=i.computed(()=>{var ve,Me,Ue;const N=((ve=r.fieldNameComment)==null?void 0:ve.label)||((Me=r.fieldNameCommentCuesheet)==null?void 0:Me.label)||((Ue=r.fieldNameContent)==null?void 0:Ue.label);return r.disabled&&N});return e({editor:M}),(N,ve)=>{var se;const Me=Zp,Ue=Jp,mt=Yp,Et=Bf,z=p$,V=ZB;return i.unref(M)?(i.openBlock(),i.createElementBlock("div",{key:0,id:"vdc-editor",class:i.normalizeClass(["vdc-editor w-full flex flex-col",[N.editorClass,{"outline-ed-primary":i.unref(M).isFocused,"outline-ed-border":!i.unref(M).isFocused}]]),style:i.normalizeStyle(I.value)},[!N.hideBubble&&!N.disabled&&x.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[J([i.unref(dc)])?(i.openBlock(),i.createBlock(Me,{key:0,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0),J([i.unref(ua)])?(i.openBlock(),i.createBlock(Ue,{key:1,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0),J([i.unref(fs)])?(i.openBlock(),i.createBlock(mt,{key:2,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0),J([i.unref(ps),i.unref(hs)])?(i.openBlock(),i.createBlock(Et,{key:3,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),N.hideToolbar?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(z,{key:1,editor:i.unref(M),"editor-comment":(se=ue.value)==null?void 0:se.editor,mode:N.mode,class:i.normalizeClass(["mb-2",N.toolBarClass])},null,8,["editor","editor-comment","mode","class"])),i.createElementVNode("div",{ref_key:"editorWrapRef",ref:ne,class:i.normalizeClass(["space-y-2 flex-1 flex flex-col break-keep",!C.value&&"[&_*]:!font-inherit [&_*]:!text-font-size-inherit",A.value&&!C.value?"[&_*]:!font-inherit":"",_.value&&!C.value?"[&_*]:!text-font-size-inherit":""]),style:i.normalizeStyle(T.value)},[be.value?(i.openBlock(),i.createBlock(V,{key:0,extensions:N.extensions,mode:N.mode,"hide-comment":N.hideComment,"field-name-comment":N.fieldNameComment,"field-name-comment-cuesheet":N.fieldNameCommentCuesheet,"field-name-content":N.fieldNameContent,comment:N.comment,"comment-cuesheet":N.commentCuesheet,content:N.modelValue,"min-chars":N.minChar.content,"font-size":_.value},null,8,["extensions","mode","hide-comment","field-name-comment","field-name-comment-cuesheet","field-name-content","comment","comment-cuesheet","content","min-chars","font-size"])):(i.openBlock(),i.createElementBlock("div",{key:1,class:"space-y-2 flex-1 flex flex-col",style:i.normalizeStyle({minWidth:`${F.value}px`})},[N.mode===i.unref(Ve).REPORT&&!N.hideComment?(i.openBlock(),i.createBlock(jZ,{key:0,ref_key:"editorCommentRef",ref:ue,mode:i.unref(Ve).REPORT,extensions:N.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":N.disableSuperInput,"is-open-super-view":Y.value,"super-preview-custom-class":N.superPreviewCustomClass,"min-char":N.minChar,"font-size":_.value,style:i.normalizeStyle(r.autoHeight?{height:"auto",minHeight:i.unref(an)(i.unref(We))}:{height:i.unref(an)(i.unref(xe)),minHeight:i.unref(an)(i.unref(Ee))}),class:"relative overflow-y-auto","onUpdate:modelValue":ve[0]||(ve[0]=ge=>o("update:comment",ge))},null,8,["mode","extensions","model-value","disabled","disable-super-input","is-open-super-view","super-preview-custom-class","min-char","font-size","style"])):i.createCommentVNode("",!0),i.createElementVNode("div",{id:"editor-container",class:"relative overflow-y-auto flex flex-col",style:i.normalizeStyle(r.autoHeight?{height:"auto",minHeight:i.unref(an)(i.unref(Ee))}:{height:i.unref(an)(i.unref($e))})},[i.createElementVNode("div",KZ,[i.withDirectives(i.createVNode(DZ,{ref_key:"superTextViewRef",ref:le,editor:i.unref(M),"super-preview-custom-class":N.superPreviewCustomClass,"min-chars":N.minChar.superPreview,"font-size":_.value},null,8,["editor","super-preview-custom-class","min-chars","font-size"]),[[i.vShow,Y.value]]),i.createElementVNode("div",{id:"editor-panel",ref_key:"contentInner",ref:j,class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},[i.createVNode(gb,{ref_key:"selectContextMenuRef",ref:Q,editor:i.unref(M),mode:N.mode,"super-text-store":i.unref(b)},{default:i.withCtx(()=>[i.createVNode(i.unref(Ao),{editor:i.unref(M),spellcheck:"true",class:i.normalizeClass(i.unref(ke)("h-full break-all",N.mode===i.unref(Ve).PLAIN_TEXT&&"plain-text"))},null,8,["editor","class"])]),_:1},8,["editor","mode","super-text-store"])],512)])],4)],4))],6)],6)):i.createCommentVNode("",!0)}}}),GZ=i.defineComponent({__name:"Switch",props:{defaultChecked:{type:Boolean},checked:{type:Boolean},disabled:{type:Boolean},required:{type:Boolean},name:{},id:{},value:{},asChild:{type:Boolean},as:{},class:{},customClassThumb:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,customClassThumb:l,...u}=n;return u}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(lD),i.mergeProps(i.unref(s),{class:i.unref(ke)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 focus-visible:ring-offset-ed-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-ed-primary data-[state=unchecked]:bg-ed-input",n.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(uD),{class:i.normalizeClass(i.unref(ke)("pointer-events-none block h-4 w-4 rounded-full bg-ed-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",n.customClassThumb))},null,8,["class"])]),_:1},16,["class"]))}}),XZ={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide"},YZ=i.defineComponent({__name:"ToolbarFormat",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[]}},setup(t){const{t:e}=Ot(),n=t,r=["fontSize","fontFamily","superText","spellchecker",dE],o=i.computed(()=>{const l=[...n.editor.extensionManager.extensions];let u=[];for(const c of l){const{button:f,divider:p=!1,spacer:m=!1,toolbar:g=!0}=c.options;if(!f||!_0(f)||!g)continue;const b=f({editor:n.editor,extension:c,t:i.unref(e),isMobile:!0});if(Array.isArray(b)){const y=b.map((w,x)=>({id:`${c.name}`,button:w,divider:x===b.length-1?p:!1,spacer:x===0?m:!1}));u=[...u,...y];continue}u.push({button:b,divider:p,spacer:m,id:`${c.name}`})}return n.activeExtensions.length?u.filter(c=>c.id&&n.activeExtensions.includes(c.id)):(r.length&&(u=u.filter(c=>c.id&&!r.includes(c.id))),u)}),s=l=>l.id==="spellchecker"?"!text-ed-blue !bg-white !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":l.button.componentProps.customClass,a=l=>l.id==="spellchecker"?"Spellchecker":l.button.componentProps.icon;return(l,u)=>(i.openBlock(),i.createElementBlock("div",{id:"tool-bar-format",class:i.normalizeClass(i.unref(ke)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2 px-2.5",!o.value.length&&"hidden"))},[i.createElementVNode("div",XZ,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(c,f)=>{var p;return i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.button.component),i.mergeProps({key:f,id:c.id,ref_for:!0},c.button.componentProps,{editor:l.editor,disabled:l.disabled||((p=c.button.componentProps)==null?void 0:p.disabled),"custom-class":s(c),icon:a(c)}),i.createSlots({_:2},[i.renderList(c.button.componentSlots,(m,g,b)=>({name:`${g}`,fn:i.withCtx(y=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(m),i.mergeProps({ref_for:!0},y==null?void 0:y.props,{id:c.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])}),128))])],2))}}),JZ={class:"flex gap-2 items-center overflow-x-auto"},K5=i.defineComponent({__name:"ToolbarMobile",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[cE,fc,ub]}},setup(t){const{t:e}=Ot(),n=t,r=i.inject("isEditable",i.ref(!0)),o=i.computed(()=>{const u=[...n.editor.extensionManager.extensions],c=u.find(m=>m.name===ub);let f=u.sort((m,g)=>m.name==="spellchecker"?-1:g.name==="spellchecker"||m.name==="superText"?1:g.name==="superText"?-1:0);c&&(f=u.sort((m,g)=>m.name==="configPlan"?1:g.name==="configPlan"?-1:0));let p=[];for(const m of f){const{button:g,divider:b=!1,spacer:y=!1,toolbar:w=!0}=m.options;if(!g||!_0(g)||!w)continue;const x=g({editor:n.editor,extension:m,t:i.unref(e),isMobile:!0});if(Array.isArray(x)){const E=x.map((k,C)=>({id:`${m.name}`,button:k,divider:C===x.length-1?b:!1,spacer:C===0?y:!1}));p=[...p,...E];continue}p.push({button:x,divider:b,spacer:y,id:`${m.name}`})}if(!r.value){const m=p.find(g=>g.id==="superText");m&&(m.button.componentProps.disabled=!0)}return n.activeExtensions.length?p.filter(m=>m.id&&n.activeExtensions.includes(m.id)):p}),s=u=>u.id==="spellchecker"?"!text-ed-blue data-[state=off]:bg-white dark:data-[state=off]:bg-ed-accent/40 !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":u.button.componentProps.customClass,a=u=>u.id==="spellchecker"?"Spellchecker":u.button.componentProps.icon,l=i.ref(!1);return(u,c)=>{const f=fE;return i.openBlock(),i.createElementBlock("div",{id:"tool-bar",class:i.normalizeClass(i.unref(ke)("z-10 border border-ed-input rounded-[5px] px-2.5 py-[5px] leading-none",i.unref(ff)()&&"top-16",!o.value.length&&"hidden"))},[i.createElementVNode("div",JZ,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(p,m)=>{var g,b,y;return i.openBlock(),i.createElementBlock(i.Fragment,{key:m},[p.spacer&&m!==0?(i.openBlock(),i.createBlock(i.unref(ci),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.resolveDynamicComponent(p.button.component),i.mergeProps({id:p.id,ref_for:!0},p.button.componentProps,{editor:u.editor,disabled:u.disabled||((g=p.button.componentProps)==null?void 0:g.disabled),"custom-class":s(p),icon:a(p)}),i.createSlots({_:2},[i.renderList(p.button.componentSlots,(w,x,E)=>({name:`${x}`,fn:i.withCtx(k=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(w),i.mergeProps({ref_for:!0},k==null?void 0:k.props,{id:p.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),p.id===fc&&i.unref(l)?(i.openBlock(),i.createBlock(f,{key:1,class:"bg-white border-inherit w-[26px] h-[26px] shadow-none",checked:(y=(b=p.button.componentProps).isActive)==null?void 0:y.call(b),"onUpdate:checked":w=>{var x,E;return(E=(x=p.button.componentProps).action)==null?void 0:E.call(x)}},null,8,["checked","onUpdate:checked"])):i.createCommentVNode("",!0),p.divider?(i.openBlock(),i.createBlock(i.unref(ci),{key:2,orientation:"vertical",class:"mx-2 h-auto"})):i.createCommentVNode("",!0)],64)}),128))])],2)}}}),ZZ={class:"flex w-fit rounded-md bg-ed-gray-600 text-white max-w-full overflow-x-auto"},QZ=Bo(i.defineComponent({__name:"MainBubbleMenuList",props:{editor:{},mode:{},disableSuperInput:{type:Boolean},hasClipboard:{type:Boolean}},emits:["close-long-press-menu"],setup(t,{emit:e}){var f;const n=t,r=e,{t:o}=Ot(),s=i.computed(()=>[...n.editor.extensionManager.extensions].find(m=>m.name==="superText")),a=i.ref(!1),l=(f=n.editor.extensionManager.extensions.find(p=>p.name==="superText"))==null?void 0:f.options.specialCharModal,u=p=>{const{state:m}=n.editor,{from:g}=m.selection;n.editor.commands.insertContentAt(g,p)},c=()=>{n.editor.chain().focus().toggleSuperInputMoblie().run(),r("close-long-press-menu");const p=DK(n.editor);n.editor.commands.setSuperTextContent(p)};return(p,m)=>{var g,b,y;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",ZZ,[i.unref(s)&&!p.disableSuperInput&&p.mode!==i.unref(Ve).EDITOR?(i.openBlock(),i.createElementBlock("button",{key:0,class:"bubble-menu-item",onClick:c},i.toDisplayString(i.unref(o)("editor.super")),1)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[0]||(m[0]=w=>a.value=!0)},i.toDisplayString(i.unref(o)("editor.insertSpecial")),1),p.hasClipboard?(i.openBlock(),i.createElementBlock("button",{key:1,class:"bubble-menu-item",onClick:m[1]||(m[1]=w=>p.editor.chain().focus().pasteContent().run())},i.toDisplayString(i.unref(o)("editor.paste")),1)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[2]||(m[2]=w=>p.editor.chain().focus().cutContent().run())},i.toDisplayString(i.unref(o)("editor.cut")),1),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[3]||(m[3]=()=>{p.editor.chain().focus().copyContent().setTextSelection(0).blur().run(),r("close-long-press-menu")})},i.toDisplayString(i.unref(o)("editor.copy")),1),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[4]||(m[4]=w=>p.editor.chain().focus().selectAll().run())},i.toDisplayString(i.unref(o)("editor.selectAll")),1)]),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent((g=i.unref(l))==null?void 0:g.component),{"is-open":i.unref(a),open:i.unref(a),class:i.normalizeClass((y=(b=i.unref(l))==null?void 0:b.componentProps)==null?void 0:y.class),onSelectedChar:u,onClose:m[5]||(m[5]=w=>a.value=!1)},null,40,["is-open","open","class"]))]))],64)}}}),[["__scopeId","data-v-e8f0c575"]]);class G5{isNativeWebViewAvailable(){return window.ReactNativeWebView!==void 0}getDevicePlatform(){var r;if(!this.isNativeWebViewAvailable())return;if(typeof window.webkit=="object"&&typeof((r=window.webkit)==null?void 0:r.messageHandlers)=="object")return E0.IOS;const n=navigator.userAgent.toLowerCase();if(n.includes("android"))return E0.ANDROID;if(n.includes("iphone")||n.includes("ipad")||n.includes("ipod"))return E0.IOS}sendToNative(e,n){if(window.ReactNativeWebView){const r={type:e,data:n};window.ReactNativeWebView.postMessage(JSON.stringify(r)),console.log(`Sent message to native: ${e}`)}else console.log("ReactNativeWebView not available")}receiveDataFromNative(e,n){const r=window.receiveDriverData;window.receiveDriverData=o=>{try{const s=JSON.parse(o);s.type===e?(console.log(`Received data from native ${e}`),n(s.data)):r&&r(o)}catch(s){console.log("Error parsing data from native",s)}}}}const X5=i.defineComponent({__name:"MainBubbleMenu",props:{editor:{},mode:{},disableSuperInput:{type:Boolean}},setup(t){const e=t,n=new G5,r=i.ref(!1),o=async()=>{var g,b;const m=await((b=(g=e.editor).hasClipboard)==null?void 0:b.call(g));r.value=!!m},s={duration:200,placement:"bottom",appendTo:()=>document.body.querySelector(".splitpanes__pane"),onShow:()=>{o(),n.sendToNative("hideIOSEditMenu")},getReferenceClientRect:()=>{if(e.editor&&!e.editor.isDestroyed){const{view:m,state:g}=e.editor,{from:b,to:y}=g.selection,w=m.dom.getBoundingClientRect(),x=m.coordsAtPos(b),E=m.coordsAtPos(y),k=Math.min(x.top,E.top),_=Math.max(x.bottom,E.bottom)-k;return new DOMRect(w.left,k,w.width,_)}return null}},a=i.ref(null),l=i.ref(!1),u=({editor:m,state:g})=>["image","superText","link"].some(w=>m.isActive(w))?!1:!g.selection.empty||l.value;function c(m){return f(m)&&m.touches.length>0?{x:m.touches[0].clientX,y:m.touches[0].clientY}:f(m)&&m.changedTouches.length>0?{x:m.changedTouches[0].clientX,y:m.changedTouches[0].clientY}:m instanceof MouseEvent?{x:m.clientX,y:m.clientY}:window.PointerEvent&&m instanceof PointerEvent?{x:m.clientX,y:m.clientY}:null}function f(m){return"touches"in m}function p(m){if(!e.editor)return;const g=c(m);if(!g)return;const b=e.editor.view,y=b.state,w=b.posAtCoords({left:g.x,top:g.y});if(!w||w.inside===-1)return;const x=w.pos,E=y.doc.content.size,k=Math.min(x+1,E);let C=y.tr;C=C.setSelection(Te.create(y.doc,x,k)),b.dispatch(C),requestAnimationFrame(()=>{const _=b.state.tr.setSelection(Te.create(b.state.doc,x,x));b.dispatch(_),b.focus()})}return i.onMounted(()=>{const m=e.editor.view.dom;ht.onLongPress(i.ref(m),y=>{l.value=!0,p(y)},{delay:500,modifiers:{prevent:!1}});const g=()=>{e.editor.state.selection.empty&&(l.value=!1)};m.addEventListener("pointerdown",g);const b=({transaction:y})=>{l.value&&y.docChanged&&(l.value=!1,i.nextTick(()=>{var w;try{const x=(w=a.value)==null?void 0:w.$el;x&&x._tippy&&typeof x._tippy.hide=="function"&&x._tippy.hide()}catch{const E=e.editor.view,k=E.state,C=k.selection.from,_=k.doc.content.size,A=Math.min(C+1,_);E.dispatch(k.tr.setSelection(Te.create(k.doc,C,A))),requestAnimationFrame(()=>{E.dispatch(E.state.tr.setSelection(Te.create(E.state.doc,C,C)))})}}))};e.editor.on("transaction",b),i.onUnmounted(()=>{m.removeEventListener("pointerdown",g),e.editor.off("transaction",b)})}),(m,g)=>(i.openBlock(),i.createBlock(i.unref(Su),{ref_key:"bubbleMenuRef",ref:a,editor:m.editor,"tippy-options":s,"should-show":u},{default:i.withCtx(()=>[i.createVNode(QZ,{editor:m.editor,mode:m.mode,disableSuperInput:m.disableSuperInput,hasClipboard:i.unref(r),onCloseLongPressMenu:g[0]||(g[0]=b=>l.value=!1)},null,8,["editor","mode","disableSuperInput","hasClipboard"])]),_:1},8,["editor"]))}}),NZ={class:"flex items-center justify-between label-large mb-2"},eQ={class:"mb-5"},tQ={class:"flex gap-x-3"},nQ=i.defineComponent({__name:"SuperInputBottomSheet",props:{editor:{},open:{type:Boolean},bottomSheetComponent:{}},emits:["save","close"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(""),s=i.ref(""),a=i.computed(()=>Mp(o.value)),l=()=>{o.value="",s.value="",n.editor.commands.setSuperTextContent(o.value,s.value)},u=()=>{l(),r("close")};i.watch(()=>n.open,()=>{n.open&&(o.value=n.editor.storage.superText.superTextContent,s.value=n.editor.storage.superText.superTextPosition)});const c=()=>{o.value=n.editor.storage.superText.superTextContent},f=()=>{r("save",o.value,s.value),l()};return(p,m)=>{var b;const g=Lt;return i.openBlock(),i.createBlock(i.resolveDynamicComponent((b=p.bottomSheetComponent)==null?void 0:b.component),{"is-open":p.open,type:"bottom",title:"수퍼 입력",onOnClose:u},{customContent:i.withCtx(()=>{var y;return[i.createElementVNode("div",NZ,[m[2]||(m[2]=i.createElementVNode("span",null,"내용",-1)),(i.openBlock(),i.createBlock(i.resolveDynamicComponent((y=p.bottomSheetComponent)==null?void 0:y.button),{class:"w-fit [&_svg]:size-6 text-blue",variant:"ghost",size:"icon",onClick:c},{default:i.withCtx(()=>[i.createVNode(g,{name:"reset",class:"h-5 w-5"}),m[1]||(m[1]=i.createElementVNode("span",null,"초기화",-1))]),_:1}))])]}),body:i.withCtx(()=>[i.createElementVNode("div",eQ,[i.createVNode(mb,{modelValue:i.unref(o),"onUpdate:modelValue":m[0]||(m[0]=y=>i.isRef(o)?o.value=y:null),"parent-editor":p.editor,"spellcheck-enabled":!1,autofocus:"end"},null,8,["modelValue","parent-editor"])])]),footer:i.withCtx(()=>{var y,w;return[i.createElementVNode("div",tQ,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent((y=p.bottomSheetComponent)==null?void 0:y.button),{variant:"outline",onClick:u},{default:i.withCtx(()=>m[3]||(m[3]=[i.createTextVNode(" 취소 ")])),_:1})),(i.openBlock(),i.createBlock(i.resolveDynamicComponent((w=p.bottomSheetComponent)==null?void 0:w.button),{disabled:i.unref(a),variant:i.unref(a)?"disabled":"default",onClick:f},{default:i.withCtx(()=>m[4]||(m[4]=[i.createTextVNode(" 입력 ")])),_:1},8,["disabled","variant"]))])]}),_:1},40,["is-open"])}}}),rQ=Dn.create({name:"diffDel",parseHTML(){return[{tag:"span.diff-del"}]},renderHTML({HTMLAttributes:t}){return["span",{class:"diff-del",...t},0]}}),oQ=i.defineComponent({__name:"EditorCommentMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useAttrs(),a=wn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,p=i.inject("isEditable",i.ref(!0)),m=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled),editorProps:{attributes:{id:or.COMMENT,[or.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:rt.throttle((x,E)=>E.key==="Enter"&&s.enter&&!E.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:x=>(x=x.replace(/\s*style="[^"]*"/g,""),x)},onCreate:({editor:x})=>{c(x)},onUpdate:rt.throttle(({editor:x})=>{l.value=!0;const E=b(x,r.output);o("update:modelValue",E),o("change",{editor:x,output:E}),c(x)},Mo),extensions:[rQ,...rt.uniqBy(rt.reverse(i.unref(r.extensions)),"name")],editable:p.value,onFocus:()=>{g()},onBlur:({editor:x,event:E})=>{o("onBlurEditor",E)}});function g(){o("setEditorSelected",m)}g();function b(x,E){if(!x)return"";if(x.isEmpty)return E==="json"?{}:"";switch(E){case"html":return x.getHTML();case"json":return x.getJSON();case"text":return x.getText();default:return""}}function y(x){return x.every(E=>m==null?void 0:m.extensionManager.extensions.find(k=>k.name===E))}i.watch(()=>f.languages,()=>{m.commands.checkSpelling()}),i.watch(()=>r.modelValue,x=>{if(!m||rt.isEqual(b(m,r.output),x))return;const{from:E,to:k}=m.state.selection;m.commands.setTextSelection({from:E,to:k}),m.commands.setContent(Vn(x,r.disabled),!1)},{deep:!0}),i.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:x})=>{o("changed:selection",{editor:x})})}),i.watch(()=>r.disableSuperInput,()=>{const x=document.getElementById(or.COMMENT);x==null||x.setAttribute(or.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),i.onUnmounted(()=>m==null?void 0:m.destroy()),Ju(_u.SAVE,()=>{localStorage.setItem("comment",b(m,"html"))});function w(x){m.commands.focus("end"),g()}return Qp(m),i.onMounted(()=>{var x;r.autoFocus&&w(r.mode),(x=m==null?void 0:m.commands)!=null&&x.setIsMobile&&m.commands.setIsMobile(!0)}),i.watch(()=>r.mode,x=>{r.autoFocus&&w()}),i.watch(()=>p.value,x=>{var E;m==null||m.setEditable(x),(E=m==null?void 0:m.commands)!=null&&E.setIsEnableSuggestion&&m.commands.setIsEnableSuggestion(x)},{immediate:!0}),e({editor:m}),(x,E)=>{const k=X5,C=Zp,_=Jp,A=Yp,T=Bf;return i.openBlock(),i.createElementBlock(i.Fragment,null,[!x.hideBubble&&!x.disabled&&i.unref(p)?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createVNode(k,{editor:i.unref(m),mode:x.mode,"disable-super-input":x.disableSuperInput},null,8,["editor","mode","disable-super-input"]),y([i.unref(dc)])?(i.openBlock(),i.createBlock(C,{key:0,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0),y([i.unref(ua)])?(i.openBlock(),i.createBlock(_,{key:1,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0),y([i.unref(fs)])?(i.openBlock(),i.createBlock(A,{key:2,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0),y([i.unref(ps),i.unref(hs)])?(i.openBlock(),i.createBlock(T,{key:3,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),i.createVNode(i.unref(Ao),{id:"editor-panel",editor:i.unref(m),spellcheck:"true",class:i.normalizeClass(["flex-1 flex-col relative"])},null,8,["editor"])],64)}}}),Yb={__name:"splitpanes",props:{horizontal:{type:Boolean,default:!1},pushOtherPanes:{type:Boolean,default:!0},maximizePanes:{type:Boolean,default:!0},rtl:{type:Boolean,default:!1},firstSplitter:{type:Boolean,default:!1}},emits:["ready","resize","resized","pane-click","pane-maximize","pane-add","pane-remove","splitter-click","splitter-dblclick"],setup(t,{emit:e}){const n=e,r=t,o=i.useSlots(),s=i.ref([]),a=i.computed(()=>s.value.reduce((Q,oe)=>(Q[~~oe.id]=oe)&&Q,{})),l=i.computed(()=>s.value.length),u=i.ref(null),c=i.ref(!1),f=i.ref({mouseDown:!1,dragging:!1,activeSplitter:null,cursorOffset:0}),p=i.ref({splitter:null,timeoutId:null}),m=i.computed(()=>({[`splitpanes splitpanes--${r.horizontal?"horizontal":"vertical"}`]:!0,"splitpanes--dragging":f.value.dragging})),g=()=>{document.addEventListener("mousemove",w,{passive:!1}),document.addEventListener("mouseup",x),"ontouchstart"in window&&(document.addEventListener("touchmove",w,{passive:!1}),document.addEventListener("touchend",x))},b=()=>{document.removeEventListener("mousemove",w,{passive:!1}),document.removeEventListener("mouseup",x),"ontouchstart"in window&&(document.removeEventListener("touchmove",w,{passive:!1}),document.removeEventListener("touchend",x))},y=(Q,oe)=>{const ue=Q.target.closest(".splitpanes__splitter");if(ue){const{left:ce,top:be}=ue.getBoundingClientRect(),{clientX:N,clientY:ve}="ontouchstart"in window&&Q.touches?Q.touches[0]:Q;f.value.cursorOffset=r.horizontal?ve-be:N-ce}g(),f.value.mouseDown=!0,f.value.activeSplitter=oe},w=Q=>{f.value.mouseDown&&(Q.preventDefault(),f.value.dragging=!0,requestAnimationFrame(()=>{T(_(Q)),Ee("resize",{event:Q},!0)}))},x=Q=>{f.value.dragging&&(window.getSelection().removeAllRanges(),Ee("resized",{event:Q},!0)),f.value.mouseDown=!1,f.value.activeSplitter=null,setTimeout(()=>{f.value.dragging=!1,b()},100)},E=(Q,oe)=>{"ontouchstart"in window&&(Q.preventDefault(),p.value.splitter===oe?(clearTimeout(p.value.timeoutId),p.value.timeoutId=null,k(Q,oe),p.value.splitter=null):(p.value.splitter=oe,p.value.timeoutId=setTimeout(()=>p.value.splitter=null,500))),f.value.dragging||Ee("splitter-click",{event:Q,index:oe},!0)},k=(Q,oe)=>{if(Ee("splitter-dblclick",{event:Q,index:oe},!0),r.maximizePanes){let ue=0;s.value=s.value.map((ce,be)=>(ce.size=be===oe?ce.max:ce.min,be!==oe&&(ue+=ce.min),ce)),s.value[oe].size-=ue,Ee("pane-maximize",{event:Q,index:oe,pane:s.value[oe]}),Ee("resized",{event:Q,index:oe},!0)}},C=(Q,oe)=>{Ee("pane-click",{event:Q,index:a.value[oe].index,pane:a.value[oe]})},_=Q=>{const oe=u.value.getBoundingClientRect(),{clientX:ue,clientY:ce}="ontouchstart"in window&&Q.touches?Q.touches[0]:Q;return{x:ue-(r.horizontal?0:f.value.cursorOffset)-oe.left,y:ce-(r.horizontal?f.value.cursorOffset:0)-oe.top}},A=Q=>{Q=Q[r.horizontal?"y":"x"];const oe=u.value[r.horizontal?"clientHeight":"clientWidth"];return r.rtl&&!r.horizontal&&(Q=oe-Q),Q*100/oe},T=Q=>{const oe=f.value.activeSplitter;let ue={prevPanesSize:I(oe),nextPanesSize:M(oe),prevReachedMinPanes:0,nextReachedMinPanes:0};const ce=0+(r.pushOtherPanes?0:ue.prevPanesSize),be=100-(r.pushOtherPanes?0:ue.nextPanesSize),N=Math.max(Math.min(A(Q),be),ce);let ve=[oe,oe+1],Me=s.value[ve[0]]||null,Ue=s.value[ve[1]]||null;const mt=Me.max<100&&N>=Me.max+ue.prevPanesSize,Et=Ue.max<100&&N<=100-(Ue.max+M(oe+1));if(mt||Et){mt?(Me.size=Me.max,Ue.size=Math.max(100-Me.max-ue.prevPanesSize-ue.nextPanesSize,0)):(Me.size=Math.max(100-Ue.max-ue.prevPanesSize-M(oe+1),0),Ue.size=Ue.max);return}if(r.pushOtherPanes){const z=P(ue,N);if(!z)return;({sums:ue,panesToResize:ve}=z),Me=s.value[ve[0]]||null,Ue=s.value[ve[1]]||null}Me!==null&&(Me.size=Math.min(Math.max(N-ue.prevPanesSize-ue.prevReachedMinPanes,Me.min),Me.max)),Ue!==null&&(Ue.size=Math.min(Math.max(100-N-ue.nextPanesSize-ue.nextReachedMinPanes,Ue.min),Ue.max))},P=(Q,oe)=>{const ue=f.value.activeSplitter,ce=[ue,ue+1];return oe<Q.prevPanesSize+s.value[ce[0]].min&&(ce[0]=j(ue).index,Q.prevReachedMinPanes=0,ce[0]<ue&&s.value.forEach((be,N)=>{N>ce[0]&&N<=ue&&(be.size=be.min,Q.prevReachedMinPanes+=be.min)}),Q.prevPanesSize=I(ce[0]),ce[0]===void 0)?(Q.prevReachedMinPanes=0,s.value[0].size=s.value[0].min,s.value.forEach((be,N)=>{N>0&&N<=ue&&(be.size=be.min,Q.prevReachedMinPanes+=be.min)}),s.value[ce[1]].size=100-Q.prevReachedMinPanes-s.value[0].min-Q.prevPanesSize-Q.nextPanesSize,null):oe>100-Q.nextPanesSize-s.value[ce[1]].min&&(ce[1]=U(ue).index,Q.nextReachedMinPanes=0,ce[1]>ue+1&&s.value.forEach((be,N)=>{N>ue&&N<ce[1]&&(be.size=be.min,Q.nextReachedMinPanes+=be.min)}),Q.nextPanesSize=M(ce[1]-1),ce[1]===void 0)?(Q.nextReachedMinPanes=0,s.value.forEach((be,N)=>{N<l.value-1&&N>=ue+1&&(be.size=be.min,Q.nextReachedMinPanes+=be.min)}),s.value[ce[0]].size=100-Q.prevPanesSize-M(ce[0]-1),null):{sums:Q,panesToResize:ce}},I=Q=>s.value.reduce((oe,ue,ce)=>oe+(ce<Q?ue.size:0),0),M=Q=>s.value.reduce((oe,ue,ce)=>oe+(ce>Q+1?ue.size:0),0),j=Q=>[...s.value].reverse().find(oe=>oe.index<Q&&oe.size>oe.min)||{},U=Q=>s.value.find(oe=>oe.index>Q+1&&oe.size>oe.min)||{},q=()=>{var Q;const oe=Array.from(((Q=u.value)==null?void 0:Q.children)||[]);for(const ue of oe){const ce=ue.classList.contains("splitpanes__pane"),be=ue.classList.contains("splitpanes__splitter");!ce&&!be&&(ue.remove(),console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."))}},le=(Q,oe,ue=!1)=>{const ce=Q-1,be=document.createElement("div");be.classList.add("splitpanes__splitter"),ue||(be.onmousedown=N=>y(N,ce),typeof window<"u"&&"ontouchstart"in window&&(be.ontouchstart=N=>y(N,ce)),be.onclick=N=>E(N,ce+1)),be.ondblclick=N=>k(N,ce+1),oe.parentNode.insertBefore(be,oe)},H=Q=>{Q.onmousedown=void 0,Q.onclick=void 0,Q.ondblclick=void 0,Q.remove()},F=()=>{var Q;const oe=Array.from(((Q=u.value)==null?void 0:Q.children)||[]);for(const ce of oe)ce.className.includes("splitpanes__splitter")&&H(ce);let ue=0;for(const ce of oe)ce.className.includes("splitpanes__pane")&&(!ue&&r.firstSplitter?le(ue,ce,!0):ue&&le(ue,ce),ue++)},L=({uid:Q,...oe})=>{const ue=a.value[Q];for(const[ce,be]of Object.entries(oe))ue[ce]=be},K=Q=>{var oe;let ue=-1;Array.from(((oe=u.value)==null?void 0:oe.children)||[]).some(ce=>(ce.className.includes("splitpanes__pane")&&ue++,ce.isSameNode(Q.el))),s.value.splice(ue,0,{...Q,index:ue}),s.value.forEach((ce,be)=>ce.index=be),c.value&&i.nextTick(()=>{F(),Y({addedPane:s.value[ue]}),Ee("pane-add",{pane:s.value[ue]})})},J=Q=>{const oe=s.value.findIndex(ce=>ce.id===Q);s.value[oe].el=null;const ue=s.value.splice(oe,1)[0];s.value.forEach((ce,be)=>ce.index=be),i.nextTick(()=>{F(),Ee("pane-remove",{pane:ue}),Y({removedPane:{...ue}})})},Y=(Q={})=>{!Q.addedPane&&!Q.removedPane?we():s.value.some(oe=>oe.givenSize!==null||oe.min||oe.max<100)?xe(Q):ne(),c.value&&Ee("resized")},ne=()=>{const Q=100/l.value;let oe=0;const ue=[],ce=[];for(const be of s.value)be.size=Math.max(Math.min(Q,be.max),be.min),oe-=be.size,be.size>=be.max&&ue.push(be.id),be.size<=be.min&&ce.push(be.id);oe>.1&&$e(oe,ue,ce)},we=()=>{let Q=100;const oe=[],ue=[];let ce=0;for(const N of s.value)Q-=N.size,N.givenSize!==null&&ce++,N.size>=N.max&&oe.push(N.id),N.size<=N.min&&ue.push(N.id);let be=100;if(Q>.1){for(const N of s.value)N.givenSize===null&&(N.size=Math.max(Math.min(Q/(l.value-ce),N.max),N.min)),be-=N.size;be>.1&&$e(be,oe,ue)}},xe=({addedPane:Q,removedPane:oe}={})=>{let ue=100/l.value,ce=0;const be=[],N=[];((Q==null?void 0:Q.givenSize)??null)!==null&&(ue=(100-Q.givenSize)/(l.value-1));for(const ve of s.value)ce-=ve.size,ve.size>=ve.max&&be.push(ve.id),ve.size<=ve.min&&N.push(ve.id);if(!(Math.abs(ce)<.1)){for(const ve of s.value)(Q==null?void 0:Q.givenSize)!==null&&(Q==null?void 0:Q.id)===ve.id||(ve.size=Math.max(Math.min(ue,ve.max),ve.min)),ce-=ve.size,ve.size>=ve.max&&be.push(ve.id),ve.size<=ve.min&&N.push(ve.id);ce>.1&&$e(ce,be,N)}},$e=(Q,oe,ue)=>{let ce;Q>0?ce=Q/(l.value-oe.length):ce=Q/(l.value-ue.length),s.value.forEach((be,N)=>{if(Q>0&&!oe.includes(be.id)){const ve=Math.max(Math.min(be.size+ce,be.max),be.min),Me=ve-be.size;Q-=Me,be.size=ve}else if(!ue.includes(be.id)){const ve=Math.max(Math.min(be.size+ce,be.max),be.min),Me=ve-be.size;Q-=Me,be.size=ve}}),Math.abs(Q)>.1&&i.nextTick(()=>{c.value&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints.")})},Ee=(Q,oe=void 0,ue=!1)=>{const ce=(oe==null?void 0:oe.index)??f.value.activeSplitter??null;n(Q,{...oe,...ce!==null&&{index:ce},...ue&&ce!==null&&{prevPane:s.value[ce-(r.firstSplitter?1:0)],nextPane:s.value[ce+(r.firstSplitter?0:1)]},panes:s.value.map(be=>({min:be.min,max:be.max,size:be.size}))})};i.watch(()=>r.firstSplitter,()=>F()),i.onMounted(()=>{q(),F(),Y(),Ee("ready"),c.value=!0}),i.onBeforeUnmount(()=>c.value=!1);const We=()=>{var Q;return i.h("div",{ref:u,class:m.value},(Q=o.default)==null?void 0:Q.call(o))};return i.provide("panes",s),i.provide("indexedPanes",a),i.provide("horizontal",i.computed(()=>r.horizontal)),i.provide("requestUpdate",L),i.provide("onPaneAdd",K),i.provide("onPaneRemove",J),i.provide("onPaneClick",C),(Q,oe)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(We)))}},ba={__name:"pane",props:{size:{type:[Number,String]},minSize:{type:[Number,String],default:0},maxSize:{type:[Number,String],default:100}},setup(t){var e;const n=t,r=i.inject("requestUpdate"),o=i.inject("onPaneAdd"),s=i.inject("horizontal"),a=i.inject("onPaneRemove"),l=i.inject("onPaneClick"),u=(e=i.getCurrentInstance())==null?void 0:e.uid,c=i.inject("indexedPanes"),f=i.computed(()=>c.value[u]),p=i.ref(null),m=i.computed(()=>{const w=isNaN(n.size)||n.size===void 0?0:parseFloat(n.size);return Math.max(Math.min(w,b.value),g.value)}),g=i.computed(()=>{const w=parseFloat(n.minSize);return isNaN(w)?0:w}),b=i.computed(()=>{const w=parseFloat(n.maxSize);return isNaN(w)?100:w}),y=i.computed(()=>{var w;return`${s.value?"height":"width"}: ${(w=f.value)==null?void 0:w.size}%`});return i.watch(()=>m.value,w=>r({uid:u,size:w})),i.watch(()=>g.value,w=>r({uid:u,min:w})),i.watch(()=>b.value,w=>r({uid:u,max:w})),i.onMounted(()=>{o({id:u,el:p.value,min:g.value,max:b.value,givenSize:n.size===void 0?null:m.value,size:m.value})}),i.onBeforeUnmount(()=>a(u)),(w,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"paneEl",ref:p,class:"splitpanes__pane",onClick:x[0]||(x[0]=E=>i.unref(l)(E,w._.uid)),style:i.normalizeStyle(y.value)},[i.renderSlot(w.$slots,"default")],4))}},Y5=i.defineComponent({__name:"ToolbarTitle",props:{titleBar:{},customClass:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("h3",{class:i.normalizeClass(i.unref(ke)("rounded-[5px] px-2.5 py-[5px] min-h-[32px] flex items-center bg-ed-gray-500",[e.customClass],[e.titleBar.bgClass]))},i.toDisplayString(e.titleBar.title),3))}}),iQ={class:"text-red-500 relative -top-1"},eh=i.defineComponent({__name:"EditorFieldName",props:{fieldName:{},mode:{},disabled:{type:Boolean,default:!1},isRequired:{type:Boolean,default:!1}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(ke)("label-large",e.fieldName.customClass))},[i.createElementVNode("span",null,i.toDisplayString(e.fieldName.label),1),i.withDirectives(i.createElementVNode("span",iQ," •",512),[[i.vShow,e.fieldName.isRequired]])],2))}});function J5(t=!1,e=10){const n=e,r=90,o=50,s=n+1,a=i.ref(!0),l=i.ref(!0),u=i.ref(o),c=i.ref(o);return{HEADER_ONLY_SIZE:n,FULL_SIZE:r,SPLIT_SIZE:o,pane1ContentVisible:a,pane2ContentVisible:l,pane1Size:u,pane2Size:c,togglePane:m=>{if(i.unref(t)){l.value?(l.value=!1,c.value=n):(l.value=!0,c.value=r+n);return}if(m==="pane1"){a.value&&l.value?(a.value=!1,u.value=n,c.value=r):a.value&&!l.value?(a.value=!1,l.value=!0,u.value=n,c.value=r):!a.value&&l.value?(a.value=!0,u.value=o,c.value=o):(a.value=!0,u.value=r,c.value=n);return}m==="pane2"&&(a.value&&l.value?(l.value=!1,u.value=r,c.value=n):l.value&&!a.value?(l.value=!1,a.value=!0,u.value=r,c.value=n):!l.value&&a.value?(l.value=!0,u.value=o,c.value=o):(l.value=!0,u.value=n,c.value=r))},handlePaneResize:m=>{const g=m.panes;if(g&&g.length>=2){const b=g[0].size,y=g[1].size;u.value=b,c.value=y,b>n&&!a.value&&(a.value=!0),y>n&&!l.value&&(l.value=!0),b<=s&&a.value&&(a.value=!1),y<=s&&l.value&&(l.value=!1)}}}}const sQ={class:"flex justify-between items-center relative"},Cc=i.defineComponent({__name:"CoreEditorMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean,default:!1},titleBarComment:{default:null},titleBarContent:{default:null},fieldNameComment:{default:null},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{default:!1},isShowLineNumber:{type:Boolean,default:!1},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{default:void 0},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){var ze;const r=t,o=n,s=new G5;i.provide("isMobile",!0);const a=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE),l=i.useAttrs(),u=wn(),{state:c,isFullscreen:f,isReady:p,editor:m,updateEditorState:g,checkSpellStore:b,setImageAttachment:y,setEditorContentMobile:w}=u,{markAsFocused:x,insertHtml:E}=yZ(),k=i.ref(!r.disabled&&!r.readonly);i.provide("isEditable",k);const C=i.computed(()=>[...c.extensions,...rt.differenceBy(r.extensions,c.extensions,"name")].map((D,Z)=>D.configure({sort:Z}))),_=i.ref(r.fontSizeDefault),A=i.ref(r.fontFamilyDefault);i.provide("fontSize",_),i.provide("fontFamily",A);const T=i.computed(()=>({fontFamily:A.value,fontSize:_.value})),P=i.ref(),{height:I}=ht.useWindowSize(),M=i.computed(()=>{var Z;if(L.value)return{bottom:"15px"};const D=((Z=P.value)==null?void 0:Z.getBoundingClientRect().bottom)||0;return{bottom:`${I.value-D+10}px`}}),j=D=>{const Z=parseInt(_.value||"12px"),ee=D?Z+2:Z-2;_.value=ee+"px"};i.onBeforeMount(()=>{a.on(j)}),i.onBeforeUnmount(()=>{a.off(j)});const U=i.computed(()=>({...i.unref(f)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),q=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:rt.throttle((D,Z)=>Z.key==="Enter"&&l.enter&&!Z.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:D=>(D=D.replace(/\s*style="[^"]*"/g,""),D),handlePaste(D,Z){var Je;if(r.mode!==Ve.PLAIN_TEXT)return!1;Z.preventDefault();const ee=((Je=Z.clipboardData)==null?void 0:Je.getData("text/plain"))||"",{tr:he,selection:Fe}=D.state;return D.dispatch(he.insertText(ee,Fe.from)),!0}},onCreate:({editor:D})=>{g(D)},onUpdate:rt.throttle(({editor:D})=>{p.value=!0;const Z=xe(D,r.output);o("update:modelValue",Z),o("change",{editor:D,output:Z}),g(D),le(D)},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(C)),"name"),editable:k.value,onFocus:D=>{ne(),o("onFocus",D),x()},onBlur:D=>o("onBlur",D),parseOptions:{preserveWhitespace:"full"}});function le(D){const Z=[];D.state.doc.descendants(ee=>{ee.type.name==="image"&&Z.push({id:ee.attrs.id,src:ee.attrs.src})}),y(Z)}const H=i.ref(),F=i.ref(!0),L=i.ref(!1);function K(){s.isNativeWebViewAvailable()&&(s.receiveDataFromNative("keyboardDidShow",D=>{L.value=!0}),s.receiveDataFromNative("keyboardDidHide",D=>{L.value=!1}))}function J(D){const Z=document.querySelectorAll('[contenteditable="true"]:not(.tiptap), .simple-editor, input, textarea'),ee=Array.from(Z).some(he=>he.contains(D.target));if(D.type==="focusout"){F.value=!0;return}F.value=!ee}ht.useEventListener(document,"focusin",J),ht.useEventListener(document,"focusout",J),i.onMounted(()=>{ne(q),w(q),K()});const Y=i.computed(()=>r.isShowFormatControlBar&&F.value&&!L.value);function ne(D){H.value=D??q,u.setEditorSelectedMobile(H.value)}const we=i.computed(()=>q.storage.superText.isShowSuperInputMoblie);function xe(D,Z){if(!D)return"";if(D.isEmpty)return Z==="json"?{}:"";if(r.mode===Ve.PLAIN_TEXT)return D.getText({blockSeparator:`
|
|
302
|
+
`});default:return""}}function J(N){return N.every(ve=>M==null?void 0:M.extensionManager.extensions.find(Me=>Me.name===ve))}i.watch(()=>y.languages,()=>{M.commands.checkSpelling()}),i.watch(()=>r.modelValue,N=>{if(!M||rt.isEqual(K(M,r.output),N))return;const{from:ve,to:Me}=M.state.selection;M.commands.setTextSelection({from:ve,to:Me}),M.commands.setContent(Vn(N,r.disabled,r.mode),!1,{preserveWhitespace:"full"}),L()},{deep:!0}),i.watch(()=>x.value,N=>{var ve;M==null||M.setEditable(N),(ve=M==null?void 0:M.commands)!=null&&ve.setIsEnableSuggestion&&M.commands.setIsEnableSuggestion(N)},{immediate:!0}),i.watch(()=>m.value,()=>{m.value&&m.value.on("selectionUpdate",({editor:N})=>{o("changed:selection",{editor:N})})}),i.onUnmounted(()=>M==null?void 0:M.destroy()),Ju(_u.SAVE,()=>{localStorage.setItem("content",K(M,"html"))});const Y=i.computed(()=>{var Ue;if(!((Ue=M==null?void 0:M.storage)!=null&&Ue.superText))return!1;const{enable:N}=M.storage.superText,ve=[De.EDITOR,De.PLAIN_TEXT].includes(r.mode),Me=r.disabled;return N&&!ve&&!Me}),ne=i.ref(null),we=i.computed(()=>r.mode),{commentHeight:xe,contentHeight:$e,minHeight:Ee,minHeightComment:We}=qZ(ne,we,r.autoHeight,typeof r.minHeight=="string"?parseInt(r.minHeight):r.minHeight),Q=i.ref(null);function oe(N){N===De.STRAIGHT&&w(Q.value)}i.onMounted(()=>{oe(r.mode)}),i.watch(()=>r.mode,N=>{oe(N)});const ue=i.ref(null),ce=()=>{var ve;(ve=ue.value)!=null&&ve.editor.commands.focusInvalidChar()||M.commands.focusInvalidChar()};u.focusFirstInvalidChar.value=ce,i.onActivated(()=>{u.focusFirstInvalidChar.value=ce});const be=i.computed(()=>{var ve,Me,Ue;const N=((ve=r.fieldNameComment)==null?void 0:ve.label)||((Me=r.fieldNameCommentCuesheet)==null?void 0:Me.label)||((Ue=r.fieldNameContent)==null?void 0:Ue.label);return r.disabled&&N});return e({editor:M}),(N,ve)=>{var se;const Me=Zp,Ue=Jp,mt=Yp,Et=Bf,z=p$,V=ZB;return i.unref(M)?(i.openBlock(),i.createElementBlock("div",{key:0,id:"vdc-editor",class:i.normalizeClass(["vdc-editor w-full flex flex-col",[N.editorClass,{"outline-ed-primary":i.unref(M).isFocused,"outline-ed-border":!i.unref(M).isFocused}]]),style:i.normalizeStyle(I.value)},[!N.hideBubble&&!N.disabled&&x.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[J([i.unref(dc)])?(i.openBlock(),i.createBlock(Me,{key:0,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0),J([i.unref(ua)])?(i.openBlock(),i.createBlock(Ue,{key:1,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0),J([i.unref(fs)])?(i.openBlock(),i.createBlock(mt,{key:2,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0),J([i.unref(ps),i.unref(hs)])?(i.openBlock(),i.createBlock(Et,{key:3,editor:i.unref(M)},null,8,["editor"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),N.hideToolbar?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(z,{key:1,editor:i.unref(M),"editor-comment":(se=ue.value)==null?void 0:se.editor,mode:N.mode,class:i.normalizeClass(["mb-2",N.toolBarClass])},null,8,["editor","editor-comment","mode","class"])),i.createElementVNode("div",{ref_key:"editorWrapRef",ref:ne,class:i.normalizeClass(["space-y-2 flex-1 flex flex-col break-keep",!C.value&&"[&_*]:!font-inherit [&_*]:!text-font-size-inherit",A.value&&!C.value?"[&_*]:!font-inherit":"",_.value&&!C.value?"[&_*]:!text-font-size-inherit":""]),style:i.normalizeStyle(T.value)},[be.value?(i.openBlock(),i.createBlock(V,{key:0,extensions:N.extensions,mode:N.mode,"hide-comment":N.hideComment,"field-name-comment":N.fieldNameComment,"field-name-comment-cuesheet":N.fieldNameCommentCuesheet,"field-name-content":N.fieldNameContent,comment:N.comment,"comment-cuesheet":N.commentCuesheet,content:N.modelValue,"min-chars":N.minChar.content,"font-size":_.value},null,8,["extensions","mode","hide-comment","field-name-comment","field-name-comment-cuesheet","field-name-content","comment","comment-cuesheet","content","min-chars","font-size"])):(i.openBlock(),i.createElementBlock("div",{key:1,class:"space-y-2 flex-1 flex flex-col",style:i.normalizeStyle({minWidth:`${F.value}px`})},[N.mode===i.unref(De).REPORT&&!N.hideComment?(i.openBlock(),i.createBlock(jZ,{key:0,ref_key:"editorCommentRef",ref:ue,mode:i.unref(De).REPORT,extensions:N.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":N.disableSuperInput,"is-open-super-view":Y.value,"super-preview-custom-class":N.superPreviewCustomClass,"min-char":N.minChar,"font-size":_.value,style:i.normalizeStyle(r.autoHeight?{height:"auto",minHeight:i.unref(an)(i.unref(We))}:{height:i.unref(an)(i.unref(xe)),minHeight:i.unref(an)(i.unref(Ee))}),class:"relative overflow-y-auto","onUpdate:modelValue":ve[0]||(ve[0]=ge=>o("update:comment",ge))},null,8,["mode","extensions","model-value","disabled","disable-super-input","is-open-super-view","super-preview-custom-class","min-char","font-size","style"])):i.createCommentVNode("",!0),i.createElementVNode("div",{id:"editor-container",class:"relative overflow-y-auto flex flex-col",style:i.normalizeStyle(r.autoHeight?{height:"auto",minHeight:i.unref(an)(i.unref(Ee))}:{height:i.unref(an)(i.unref($e))})},[i.createElementVNode("div",KZ,[i.withDirectives(i.createVNode(DZ,{ref_key:"superTextViewRef",ref:le,editor:i.unref(M),"super-preview-custom-class":N.superPreviewCustomClass,"min-chars":N.minChar.superPreview,"font-size":_.value},null,8,["editor","super-preview-custom-class","min-chars","font-size"]),[[i.vShow,Y.value]]),i.createElementVNode("div",{id:"editor-panel",ref_key:"contentInner",ref:j,class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},[i.createVNode(gb,{ref_key:"selectContextMenuRef",ref:Q,editor:i.unref(M),mode:N.mode,"super-text-store":i.unref(b)},{default:i.withCtx(()=>[i.createVNode(i.unref(Ao),{editor:i.unref(M),spellcheck:"true",class:i.normalizeClass(i.unref(ke)("h-full break-all",N.mode===i.unref(De).PLAIN_TEXT&&"plain-text"))},null,8,["editor","class"])]),_:1},8,["editor","mode","super-text-store"])],512)])],4)],4))],6)],6)):i.createCommentVNode("",!0)}}}),GZ=i.defineComponent({__name:"Switch",props:{defaultChecked:{type:Boolean},checked:{type:Boolean},disabled:{type:Boolean},required:{type:Boolean},name:{},id:{},value:{},asChild:{type:Boolean},as:{},class:{},customClassThumb:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{const{class:a,customClassThumb:l,...u}=n;return u}),s=It(o,r);return(a,l)=>(i.openBlock(),i.createBlock(i.unref(lD),i.mergeProps(i.unref(s),{class:i.unref(ke)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 focus-visible:ring-offset-ed-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-ed-primary data-[state=unchecked]:bg-ed-input",n.class)}),{default:i.withCtx(()=>[i.createVNode(i.unref(uD),{class:i.normalizeClass(i.unref(ke)("pointer-events-none block h-4 w-4 rounded-full bg-ed-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",n.customClassThumb))},null,8,["class"])]),_:1},16,["class"]))}}),XZ={class:"flex gap-2 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide"},YZ=i.defineComponent({__name:"ToolbarFormat",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[]}},setup(t){const{t:e}=Ot(),n=t,r=["fontSize","fontFamily","superText","spellchecker",dE],o=i.computed(()=>{const l=[...n.editor.extensionManager.extensions];let u=[];for(const c of l){const{button:f,divider:p=!1,spacer:m=!1,toolbar:g=!0}=c.options;if(!f||!_0(f)||!g)continue;const b=f({editor:n.editor,extension:c,t:i.unref(e),isMobile:!0});if(Array.isArray(b)){const y=b.map((w,x)=>({id:`${c.name}`,button:w,divider:x===b.length-1?p:!1,spacer:x===0?m:!1}));u=[...u,...y];continue}u.push({button:b,divider:p,spacer:m,id:`${c.name}`})}return n.activeExtensions.length?u.filter(c=>c.id&&n.activeExtensions.includes(c.id)):(r.length&&(u=u.filter(c=>c.id&&!r.includes(c.id))),u)}),s=l=>l.id==="spellchecker"?"!text-ed-blue !bg-white !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":l.button.componentProps.customClass,a=l=>l.id==="spellchecker"?"Spellchecker":l.button.componentProps.icon;return(l,u)=>(i.openBlock(),i.createElementBlock("div",{id:"tool-bar-format",class:i.normalizeClass(i.unref(ke)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2 px-2.5",!o.value.length&&"hidden"))},[i.createElementVNode("div",XZ,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(c,f)=>{var p;return i.openBlock(),i.createBlock(i.resolveDynamicComponent(c.button.component),i.mergeProps({key:f,id:c.id,ref_for:!0},c.button.componentProps,{editor:l.editor,disabled:l.disabled||((p=c.button.componentProps)==null?void 0:p.disabled),"custom-class":s(c),icon:a(c)}),i.createSlots({_:2},[i.renderList(c.button.componentSlots,(m,g,b)=>({name:`${g}`,fn:i.withCtx(y=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(m),i.mergeProps({ref_for:!0},y==null?void 0:y.props,{id:c.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])}),128))])],2))}}),JZ={class:"flex gap-2 items-center overflow-x-auto"},K5=i.defineComponent({__name:"ToolbarMobile",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[cE,fc,ub]}},setup(t){const{t:e}=Ot(),n=t,r=i.inject("isEditable",i.ref(!0)),o=i.computed(()=>{const u=[...n.editor.extensionManager.extensions],c=u.find(m=>m.name===ub);let f=u.sort((m,g)=>m.name==="spellchecker"?-1:g.name==="spellchecker"||m.name==="superText"?1:g.name==="superText"?-1:0);c&&(f=u.sort((m,g)=>m.name==="configPlan"?1:g.name==="configPlan"?-1:0));let p=[];for(const m of f){const{button:g,divider:b=!1,spacer:y=!1,toolbar:w=!0}=m.options;if(!g||!_0(g)||!w)continue;const x=g({editor:n.editor,extension:m,t:i.unref(e),isMobile:!0});if(Array.isArray(x)){const E=x.map((k,C)=>({id:`${m.name}`,button:k,divider:C===x.length-1?b:!1,spacer:C===0?y:!1}));p=[...p,...E];continue}p.push({button:x,divider:b,spacer:y,id:`${m.name}`})}if(!r.value){const m=p.find(g=>g.id==="superText");m&&(m.button.componentProps.disabled=!0)}return n.activeExtensions.length?p.filter(m=>m.id&&n.activeExtensions.includes(m.id)):p}),s=u=>u.id==="spellchecker"?"!text-ed-blue data-[state=off]:bg-white dark:data-[state=off]:bg-ed-accent/40 !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":u.button.componentProps.customClass,a=u=>u.id==="spellchecker"?"Spellchecker":u.button.componentProps.icon,l=i.ref(!1);return(u,c)=>{const f=fE;return i.openBlock(),i.createElementBlock("div",{id:"tool-bar",class:i.normalizeClass(i.unref(ke)("z-10 border border-ed-input rounded-[5px] px-2.5 py-[5px] leading-none",i.unref(ff)()&&"top-16",!o.value.length&&"hidden"))},[i.createElementVNode("div",JZ,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(p,m)=>{var g,b,y;return i.openBlock(),i.createElementBlock(i.Fragment,{key:m},[p.spacer&&m!==0?(i.openBlock(),i.createBlock(i.unref(ci),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.resolveDynamicComponent(p.button.component),i.mergeProps({id:p.id,ref_for:!0},p.button.componentProps,{editor:u.editor,disabled:u.disabled||((g=p.button.componentProps)==null?void 0:g.disabled),"custom-class":s(p),icon:a(p)}),i.createSlots({_:2},[i.renderList(p.button.componentSlots,(w,x,E)=>({name:`${x}`,fn:i.withCtx(k=>[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(w),i.mergeProps({ref_for:!0},k==null?void 0:k.props,{id:p.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),p.id===fc&&i.unref(l)?(i.openBlock(),i.createBlock(f,{key:1,class:"bg-white border-inherit w-[26px] h-[26px] shadow-none",checked:(y=(b=p.button.componentProps).isActive)==null?void 0:y.call(b),"onUpdate:checked":w=>{var x,E;return(E=(x=p.button.componentProps).action)==null?void 0:E.call(x)}},null,8,["checked","onUpdate:checked"])):i.createCommentVNode("",!0),p.divider?(i.openBlock(),i.createBlock(i.unref(ci),{key:2,orientation:"vertical",class:"mx-2 h-auto"})):i.createCommentVNode("",!0)],64)}),128))])],2)}}}),ZZ={class:"flex w-fit rounded-md bg-ed-gray-600 text-white max-w-full overflow-x-auto"},QZ=Bo(i.defineComponent({__name:"MainBubbleMenuList",props:{editor:{},mode:{},disableSuperInput:{type:Boolean},hasClipboard:{type:Boolean}},emits:["close-long-press-menu"],setup(t,{emit:e}){var f;const n=t,r=e,{t:o}=Ot(),s=i.computed(()=>[...n.editor.extensionManager.extensions].find(m=>m.name==="superText")),a=i.ref(!1),l=(f=n.editor.extensionManager.extensions.find(p=>p.name==="superText"))==null?void 0:f.options.specialCharModal,u=p=>{const{state:m}=n.editor,{from:g}=m.selection;n.editor.commands.insertContentAt(g,p)},c=()=>{n.editor.chain().focus().toggleSuperInputMoblie().run(),r("close-long-press-menu");const p=DK(n.editor);n.editor.commands.setSuperTextContent(p)};return(p,m)=>{var g,b,y;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("div",ZZ,[i.unref(s)&&!p.disableSuperInput&&p.mode!==i.unref(De).EDITOR?(i.openBlock(),i.createElementBlock("button",{key:0,class:"bubble-menu-item",onClick:c},i.toDisplayString(i.unref(o)("editor.super")),1)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[0]||(m[0]=w=>a.value=!0)},i.toDisplayString(i.unref(o)("editor.insertSpecial")),1),p.hasClipboard?(i.openBlock(),i.createElementBlock("button",{key:1,class:"bubble-menu-item",onClick:m[1]||(m[1]=w=>p.editor.chain().focus().pasteContent().run())},i.toDisplayString(i.unref(o)("editor.paste")),1)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[2]||(m[2]=w=>p.editor.chain().focus().cutContent().run())},i.toDisplayString(i.unref(o)("editor.cut")),1),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[3]||(m[3]=()=>{p.editor.chain().focus().copyContent().setTextSelection(0).blur().run(),r("close-long-press-menu")})},i.toDisplayString(i.unref(o)("editor.copy")),1),i.createElementVNode("button",{class:"bubble-menu-item",onClick:m[4]||(m[4]=w=>p.editor.chain().focus().selectAll().run())},i.toDisplayString(i.unref(o)("editor.selectAll")),1)]),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent((g=i.unref(l))==null?void 0:g.component),{"is-open":i.unref(a),open:i.unref(a),class:i.normalizeClass((y=(b=i.unref(l))==null?void 0:b.componentProps)==null?void 0:y.class),onSelectedChar:u,onClose:m[5]||(m[5]=w=>a.value=!1)},null,40,["is-open","open","class"]))]))],64)}}}),[["__scopeId","data-v-e8f0c575"]]);class G5{isNativeWebViewAvailable(){return window.ReactNativeWebView!==void 0}getDevicePlatform(){var r;if(!this.isNativeWebViewAvailable())return;if(typeof window.webkit=="object"&&typeof((r=window.webkit)==null?void 0:r.messageHandlers)=="object")return E0.IOS;const n=navigator.userAgent.toLowerCase();if(n.includes("android"))return E0.ANDROID;if(n.includes("iphone")||n.includes("ipad")||n.includes("ipod"))return E0.IOS}sendToNative(e,n){if(window.ReactNativeWebView){const r={type:e,data:n};window.ReactNativeWebView.postMessage(JSON.stringify(r)),console.log(`Sent message to native: ${e}`)}else console.log("ReactNativeWebView not available")}receiveDataFromNative(e,n){const r=window.receiveDriverData;window.receiveDriverData=o=>{try{const s=JSON.parse(o);s.type===e?(console.log(`Received data from native ${e}`),n(s.data)):r&&r(o)}catch(s){console.log("Error parsing data from native",s)}}}}const X5=i.defineComponent({__name:"MainBubbleMenu",props:{editor:{},mode:{},disableSuperInput:{type:Boolean}},setup(t){const e=t,n=new G5,r=i.ref(!1),o=async()=>{var g,b;const m=await((b=(g=e.editor).hasClipboard)==null?void 0:b.call(g));r.value=!!m},s={duration:200,placement:"bottom",appendTo:()=>document.body.querySelector(".splitpanes__pane"),onShow:()=>{o(),n.sendToNative("hideIOSEditMenu")},getReferenceClientRect:()=>{if(e.editor&&!e.editor.isDestroyed){const{view:m,state:g}=e.editor,{from:b,to:y}=g.selection,w=m.dom.getBoundingClientRect(),x=m.coordsAtPos(b),E=m.coordsAtPos(y),k=Math.min(x.top,E.top),_=Math.max(x.bottom,E.bottom)-k;return new DOMRect(w.left,k,w.width,_)}return null}},a=i.ref(null),l=i.ref(!1),u=({editor:m,state:g})=>["image","superText","link"].some(w=>m.isActive(w))?!1:!g.selection.empty||l.value;function c(m){return f(m)&&m.touches.length>0?{x:m.touches[0].clientX,y:m.touches[0].clientY}:f(m)&&m.changedTouches.length>0?{x:m.changedTouches[0].clientX,y:m.changedTouches[0].clientY}:m instanceof MouseEvent?{x:m.clientX,y:m.clientY}:window.PointerEvent&&m instanceof PointerEvent?{x:m.clientX,y:m.clientY}:null}function f(m){return"touches"in m}function p(m){if(!e.editor)return;const g=c(m);if(!g)return;const b=e.editor.view,y=b.state,w=b.posAtCoords({left:g.x,top:g.y});if(!w||w.inside===-1)return;const x=w.pos,E=y.doc.content.size,k=Math.min(x+1,E);let C=y.tr;C=C.setSelection(Te.create(y.doc,x,k)),b.dispatch(C),requestAnimationFrame(()=>{const _=b.state.tr.setSelection(Te.create(b.state.doc,x,x));b.dispatch(_),b.focus()})}return i.onMounted(()=>{const m=e.editor.view.dom;ht.onLongPress(i.ref(m),y=>{l.value=!0,p(y)},{delay:500,modifiers:{prevent:!1}});const g=()=>{e.editor.state.selection.empty&&(l.value=!1)};m.addEventListener("pointerdown",g);const b=({transaction:y})=>{l.value&&y.docChanged&&(l.value=!1,i.nextTick(()=>{var w;try{const x=(w=a.value)==null?void 0:w.$el;x&&x._tippy&&typeof x._tippy.hide=="function"&&x._tippy.hide()}catch{const E=e.editor.view,k=E.state,C=k.selection.from,_=k.doc.content.size,A=Math.min(C+1,_);E.dispatch(k.tr.setSelection(Te.create(k.doc,C,A))),requestAnimationFrame(()=>{E.dispatch(E.state.tr.setSelection(Te.create(E.state.doc,C,C)))})}}))};e.editor.on("transaction",b),i.onUnmounted(()=>{m.removeEventListener("pointerdown",g),e.editor.off("transaction",b)})}),(m,g)=>(i.openBlock(),i.createBlock(i.unref(Su),{ref_key:"bubbleMenuRef",ref:a,editor:m.editor,"tippy-options":s,"should-show":u},{default:i.withCtx(()=>[i.createVNode(QZ,{editor:m.editor,mode:m.mode,disableSuperInput:m.disableSuperInput,hasClipboard:i.unref(r),onCloseLongPressMenu:g[0]||(g[0]=b=>l.value=!1)},null,8,["editor","mode","disableSuperInput","hasClipboard"])]),_:1},8,["editor"]))}}),NZ={class:"flex items-center justify-between label-large mb-2"},eQ={class:"mb-5"},tQ={class:"flex gap-x-3"},nQ=i.defineComponent({__name:"SuperInputBottomSheet",props:{editor:{},open:{type:Boolean},bottomSheetComponent:{}},emits:["save","close"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(""),s=i.ref(""),a=i.computed(()=>Mp(o.value)),l=()=>{o.value="",s.value="",n.editor.commands.setSuperTextContent(o.value,s.value)},u=()=>{l(),r("close")};i.watch(()=>n.open,()=>{n.open&&(o.value=n.editor.storage.superText.superTextContent,s.value=n.editor.storage.superText.superTextPosition)});const c=()=>{o.value=n.editor.storage.superText.superTextContent},f=()=>{r("save",o.value,s.value),l()};return(p,m)=>{var b;const g=Lt;return i.openBlock(),i.createBlock(i.resolveDynamicComponent((b=p.bottomSheetComponent)==null?void 0:b.component),{"is-open":p.open,type:"bottom",title:"수퍼 입력",onOnClose:u},{customContent:i.withCtx(()=>{var y;return[i.createElementVNode("div",NZ,[m[2]||(m[2]=i.createElementVNode("span",null,"내용",-1)),(i.openBlock(),i.createBlock(i.resolveDynamicComponent((y=p.bottomSheetComponent)==null?void 0:y.button),{class:"w-fit [&_svg]:size-6 text-blue",variant:"ghost",size:"icon",onClick:c},{default:i.withCtx(()=>[i.createVNode(g,{name:"reset",class:"h-5 w-5"}),m[1]||(m[1]=i.createElementVNode("span",null,"초기화",-1))]),_:1}))])]}),body:i.withCtx(()=>[i.createElementVNode("div",eQ,[i.createVNode(mb,{modelValue:i.unref(o),"onUpdate:modelValue":m[0]||(m[0]=y=>i.isRef(o)?o.value=y:null),"parent-editor":p.editor,"spellcheck-enabled":!1,autofocus:"end"},null,8,["modelValue","parent-editor"])])]),footer:i.withCtx(()=>{var y,w;return[i.createElementVNode("div",tQ,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent((y=p.bottomSheetComponent)==null?void 0:y.button),{variant:"outline",onClick:u},{default:i.withCtx(()=>m[3]||(m[3]=[i.createTextVNode(" 취소 ")])),_:1})),(i.openBlock(),i.createBlock(i.resolveDynamicComponent((w=p.bottomSheetComponent)==null?void 0:w.button),{disabled:i.unref(a),variant:i.unref(a)?"disabled":"default",onClick:f},{default:i.withCtx(()=>m[4]||(m[4]=[i.createTextVNode(" 입력 ")])),_:1},8,["disabled","variant"]))])]}),_:1},40,["is-open"])}}}),rQ=Dn.create({name:"diffDel",parseHTML(){return[{tag:"span.diff-del"}]},renderHTML({HTMLAttributes:t}){return["span",{class:"diff-del",...t},0]}}),oQ=i.defineComponent({__name:"EditorCommentMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useAttrs(),a=wn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,p=i.inject("isEditable",i.ref(!0)),m=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled),editorProps:{attributes:{id:or.COMMENT,[or.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:rt.throttle((x,E)=>E.key==="Enter"&&s.enter&&!E.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:x=>(x=x.replace(/\s*style="[^"]*"/g,""),x)},onCreate:({editor:x})=>{c(x)},onUpdate:rt.throttle(({editor:x})=>{l.value=!0;const E=b(x,r.output);o("update:modelValue",E),o("change",{editor:x,output:E}),c(x)},Mo),extensions:[rQ,...rt.uniqBy(rt.reverse(i.unref(r.extensions)),"name")],editable:p.value,onFocus:()=>{g()},onBlur:({editor:x,event:E})=>{o("onBlurEditor",E)}});function g(){o("setEditorSelected",m)}g();function b(x,E){if(!x)return"";if(x.isEmpty)return E==="json"?{}:"";switch(E){case"html":return x.getHTML();case"json":return x.getJSON();case"text":return x.getText();default:return""}}function y(x){return x.every(E=>m==null?void 0:m.extensionManager.extensions.find(k=>k.name===E))}i.watch(()=>f.languages,()=>{m.commands.checkSpelling()}),i.watch(()=>r.modelValue,x=>{if(!m||rt.isEqual(b(m,r.output),x))return;const{from:E,to:k}=m.state.selection;m.commands.setTextSelection({from:E,to:k}),m.commands.setContent(Vn(x,r.disabled),!1)},{deep:!0}),i.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:x})=>{o("changed:selection",{editor:x})})}),i.watch(()=>r.disableSuperInput,()=>{const x=document.getElementById(or.COMMENT);x==null||x.setAttribute(or.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),i.onUnmounted(()=>m==null?void 0:m.destroy()),Ju(_u.SAVE,()=>{localStorage.setItem("comment",b(m,"html"))});function w(x){m.commands.focus("end"),g()}return Qp(m),i.onMounted(()=>{var x;r.autoFocus&&w(r.mode),(x=m==null?void 0:m.commands)!=null&&x.setIsMobile&&m.commands.setIsMobile(!0)}),i.watch(()=>r.mode,x=>{r.autoFocus&&w()}),i.watch(()=>p.value,x=>{var E;m==null||m.setEditable(x),(E=m==null?void 0:m.commands)!=null&&E.setIsEnableSuggestion&&m.commands.setIsEnableSuggestion(x)},{immediate:!0}),e({editor:m}),(x,E)=>{const k=X5,C=Zp,_=Jp,A=Yp,T=Bf;return i.openBlock(),i.createElementBlock(i.Fragment,null,[!x.hideBubble&&!x.disabled&&i.unref(p)?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createVNode(k,{editor:i.unref(m),mode:x.mode,"disable-super-input":x.disableSuperInput},null,8,["editor","mode","disable-super-input"]),y([i.unref(dc)])?(i.openBlock(),i.createBlock(C,{key:0,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0),y([i.unref(ua)])?(i.openBlock(),i.createBlock(_,{key:1,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0),y([i.unref(fs)])?(i.openBlock(),i.createBlock(A,{key:2,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0),y([i.unref(ps),i.unref(hs)])?(i.openBlock(),i.createBlock(T,{key:3,editor:i.unref(m)},null,8,["editor"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),i.createVNode(i.unref(Ao),{id:"editor-panel",editor:i.unref(m),spellcheck:"true",class:i.normalizeClass(["flex-1 flex-col relative"])},null,8,["editor"])],64)}}}),Yb={__name:"splitpanes",props:{horizontal:{type:Boolean,default:!1},pushOtherPanes:{type:Boolean,default:!0},maximizePanes:{type:Boolean,default:!0},rtl:{type:Boolean,default:!1},firstSplitter:{type:Boolean,default:!1}},emits:["ready","resize","resized","pane-click","pane-maximize","pane-add","pane-remove","splitter-click","splitter-dblclick"],setup(t,{emit:e}){const n=e,r=t,o=i.useSlots(),s=i.ref([]),a=i.computed(()=>s.value.reduce((Q,oe)=>(Q[~~oe.id]=oe)&&Q,{})),l=i.computed(()=>s.value.length),u=i.ref(null),c=i.ref(!1),f=i.ref({mouseDown:!1,dragging:!1,activeSplitter:null,cursorOffset:0}),p=i.ref({splitter:null,timeoutId:null}),m=i.computed(()=>({[`splitpanes splitpanes--${r.horizontal?"horizontal":"vertical"}`]:!0,"splitpanes--dragging":f.value.dragging})),g=()=>{document.addEventListener("mousemove",w,{passive:!1}),document.addEventListener("mouseup",x),"ontouchstart"in window&&(document.addEventListener("touchmove",w,{passive:!1}),document.addEventListener("touchend",x))},b=()=>{document.removeEventListener("mousemove",w,{passive:!1}),document.removeEventListener("mouseup",x),"ontouchstart"in window&&(document.removeEventListener("touchmove",w,{passive:!1}),document.removeEventListener("touchend",x))},y=(Q,oe)=>{const ue=Q.target.closest(".splitpanes__splitter");if(ue){const{left:ce,top:be}=ue.getBoundingClientRect(),{clientX:N,clientY:ve}="ontouchstart"in window&&Q.touches?Q.touches[0]:Q;f.value.cursorOffset=r.horizontal?ve-be:N-ce}g(),f.value.mouseDown=!0,f.value.activeSplitter=oe},w=Q=>{f.value.mouseDown&&(Q.preventDefault(),f.value.dragging=!0,requestAnimationFrame(()=>{T(_(Q)),Ee("resize",{event:Q},!0)}))},x=Q=>{f.value.dragging&&(window.getSelection().removeAllRanges(),Ee("resized",{event:Q},!0)),f.value.mouseDown=!1,f.value.activeSplitter=null,setTimeout(()=>{f.value.dragging=!1,b()},100)},E=(Q,oe)=>{"ontouchstart"in window&&(Q.preventDefault(),p.value.splitter===oe?(clearTimeout(p.value.timeoutId),p.value.timeoutId=null,k(Q,oe),p.value.splitter=null):(p.value.splitter=oe,p.value.timeoutId=setTimeout(()=>p.value.splitter=null,500))),f.value.dragging||Ee("splitter-click",{event:Q,index:oe},!0)},k=(Q,oe)=>{if(Ee("splitter-dblclick",{event:Q,index:oe},!0),r.maximizePanes){let ue=0;s.value=s.value.map((ce,be)=>(ce.size=be===oe?ce.max:ce.min,be!==oe&&(ue+=ce.min),ce)),s.value[oe].size-=ue,Ee("pane-maximize",{event:Q,index:oe,pane:s.value[oe]}),Ee("resized",{event:Q,index:oe},!0)}},C=(Q,oe)=>{Ee("pane-click",{event:Q,index:a.value[oe].index,pane:a.value[oe]})},_=Q=>{const oe=u.value.getBoundingClientRect(),{clientX:ue,clientY:ce}="ontouchstart"in window&&Q.touches?Q.touches[0]:Q;return{x:ue-(r.horizontal?0:f.value.cursorOffset)-oe.left,y:ce-(r.horizontal?f.value.cursorOffset:0)-oe.top}},A=Q=>{Q=Q[r.horizontal?"y":"x"];const oe=u.value[r.horizontal?"clientHeight":"clientWidth"];return r.rtl&&!r.horizontal&&(Q=oe-Q),Q*100/oe},T=Q=>{const oe=f.value.activeSplitter;let ue={prevPanesSize:I(oe),nextPanesSize:M(oe),prevReachedMinPanes:0,nextReachedMinPanes:0};const ce=0+(r.pushOtherPanes?0:ue.prevPanesSize),be=100-(r.pushOtherPanes?0:ue.nextPanesSize),N=Math.max(Math.min(A(Q),be),ce);let ve=[oe,oe+1],Me=s.value[ve[0]]||null,Ue=s.value[ve[1]]||null;const mt=Me.max<100&&N>=Me.max+ue.prevPanesSize,Et=Ue.max<100&&N<=100-(Ue.max+M(oe+1));if(mt||Et){mt?(Me.size=Me.max,Ue.size=Math.max(100-Me.max-ue.prevPanesSize-ue.nextPanesSize,0)):(Me.size=Math.max(100-Ue.max-ue.prevPanesSize-M(oe+1),0),Ue.size=Ue.max);return}if(r.pushOtherPanes){const z=P(ue,N);if(!z)return;({sums:ue,panesToResize:ve}=z),Me=s.value[ve[0]]||null,Ue=s.value[ve[1]]||null}Me!==null&&(Me.size=Math.min(Math.max(N-ue.prevPanesSize-ue.prevReachedMinPanes,Me.min),Me.max)),Ue!==null&&(Ue.size=Math.min(Math.max(100-N-ue.nextPanesSize-ue.nextReachedMinPanes,Ue.min),Ue.max))},P=(Q,oe)=>{const ue=f.value.activeSplitter,ce=[ue,ue+1];return oe<Q.prevPanesSize+s.value[ce[0]].min&&(ce[0]=j(ue).index,Q.prevReachedMinPanes=0,ce[0]<ue&&s.value.forEach((be,N)=>{N>ce[0]&&N<=ue&&(be.size=be.min,Q.prevReachedMinPanes+=be.min)}),Q.prevPanesSize=I(ce[0]),ce[0]===void 0)?(Q.prevReachedMinPanes=0,s.value[0].size=s.value[0].min,s.value.forEach((be,N)=>{N>0&&N<=ue&&(be.size=be.min,Q.prevReachedMinPanes+=be.min)}),s.value[ce[1]].size=100-Q.prevReachedMinPanes-s.value[0].min-Q.prevPanesSize-Q.nextPanesSize,null):oe>100-Q.nextPanesSize-s.value[ce[1]].min&&(ce[1]=U(ue).index,Q.nextReachedMinPanes=0,ce[1]>ue+1&&s.value.forEach((be,N)=>{N>ue&&N<ce[1]&&(be.size=be.min,Q.nextReachedMinPanes+=be.min)}),Q.nextPanesSize=M(ce[1]-1),ce[1]===void 0)?(Q.nextReachedMinPanes=0,s.value.forEach((be,N)=>{N<l.value-1&&N>=ue+1&&(be.size=be.min,Q.nextReachedMinPanes+=be.min)}),s.value[ce[0]].size=100-Q.prevPanesSize-M(ce[0]-1),null):{sums:Q,panesToResize:ce}},I=Q=>s.value.reduce((oe,ue,ce)=>oe+(ce<Q?ue.size:0),0),M=Q=>s.value.reduce((oe,ue,ce)=>oe+(ce>Q+1?ue.size:0),0),j=Q=>[...s.value].reverse().find(oe=>oe.index<Q&&oe.size>oe.min)||{},U=Q=>s.value.find(oe=>oe.index>Q+1&&oe.size>oe.min)||{},q=()=>{var Q;const oe=Array.from(((Q=u.value)==null?void 0:Q.children)||[]);for(const ue of oe){const ce=ue.classList.contains("splitpanes__pane"),be=ue.classList.contains("splitpanes__splitter");!ce&&!be&&(ue.remove(),console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."))}},le=(Q,oe,ue=!1)=>{const ce=Q-1,be=document.createElement("div");be.classList.add("splitpanes__splitter"),ue||(be.onmousedown=N=>y(N,ce),typeof window<"u"&&"ontouchstart"in window&&(be.ontouchstart=N=>y(N,ce)),be.onclick=N=>E(N,ce+1)),be.ondblclick=N=>k(N,ce+1),oe.parentNode.insertBefore(be,oe)},H=Q=>{Q.onmousedown=void 0,Q.onclick=void 0,Q.ondblclick=void 0,Q.remove()},F=()=>{var Q;const oe=Array.from(((Q=u.value)==null?void 0:Q.children)||[]);for(const ce of oe)ce.className.includes("splitpanes__splitter")&&H(ce);let ue=0;for(const ce of oe)ce.className.includes("splitpanes__pane")&&(!ue&&r.firstSplitter?le(ue,ce,!0):ue&&le(ue,ce),ue++)},L=({uid:Q,...oe})=>{const ue=a.value[Q];for(const[ce,be]of Object.entries(oe))ue[ce]=be},K=Q=>{var oe;let ue=-1;Array.from(((oe=u.value)==null?void 0:oe.children)||[]).some(ce=>(ce.className.includes("splitpanes__pane")&&ue++,ce.isSameNode(Q.el))),s.value.splice(ue,0,{...Q,index:ue}),s.value.forEach((ce,be)=>ce.index=be),c.value&&i.nextTick(()=>{F(),Y({addedPane:s.value[ue]}),Ee("pane-add",{pane:s.value[ue]})})},J=Q=>{const oe=s.value.findIndex(ce=>ce.id===Q);s.value[oe].el=null;const ue=s.value.splice(oe,1)[0];s.value.forEach((ce,be)=>ce.index=be),i.nextTick(()=>{F(),Ee("pane-remove",{pane:ue}),Y({removedPane:{...ue}})})},Y=(Q={})=>{!Q.addedPane&&!Q.removedPane?we():s.value.some(oe=>oe.givenSize!==null||oe.min||oe.max<100)?xe(Q):ne(),c.value&&Ee("resized")},ne=()=>{const Q=100/l.value;let oe=0;const ue=[],ce=[];for(const be of s.value)be.size=Math.max(Math.min(Q,be.max),be.min),oe-=be.size,be.size>=be.max&&ue.push(be.id),be.size<=be.min&&ce.push(be.id);oe>.1&&$e(oe,ue,ce)},we=()=>{let Q=100;const oe=[],ue=[];let ce=0;for(const N of s.value)Q-=N.size,N.givenSize!==null&&ce++,N.size>=N.max&&oe.push(N.id),N.size<=N.min&&ue.push(N.id);let be=100;if(Q>.1){for(const N of s.value)N.givenSize===null&&(N.size=Math.max(Math.min(Q/(l.value-ce),N.max),N.min)),be-=N.size;be>.1&&$e(be,oe,ue)}},xe=({addedPane:Q,removedPane:oe}={})=>{let ue=100/l.value,ce=0;const be=[],N=[];((Q==null?void 0:Q.givenSize)??null)!==null&&(ue=(100-Q.givenSize)/(l.value-1));for(const ve of s.value)ce-=ve.size,ve.size>=ve.max&&be.push(ve.id),ve.size<=ve.min&&N.push(ve.id);if(!(Math.abs(ce)<.1)){for(const ve of s.value)(Q==null?void 0:Q.givenSize)!==null&&(Q==null?void 0:Q.id)===ve.id||(ve.size=Math.max(Math.min(ue,ve.max),ve.min)),ce-=ve.size,ve.size>=ve.max&&be.push(ve.id),ve.size<=ve.min&&N.push(ve.id);ce>.1&&$e(ce,be,N)}},$e=(Q,oe,ue)=>{let ce;Q>0?ce=Q/(l.value-oe.length):ce=Q/(l.value-ue.length),s.value.forEach((be,N)=>{if(Q>0&&!oe.includes(be.id)){const ve=Math.max(Math.min(be.size+ce,be.max),be.min),Me=ve-be.size;Q-=Me,be.size=ve}else if(!ue.includes(be.id)){const ve=Math.max(Math.min(be.size+ce,be.max),be.min),Me=ve-be.size;Q-=Me,be.size=ve}}),Math.abs(Q)>.1&&i.nextTick(()=>{c.value&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints.")})},Ee=(Q,oe=void 0,ue=!1)=>{const ce=(oe==null?void 0:oe.index)??f.value.activeSplitter??null;n(Q,{...oe,...ce!==null&&{index:ce},...ue&&ce!==null&&{prevPane:s.value[ce-(r.firstSplitter?1:0)],nextPane:s.value[ce+(r.firstSplitter?0:1)]},panes:s.value.map(be=>({min:be.min,max:be.max,size:be.size}))})};i.watch(()=>r.firstSplitter,()=>F()),i.onMounted(()=>{q(),F(),Y(),Ee("ready"),c.value=!0}),i.onBeforeUnmount(()=>c.value=!1);const We=()=>{var Q;return i.h("div",{ref:u,class:m.value},(Q=o.default)==null?void 0:Q.call(o))};return i.provide("panes",s),i.provide("indexedPanes",a),i.provide("horizontal",i.computed(()=>r.horizontal)),i.provide("requestUpdate",L),i.provide("onPaneAdd",K),i.provide("onPaneRemove",J),i.provide("onPaneClick",C),(Q,oe)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(We)))}},ba={__name:"pane",props:{size:{type:[Number,String]},minSize:{type:[Number,String],default:0},maxSize:{type:[Number,String],default:100}},setup(t){var e;const n=t,r=i.inject("requestUpdate"),o=i.inject("onPaneAdd"),s=i.inject("horizontal"),a=i.inject("onPaneRemove"),l=i.inject("onPaneClick"),u=(e=i.getCurrentInstance())==null?void 0:e.uid,c=i.inject("indexedPanes"),f=i.computed(()=>c.value[u]),p=i.ref(null),m=i.computed(()=>{const w=isNaN(n.size)||n.size===void 0?0:parseFloat(n.size);return Math.max(Math.min(w,b.value),g.value)}),g=i.computed(()=>{const w=parseFloat(n.minSize);return isNaN(w)?0:w}),b=i.computed(()=>{const w=parseFloat(n.maxSize);return isNaN(w)?100:w}),y=i.computed(()=>{var w;return`${s.value?"height":"width"}: ${(w=f.value)==null?void 0:w.size}%`});return i.watch(()=>m.value,w=>r({uid:u,size:w})),i.watch(()=>g.value,w=>r({uid:u,min:w})),i.watch(()=>b.value,w=>r({uid:u,max:w})),i.onMounted(()=>{o({id:u,el:p.value,min:g.value,max:b.value,givenSize:n.size===void 0?null:m.value,size:m.value})}),i.onBeforeUnmount(()=>a(u)),(w,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"paneEl",ref:p,class:"splitpanes__pane",onClick:x[0]||(x[0]=E=>i.unref(l)(E,w._.uid)),style:i.normalizeStyle(y.value)},[i.renderSlot(w.$slots,"default")],4))}},Y5=i.defineComponent({__name:"ToolbarTitle",props:{titleBar:{},customClass:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("h3",{class:i.normalizeClass(i.unref(ke)("rounded-[5px] px-2.5 py-[5px] min-h-[32px] flex items-center bg-ed-gray-500",[e.customClass],[e.titleBar.bgClass]))},i.toDisplayString(e.titleBar.title),3))}}),iQ={class:"text-red-500 relative -top-1"},eh=i.defineComponent({__name:"EditorFieldName",props:{fieldName:{},mode:{},disabled:{type:Boolean,default:!1},isRequired:{type:Boolean,default:!1}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(ke)("label-large",e.fieldName.customClass))},[i.createElementVNode("span",null,i.toDisplayString(e.fieldName.label),1),i.withDirectives(i.createElementVNode("span",iQ," •",512),[[i.vShow,e.fieldName.isRequired]])],2))}});function J5(t=!1,e=10){const n=e,r=90,o=50,s=n+1,a=i.ref(!0),l=i.ref(!0),u=i.ref(o),c=i.ref(o);return{HEADER_ONLY_SIZE:n,FULL_SIZE:r,SPLIT_SIZE:o,pane1ContentVisible:a,pane2ContentVisible:l,pane1Size:u,pane2Size:c,togglePane:m=>{if(i.unref(t)){l.value?(l.value=!1,c.value=n):(l.value=!0,c.value=r+n);return}if(m==="pane1"){a.value&&l.value?(a.value=!1,u.value=n,c.value=r):a.value&&!l.value?(a.value=!1,l.value=!0,u.value=n,c.value=r):!a.value&&l.value?(a.value=!0,u.value=o,c.value=o):(a.value=!0,u.value=r,c.value=n);return}m==="pane2"&&(a.value&&l.value?(l.value=!1,u.value=r,c.value=n):l.value&&!a.value?(l.value=!1,a.value=!0,u.value=r,c.value=n):!l.value&&a.value?(l.value=!0,u.value=o,c.value=o):(l.value=!0,u.value=n,c.value=r))},handlePaneResize:m=>{const g=m.panes;if(g&&g.length>=2){const b=g[0].size,y=g[1].size;u.value=b,c.value=y,b>n&&!a.value&&(a.value=!0),y>n&&!l.value&&(l.value=!0),b<=s&&a.value&&(a.value=!1),y<=s&&l.value&&(l.value=!1)}}}}const sQ={class:"flex justify-between items-center relative"},Cc=i.defineComponent({__name:"CoreEditorMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean,default:!1},customClassFormatControlBar:{default:""},titleBarComment:{default:null},titleBarContent:{default:null},fieldNameComment:{default:null},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{default:!1},isShowLineNumber:{type:Boolean,default:!1},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{default:void 0},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){var ze;const r=t,o=n,s=new G5;i.provide("isMobile",!0);const a=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE),l=i.useAttrs(),u=wn(),{state:c,isFullscreen:f,isReady:p,editor:m,updateEditorState:g,checkSpellStore:b,setImageAttachment:y,setEditorContentMobile:w}=u,{markAsFocused:x,insertHtml:E}=yZ(),k=i.ref(!r.disabled&&!r.readonly);i.provide("isEditable",k);const C=i.computed(()=>[...c.extensions,...rt.differenceBy(r.extensions,c.extensions,"name")].map((D,Z)=>D.configure({sort:Z}))),_=i.ref(r.fontSizeDefault),A=i.ref(r.fontFamilyDefault);i.provide("fontSize",_),i.provide("fontFamily",A);const T=i.computed(()=>({fontFamily:A.value,fontSize:_.value})),P=i.ref(),{height:I}=ht.useWindowSize(),M=i.computed(()=>{var Z;if(L.value)return{bottom:"15px"};const D=((Z=P.value)==null?void 0:Z.getBoundingClientRect().bottom)||0;return{bottom:`${I.value-D+10}px`}}),j=D=>{const Z=parseInt(_.value||"12px"),ee=D?Z+2:Z-2;_.value=ee+"px"};i.onBeforeMount(()=>{a.on(j)}),i.onBeforeUnmount(()=>{a.off(j)});const U=i.computed(()=>({...i.unref(f)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),q=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:rt.throttle((D,Z)=>Z.key==="Enter"&&l.enter&&!Z.shiftKey?(o("enter"),!0):!1,Mo),transformPastedHTML:D=>(D=D.replace(/\s*style="[^"]*"/g,""),D),handlePaste(D,Z){var Je;if(r.mode!==De.PLAIN_TEXT)return!1;Z.preventDefault();const ee=((Je=Z.clipboardData)==null?void 0:Je.getData("text/plain"))||"",{tr:he,selection:Fe}=D.state;return D.dispatch(he.insertText(ee,Fe.from)),!0}},onCreate:({editor:D})=>{g(D)},onUpdate:rt.throttle(({editor:D})=>{p.value=!0;const Z=xe(D,r.output);o("update:modelValue",Z),o("change",{editor:D,output:Z}),g(D),le(D)},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(C)),"name"),editable:k.value,onFocus:D=>{ne(),o("onFocus",D),x()},onBlur:D=>o("onBlur",D),parseOptions:{preserveWhitespace:"full"}});function le(D){const Z=[];D.state.doc.descendants(ee=>{ee.type.name==="image"&&Z.push({id:ee.attrs.id,src:ee.attrs.src})}),y(Z)}const H=i.ref(),F=i.ref(!0),L=i.ref(!1);function K(){s.isNativeWebViewAvailable()&&(s.receiveDataFromNative("keyboardDidShow",D=>{L.value=!0}),s.receiveDataFromNative("keyboardDidHide",D=>{L.value=!1}))}function J(D){const Z=document.querySelectorAll('[contenteditable="true"]:not(.tiptap), .simple-editor, input, textarea'),ee=Array.from(Z).some(he=>he.contains(D.target));if(D.type==="focusout"){F.value=!0;return}F.value=!ee}ht.useEventListener(document,"focusin",J),ht.useEventListener(document,"focusout",J),i.onMounted(()=>{ne(q),w(q),K()});const Y=i.computed(()=>r.isShowFormatControlBar&&F.value&&!L.value);function ne(D){H.value=D??q,u.setEditorSelectedMobile(H.value)}const we=i.computed(()=>q.storage.superText.isShowSuperInputMoblie);function xe(D,Z){if(!D)return"";if(D.isEmpty)return Z==="json"?{}:"";if(r.mode===De.PLAIN_TEXT)return D.getText({blockSeparator:`
|
|
303
303
|
`});switch(Z){case"html":return D.getHTML();case"json":return D.getJSON();case"text":return D.getText({blockSeparator:`
|
|
304
|
-
`});default:return""}}function $e(D){return D.every(Z=>q==null?void 0:q.extensionManager.extensions.find(ee=>ee.name===Z))}i.watch(()=>b.languages,()=>{q.commands.checkSpelling()}),i.watch(()=>r.modelValue,D=>{if(!q||rt.isEqual(xe(q,r.output),D))return;const{from:Z,to:ee}=q.state.selection;q.commands.setTextSelection({from:Z,to:ee}),q.commands.setContent(Vn(D,r.disabled,r.mode),!1,{preserveWhitespace:"full"})},{deep:!0}),i.watch([()=>r.disabled,()=>r.readonly],()=>{k.value=!r.disabled&&!r.readonly},{immediate:!0}),i.watch(()=>k.value,D=>{var Z;q==null||q.setEditable(D),(Z=q==null?void 0:q.commands)!=null&&Z.setIsEnableSuggestion&&q.commands.setIsEnableSuggestion(D)},{immediate:!0}),i.watch(()=>m.value,()=>{m.value&&m.value.on("selectionUpdate",({editor:D})=>{o("changed:selection",{editor:D})})}),i.onUnmounted(()=>{var D;q==null||q.destroy(),(D=H.value)==null||D.destroy()}),Ju(_u.SAVE,()=>{localStorage.setItem("content",xe(q,"html"))});const Ee=(D,Z)=>{const ee=q;if(ee){if(Z){const he=ee.state.doc.nodeAt(+Z),{[Qe.ELEMENT_ID]:Fe,...Je}=(he==null?void 0:he.attrs)||{};ee.view.dispatch(ee.state.tr.setNodeMarkup(+Z,void 0,{...Je,[Qe.TEXT]:D}))}else{const{from:he}=ee.view.state.selection;ee.commands.insertContentAt(he,{type:"superText",attrs:{"data-id":pi(6),"data-text":D}})}ee.commands.toggleSuperInputMoblie(),ee.storage.superText.addToast({type:"success",message:"수퍼가 수정되었습니다"})}},We=D=>{var ee;const Z=H.value??q;if(Z){const{from:he}=Z.view.state.selection;Z.commands.insertContentAt(he,{type:"configPlan",attrs:{"data-id":pi(6),"data-text":D}})}(ee=H.value)==null||ee.commands.toggleConfigPlanInput()};function Q(D){D===Ve.STRAIGHT&&q.commands.focus("end"),D===Ve.EDITOR&&q.commands.focus("end")}const oe=i.computed(()=>k.value&&r.mode===Ve.STRAIGHT||k.value&&r.mode===Ve.REPORT);i.onMounted(()=>{var D;r.autoFocus&&Q(r.mode),(D=q==null?void 0:q.commands)!=null&&D.setIsMobile&&q.commands.setIsMobile(!0),q.storage.superText.enable&&q.commands.toggleSuperTextView()}),i.watch(()=>r.mode,D=>{r.autoFocus&&Q(D)});const ue=(ze=q.extensionManager.extensions.find(D=>D.name==="superText"))==null?void 0:ze.options.bottomSheetComponent,ce=i.computed(()=>{const D=r.mode===Ve.REPORT,Z=r.mode===Ve.EDITOR&&r.isScreenSplit,ee=!r.hideComment;return(D||Z)&&ee}),be=i.computed(()=>!ce.value),{HEADER_ONLY_SIZE:N,pane1ContentVisible:ve,pane2ContentVisible:Me,pane1Size:Ue,pane2Size:mt,togglePane:Et,handlePaneResize:z}=J5(be);function V(){if(!r.contentAutoCopied)return;const D=hT(r.contentAutoCopied,".super-text");E(q,D)}const{isScrolling:se,handleScroll:ge}=xc(),{isScrolling:Re,handleScroll:Ne}=xc();return e({editor:q}),(D,Z)=>{var pt,pn,On,qr;const ee=X5,he=Zp,Fe=Jp,Je=Yp,St=Bf,Kt=K5,vo=YZ,ie=Ef,Be=GZ,He=Lt,yt=yn;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.unref(H)?(i.openBlock(),i.createElementBlock("div",{key:0,id:"vdc-editor",ref_key:"editorRef",ref:P,style:i.normalizeStyle(i.unref(U)),class:i.normalizeClass(i.unref(ke)("vdc-editor mobile relative w-full flex flex-col",!r.height&&"flex-1",D.editorClass,D.disabled&&"disabled",D.mode!==i.unref(Ve).EDITOR&&D.isShowLineNumber&&"editor-line"))},[!D.hideBubble&&!D.disabled&&i.unref(k)?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createVNode(ee,{editor:i.unref(q),mode:D.mode},null,8,["editor","mode"]),$e([i.unref(dc)])?(i.openBlock(),i.createBlock(he,{key:0,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0),$e([i.unref(ua)])?(i.openBlock(),i.createBlock(Fe,{key:1,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0),$e([i.unref(fs)])?(i.openBlock(),i.createBlock(Je,{key:2,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0),$e([i.unref(ps),i.unref(hs)])?(i.openBlock(),i.createBlock(St,{key:3,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),D.hideToolbar?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Kt,{key:1,editor:i.unref(H),mode:D.mode,disabled:D.disabled,class:i.normalizeClass(["mb-[3px]",D.toolBarClass]),"active-extensions":D.mode===i.unref(Ve).EDITOR?[fc]:void 0},null,8,["editor","mode","disabled","class","active-extensions"])),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[D.isShowFormatControlBar?(i.openBlock(),i.createElementBlock("div",{key:0,style:i.normalizeStyle(i.unref(M)),class:i.normalizeClass(i.unref(ke)("absolute left-5 right-5 z-[12]",i.unref(L)&&"fixed"))},[i.createVNode(vo,{editor:i.unref(H),mode:D.mode,disabled:!i.unref(k)||D.disabled,style:i.normalizeStyle({visibility:i.unref(F)?"visible":"hidden"})},null,8,["editor","mode","disabled","style"])],6)):i.createCommentVNode("",!0)])),i.createVNode(i.unref(Yb),{class:i.normalizeClass(i.unref(ke)("flex-1 basis-0 flex-col",i.unref(Y)&&"pb-16")),style:i.normalizeStyle({...i.unref(T)}),horizontal:"",onResize:i.unref(z)},{default:i.withCtx(()=>[i.unref(ce)?(i.openBlock(),i.createBlock(i.unref(ba),{key:0,size:i.unref(Ue),"min-size":i.unref(N),class:"flex flex-col"},{default:i.withCtx(()=>{var Er,Zn;return[(Er=D.titleBarComment)!=null&&Er.title?(i.openBlock(),i.createBlock(Y5,{key:0,"title-bar":D.titleBarComment,class:"mb-[3px]"},null,8,["title-bar"])):i.createCommentVNode("",!0),(Zn=D.fieldNameComment)!=null&&Zn.label?(i.openBlock(),i.createElementBlock("div",{key:1,onClick:Z[0]||(Z[0]=kr=>i.unref(Et)("pane1")),class:i.normalizeClass(i.unref(ke)("flex justify-between items-center py-1.5 mb-1 active:bg-ed-accent",!D.isAccordion&&"pointer-events-none"))},[i.createVNode(eh,{"field-name":D.fieldNameComment,mode:D.mode},null,8,["field-name","mode"]),D.isAccordion?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(ve)?i.unref(cg):i.unref(Nu)),{key:0,class:"h-5 w-5"})):i.createCommentVNode("",!0)],2)):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{onScroll:Z[2]||(Z[2]=(...kr)=>i.unref(ge)&&i.unref(ge)(...kr)),class:i.normalizeClass(i.unref(ke)("flex-1 !overflow-y-auto overflow-x-hidden basis-0 flex h-full flex-col",!i.unref(se)&&"scrollbar-thumb-transparent",D.contentClass))},[i.createVNode(oQ,{ref:"editorCommentRef",mode:D.mode,extensions:D.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":D.disableSuperInput,"field-name-comment":D.fieldNameComment,"is-show-format-control-bar":D.isShowFormatControlBar,"auto-focus":D.autoFocus,"onUpdate:modelValue":Z[1]||(Z[1]=kr=>o("update:comment",kr)),onSetEditorSelected:ne},null,8,["mode","extensions","model-value","disabled","disable-super-input","field-name-comment","is-show-format-control-bar","auto-focus"])],34),[[i.vShow,i.unref(ve)]])]}),_:1},8,["size","min-size"])):i.createCommentVNode("",!0),i.createVNode(i.unref(ba),{size:i.unref(mt),"min-size":i.unref(N),class:"flex flex-col"},{default:i.withCtx(()=>{var Er,Zn,kr;return[(Er=D.titleBarContent)!=null&&Er.title?(i.openBlock(),i.createBlock(Y5,{key:0,"title-bar":D.titleBarContent,class:"mb-[3px]"},null,8,["title-bar"])):i.createCommentVNode("",!0),i.createElementVNode("div",sQ,[(Zn=D.fieldNameContent)!=null&&Zn.label?(i.openBlock(),i.createElementBlock("div",{key:0,onClick:Z[3]||(Z[3]=qo=>i.unref(Et)("pane2")),class:i.normalizeClass(i.unref(ke)("flex justify-between items-center py-1.5 mb-1 active:bg-ed-accent flex-1",!D.isAccordion&&"pointer-events-none"))},[i.createVNode(eh,{"field-name":D.fieldNameContent,mode:D.mode},null,8,["field-name","mode"]),D.isAccordion?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Me)?i.unref(cg):i.unref(Nu)),{key:0,class:"h-5 w-5"})):i.createCommentVNode("",!0)],2)):i.createCommentVNode("",!0),i.unref(oe)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(i.unref(ke)("flex items-center gap-x-2 absolute right-9 top-1.5 z-10",!((kr=D.fieldNameContent)!=null&&kr.label)&&"static ml-auto"))},[i.createVNode(ie,{for:"superView",class:"body-medium"},{default:i.withCtx(()=>Z[8]||(Z[8]=[i.createTextVNode("수퍼")])),_:1}),i.createVNode(Be,{id:"superView",checked:i.unref(q).storage.superText.enable,"onUpdate:checked":Z[4]||(Z[4]=qo=>i.unref(q).commands.toggleSuperTextView()),class:"w-8 h-5 data-[state=checked]:bg-blue-500","custom-class-thumb":"w-4 h-4 data-[state=checked]:translate-x-3"},null,8,["checked"])],2)):i.createCommentVNode("",!0),D.contentAutoCopied?(i.openBlock(),i.createBlock(yt,{key:2,disabled:i.unref(Mp)(D.contentAutoCopied),onClick:V,variant:"ghost",class:"w-fit h-fit p-0 gap-x-1 label-large text-blue-500"},{default:i.withCtx(()=>[i.createVNode(He,{name:"autoCopy",class:"size-5"}),Z[9]||(Z[9]=i.createTextVNode("자동복사"))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.withDirectives(i.createElementVNode("div",{onScroll:Z[5]||(Z[5]=(...qo)=>i.unref(Ne)&&i.unref(Ne)(...qo)),class:i.normalizeClass(i.unref(ke)("flex-1 !overflow-y-auto overflow-x-hidden basis-0 flex flex-col",!i.unref(Re)&&"scrollbar-thumb-transparent",D.contentClass))},[i.createVNode(i.unref(Ao),{id:"editor-panel",editor:i.unref(q),class:i.normalizeClass(["flex-1 flex-col relative break-all",D.mode===i.unref(Ve).PLAIN_TEXT&&"plain-text"])},null,8,["editor","class"])],34),[[i.vShow,i.unref(Me)]])]}),_:1},8,["size","min-size"])]),_:1},8,["class","style","onResize"])],6)):i.createCommentVNode("",!0),(pt=i.unref(q))!=null&&pt.storage.superText&&i.unref(ue)?(i.openBlock(),i.createBlock(nQ,{key:1,open:i.unref(we),editor:i.unref(q),"bottom-sheet-component":i.unref(ue),onClose:Z[6]||(Z[6]=Er=>i.unref(q).commands.toggleSuperInputMoblie()),onSave:Ee},null,8,["open","editor","bottom-sheet-component"])):i.createCommentVNode("",!0),(pn=i.unref(H))!=null&&pn.storage.configPlan?(i.openBlock(),i.createBlock(EE,{key:2,open:(On=i.unref(H))==null?void 0:On.storage.configPlan.isShowConfigPlanInput,"is-view-mode":!((qr=i.unref(H))!=null&&qr.storage.configPlan.isShowConfigPlanInput),editor:i.unref(H),title:D.$t("editor.configPlan"),onClose:Z[7]||(Z[7]=Er=>i.unref(H).commands.toggleConfigPlanInput()),onSave:We},null,8,["open","is-view-mode","editor","title"])):i.createCommentVNode("",!0)],64)}}}),aQ=i.defineComponent({__name:"ArticleEditor",props:{mode:{default:Ve.STRAIGHT},isMobile:{type:Boolean},superTextArea:{},modelValue:{},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{},dark:{type:Boolean},disabled:{type:Boolean},hideToolbar:{type:Boolean},isShowFormatControlBar:{type:Boolean},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean},maxWidth:{},minHeight:{},maxHeight:{},height:{},extensions:{},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},setup(t){const e=t,n=wn();return i.onMounted(()=>{n.setTextAlert(e.textAlert||"")}),(r,o)=>e.isMobile?(i.openBlock(),i.createBlock(Cc,i.mergeProps({key:1},e,{"onUpdate:modelValue":o[2]||(o[2]=s=>r.$emit("update:modelValue",s)),"onUpdate:comment":o[3]||(o[3]=s=>r.$emit("update:comment",s))}),null,16)):(i.openBlock(),i.createBlock(Np,i.mergeProps({key:0},e,{"onUpdate:modelValue":o[0]||(o[0]=s=>r.$emit("update:modelValue",s)),"onUpdate:comment":o[1]||(o[1]=s=>r.$emit("update:comment",s))}),null,16))}}),lQ=i.defineComponent({__name:"DigitalNewsEditor",props:{mode:{default:Ve.EDITOR},isMobile:{type:Boolean},superTextArea:{},modelValue:{},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{},dark:{type:Boolean},disabled:{type:Boolean},hideToolbar:{type:Boolean},isShowFormatControlBar:{type:Boolean},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean},maxWidth:{},minHeight:{},maxHeight:{},height:{},extensions:{},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},setup(t){const e=t;return(n,r)=>{const o=Np,s=Cc;return e.isMobile?(i.openBlock(),i.createBlock(s,i.mergeProps({key:1},e,{"onUpdate:modelValue":r[1]||(r[1]=a=>n.$emit("update:modelValue",a)),"onUpdate:comment":r[2]||(r[2]=a=>n.$emit("update:comment",a))}),null,16)):(i.openBlock(),i.createBlock(o,i.mergeProps({key:0},e,{"onUpdate:modelValue":r[0]||(r[0]=a=>n.$emit("update:modelValue",a))}),null,16))}}});var Z5={exports:{}};(function(t){(function(){function e(H){return H===">"}function n(H){return H==="<"}function r(H){return/^\s+$/.test(H)}function o(H){var F=H.match(/^\s*<([^!>][^>]*)>\s*$/);return!!F&&F[1].trim().split(" ")[0]}function s(H){return!o(H)}function a(H){return/^<!--/.test(H)}function l(H){return/--\>$/.test(H)}var u,c=new RegExp("^<(iframe|object|math|svg|script|video|head|style|a)");function f(H){var F=u.exec(H);return F&&F[1]}function p(H,F){return H.substring(H.length-F.length-2)==="</"+F}function m(H){return/^\s*<[^>]+\/>\s*$/.test(H)}function g(H){var F=/^<img[\s>]/.test(H);return F||s(H)||f(H)||m(H)}function b(H){return{string:H,key:x(H)}}function y(H,F,L,K){this.segment=K,this.length=L,this.startInBefore=H+K.beforeIndex,this.startInAfter=F+K.afterIndex,this.endInBefore=this.startInBefore+this.length-1,this.endInAfter=this.startInAfter+this.length-1,this.segmentStartInBefore=H,this.segmentStartInAfter=F,this.segmentEndInBefore=this.segmentStartInBefore+this.length-1,this.segmentEndInAfter=this.segmentStartInAfter+this.length-1}function w(H){for(var F="char",L="",K="",J=[],Y=0;Y<H.length;Y++){var ne=H[Y];switch(F){case"tag":var we=f(L);we?(F="atomic_tag",K=we,L+=ne):a(L)?(F="html_comment",L+=ne):e(ne)?(L+=">",J.push(b(L)),L="",r(ne)?F="whitespace":F="char"):L+=ne;break;case"atomic_tag":e(ne)&&p(L,K)?(L+=">",J.push(b(L)),L="",K="",F="char"):L+=ne;break;case"html_comment":L+=ne,l(L)&&(L="",F="char");break;case"char":n(ne)?(L&&J.push(b(L)),L="<",F="tag"):/\s/.test(ne)?(L&&J.push(b(L)),L=ne,F="whitespace"):/[\w\d\#@]/.test(ne)?L+=ne:/&/.test(ne)?(L&&J.push(b(L)),L=ne):(L+=ne,J.push(b(L)),L="");break;case"whitespace":n(ne)?(L&&J.push(b(L)),L="<",F="tag"):r(ne)?L+=ne:(L&&J.push(b(L)),L=ne,F="char");break;default:throw new Error("Unknown mode "+F)}}return L&&J.push(b(L)),J}function x(H){var F=/^<img.*src=['"]([^"']*)['"].*>$/.exec(H);if(F)return'<img src="'+F[1]+'">';var L=/^<a.*href=['"]([^"']*)['"]/.exec(H);if(L)return'<a href="'+L[1]+'"></a>';var K=/^<object.*data=['"]([^"']*)['"]/.exec(H);if(K)return'<object src="'+K[1]+'"></object>';if(/^<(svg|math|video)[\s>]/.test(H)){var J=H.indexOf('data-uuid="');if(J!==-1){var Y=H.slice(0,J),ne=H.slice(J+44);return Y+ne}else return H}var we=/^<iframe.*src=['"]([^"']*)['"].*>/.exec(H);if(we)return'<iframe src="'+we[1]+'"></iframe>';var xe=/<([^\s>]+)[\s>]/.exec(H);return xe?"<"+xe[1].toLowerCase()+">":H&&H.replace(/(\s+| | )/g," ")}function E(H){return H.reduce(function(F,L,K){return F[L.key]?F[L.key].push(K):F[L.key]=[K],F},Object.create(null))}function k(H,F){return F.endInBefore<H.startInBefore&&F.endInAfter<H.startInAfter?-1:F.startInBefore>H.endInBefore&&F.startInAfter>H.endInAfter?1:0}function C(){this._root=null}C.prototype={add:function(H){var F={value:H,left:null,right:null},L=this._root;if(L)for(;;){var K=k(L.value,H);if(K===-1)if(L.left)L=L.left;else{L.left=F;break}else if(K===1)if(L.right)L=L.right;else{L.right=F;break}else break}else this._root=F},toArray:function(){function H(F,L){return F&&(H(F.left,L),L.push(F.value),H(F.right,L)),L}return H(this._root,[])}};function _(H){for(var F=H.beforeTokens,L=H.afterMap,K=null,J=null,Y=0;Y<F.length;Y++){var ne=!1,we=F.length-Y;if(J&&we<J.length)break;var xe=F[Y];if(xe.key===" "){K=Y;continue}K===Y-1&&(ne=!0);var $e=L[xe.key];$e&&$e.forEach(function(Ee){var We=J?J.length:0,Q=A(H,Y,Ee,We,ne);Q&&Q.length>We&&(J=Q)})}return J}function A(H,F,L,K,J){var Y=H.beforeTokens,ne=H.afterTokens,we=F+K,xe=L+K;if(!(we>=Y.length||xe>=ne.length)){if(K){var $e=Y[we].key,Ee=ne[xe].key;if($e!==Ee)return}for(var We=!0,Q=1,oe=F+Q,ue=L+Q;We&&oe<Y.length&&ue<ne.length;){var ce=Y[oe].key,be=ne[ue].key;ce===be?(Q++,oe=F+Q,ue=L+Q):We=!1}if(J&&F>0&&L>0){var N=Y[F-1].key,ve=ne[L-1].key;N===" "&&ve===" "&&(F--,L--,Q++)}return new y(F,L,Q,H)}}function T(H,F,L,K){return{beforeTokens:H,afterTokens:F,beforeMap:E(H),afterMap:E(F),beforeIndex:L,afterIndex:K}}function P(H){for(var F=new C,L,K=[H];K.length;)if(H=K.pop(),L=_(H),L&&L.length){if(L.segmentStartInBefore>0&&L.segmentStartInAfter>0){var J=H.beforeTokens.slice(0,L.segmentStartInBefore),Y=H.afterTokens.slice(0,L.segmentStartInAfter);K.push(T(J,Y,H.beforeIndex,H.afterIndex))}var ne=H.beforeTokens.slice(L.segmentEndInBefore+1),we=H.afterTokens.slice(L.segmentEndInAfter+1),xe=H.beforeIndex+L.segmentEndInBefore+1,$e=H.afterIndex+L.segmentEndInAfter+1;ne.length&&we.length&&K.push(T(ne,we,xe,$e)),F.add(L)}return F.toArray()}function I(H,F){if(!H)throw new Error("Missing beforeTokens");if(!F)throw new Error("Missing afterTokens");var L=0,K=0,J=[],Y=T(H,F,0,0),ne=P(Y);ne.push(new y(H.length,F.length,0,Y));for(var we=0;we<ne.length;we++){var xe=ne[we],$e="none";L===xe.startInBefore?K!==xe.startInAfter&&($e="insert"):($e="delete",K!==xe.startInAfter&&($e="replace")),$e!=="none"&&J.push({action:$e,startInBefore:L,endInBefore:$e!=="insert"?xe.startInBefore-1:null,startInAfter:K,endInAfter:$e!=="delete"?xe.startInAfter-1:null}),xe.length!==0&&J.push({action:"equal",startInBefore:xe.startInBefore,endInBefore:xe.endInBefore,startInAfter:xe.startInAfter,endInAfter:xe.endInAfter}),L=xe.endInBefore+1,K=xe.endInAfter+1}var Ee=[],We={action:"none"};function Q(ce){return ce.action!=="equal"||ce.endInBefore-ce.startInBefore!==0?!1:/^\s$/.test(H.slice(ce.startInBefore,ce.endInBefore+1))}for(var oe=0;oe<J.length;oe++){var ue=J[oe];Q(ue)&&We.action==="replace"||ue.action==="replace"&&We.action==="replace"?(We.endInBefore=ue.endInBefore,We.endInAfter=ue.endInAfter):(Ee.push(ue),We=ue)}return Ee}function M(H){this.tokens=H,this.notes=H.reduce(function(F,L,K){F.notes.push({isWrappable:g(L),insertedTag:!1});var J=!m(L)&&o(L),Y=F.tagStack[F.tagStack.length-1];return J&&(Y&&"/"+Y.tag===J?(F.notes[Y.position].insertedTag=!0,F.tagStack.pop()):F.tagStack.push({tag:J,position:K})),F},{notes:[],tagStack:[]}).notes}M.prototype.combine=function(H,F){var L=this.notes,K=this.tokens.slice(),J=K.reduce(function(Y,ne,we){L[we].insertedTag&&(K[we]=F(K[we])),Y.status===null&&(Y.status=L[we].isWrappable);var xe=L[we].isWrappable;return xe!==Y.status&&(Y.list.push({isWrappable:Y.status,tokens:K.slice(Y.lastIndex,we)}),Y.lastIndex=we,Y.status=xe),we===K.length-1&&Y.list.push({isWrappable:Y.status,tokens:K.slice(Y.lastIndex,we+1)}),Y},{list:[],status:null,lastIndex:0}).list;return J.map(H).join("")};function j(H,F,L,K,J){var Y=new M(F);K=K?K+"-":"";var ne=" data-"+K+'operation-index="'+L+'"';return J&&(ne+=' class="'+J+'"'),Y.combine(function(we){if(we.isWrappable){var xe=we.tokens.join("");if(xe.trim())return"<"+H+ne+">"+xe+"</"+H+">"}else return we.tokens.join("");return""},function(we){var xe=' data-diff-node="'+H+'"';return xe+=" data-"+K+'operation-index="'+L+'"',we.replace(/>\s*$/,xe+"$&")})}var U={equal:function(H,F,L,K,J,Y){var ne=L.slice(H.startInAfter,H.endInAfter+1);return ne.reduce(function(we,xe){return we+xe.string},"")},insert:function(H,F,L,K,J,Y){var ne=L.slice(H.startInAfter,H.endInAfter+1),we=ne.map(function(xe){return xe.string});return j("ins",we,K,J,Y)},delete:function(H,F,L,K,J,Y){var ne=F.slice(H.startInBefore,H.endInBefore+1),we=ne.map(function(xe){return xe.string});return j("del",we,K,J,Y)},replace:function(){return U.delete.apply(null,arguments)+U.insert.apply(null,arguments)}};function q(H,F,L,K,J){return L.reduce(function(Y,ne,we){return Y+U[ne.action](ne,H,F,we,K,J)},"")}function le(H,F,L,K,J){if(H===F)return H;J?u=new RegExp("^<("+J.replace(/\s*/g,"").replace(/,/g,"|")+")"):u=c,H=w(H),F=w(F);var Y=I(H,F);return q(H,F,Y,K,L)}le.htmlToTokens=w,le.findMatchingBlocks=P,P.findBestMatch=_,P.createMap=E,P.createToken=b,P.createSegment=T,P.getKeyForToken=x,le.calculateOperations=I,le.renderOperations=q,t!==null?t.exports=le:this.htmldiff=le}).call(Za)})(Z5);var uQ=Z5.exports;const cQ=WB(uQ),Q5=(t,e,n)=>{let r="";{const o=Vn(t,n),s=Vn(e,n);r=cQ(o,s,null,null,"button")}return r=r.replace(/<del[^>]*>/g,'<span class="diff-del">').replace(/<\/del>/g,"</span>").replace(/<ins[^>]*>/g,'<mark style="background:#FEF3C7;">').replace(/<\/ins>/g,"</mark>"),r},dQ={key:0,class:"px-2 min-h-[24px] flex items-center justify-between gap-1 mb-1.5"},fQ={class:"flex items-center gap-2"},pQ={class:"body-small text-gray-600 px-[6px] py-[2px] shrink-0 rounded-[4px] bg-gray-100"},hQ={class:"label-large text-gray-800 line-clamp-1"},mQ={class:"flex items-center gap-1 shrink-0"},gQ={class:"mt-[2px]"},bQ={class:"body-small text-gray-400"},vQ={class:"border border-ed-gray rounded-[5px] p-2.5 my-2 h-full"},yQ={key:0,class:"px-2 min-h-[24px] flex items-center justify-between gap-1 mb-1.5"},wQ={class:"flex items-center gap-2"},xQ={class:"body-small text-blue-500 px-[6px] py-[2px] shrink-0 rounded-[4px] bg-blue-50"},CQ={class:"label-large text-gray-800 line-clamp-1"},EQ={class:"flex items-center gap-1 shrink-0"},kQ={class:"mt-[2px]"},SQ={class:"body-small text-gray-400"},_Q=Bo(i.defineComponent({__name:"ArticleCompareEditor",props:{originalData:{},changedData:{},extensions:{},editorClass:{}},setup(t){const e=t,n=i.ref(!1),r=i.computed(()=>!e.originalData||!e.changedData?{comment:"",content:""}:{comment:Q5(e.originalData.comment,e.changedData.comment,!0),content:Q5(e.originalData.content,e.changedData.content,!0)}),{HEADER_ONLY_SIZE:o,pane1ContentVisible:s,pane2ContentVisible:a,pane1Size:l,pane2Size:u,handlePaneResize:c}=J5(!1,6),{isScrolling:f,handleScroll:p}=xc(),{isScrolling:m,handleScroll:g}=xc();return(b,y)=>{const w=Lt;return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(ke)("h-full",b.editorClass))},[i.createVNode(i.unref(Yb),{horizontal:"",onResize:i.unref(c)},{default:i.withCtx(()=>[i.createVNode(i.unref(ba),{size:i.unref(l),"min-size":i.unref(o),class:"flex flex-col"},{default:i.withCtx(()=>{var x,E,k,C,_,A,T,P,I,M;return[(E=(x=b.originalData)==null?void 0:x.titleBar)!=null&&E.title?(i.openBlock(),i.createElementBlock("div",dQ,[i.createElementVNode("div",fQ,[i.createElementVNode("div",pQ,i.toDisplayString(b.$t("기준")),1),i.createElementVNode("h3",hQ,i.toDisplayString((C=(k=b.originalData)==null?void 0:k.titleBar)==null?void 0:C.title),1)]),i.createElementVNode("div",mQ,[i.createElementVNode("div",gQ,[i.createVNode(w,{name:"Clock",class:"w-[13px] h-[13px] text-gray-400"})]),i.createElementVNode("div",bQ,i.toDisplayString((A=(_=b.originalData)==null?void 0:_.titleBar)==null?void 0:A.time),1)])])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{onScroll:y[0]||(y[0]=(...j)=>i.unref(p)&&i.unref(p)(...j)),class:i.normalizeClass(i.unref(ke)("border border-gray-50 rounded-md py-[10px] px-4 flex-1 overflow-y-auto",!i.unref(f)&&"scrollbar-thumb-transparent"))},[i.createVNode(Cc,{"editor-class":"h-full",mode:i.unref(Ve).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(T=b.originalData)==null?void 0:T.fieldNameComment,"field-name-content":(P=b.originalData)==null?void 0:P.fieldNameContent,comment:(I=b.originalData)==null?void 0:I.comment,"model-value":(M=b.originalData)==null?void 0:M.content},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value"])],34),[[i.vShow,i.unref(s)]])]}),_:1},8,["size","min-size"]),i.unref(n)?(i.openBlock(),i.createBlock(i.unref(ba),{key:0},{default:i.withCtx(()=>{var x,E,k,C;return[i.createElementVNode("div",vQ,[i.createVNode(Cc,{"editor-class":"h-full",mode:i.unref(Ve).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(x=b.changedData)==null?void 0:x.fieldNameComment,"field-name-content":(E=b.changedData)==null?void 0:E.fieldNameContent,comment:(k=b.changedData)==null?void 0:k.comment,"model-value":(C=b.changedData)==null?void 0:C.content},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value"])])]}),_:1})):i.createCommentVNode("",!0),i.createVNode(i.unref(ba),{size:i.unref(u),"min-size":i.unref(o),class:"flex flex-col"},{default:i.withCtx(()=>{var x,E,k,C,_,A,T,P;return[(E=(x=b.changedData)==null?void 0:x.titleBar)!=null&&E.title?(i.openBlock(),i.createElementBlock("div",yQ,[i.createElementVNode("div",wQ,[i.createElementVNode("div",xQ,i.toDisplayString(b.$t("대상")),1),i.createElementVNode("h3",CQ,i.toDisplayString((C=(k=b.changedData)==null?void 0:k.titleBar)==null?void 0:C.title),1)]),i.createElementVNode("div",EQ,[i.createElementVNode("div",kQ,[i.createVNode(w,{name:"Clock",class:"w-[13px] h-[13px] text-gray-400"})]),i.createElementVNode("div",SQ,i.toDisplayString((A=(_=b.changedData)==null?void 0:_.titleBar)==null?void 0:A.time),1)])])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{onScroll:y[1]||(y[1]=(...I)=>i.unref(g)&&i.unref(g)(...I)),class:i.normalizeClass(i.unref(ke)("border border-gray-50 bg-dark-blue-600 rounded-md py-[10px] px-4 flex-1 overflow-y-auto",!i.unref(m)&&"scrollbar-thumb-transparent"))},[i.createVNode(Cc,{"editor-class":"h-full",mode:i.unref(Ve).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(T=b.changedData)==null?void 0:T.fieldNameComment,"field-name-content":(P=b.changedData)==null?void 0:P.fieldNameContent,comment:i.unref(r).comment,"model-value":i.unref(r).content},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value"])],34),[[i.vShow,i.unref(a)]])]}),_:1},8,["size","min-size"])]),_:1},8,["onResize"])],2)}}}),[["__scopeId","data-v-cc9492d8"]]),N5=t=>{if(!t)return-1;const{from:e}=t.state.selection;let n=0;return t.state.doc.descendants((r,o)=>{r.type.name===xp&&o<e&&n++}),n},TQ=i.defineComponent({__name:"SuperViewMobileSuperEditor",props:{isMobile:{type:Boolean},superTextArea:{},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{default:null},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n;i.computed(()=>r.mode===Ve.EDITOR);const s=ht.useEventBus(ar.RENDER_SUPER_TEXT),a=wn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,p=i.ref(!1);i.provide("isEditable",p);const m=i.ref(pw(r.modelValue));function g(C){if(r.disabled||r.readonly)return;const _=N5(C);o("lineFocus",{lineIndex:_})}function b(){o("lineFocus",{lineIndex:void 0})}const y=new ii({enablePasteRules:!1,enableInputRules:!1,content:m.value,onCreate:({editor:C})=>{c(C)},onUpdate:rt.throttle(({editor:C})=>{l.value=!0;const _=k(C,r.output);o("update:modelValue",_),o("change",{editor:C,output:_}),c(C)},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(r.extensions)),"name"),editable:p.value,onFocus:()=>{x(),w.value=!0,g(y)},onBlur:()=>{w.value=!1,b()},onSelectionUpdate:()=>{g(y)}}),w=i.ref(!1);function x(){o("setEditorSelected",y)}function E(){s.emit({action:"render"})}function k(C,_){if(!C)return"";if(C.isEmpty)return _==="json"?{}:"";switch(_){case"html":return C.getHTML();case"json":return C.getJSON();case"text":return C.getText();default:return""}}return i.watch(()=>f.languages,()=>{y.commands.checkSpelling()}),i.watch(()=>r.modelValue,C=>{if(!y||rt.isEqual(k(y,r.output),C))return;const{from:_,to:A}=y.state.selection;y.commands.setTextSelection({from:_,to:A}),E(),m.value=pw(C)},{deep:!0}),i.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:C})=>{o("changed:selection",{editor:C})})}),i.watch(()=>r.disableSuperInput,()=>{const C=document.getElementById(or.COMMENT);C==null||C.setAttribute(or.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),i.onUnmounted(()=>y==null?void 0:y.destroy()),Qp(y),i.onMounted(()=>{var C,_;(C=y==null?void 0:y.commands)!=null&&C.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(!1),(_=y==null?void 0:y.commands)!=null&&_.setIsMobile&&y.commands.setIsMobile(!0)}),e({editor:y}),(C,_)=>{var T;const A=eh;return i.openBlock(),i.createElementBlock(i.Fragment,null,[(T=C.fieldNameSuper)!=null&&T.label?(i.openBlock(),i.createBlock(A,{key:0,"field-name":C.fieldNameSuper,mode:C.mode,disabled:C.disabled,class:"mb-1",intent:"secondary"},null,8,["field-name","mode","disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(Ao),{editor:i.unref(y),spellcheck:"true",class:i.normalizeClass(["flex-1 flex-col"])},null,8,["editor"])],64)}}}),AQ=(t,e)=>{let n=null;return t.state.doc.descendants((r,o)=>{if(r.type.name==="paragraph"&&Number(r.attrs["number-line"])===e)return n={node:r,pos:o},!1}),n},ek="focused-line";async function tk({lineIndex:t,editor:e}){if(e.state.doc.descendants((l,u)=>{if(l.attrs.class===ek){const c=e.state.tr.setNodeMarkup(u,void 0,{...l.attrs,class:""});return e.view.dispatch(c),!1}}),await i.nextTick(),!t)return;const n=AQ(e,t);if(!n)return;const{node:r,pos:o}=n,s=e.state.tr.setNodeMarkup(o,void 0,{...r.attrs,class:ek});e.view.dispatch(s),await i.nextTick(),e.view.nodeDOM(o).scrollIntoView({behavior:"smooth"})}const OQ=i.defineComponent({__name:"SuperViewMobileEditor",props:{isMobile:{type:Boolean},superTextArea:{},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{default:"12px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{default:null},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{default:void 0},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n;i.provide("isMobile",!0),i.computed(()=>r.mode===Ve.EDITOR);const s=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE);i.useAttrs();const a=wn(),{state:l,isFullscreen:u,isReady:c,editor:f,updateEditorState:p,checkSpellStore:m}=a,g=i.ref(!1);i.provide("isEditable",g);const b=i.ref(void 0),y=i.ref(),w=i.computed(()=>[...l.extensions,...rt.differenceBy(r.extensions,l.extensions,"name")].map((F,L)=>F.configure({sort:L}))),x=i.ref(r.fontSizeDefault),E=i.ref(r.fontFamilyDefault);i.provide("fontSize",x),i.provide("fontFamily",E);const k=i.computed(()=>({fontFamily:E.value,fontSize:x.value})),C=i.ref(),_=F=>{const L=parseInt(x.value||"12px"),K=F?L+2:L-2;x.value=K+"px"};i.onBeforeMount(()=>{s.on(_)}),i.onBeforeUnmount(()=>{s.off(_)});const A=i.computed(()=>({...i.unref(u)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0}));function T(F){if(r.disabled||r.readonly)return;const L=N5(F);b.value=L}function P(){b.value=void 0}const I=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled,r.mode),onCreate:({editor:F})=>{p(F)},onUpdate:rt.throttle(({editor:F})=>{c.value=!0;const L=le(F,r.output);o("update:modelValue",L),o("change",{editor:F,output:L}),p(F)},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(w)),"name"),editable:g.value,onFocus:()=>{q(),M.value=!0,T(I)},onBlur:()=>{M.value=!1,P()},onSelectionUpdate:()=>{T(I)}}),M=i.ref(!1),j=i.ref();i.onMounted(()=>{j.value=I});const U=({lineIndex:F})=>{var K;I&&tk({lineIndex:F,editor:I});const L=(K=y.value)==null?void 0:K.editor;L&&tk({lineIndex:F,editor:L})};i.watch(()=>b.value,F=>{o("lineFocus",{lineIndex:F}),U({lineIndex:F})},{immediate:!0});function q(F){j.value=I}function le(F,L){if(!F)return"";if(F.isEmpty)return L==="json"?{}:"";switch(L){case"html":return F.getHTML();case"json":return F.getJSON();case"text":return F.getText({blockSeparator:`
|
|
304
|
+
`});default:return""}}function $e(D){return D.every(Z=>q==null?void 0:q.extensionManager.extensions.find(ee=>ee.name===Z))}i.watch(()=>b.languages,()=>{q.commands.checkSpelling()}),i.watch(()=>r.modelValue,D=>{if(!q||rt.isEqual(xe(q,r.output),D))return;const{from:Z,to:ee}=q.state.selection;q.commands.setTextSelection({from:Z,to:ee}),q.commands.setContent(Vn(D,r.disabled,r.mode),!1,{preserveWhitespace:"full"})},{deep:!0}),i.watch([()=>r.disabled,()=>r.readonly],()=>{k.value=!r.disabled&&!r.readonly},{immediate:!0}),i.watch(()=>k.value,D=>{var Z;q==null||q.setEditable(D),(Z=q==null?void 0:q.commands)!=null&&Z.setIsEnableSuggestion&&q.commands.setIsEnableSuggestion(D)},{immediate:!0}),i.watch(()=>m.value,()=>{m.value&&m.value.on("selectionUpdate",({editor:D})=>{o("changed:selection",{editor:D})})}),i.onUnmounted(()=>{var D;q==null||q.destroy(),(D=H.value)==null||D.destroy()}),Ju(_u.SAVE,()=>{localStorage.setItem("content",xe(q,"html"))});const Ee=(D,Z)=>{const ee=q;if(ee){if(Z){const he=ee.state.doc.nodeAt(+Z),{[Qe.ELEMENT_ID]:Fe,...Je}=(he==null?void 0:he.attrs)||{};ee.view.dispatch(ee.state.tr.setNodeMarkup(+Z,void 0,{...Je,[Qe.TEXT]:D}))}else{const{from:he}=ee.view.state.selection;ee.commands.insertContentAt(he,{type:"superText",attrs:{"data-id":pi(6),"data-text":D}})}ee.commands.toggleSuperInputMoblie(),ee.storage.superText.addToast({type:"success",message:"수퍼가 수정되었습니다"})}},We=D=>{var ee;const Z=H.value??q;if(Z){const{from:he}=Z.view.state.selection;Z.commands.insertContentAt(he,{type:"configPlan",attrs:{"data-id":pi(6),"data-text":D}})}(ee=H.value)==null||ee.commands.toggleConfigPlanInput()};function Q(D){D===De.STRAIGHT&&q.commands.focus("end"),D===De.EDITOR&&q.commands.focus("end")}const oe=i.computed(()=>k.value&&r.mode===De.STRAIGHT||k.value&&r.mode===De.REPORT);i.onMounted(()=>{var D,Z;r.autoFocus&&Q(r.mode),(D=q==null?void 0:q.commands)!=null&&D.setIsMobile&&q.commands.setIsMobile(!0),(Z=q.storage.superText)!=null&&Z.enable&&q.commands.toggleSuperTextView()}),i.watch(()=>r.mode,D=>{r.autoFocus&&Q(D)});const ue=(ze=q.extensionManager.extensions.find(D=>D.name==="superText"))==null?void 0:ze.options.bottomSheetComponent,ce=i.computed(()=>{const D=r.mode===De.REPORT,Z=r.mode===De.EDITOR&&r.isScreenSplit,ee=!r.hideComment;return(D||Z)&&ee}),be=i.computed(()=>!ce.value),{HEADER_ONLY_SIZE:N,pane1ContentVisible:ve,pane2ContentVisible:Me,pane1Size:Ue,pane2Size:mt,togglePane:Et,handlePaneResize:z}=J5(be);function V(){if(!r.contentAutoCopied)return;const D=hT(r.contentAutoCopied,".super-text");E(q,D)}const{isScrolling:se,handleScroll:ge}=xc(),{isScrolling:Re,handleScroll:Ne}=xc();return e({editor:q}),(D,Z)=>{var pt,pn,On,qr;const ee=X5,he=Zp,Fe=Jp,Je=Yp,St=Bf,Kt=K5,vo=YZ,ie=Ef,Be=GZ,He=Lt,yt=yn;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.unref(H)?(i.openBlock(),i.createElementBlock("div",{key:0,id:"vdc-editor",ref_key:"editorRef",ref:P,style:i.normalizeStyle(i.unref(U)),class:i.normalizeClass(i.unref(ke)("vdc-editor mobile relative w-full flex flex-col",!r.height&&"flex-1",D.editorClass,D.disabled&&"disabled",D.mode!==i.unref(De).EDITOR&&D.isShowLineNumber&&"editor-line"))},[!D.hideBubble&&!D.disabled&&i.unref(k)?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createVNode(ee,{editor:i.unref(q),mode:D.mode},null,8,["editor","mode"]),$e([i.unref(dc)])?(i.openBlock(),i.createBlock(he,{key:0,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0),$e([i.unref(ua)])?(i.openBlock(),i.createBlock(Fe,{key:1,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0),$e([i.unref(fs)])?(i.openBlock(),i.createBlock(Je,{key:2,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0),$e([i.unref(ps),i.unref(hs)])?(i.openBlock(),i.createBlock(St,{key:3,editor:i.unref(q)},null,8,["editor"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),D.hideToolbar?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(Kt,{key:1,editor:i.unref(H),mode:D.mode,disabled:D.disabled,class:i.normalizeClass(["mb-[3px]",D.toolBarClass]),"active-extensions":D.mode===i.unref(De).EDITOR?[fc]:void 0},null,8,["editor","mode","disabled","class","active-extensions"])),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[D.isShowFormatControlBar&&D.mode===i.unref(De).EDITOR?(i.openBlock(),i.createElementBlock("div",{key:0,style:i.normalizeStyle({...i.unref(M),visibility:i.unref(F)?"visible":"hidden",pointerEvents:i.unref(F)?"auto":"none"}),class:i.normalizeClass(i.unref(ke)("absolute left-5 right-5 z-[12]",i.unref(L)&&"fixed",D.customClassFormatControlBar))},[i.createVNode(vo,{editor:i.unref(H),mode:D.mode,disabled:!i.unref(k)||D.disabled},null,8,["editor","mode","disabled"])],6)):i.createCommentVNode("",!0)])),i.createVNode(i.unref(Yb),{class:i.normalizeClass(i.unref(ke)("flex-1 basis-0 flex-col",i.unref(Y)&&"pb-16")),style:i.normalizeStyle({...i.unref(T)}),horizontal:"",onResize:i.unref(z)},{default:i.withCtx(()=>[i.unref(ce)?(i.openBlock(),i.createBlock(i.unref(ba),{key:0,size:i.unref(Ue),"min-size":i.unref(N),class:"flex flex-col"},{default:i.withCtx(()=>{var Er,Zn;return[(Er=D.titleBarComment)!=null&&Er.title?(i.openBlock(),i.createBlock(Y5,{key:0,"title-bar":D.titleBarComment,class:"mb-[3px]"},null,8,["title-bar"])):i.createCommentVNode("",!0),(Zn=D.fieldNameComment)!=null&&Zn.label?(i.openBlock(),i.createElementBlock("div",{key:1,onClick:Z[0]||(Z[0]=kr=>i.unref(Et)("pane1")),class:i.normalizeClass(i.unref(ke)("flex justify-between items-center py-1.5 mb-1 active:bg-ed-accent",!D.isAccordion&&"pointer-events-none"))},[i.createVNode(eh,{"field-name":D.fieldNameComment,mode:D.mode},null,8,["field-name","mode"]),D.isAccordion?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(ve)?i.unref(cg):i.unref(Nu)),{key:0,class:"h-5 w-5"})):i.createCommentVNode("",!0)],2)):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{onScroll:Z[2]||(Z[2]=(...kr)=>i.unref(ge)&&i.unref(ge)(...kr)),class:i.normalizeClass(i.unref(ke)("flex-1 !overflow-y-auto overflow-x-hidden basis-0 flex h-full flex-col",!i.unref(se)&&"scrollbar-thumb-transparent",D.contentClass))},[i.createVNode(oQ,{ref:"editorCommentRef",mode:D.mode,extensions:D.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":D.disableSuperInput,"field-name-comment":D.fieldNameComment,"is-show-format-control-bar":D.isShowFormatControlBar,"auto-focus":D.autoFocus,"onUpdate:modelValue":Z[1]||(Z[1]=kr=>o("update:comment",kr)),onSetEditorSelected:ne},null,8,["mode","extensions","model-value","disabled","disable-super-input","field-name-comment","is-show-format-control-bar","auto-focus"])],34),[[i.vShow,i.unref(ve)]])]}),_:1},8,["size","min-size"])):i.createCommentVNode("",!0),i.createVNode(i.unref(ba),{size:i.unref(mt),"min-size":i.unref(N),class:"flex flex-col"},{default:i.withCtx(()=>{var Er,Zn,kr;return[(Er=D.titleBarContent)!=null&&Er.title?(i.openBlock(),i.createBlock(Y5,{key:0,"title-bar":D.titleBarContent,class:"mb-[3px]"},null,8,["title-bar"])):i.createCommentVNode("",!0),i.createElementVNode("div",sQ,[(Zn=D.fieldNameContent)!=null&&Zn.label?(i.openBlock(),i.createElementBlock("div",{key:0,onClick:Z[3]||(Z[3]=qo=>i.unref(Et)("pane2")),class:i.normalizeClass(i.unref(ke)("flex justify-between items-center py-1.5 mb-1 active:bg-ed-accent flex-1",!D.isAccordion&&"pointer-events-none"))},[i.createVNode(eh,{"field-name":D.fieldNameContent,mode:D.mode},null,8,["field-name","mode"]),D.isAccordion?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Me)?i.unref(cg):i.unref(Nu)),{key:0,class:"h-5 w-5"})):i.createCommentVNode("",!0)],2)):i.createCommentVNode("",!0),i.unref(oe)?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(i.unref(ke)("flex items-center gap-x-2 absolute right-9 top-1.5 z-10",!((kr=D.fieldNameContent)!=null&&kr.label)&&"static ml-auto"))},[i.createVNode(ie,{for:"superView",class:"body-medium"},{default:i.withCtx(()=>Z[8]||(Z[8]=[i.createTextVNode("수퍼")])),_:1}),i.createVNode(Be,{id:"superView",checked:i.unref(q).storage.superText.enable,"onUpdate:checked":Z[4]||(Z[4]=qo=>i.unref(q).commands.toggleSuperTextView()),class:"w-8 h-5 data-[state=checked]:bg-blue-500","custom-class-thumb":"w-4 h-4 data-[state=checked]:translate-x-3"},null,8,["checked"])],2)):i.createCommentVNode("",!0),D.contentAutoCopied?(i.openBlock(),i.createBlock(yt,{key:2,disabled:i.unref(Mp)(D.contentAutoCopied),onClick:V,variant:"ghost",class:"w-fit h-fit p-0 gap-x-1 label-large text-blue-500"},{default:i.withCtx(()=>[i.createVNode(He,{name:"autoCopy",class:"size-5"}),Z[9]||(Z[9]=i.createTextVNode("자동복사"))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.withDirectives(i.createElementVNode("div",{onScroll:Z[5]||(Z[5]=(...qo)=>i.unref(Ne)&&i.unref(Ne)(...qo)),class:i.normalizeClass(i.unref(ke)("flex-1 !overflow-y-auto overflow-x-hidden basis-0 flex flex-col",!i.unref(Re)&&"scrollbar-thumb-transparent",D.contentClass))},[i.createVNode(i.unref(Ao),{id:"editor-panel",editor:i.unref(q),class:i.normalizeClass(["flex-1 flex-col relative break-all",D.mode===i.unref(De).PLAIN_TEXT&&"plain-text"])},null,8,["editor","class"])],34),[[i.vShow,i.unref(Me)]])]}),_:1},8,["size","min-size"])]),_:1},8,["class","style","onResize"])],6)):i.createCommentVNode("",!0),(pt=i.unref(q))!=null&&pt.storage.superText&&i.unref(ue)?(i.openBlock(),i.createBlock(nQ,{key:1,open:i.unref(we),editor:i.unref(q),"bottom-sheet-component":i.unref(ue),onClose:Z[6]||(Z[6]=Er=>i.unref(q).commands.toggleSuperInputMoblie()),onSave:Ee},null,8,["open","editor","bottom-sheet-component"])):i.createCommentVNode("",!0),(pn=i.unref(H))!=null&&pn.storage.configPlan?(i.openBlock(),i.createBlock(EE,{key:2,open:(On=i.unref(H))==null?void 0:On.storage.configPlan.isShowConfigPlanInput,"is-view-mode":!((qr=i.unref(H))!=null&&qr.storage.configPlan.isShowConfigPlanInput),editor:i.unref(H),title:D.$t("editor.configPlan"),onClose:Z[7]||(Z[7]=Er=>i.unref(H).commands.toggleConfigPlanInput()),onSave:We},null,8,["open","is-view-mode","editor","title"])):i.createCommentVNode("",!0)],64)}}}),aQ=i.defineComponent({__name:"ArticleEditor",props:{mode:{default:De.STRAIGHT},isMobile:{type:Boolean},superTextArea:{},modelValue:{},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{},dark:{type:Boolean},disabled:{type:Boolean},hideToolbar:{type:Boolean},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean},maxWidth:{},minHeight:{},maxHeight:{},height:{},extensions:{},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},setup(t){const e=t,n=wn();return i.onMounted(()=>{n.setTextAlert(e.textAlert||"")}),(r,o)=>e.isMobile?(i.openBlock(),i.createBlock(Cc,i.mergeProps({key:1},e,{"onUpdate:modelValue":o[2]||(o[2]=s=>r.$emit("update:modelValue",s)),"onUpdate:comment":o[3]||(o[3]=s=>r.$emit("update:comment",s))}),null,16)):(i.openBlock(),i.createBlock(Np,i.mergeProps({key:0},e,{"onUpdate:modelValue":o[0]||(o[0]=s=>r.$emit("update:modelValue",s)),"onUpdate:comment":o[1]||(o[1]=s=>r.$emit("update:comment",s))}),null,16))}}),lQ=i.defineComponent({__name:"DigitalNewsEditor",props:{mode:{default:De.EDITOR},isMobile:{type:Boolean},superTextArea:{},modelValue:{},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{},dark:{type:Boolean},disabled:{type:Boolean},hideToolbar:{type:Boolean},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean},maxWidth:{},minHeight:{},maxHeight:{},height:{},extensions:{},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},setup(t){const e=t;return(n,r)=>{const o=Np,s=Cc;return e.isMobile?(i.openBlock(),i.createBlock(s,i.mergeProps({key:1},e,{"onUpdate:modelValue":r[1]||(r[1]=a=>n.$emit("update:modelValue",a)),"onUpdate:comment":r[2]||(r[2]=a=>n.$emit("update:comment",a))}),null,16)):(i.openBlock(),i.createBlock(o,i.mergeProps({key:0},e,{"onUpdate:modelValue":r[0]||(r[0]=a=>n.$emit("update:modelValue",a))}),null,16))}}});var Z5={exports:{}};(function(t){(function(){function e(H){return H===">"}function n(H){return H==="<"}function r(H){return/^\s+$/.test(H)}function o(H){var F=H.match(/^\s*<([^!>][^>]*)>\s*$/);return!!F&&F[1].trim().split(" ")[0]}function s(H){return!o(H)}function a(H){return/^<!--/.test(H)}function l(H){return/--\>$/.test(H)}var u,c=new RegExp("^<(iframe|object|math|svg|script|video|head|style|a)");function f(H){var F=u.exec(H);return F&&F[1]}function p(H,F){return H.substring(H.length-F.length-2)==="</"+F}function m(H){return/^\s*<[^>]+\/>\s*$/.test(H)}function g(H){var F=/^<img[\s>]/.test(H);return F||s(H)||f(H)||m(H)}function b(H){return{string:H,key:x(H)}}function y(H,F,L,K){this.segment=K,this.length=L,this.startInBefore=H+K.beforeIndex,this.startInAfter=F+K.afterIndex,this.endInBefore=this.startInBefore+this.length-1,this.endInAfter=this.startInAfter+this.length-1,this.segmentStartInBefore=H,this.segmentStartInAfter=F,this.segmentEndInBefore=this.segmentStartInBefore+this.length-1,this.segmentEndInAfter=this.segmentStartInAfter+this.length-1}function w(H){for(var F="char",L="",K="",J=[],Y=0;Y<H.length;Y++){var ne=H[Y];switch(F){case"tag":var we=f(L);we?(F="atomic_tag",K=we,L+=ne):a(L)?(F="html_comment",L+=ne):e(ne)?(L+=">",J.push(b(L)),L="",r(ne)?F="whitespace":F="char"):L+=ne;break;case"atomic_tag":e(ne)&&p(L,K)?(L+=">",J.push(b(L)),L="",K="",F="char"):L+=ne;break;case"html_comment":L+=ne,l(L)&&(L="",F="char");break;case"char":n(ne)?(L&&J.push(b(L)),L="<",F="tag"):/\s/.test(ne)?(L&&J.push(b(L)),L=ne,F="whitespace"):/[\w\d\#@]/.test(ne)?L+=ne:/&/.test(ne)?(L&&J.push(b(L)),L=ne):(L+=ne,J.push(b(L)),L="");break;case"whitespace":n(ne)?(L&&J.push(b(L)),L="<",F="tag"):r(ne)?L+=ne:(L&&J.push(b(L)),L=ne,F="char");break;default:throw new Error("Unknown mode "+F)}}return L&&J.push(b(L)),J}function x(H){var F=/^<img.*src=['"]([^"']*)['"].*>$/.exec(H);if(F)return'<img src="'+F[1]+'">';var L=/^<a.*href=['"]([^"']*)['"]/.exec(H);if(L)return'<a href="'+L[1]+'"></a>';var K=/^<object.*data=['"]([^"']*)['"]/.exec(H);if(K)return'<object src="'+K[1]+'"></object>';if(/^<(svg|math|video)[\s>]/.test(H)){var J=H.indexOf('data-uuid="');if(J!==-1){var Y=H.slice(0,J),ne=H.slice(J+44);return Y+ne}else return H}var we=/^<iframe.*src=['"]([^"']*)['"].*>/.exec(H);if(we)return'<iframe src="'+we[1]+'"></iframe>';var xe=/<([^\s>]+)[\s>]/.exec(H);return xe?"<"+xe[1].toLowerCase()+">":H&&H.replace(/(\s+| | )/g," ")}function E(H){return H.reduce(function(F,L,K){return F[L.key]?F[L.key].push(K):F[L.key]=[K],F},Object.create(null))}function k(H,F){return F.endInBefore<H.startInBefore&&F.endInAfter<H.startInAfter?-1:F.startInBefore>H.endInBefore&&F.startInAfter>H.endInAfter?1:0}function C(){this._root=null}C.prototype={add:function(H){var F={value:H,left:null,right:null},L=this._root;if(L)for(;;){var K=k(L.value,H);if(K===-1)if(L.left)L=L.left;else{L.left=F;break}else if(K===1)if(L.right)L=L.right;else{L.right=F;break}else break}else this._root=F},toArray:function(){function H(F,L){return F&&(H(F.left,L),L.push(F.value),H(F.right,L)),L}return H(this._root,[])}};function _(H){for(var F=H.beforeTokens,L=H.afterMap,K=null,J=null,Y=0;Y<F.length;Y++){var ne=!1,we=F.length-Y;if(J&&we<J.length)break;var xe=F[Y];if(xe.key===" "){K=Y;continue}K===Y-1&&(ne=!0);var $e=L[xe.key];$e&&$e.forEach(function(Ee){var We=J?J.length:0,Q=A(H,Y,Ee,We,ne);Q&&Q.length>We&&(J=Q)})}return J}function A(H,F,L,K,J){var Y=H.beforeTokens,ne=H.afterTokens,we=F+K,xe=L+K;if(!(we>=Y.length||xe>=ne.length)){if(K){var $e=Y[we].key,Ee=ne[xe].key;if($e!==Ee)return}for(var We=!0,Q=1,oe=F+Q,ue=L+Q;We&&oe<Y.length&&ue<ne.length;){var ce=Y[oe].key,be=ne[ue].key;ce===be?(Q++,oe=F+Q,ue=L+Q):We=!1}if(J&&F>0&&L>0){var N=Y[F-1].key,ve=ne[L-1].key;N===" "&&ve===" "&&(F--,L--,Q++)}return new y(F,L,Q,H)}}function T(H,F,L,K){return{beforeTokens:H,afterTokens:F,beforeMap:E(H),afterMap:E(F),beforeIndex:L,afterIndex:K}}function P(H){for(var F=new C,L,K=[H];K.length;)if(H=K.pop(),L=_(H),L&&L.length){if(L.segmentStartInBefore>0&&L.segmentStartInAfter>0){var J=H.beforeTokens.slice(0,L.segmentStartInBefore),Y=H.afterTokens.slice(0,L.segmentStartInAfter);K.push(T(J,Y,H.beforeIndex,H.afterIndex))}var ne=H.beforeTokens.slice(L.segmentEndInBefore+1),we=H.afterTokens.slice(L.segmentEndInAfter+1),xe=H.beforeIndex+L.segmentEndInBefore+1,$e=H.afterIndex+L.segmentEndInAfter+1;ne.length&&we.length&&K.push(T(ne,we,xe,$e)),F.add(L)}return F.toArray()}function I(H,F){if(!H)throw new Error("Missing beforeTokens");if(!F)throw new Error("Missing afterTokens");var L=0,K=0,J=[],Y=T(H,F,0,0),ne=P(Y);ne.push(new y(H.length,F.length,0,Y));for(var we=0;we<ne.length;we++){var xe=ne[we],$e="none";L===xe.startInBefore?K!==xe.startInAfter&&($e="insert"):($e="delete",K!==xe.startInAfter&&($e="replace")),$e!=="none"&&J.push({action:$e,startInBefore:L,endInBefore:$e!=="insert"?xe.startInBefore-1:null,startInAfter:K,endInAfter:$e!=="delete"?xe.startInAfter-1:null}),xe.length!==0&&J.push({action:"equal",startInBefore:xe.startInBefore,endInBefore:xe.endInBefore,startInAfter:xe.startInAfter,endInAfter:xe.endInAfter}),L=xe.endInBefore+1,K=xe.endInAfter+1}var Ee=[],We={action:"none"};function Q(ce){return ce.action!=="equal"||ce.endInBefore-ce.startInBefore!==0?!1:/^\s$/.test(H.slice(ce.startInBefore,ce.endInBefore+1))}for(var oe=0;oe<J.length;oe++){var ue=J[oe];Q(ue)&&We.action==="replace"||ue.action==="replace"&&We.action==="replace"?(We.endInBefore=ue.endInBefore,We.endInAfter=ue.endInAfter):(Ee.push(ue),We=ue)}return Ee}function M(H){this.tokens=H,this.notes=H.reduce(function(F,L,K){F.notes.push({isWrappable:g(L),insertedTag:!1});var J=!m(L)&&o(L),Y=F.tagStack[F.tagStack.length-1];return J&&(Y&&"/"+Y.tag===J?(F.notes[Y.position].insertedTag=!0,F.tagStack.pop()):F.tagStack.push({tag:J,position:K})),F},{notes:[],tagStack:[]}).notes}M.prototype.combine=function(H,F){var L=this.notes,K=this.tokens.slice(),J=K.reduce(function(Y,ne,we){L[we].insertedTag&&(K[we]=F(K[we])),Y.status===null&&(Y.status=L[we].isWrappable);var xe=L[we].isWrappable;return xe!==Y.status&&(Y.list.push({isWrappable:Y.status,tokens:K.slice(Y.lastIndex,we)}),Y.lastIndex=we,Y.status=xe),we===K.length-1&&Y.list.push({isWrappable:Y.status,tokens:K.slice(Y.lastIndex,we+1)}),Y},{list:[],status:null,lastIndex:0}).list;return J.map(H).join("")};function j(H,F,L,K,J){var Y=new M(F);K=K?K+"-":"";var ne=" data-"+K+'operation-index="'+L+'"';return J&&(ne+=' class="'+J+'"'),Y.combine(function(we){if(we.isWrappable){var xe=we.tokens.join("");if(xe.trim())return"<"+H+ne+">"+xe+"</"+H+">"}else return we.tokens.join("");return""},function(we){var xe=' data-diff-node="'+H+'"';return xe+=" data-"+K+'operation-index="'+L+'"',we.replace(/>\s*$/,xe+"$&")})}var U={equal:function(H,F,L,K,J,Y){var ne=L.slice(H.startInAfter,H.endInAfter+1);return ne.reduce(function(we,xe){return we+xe.string},"")},insert:function(H,F,L,K,J,Y){var ne=L.slice(H.startInAfter,H.endInAfter+1),we=ne.map(function(xe){return xe.string});return j("ins",we,K,J,Y)},delete:function(H,F,L,K,J,Y){var ne=F.slice(H.startInBefore,H.endInBefore+1),we=ne.map(function(xe){return xe.string});return j("del",we,K,J,Y)},replace:function(){return U.delete.apply(null,arguments)+U.insert.apply(null,arguments)}};function q(H,F,L,K,J){return L.reduce(function(Y,ne,we){return Y+U[ne.action](ne,H,F,we,K,J)},"")}function le(H,F,L,K,J){if(H===F)return H;J?u=new RegExp("^<("+J.replace(/\s*/g,"").replace(/,/g,"|")+")"):u=c,H=w(H),F=w(F);var Y=I(H,F);return q(H,F,Y,K,L)}le.htmlToTokens=w,le.findMatchingBlocks=P,P.findBestMatch=_,P.createMap=E,P.createToken=b,P.createSegment=T,P.getKeyForToken=x,le.calculateOperations=I,le.renderOperations=q,t!==null?t.exports=le:this.htmldiff=le}).call(Za)})(Z5);var uQ=Z5.exports;const cQ=WB(uQ),Q5=(t,e,n)=>{let r="";{const o=Vn(t,n),s=Vn(e,n);r=cQ(o,s,null,null,"button")}return r=r.replace(/<del[^>]*>/g,'<span class="diff-del">').replace(/<\/del>/g,"</span>").replace(/<ins[^>]*>/g,'<mark style="background:#FEF3C7;">').replace(/<\/ins>/g,"</mark>"),r},dQ={key:0,class:"px-2 min-h-[24px] flex items-center justify-between gap-1 mb-1.5"},fQ={class:"flex items-center gap-2"},pQ={class:"body-small text-gray-600 px-[6px] py-[2px] shrink-0 rounded-[4px] bg-gray-100"},hQ={class:"label-large text-gray-800 line-clamp-1"},mQ={class:"flex items-center gap-1 shrink-0"},gQ={class:"mt-[2px]"},bQ={class:"body-small text-gray-400"},vQ={class:"border border-ed-gray rounded-[5px] p-2.5 my-2 h-full"},yQ={key:0,class:"px-2 min-h-[24px] flex items-center justify-between gap-1 mb-1.5"},wQ={class:"flex items-center gap-2"},xQ={class:"body-small text-blue-500 px-[6px] py-[2px] shrink-0 rounded-[4px] bg-blue-50"},CQ={class:"label-large text-gray-800 line-clamp-1"},EQ={class:"flex items-center gap-1 shrink-0"},kQ={class:"mt-[2px]"},SQ={class:"body-small text-gray-400"},_Q=Bo(i.defineComponent({__name:"ArticleCompareEditor",props:{originalData:{},changedData:{},extensions:{},editorClass:{}},setup(t){const e=t,n=i.ref(!1),r=i.computed(()=>!e.originalData||!e.changedData?{comment:"",content:""}:{comment:Q5(e.originalData.comment,e.changedData.comment,!0),content:Q5(e.originalData.content,e.changedData.content,!0)}),{HEADER_ONLY_SIZE:o,pane1ContentVisible:s,pane2ContentVisible:a,pane1Size:l,pane2Size:u,handlePaneResize:c}=J5(!1,6),{isScrolling:f,handleScroll:p}=xc(),{isScrolling:m,handleScroll:g}=xc();return(b,y)=>{const w=Lt;return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(i.unref(ke)("h-full",b.editorClass))},[i.createVNode(i.unref(Yb),{horizontal:"",onResize:i.unref(c)},{default:i.withCtx(()=>[i.createVNode(i.unref(ba),{size:i.unref(l),"min-size":i.unref(o),class:"flex flex-col"},{default:i.withCtx(()=>{var x,E,k,C,_,A,T,P,I,M;return[(E=(x=b.originalData)==null?void 0:x.titleBar)!=null&&E.title?(i.openBlock(),i.createElementBlock("div",dQ,[i.createElementVNode("div",fQ,[i.createElementVNode("div",pQ,i.toDisplayString(b.$t("기준")),1),i.createElementVNode("h3",hQ,i.toDisplayString((C=(k=b.originalData)==null?void 0:k.titleBar)==null?void 0:C.title),1)]),i.createElementVNode("div",mQ,[i.createElementVNode("div",gQ,[i.createVNode(w,{name:"Clock",class:"w-[13px] h-[13px] text-gray-400"})]),i.createElementVNode("div",bQ,i.toDisplayString((A=(_=b.originalData)==null?void 0:_.titleBar)==null?void 0:A.time),1)])])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{onScroll:y[0]||(y[0]=(...j)=>i.unref(p)&&i.unref(p)(...j)),class:i.normalizeClass(i.unref(ke)("border border-gray-50 rounded-md py-[10px] px-4 flex-1 overflow-y-auto",!i.unref(f)&&"scrollbar-thumb-transparent"))},[i.createVNode(Cc,{"editor-class":"h-full",mode:i.unref(De).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(T=b.originalData)==null?void 0:T.fieldNameComment,"field-name-content":(P=b.originalData)==null?void 0:P.fieldNameContent,comment:(I=b.originalData)==null?void 0:I.comment,"model-value":(M=b.originalData)==null?void 0:M.content},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value"])],34),[[i.vShow,i.unref(s)]])]}),_:1},8,["size","min-size"]),i.unref(n)?(i.openBlock(),i.createBlock(i.unref(ba),{key:0},{default:i.withCtx(()=>{var x,E,k,C;return[i.createElementVNode("div",vQ,[i.createVNode(Cc,{"editor-class":"h-full",mode:i.unref(De).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(x=b.changedData)==null?void 0:x.fieldNameComment,"field-name-content":(E=b.changedData)==null?void 0:E.fieldNameContent,comment:(k=b.changedData)==null?void 0:k.comment,"model-value":(C=b.changedData)==null?void 0:C.content},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value"])])]}),_:1})):i.createCommentVNode("",!0),i.createVNode(i.unref(ba),{size:i.unref(u),"min-size":i.unref(o),class:"flex flex-col"},{default:i.withCtx(()=>{var x,E,k,C,_,A,T,P;return[(E=(x=b.changedData)==null?void 0:x.titleBar)!=null&&E.title?(i.openBlock(),i.createElementBlock("div",yQ,[i.createElementVNode("div",wQ,[i.createElementVNode("div",xQ,i.toDisplayString(b.$t("대상")),1),i.createElementVNode("h3",CQ,i.toDisplayString((C=(k=b.changedData)==null?void 0:k.titleBar)==null?void 0:C.title),1)]),i.createElementVNode("div",EQ,[i.createElementVNode("div",kQ,[i.createVNode(w,{name:"Clock",class:"w-[13px] h-[13px] text-gray-400"})]),i.createElementVNode("div",SQ,i.toDisplayString((A=(_=b.changedData)==null?void 0:_.titleBar)==null?void 0:A.time),1)])])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("div",{onScroll:y[1]||(y[1]=(...I)=>i.unref(g)&&i.unref(g)(...I)),class:i.normalizeClass(i.unref(ke)("border border-gray-50 bg-dark-blue-600 rounded-md py-[10px] px-4 flex-1 overflow-y-auto",!i.unref(m)&&"scrollbar-thumb-transparent"))},[i.createVNode(Cc,{"editor-class":"h-full",mode:i.unref(De).REPORT,disabled:"","hide-toolbar":"",extensions:b.extensions,"field-name-comment":(T=b.changedData)==null?void 0:T.fieldNameComment,"field-name-content":(P=b.changedData)==null?void 0:P.fieldNameContent,comment:i.unref(r).comment,"model-value":i.unref(r).content},null,8,["mode","extensions","field-name-comment","field-name-content","comment","model-value"])],34),[[i.vShow,i.unref(a)]])]}),_:1},8,["size","min-size"])]),_:1},8,["onResize"])],2)}}}),[["__scopeId","data-v-cc9492d8"]]),N5=t=>{if(!t)return-1;const{from:e}=t.state.selection;let n=0;return t.state.doc.descendants((r,o)=>{r.type.name===xp&&o<e&&n++}),n},TQ=i.defineComponent({__name:"SuperViewMobileSuperEditor",props:{isMobile:{type:Boolean},superTextArea:{},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{default:null},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{},contentClass:{},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n;i.computed(()=>r.mode===De.EDITOR);const s=ht.useEventBus(ar.RENDER_SUPER_TEXT),a=wn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,p=i.ref(!1);i.provide("isEditable",p);const m=i.ref(pw(r.modelValue));function g(C){if(r.disabled||r.readonly)return;const _=N5(C);o("lineFocus",{lineIndex:_})}function b(){o("lineFocus",{lineIndex:void 0})}const y=new ii({enablePasteRules:!1,enableInputRules:!1,content:m.value,onCreate:({editor:C})=>{c(C)},onUpdate:rt.throttle(({editor:C})=>{l.value=!0;const _=k(C,r.output);o("update:modelValue",_),o("change",{editor:C,output:_}),c(C)},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(r.extensions)),"name"),editable:p.value,onFocus:()=>{x(),w.value=!0,g(y)},onBlur:()=>{w.value=!1,b()},onSelectionUpdate:()=>{g(y)}}),w=i.ref(!1);function x(){o("setEditorSelected",y)}function E(){s.emit({action:"render"})}function k(C,_){if(!C)return"";if(C.isEmpty)return _==="json"?{}:"";switch(_){case"html":return C.getHTML();case"json":return C.getJSON();case"text":return C.getText();default:return""}}return i.watch(()=>f.languages,()=>{y.commands.checkSpelling()}),i.watch(()=>r.modelValue,C=>{if(!y||rt.isEqual(k(y,r.output),C))return;const{from:_,to:A}=y.state.selection;y.commands.setTextSelection({from:_,to:A}),E(),m.value=pw(C)},{deep:!0}),i.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:C})=>{o("changed:selection",{editor:C})})}),i.watch(()=>r.disableSuperInput,()=>{const C=document.getElementById(or.COMMENT);C==null||C.setAttribute(or.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),i.onUnmounted(()=>y==null?void 0:y.destroy()),Qp(y),i.onMounted(()=>{var C,_;(C=y==null?void 0:y.commands)!=null&&C.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(!1),(_=y==null?void 0:y.commands)!=null&&_.setIsMobile&&y.commands.setIsMobile(!0)}),e({editor:y}),(C,_)=>{var T;const A=eh;return i.openBlock(),i.createElementBlock(i.Fragment,null,[(T=C.fieldNameSuper)!=null&&T.label?(i.openBlock(),i.createBlock(A,{key:0,"field-name":C.fieldNameSuper,mode:C.mode,disabled:C.disabled,class:"mb-1",intent:"secondary"},null,8,["field-name","mode","disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(Ao),{editor:i.unref(y),spellcheck:"true",class:i.normalizeClass(["flex-1 flex-col"])},null,8,["editor"])],64)}}}),AQ=(t,e)=>{let n=null;return t.state.doc.descendants((r,o)=>{if(r.type.name==="paragraph"&&Number(r.attrs["number-line"])===e)return n={node:r,pos:o},!1}),n},ek="focused-line";async function tk({lineIndex:t,editor:e}){if(e.state.doc.descendants((l,u)=>{if(l.attrs.class===ek){const c=e.state.tr.setNodeMarkup(u,void 0,{...l.attrs,class:""});return e.view.dispatch(c),!1}}),await i.nextTick(),!t)return;const n=AQ(e,t);if(!n)return;const{node:r,pos:o}=n,s=e.state.tr.setNodeMarkup(o,void 0,{...r.attrs,class:ek});e.view.dispatch(s),await i.nextTick(),e.view.nodeDOM(o).scrollIntoView({behavior:"smooth"})}const OQ=i.defineComponent({__name:"SuperViewMobileEditor",props:{isMobile:{type:Boolean},superTextArea:{},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean},fontSizeDefault:{default:"12px"},fontFamilyDefault:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{default:null},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},toolBarClass:{default:void 0},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,o=n;i.provide("isMobile",!0),i.computed(()=>r.mode===De.EDITOR);const s=ht.useEventBus(ar.INCREASE_DECREASE_FONTSIZE);i.useAttrs();const a=wn(),{state:l,isFullscreen:u,isReady:c,editor:f,updateEditorState:p,checkSpellStore:m}=a,g=i.ref(!1);i.provide("isEditable",g);const b=i.ref(void 0),y=i.ref(),w=i.computed(()=>[...l.extensions,...rt.differenceBy(r.extensions,l.extensions,"name")].map((F,L)=>F.configure({sort:L}))),x=i.ref(r.fontSizeDefault),E=i.ref(r.fontFamilyDefault);i.provide("fontSize",x),i.provide("fontFamily",E);const k=i.computed(()=>({fontFamily:E.value,fontSize:x.value})),C=i.ref(),_=F=>{const L=parseInt(x.value||"12px"),K=F?L+2:L-2;x.value=K+"px"};i.onBeforeMount(()=>{s.on(_)}),i.onBeforeUnmount(()=>{s.off(_)});const A=i.computed(()=>({...i.unref(u)?{height:"100%"}:{minHeight:r.minHeight?an(r.minHeight):void 0,maxHeight:r.maxHeight?an(r.maxHeight):void 0,height:r.height?an(r.height):void 0},maxWidth:an(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0}));function T(F){if(r.disabled||r.readonly)return;const L=N5(F);b.value=L}function P(){b.value=void 0}const I=new ii({enablePasteRules:!1,enableInputRules:!1,content:Vn(r.modelValue,r.disabled,r.mode),onCreate:({editor:F})=>{p(F)},onUpdate:rt.throttle(({editor:F})=>{c.value=!0;const L=le(F,r.output);o("update:modelValue",L),o("change",{editor:F,output:L}),p(F)},Mo),extensions:rt.uniqBy(rt.reverse(i.unref(w)),"name"),editable:g.value,onFocus:()=>{q(),M.value=!0,T(I)},onBlur:()=>{M.value=!1,P()},onSelectionUpdate:()=>{T(I)}}),M=i.ref(!1),j=i.ref();i.onMounted(()=>{j.value=I});const U=({lineIndex:F})=>{var K;I&&tk({lineIndex:F,editor:I});const L=(K=y.value)==null?void 0:K.editor;L&&tk({lineIndex:F,editor:L})};i.watch(()=>b.value,F=>{o("lineFocus",{lineIndex:F}),U({lineIndex:F})},{immediate:!0});function q(F){j.value=I}function le(F,L){if(!F)return"";if(F.isEmpty)return L==="json"?{}:"";switch(L){case"html":return F.getHTML();case"json":return F.getJSON();case"text":return F.getText({blockSeparator:`
|
|
305
305
|
`});default:return""}}function H(F){return F.every(L=>I==null?void 0:I.extensionManager.extensions.find(K=>K.name===L))}return i.watch(()=>m.languages,()=>{I.commands.checkSpelling()}),i.watch(()=>r.modelValue,F=>{if(!I||rt.isEqual(le(I,r.output),F))return;const{from:L,to:K}=I.state.selection;I.commands.setTextSelection({from:L,to:K}),I.commands.setContent(Vn(F,r.disabled,r.mode),!1)},{deep:!0}),i.watch(()=>f.value,()=>{f.value&&f.value.on("selectionUpdate",({editor:F})=>{o("changed:selection",{editor:F})})}),i.onUnmounted(()=>{var F;I==null||I.destroy(),(F=j.value)==null||F.destroy()}),Ju(_u.SAVE,()=>{localStorage.setItem("content",le(I,"html"))}),i.onMounted(()=>{var F,L;(F=I==null?void 0:I.commands)!=null&&F.setIsEnableSuggestion&&I.commands.setIsEnableSuggestion(!1),(L=I==null?void 0:I.commands)!=null&&L.setIsMobile&&I.commands.setIsMobile(!0)}),Qp(I),e({editor:I}),(F,L)=>{const K=Zp,J=Jp,Y=Yp,ne=Bf,we=K5,xe=eh;return j.value?(i.openBlock(),i.createElementBlock("div",{key:0,id:"vdc-editor",ref_key:"editorRef",ref:C,style:i.normalizeStyle(A.value),class:i.normalizeClass(i.unref(ke)("vdc-editor mobile relative w-full flex flex-col editor-line-number editor-line",!r.height&&"flex-1",F.editorClass))},[!F.hideBubble&&!F.disabled&&g.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[H([i.unref(dc)])?(i.openBlock(),i.createBlock(K,{key:0,editor:i.unref(I)},null,8,["editor"])):i.createCommentVNode("",!0),H([i.unref(ua)])?(i.openBlock(),i.createBlock(J,{key:1,editor:i.unref(I)},null,8,["editor"])):i.createCommentVNode("",!0),H([i.unref(fs)])?(i.openBlock(),i.createBlock(Y,{key:2,editor:i.unref(I)},null,8,["editor"])):i.createCommentVNode("",!0),H([i.unref(ps),i.unref(hs)])?(i.openBlock(),i.createBlock(ne,{key:3,editor:i.unref(I)},null,8,["editor"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),F.hideToolbar?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(we,{key:1,editor:j.value,mode:F.mode,disabled:F.disabled,class:i.normalizeClass(["mb-[3px]",F.toolBarClass]),"active-extensions":[fc]},null,8,["editor","mode","disabled","class","active-extensions"])),i.createVNode(i.unref(Yb),{class:i.normalizeClass(i.unref(ke)("flex flex-col")),style:i.normalizeStyle({...k.value}),horizontal:""},{default:i.withCtx(()=>[i.createVNode(i.unref(ba),{size:50,class:"border-none p-0 flex flex-col bg-[#EEEEEE]"},{default:i.withCtx(()=>{var $e;return[i.createElementVNode("div",{class:i.normalizeClass(i.unref(ke)("flex-1 !overflow-y-auto scrollbar-hide basis-0 flex flex-col pt-1.5 p-2.5 border border-ed-gray rounded-[5px]",F.contentClass))},[($e=F.fieldNameContent)!=null&&$e.label?(i.openBlock(),i.createBlock(xe,{key:0,"field-name":F.fieldNameContent,mode:F.mode,disabled:F.disabled,class:"mb-1"},null,8,["field-name","mode","disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(Ao),{editor:i.unref(I),spellcheck:"true",class:i.normalizeClass(["flex-1 flex-col"])},null,8,["editor"])],2)]}),_:1}),i.createVNode(i.unref(ba),{size:50,class:"border-none p-0 flex flex-col"},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(i.unref(ke)("flex-1 overflow-y-auto scrollbar-hide flex flex-col pt-1.5 p-2.5 border border-ed-gray rounded-[5px]",M.value&&"border-ed-blue",F.disabled&&"border-transparent",F.contentClass))},[i.createVNode(TQ,{ref_key:"superEditorRef",ref:y,mode:F.mode,"field-name-super":F.fieldNameSuper,extensions:F.extensions,"model-value":F.modelValue,disabled:F.disabled,readonly:F.readonly,onLineFocus:U},null,8,["mode","field-name-super","extensions","model-value","disabled","readonly"])],2)]),_:1})]),_:1},8,["class","style"])],6)):i.createCommentVNode("",!0)}}}),nk={"editor.remove":"Remove","editor.copy":"Copy","editor.words":"WORDS","editor.characters":"CHARACTERS","editor.default":"Default","editor.recent":"Recently Used","editor.nofill":"Remove Color","editor.format":"Format Painter","editor.close":"Close","editor.modify":"Modify","editor.preview.tooltip":"Preview","editor.draghandle.tooltip":"Click And Drag","editor.copyToClipboard":"CopyToClipboard","editor.importWord.tooltip":"Import from Word","editor.importWord.success":"Import Success","editor.importWord.fileTooLarge":"File is Too large","editor.importWord.error":"Import Failed, File not supported","editor.slash":"Press '/' for commands","editor.slash.empty":"No Result","editor.slash.format":"Format","editor.slash.insert":"Insert","editor.slash.embed":"Embed Services","editor.content":"Please input content","editor.slash.hint":"Please input content","editor.moremark":"More Text Styles","editor.size.small.tooltip":"Small","editor.size.medium.tooltip":"Medium","editor.size.large.tooltip":"Cover","editor.bold.tooltip":"Bold","editor.italic.tooltip":"Italic","editor.underline.tooltip":"Underline","editor.strike.tooltip":"Strike","editor.color.tooltip":"Color","editor.color.more":"Color Picker","editor.highlight.tooltip":"Highlight","editor.lineheight.tooltip":"Line Height","editor.heading.tooltip":"Headings","editor.heading.h1.tooltip":"Heading 1","editor.heading.h2.tooltip":"Heading 2","editor.heading.h3.tooltip":"Heading 3","editor.heading.h4.tooltip":"Heading 4","editor.heading.h5.tooltip":"Heading 5","editor.heading.h6.tooltip":"Heading 6","editor.paragraph.tooltip":"Paragraph","editor.textalign.tooltip":"Align","editor.textalign.left.tooltip":"Left","editor.textalign.center.tooltip":"Center","editor.textalign.right.tooltip":"Right","editor.textalign.justify.tooltip":"Justify","editor.indent":"Indent","editor.indent.indent":"Increase Indent","editor.indent.outdent":"Decrease Indent","editor.fontFamily.tooltip":"Font family","editor.fontFamily.default":"Default","editor.fontFamily.gulim":"Gulim","editor.fontFamily.dotum":"Dotum","editor.fontFamily.gungsuh":"Gungsuh","editor.fontSize.tooltip":"Font size","editor.fontSize.default.tooltip":"Default","editor.superscript.tooltip":"Superscript","editor.subscript.tooltip":"Subscript","editor.bulletlist.tooltip":"Bullet List","editor.bulletlist.disc.tooltip":"Disc","editor.bulletlist.circle.tooltip":"Circle","editor.bulletlist.square.tooltip":"Square","editor.orderedlist.tooltip":"Ordered List","editor.orderedlist.decimal.tooltip":"Decimal","editor.orderedlist.decimalLeadingZero.tooltip":"Decimal with leading zero","editor.orderedlist.lowerRoman.tooltip":"Lower Roman","editor.orderedlist.upperRoman.tooltip":"Upper Roman","editor.orderedlist.lowerLatin.tooltip":"Lower Latin","editor.orderedlist.upperLatin.tooltip":"Upper Latin","editor.orderedlist.tradChineseInformal.tooltip":"Trad Chinese Informal","editor.orderedlist.simpChineseFormal.tooltip":"Simp Chinese Informal","editor.tasklist.tooltip":"Task List","editor.indent.tooltip":"Indent","editor.outdent.tooltip":"Outdent","editor.columns.tooltip":"Columns","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"UnLink","editor.link.open.tooltip":"Open Link","editor.link.edit.tooltip":"Edit Link","editor.link.dialog.title":"Insert Link","editor.link.dialog.link":"Link","editor.link.dialog.text":"Text","editor.link.dialog.openInNewTab":"Open In New Tab","editor.link.dialog.link.placeholder":"Link Address","editor.link.dialog.text.placeholder":"Add Description","editor.link.dialog.button.apply":"Apply","editor.image.tooltip":"Image","editor.image.menu.flipX":"Flip vertical","editor.image.menu.flipY":"Flip horizontal","editor.image.menu.size":"Set Size","editor.image.menu.size.width":"Width","editor.image.menu.size.height":"Height","editor.image.dragger.tooltip":"Click or drag the image to the area to upload","editor.image.float.left.tooltip":"Float left","editor.image.float.none.tooltip":"Float none","editor.image.float.right.tooltip":"Float right","editor.image.dialog.title":"Add an image","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Upload","editor.image.dialog.uploading":"Uploading","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Lock original aspect ratio","editor.image.dialog.form.file":"File","editor.image.dialog.button.apply":"apply","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Upload","editor.video.dialog.uploading":"Uploading","editor.video.dialog.title":"Embed or upload a video","editor.video.dialog.link":"link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"apply","editor.table.tooltip":"Table","editor.table.menu.insert_table":"Insert Table","editor.table.menu.insert_table.with_header_row":"With header row","editor.table.menu.insertColumnBefore":"Insert Column Before","editor.table.menu.insertColumnAfter":"Insert Column After","editor.table.menu.deleteColumn":"Delete Column","editor.table.menu.insertRowAbove":"Insert Row Above","editor.table.menu.insertRowBelow":"Insert Row Below","editor.table.menu.deleteRow":"Delete Row","editor.table.menu.mergeCells":"Merge Cells","editor.table.menu.splitCells":"Split Cells","editor.table.menu.deleteTable":"Delete Table","editor.table.menu.setCellsBgColor":"Cell Background Color","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Horizontal Rule","editor.code.tooltip":"Code","editor.codeblock.tooltip":"Code Block","editor.clear.tooltip":"Clear Format","editor.undo.tooltip":"Undo","editor.redo.tooltip":"Redo","editor.fullscreen.tooltip.fullscreen":"Fullscreen","editor.fullscreen.tooltip.exit":"Fullscreen Exit","editor.imageUpload.fileTypeNotSupported":"File type not supported","editor.imageUpload.fileSizeTooBig":"File size too big, Maximum size is","editor.AI.placeholder":"Ask AI ...","editor.AI.generating":"Generating","editor.AI.insert":"Insert below selection","editor.AI.replace":"Replace selected content","editor.AI.regenerate":"Regenerate","editor.AI.close":"Close","editor.AI.stop":"Stop","editor.AI.ask":"Ask AI","editor.menubar.file":"File","editor.menubar.edit":"Edit","editor.menubar.view":"View","editor.menubar.insert":"Insert","editor.menubar.format":"Format","editor.menubar.menu.newDoc":"New Document","editor.menubar.menu.restoreLastDraft":"Restore last draft","editor.menubar.menu.print":"Print","editor.menubar.menu.cut":"Cut","editor.menubar.menu.copy":"Copy","editor.menubar.menu.paste":"Paste","editor.menubar.menu.pasteAsText":"Paste as text","editor.menubar.menu.selectAll":"Select all","editor.menubar.menu.preview":"Preview","editor.menubar.menu.spellCheck":"Spell check","editor.menubar.menu.spelling":"spelling","editor.menubar.menu.superView":"Super view","editor.menubar.menu.insertSuper":"Insert super","editor.menubar.menu.articleContent":"Article content","editor.menubar.menu.articleComment":"Article comment","editor.menubar.menu.cancel":"Cancel","editor.menubar.menu.save":"Save","editor.findAndReplace.tooltip":"Find and replace","editor.findAndReplace.find":"Find","editor.findAndReplace.replace":"Replace","editor.findAndReplace.replaceAll":"Replace All","editor.findAndReplace.caseSensitive":"Case Sensitive","editor.printer.tooltip":"Print","editor.superinput":"Super input","editor.insert.symbol":"Insert symbol","editor.check":"Check","editor.detail":"Detail","editor.inputSuper":"Input Super","editor.insertSpecial":"Special characters","editor.cut":"Cut","editor.paste":"Paste","editor.selectAll":"SelectAll","editor.delete":"Delete","editor.super.edit":"Super edit","editor.super.delete":"Super delete","editor.configPlan.edit":"Config plan edit","editor.configPlan.delete":"Config plan delete","editor.super":"Super","editor.configPlan":"Config plan","editor.insertConfigPlan":"Insert config plan","editor.alert":"Super has been changed. Super ID will be deleted.","editor.alertConfirm":"Confirm","editor.alertYes":"OK"},rk={"editor.remove":"제거","editor.copy":"복사","editor.words":"낱말","editor.characters":"문자","editor.default":"기본값","editor.recent":"최근 사용됨","editor.nofill":"색상 제거","editor.format":"형식 페인터","editor.close":"닫기","editor.modify":"수정","editor.preview.tooltip":"미리보기","editor.draghandle.tooltip":"클릭하여 드래그","editor.copyToClipboard":"클립보드에 복사","editor.importWord.tooltip":"Word에서 가져오기","editor.importWord.success":"가져오기 성공","editor.importWord.fileTooLarge":"파일이 너무 큽니다","editor.importWord.error":"가져오기 실패, 파일이 지원되지 않음","editor.slash":"명령을 보려면 '/'를 누르세요.","editor.slash.empty":"결과 없음","editor.slash.format":"형식","editor.slash.insert":"삽입","editor.slash.embed":"서비스 삽입","editor.content":"내용을 입력해주세요","editor.slash.hint":"내용을 입력해주세요","editor.moremark":"추가 텍스트 스타일","editor.size.small.tooltip":"작음","editor.size.medium.tooltip":"중간","editor.size.large.tooltip":"표지","editor.bold.tooltip":"굵게","editor.italic.tooltip":"기울임꼴","editor.underline.tooltip":"밑줄","editor.strike.tooltip":"스트라이크","editor.color.tooltip":"색상","editor.color.more":"색상 선택기","editor.highlight.tooltip":"강조 표시","editor.lineheight.tooltip":"줄 높이","editor.heading.tooltip":"제목","editor.heading.h1.tooltip":"제목 1","editor.heading.h2.tooltip":"제목 2","editor.heading.h3.tooltip":"제목 3","editor.heading.h4.tooltip":"제목 4","editor.heading.h5.tooltip":"제목 5","editor.heading.h6.tooltip":"제목 6","editor.paragraph.tooltip":"단락","editor.textalign.tooltip":"정렬","editor.textalign.left.tooltip":"왼쪽","editor.textalign.center.tooltip":"가운데","editor.textalign.right.tooltip":"오른쪽","editor.textalign.justify.tooltip":"정렬","editor.indent":"들여쓰기","editor.indent.indent":"들여쓰기","editor.indent.outdent":"들여쓰기 줄이기","editor.fontFamily.tooltip":"글꼴 모음","editor.fontFamily.default":"기본값","editor.fontFamily.gulim":"굴림","editor.fontFamily.dotum":"돋움","editor.fontFamily.gungsuh":"궁서","editor.fontSize.tooltip":"글꼴 크기","editor.fontSize.default.tooltip":"기본값","editor.superscript.tooltip":"위 첨자","editor.subscript.tooltip":"아래첨자","editor.bulletlist.tooltip":"글머리 기호 목록","editor.bulletlist.disc.tooltip":"디스크","editor.bulletlist.circle.tooltip":"원","editor.bulletlist.square.tooltip":"사각형","editor.orderedlist.tooltip":"순서가 지정된 목록","editor.orderedlist.decimal.tooltip":"십진수","editor.orderedlist.decimalLeadingZero.tooltip":"앞에 0이 있는 십진수","editor.orderedlist.lowerRoman.tooltip":"하위 로마자","editor.orderedlist.upperRoman.tooltip":"상위 로마자","editor.orderedlist.lowerLatin.tooltip":"하위 라틴어","editor.orderedlist.upperLatin.tooltip":"상위 라틴어","editor.orderedlist.tradChinaInformal.tooltip":"중국어 비공식","editor.orderedlist.simpChinaFormal.tooltip":"간체 중국어 비공식","editor.tasklist.tooltip":"작업 목록","editor.indent.tooltip":"들여쓰기","editor.outdent.tooltip":"내어쓰기","editor.columns.tooltip":"열","editor.link.tooltip":"링크","editor.link.unlink.tooltip":"링크 해제","editor.link.open.tooltip":"링크 열기","editor.link.edit.tooltip":"링크 편집","editor.link.dialog.title":"링크 삽입","editor.link.dialog.link":"링크","editor.link.dialog.text":"텍스트","editor.link.dialog.openInNewTab":"새 탭에서 열기","editor.link.dialog.link.placeholder":"링크 주소","editor.link.dialog.text.placeholder":"설명 추가","editor.link.dialog.button.apply":"적용","editor.image.tooltip":"이미지","editor.image.menu.flipX":"세로 뒤집기","editor.image.menu.flipY":"가로 뒤집기","editor.image.menu.size":"크기 설정","editor.image.menu.size.width":"너비","editor.image.menu.size.height":"높이","editor.image.dragger.tooltip":"업로드할 영역으로 이미지를 클릭하거나 드래그하세요.","editor.image.float.left.tooltip":"왼쪽으로 부동","editor.image.float.none.tooltip":"부동 없음","editor.image.float.right.tooltip":"오른쪽으로 부동","editor.image.dialog.title":"이미지 추가","editor.image.dialog.tab.url":"URL","editor.image.dialog.tab.upload":"업로드","editor.image.dialog.uploading":"업로드 중","editor.image.dialog.form.link":"링크","editor.image.dialog.placeholder":"링크","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"원본 가로 세로 비율 잠금","editor.image.dialog.form.file":"파일","editor.image.dialog.button.apply":"적용","editor.video.tooltip":"비디오","editor.video.dialog.tab.upload":"업로드","editor.video.dialog.uploading":"업로드 중","editor.video.dialog.title":"동영상 삽입 또는 업로드","editor.video.dialog.link":"링크","editor.video.dialog.placeholder":"링크","editor.video.dialog.button.apply":"적용","editor.table.tooltip":"테이블","editor.table.menu.insert_table":"테이블 삽입","editor.table.menu.insert_table.with_header_row":"머리글 행 포함","editor.table.menu.insertColumnBefore":"앞에 열 삽입","editor.table.menu.insertColumnAfter":"다음에 열 삽입","editor.table.menu.deleteColumn":"열 삭제","editor.table.menu.insertRowAbove":"위에 행 삽입","editor.table.menu.insertRowBelow":"아래에 행 삽입","editor.table.menu.deleteRow":"행 삭제","editor.table.menu.mergeCells":"셀 병합","editor.table.menu.splitCells":"셀 분할","editor.table.menu.deleteTable":"테이블 삭제","editor.table.menu.setCellsBgColor":"셀 배경색","editor.blockquote.tooltip":"블록인용","editor.horizontalrule.tooltip":"수평 규칙","editor.code.tooltip":"코드","editor.codeblock.tooltip":"코드 블록","editor.clear.tooltip":"형식 지우기","editor.undo.tooltip":"실행 취소","editor.redo.tooltip":"다시 실행","editor.fullscreen.tooltip.fullscreen":"전체 화면","editor.fullscreen.tooltip.exit":"전체 화면 종료","editor.imageUpload.fileTypeNotSupported":"지원되지 않는 파일 형식","editor.imageUpload.fileSizeTooBig":"파일 크기가 너무 큽니다. 최대 크기는 다음과 같습니다.","editor.AI.placeholder":"AI에게 물어보세요...","editor.AI.geneating":"생성","editor.AI.insert":"선택 항목 아래에 삽입","editor.AI.replace":"선택한 콘텐츠 교체","editor.AI.regenerate":"재생성","editor.AI.close":"닫기","editor.AI.stop":"중지","editor.AI.ask":"AI에게 물어보세요","editor.menubar.file":"파일","editor.menubar.edit":"편집","editor.menubar.view":"보기","editor.menubar.insert":"삽입","editor.menubar.format":"형식","editor.menubar.menu.newDoc":"새 문서","editor.menubar.menu.restoreLastDraft":"마지막 초안 복원","editor.menubar.menu.print":"인쇄","editor.menubar.menu.cut":"잘라내기","editor.menubar.menu.copy":"복사","editor.menubar.menu.paste":"붙여넣기","editor.menubar.menu.pasteAsText":"텍스트로 붙여넣기","editor.menubar.menu.selectAll":"모두 선택","editor.menubar.menu.preview":"미리보기","editor.menubar.menu.spellCheck":"맞춤법 검사","editor.menubar.menu.spelling":"맞춤법","editor.menubar.menu.superView":"수퍼보기","editor.menubar.menu.insertSuper":"수퍼 넣기","editor.menubar.menu.articleContent":"앵커멘트","editor.menubar.menu.articleComment":"상세 텍스트","editor.menubar.menu.cancel":"취소","editor.menubar.menu.save":"저장","editor.findAndReplace.tooltip":"찾기 및 바꾸기","editor.findAndReplace.find":"찾기","editor.findAndReplace.replace":"바꾸기","editor.findAndReplace.replaceAll":"모두 바꾸기","editor.findAndReplace.caseSensitive":"대소문자 구분","editor.printer.tooltip":"인쇄","editor.superinput":"수퍼입력","editor.insert.symbol":"기호삽입","editor.check":"확인","editor.detail":"내용","editor.inputSuper":"수퍼 작성","editor.insertSpecial":"특수문자","editor.cut":"잘라내기","editor.paste":"붙여넣기","editor.selectAll":"모두선택","editor.delete":"삭제","editor.super.edit":"수퍼 수정","editor.super.delete":"수퍼 삭제","editor.configPlan.edit":"구성안 수정","editor.configPlan.delete":"구성안 삭제","editor.super":"수퍼","editor.configPlan":"구성안","editor.insertConfigPlan":"구성안넣기","editor.alert":"수퍼가 변경되었습니다. 수퍼아이디를 삭제합니다.","editor.alertConfirm":"확인","editor.alertYes":"확인"},MQ=t$({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:nk,ko:rk}});hC();const ok={install(t){t.use(MQ),t.component("vdc-editor",Np)}},BQ=ht.useEventBus(ar.RENDER_SUPER_TEXT);function IQ(){BQ.emit({action:"render"})}const RQ={class:"min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm"},LQ=i.defineComponent({__name:"BulkSpellCheckerFail",setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",RQ,[i.createVNode(i.unref(CU),{class:"h-12 w-12 text-red-500"}),n[0]||(n[0]=i.createElementVNode("div",null,"맞춤법 검사에 실패했습니다",-1)),n[1]||(n[1]=i.createElementVNode("p",{class:"text-xs font-normal text-gray-600 dark:text-gray-400"},"다시 검사하기 버튼을 눌러 재시도 해주세요",-1))]))}}),PQ={class:"min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm"},DQ=i.defineComponent({__name:"BulkSpellCheckerNotWrongWord",setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",PQ,[i.createVNode(i.unref(EU),{class:"h-12 w-12 text-blue-500"}),n[0]||(n[0]=i.createElementVNode("div",null,"맞춤법 오류가 없습니다",-1))]))}}),VQ={class:"relative"},FQ=["innerHTML"],$Q={class:"border-b border-gray-500"},zQ=i.defineComponent({__name:"BulkSpellCheckerHelpText",props:{text:{}},setup(t){const e=i.ref(!1),n=i.ref(!1),r=i.ref(null);function o(){e.value=!e.value}return i.onMounted(async()=>{await i.nextTick(),r.value&&r.value.scrollHeight>32&&(n.value=!0)}),(s,a)=>(i.openBlock(),i.createElementBlock("div",VQ,[i.createElementVNode("div",{ref_key:"helpRef",ref:r,class:i.normalizeClass(["text-gray-700 dark:text-gray-400 transition-all",i.unref(e)?"max-h-none":"max-h-[32px] overflow-hidden"]),innerHTML:s.text},null,10,FQ),i.unref(n)?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["",i.unref(ke)("w-32 flex items-end justify-end bg-gradient-to-l from-white via-white to-transparent dark:from-ed-background dark:via-ed-background",i.unref(e)?"ml-auto opacity-60":"absolute bottom-0 right-0")])},[i.createElementVNode("button",{class:"flex items-center gap-1",onClick:i.withModifiers(o,["stop"])},[i.createElementVNode("span",$Q,i.toDisplayString(i.unref(e)?"접기":"자세히"),1),i.createVNode(i.unref(Nu),{class:i.normalizeClass(["w-4 h-4 transition-transform",i.unref(e)?"rotate-180":""])},null,8,["class"])])],2)):i.createCommentVNode("",!0)]))}}),Jb=new kt("bulk-spellcheck-highlight");function HQ(t,e,n=`
|
|
306
306
|
`){return new tt({key:Jb,props:{decorations(r){const o=[],s={[Bd.SPACING]:"bulk-highlight text-blue-500 border-b-2 border-blue-500",[Bd.SPELLING]:"bulk-highlight text-red-500 border-b-2 border-red-500"};return e.forEach(a=>{var g,b;const l=Bl(t,a.startIndex,n),u=Bl(t,a.endIndex-1,n)+1,c=(b=(g=a.errorHelpDtos)==null?void 0:g[0])==null?void 0:b.errorType,f=s[c??-1]||"bulk-highlight text-green-500 border-b-2 border-green-500",p=Math.max(0,Math.min(l,r.doc.content.size)),m=Math.max(0,Math.min(u,r.doc.content.size));p<m&&o.push(jt.inline(p,m,{class:f}))}),ft.create(r.doc,o)}}})}function Zb(t,e){if(t.unregisterPlugin(Jb),!e.length)return;const n=HQ(t,e);t.registerPlugin(n)}function UQ(t){t&&t.unregisterPlugin(Jb)}function ik(t,e=`
|
|
307
307
|
`){const n=[];let r=0,o=!0;return t.state.doc.descendants((s,a)=>{if(s.isText&&s.text)for(let c=0;c<s.text.length;c++)n[r++]=a+c;const l=s.type&&s.type.name;if((l==="hardBreak"||l==="hard_break"||l==="br")&&e.length>0)for(let c=0;c<e.length;c++)n[r++]=a;if(s.isBlock){if(!o&&e.length>0)for(let c=0;c<e.length;c++)n[r++]=a;o=!1}return!0}),n}function Bl(t,e,n=`
|
|
308
308
|
`){const r=ik(t,n);if(e<0&&(e=0),e>=r.length)return t.state.doc.content.size;const o=r[e];if(o==null){for(let s=e;s<r.length;s++)if(r[s]!=null)return r[s];for(let s=e-1;s>=0;s--)if(r[s]!=null)return r[s];return t.state.doc.content.size}return o}const WQ=["onClick"],jQ={class:"flex items-center mb-2"},qQ={class:"flex items-center gap-2"},KQ={class:"break-all whitespace-normal"},GQ={class:"flex items-center mb-2"},XQ={key:0,class:"flex-1 space-y-1"},YQ={class:"text-sm"},JQ=["onClick"],ZQ={key:1},QQ={class:"flex"},NQ={class:"flex-1"},Qb=450,eN=i.defineComponent({__name:"BulkSpellCheckerWrongWordList",props:{editorsState:{}},setup(t){const e=t;function n(p){return{[Bd.SPACING]:"bg-blue-500",[Bd.SPELLING]:"bg-red-500"}[p??-1]||"bg-green-500"}function r(p){var m,g,b,y;return((y=(b=(g=(m=p==null?void 0:p.extensionStorage)==null?void 0:m.spellchecker)==null?void 0:g.spellchecker)==null?void 0:b.uiStrings)==null?void 0:y.uiStrings)||"No suggestions found"}function o(p){var m,g;if(p===Oo.EDITOR_COMMENT){(m=e.editorsState[Oo.EDITOR_CONTENT].editor)==null||m.commands.setTextSelection(0);return}if(p===Oo.EDITOR_CONTENT){(g=e.editorsState[Oo.EDITOR_COMMENT].editor)==null||g.commands.setTextSelection(0);return}}function s(p,m,g){if(!m)return;o(p);const b=Bl(m,g.startIndex),y=Bl(m,g.endIndex-1)+1;m.chain().setTextSelection({from:b,to:y}).focus().run();const w=Math.max(0,Math.floor((b+y)/2)),E=m.view.domAtPos(w).node;let k=null;E instanceof Element?k=E:E instanceof Text?k=E.parentElement:k=(E==null?void 0:E.parentElement)??m.view.dom,k!=null&&k.scrollIntoView&&k.scrollIntoView({behavior:"smooth",block:"center"})}function a(p,m,g,b){var A;if(!p)return;const y=Bl(p,g.startIndex),w=Bl(p,g.endIndex-1)+1,x=p.state.tr.insertText(b,y,w);p.view.dispatch(x),p.view.focus();const E=b.length-(((A=g.wrongWord)==null?void 0:A.length)??0),k=g.startIndex,C=g.endIndex;for(let T=m.length-1;T>=0;T--){const P=m[T];if(P.startIndex>=k&&P.startIndex<C){m.splice(T,1);continue}P.startIndex>k&&(P.startIndex+=E,P.endIndex+=E)}const _=m.indexOf(g);_!==-1&&m.splice(_,1),Zb(p,m)}const l=i.ref(null),u=i.ref(Qb),{height:c}=ht.useWindowSize();function f(){const p=l.value;if(!p)return;const m=80,g=p.getBoundingClientRect(),b=c.value-g.top-m;u.value=Qb>b?b:Qb}return i.onMounted(()=>{f(),ht.useEventListener(window,"resize",f)}),(p,m)=>{const g=zQ;return i.openBlock(),i.createElementBlock("div",{ref_key:"contentEl",ref:l,style:i.normalizeStyle({maxHeight:`${i.unref(u)}px`}),class:"pr-1 overflow-y-auto"},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.editorsState,(b,y)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:y},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(b.wrongWords,(w,x)=>{var E,k;return i.openBlock(),i.createElementBlock("div",{key:x,class:"border-b border-gray-400 dark:border-ed-muted pb-5 mb-5 cursor-pointer",onClick:C=>s(y,p.editorsState[y].editor,w)},[i.createElementVNode("div",jQ,[m[0]||(m[0]=i.createElementVNode("span",{class:"w-16 font-medium"},"입력 내용",-1)),i.createElementVNode("div",qQ,[i.createElementVNode("span",{class:i.normalizeClass(["w-1.5 h-1.5 rounded-full",n((E=w.errorHelpDtos[0])==null?void 0:E.errorType)])},null,2),i.createElementVNode("span",KQ,i.toDisplayString(w.wrongWord),1)])]),i.createElementVNode("div",GQ,[m[3]||(m[3]=i.createElementVNode("span",{class:"w-16 font-medium"},"대치어",-1)),w.correctWord.length?(i.openBlock(),i.createElementBlock("div",XQ,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(w.correctWord,(C,_)=>(i.openBlock(),i.createElementBlock("div",{key:_,class:"font-semibold px-3 py-1.5 rounded bg-gray-400 dark:bg-ed-muted flex items-center justify-between"},[i.createElementVNode("div",YQ,i.toDisplayString(C),1),i.createElementVNode("button",{class:"flex items-center gap-1 text-blue-500",onClick:i.withModifiers(A=>a(b.editor,b.wrongWords,w,C),["stop"])},[i.createVNode(i.unref(xU),{class:"w-4 h-4"}),m[1]||(m[1]=i.createTextVNode()),m[2]||(m[2]=i.createElementVNode("span",null,"바꾸기",-1))],8,JQ)]))),128))])):(i.openBlock(),i.createElementBlock("div",ZQ,i.toDisplayString(r(b.editor)),1))]),i.createElementVNode("div",QQ,[m[4]||(m[4]=i.createElementVNode("span",{class:"w-16 font-medium"},"도움말",-1)),i.createElementVNode("div",NQ,[i.createVNode(g,{text:(k=w.errorHelpDtos[0])==null?void 0:k.errorMessage},null,8,["text"])])])],8,WQ)}),128))],64))),128))],4)}}}),tN={key:0,class:"opacity-25",cx:"12",cy:"12",r:"10",fill:"#ffffff",stroke:"currentColor","stroke-width":"4"},nN={key:1,class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},rN=i.defineComponent({__name:"SpinnerIcon",props:{fillWhite:{type:Boolean,default:!1},class:{default:""}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createElementBlock("svg",{class:i.normalizeClass(i.unref(ke)("animate-spin h-5 w-5 mr-0.5",e.class)),viewBox:"0 0 24 24","aria-hidden":"true"},[n.fillWhite?(i.openBlock(),i.createElementBlock("circle",tN)):(i.openBlock(),i.createElementBlock("circle",nN)),r[0]||(r[0]=i.createElementVNode("path",{class:"opacity-100",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1))],2))}}),oN={},iN={class:"min-h-[188px] flex flex-col items-center justify-center gap-y-2 text-sm"};function sN(t,e){const n=rN;return i.openBlock(),i.createElementBlock("div",iN,[i.createVNode(n,{"fill-white":"",class:"h-10 w-10 text-blue-500"}),e[0]||(e[0]=i.createElementVNode("div",null,"맞춤법 검사 중입니다",-1))])}const aN=Bo(oN,[["render",sN]]),lN={class:"text-xs py-4 px-6"},uN={class:"flex items-center justify-between mt-3"},cN={class:"flex gap-x-1"},dN=i.defineComponent({__name:"BulkSpellCheckerContent",props:{editorsState:{},spellCheckStatus:{},allWrongWordsMissSuggestions:{type:Boolean}},emits:["close-modal","run-spellcheck","replace-all-editor-errors"],setup(t,{emit:e}){const n=e;return(r,o)=>{const s=aN,a=eN,l=DQ,u=LQ,c=yn;return i.openBlock(),i.createElementBlock("div",lN,[r.spellCheckStatus===i.unref(oo).LOADING?(i.openBlock(),i.createBlock(s,{key:0})):r.spellCheckStatus===i.unref(oo).HAS_ERROR?(i.openBlock(),i.createBlock(a,{key:1,editorsState:r.editorsState},null,8,["editorsState"])):r.spellCheckStatus===i.unref(oo).NO_ERROR?(i.openBlock(),i.createBlock(l,{key:2})):r.spellCheckStatus===i.unref(oo).FAIL?(i.openBlock(),i.createBlock(u,{key:3})):i.createCommentVNode("",!0),i.createElementVNode("div",uN,[o[4]||(o[4]=i.createStaticVNode('<ul class="flex items-cente gap-x-4"><li class="flex items-center gap-x-1"><span class="w-1.5 h-1.5 rounded-full bg-red-500"></span>맞춤법</li><li class="flex items-center gap-x-1"><span class="w-1.5 h-1.5 rounded-full bg-blue-500"></span>띄어쓰기</li><li class="flex items-center gap-x-1"><span class="w-1.5 h-1.5 rounded-full bg-green-500"></span>통합교정</li></ul>',1)),i.createElementVNode("div",cN,[i.createVNode(c,{variant:"outline",class:i.normalizeClass(i.unref(ke)("border-blue-500 text-blue-500 text-xs px-3 py-2 h-auto hover:bg-white/80 hover:opacity-80 hover:text-blue-500 dark:text-dark-blue-100 dark:hover:bg-dark-blue-400 dark:hover:text-dark-blue-50 dark:hover:border-dark-blue-100",r.spellCheckStatus===i.unref(oo).LOADING&&"text-gray-300 bg-gray-400 border-gray-400 pointer-events-none dark:bg-ed-muted/70 dark:border-ed-muted/70 dark:text-gray-500")),onClick:o[0]||(o[0]=f=>n("run-spellcheck"))},{default:i.withCtx(()=>o[2]||(o[2]=[i.createTextVNode("다시 검사하기")])),_:1},8,["class"]),i.createVNode(c,{class:i.normalizeClass(i.unref(ke)("border-blue-500 text-white text-xs px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80",(r.spellCheckStatus!==i.unref(oo).HAS_ERROR||r.allWrongWordsMissSuggestions)&&"text-gray-300 bg-gray-400 hover:bg-gray-400 pointer-events-none dark:bg-ed-muted/70 dark:text-gray-500")),onClick:o[1]||(o[1]=f=>n("replace-all-editor-errors"))},{default:i.withCtx(()=>o[3]||(o[3]=[i.createTextVNode("모두 바꾸기")])),_:1},8,["class"])])])])}}}),fN=()=>{const t=i.reactive({[Oo.EDITOR_COMMENT]:{editor:null,wrongWords:[]},[Oo.EDITOR_CONTENT]:{editor:null,wrongWords:[]}});function e(w,x){t[w].editor=x}const n=i.ref(oo.NO_ERROR);function r(){Object.values(t).forEach(w=>{w.wrongWords=[]})}function o(w,x){return w?oo.FAIL:x?oo.HAS_ERROR:oo.NO_ERROR}async function s(){var E,k;n.value=oo.LOADING;let w=!1,x=!1;for(const[C,{editor:_}]of Object.entries(t)){if(!_)continue;const A=(E=_==null?void 0:_.extensionManager.extensions.find(P=>P.name==="spellchecker"))==null?void 0:E.options.proofreader.api,T=_.getText({blockSeparator:`
|
|
309
309
|
`});if(!(!A||!T))try{const{data:P}=await on.post(A,{value:T});if(!P.success&&P.code!==LB.NOTHING_TO_CHANGE){x=!0,t[C].wrongWords=[];continue}if((k=P.data)!=null&&k.wrongWordResponseDto){w=!0,t[C].wrongWords=P.data.wrongWordResponseDto;continue}t[C].wrongWords=[]}catch(P){console.error("handleRunSpellCheck error: ",P),x=!0}}n.value=o(x,w)}const a=i.computed(()=>Object.values(t).reduce((w,{wrongWords:x})=>w+x.length,0));i.watch(a,w=>{w===0&&(n.value=o(!1,!1))});const l=i.computed(()=>{const w=Object.values(t).flatMap(x=>x.wrongWords);return w.length===0?!1:w.every(x=>!Array.isArray(x.correctWord)||x.correctWord.length===0)});function u(){for(const[w,{editor:x,wrongWords:E}]of Object.entries(t))x&&Zb(x,E)}function c(){for(const[w,{editor:x}]of Object.entries(t))x&&UQ(x)}async function f(){await s(),u()}let p=!0;function m(w){if(p=w,!!w)for(const[x,{editor:E}]of Object.entries(t))E&&(E.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!1),E.view.dispatch(E.state.tr.setMeta(Hn.IS_ACTIVE_SPELLCHECK,!1)))}function g(){if(p)for(const[w,{editor:x}]of Object.entries(t))x&&(x.extensionStorage.spellchecker.spellchecker.setEnabledProofreadText(!0),x.view.dispatch(x.state.tr.setMeta(Hn.IS_ACTIVE_SPELLCHECK,!0)))}function b(w,x,E=`
|
|
310
|
-
`){if(!w||!x.length)return;const k=ik(w,E);function C(M){if(M<0&&(M=0),M>=k.length)return w.state.doc.content.size;if(k[M]!=null)return k[M];for(let j=M;j<k.length;j++)if(k[j]!=null)return k[j];for(let j=M-1;j>=0;j--)if(k[j]!=null)return k[j];return w.state.doc.content.size}const A=x.map(M=>{var le;const j=C(M.startIndex),U=C(Math.max(0,M.endIndex-1))+1,q=((le=M.correctWord)==null?void 0:le[0])??M.wrongWord;return{item:M,from:j,to:U,replacement:q}}).filter(M=>typeof M.from=="number"&&typeof M.to=="number"&&M.from<M.to);if(!A.length)return;A.sort((M,j)=>j.from-M.from);const T=w.state.tr;let P=Number.POSITIVE_INFINITY;const I=new Set;for(const M of A)M.to>P||(T.insertText(M.replacement,M.from,M.to),I.add(M.item),P=M.from);I.size>0&&(w.view.dispatch(T),w.view.focus()),I.size>0&&(x=x.filter(M=>![...I].some(j=>j===M))),Zb(w,x)}function y(){for(const[w,{editor:x,wrongWords:E}]of Object.entries(t))x&&b(x,E)}return{editorsState:t,spellCheckStatus:n,countTotalWrongWords:a,allWrongWordsMissSuggestions:l,setEditor:e,resetAllEditorWrongWords:r,disableSpellCheckRealTime:m,resetEnableSpellCheckRealTime:g,applyAllEditorHighlightErrors:u,clearAllEditorHighlightErrors:c,reRunSpellCheckAndHighlight:f,handleRunSpellCheck:s,replaceAllEditorErrors:y}},pN=i.defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(LR),i.normalizeProps(i.guardReactiveProps(e)),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16))}}),hN={key:0,class:"border-blue-500 text-white text-xs text-nowrap px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80 flex items-center rounded"},mN=Object.freeze(Object.defineProperty({__proto__:null,default:i.defineComponent({__name:"BulkSpellChecker",props:{editor:{},editorComment:{},isEnableSpellCheckRealTime:{type:Boolean}},setup(t){var M,j;const e=t,{editorsState:n,countTotalWrongWords:r,spellCheckStatus:o,allWrongWordsMissSuggestions:s,setEditor:a,disableSpellCheckRealTime:l,resetEnableSpellCheckRealTime:u,handleRunSpellCheck:c,resetAllEditorWrongWords:f,applyAllEditorHighlightErrors:p,clearAllEditorHighlightErrors:m,reRunSpellCheckAndHighlight:g,replaceAllEditorErrors:b}=fN(),y=i.ref(!1),w=i.reactive({x:0,y:0}),x=i.ref(!1),E={x:0,y:0},k=U=>{x.value=!0,E.x=U.clientX-w.x,E.y=U.clientY-w.y,document.addEventListener("mousemove",C),document.addEventListener("mouseup",_)},C=U=>{x.value&&(w.x=U.clientX-E.x,w.y=U.clientY-E.y)},_=()=>{x.value=!1,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",_)};i.onUnmounted(()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",_)});const A=i.ref(null),T=i.ref({top:0,right:0}),P=()=>{if(A.value){const U=A.value.$el.getBoundingClientRect();T.value={top:U.bottom+window.scrollY+5,right:window.innerWidth-U.right-window.scrollX},w.x=0,w.y=0}};i.onMounted(async()=>{e.editorComment&&a(Oo.EDITOR_COMMENT,e.editorComment),a(Oo.EDITOR_CONTENT,e.editor)}),i.onUnmounted(()=>{a(Oo.EDITOR_COMMENT,null),a(Oo.EDITOR_CONTENT,null)}),i.watch(y,async U=>{U?(await i.nextTick(),P(),l(e.isEnableSpellCheckRealTime),await c(),p()):(f(),u(),m())});const I=(j=(M=e.editor)==null?void 0:M.extensionManager.extensions.find(U=>U.name==="spellchecker"))==null?void 0:j.options.bulkSpellCheckerButton;return(U,q)=>{const le=Lt,H=Xb,F=Ap,L=Tp,K=_p,J=CE,Y=dN,ne=Sp,we=kp;return i.openBlock(),i.createBlock(we,{open:i.unref(y)},{default:i.withCtx(()=>[i.createVNode(i.unref(pN),{"as-child":"",ref_key:"triggerRef",ref:A,onClick:q[0]||(q[0]=xe=>y.value=!i.unref(y))},{default:i.withCtx(()=>[i.unref(I)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(I).component),{key:1,buttonName:i.unref(I).props.buttonName,icon:i.unref(I).props.icon,type:i.unref(I).props.type,disabled:i.unref(I).props.disabled,iconPosition:i.unref(I).props.iconPosition,buttonSize:i.unref(I).props.buttonSize,iconClass:i.unref(I).props.iconClass},null,8,["buttonName","icon","type","disabled","iconPosition","buttonSize","iconClass"])):(i.openBlock(),i.createElementBlock("button",hN,[i.createVNode(le,{name:"checkUnderline"}),q[4]||(q[4]=i.createTextVNode("맞춤법 일괄 교정 "))]))]),_:1},512),i.createVNode(ne,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none dark:border-ed-muted","as-child":""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"z-[70]",style:i.normalizeStyle({transform:`translate(${i.unref(w).x}px, ${i.unref(w).y}px)`,top:`${i.unref(T).top}px`,right:`${i.unref(T).right}px`,left:"auto"})},[i.createVNode(K,{class:"bg-ed-blue-light py-3.5 px-6 rounded-t-[5px] cursor-move text-blue-500 dark:text-dark-blue-100 flex-row items-center justify-between",onMousedown:i.withModifiers(k,["prevent"])},{default:i.withCtx(()=>[i.createVNode(F,{class:"text-base space-x-2"},{default:i.withCtx(()=>[q[5]||(q[5]=i.createElementVNode("span",null,"맞춤법/문법 오류",-1)),i.createVNode(H,{class:"text-sm bg-blue-500 hover:bg-blue-500 dark:bg-dark-blue-100 px-2"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r))+"개",1)]),_:1})]),_:1}),i.createVNode(L,{onClick:q[1]||(q[1]=xe=>y.value=!1),class:"text-xs flex items-center gap-x-1"},{default:i.withCtx(()=>[i.createVNode(le,{name:"Close",class:"w-4 h-4"}),i.createTextVNode(i.toDisplayString(U.$t("editor.close")),1)]),_:1})]),_:1}),i.createVNode(J),i.createVNode(Y,{editorsState:i.unref(n),spellCheckStatus:i.unref(o),allWrongWordsMissSuggestions:i.unref(s),onCloseModal:q[2]||(q[2]=xe=>y.value=!1),onRunSpellcheck:i.unref(g),onReplaceAllEditorErrors:q[3]||(q[3]=xe=>(i.unref(b)(),y.value=!1))},null,8,["editorsState","spellCheckStatus","allWrongWordsMissSuggestions","onRunSpellcheck"])],4)]),_:1})]),_:1},8,["open"])}}})},Symbol.toStringTag,{value:"Module"}));At.ArticleCompareEditor=_Q,At.ArticleEditor=aQ,At.CoreEditor=Np,At.DigitalNewsEditor=lQ,At.EditorMode=
|
|
310
|
+
`){if(!w||!x.length)return;const k=ik(w,E);function C(M){if(M<0&&(M=0),M>=k.length)return w.state.doc.content.size;if(k[M]!=null)return k[M];for(let j=M;j<k.length;j++)if(k[j]!=null)return k[j];for(let j=M-1;j>=0;j--)if(k[j]!=null)return k[j];return w.state.doc.content.size}const A=x.map(M=>{var le;const j=C(M.startIndex),U=C(Math.max(0,M.endIndex-1))+1,q=((le=M.correctWord)==null?void 0:le[0])??M.wrongWord;return{item:M,from:j,to:U,replacement:q}}).filter(M=>typeof M.from=="number"&&typeof M.to=="number"&&M.from<M.to);if(!A.length)return;A.sort((M,j)=>j.from-M.from);const T=w.state.tr;let P=Number.POSITIVE_INFINITY;const I=new Set;for(const M of A)M.to>P||(T.insertText(M.replacement,M.from,M.to),I.add(M.item),P=M.from);I.size>0&&(w.view.dispatch(T),w.view.focus()),I.size>0&&(x=x.filter(M=>![...I].some(j=>j===M))),Zb(w,x)}function y(){for(const[w,{editor:x,wrongWords:E}]of Object.entries(t))x&&b(x,E)}return{editorsState:t,spellCheckStatus:n,countTotalWrongWords:a,allWrongWordsMissSuggestions:l,setEditor:e,resetAllEditorWrongWords:r,disableSpellCheckRealTime:m,resetEnableSpellCheckRealTime:g,applyAllEditorHighlightErrors:u,clearAllEditorHighlightErrors:c,reRunSpellCheckAndHighlight:f,handleRunSpellCheck:s,replaceAllEditorErrors:y}},pN=i.defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(i.openBlock(),i.createBlock(i.unref(LR),i.normalizeProps(i.guardReactiveProps(e)),{default:i.withCtx(()=>[i.renderSlot(n.$slots,"default")]),_:3},16))}}),hN={key:0,class:"border-blue-500 text-white text-xs text-nowrap px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80 flex items-center rounded"},mN=Object.freeze(Object.defineProperty({__proto__:null,default:i.defineComponent({__name:"BulkSpellChecker",props:{editor:{},editorComment:{},isEnableSpellCheckRealTime:{type:Boolean}},setup(t){var M,j;const e=t,{editorsState:n,countTotalWrongWords:r,spellCheckStatus:o,allWrongWordsMissSuggestions:s,setEditor:a,disableSpellCheckRealTime:l,resetEnableSpellCheckRealTime:u,handleRunSpellCheck:c,resetAllEditorWrongWords:f,applyAllEditorHighlightErrors:p,clearAllEditorHighlightErrors:m,reRunSpellCheckAndHighlight:g,replaceAllEditorErrors:b}=fN(),y=i.ref(!1),w=i.reactive({x:0,y:0}),x=i.ref(!1),E={x:0,y:0},k=U=>{x.value=!0,E.x=U.clientX-w.x,E.y=U.clientY-w.y,document.addEventListener("mousemove",C),document.addEventListener("mouseup",_)},C=U=>{x.value&&(w.x=U.clientX-E.x,w.y=U.clientY-E.y)},_=()=>{x.value=!1,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",_)};i.onUnmounted(()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",_)});const A=i.ref(null),T=i.ref({top:0,right:0}),P=()=>{if(A.value){const U=A.value.$el.getBoundingClientRect();T.value={top:U.bottom+window.scrollY+5,right:window.innerWidth-U.right-window.scrollX},w.x=0,w.y=0}};i.onMounted(async()=>{e.editorComment&&a(Oo.EDITOR_COMMENT,e.editorComment),a(Oo.EDITOR_CONTENT,e.editor)}),i.onUnmounted(()=>{a(Oo.EDITOR_COMMENT,null),a(Oo.EDITOR_CONTENT,null)}),i.watch(y,async U=>{U?(await i.nextTick(),P(),l(e.isEnableSpellCheckRealTime),await c(),p()):(f(),u(),m())});const I=(j=(M=e.editor)==null?void 0:M.extensionManager.extensions.find(U=>U.name==="spellchecker"))==null?void 0:j.options.bulkSpellCheckerButton;return(U,q)=>{const le=Lt,H=Xb,F=Ap,L=Tp,K=_p,J=CE,Y=dN,ne=Sp,we=kp;return i.openBlock(),i.createBlock(we,{open:i.unref(y)},{default:i.withCtx(()=>[i.createVNode(i.unref(pN),{"as-child":"",ref_key:"triggerRef",ref:A,onClick:q[0]||(q[0]=xe=>y.value=!i.unref(y))},{default:i.withCtx(()=>[i.unref(I)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(I).component),{key:1,buttonName:i.unref(I).props.buttonName,icon:i.unref(I).props.icon,type:i.unref(I).props.type,disabled:i.unref(I).props.disabled,iconPosition:i.unref(I).props.iconPosition,buttonSize:i.unref(I).props.buttonSize,iconClass:i.unref(I).props.iconClass},null,8,["buttonName","icon","type","disabled","iconPosition","buttonSize","iconClass"])):(i.openBlock(),i.createElementBlock("button",hN,[i.createVNode(le,{name:"checkUnderline"}),q[4]||(q[4]=i.createTextVNode("맞춤법 일괄 교정 "))]))]),_:1},512),i.createVNode(ne,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none dark:border-ed-muted","as-child":""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:"z-[70]",style:i.normalizeStyle({transform:`translate(${i.unref(w).x}px, ${i.unref(w).y}px)`,top:`${i.unref(T).top}px`,right:`${i.unref(T).right}px`,left:"auto"})},[i.createVNode(K,{class:"bg-ed-blue-light py-3.5 px-6 rounded-t-[5px] cursor-move text-blue-500 dark:text-dark-blue-100 flex-row items-center justify-between",onMousedown:i.withModifiers(k,["prevent"])},{default:i.withCtx(()=>[i.createVNode(F,{class:"text-base space-x-2"},{default:i.withCtx(()=>[q[5]||(q[5]=i.createElementVNode("span",null,"맞춤법/문법 오류",-1)),i.createVNode(H,{class:"text-sm bg-blue-500 hover:bg-blue-500 dark:bg-dark-blue-100 px-2"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(r))+"개",1)]),_:1})]),_:1}),i.createVNode(L,{onClick:q[1]||(q[1]=xe=>y.value=!1),class:"text-xs flex items-center gap-x-1"},{default:i.withCtx(()=>[i.createVNode(le,{name:"Close",class:"w-4 h-4"}),i.createTextVNode(i.toDisplayString(U.$t("editor.close")),1)]),_:1})]),_:1}),i.createVNode(J),i.createVNode(Y,{editorsState:i.unref(n),spellCheckStatus:i.unref(o),allWrongWordsMissSuggestions:i.unref(s),onCloseModal:q[2]||(q[2]=xe=>y.value=!1),onRunSpellcheck:i.unref(g),onReplaceAllEditorErrors:q[3]||(q[3]=xe=>(i.unref(b)(),y.value=!1))},null,8,["editorsState","spellCheckStatus","allWrongWordsMissSuggestions","onRunSpellcheck"])],4)]),_:1})]),_:1},8,["open"])}}})},Symbol.toStringTag,{value:"Module"}));At.ArticleCompareEditor=_Q,At.ArticleEditor=aQ,At.CoreEditor=Np,At.DigitalNewsEditor=lQ,At.EditorMode=De,At.SBSEditorPlugin=ok,At.SuperViewMobileEditor=OQ,At.default=ok,At.enUS=nk,At.extension=gZ,At.koKR=rk,At.nodeNames=Xq,At.updateSuperTextView=IQ,At.useConfigTiptap=vZ,At.useEditor=IB,At.useTiptapStore=wn,Object.defineProperties(At,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
311
311
|
//# sourceMappingURL=vdc-editor.umd.js.map
|