@opengis/richtext 0.0.34 → 0.0.35

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.
@@ -1,16 +1,16 @@
1
- (function(Gt,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(Gt=typeof globalThis<"u"?globalThis:Gt||self,i(Gt.richtext={},Gt.Vue))})(this,(function(Gt,i){"use strict";function et(n){this.content=n}et.prototype={constructor:et,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),s=r.content.slice();return o==-1?s.push(t||n,e):(s[o+1]=e,t&&(s[o]=t)),new et(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new et(t)},addToStart:function(n,e){return new et([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new et(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),s=r.find(n);return o.splice(s==-1?o.length:s,0,e,t),new et(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=et.from(n),n.size?new et(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=et.from(n),n.size?new et(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=et.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},et.from=function(n){if(n instanceof et)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new et(e)};function kc(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let l=0;o.text[l]==s.text[l];l++)t++;return t}if(o.content.size||s.content.size){let l=kc(o.content,s.content,t+1);if(l!=null)return l}t+=o.nodeSize}}function xc(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let l=n.child(--o),a=e.child(--s),c=l.nodeSize;if(l==a){t-=c,r-=c;continue}if(!l.sameMarkup(a))return{a:t,b:r};if(l.isText&&l.text!=a.text){let d=0,u=Math.min(l.text.length,a.text.length);for(;d<u&&l.text[l.text.length-d-1]==a.text[a.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(l.content.size||a.content.size){let d=xc(l.content,a.content,t-1,r-1);if(d)return d}t-=c,r-=c}}class F{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let l=0,a=0;a<t;l++){let c=this.content[l],d=a+c.nodeSize;if(d>e&&r(c,o+a,s||null,l)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),r,o+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",l=!0;return this.nodesBetween(e,t,(a,c)=>{let d=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(l?l=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new F(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;c>e&&((l<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,t-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,t-l-1))),r.push(a),o+=a.nodeSize),l=c}return new F(r,o)}cutByIndex(e,t){return e==t?F.empty:e==0&&t==this.content.length?this:new F(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new F(o,s)}addToStart(e){return new F([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new F(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return kc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return xc(this,e,t,r)}findIndex(e){if(e==0)return Wo(0,e);if(e==this.size)return Wo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),s=r+o.nodeSize;if(s>=e)return s==e?Wo(t+1,s):Wo(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return F.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new F(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return F.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new F(t||e,r)}static from(e){if(!e)return F.empty;if(e instanceof F)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new F([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}F.empty=new F([],0);const Fl={index:0,offset:0};function Wo(n,e){return Fl.index=n,Fl.offset=e,Fl}function Ko(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Ko(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Ko(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Se=class gc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ko(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=r.create(t.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return gc.none;if(e instanceof gc)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Se.none=[];class qo extends Error{}class J{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Ec(this.content,e+this.openStart,t);return r&&new J(r,this.openStart,this.openEnd)}removeBetween(e,t){return new J(wc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return J.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new J(F.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new J(e,r,o)}}J.empty=new J(F.empty,0,0);function wc(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:l,offset:a}=n.findIndex(t);if(o==e||s.isText){if(a!=t&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(wc(s.content,e-o-1,t-o-1)))}function Ec(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),l=n.maybeChild(o);if(s==e||l.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=Ec(l.content,e-s-1,t,l);return a&&n.replaceChild(o,l.copy(a))}function Pm(n,e,t){if(t.openStart>n.depth)throw new qo("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qo("Inconsistent open depths");return Cc(n,e,t,0)}function Cc(n,e,t,r){let o=n.index(r),s=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let l=Cc(n,e,t,r+1);return s.copy(s.content.replaceChild(o,l))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let l=n.parent,a=l.content;return Qn(l,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:l,end:a}=$m(t,n);return Qn(s,_c(n,l,a,e,r))}else return Qn(s,Go(n,e,r))}function vc(n,e){if(!e.type.compatibleContent(n.type))throw new qo("Cannot join "+e.type.name+" onto "+n.type.name)}function Pl(n,e,t){let r=n.node(t);return vc(r,e.node(t)),r}function Zn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function qr(n,e,t,r){let o=(e||n).node(t),s=0,l=e?e.index(t):o.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Zn(n.nodeAfter,r),s++));for(let a=s;a<l;a++)Zn(o.child(a),r);e&&e.depth==t&&e.textOffset&&Zn(e.nodeBefore,r)}function Qn(n,e){return n.type.checkContent(e),n.copy(e)}function _c(n,e,t,r,o){let s=n.depth>o&&Pl(n,e,o+1),l=r.depth>o&&Pl(t,r,o+1),a=[];return qr(null,n,o,a),s&&l&&e.index(o)==t.index(o)?(vc(s,l),Zn(Qn(s,_c(n,e,t,r,o+1)),a)):(s&&Zn(Qn(s,Go(n,e,o+1)),a),qr(e,t,o,a),l&&Zn(Qn(l,Go(t,r,o+1)),a)),qr(r,null,o,a),new F(a)}function Go(n,e,t){let r=[];if(qr(null,n,t,r),n.depth>t){let o=Pl(n,e,t+1);Zn(Qn(o,Go(n,e,t+1)),r)}return qr(e,null,t,r),new F(r)}function $m(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)o=e.node(s).copy(F.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class Gr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Se.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let a=r;r=o,o=a}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!o||!s[l].isInSet(o.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Jo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,s=t;for(let l=e;;){let{index:a,offset:c}=l.content.findIndex(s),d=s-c;if(r.push(l,a,o+c),!d||(l=l.child(a),l.isText))break;s=d-1,o+=c+1}return new Gr(t,r,s)}static resolveCached(e,t){let r=Sc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==t)return l}else Sc.set(e,r=new zm);let o=r.elts[r.i]=Gr.resolve(e,t);return r.i=(r.i+1)%Hm,o}}class zm{constructor(){this.elts=[],this.i=0}}const Hm=12,Sc=new WeakMap;class Jo{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const jm=Object.create(null);let Sn=class yc{constructor(e,t,r,o=Se.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||F.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Ko(this.attrs,t||e.defaultAttrs||jm)&&Se.sameSet(this.marks,r||Se.none)}copy(e=null){return e==this.content?this:new yc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new yc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return J.empty;let o=this.resolve(e),s=this.resolve(t),l=r?0:o.sharedDepth(t),a=o.start(l),d=o.node(l).content.cut(o.pos-a,s.pos-a);return new J(d,o.depth-l,s.depth-l)}replace(e,t,r){return Pm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return Gr.resolveCached(this,e)}resolveNoCache(e){return Gr.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Nc(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=F.empty,o=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,o,s),a=l&&l.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=o;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,t);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Se.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Se.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=F.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};Sn.prototype.text=void 0;class Yo extends Sn{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Nc(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Yo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Yo(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Nc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Um(e,t);if(r.next==null)return er.empty;let o=Mc(r);r.next&&r.err("Unexpected trailing text");let s=Xm(Ym(o));return Zm(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let s=t;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function s(l,a){let c=l.matchFragment(e,r);if(c&&(!t||c.validEnd))return F.from(a.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:u,next:f}=l.next[d];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let p=s(f,a.concat(u));if(p)return p}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let l=[];for(let a=o;a.type;a=a.via)l.push(a.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!o.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
2
- `)}}er.empty=new er(!0);class Um{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Mc(n){let e=[];do e.push(Wm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Wm(n){let e=[];do e.push(Km(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Km(n){let e=Jm(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=qm(n,e);else break;return e}function Tc(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function qm(n,e){let t=Tc(n),r=t;return n.eat(",")&&(n.next!="}"?r=Tc(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Gm(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let s in t){let l=t[s];l.isInGroup(e)&&o.push(l)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Jm(n){if(n.eat("(")){let e=Mc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Gm(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Ym(n){let e=[[]];return o(s(n,0),t()),e;function t(){return e.push([])-1}function r(l,a,c){let d={term:c,to:a};return e[l].push(d),d}function o(l,a){l.forEach(c=>c.to=a)}function s(l,a){if(l.type=="choice")return l.exprs.reduce((c,d)=>c.concat(s(d,a)),[]);if(l.type=="seq")for(let c=0;;c++){let d=s(l.exprs[c],a);if(c==l.exprs.length-1)return d;o(d,a=t())}else if(l.type=="star"){let c=t();return r(a,c),o(s(l.expr,c),c),[r(c)]}else if(l.type=="plus"){let c=t();return o(s(l.expr,a),c),o(s(l.expr,c),c),[r(c)]}else{if(l.type=="opt")return[r(a)].concat(s(l.expr,a));if(l.type=="range"){let c=a;for(let d=0;d<l.min;d++){let u=t();o(s(l.expr,c),u),c=u}if(l.max==-1)o(s(l.expr,c),c);else for(let d=l.min;d<l.max;d++){let u=t();r(c,u),o(s(l.expr,c),u),c=u}return[r(c)]}else{if(l.type=="name")return[r(a,void 0,l.value)];throw new Error("Unknown expr type")}}}}function Ac(n,e){return e-n}function Bc(n,e){let t=[];return r(e),t.sort(Ac);function r(o){let s=n[o];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(o);for(let l=0;l<s.length;l++){let{term:a,to:c}=s[l];!a&&t.indexOf(c)==-1&&r(c)}}}function Xm(n){let e=Object.create(null);return t(Bc(n,0));function t(r){let o=[];r.forEach(l=>{n[l].forEach(({term:a,to:c})=>{if(!a)return;let d;for(let u=0;u<o.length;u++)o[u][0]==a&&(d=o[u][1]);Bc(n,c).forEach(u=>{d||o.push([a,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let s=e[r.join(",")]=new er(r.indexOf(n.length-1)>-1);for(let l=0;l<o.length;l++){let a=o[l][1].sort(Ac);s.next.push({type:o[l][0],next:e[a.join(",")]||t(a)})}return s}}function Zm(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],s=!o.validEnd,l=[];for(let a=0;a<o.next.length;a++){let{type:c,next:d}=o.next[a];l.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Vc(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Lc(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let s=n[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function Oc(n,e,t,r){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${o}`);for(let o in n){let s=n[o];s.validate&&s.validate(e[o])}}function Ic(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new eg(n,r,e[r]);return t}let Dc=class Om{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ic(e,r.attrs),this.defaultAttrs=Vc(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==er.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:Lc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Sn(this,this.computeAttrs(e),F.from(t),Se.setFrom(r))}createChecked(e=null,t,r){return t=F.from(t),this.checkContent(t),new Sn(this,this.computeAttrs(e),t,Se.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=F.from(t),t.size){let l=this.contentMatch.fillBefore(t);if(!l)return null;t=l.append(t)}let o=this.contentMatch.matchFragment(t),s=o&&o.fillBefore(F.empty,!0);return s?new Sn(this,e,t.append(s),Se.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Oc(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Se.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,l)=>r[s]=new Om(s,t,l));let o=t.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 Qm(n,e,t){let r=t.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 ${n}, got ${s}`)}}class eg{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Qm(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Xo{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=Ic(e,o.attrs),this.excluded=null;let s=Vc(this.attrs);this.instance=s?new Se(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Se(this,Lc(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((s,l)=>r[s]=new Xo(s,o++,t,l)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Oc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Rc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=et.from(e.nodes),t.marks=et.from(e.marks||{}),this.nodes=Dc.compile(this.spec.nodes,this),this.marks=Xo.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],l=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=er.parse(l,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=a=="_"?null:a?Fc(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:Fc(this,l.split(" "))}this.nodeFromJSON=o=>Sn.fromJSON(this,o),this.markFromJSON=o=>Se.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Dc){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Yo(r,r.defaultAttrs,e,Se.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Fc(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],s=n.marks[o],l=s;if(s)t.push(s);else for(let a in n.marks){let c=n.marks[a];(o=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&t.push(l=c)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function tg(n){return n.tag!=null}function ng(n){return n.style!=null}let wr=class bc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(tg(o))this.tags.push(o);else if(ng(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,t={}){let r=new Hc(this,t,!1);return r.addAll(e,Se.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Hc(this,t,!0);return r.addAll(e,Se.none,t.from,t.to),J.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(sg(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,t,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let l=this.styles[s],a=l.style;if(!(a.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(l.getAttrs){let c=l.getAttrs(t);if(c===!1)continue;l.attrs=c||void 0}return l}}}static schemaRules(e){let t=[];function r(o){let s=o.priority==null?50:o.priority,l=0;for(;l<t.length;l++){let a=t[l];if((a.priority==null?50:a.priority)<s)break}t.splice(l,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(l=>{r(l=jc(l)),l.mark||l.ignore||l.clearMark||(l.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(l=>{r(l=jc(l)),l.node||l.ignore||l.mark||(l.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new bc(e,bc.schemaRules(e)))}};const Pc={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},rg={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},$c={ol:!0,ul:!0},Jr=1,$l=2,Yr=4;function zc(n,e,t){return e!=null?(e?Jr:0)|(e==="full"?$l:0):n&&n.whitespace=="pre"?Jr|$l:t&~Yr}class Zo{constructor(e,t,r,o,s,l){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=l,this.content=[],this.activeMarks=Se.none,this.match=s||(l&Yr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(F.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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&Jr)){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 t=F.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(F.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Pc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Hc{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,s,l=zc(null,t.preserveWhitespace,0)|(r?Yr:0);o?s=new Zo(o.type,o.attrs,Se.none,!0,t.topMatch||o.type.contentMatch,l):r?s=new Zo(null,null,Se.none,!0,null,l):s=new Zo(e.schema.topNodeType,null,Se.none,!0,null,l),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,s=o.options&$l?"full":this.localPreserveWS||(o.options&Jr)>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
- `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),a;$c.hasOwnProperty(l)&&this.parser.normalizeLists&&og(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:rg.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(Pc.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(s),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
- `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],l=r.getPropertyValue(s);if(l)for(let a=void 0;;){let c=this.parser.matchStyle(s,l,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,r,o){let s,l;if(t.node)if(l=this.parser.schema.nodes[t.node],l.isLeaf)this.insertNode(l.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(l,t.attrs||null,r,t.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let a=this.top;if(l&&l.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,o){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];l!=a;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,t);this.findAtPoint(e,s)}findPlace(e,t,r){let o,s;for(let l=this.open,a=0;l>=0;l--){let c=this.nodes[l],d=c.findWrapping(e);if(d&&(!o||o.length>d.length+a)&&(o=d,s=c,!d.length))break;if(c.solid){if(r)break;a+=2}}if(!o)return null;this.sync(s);for(let l=0;l<o.length;l++)t=this.enterInner(o[l],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let o=this.findPlace(e,t,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=Se.none;for(let a of o.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):Uc(a.type,e.type))&&(l=a.addToSet(l));return s.content.push(e.mark(l)),!0}return!1}enter(e,t,r,o){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,o)),s}enterInner(e,t,r,o=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let a=zc(e,s,l.options);l.options&Yr&&l.content.length==0&&(a|=Yr);let c=Se.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):Uc(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Zo(e,t,c,o,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Jr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&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)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),l=(a,c)=>{for(;a>=0;a--){let d=t[a];if(d==""){if(a==t.length-1||a==0)continue;for(;c>=s;c--)if(l(a-1,c))return!0;return!1}else{let u=c>0||c==0&&o?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return l(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function og(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&$c.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function sg(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function jc(n){let e={};for(let t in n)e[t]=n[t];return e}function Uc(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let s=[],l=a=>{s.push(a);for(let c=0;c<a.edgeCount;c++){let{type:d,next:u}=a.edge(c);if(d==e||s.indexOf(u)<0&&l(u))return!0}};if(l(o.contentMatch))return!0}}class tr{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=zl(t).createDocumentFragment());let o=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let a=0,c=0;for(;a<s.length&&c<l.marks.length;){let d=l.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(s[a][0])||d.type.spec.spanning===!1)break;a++,c++}for(;a<s.length;)o=s.pop()[1];for(;c<l.marks.length;){let d=l.marks[c++],u=this.serializeMark(d,l.isInline,t);u&&(s.push([d,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(l,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=Qo(zl(t),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,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Qo(zl(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return Qo(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new tr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Wc(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Wc(e.marks)}}function Wc(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function zl(n){return n.document||window.document}const Kc=new WeakMap;function lg(n){let e=Kc.get(n);return e===void 0&&Kc.set(n,e=ig(n)),e}function ig(n){let e=null;function t(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++)t(r[o]);else for(let o in r)t(r[o])}return t(n),e}function Qo(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=lg(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 l=o.indexOf(" ");l>0&&(t=o.slice(0,l),o=o.slice(l+1));let a,c=t?n.createElementNS(t,o):n.createElement(o),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Qo(n,p,t,r);if(c.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:c,contentDOM:a}}const qc=65535,Gc=Math.pow(2,16);function ag(n,e){return n+e*Gc}function Jc(n){return n&qc}function cg(n){return(n-(n&qc))/Gc}const Yc=1,Xc=2,es=4,Zc=8;class Hl{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Zc)>0}get deletedBefore(){return(this.delInfo&(Yc|es))>0}get deletedAfter(){return(this.delInfo&(Xc|es))>0}get deletedAcross(){return(this.delInfo&es)>0}}class Ct{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ct.empty)return Ct.empty}recover(e){let t=0,r=Jc(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+cg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[a+s],u=this.ranges[a+l],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:t:t,h=c+o+(p<0?0:u);if(r)return h;let m=e==(t<0?c:f)?null:ag(a/3,e-c),g=e==c?Xc:e==f?Yc:es;return(t<0?e!=c:e!=f)&&(g|=Zc),new Hl(h,g,m)}o+=u-d}return r?e+o:new Hl(e+o,0,null)}touches(e,t){let r=0,o=Jc(t),s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[a+s],u=c+d;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+l]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let l=this.ranges[o],a=l-(this.inverted?s:0),c=l+(this.inverted?0:s),d=this.ranges[o+t],u=this.ranges[o+r];e(a,a+d,c,c+u),s+=u-d}}invert(){return new Ct(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ct.empty:new Ct(e<0?[0,-e,0]:[0,0,e])}}Ct.empty=new Ct([]);class Xr{constructor(e,t,r=0,o=e?e.length:0){this.mirror=t,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Xr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let o=e.getMirror(t);this.appendMap(e._maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e._maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new Xr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],a=l.mapResult(e,t);if(a.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new Hl(e,o,null)}}const jl=Object.create(null);class st{getMap(){return Ct.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=jl[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jl)throw new RangeError("Duplicate use of step JSON ID "+e);return jl[e]=t,t.prototype.jsonID=e,t}}class ze{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ze(e,null)}static fail(e){return new ze(null,e)}static fromReplace(e,t,r,o){try{return ze.ok(e.replace(t,r,o))}catch(s){if(s instanceof qo)return ze.fail(s.message);throw s}}}function Ul(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let s=n.child(o);s.content.size&&(s=s.copy(Ul(s.content,e,s))),s.isInline&&(s=e(s,t,o)),r.push(s)}return F.fromArray(r)}class Nn extends st{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new J(Ul(t.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),o),t.openStart,t.openEnd);return ze.fromReplace(e,this.from,this.to,s)}invert(){return new zt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Nn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Nn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Nn(t.from,t.to,e.markFromJSON(t.mark))}}st.jsonID("addMark",Nn);class zt extends st{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new J(Ul(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return ze.fromReplace(e,this.from,this.to,r)}invert(){return new Nn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new zt(t.pos,r.pos,this.mark)}merge(e){return e instanceof zt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zt(t.from,t.to,e.markFromJSON(t.mark))}}st.jsonID("removeMark",zt);class Mn extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ze.fromReplace(e,this.pos,this.pos+1,new J(F.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new Mn(this.pos,t.marks[o]);return new Mn(this.pos,this.mark)}}return new nr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Mn(t.pos,e.markFromJSON(t.mark))}}st.jsonID("addNodeMark",Mn);class nr extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ze.fromReplace(e,this.pos,this.pos+1,new J(F.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Mn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new nr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new nr(t.pos,e.markFromJSON(t.mark))}}st.jsonID("removeNodeMark",nr);class Ge extends st{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Wl(e,this.from,this.to)?ze.fail("Structure replace would overwrite content"):ze.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ct([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ge(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Ge(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ge)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?J.empty:new J(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ge(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?J.empty:new J(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ge(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ge(t.from,t.to,J.fromJSON(e,t.slice),!!t.structure)}}st.jsonID("replace",Ge);class Je extends st{constructor(e,t,r,o,s,l,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=l,this.structure=a}apply(e){if(this.structure&&(Wl(e,this.from,this.gapFrom)||Wl(e,this.gapTo,this.to)))return ze.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ze.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ze.fromReplace(e,this.from,this.to,r):ze.fail("Content does not fit in gap")}getMap(){return new Ct([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||s>r.pos?null:new Je(t.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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(t.from,t.to,t.gapFrom,t.gapTo,J.fromJSON(e,t.slice),t.insert,!!t.structure)}}st.jsonID("replaceAround",Je);function Wl(n,e,t){let r=n.resolve(e),o=t-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,o--}}return!1}function dg(n,e,t,r){let o=[],s=[],l,a;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(l&&l.to==p&&l.mark.eq(f[g])?l.to=h:o.push(l=new zt(p,h,f[g])));a&&a.to==p?a.to=h:s.push(a=new Nn(p,h,r))}}),o.forEach(c=>n.step(c)),s.forEach(c=>n.step(c))}function ug(n,e,t,r){let o=[],s=0;n.doc.nodesBetween(e,t,(l,a)=>{if(!l.isInline)return;s++;let c=null;if(r instanceof Xo){let d=l.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(l.marks)&&(c=[r]):c=l.marks;if(c&&c.length){let d=Math.min(a+l.nodeSize,t);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<o.length;h++){let m=o[h];m.step==s-1&&f.eq(o[h].style)&&(p=m)}p?(p.to=d,p.step=s):o.push({style:f,from:Math.max(a,e),to:d,step:s})}}}),o.forEach(l=>n.step(new zt(l.from,l.to,l.style)))}function Kl(n,e,t,r=t.contentMatch,o=!0){let s=n.doc.nodeAt(e),l=[],a=e+1;for(let c=0;c<s.childCount;c++){let d=s.child(c),u=a+d.nodeSize,f=r.matchType(d.type);if(!f)l.push(new Ge(a,u,J.empty));else{r=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new zt(a,u,d.marks[p]));if(o&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new J(F.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),l.push(new Ge(a+p.index,a+p.index+p[0].length,m))}}a=u}if(!r.validEnd){let c=r.fillBefore(F.empty,!0);n.replace(a,a,new J(c,0,0))}for(let c=l.length-1;c>=0;c--)n.step(l[c])}function fg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Er(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),s=n.$from.index(r),l=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(s,l,t))return r;if(r==0||o.type.spec.isolating||!fg(o,s,l))break}return null}function pg(n,e,t){let{$from:r,$to:o,depth:s}=e,l=r.before(s+1),a=o.after(s+1),c=l,d=a,u=F.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=F.from(r.node(m).copy(u)),f++):c--;let p=F.empty,h=0;for(let m=s,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,p=F.from(o.node(m).copy(p)),h++):d++;n.step(new Je(c,d,l,a,new J(u.append(p),f,h),u.size-f,!0))}function ql(n,e,t=null,r=n){let o=hg(n,e),s=o&&mg(r,e);return s?o.map(Qc).concat({type:e,attrs:t}).concat(s.map(Qc)):null}function Qc(n){return{type:n,attrs:null}}function hg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return t.canReplaceWith(r,o,l)?s:null}function mg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let c=(l.length?l[l.length-1]:e).contentMatch;for(let d=r;c&&d<o;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:l}function gg(n,e,t){let r=F.empty;for(let l=t.length-1;l>=0;l--){if(r.size){let a=t[l].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=F.from(t[l].type.create(t[l].attrs,r))}let o=e.start,s=e.end;n.step(new Je(o,s,o,s,new J(r,0,0),t.length,!0))}function yg(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(l,a)=>{let c=typeof o=="function"?o(l):o;if(l.isTextblock&&!l.hasMarkup(r,c)&&bg(n.doc,n.mapping.slice(s).map(a),r)){let d=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&td(n,l,a,s),Kl(n,n.mapping.slice(s).map(a,1),r,void 0,d===null);let u=n.mapping.slice(s),f=u.map(a,1),p=u.map(a+l.nodeSize,1);return n.step(new Je(f,p,f+1,p-1,new J(F.from(r.create(c,null,l.marks)),0,0),1,!0)),d===!0&&ed(n,l,a,s),!1}})}function ed(n,e,t,r){e.forEach((o,s)=>{if(o.isText){let l,a=/\r?\n|\r/g;for(;l=a.exec(o.text);){let c=n.mapping.slice(r).map(t+1+s+l.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function td(n,e,t,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let l=n.mapping.slice(r).map(t+1+s);n.replaceWith(l,l+1,e.type.schema.text(`
5
- `))}})}function bg(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function kg(n,e,t,r,o){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let l=t.create(r,null,o||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,l);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Je(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new J(F.from(l),0,0),1,!0))}function un(n,e,t=1,r){let o=n.resolve(e),s=o.depth-t,l=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!l.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let d=o.depth-1,u=t-2;d>s;d--,u--){let f=o.node(d),p=o.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(s),c=r&&r[0];return o.node(s).canReplaceWith(a,a,c?c.type:o.node(s+1).type)}function xg(n,e,t=1,r){let o=n.doc.resolve(e),s=F.empty,l=F.empty;for(let a=o.depth,c=o.depth-t,d=t-1;a>c;a--,d--){s=F.from(o.node(a).copy(s));let u=r&&r[d];l=F.from(u?u.type.create(u.attrs,l):o.node(a).copy(l))}n.step(new Ge(e,e,new J(s.append(l),t,t),!0))}function Tn(n,e){let t=n.resolve(e),r=t.index();return nd(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function wg(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),l=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(l),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function nd(n,e){return!!(n&&e&&!n.isLeaf&&wg(n,e))}function ts(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let s,l,a=r.index(o);if(o==r.depth?(s=r.nodeBefore,l=r.nodeAfter):t>0?(s=r.node(o+1),a++,l=r.node(o).maybeChild(a)):(s=r.node(o).maybeChild(a-1),l=r.node(o+1)),s&&!s.isTextblock&&nd(s,l)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function Eg(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,s=n.doc.resolve(e-t),l=s.node().type;if(o&&l.inlineContent){let u=l.whitespace=="pre",f=!!l.contentMatch.matchType(o);u&&!f?r=!1:!u&&f&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);td(n,u.node(),u.before(),a)}l.inlineContent&&Kl(n,e+t-1,l,s.node().contentMatchAt(s.index()),r==null);let c=n.mapping.slice(a),d=c.map(e-t);if(n.step(new Ge(d,c.map(e+t,-1),J.empty,!0)),r===!0){let u=n.doc.resolve(d);ed(n,u.node(),u.before(),n.steps.length)}return n}function Cg(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))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,t))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,t))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function rd(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let s=0;s<t.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let l=r.depth;l>=0;l--){let a=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,c=r.index(l)+(a>0?1:0),d=r.node(l),u=!1;if(s==1)u=d.canReplace(c,c,o);else{let f=d.contentMatchAt(c).findWrapping(o.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return a==0?r.pos:a<0?r.before(l+1):r.after(l+1)}return null}function ns(n,e,t=e,r=J.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),s=n.resolve(t);return od(o,s,r)?new Ge(e,t,r):new vg(o,s,r).fit()}function od(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class vg{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=F.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=F.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,l=r.depth,a=o.depth;for(;l&&a&&s.childCount==1;)s=s.firstChild.content,l--,a--;let c=new J(s,l,a);return e>-1?new Je(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new Ge(r.pos,o.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=Gl(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let l=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,f=null;if(t==1&&(l?d.matchType(l.type)||(f=d.fillBefore(F.from(l),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(t==2&&l&&(u=d.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Gl(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new J(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Gl(e,t);if(o.childCount<=1&&t>0){let s=e.size-t<=t+o.size;this.unplaced=new J(Zr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new J(Zr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let l=this.unplaced,a=r?r.content:l.content,c=l.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));f=f.matchFragment(o)}let h=a.size+e-(l.content.size-l.openEnd);for(;d<a.childCount;){let g=a.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(sd(g.mark(p.allowedMarks(g.marks)),d==1?c:0,d==a.childCount?h:-1)))}let m=d==a.childCount;m||(h=-1),this.placed=Qr(this.placed,t,F.from(u)),this.frontier[t].match=f,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?J.empty:new J(Zr(l.content,e-1,1),e-1,h<0?l.openEnd:e-1):new J(Zr(l.content,e,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Jl(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),l=Jl(e,t,o,r,s);if(l){for(let a=t-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=Jl(e,a,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:l,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Qr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.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,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Qr(this.placed,this.depth,F.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(F.empty,!0);t.childCount&&(this.placed=Qr(this.placed,this.frontier.length,t))}}function Zr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Zr(n.firstChild.content,e-1,t)))}function Qr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Qr(n.lastChild.content,e-1,t)))}function Gl(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function sd(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,sd(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(F.empty,!0)))),n.copy(r)}function Jl(n,e,t,r,o){let s=n.node(e),l=o?n.indexAfter(e):n.index(e);if(l==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,l);return a&&!_g(t,s.content,l)?a:null}function _g(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Sg(n){return n.spec.defining||n.spec.definingForContent}function Ng(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),s=n.doc.resolve(t);if(od(o,s,r))return n.step(new Ge(e,t,r));let l=id(o,n.doc.resolve(t));l[l.length-1]==0&&l.pop();let a=-(o.depth+1);l.unshift(a);for(let p=o.depth,h=o.pos-1;p>0;p--,h--){let m=o.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;l.indexOf(p)>-1?a=p:o.before(p)==h&&l.splice(1,0,-p)}let c=l.indexOf(a),d=[],u=r.openStart;for(let p=r.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==r.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=Sg(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+u+1)%(r.openStart+1),m=d[h];if(m)for(let g=0;g<l.length;g++){let y=l[(g+c)%l.length],b=!0;y<0&&(b=!1,y=-y);let k=o.node(y-1),E=o.index(y-1);if(k.canReplaceWith(E,E,m.type,m.marks))return n.replace(o.before(y),b?s.after(y):t,new J(ld(r.content,0,r.openStart,h),h,r.openEnd))}}let f=n.steps.length;for(let p=l.length-1;p>=0&&(n.replace(e,t,r),!(n.steps.length>f));p--){let h=l[p];h<0||(e=o.before(h),t=s.after(h))}}function ld(n,e,t,r,o){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(ld(s.content,e+1,t,r,s)))}if(e>r){let s=o.contentMatchAt(0),l=s.fillBefore(n).append(n);n=l.append(s.matchFragment(l).fillBefore(F.empty,!0))}return n}function Mg(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Cg(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new J(F.from(r),0,0))}function Tg(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),s=id(r,o);for(let l=0;l<s.length;l++){let a=s[l],c=l==s.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),o.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return n.delete(r.before(a),o.after(a))}for(let l=1;l<=r.depth&&l<=o.depth;l++)if(e-r.start(l)==r.depth-l&&t>r.end(l)&&o.end(l)-t!=o.depth-l&&r.start(l-1)==o.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),o.index(l-1)))return n.delete(r.before(l),t);n.delete(e,t)}function id(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let s=n.start(o);if(s<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&t.push(o)}return t}class Cr extends st{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return ze.fromReplace(e,this.pos,this.pos+1,new J(F.from(o),0,t.isLeaf?0:1))}getMap(){return Ct.empty}invert(e){return new Cr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Cr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Cr(t.pos,t.attr,t.value)}}st.jsonID("attr",Cr);class eo extends st{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ze.ok(r)}getMap(){return Ct.empty}invert(e){return new eo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new eo(t.attr,t.value)}}st.jsonID("docAttr",eo);let vr=class extends Error{};vr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},vr.prototype=Object.create(Error.prototype),vr.prototype.constructor=vr,vr.prototype.name="TransformError";class Yl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Xr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new vr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=J.empty){let o=ns(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new J(F.from(r),0,0))}delete(e,t){return this.replace(e,t,J.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Ng(this,e,t,r),this}replaceRangeWith(e,t,r){return Mg(this,e,t,r),this}deleteRange(e,t){return Tg(this,e,t),this}lift(e,t){return pg(this,e,t),this}join(e,t=1){return Eg(this,e,t),this}wrap(e,t){return gg(this,e,t),this}setBlockType(e,t=e,r,o=null){return yg(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return kg(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Cr(e,t,r)),this}setDocAttribute(e,t){return this.step(new eo(e,t)),this}addNodeMark(e,t){return this.step(new Mn(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Se)t.isInSet(r.marks)&&this.step(new nr(e,t));else{let o=r.marks,s,l=[];for(;s=t.isInSet(o);)l.push(new nr(e,s)),o=s.removeFromSet(o);for(let a=l.length-1;a>=0;a--)this.step(l[a])}return this}split(e,t=1,r){return xg(this,e,t,r),this}addMark(e,t,r){return dg(this,e,t,r),this}removeMark(e,t,r){return ug(this,e,t,r),this}clearIncompatible(e,t,r){return Kl(this,e,t,r),this}}const Xl=Object.create(null);class le{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new ad(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=J.empty){let r=t.content.lastChild,o=null;for(let a=0;a<t.openEnd;a++)o=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:c,$to:d}=l[a],u=e.mapping.slice(s);e.replaceRange(u.map(c.pos),u.map(d.pos),a?J.empty:t),a==0&&ud(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r),d=c.map(l.pos),u=c.map(a.pos);s?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),ud(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new se(e):_r(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let l=t<0?_r(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):_r(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new vt(e.node(0))}static atStart(e){return _r(e,e,0,0,1)||new vt(e)}static atEnd(e){return _r(e,e,e.content.size,e.childCount,-1)||new vt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xl[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Xl)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return se.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class ad{constructor(e,t){this.$from=e,this.$to=t}}let cd=!1;function dd(n){!cd&&!n.parent.inlineContent&&(cd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class se extends le{constructor(e,t=e){dd(e),dd(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return le.near(r);let o=e.resolve(t.map(this.anchor));return new se(o.parent.inlineContent?o:r,r)}replace(e,t=J.empty){if(super.replace(e,t),t==J.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof se&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new rs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new se(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let s=le.findFrom(t,r,!0)||le.findFrom(t,-r,!0);if(s)t=s.$head;else return le.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new se(e,t)}}le.jsonID("text",se);class rs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new rs(e.map(this.anchor),e.map(this.head))}resolve(e){return se.between(e.resolve(this.anchor),e.resolve(this.head))}}class oe extends le{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),s=e.resolve(o);return r?le.near(s):new oe(s)}content(){return new J(F.from(this.node),0,0)}eq(e){return e instanceof oe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Zl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new oe(e.resolve(t.anchor))}static create(e,t){return new oe(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}oe.prototype.visible=!1,le.jsonID("node",oe);class Zl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new rs(r,r):new Zl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&oe.isSelectable(r)?new oe(t):le.near(t)}}class vt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=J.empty){if(t==J.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new vt(e)}map(e){return new vt(e)}eq(e){return e instanceof vt}getBookmark(){return Ag}}le.jsonID("all",vt);const Ag={map(){return this},resolve(n){return new vt(n)}};function _r(n,e,t,r,o,s=!1){if(e.inlineContent)return se.create(n,t);for(let l=r-(o>0?0:1);o>0?l<e.childCount:l>=0;l+=o){let a=e.child(l);if(a.isAtom){if(!s&&oe.isSelectable(a))return oe.create(n,t-(o<0?a.nodeSize:0))}else{let c=_r(n,a,t+o,o<0?a.childCount:0,o,s);if(c)return c}t+=a.nodeSize*o}return null}function ud(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof Ge||o instanceof Je))return;let s=n.mapping.maps[r],l;s.forEach((a,c,d,u)=>{l==null&&(l=u)}),n.setSelection(le.near(n.doc.resolve(l),t))}const fd=1,ss=2,pd=4;class Bg extends Yl{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|fd)&~ss,this.storedMarks=null,this}get selectionSet(){return(this.updated&fd)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ss,this}ensureMarks(e){return Se.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&ss)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ss,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Se.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(t);s=r==t?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,s)),this.selection.empty||this.setSelection(le.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=pd,this}get scrolledIntoView(){return(this.updated&pd)>0}}function hd(n,e){return!e||!n?n:n.bind(e)}class to{constructor(e,t,r){this.name=e,this.init=hd(t.init,r),this.apply=hd(t.apply,r)}}const Vg=[new to("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new to("selection",{init(n,e){return n.selection||le.atStart(e.doc)},apply(n){return n.selection}}),new to("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new to("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ql{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Vg.slice(),t&&t.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 to(r.key,r.spec.state,r))})}}class Sr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){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 t=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let a=this.config.plugins[l];if(a.spec.appendTransaction){let c=o?o[l].n:0,d=o?o[l].state:this,u=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,d,r);if(u&&r.filterTransaction(u,l)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let f=0;f<this.config.plugins.length;f++)o.push(f<l?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),s=!0}o&&(o[l]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Sr(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Bg(this)}static create(e){let t=new Ql(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Sr(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new Ql(this.schema,e.plugins),r=t.fields,o=new Sr(t);for(let s=0;s<r.length;s++){let l=r[s].name;o[l]=this.hasOwnProperty(l)?this[l]:r[s].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.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&&(t[r]=s.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Ql(e.schema,e.plugins),s=new Sr(o);return o.fields.forEach(l=>{if(l.name=="doc")s.doc=Sn.fromJSON(e.schema,t.doc);else if(l.name=="selection")s.selection=le.fromJSON(s.doc,t.selection);else if(l.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],d=c.spec.state;if(c.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[l.name]=d.fromJSON.call(c,e,t[a],s);return}}s[l.name]=l.init(e,s)}}),s}}function md(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=md(o,e,{})),t[r]=o}return t}class Oe{constructor(e){this.spec=e,this.props={},e.props&&md(e.props,this,this.props),this.key=e.key?e.key.key:gd("plugin")}getState(e){return e[this.key]}}const ei=Object.create(null);function gd(n){return n in ei?n+"$"+ ++ei[n]:(ei[n]=0,n+"$")}class $e{constructor(e="key"){this.key=gd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const tt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Nr=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let ti=null;const fn=function(n,e,t){let r=ti||(ti=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Lg=function(){ti=null},rr=function(n,e,t,r){return t&&(yd(n,e,t,r,-1)||yd(n,e,t,r,1))},Og=/^(img|br|input|textarea|hr)$/i;function yd(n,e,t,r,o){for(var s;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Tt(n))){let l=n.parentNode;if(!l||l.nodeType!=1||no(n)||Og.test(n.nodeName)||n.contentEditable=="false")return!1;e=tt(n)+(o<0?0:1),n=l}else if(n.nodeType==1){let l=n.childNodes[e+(o<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else n=l,e=o<0?Tt(n):0}else return!1}}function Tt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ig(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Tt(n)}else if(n.parentNode&&!no(n))e=tt(n),n=n.parentNode;else return null}}function Dg(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!no(n))e=tt(n)+1,n=n.parentNode;else return null}}function Rg(n,e,t){for(let r=e==0,o=e==Tt(n);r||o;){if(n==t)return!0;let s=tt(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,o=o&&s==Tt(n)}}function no(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const ls=function(n){return n.focusNode&&rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function or(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Fg(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Pg(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Tt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Tt(r.startContainer),r.startOffset)}}}const Jt=typeof navigator<"u"?navigator:null,bd=typeof document<"u"?document:null,An=Jt&&Jt.userAgent||"",ni=/Edge\/(\d+)/.exec(An),kd=/MSIE \d/.exec(An),ri=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(An),bt=!!(kd||ri||ni),Bn=kd?document.documentMode:ri?+ri[1]:ni?+ni[1]:0,At=!bt&&/gecko\/(\d+)/i.test(An);At&&+(/Firefox\/(\d+)/.exec(An)||[0,0])[1];const oi=!bt&&/Chrome\/(\d+)/.exec(An),lt=!!oi,xd=oi?+oi[1]:0,ut=!bt&&!!Jt&&/Apple Computer/.test(Jt.vendor),Mr=ut&&(/Mobile\/\w+/.test(An)||!!Jt&&Jt.maxTouchPoints>2),Bt=Mr||(Jt?/Mac/.test(Jt.platform):!1),$g=Jt?/Win/.test(Jt.platform):!1,pn=/Android \d/.test(An),ro=!!bd&&"webkitFontSmoothing"in bd.documentElement.style,zg=ro?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Hg(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function hn(n,e){return typeof n=="number"?n:n[e]}function jg(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function wd(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let l=t||n.dom;l;){if(l.nodeType!=1){l=Nr(l);continue}let a=l,c=a==s.body,d=c?Hg(s):jg(a),u=0,f=0;if(e.top<d.top+hn(r,"top")?f=-(d.top-e.top+hn(o,"top")):e.bottom>d.bottom-hn(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+hn(o,"top")-d.top:e.bottom-d.bottom+hn(o,"bottom")),e.left<d.left+hn(r,"left")?u=-(d.left-e.left+hn(o,"left")):e.right>d.right-hn(r,"right")&&(u=e.right-d.right+hn(o,"right")),u||f)if(c)s.defaultView.scrollBy(u,f);else{let h=a.scrollLeft,m=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,y=a.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=c?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(p))break;l=p=="absolute"?l.offsetParent:Nr(l)}}function Ug(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,l=t+1;l<Math.min(innerHeight,e.bottom);l+=5){let a=n.root.elementFromPoint(s,l);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,o=c.top;break}}return{refDOM:r,refTop:o,stack:Ed(n.dom)}}function Ed(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Nr(r));return e}function Wg({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Cd(t,r==0?0:r-e)}function Cd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:s}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Tr=null;function Kg(n){if(n.setActive)return n.setActive();if(Tr)return n.focus(Tr);let e=Ed(n);n.focus(Tr==null?{get preventScroll(){return Tr={preventScroll:!0},!0}}:void 0),Tr||(Tr=!1,Cd(e,0))}function vd(n,e){let t,r=2e8,o,s=0,l=e.top,a=e.top,c,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=fn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=l&&m.bottom>=a){l=Math.max(m.bottom,l),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&c&&(t=c,o=d,r=0),t&&t.nodeType==3?qg(t,o):!t||r&&t.nodeType==1?{node:n,offset:s}:vd(t,o)}function qg(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Vn(r,1);if(s.top!=s.bottom&&si(e,s))return{node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function si(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Gg(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Jg(n,e,t){let{node:r,offset:o}=vd(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&t.left>(l.left+l.right)/2?1:-1}return n.docView.posFromDOM(r,o,s)}function Yg(n,e,t,r){let o=-1;for(let s=e,l=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!l&&c.left>r.left||c.top>r.top?o=a.posBefore:(!l&&c.right<r.left||c.bottom<r.top)&&(o=a.posAfter),l=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function _d(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=o;;){let l=n.childNodes[s];if(l.nodeType==1){let a=l.getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(si(e,d))return _d(l,e,d)}}if((s=(s+1)%r)==o)break}return n}function Xg(n,e){let t=n.dom.ownerDocument,r,o=0,s=Pg(t,e.left,e.top);s&&({node:r,offset:o}=s);let l=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!l||!n.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=n.dom.getBoundingClientRect();if(!si(e,d)||(l=_d(n.dom,e,d),!l))return null}if(ut)for(let d=l;r&&d;d=Nr(d))d.draggable&&(r=void 0);if(l=Gg(l,e),r){if(At&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&o++}let d;ro&&o&&r.nodeType==1&&(d=r.childNodes[o-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=Yg(n,r,o,e))}a==null&&(a=Jg(n,l,e));let c=n.docView.nearestDesc(l,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Sd(n){return n.top<n.bottom||n.left<n.right}function Vn(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Sd(r))return r}return Array.prototype.find.call(t,Sd)||n.getBoundingClientRect()}const Zg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Nd(n,e,t){let{node:r,offset:o,atom:s}=n.docView.domFromPos(e,t<0?-1:1),l=ro||At;if(r.nodeType==3)if(l&&(Zg.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let c=Vn(fn(r,o,o),t);if(At&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let d=Vn(fn(r,o-1,o-1),-1);if(d.top==c.top){let u=Vn(fn(r,o,o+1),-1);if(u.top!=c.top)return oo(u,u.left<d.left)}}return c}else{let c=o,d=o,u=t<0?1:-1;return t<0&&!o?(d++,u=-1):t>=0&&o==r.nodeValue.length?(c--,u=1):t<0?c--:d++,oo(Vn(fn(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(t<0||o==Tt(r))){let c=r.childNodes[o-1];if(c.nodeType==1)return li(c.getBoundingClientRect(),!1)}if(s==null&&o<Tt(r)){let c=r.childNodes[o];if(c.nodeType==1)return li(c.getBoundingClientRect(),!0)}return li(r.getBoundingClientRect(),t>=0)}if(s==null&&o&&(t<0||o==Tt(r))){let c=r.childNodes[o-1],d=c.nodeType==3?fn(c,Tt(c)-(l?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return oo(Vn(d,1),!1)}if(s==null&&o<Tt(r)){let c=r.childNodes[o];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?fn(c,0,l?0:1):c.nodeType==1?c:null:null;if(d)return oo(Vn(d,-1),!0)}return oo(Vn(r.nodeType==3?fn(r):r,-t),t>=0)}function oo(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function li(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Md(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function Qg(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Md(n,e,()=>{let{node:s}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let l=Nd(n,o.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=fn(a,0,a.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?l.top-u.top>(u.bottom-l.top)*2:u.bottom-l.bottom>(l.bottom-u.top)*2))return!1}}return!0})}const e0=/[\u0590-\u08ac]/;function t0(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,l=o==r.parent.content.size,a=n.domSelection();return a?!e0.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:l:Md(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{a.collapse(u,f),c&&(c!=u||d!=f)&&a.extend&&a.extend(c,d)}catch{}return p!=null&&(a.caretBidiLevel=p),y}):r.pos==r.start()||r.pos==r.end()}let Td=null,Ad=null,Bd=!1;function n0(n,e,t){return Td==e&&Ad==t?Bd:(Td=e,Ad=t,Bd=t=="up"||t=="down"?Qg(n,e,t):t0(n,e,t))}const Vt=0,Vd=1,sr=2,Yt=3;class so{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Vt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];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,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,l;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>tt(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(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&t==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,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),l;if(s&&(!t||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let l=0;l<o.children.length;l++){let a=o.children[l];if(a.size){o=a;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,t){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 l=this.children[r],a=s+l.size;if(a>e||l instanceof Id){o=e-s;break}s=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Ld&&s.side>=0;r--);if(t<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&t&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?tt(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?tt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let l=r,a=0;;a++){let c=this.children[a],d=l+c.size;if(o==-1&&e<=d){let u=l+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=l;for(let f=a;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=tt(p.dom)+1;break}e-=p.size}o==-1&&(o=0)}if(o>-1&&(d>t||a==this.children.length-1)){t=d;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=tt(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let s=Math.min(e,t),l=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(s>m&&l<y)return g.setSelection(e-m-g.border,t-m-g.border,r,o);m=y}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((At||ut)&&e==t){let{node:h,offset:m}=a;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
6
- `),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=c={node:y.parentNode,offset:tt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(At&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||f&&ut)&&rr(a.node,a.offset,u.anchorNode,u.anchorOffset)&&rr(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==t)&&!(f&&At)){d.collapse(a.node,a.offset);try{e!=t&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>t){let m=a;a=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(a.node,a.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],l=r+s.size;if(r==l?e<=l&&t>=r:e<l&&t>r){let a=r+s.border,c=l-s.border;if(e>=a&&t<=c){this.dirty=e==r||t==l?sr:Vd,e==a&&t==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Yt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?sr:Yt}r=l}this.dirty=sr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?sr:Vd;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ld extends so{constructor(e,t,r,o){let s,l=t.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(l.nodeType!=1){let a=document.createElement("span");a.appendChild(l),l=a}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Vt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class r0 extends so{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class lr extends so{constructor(e,t,r,o,s){super(e,[],r,o),this.mark=t,this.spec=s}static create(e,t,r,o){let s=o.nodeViews[t.type.name],l=s&&s(t,o,r);return(!l||!l.dom)&&(l=tr.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new lr(e,t,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Vt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Vt}}slice(e,t,r){let o=lr.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;t<l&&(s=ai(s,t,l,r)),e>0&&(s=ai(s,0,e,r));for(let a=0;a<s.length;a++)s[a].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 Ln extends so{constructor(e,t,r,o,s,l,a,c,d){super(e,[],s,l),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,t,r,o,s,l){let a=s.nodeViews[t.type.name],c,d=a&&a(t,s,()=>{if(!c)return l;if(c.parent)return c.parent.posBeforeChild(c)},r,o),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=tr.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let p=u;return u=Fd(u,r,t),d?c=new o0(e,t,r,o,u,f||null,p,d,s,l+1):t.isText?new is(e,t,r,o,u,p,s):new Ln(e,t,r,o,u,f||null,p,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>F.empty)}return e}matchesNode(e,t,r){return this.dirty==Vt&&e.eq(this.node)&&as(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,s=e.composing?this.localCompositionInfo(e,t):null,l=s&&s.pos>-1?s:null,a=s&&s.pos<0,c=new l0(this,l&&l.node,e);c0(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Se.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,o)},(d,u,f,p)=>{c.syncToMarks(d.marks,r,e);let h;c.findNodeMatch(d,u,f,p)||a&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(h=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,o)||c.addNode(d,u,f,e,o),o+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==sr)&&(l&&this.protectLocalComposition(e,l),Dd(this.contentDOM,this.children,e),Mr&&d0(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof se)||r<t||o>t+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 l=s.nodeValue,a=u0(this.node.content,l,r-t,o-t);return a<0?null:{node:s,pos:a,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let s=t;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 l=new r0(this,s,t,o);e.input.compositionNodes.push(l),this.children=ai(this.children,r,r+o.length,e,l)}update(e,t,r,o){return this.dirty==Yt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Vt}updateOuterDeco(e){if(as(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Rd(this.dom,this.nodeDOM,ii(this.outerDeco,this.node,t),ii(e,this.node,t)),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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Od(n,e,t,r,o){Fd(r,e,n);let s=new Ln(void 0,n,e,t,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class is extends Ln{constructor(e,t,r,o,s,l,a){super(e,t,r,o,s,null,l,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==Yt||this.dirty!=Vt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Vt||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=Vt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),s=document.createTextNode(o.text);return new is(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Yt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Id extends so{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Vt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class o0 extends Ln{constructor(e,t,r,o,s,l,a,c,d,u){super(e,t,r,o,s,l,a,d,u),this.spec=c}update(e,t,r,o){if(this.dirty==Yt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,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 Dd(n,e,t){let r=n.firstChild,o=!1;for(let s=0;s<e.length;s++){let l=e[s],a=l.dom;if(a.parentNode==n){for(;a!=r;)r=Pd(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(a,r);if(l instanceof lr){let c=r?r.previousSibling:n.lastChild;Dd(l.contentDOM,l.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=Pd(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const lo=function(n){n&&(this.nodeName=n)};lo.prototype=Object.create(null);const ir=[new lo];function ii(n,e,t){if(n.length==0)return ir;let r=t?ir[0]:new lo,o=[r];for(let s=0;s<n.length;s++){let l=n[s].type.attrs;if(l){l.nodeName&&o.push(r=new lo(l.nodeName));for(let a in l){let c=l[a];c!=null&&(t&&o.length==1&&o.push(r=new lo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return o}function Rd(n,e,t,r){if(t==ir&&r==ir)return e;let o=e;for(let s=0;s<r.length;s++){let l=r[s],a=t[s];if(s){let c;a&&a.nodeName==l.nodeName&&o!=n&&(c=o.parentNode)&&c.nodeName.toLowerCase()==l.nodeName||(c=document.createElement(l.nodeName),c.pmIsDeco=!0,c.appendChild(o),a=ir[0]),o=c}s0(o,a||ir[0],l)}return o}function s0(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&n.classList.add(o[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function Fd(n,e,t){return Rd(n,n,ir,ii(e,t,n.nodeType!=1))}function as(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function Pd(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class l0{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=i0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let o=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;o<l&&(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=Vt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=lr.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let s=-1,l;if(o>=this.preMatch.index&&(l=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&l.matchesNode(e,t,r))s=this.top.children.indexOf(l,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let d=this.top.children[a];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,o,s){let l=this.top.children[o];return l.dirty==Yt&&l.dom==l.contentDOM&&(l.dirty=sr),l.update(e,t,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==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=t}}updateNextNode(e,t,r,o,s,l){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof Ln){let d=this.preMatch.matched.get(c);if(d!=null&&d!=s)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Yt&&as(t,c.outerDeco));if(!p&&c.update(e,t,r,o))return this.destroyBetween(this.index,a),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,t,r,o,l)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=sr,f.updateChildren(o,l+1),f.dirty=Vt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,s,l){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!as(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Ln.create(this.top,t,r,o,s,l);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,t,r,o,s){let l=Ln.create(this.top,e,t,r,o,s);l.contentDOM&&l.updateChildren(o,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,t,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 Ld(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof lr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof is)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ut||lt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Id(this.top,[],r,null);t!=this.top?t.children.push(o):t.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 i0(n,e){let t=e,r=t.children.length,o=n.childCount,s=new Map,l=[];e:for(;o>0;){let a;for(;;)if(r){let d=t.children[r-1];if(d instanceof lr)t=d,r=d.children.length;else{a=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(o-1))break;--o,s.set(a,o),l.push(a)}}return{index:o,matched:s,matches:l.reverse()}}function a0(n,e){return n.type.side-e.type.side}function c0(n,e,t,r){let o=e.locals(n),s=0;if(o.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,o,e.forChild(s,u),d),s+=u.nodeSize}return}let l=0,a=[],c=null;for(let d=0;;){let u,f;for(;l<o.length&&o[l].to==s;){let y=o[l++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(a0);for(let y=0;y<f.length;y++)t(f[y],d,!!c)}else t(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<n.childCount)h=d,p=n.child(d++);else break;for(let y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;l<o.length&&o[l].from<=s&&o[l].to>s;)a.push(o[l++]);let m=s+p.nodeSize;if(p.isText){let y=m;l<o.length&&o[l].from<y&&(y=o[l].from);for(let b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<m&&(c=p.cut(y-s),p=p.cut(0,y-s),m=y,h=-1)}else for(;l<o.length&&o[l].to<m;)l++;let g=p.isInline&&!p.isLeaf?a.filter(y=>!y.inline):a.slice();r(p,g,e.forChild(s,p),h),s=m}}function d0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function u0(n,e,t,r){for(let o=0,s=0;o<n.childCount&&s<=r;){let l=n.child(o++),a=s;if(s+=l.nodeSize,!l.isText)continue;let c=l.text;for(;o<n.childCount;){let d=n.child(o++);if(s+=d.nodeSize,!d.isText)break;c+=d.text}if(s>=t){if(s>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a<r?c.lastIndexOf(e,r-a-1):-1;if(d>=0&&d+e.length+a>=t)return a+d;if(t==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function ai(n,e,t,r,o){let s=[];for(let l=0,a=0;l<n.length;l++){let c=n[l],d=a,u=a+=c.size;d>=t||u<=e?s.push(c):(d<e&&s.push(c.slice(0,e-d,r)),o&&(s.push(o),o=void 0),u>t&&s.push(c.slice(t-d,c.size,r)))}return s}function ci(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),s=o&&o.size==0,l=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(l<0)return null;let a=r.resolve(l),c,d;if(ls(t)){for(c=l;o&&!o.node;)o=o.parent;let f=o.node;if(o&&f.isAtom&&oe.isSelectable(f)&&o.parent&&!(f.isInline&&Rg(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;d=new oe(l==p?a:r.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=l,p=l;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,l]=p==n.state.selection.anchor?[p,f]:[f,p],a=r.resolve(l)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let f=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;d=ui(n,u,a,f)}return d}function $d(n){return n.editable?n.hasFocus():qd(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function mn(n,e=!1){let t=n.state.selection;if(Ud(n,t),!!$d(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&lt){let r=n.domSelectionRange(),o=n.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&rr(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)p0(n);else{let{anchor:r,head:o}=t,s,l;zd&&!(t instanceof se)&&(t.$from.parent.inlineContent||(s=Hd(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(l=Hd(n,t.to))),n.docView.setSelection(r,o,n,e),zd&&(s&&jd(s),l&&jd(l)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&f0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const zd=ut||lt&&xd<63;function Hd(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(ut&&o&&o.contentEditable=="false")return di(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return di(o);if(s)return di(s)}}function di(n){return n.contentEditable="true",ut&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function jd(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function f0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!$d(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function p0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,tt(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&bt&&Bn<=11&&(t.disabled=!0,t.disabled=!1)}function Ud(n,e){if(e instanceof oe){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Wd(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Wd(n)}function Wd(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function ui(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||se.between(e,t,r)}function Kd(n){return n.editable&&!n.hasFocus()?!1:qd(n)}function qd(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function h0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return rr(e.node,e.offset,t.anchorNode,t.anchorOffset)}function fi(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),s=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return s&&le.findFrom(s,e)}function On(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Gd(n,e,t){let r=n.state.selection;if(r instanceof se)if(t.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 l=n.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return On(n,new se(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=fi(n.state,e);return o&&o instanceof oe?On(n,o):!1}else if(!(Bt&&t.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,l;if(!s||s.isText)return!1;let a=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(l=n.docView.descAt(a))&&!l.contentDOM?oe.isSelectable(s)?On(n,new oe(e<0?n.state.doc.resolve(o.pos-s.nodeSize):o)):ro?On(n,new se(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof oe&&r.node.isInline)return On(n,new se(e>0?r.$to:r.$from));{let o=fi(n.state,e);return o?On(n,o):!1}}}function cs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function io(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Ar(n,e){return e<0?m0(n):g0(n)}function m0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,s,l=!1;for(At&&t.nodeType==1&&r<cs(t)&&io(t.childNodes[r],-1)&&(l=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(io(a,-1))o=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(Jd(t))break;{let a=t.previousSibling;for(;a&&io(a,-1);)o=t.parentNode,s=tt(a),a=a.previousSibling;if(a)t=a,r=cs(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}l?pi(n,t,r):o&&pi(n,o,s)}function g0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=cs(t),s,l;for(;;)if(r<o){if(t.nodeType!=1)break;let a=t.childNodes[r];if(io(a,1))s=t,l=++r;else break}else{if(Jd(t))break;{let a=t.nextSibling;for(;a&&io(a,1);)s=a.parentNode,l=tt(a)+1,a=a.nextSibling;if(a)t=a,r=0,o=cs(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}s&&pi(n,s,l)}function Jd(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function y0(n,e){for(;n&&e==n.childNodes.length&&!no(n);)e=tt(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function b0(n,e){for(;n&&!e&&!no(n);)e=tt(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function pi(n,e,t){if(e.nodeType!=3){let s,l;(l=y0(e,t))?(e=l,t=0):(s=b0(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ls(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&mn(n)},50)}function Yd(n,e){let t=n.state.doc.resolve(e);if(!(lt||$g)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Xd(n,e,t){let r=n.state.selection;if(r instanceof se&&!r.empty||t.indexOf("s")>-1||Bt&&t.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let l=fi(n.state,e);if(l&&l instanceof oe)return On(n,l)}if(!o.parent.inlineContent){let l=e<0?o:s,a=r instanceof vt?le.near(l,e):le.findFrom(l,e);return a?On(n,a):!1}return!1}function Zd(n,e){if(!(n.state.selection instanceof se))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let l=n.state.tr;return e<0?l.delete(t.pos-s.nodeSize,t.pos):l.delete(t.pos,t.pos+s.nodeSize),n.dispatch(l),!0}return!1}function Qd(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function k0(n){if(!ut||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Qd(n,r,"true"),setTimeout(()=>Qd(n,r,"false"),20)}return!1}function x0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function w0(n,e){let t=e.keyCode,r=x0(e);if(t==8||Bt&&t==72&&r=="c")return Zd(n,-1)||Ar(n,-1);if(t==46&&!e.shiftKey||Bt&&t==68&&r=="c")return Zd(n,1)||Ar(n,1);if(t==13||t==27)return!0;if(t==37||Bt&&t==66&&r=="c"){let o=t==37?Yd(n,n.state.selection.from)=="ltr"?-1:1:-1;return Gd(n,o,r)||Ar(n,o)}else if(t==39||Bt&&t==70&&r=="c"){let o=t==39?Yd(n,n.state.selection.from)=="ltr"?1:-1:1;return Gd(n,o,r)||Ar(n,o)}else{if(t==38||Bt&&t==80&&r=="c")return Xd(n,-1,r)||Ar(n,-1);if(t==40||Bt&&t==78&&r=="c")return k0(n)||Xd(n,1,r)||Ar(n,1);if(r==(Bt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function hi(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let l=n.someProp("clipboardSerializer")||tr.fromSchema(n.state.schema),a=iu(),c=a.createElement("div");c.appendChild(l.serializeFragment(r,{document:a}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=su[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${o} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
7
-
8
- `);return{dom:c,text:p,slice:e}}function eu(n,e,t,r,o){let s=o.parent.type.spec.code,l,a;if(!t&&!e)return null;let c=!!e&&(r||s||!t);if(c){if(n.someProp("transformPastedText",p=>{e=p(e,s||r,n)}),s)return a=new J(F.from(n.state.schema.text(e.replace(/\r\n?/g,`
9
- `))),0,0),n.someProp("transformPasted",p=>{a=p(a,n,!0)}),a;let f=n.someProp("clipboardTextParser",p=>p(e,o,r,n));if(f)a=f;else{let p=o.marks(),{schema:h}=n.state,m=tr.fromSchema(h);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=l.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),l=_0(t),ro&&S0(l);let d=l&&l.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=l.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;l=p}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||wr.fromSchema(n.state.schema)).parseSlice(l,{preserveWhitespace:!!(c||u),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!E0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)a=N0(ou(a,+u[1],+u[2]),u[4]);else if(a=J.maxOpen(C0(a.content,o),!0),a.openStart||a.openEnd){let f=0,p=0;for(let h=a.content.firstChild;f<a.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=a.content.lastChild;p<a.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);a=ou(a,f,p)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const E0=/^(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 C0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),s,l=[];if(n.forEach(a=>{if(!l)return;let c=o.findWrapping(a.type),d;if(!c)return l=null;if(d=l.length&&s.length&&nu(c,s,a,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=ru(l[l.length-1],s.length));let u=tu(a,c);l.push(u),o=o.matchType(u.type),s=c}}),l)return F.from(l)}return n}function tu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,F.from(n));return n}function nu(n,e,t,r,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let s=nu(n,e,t,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==n.length-1?t.type:n[o+1]))return r.copy(r.content.append(F.from(tu(t,n,o+1))))}}function ru(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ru(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(F.empty,!0);return n.copy(t.append(r))}function mi(n,e,t,r,o,s){let l=e<0?n.firstChild:n.lastChild,a=l.content;return n.childCount>1&&(s=0),o<r-1&&(a=mi(a,e,t,r,o+1,s)),o>=t&&(a=e<0?l.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(F.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,l.copy(a))}function ou(n,e,t){return e<n.openStart&&(n=new J(mi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new J(mi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const su={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 lu=null;function iu(){return lu||(lu=document.implementation.createHTMLDocument("title"))}let gi=null;function v0(n){let e=window.trustedTypes;return e?(gi||(gi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),gi.createHTML(n)):n}function _0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=iu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&su[r[1].toLowerCase()])&&(n=o.map(s=>"<"+s+">").join("")+n+o.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=v0(n),o)for(let s=0;s<o.length;s++)t=t.querySelector(o[s])||t;return t}function S0(n){let e=n.querySelectorAll(lt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function N0(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:o,openStart:s,openEnd:l}=n;for(let a=r.length-2;a>=0;a-=2){let c=t.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;o=F.from(c.create(r[a+1],o)),s++,l++}return new J(o,s,l)}const ft={},pt={},M0={touchstart:!0,touchmove:!0};class T0{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function A0(n){for(let e in ft){let t=ft[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{V0(n,r)&&!bi(n,r)&&(n.editable||!(r.type in pt))&&t(n,r)},M0[e]?{passive:!0}:void 0)}ut&&n.dom.addEventListener("input",()=>null),yi(n)}function In(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function B0(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function yi(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>bi(n,r))})}function bi(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function V0(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function L0(n,e){!bi(n,e)&&ft[e.type]&&(n.editable||!(e.type in pt))&&ft[e.type](n,e)}pt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!cu(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(pn&&lt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Mr&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,or(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||w0(n,t)?t.preventDefault():In(n,"key")},pt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},pt.keypress=(n,e)=>{let t=e;if(cu(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Bt&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof se)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",l=>l(n,r.$from.pos,r.$to.pos,o,s))&&n.dispatch(s()),t.preventDefault()}};function ds(n){return{left:n.clientX,top:n.clientY}}function O0(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function ki(n,e,t,r,o){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(n.someProp(e,a=>l>s.depth?a(n,t,s.nodeAfter,s.before(l),o,!0):a(n,t,s.node(l),s.before(l),o,!1)))return!0;return!1}function Br(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function I0(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&oe.isSelectable(r)?(Br(n,new oe(t)),!0):!1}function D0(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof oe&&(r=t.node);let s=n.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let a=l>s.depth?s.nodeAfter:s.node(l);if(oe.isSelectable(a)){r&&t.$from.depth>0&&l>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?o=s.before(t.$from.depth):o=s.before(l);break}}return o!=null?(Br(n,oe.create(n.state.doc,o)),!0):!1}function R0(n,e,t,r,o){return ki(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(o?D0(n,t):I0(n,t))}function F0(n,e,t,r){return ki(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function P0(n,e,t,r){return ki(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||$0(n,t,r)}function $0(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Br(n,se.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s),a=o.before(s);if(l.inlineContent)Br(n,se.create(r,a+1,a+1+l.content.size));else if(oe.isSelectable(l))Br(n,oe.create(r,a));else continue;return!0}}function xi(n){return us(n)}const au=Bt?"metaKey":"ctrlKey";ft.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=xi(n),o=Date.now(),s="singleClick";o-n.input.lastClick.time<500&&O0(t,n.input.lastClick)&&!t[au]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:s,button:t.button};let l=n.posAtCoords(ds(t));l&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new z0(n,l,t,!!r)):(s=="doubleClick"?F0:P0)(n,l.pos,l.inside,t)?t.preventDefault():In(n,"pointer"))};class z0{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[au],this.allowDefault=r.shiftKey;let s,l;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),l=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,l=u.depth?u.before():0}const a=o?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof oe&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&At&&!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)),In(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(()=>mn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ds(e))),this.updateAllowDefault(e),this.allowDefault||!t?In(this.view,"pointer"):R0(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ut&&this.mightDrag&&!this.mightDrag.node.isAtom||lt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Br(this.view,le.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):In(this.view,"pointer")}move(e){this.updateAllowDefault(e),In(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)}}ft.touchstart=n=>{n.input.lastTouch=Date.now(),xi(n),In(n,"pointer")},ft.touchmove=n=>{n.input.lastTouch=Date.now(),In(n,"pointer")},ft.contextmenu=n=>xi(n);function cu(n,e){return n.composing?!0:ut&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const H0=pn?5e3:-1;pt.compositionstart=pt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof se&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),us(n,!0),n.markCursor=null;else if(us(n,!e.selection.empty),At&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let l=s<0?o.lastChild:o.childNodes[s-1];if(!l)break;if(l.nodeType==3){let a=n.domSelection();a&&a.collapse(l,l.nodeValue.length);break}else o=l,s=-1}}n.input.composing=!0}du(n,H0)},pt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,du(n,20))};function du(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>us(n),e))}function uu(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=U0());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function j0(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Ig(e.focusNode,e.focusOffset),r=Dg(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let l=t.pmViewDesc;if(!(!l||!l.isText(t.nodeValue)))return r}}return t||r}function U0(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function us(n,e=!1){if(!(pn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),uu(n),e||n.docView&&n.docView.dirty){let t=ci(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function W0(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const ao=bt&&Bn<15||Mr&&zg<604;ft.copy=pt.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let s=ao?null:t.clipboardData,l=r.content(),{dom:a,text:c}=hi(n,l);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",c)):W0(n,a),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function K0(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function q0(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?co(n,r.value,null,o,e):co(n,r.textContent,r.innerHTML,o,e)},50)}function co(n,e,t,r,o){let s=eu(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,o,s||J.empty)))return!0;if(!s)return!1;let l=K0(s),a=l?n.state.tr.replaceSelectionWith(l,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function fu(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}pt.paste=(n,e)=>{let t=e;if(n.composing&&!pn)return;let r=ao?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&co(n,fu(r),r.getData("text/html"),o,t)?t.preventDefault():q0(n,t)};class pu{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const G0=Bt?"altKey":"ctrlKey";function hu(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[G0]}ft.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,s=o.empty?null:n.posAtCoords(ds(t)),l;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof oe?o.to-1:o.to))){if(r&&r.mightDrag)l=oe.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(l=oe.create(n.state.doc,f.posBefore))}}let a=(l||n.state.selection).content(),{dom:c,text:d,slice:u}=hi(n,a);(!t.dataTransfer.files.length||!lt||xd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ao?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",ao||t.dataTransfer.setData("text/plain",d),n.dragging=new pu(u,hu(n,t),l)},ft.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},pt.dragover=pt.dragenter=(n,e)=>e.preventDefault(),pt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(ds(t));if(!o)return;let s=n.state.doc.resolve(o.pos),l=r&&r.slice;l?n.someProp("transformPasted",m=>{l=m(l,n,!1)}):l=eu(n,fu(t.dataTransfer),ao?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&hu(n,t));if(n.someProp("handleDrop",m=>m(n,t,l||J.empty,a))){t.preventDefault();return}if(!l)return;t.preventDefault();let c=l?rd(n.state.doc,s.pos,l):s.pos;c==null&&(c=s.pos);let d=n.state.tr;if(a){let{node:m}=r;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),f=l.openStart==0&&l.openEnd==0&&l.content.childCount==1,p=d.doc;if(f?d.replaceRangeWith(u,u,l.content.firstChild):d.replaceRange(u,u,l),d.doc.eq(p))return;let h=d.doc.resolve(u);if(f&&oe.isSelectable(l.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(l.content.firstChild))d.setSelection(new oe(h));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),d.setSelection(ui(n,h,d.doc.resolve(m)))}n.focus(),n.dispatch(d.setMeta("uiEvent","drop"))},ft.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&mn(n)},20))},ft.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},ft.beforeinput=(n,e)=>{if(lt&&pn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,or(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in pt)ft[n]=pt[n];function uo(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class fs{constructor(e,t){this.toDOM=e,this.spec=t||ar,this.side=this.spec.side||0}map(e,t,r,o){let{pos:s,deleted:l}=e.mapResult(t.from+o,this.side<0?-1:1);return l?null:new Ye(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof fs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&uo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Dn{constructor(e,t){this.attrs=e,this.spec=t||ar}map(e,t,r,o){let s=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,l=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new Ye(s,l,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Dn&&uo(this.attrs,e.attrs)&&uo(this.spec,e.spec)}static is(e){return e.type instanceof Dn}destroy(){}}class wi{constructor(e,t){this.attrs=e,this.spec=t||ar}map(e,t,r,o){let s=e.mapResult(t.from+o,1);if(s.deleted)return null;let l=e.mapResult(t.to+o,-1);return l.deleted||l.pos<=s.pos?null:new Ye(s.pos-r,l.pos-r,this)}valid(e,t){let{index:r,offset:o}=e.content.findIndex(t.from),s;return o==t.from&&!(s=e.child(r)).isText&&o+s.nodeSize==t.to}eq(e){return this==e||e instanceof wi&&uo(this.attrs,e.attrs)&&uo(this.spec,e.spec)}destroy(){}}class Ye{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ye(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Ye(e,e,new fs(t,r))}static inline(e,t,r,o){return new Ye(e,t,new Dn(r,o))}static node(e,t,r,o){return new Ye(e,t,new wi(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Dn}get widget(){return this.type instanceof fs}}const Vr=[],ar={};class Me{constructor(e,t){this.local=e.length?e:Vr,this.children=t.length?t:Vr}static create(e,t){return t.length?ps(t,e,0,ar):it}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,s){for(let l=0;l<this.local.length;l++){let a=this.local[l];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<t&&this.children[l+1]>e){let a=this.children[l]+1;this.children[l+2].findInner(e-a,t-a,r,o+a,s)}}map(e,t,r){return this==it||e.maps.length==0?this:this.mapInner(e,t,0,0,r||ar)}mapInner(e,t,r,o,s){let l;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(t,c)?(l||(l=[])).push(c):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?J0(this.children,l||[],e,t,r,o,s):l?new Me(l.sort(cr),Vr):it}add(e,t){return t.length?this==it?Me.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,s=0;e.forEach((a,c)=>{let d=c+r,u;if(u=gu(t,a,d)){for(o||(o=this.children.slice());s<o.length&&o[s]<c;)s+=3;o[s]==c?o[s+2]=o[s+2].addInner(a,u,d+1):o.splice(s,0,c,c+a.nodeSize,ps(u,a,d+1,ar)),s+=3}});let l=mu(s?yu(t):t,-r);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||l.splice(a--,1);return new Me(l.length?this.local.concat(l).sort(cr):this.local,o||this.children)}remove(e){return e.length==0||this==it?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let l,a=r[s]+t,c=r[s+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<c&&(e[u]=null,(l||(l=[])).push(f));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,a+1);d!=it?r[s+2]=d:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let a=0;a<o.length;a++)o[a].eq(l,t)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Me(o,r):it}forChild(e,t){if(this==it)return this;if(t.isLeaf)return Me.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,l=s+t.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<l&&c.to>s&&c.type instanceof Dn){let d=Math.max(s,c.from)-s,u=Math.min(l,c.to)-s;d<u&&(o||(o=[])).push(c.copy(d,u))}}if(o){let a=new Me(o.sort(cr),Vr);return r?new Rn([a,r]):a}return r||it}eq(e){if(this==e)return!0;if(!(e instanceof Me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ei(this.localsInner(e))}localsInner(e){if(this==it)return Vr;if(e.inlineContent||!this.local.some(Dn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Dn||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Me.empty=new Me([],[]),Me.removeOverlap=Ei;const it=Me.empty;class Rn{constructor(e){this.members=e}map(e,t){const r=this.members.map(o=>o.map(e,t,ar));return Rn.from(r)}forChild(e,t){if(t.isLeaf)return Me.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,t);s!=it&&(s instanceof Rn?r=r.concat(s.members):r.push(s))}return Rn.from(r)}eq(e){if(!(e instanceof Rn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let l=0;l<s.length;l++)t.push(s[l])}}return t?Ei(r?t:t.sort(cr)):Vr}static from(e){switch(e.length){case 0:return it;case 1:return e[0];default:return new Rn(e.every(t=>t instanceof Me)?e:e.reduce((t,r)=>t.concat(r instanceof Me?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function J0(n,e,t,r,o,s,l){let a=n.slice();for(let d=0,u=s;d<t.maps.length;d++){let f=0;t.maps[d].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<a.length;b+=3){let k=a[b+1];if(k<0||p>k+u-f)continue;let E=a[b]+u-f;h>=E?a[b+1]=p<=E?-2:-1:p>=u&&y&&(a[b]+=y,a[b+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){c=!0,a[d+1]=-1;continue}let u=t.map(n[d]+s),f=u-o;if(f<0||f>=r.content.size){c=!0;continue}let p=t.map(n[d+1]+s,-1),h=p-o,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=a[d+2].mapInner(t,y,u+1,n[d]+s+1,l);b!=it?(a[d]=f,a[d+1]=h,a[d+2]=b):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=Y0(a,n,e,t,o,s,l),u=ps(d,r,0,l);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<a.length&&a[p]<h;)p+=3;a.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Me(e.sort(cr),a)}function mu(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new Ye(o.from+e,o.to+e,o.type))}return t}function Y0(n,e,t,r,o,s,l){function a(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(r,o,d);f?t.push(f):l.onRemove&&l.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)a(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+s+1);return t}function gu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let s=0,l;s<n.length;s++)(l=n[s])&&l.from>t&&l.to<r&&((o||(o=[])).push(l),n[s]=null);return o}function yu(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ps(n,e,t,r){let o=[],s=!1;e.forEach((a,c)=>{let d=gu(n,a,c+t);if(d){s=!0;let u=ps(d,a,t+c+1,r);u!=it&&o.push(c,c+a.nodeSize,u)}});let l=mu(s?yu(n):n,-t).sort(cr);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||(r.onRemove&&r.onRemove(l[a].spec),l.splice(a--,1));return l.length||o.length?new Me(l,o):it}function cr(n,e){return n.from-e.from||n.to-e.to}function Ei(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[o]=s.copy(s.from,r.to),bu(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),bu(e,o,r.copy(s.from,r.to)));break}}}return e}function bu(n,e,t){for(;e<n.length&&cr(t,n[e])>0;)e++;n.splice(e,0,t)}function Ci(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=it&&e.push(r)}),n.cursorWrapper&&e.push(Me.create(n.state.doc,[n.cursorWrapper.deco])),Rn.from(e)}const X0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Z0=bt&&Bn<=11;class Q0{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 ey{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Q0,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]);bt&&Bn<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),Z0&&(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,X0)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Kd(this.view)){if(this.suppressingSelectionUpdates)return mn(this.view);if(bt&&Bn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&rr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Nr(s))t.add(s);for(let s=e.anchorNode;s;s=Nr(s))if(t.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Kd(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,a=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],c);f&&(s=s<0?f.from:Math.min(f.from,s),l=l<0?f.to:Math.max(f.to,l),f.typeOver&&(a=!0))}if(At&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||ry(e,f)!=h)&&p.remove()}}}let d=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ls(r)&&(d=ci(e))&&d.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,mn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,l),ty(e)),this.handleDOMChange(s,l,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||mn(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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 u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}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(bt&&Bn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p)}let l=o&&o.parentNode==e.target?tt(o)+1:0,a=r.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?tt(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:a,to:d}}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 ku=new WeakMap,xu=!1;function ty(n){if(!ku.has(n)&&(ku.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=At,xu)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."),xu=!0}}function wu(n,e){let t=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,l=n.domAtPos(n.state.selection.anchor);return rr(l.node,l.offset,o,s)&&([t,r,o,s]=[o,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:o,focusOffset:s}}function ny(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return wu(n,o)}let t;function r(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?wu(n,t):null}function ry(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function oy(n,e,t){let{node:r,fromOffset:o,toOffset:s,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ls(c)||d.push({node:c.focusNode,offset:c.focusOffset})),lt&&n.input.lastKeyCode===8)for(let y=s;y>o;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let f=n.state.doc,p=n.someProp("domParser")||wr.fromSchema(n.state.schema),h=f.resolve(l),m=null,g=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:sy,context:h});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+l,head:b+l}}return{doc:g,sel:m,from:l,to:a}}function sy(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ut&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ut&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ly=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function iy(n,e,t,r,o){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let w=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,T=ci(n,w);if(T&&!n.state.selection.eq(T)){if(lt&&pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",R=>R(n,or(13,"Enter"))))return;let D=n.state.tr.setSelection(T);w=="pointer"?D.setMeta("pointer",!0):w=="key"&&D.scrollIntoView(),s&&D.setMeta("composition",s),n.dispatch(D)}return}let l=n.state.doc.resolve(e),a=l.sharedDepth(t);e=l.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,d=oy(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=dy(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Mr&&n.input.lastIOSEnter>Date.now()-225||pn)&&o.some(w=>w.nodeType==1&&!ly.test(w.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",w=>w(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof se&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let w=Eu(n,n.state.doc,d.sel);if(w&&!w.eq(n.state.selection)){let T=n.state.tr.setSelection(w);s&&T.setMeta("composition",s),n.dispatch(T)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof se&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),bt&&Bn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),b=u.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Mr&&n.input.lastIOSEnter>Date.now()-225&&(!k||o.some(w=>w.nodeName=="DIV"||w.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",w=>w(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&cy(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",w=>w(n,or(8,"Backspace")))){pn&&lt&&n.domObserver.suppressSelectionUpdates();return}lt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),pn&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(w){return w(n,or(13,"Enter"))})},20));let E=m.start,x=m.endA,C=w=>{let T=w||n.state.tr.replace(E,x,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let D=Eu(n,T.doc,d.sel);D&&!(lt&&n.composing&&D.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(D.head==E||D.head==T.mapping.map(x)-1)||bt&&D.empty&&D.head==E)&&T.setSelection(D)}return s&&T.setMeta("composition",s),T.scrollIntoView()},S;if(k){if(g.pos==y.pos){bt&&Bn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>mn(n),20));let w=C(n.state.tr.delete(E,x)),T=u.resolve(m.start).marksAcross(u.resolve(m.endA));T&&w.ensureMarks(T),n.dispatch(w)}else if(m.endA==m.endB&&(S=ay(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let w=C(n.state.tr);S.type=="add"?w.addMark(E,x,S.mark):w.removeMark(E,x,S.mark),n.dispatch(w)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let w=g.parent.textBetween(g.parentOffset,y.parentOffset),T=()=>C(n.state.tr.insertText(w,E,x));n.someProp("handleTextInput",D=>D(n,E,x,w,T))||n.dispatch(T())}}else n.dispatch(C())}function Eu(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:ui(n,e.resolve(t.anchor),e.resolve(t.head))}function ay(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,s=r,l,a,c;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(o.length==1&&s.length==0)a=o[0],l="add",c=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&s.length==1)a=s[0],l="remove",c=u=>u.mark(a.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(F.from(d).eq(n))return{mark:a,type:l}}function cy(n,e,t,r,o){if(t-e<=o.pos-r.pos||vi(r,!0,!1)<o.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=n.resolve(vi(s,!0,!0));return!l.parent.isTextblock||l.pos>t||vi(l,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function vi(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function dy(n,e,t,r,o){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:l,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let c=Math.max(0,s-Math.min(l,a));r-=l+c-s}if(l<s&&n.size<e.size){let c=r<=s&&r>=l?s-r:0;s-=c,s&&s<e.size&&Cu(e.textBetween(s-1,s+1))&&(s+=c?1:-1),a=s+(a-l),l=s}else if(a<s){let c=r<=s&&r>=a?s-r:0;s-=c,s&&s<n.size&&Cu(n.textBetween(s-1,s+1))&&(s+=c?1:-1),l=s+(l-a),a=s}return{start:s,endA:l,endB:a}}function Cu(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class vu{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new T0,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Tu),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=Nu(this),Su(this),this.nodeViews=Mu(this),this.docView=Od(this.state.doc,_u(this),Ci(this),this.dom,this),this.domObserver=new ey(this,(r,o,s,l)=>iy(this,r,o,s,l)),this.domObserver.start(),A0(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&yi(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Tu),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(uu(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Mu(this);fy(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&yi(this),this.editable=Nu(this),Su(this);let c=Ci(this),d=_u(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(o.selection))&&(l=!0);let p=u=="preserve"&&l&&this.dom.style.overflowAnchor==null&&Ug(this);if(l){this.domObserver.stop();let h=f&&(bt||lt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&uy(o.selection,e.selection);if(f){let m=lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=j0(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Od(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&h0(this))?mn(this,h):(Ud(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),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&Wg(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof oe){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&wd(this,t.getBoundingClientRect(),e)}else wd(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){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-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new pu(e.slice,e.move,o<0?void 0:oe.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let l=0;l<this.directPlugins.length;l++){let a=this.directPlugins[l].props[e];if(a!=null&&(o=t?t(a):a))return o}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let a=s[l].props[e];if(a!=null&&(o=t?t(a):a))return o}}hasFocus(){if(bt){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&&Kg(this.dom),mn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Xg(this,e)}coordsAtPos(e,t=1){return Nd(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return n0(this,t||this.state,e)}pasteHTML(e,t){return co(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return co(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return hi(this,e)}destroy(){this.docView&&(B0(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ci(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Lg())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return L0(this,e)}domSelectionRange(){let e=this.domSelection();return e?ut&&this.root.nodeType===11&&Fg(this.dom.ownerDocument)==this.dom&&ny(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}vu.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function _u(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ye.node(0,n.state.doc.content.size,e)]}function Su(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ye.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Nu(n){return!n.someProp("editable",e=>e(n.state)===!1)}function uy(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Mu(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function fy(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function Tu(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Fn={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:"'"},hs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},py=typeof navigator<"u"&&/Mac/.test(navigator.platform),hy=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),nt=0;nt<10;nt++)Fn[48+nt]=Fn[96+nt]=String(nt);for(var nt=1;nt<=24;nt++)Fn[nt+111]="F"+nt;for(var nt=65;nt<=90;nt++)Fn[nt]=String.fromCharCode(nt+32),hs[nt]=String.fromCharCode(nt);for(var _i in Fn)hs.hasOwnProperty(_i)||(hs[_i]=Fn[_i]);function my(n){var e=py&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||hy&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?hs:Fn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const gy=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),yy=typeof navigator<"u"&&/Win/.test(navigator.platform);function by(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,s,l;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))gy?l=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),l&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function ky(n){let e=Object.create(null);for(let t in n)e[by(t)]=n[t];return e}function Si(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function xy(n){return new Oe({props:{handleKeyDown:Ni(n)}})}function Ni(n){let e=ky(n);return function(t,r){let o=my(r),s,l=e[Si(o,r)];if(l&&l(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[Si(o,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(yy&&r.ctrlKey&&r.altKey)&&(s=Fn[r.keyCode])&&s!=o){let a=e[Si(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}const Mi=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Au(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const Bu=(n,e,t)=>{let r=Au(n,t);if(!r)return!1;let o=Ti(r);if(!o){let l=r.blockRange(),a=l&&Er(l);return a==null?!1:(e&&e(n.tr.lift(l,a).scrollIntoView()),!0)}let s=o.nodeBefore;if($u(n,o,e,-1))return!0;if(r.parent.content.size==0&&(Lr(s,"end")||oe.isSelectable(s)))for(let l=r.depth;;l--){let a=ns(n.doc,r.before(l),r.after(l),J.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Lr(s,"end")?le.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):oe.create(c.doc,o.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},wy=(n,e,t)=>{let r=Au(n,t);if(!r)return!1;let o=Ti(r);return o?Vu(n,o,e):!1},Ey=(n,e,t)=>{let r=Ou(n,t);if(!r)return!1;let o=Ai(r);return o?Vu(n,o,e):!1};function Vu(n,e,t){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let l=e.nodeAfter,a=l,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let d=ns(n.doc,s,c,J.empty);if(!d||d.from!=s||d instanceof Ge&&d.slice.size>=c-s)return!1;if(t){let u=n.tr.step(d);u.setSelection(se.create(u.doc,s)),t(u.scrollIntoView())}return!0}function Lr(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Lu=(n,e,t)=>{let{$head:r,empty:o}=n.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Ti(r)}let l=s&&s.nodeBefore;return!l||!oe.isSelectable(l)?!1:(e&&e(n.tr.setSelection(oe.create(n.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function Ti(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Ou(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Iu=(n,e,t)=>{let r=Ou(n,t);if(!r)return!1;let o=Ai(r);if(!o)return!1;let s=o.nodeAfter;if($u(n,o,e,1))return!0;if(r.parent.content.size==0&&(Lr(s,"start")||oe.isSelectable(s))){let l=ns(n.doc,r.before(),r.after(),J.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Lr(s,"start")?le.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):oe.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},Du=(n,e,t)=>{let{$head:r,empty:o}=n.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=Ai(r)}let l=s&&s.nodeAfter;return!l||!oe.isSelectable(l)?!1:(e&&e(n.tr.setSelection(oe.create(n.doc,s.pos)).scrollIntoView()),!0)};function Ai(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const Cy=(n,e)=>{let t=n.selection,r=t instanceof oe,o;if(r){if(t.node.isTextblock||!Tn(n.doc,t.from))return!1;o=t.from}else if(o=ts(n.doc,t.from,-1),o==null)return!1;if(e){let s=n.tr.join(o);r&&s.setSelection(oe.create(s.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},vy=(n,e)=>{let t=n.selection,r;if(t instanceof oe){if(t.node.isTextblock||!Tn(n.doc,t.to))return!1;r=t.to}else if(r=ts(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},_y=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),s=o&&Er(o);return s==null?!1:(e&&e(n.tr.lift(o,s).scrollIntoView()),!0)},Ru=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
10
- `).scrollIntoView()),!0)};function Bi(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Sy=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),s=t.indexAfter(-1),l=Bi(o.contentMatchAt(s));if(!l||!o.canReplaceWith(s,s,l))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,l.createAndFill());c.setSelection(le.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},Fu=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof vt||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=Bi(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=n.tr.insert(l,s.createAndFill());a.setSelection(se.create(a.doc,l+1)),e(a.scrollIntoView())}return!0},Pu=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(un(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),o=r&&Er(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function Ny(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof oe&&e.selection.node.isBlock)return!r.parentOffset||!un(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,a,c=!1,d=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){c=r.end(h)==r.pos+(r.depth-h),d=r.start(h)==r.pos-(r.depth-h),a=Bi(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(c&&a?{type:a}:null),l=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof se||e.selection instanceof vt)&&u.deleteSelection();let f=u.mapping.map(r.pos),p=un(u.doc,f,s.length,s);if(p||(s[0]=a?{type:a}:null,p=un(u.doc,f,s.length,s)),!p)return!1;if(u.split(f,s.length,s),!c&&d&&r.node(l).type!=a){let h=u.mapping.map(r.before(l)),m=u.doc.resolve(h);a&&r.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(l)),a)}return t&&t(u.scrollIntoView()),!0}}const My=Ny(),Ty=(n,e)=>{let{$from:t,to:r}=n.selection,o,s=t.sharedDepth(r);return s==0?!1:(o=t.before(s),e&&e(n.tr.setSelection(oe.create(n.doc,o))),!0)};function Ay(n,e,t){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)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||Tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function $u(n,e,t,r){let o=e.nodeBefore,s=e.nodeAfter,l,a,c=o.type.spec.isolating||s.type.spec.isolating;if(!c&&Ay(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(l=(a=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&a.matchType(l[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,m=F.empty;for(let b=l.length-1;b>=0;b--)m=F.from(l[b].create(null,m));m=F.from(o.copy(m));let g=n.tr.step(new Je(e.pos-1,h,e.pos,h,new J(m,1,0),l.length,!0)),y=g.doc.resolve(h+2*l.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Tn(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&c?null:le.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&Er(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&Lr(s,"start",!0)&&Lr(o,"end")){let h=o,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=F.empty;for(let E=m.length-1;E>=0;E--)b=F.from(m[E].copy(b));let k=n.tr.step(new Je(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new J(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function zu(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(t&&t(e.tr.setSelection(se.create(e.doc,n<0?o.start(s):o.end(s)))),!0):!1}}const By=zu(-1),Vy=zu(1);function Ly(n,e=null){return function(t,r){let{$from:o,$to:s}=t.selection,l=o.blockRange(s),a=l&&ql(l,n,e);return a?(r&&r(t.tr.wrap(l,a).scrollIntoView()),!0):!1}}function Hu(n,e=null){return function(t,r){let o=!1;for(let s=0;s<t.selection.ranges.length&&!o;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(l,a,(c,d)=>{if(o)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)o=!0;else{let u=t.doc.resolve(d),f=u.index();o=u.parent.canReplaceWith(f,f+1,n)}})}if(!o)return!1;if(r){let s=t.tr;for(let l=0;l<t.selection.ranges.length;l++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[l];s.setBlockType(a,c,n,e)}r(s.scrollIntoView())}return!0}}function Vi(...n){return function(e,t,r){for(let o=0;o<n.length;o++)if(n[o](e,t,r))return!0;return!1}}Vi(Mi,Bu,Lu),Vi(Mi,Iu,Du),Vi(Ru,Fu,Pu,My),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Oy(n,e=null){return function(t,r){let{$from:o,$to:s}=t.selection,l=o.blockRange(s);if(!l)return!1;let a=r?t.tr:null;return Iy(a,l,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Iy(n,e,t,r=null){let o=!1,s=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=l.resolve(e.start-2);s=new Jo(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Jo(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=ql(s,t,r,e);return a?(n&&Dy(n,e,a,o,t),!0):!1}function Dy(n,e,t,r,o){let s=F.empty;for(let u=t.length-1;u>=0;u--)s=F.from(t[u].type.create(t[u].attrs,s));n.step(new Je(e.start-(r?2:0),e.end,e.start,e.end,new J(s,0,0),t.length,!0));let l=0;for(let u=0;u<t.length;u++)t[u].type==o&&(l=u+1);let a=t.length-l,c=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&un(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=d.child(u).nodeSize;return n}function Ry(n){return function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,l=>l.childCount>0&&l.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Fy(e,t,n,s):Py(e,t,s):!0:!1}}function Fy(n,e,t,r){let o=n.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(o.step(new Je(s-1,l,s,l,new J(F.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Jo(o.doc.resolve(r.$from.pos),o.doc.resolve(l),r.depth));const a=Er(r);if(a==null)return!1;o.lift(r,a);let c=o.doc.resolve(o.mapping.map(s,-1)-1);return Tn(o.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&o.join(c.pos),e(o.scrollIntoView()),!0}function Py(n,e,t){let r=n.tr,o=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=o.child(m).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),l=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==o.childCount,d=s.node(-1),u=s.index(-1);if(!d.canReplace(u+(a?0:1),u+1,l.content.append(c?F.empty:F.from(o))))return!1;let f=s.pos,p=f+l.nodeSize;return r.step(new Je(f-(a?1:0),p+(c?1:0),f+1,p-1,new J((a?F.empty:F.from(o.copy(F.empty))).append(c?F.empty:F.from(o.copy(F.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function $y(n){return function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,d=>d.childCount>0&&d.firstChild.type==n);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let a=s.parent,c=a.child(l-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==a.type,u=F.from(d?n.create():null),f=new J(F.from(n.create(null,F.from(a.type.create(null,u)))),d?3:1,0),p=s.start,h=s.end;t(e.tr.step(new Je(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}var zy=Object.defineProperty,ju=(n,e)=>{for(var t in e)zy(n,t,{get:e[t],enumerable:!0})};function ms(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:o}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=t.selection,o=t.doc,s=t.storedMarks,t}}}var gs=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:o}=t,s=this.buildProps(o);return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...d)=>{const u=a(...d)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:o}=this,{view:s}=r,l=[],a=!!n,c=n||o.tr,d=()=>(!a&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,e),y=p(...m)(g);return l.push(y),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,o=n||t.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...d)=>c(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:o}=this,{view:s}=r,l={tr:n,editor:r,view:s,state:ms({state:o,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}},Hy=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function Uu(n,e){const t=new Yl(n);return e.forEach(r=>{r.steps.forEach(o=>{t.step(o)})}),t}var Wu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Wu(r)}return n};function ys(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Wu(t)}function fo(n,e,t){if(n instanceof Sn||n instanceof F)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,o=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return F.fromArray(n.map(a=>e.nodeFromJSON(a)));const l=e.nodeFromJSON(n);return t.errorOnInvalidContent&&l.check(),l}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),fo("",e,t)}if(o){if(t.errorOnInvalidContent){let l=!1,a="";const c=new Rc({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(l=!0,a=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?wr.fromSchema(c).parseSlice(ys(n),t.parseOptions):wr.fromSchema(c).parse(ys(n),t.parseOptions),t.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=wr.fromSchema(e);return t.slice?s.parseSlice(ys(n),t.parseOptions).content:s.parse(ys(n),t.parseOptions)}return fo("",e,t)}function Li(n,e,t={},r={}){return fo(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}function jy(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Uy(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(o,s)=>{t(o)&&r.push({node:o,pos:s})}),r}function Ku(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function bs(n){return e=>Ku(e.$from,n)}function ne(n,e,t){return n.config[e]===void 0&&n.parent?ne(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ne(n.parent,e,t):null}):n.config[e]}function Oi(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=ne(e,"addExtensions",t);return r?[e,...Oi(r())]:e}).flat(10)}function Ii(n,e){const t=tr.fromSchema(e).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(t),o.innerHTML}function qu(n){return typeof n=="function"}function ke(n,e=void 0,...t){return qu(n)?e?n.bind(e)(...t):n(...t):n}function Wy(n={}){return Object.keys(n).length===0&&n.constructor===Object}function po(n){const e=n.filter(o=>o.type==="extension"),t=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function Gu(n){const e=[],{nodeExtensions:t,markExtensions:r}=po(n),o=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage,extensions:o},c=ne(l,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...s,...h}})})})})}),o.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage},c=ne(l,"addAttributes",a);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...s,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:l.name,name:u,attribute:p})})}),e}function we(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const a=s?String(s).split(" "):[],c=r[o]?r[o].split(" "):[],d=a.filter(u=>!c.includes(u));r[o]=[...c,...d].join(" ")}else if(o==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),a.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),r[o]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[o]=s}),r},{})}function ks(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>we(t,r),{})}function Ky(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Ju(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const o=e.reduce((s,l)=>{const a=l.attribute.parseHTML?l.attribute.parseHTML(t):Ky(t.getAttribute(l.name));return a==null?s:{...s,[l.name]:a}},{});return{...r,...o}}}}function Yu(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&Wy(t)?!1:t!=null))}function qy(n,e){var t;const r=Gu(n),{nodeExtensions:o,markExtensions:s}=po(n),l=(t=o.find(d=>ne(d,"topNode")))==null?void 0:t.name,a=Object.fromEntries(o.map(d=>{const u=r.filter(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((b,k)=>{const E=ne(k,"extendNodeSchema",f);return{...b,...E?E(d):{}}},{}),h=Yu({...p,content:ke(ne(d,"content",f)),marks:ke(ne(d,"marks",f)),group:ke(ne(d,"group",f)),inline:ke(ne(d,"inline",f)),atom:ke(ne(d,"atom",f)),selectable:ke(ne(d,"selectable",f)),draggable:ke(ne(d,"draggable",f)),code:ke(ne(d,"code",f)),whitespace:ke(ne(d,"whitespace",f)),linebreakReplacement:ke(ne(d,"linebreakReplacement",f)),defining:ke(ne(d,"defining",f)),isolating:ke(ne(d,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var k,E;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(E=b?.attribute)==null?void 0:E.validate}]}))}),m=ke(ne(d,"parseHTML",f));m&&(h.parseDOM=m.map(b=>Ju(b,u)));const g=ne(d,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ks(b,u)}));const y=ne(d,"renderText",f);return y&&(h.toText=y),[d.name,h]})),c=Object.fromEntries(s.map(d=>{const u=r.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((y,b)=>{const k=ne(b,"extendMarkSchema",f);return{...y,...k?k(d):{}}},{}),h=Yu({...p,inclusive:ke(ne(d,"inclusive",f)),excludes:ke(ne(d,"excludes",f)),group:ke(ne(d,"group",f)),spanning:ke(ne(d,"spanning",f)),code:ke(ne(d,"code",f)),attrs:Object.fromEntries(u.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=ke(ne(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>Ju(y,u)));const g=ne(d,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:ks(y,u)})),[d.name,h]}));return new Rc({topNode:l,nodes:a,marks:c})}function Gy(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Di(n){return n.sort((t,r)=>{const o=ne(t,"priority")||100,s=ne(r,"priority")||100;return o>s?-1:o<s?1:0})}function Xu(n){const e=Di(Oi(n)),t=Gy(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Zu(n,e,t){const{from:r,to:o}=e,{blockSeparator:s=`
11
-
12
- `,textSerializers:l={}}=t||{};let a="";return n.nodesBetween(r,o,(c,d,u,f)=>{var p;c.isBlock&&d>r&&(a+=s);const h=l?.[c.type.name];if(h)return u&&(a+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(a+=(p=c?.text)==null?void 0:p.slice(Math.max(r,d)-d,o-d))}),a}function Jy(n,e){const t={from:0,to:n.content.size};return Zu(n,t,e)}function Qu(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function gn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}function ef(n,e){const t=gn(e,n.schema),{from:r,to:o,empty:s}=n.selection,l=[];s?(n.storedMarks&&l.push(...n.storedMarks),l.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,c=>{l.push(...c.marks)});const a=l.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function He(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Yy(n,e){const t=He(e,n.schema),{from:r,to:o}=n.selection,s=[];n.doc.nodesBetween(r,o,a=>{s.push(a)});const l=s.reverse().find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function xs(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function tf(n,e){const t=xs(typeof e=="string"?e:e.name,n.schema);return t==="node"?Yy(n,e):t==="mark"?ef(n,e):{}}function Xy(n,e=JSON.stringify){const t={};return n.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(t,o)?!1:t[o]=!0})}function Zy(n){const e=Xy(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,l)=>l!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function nf(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((o,s)=>{const l=[];if(o.ranges.length)o.forEach((a,c)=>{l.push({from:a,to:c})});else{const{from:a,to:c}=t[s];if(a===void 0||c===void 0)return;l.push({from:a,to:c})}l.forEach(({from:a,to:c})=>{const d=e.slice(s).map(a,-1),u=e.slice(s).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);r.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),Zy(r)}function Ri(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ws(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>t.strict?e[o]===n[o]:Ri(e[o])?e[o].test(n[o]):e[o]===n[o]):!0}function rf(n,e,t={}){return n.find(r=>r.type===e&&ws(Object.fromEntries(Object.keys(t).map(o=>[o,r.attrs[o]])),t))}function of(n,e,t={}){return!!rf(n,e,t)}function Fi(n,e,t){var r;if(!n||!e)return;let o=n.parent.childAfter(n.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=n.parent.childBefore(n.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(t=t||((r=o.node.marks[0])==null?void 0:r.attrs),!rf([...o.node.marks],e,t)))return;let l=o.index,a=n.start()+o.offset,c=l+1,d=a+o.node.nodeSize;for(;l>0&&of([...n.parent.child(l-1).marks],e,t);)l-=1,a-=n.parent.child(l).nodeSize;for(;c<n.parent.childCount&&of([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:a,to:d}}function Pi(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(o=>{const s=t.resolve(n),l=Fi(s,o.type);l&&r.push({mark:o,...l})}):t.nodesBetween(n,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(l=>({from:s,to:s+o.nodeSize,mark:l})))}),r}var Qy=(n,e,t,r=20)=>{const o=n.doc.resolve(t);let s=r,l=null;for(;s>0&&l===null;){const a=o.node(s);a?.type.name===e?l=a:s-=1}return[l,s]};function $i(n,e){return e.nodes[n]||e.marks[n]||null}function Es(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const o=n.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var eb=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(o,s,l,a)=>{var c,d;const u=((d=(c=o.type.spec).toText)==null?void 0:d.call(c,{node:o,pos:s,parent:l,index:a}))||o.textContent||"%leaf%";t+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),t};function zi(n,e,t={}){const{empty:r,ranges:o}=n.selection,s=e?gn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>ws(f.attrs,t,{strict:!1}));let l=0;const a=[];if(o.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),k=Math.min(m,y+g.nodeSize),E=k-b;l+=E,a.push(...g.marks.map(x=>({mark:x,from:b,to:k})))})}),l===0)return!1;const c=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>ws(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=l}function Pn(n,e,t={}){const{from:r,to:o,empty:s}=n.selection,l=e?He(e,n.schema):null,a=[];n.doc.nodesBetween(r,o,(f,p)=>{if(f.isText)return;const h=Math.max(r,p),m=Math.min(o,p+f.nodeSize);a.push({node:f,from:h,to:m})});const c=o-r,d=a.filter(f=>l?l.name===f.node.type.name:!0).filter(f=>ws(f.node.attrs,t,{strict:!1}));return s?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}function tb(n,e,t={}){if(!e)return Pn(n,null,t)||zi(n,null,t);const r=xs(e,n.schema);return r==="node"?Pn(n,e,t):r==="mark"?zi(n,e,t):!1}var nb=(n,e)=>{const{$from:t,$to:r,$anchor:o}=n.selection;if(e){const s=bs(a=>a.type.name===e)(n.selection);if(!s)return!1;const l=n.doc.resolve(s.pos+1);return o.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},rb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function sf(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function lf(n,e){const{nodeExtensions:t}=po(e),r=t.find(l=>l.name===n);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=ke(ne(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Cs(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let o=!0;return n.content.forEach(s=>{o!==!1&&(Cs(s,{ignoreWhitespace:t,checkChildren:e})||(o=!1))}),o}return!1}function af(n){return n instanceof oe}function cf(n){return n instanceof se}function dr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function df(n,e=null){if(!e)return null;const t=le.atStart(n),r=le.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const o=t.from,s=r.to;return e==="all"?se.create(n,dr(0,o,s),dr(n.content.size,o,s)):se.create(n,dr(e,o,s),dr(e,o,s))}function ob(n,e,t){const r=n.steps.length-1;if(r<e)return;const o=n.steps[r];if(!(o instanceof Ge||o instanceof Je))return;const s=n.mapping.maps[r];let l=0;s.forEach((a,c,d,u)=>{l===0&&(l=u)}),n.setSelection(le.near(n.doc.resolve(l),t))}var vs=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},sb=(n,e)=>{if(Ri(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function _s(n){var e;const{editor:t,from:r,to:o,text:s,rules:l,plugin:a}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=eb(d)+s;return l.forEach(p=>{if(u)return;const h=sb(f,p.find);if(!h)return;const m=c.state.tr,g=ms({state:c.state,transaction:m}),y={from:r-(h[0].length-s.length),to:o},{commands:b,chain:k,can:E}=new gs({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:k,can:E})===null||!m.steps.length||(p.undoable&&m.setMeta(a,{transform:m,from:r,to:o,text:s}),c.dispatch(m),u=!0)}),u}function lb(n){const{editor:e,rules:t}=n,r=new Oe({state:{init(){return null},apply(o,s,l){const a=o.getMeta(r);if(a)return a;const c=o.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Ii(F.from(u),l.schema);const{from:f}=c,p=f+u.length;_s({editor:e,from:f,to:p,text:u,rules:t,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,l,a){return _s({editor:e,from:s,to:l,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&_s({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:l}=o.state.selection;return l?_s({editor:e,from:l.pos,to:l.pos,text:`
13
- `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function ib(n){return Object.prototype.toString.call(n).slice(8,-1)}function Ss(n){return ib(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function uf(n,e){const t={...n};return Ss(n)&&Ss(e)&&Object.keys(e).forEach(r=>{Ss(e[r])&&Ss(n[r])?t[r]=uf(n[r],e[r]):t[r]=e[r]}),t}var Hi=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...ke(ne(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>uf(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Ht=class Im extends Hi{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Im(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const l=o.marks();if(!!!l.find(d=>d?.type.name===t.name))return!1;const c=l.find(d=>d?.type.name===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function ab(n){return typeof n=="number"}var cb=class{constructor(n){this.find=n.find,this.handler=n.handler}},db=(n,e,t)=>{if(Ri(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=n,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 ub(n){const{editor:e,state:t,from:r,to:o,rule:s,pasteEvent:l,dropEvent:a}=n,{commands:c,chain:d,can:u}=new gs({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,o,(h,m)=>{var g,y,b,k,E;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(E=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?E:0,C=Math.max(r,m),S=Math.min(o,m+x);if(C>=S)return;const w=h.isText?h.text||"":h.textBetween(C-m,S-m,void 0,"");db(w,s.find,l).forEach(D=>{if(D.index===void 0)return;const R=C+D.index+1,A=R+D[0].length,B={from:t.tr.mapping.map(R),to:t.tr.mapping.map(A)},W=s.handler({state:t,range:B,match:D,commands:c,chain:d,can:u,pasteEvent:l,dropEvent:a});f.push(W)})}),f.every(h=>h!==null)}var Ns=null,fb=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function pb(n){const{editor:e,rules:t}=n;let r=null,o=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const g=u.tr,y=ms({state:u,transaction:g});if(!(!ub({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Oe({view(f){const p=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Ns=e)},h=()=>{Ns&&(Ns=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(s=r===f.dom.parentElement,a=p,!s){const h=Ns;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return l=p,o=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!o,y=m.getMeta("uiEvent")==="drop"&&!s,b=m.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:C}=b;typeof C=="string"?C=C:C=Ii(F.from(C),h.schema);const{from:S}=b,w=S+C.length,T=fb(C);return c({rule:u,state:h,from:S,to:{b:w},pasteEvt:T})}const E=p.doc.content.findDiffStart(h.doc.content),x=p.doc.content.findDiffEnd(h.doc.content);if(!(!ab(E)||!x||E===x.b))return c({rule:u,state:h,from:E,to:x,pasteEvt:l})}}))}var Ms=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.extensions=Xu(n),this.schema=qy(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:$i(e.name,this.schema)},r=ne(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Di([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:$i(r.name,this.schema)},s=[],l=ne(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&ne(r,"exitable",o)&&(a.ArrowRight=()=>Ht.handleExit({editor:n,mark:r})),l){const p=Object.fromEntries(Object.entries(l()).map(([h,m])=>[h,()=>m({editor:n})]));a={...a,...p}}const c=xy(a);s.push(c);const d=ne(r,"addInputRules",o);if(sf(r,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=lb({editor:n,rules:p}),m=Array.isArray(h)?h:[h];s.push(...m)}}const u=ne(r,"addPasteRules",o);if(sf(r,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=pb({editor:n,rules:p});s.push(...h)}}const f=ne(r,"addProseMirrorPlugins",o);if(f){const p=f();s.push(...p)}return s})}get attributes(){return Gu(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=po(this.extensions);return Object.fromEntries(e.filter(t=>!!ne(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:He(t.name,this.schema)},s=ne(t,"addNodeView",o);if(!s)return[];const l=(a,c,d,u,f)=>{const p=ks(a,r);return s()({node:a,view:c,getPos:d,decorations:u,innerDecorations:f,editor:n,extension:t,HTMLAttributes:p})};return[t.name,l]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=po(this.extensions);return Object.fromEntries(e.filter(t=>!!ne(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:gn(t.name,this.schema)},s=ne(t,"addMarkView",o);if(!s)return[];const l=(a,c,d)=>{const u=ks(a,r);return s()({mark:a,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{M1(a,n,f)}})};return[t.name,l]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:$i(e.name,this.schema)};e.type==="mark"&&((t=ke(ne(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const o=ne(e,"onBeforeCreate",r),s=ne(e,"onCreate",r),l=ne(e,"onUpdate",r),a=ne(e,"onSelectionUpdate",r),c=ne(e,"onTransaction",r),d=ne(e,"onFocus",r),u=ne(e,"onBlur",r),f=ne(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};Ms.resolve=Xu,Ms.sort=Di,Ms.flatten=Oi;var hb={};ju(hb,{ClipboardTextSerializer:()=>ff,Commands:()=>yf,Delete:()=>bf,Drop:()=>kf,Editable:()=>xf,FocusEvents:()=>Ef,Keymap:()=>Cf,Paste:()=>vf,Tabindex:()=>_f,focusEventsPluginKey:()=>wf});var Ce=class Dm extends Hi{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Dm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},ff=Ce.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Oe({key:new $e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:o}=e,{ranges:s}=o,l=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),c=Qu(t);return Zu(r,{from:l,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),pf={};ju(pf,{blur:()=>mb,clearContent:()=>gb,clearNodes:()=>yb,command:()=>bb,createParagraphNear:()=>kb,cut:()=>xb,deleteCurrentNode:()=>wb,deleteNode:()=>Eb,deleteRange:()=>Cb,deleteSelection:()=>vb,enter:()=>_b,exitCode:()=>Sb,extendMarkRange:()=>Nb,first:()=>Mb,focus:()=>Ab,forEach:()=>Bb,insertContent:()=>Vb,insertContentAt:()=>Ob,joinBackward:()=>Rb,joinDown:()=>Db,joinForward:()=>Fb,joinItemBackward:()=>Pb,joinItemForward:()=>$b,joinTextblockBackward:()=>zb,joinTextblockForward:()=>Hb,joinUp:()=>Ib,keyboardShortcut:()=>Ub,lift:()=>Wb,liftEmptyBlock:()=>Kb,liftListItem:()=>qb,newlineInCode:()=>Gb,resetAttributes:()=>Jb,scrollIntoView:()=>Yb,selectAll:()=>Xb,selectNodeBackward:()=>Zb,selectNodeForward:()=>Qb,selectParentNode:()=>e1,selectTextblockEnd:()=>t1,selectTextblockStart:()=>n1,setContent:()=>r1,setMark:()=>s1,setMeta:()=>l1,setNode:()=>i1,setNodeSelection:()=>a1,setTextSelection:()=>c1,sinkListItem:()=>d1,splitBlock:()=>u1,splitListItem:()=>f1,toggleList:()=>p1,toggleMark:()=>h1,toggleNode:()=>m1,toggleWrap:()=>g1,undoInputRule:()=>y1,unsetAllMarks:()=>b1,unsetMark:()=>k1,updateAttributes:()=>x1,wrapIn:()=>w1,wrapInList:()=>E1});var mb=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),gb=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),yb=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:o}=r;return t&&o.forEach(({$from:s,$to:l})=>{n.doc.nodesBetween(s.pos,l.pos,(a,c)=>{if(a.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+a.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Er(h);if(a.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},bb=n=>e=>n(e),kb=()=>({state:n,dispatch:e})=>Fu(n,e),xb=(n,e)=>({editor:t,tr:r})=>{const{state:o}=t,s=o.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const l=r.mapping.map(e);return r.insert(l,s.content),r.setSelection(new se(r.doc.resolve(Math.max(l-1,0)))),!0},wb=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const o=n.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const a=o.before(s),c=o.after(s);n.delete(a,c).scrollIntoView()}return!0}return!1},Eb=n=>({tr:e,state:t,dispatch:r})=>{const o=He(n,t.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===o){if(r){const c=s.before(l),d=s.after(l);e.delete(c,d).scrollIntoView()}return!0}return!1},Cb=n=>({tr:e,dispatch:t})=>{const{from:r,to:o}=n;return t&&e.delete(r,o),!0},vb=()=>({state:n,dispatch:e})=>Mi(n,e),_b=()=>({commands:n})=>n.keyboardShortcut("Enter"),Sb=()=>({state:n,dispatch:e})=>Sy(n,e),Nb=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const s=gn(n,r.schema),{doc:l,selection:a}=t,{$from:c,from:d,to:u}=a;if(o){const f=Fi(c,s,e);if(f&&f.from<=d&&f.to>=u){const p=se.create(l,f.from,f.to);t.setSelection(p)}}return!0},Mb=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Tb(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ji(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Ab=(n=null,e={})=>({editor:t,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(ji()||Tb())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!cf(t.state.selection))return l(),!0;const a=df(o.doc,n)||t.state.selection,c=t.state.selection.eq(a);return s&&(c||o.setSelection(a),c&&o.storedMarks&&o.setStoredMarks(o.storedMarks),l()),!0},Bb=(n,e)=>t=>n.every((r,o)=>e(r,{...t,index:o})),Vb=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Lb=n=>!("type"in n),Ob=(n,e,t)=>({tr:r,dispatch:o,editor:s})=>{var l;if(o){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{fo(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{a=fo(e,s.schema,{parseOptions:d,errorOnInvalidContent:(l=t.errorOnInvalidContent)!=null?l:s.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((Lb(a)?a:[a]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===f&&h){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof F){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=a;const y=r.doc.resolve(u),b=y.node(),k=y.parentOffset===0,E=b.isText||b.isTextblock,x=b.content.size>0;k&&E&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&ob(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},Ib=()=>({state:n,dispatch:e})=>Cy(n,e),Db=()=>({state:n,dispatch:e})=>vy(n,e),Rb=()=>({state:n,dispatch:e})=>Bu(n,e),Fb=()=>({state:n,dispatch:e})=>Iu(n,e),Pb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ts(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},$b=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ts(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},zb=()=>({state:n,dispatch:e})=>wy(n,e),Hb=()=>({state:n,dispatch:e})=>Ey(n,e);function hf(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function jb(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,o,s,l;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))ji()||hf()?l=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),o&&(t=`Ctrl-${t}`),l&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var Ub=n=>({editor:e,view:t,tr:r,dispatch:o})=>{const s=jb(n).split(/-(?!$)/),l=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),a=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,a))});return c?.steps.forEach(d=>{const u=d.map(r.mapping);u&&o&&r.maybeStep(u)}),!0},Wb=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?_y(t,r):!1},Kb=()=>({state:n,dispatch:e})=>Pu(n,e),qb=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return Ry(r)(e,t)},Gb=()=>({state:n,dispatch:e})=>Ru(n,e);function mf(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,o)=>(t.includes(o)||(r[o]=n[o]),r),{})}var Jb=(n,e)=>({tr:t,state:r,dispatch:o})=>{let s=null,l=null;const a=xs(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=He(n,r.schema)),a==="mark"&&(l=gn(n,r.schema)),o&&t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{s&&s===d.type&&t.setNodeMarkup(u,void 0,mf(d.attrs,e)),l&&d.marks.length&&d.marks.forEach(f=>{l===f.type&&t.addMark(u,u+d.nodeSize,l.create(mf(f.attrs,e)))})})}),!0):!1},Yb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Xb=()=>({tr:n,dispatch:e})=>{if(e){const t=new vt(n.doc);n.setSelection(t)}return!0},Zb=()=>({state:n,dispatch:e})=>Lu(n,e),Qb=()=>({state:n,dispatch:e})=>Du(n,e),e1=()=>({state:n,dispatch:e})=>Ty(n,e),t1=()=>({state:n,dispatch:e})=>Vy(n,e),n1=()=>({state:n,dispatch:e})=>By(n,e),r1=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:l,commands:a})=>{const{doc:c}=s;if(r.preserveWhitespace!=="full"){const d=Li(n,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return l&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return l&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function o1(n,e,t){var r;const{selection:o}=e;let s=null;if(cf(o)&&(s=o.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(d=>d.type.excludes(t)))}const{ranges:l}=o;return l.some(({$from:a,$to:c})=>{let d=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var s1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const{selection:s}=t,{empty:l,ranges:a}=s,c=gn(n,r.schema);if(o)if(l){const d=ef(r,c);t.addStoredMark(c.create({...d,...e}))}else a.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),g=Math.min(h+p.nodeSize,f);p.marks.find(b=>b.type===c)?p.marks.forEach(b=>{c===b.type&&t.addMark(m,g,c.create({...b.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return o1(r,t,c)},l1=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),i1=(n,e={})=>({state:t,dispatch:r,chain:o})=>{const s=He(n,t.schema);let l;return t.selection.$anchor.sameParent(t.selection.$head)&&(l=t.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:a})=>Hu(s,{...l,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Hu(s,{...l,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},a1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,o=dr(n,0,r.content.size),s=oe.create(r,o);e.setSelection(s)}return!0},c1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:o,to:s}=typeof n=="number"?{from:n,to:n}:n,l=se.atStart(r).from,a=se.atEnd(r).to,c=dr(o,l,a),d=dr(s,l,a),u=se.create(r,c,d);e.setSelection(u)}return!0},d1=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return $y(r)(e,t)};function gf(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(o=>e?.includes(o.type.name));n.tr.ensureMarks(r)}}var u1=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:o})=>{const{selection:s,doc:l}=e,{$from:a,$to:c}=s,d=o.extensionManager.attributes,u=Es(d,a.node().type.name,a.node().attrs);if(s instanceof oe&&s.node.isBlock)return!a.parentOffset||!un(l,a.pos)?!1:(r&&(n&&gf(t,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=a.depth===0?void 0:jy(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=un(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&un(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),r){if(m&&(s instanceof se&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),p&&!f&&!a.parentOffset&&a.parent.type!==p)){const g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}n&&gf(t,o.extensionManager.splittableMarks),e.scrollIntoView()}return m},f1=(n,e={})=>({tr:t,state:r,dispatch:o,editor:s})=>{var l;const a=He(n,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==a)return!1;const p=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let b=F.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let T=c.depth-k;T>=c.depth-3;T-=1)b=F.from(c.node(T).copy(b));const E=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,x={...Es(p,c.node().type.name,c.node().attrs),...e},C=((l=a.contentMatch.defaultType)==null?void 0:l.createAndFill(x))||void 0;b=b.append(F.from(a.createAndFill(null,C)||void 0));const S=c.before(c.depth-(k-1));t.replace(S,c.after(-E),new J(b,4-k,0));let w=-1;t.doc.nodesBetween(S,t.doc.content.size,(T,D)=>{if(w>-1)return!1;T.isTextblock&&T.content.size===0&&(w=D+1)}),w>-1&&t.setSelection(se.near(t.doc.resolve(w))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Es(p,f.type.name,f.attrs),...e},g={...Es(p,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=h?[{type:a,attrs:m},{type:h,attrs:g}]:[{type:a,attrs:m}];if(!un(t.doc,c.pos,2))return!1;if(o){const{selection:b,storedMarks:k}=r,{splittableMarks:E}=s.extensionManager,x=k||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!x||!o)return!0;const C=x.filter(S=>E.includes(S.type.name));t.ensureMarks(C)}return!0},Ui=(n,e)=>{const t=bs(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===o?.type&&Tn(n.doc,t.pos)&&n.join(t.pos),!0},Wi=(n,e)=>{const t=bs(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===o?.type&&Tn(n.doc,r)&&n.join(r),!0},p1=(n,e,t,r={})=>({editor:o,tr:s,state:l,dispatch:a,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=o.extensionManager,h=He(n,l.schema),m=He(e,l.schema),{selection:g,storedMarks:y}=l,{$from:b,$to:k}=g,E=b.blockRange(k),x=y||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const C=bs(S=>lf(S.type.name,f))(g);if(E.depth>=1&&C&&E.depth-C.depth<=1){if(C.node.type===h)return d.liftListItem(m);if(lf(C.node.type.name,f)&&h.validContent(C.node.content)&&a)return c().command(()=>(s.setNodeMarkup(C.pos,h),!0)).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run()}return!t||!x||!a?c().command(()=>u().wrapInList(h,r)?!0:d.clearNodes()).wrapInList(h,r).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run():c().command(()=>{const S=u().wrapInList(h,r),w=x.filter(T=>p.includes(T.type.name));return s.ensureMarks(w),S?!0:d.clearNodes()}).wrapInList(h,r).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run()},h1=(n,e={},t={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=t,l=gn(n,r.schema);return zi(r,l,e)?o.unsetMark(l,{extendEmptyMarkRange:s}):o.setMark(l,e)},m1=(n,e,t={})=>({state:r,commands:o})=>{const s=He(n,r.schema),l=He(e,r.schema),a=Pn(r,s,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?o.setNode(l,c):o.setNode(s,{...c,...t})},g1=(n,e={})=>({state:t,commands:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?r.lift(o):r.wrapIn(o,e)},y1=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const o=t[r];let s;if(o.spec.isInputRules&&(s=o.getState(n))){if(e){const l=n.tr,a=s.transform;for(let c=a.steps.length-1;c>=0;c-=1)l.step(a.steps[c].invert(a.docs[c]));if(s.text){const c=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,n.schema.text(s.text,c))}else l.delete(s.from,s.to)}return!0}}return!1},b1=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:o}=t;return r||e&&o.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},k1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:a}=t,c=gn(n,r.schema),{$from:d,empty:u,ranges:f}=a;if(!o)return!0;if(u&&l){let{from:p,to:h}=a;const m=(s=d.marks().find(y=>y.type===c))==null?void 0:s.attrs,g=Fi(d,c,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,c)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,c)});return t.removeStoredMark(c),!0},x1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{let s=null,l=null;const a=xs(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=He(n,r.schema)),a==="mark"&&(l=gn(n,r.schema)),o&&t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let f,p,h,m;t.selection.empty?r.doc.nodesBetween(d,u,(g,y)=>{s&&s===g.type&&(h=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,p=g)}):r.doc.nodesBetween(d,u,(g,y)=>{y<d&&s&&s===g.type&&(h=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,p=g),y>=d&&y<=u&&(s&&s===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(b=>{if(l===b.type){const k=Math.max(y,d),E=Math.min(y+g.nodeSize,u);t.addMark(k,E,l.create({...b.attrs,...e}))}}))}),p&&(f!==void 0&&t.setNodeMarkup(f,void 0,{...p.attrs,...e}),l&&p.marks.length&&p.marks.forEach(g=>{l===g.type&&t.addMark(h,m,l.create({...g.attrs,...e}))}))}),!0):!1},w1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Ly(o,e)(t,r)},E1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Oy(o,e)(t,r)},yf=Ce.create({name:"commands",addCommands(){return{...pf}}}),bf=Ce.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,o;const s=()=>{var l,a,c,d;if((d=(c=(a=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:a.filterTransaction)==null?void 0:c.call(a,n))!=null?d:n.getMeta("y-sync$"))return;const u=Uu(n.before,[n,...e]);nf(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var g,y;if(h instanceof zt){const b=p.slice(m).map(h.from,-1),k=p.slice(m).map(h.to),E=p.invert().map(b,-1),x=p.invert().map(k),C=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(w=>w.eq(h.mark)),S=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(w=>w.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:E,to:x},newRange:{from:b,to:k},partial:!!(S||C),editor:this.editor,transaction:n,combinedTransform:u})}})};(o=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),kf=Ce.create({name:"drop",addProseMirrorPlugins(){return[new Oe({key:new $e("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),xf=Ce.create({name:"editable",addProseMirrorPlugins(){return[new Oe({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wf=new $e("focusEvents"),Ef=Ce.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Oe({key:wf,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Cf=Ce.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:a})=>{const{selection:c,doc:d}=a,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?a.doc.resolve(p-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:le.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ji()||hf()?s:o},addProseMirrorPlugins(){return[new Oe({key:new $e("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),o=n.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:l,to:a}=e.selection,c=le.atStart(e.doc).from,d=le.atEnd(e.doc).to;if(s||!(l===c&&a===d)||!Cs(t.doc))return;const p=t.tr,h=ms({state:t,transaction:p}),{commands:m}=new gs({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),vf=Ce.create({name:"paste",addProseMirrorPlugins(){return[new Oe({key:new $e("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),_f=Ce.create({name:"tabindex",addProseMirrorPlugins(){return[new Oe({key:new $e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),C1=class Kr{constructor(e,t,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,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}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,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),t=this.resolvedPos.doc.resolve(e);return new Kr(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kr(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 Kr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const o=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!o&&a.depth<=this.depth)return;const c=new Kr(a,this.editor,o,o?t:null);o&&(c.actualDepth=this.depth+1),e.push(new Kr(a,this.editor,o,o?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(t).length>0){const s=o.node.attrs,l=Object.keys(t);for(let a=0;a<l.length;a+=1){const c=l[a];if(s[c]!==t[c])break}}else r=o;o=o.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(t);return this.children.forEach(l=>{r&&o.length>0||(l.node.type.name===e&&s.every(c=>t[c]===l.node.attrs[c])&&o.push(l),!(r&&o.length>0)&&(o=o.concat(l.querySelectorAll(e,t,r))))}),o}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},v1=`.ProseMirror {
1
+ (function(Gt,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(Gt=typeof globalThis<"u"?globalThis:Gt||self,i(Gt.richtext={},Gt.Vue))})(this,(function(Gt,i){"use strict";function et(n){this.content=n}et.prototype={constructor:et,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),s=r.content.slice();return o==-1?s.push(t||n,e):(s[o+1]=e,t&&(s[o]=t)),new et(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new et(t)},addToStart:function(n,e){return new et([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new et(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),s=r.find(n);return o.splice(s==-1?o.length:s,0,e,t),new et(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=et.from(n),n.size?new et(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=et.from(n),n.size?new et(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=et.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},et.from=function(n){if(n instanceof et)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new et(e)};function Ec(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let l=0;o.text[l]==s.text[l];l++)t++;return t}if(o.content.size||s.content.size){let l=Ec(o.content,s.content,t+1);if(l!=null)return l}t+=o.nodeSize}}function Cc(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let l=n.child(--o),a=e.child(--s),c=l.nodeSize;if(l==a){t-=c,r-=c;continue}if(!l.sameMarkup(a))return{a:t,b:r};if(l.isText&&l.text!=a.text){let d=0,u=Math.min(l.text.length,a.text.length);for(;d<u&&l.text[l.text.length-d-1]==a.text[a.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(l.content.size||a.content.size){let d=Cc(l.content,a.content,t-1,r-1);if(d)return d}t-=c,r-=c}}class F{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let l=0,a=0;a<t;l++){let c=this.content[l],d=a+c.nodeSize;if(d>e&&r(c,o+a,s||null,l)!==!1&&c.content.size){let u=a+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),r,o+u)}a=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",l=!0;return this.nodesBetween(e,t,(a,c)=>{let d=a.isText?a.text.slice(Math.max(e,c)-c,t-c):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&d||a.isTextblock)&&r&&(l?l=!1:s+=r),s+=d},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new F(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,l=0;l<t;s++){let a=this.content[s],c=l+a.nodeSize;c>e&&((l<e||c>t)&&(a.isText?a=a.cut(Math.max(0,e-l),Math.min(a.text.length,t-l)):a=a.cut(Math.max(0,e-l-1),Math.min(a.content.size,t-l-1))),r.push(a),o+=a.nodeSize),l=c}return new F(r,o)}cutByIndex(e,t){return e==t?F.empty:e==0&&t==this.content.length?this:new F(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new F(o,s)}addToStart(e){return new F([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new F(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Ec(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Cc(this,e,t,r)}findIndex(e){if(e==0)return Wo(0,e);if(e==this.size)return Wo(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let o=this.child(t),s=r+o.nodeSize;if(s>=e)return s==e?Wo(t+1,s):Wo(t,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return F.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new F(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return F.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new F(t||e,r)}static from(e){if(!e)return F.empty;if(e instanceof F)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new F([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}F.empty=new F([],0);const Fl={index:0,offset:0};function Wo(n,e){return Fl.index=n,Fl.offset=e,Fl}function Ko(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Ko(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Ko(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let Se=class kc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ko(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=r.create(t.attrs);return r.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return kc.none;if(e instanceof kc)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};Se.none=[];class qo extends Error{}class J{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=_c(this.content,e+this.openStart,t);return r&&new J(r,this.openStart,this.openEnd)}removeBetween(e,t){return new J(vc(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return J.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new J(F.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new J(e,r,o)}}J.empty=new J(F.empty,0,0);function vc(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:l,offset:a}=n.findIndex(t);if(o==e||s.isText){if(a!=t&&!n.child(l).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=l)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(vc(s.content,e-o-1,t-o-1)))}function _c(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),l=n.maybeChild(o);if(s==e||l.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let a=_c(l.content,e-s-1,t,l);return a&&n.replaceChild(o,l.copy(a))}function Wm(n,e,t){if(t.openStart>n.depth)throw new qo("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new qo("Inconsistent open depths");return Sc(n,e,t,0)}function Sc(n,e,t,r){let o=n.index(r),s=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let l=Sc(n,e,t,r+1);return s.copy(s.content.replaceChild(o,l))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let l=n.parent,a=l.content;return Qn(l,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:l,end:a}=Km(t,n);return Qn(s,Mc(n,l,a,e,r))}else return Qn(s,Go(n,e,r))}function Nc(n,e){if(!e.type.compatibleContent(n.type))throw new qo("Cannot join "+e.type.name+" onto "+n.type.name)}function Pl(n,e,t){let r=n.node(t);return Nc(r,e.node(t)),r}function Zn(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function qr(n,e,t,r){let o=(e||n).node(t),s=0,l=e?e.index(t):o.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Zn(n.nodeAfter,r),s++));for(let a=s;a<l;a++)Zn(o.child(a),r);e&&e.depth==t&&e.textOffset&&Zn(e.nodeBefore,r)}function Qn(n,e){return n.type.checkContent(e),n.copy(e)}function Mc(n,e,t,r,o){let s=n.depth>o&&Pl(n,e,o+1),l=r.depth>o&&Pl(t,r,o+1),a=[];return qr(null,n,o,a),s&&l&&e.index(o)==t.index(o)?(Nc(s,l),Zn(Qn(s,Mc(n,e,t,r,o+1)),a)):(s&&Zn(Qn(s,Go(n,e,o+1)),a),qr(e,t,o,a),l&&Zn(Qn(l,Go(t,r,o+1)),a)),qr(r,null,o,a),new F(a)}function Go(n,e,t){let r=[];if(qr(null,n,t,r),n.depth>t){let o=Pl(n,e,t+1);Zn(Qn(o,Go(n,e,t+1)),r)}return qr(e,null,t,r),new F(r)}function Km(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)o=e.node(s).copy(F.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class Gr{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return Se.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let a=r;r=o,o=a}let s=r.marks;for(var l=0;l<s.length;l++)s[l].type.spec.inclusive===!1&&(!o||!s[l].isInSet(o.marks))&&(s=s[l--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Jo(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],o=0,s=t;for(let l=e;;){let{index:a,offset:c}=l.content.findIndex(s),d=s-c;if(r.push(l,a,o+c),!d||(l=l.child(a),l.isText))break;s=d-1,o+=c+1}return new Gr(t,r,s)}static resolveCached(e,t){let r=Tc.get(e);if(r)for(let s=0;s<r.elts.length;s++){let l=r.elts[s];if(l.pos==t)return l}else Tc.set(e,r=new qm);let o=r.elts[r.i]=Gr.resolve(e,t);return r.i=(r.i+1)%Gm,o}}class qm{constructor(){this.elts=[],this.i=0}}const Gm=12,Tc=new WeakMap;class Jo{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Jm=Object.create(null);let Sn=class xc{constructor(e,t,r,o=Se.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||F.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,o=0){this.content.nodesBetween(e,t,r,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Ko(this.attrs,t||e.defaultAttrs||Jm)&&Se.sameSet(this.marks,r||Se.none)}copy(e=null){return e==this.content?this:new xc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new xc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return J.empty;let o=this.resolve(e),s=this.resolve(t),l=r?0:o.sharedDepth(t),a=o.start(l),d=o.node(l).content.cut(o.pos-a,s.pos-a);return new J(d,o.depth-l,s.depth-l)}replace(e,t,r){return Wm(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return Gr.resolveCached(this,e)}resolveNoCache(e){return Gr.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Ac(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=F.empty,o=0,s=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,o,s),a=l&&l.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let c=o;c<s;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),l=s&&s.matchFragment(this.content,t);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Se.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Se.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=F.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,o,r);return s.type.checkAttrs(s.attrs),s}};Sn.prototype.text=void 0;class Yo extends Sn{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ac(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Yo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Yo(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Ac(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class er{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Ym(e,t);if(r.next==null)return er.empty;let o=Bc(r);r.next&&r.err("Unexpected trailing text");let s=rg(ng(o));return og(s,r),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let o=this;for(let s=t;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function s(l,a){let c=l.matchFragment(e,r);if(c&&(!t||c.validEnd))return F.from(a.map(d=>d.createAndFill()));for(let d=0;d<l.next.length;d++){let{type:u,next:f}=l.next[d];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let p=s(f,a.concat(u));if(p)return p}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let l=[];for(let a=o;a.type;a=a.via)l.push(a.type);return l.reverse()}for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!o.type||c.validEnd)&&(r.push({match:a.contentMatch,type:a,via:o}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)s+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return s}).join(`
2
+ `)}}er.empty=new er(!0);class Ym{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Bc(n){let e=[];do e.push(Xm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Xm(n){let e=[];do e.push(Zm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Zm(n){let e=tg(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Qm(n,e);else break;return e}function Vc(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Qm(n,e){let t=Vc(n),r=t;return n.eat(",")&&(n.next!="}"?r=Vc(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function eg(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let s in t){let l=t[s];l.isInGroup(e)&&o.push(l)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function tg(n){if(n.eat("(")){let e=Bc(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=eg(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function ng(n){let e=[[]];return o(s(n,0),t()),e;function t(){return e.push([])-1}function r(l,a,c){let d={term:c,to:a};return e[l].push(d),d}function o(l,a){l.forEach(c=>c.to=a)}function s(l,a){if(l.type=="choice")return l.exprs.reduce((c,d)=>c.concat(s(d,a)),[]);if(l.type=="seq")for(let c=0;;c++){let d=s(l.exprs[c],a);if(c==l.exprs.length-1)return d;o(d,a=t())}else if(l.type=="star"){let c=t();return r(a,c),o(s(l.expr,c),c),[r(c)]}else if(l.type=="plus"){let c=t();return o(s(l.expr,a),c),o(s(l.expr,c),c),[r(c)]}else{if(l.type=="opt")return[r(a)].concat(s(l.expr,a));if(l.type=="range"){let c=a;for(let d=0;d<l.min;d++){let u=t();o(s(l.expr,c),u),c=u}if(l.max==-1)o(s(l.expr,c),c);else for(let d=l.min;d<l.max;d++){let u=t();r(c,u),o(s(l.expr,c),u),c=u}return[r(c)]}else{if(l.type=="name")return[r(a,void 0,l.value)];throw new Error("Unknown expr type")}}}}function Lc(n,e){return e-n}function Oc(n,e){let t=[];return r(e),t.sort(Lc);function r(o){let s=n[o];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(o);for(let l=0;l<s.length;l++){let{term:a,to:c}=s[l];!a&&t.indexOf(c)==-1&&r(c)}}}function rg(n){let e=Object.create(null);return t(Oc(n,0));function t(r){let o=[];r.forEach(l=>{n[l].forEach(({term:a,to:c})=>{if(!a)return;let d;for(let u=0;u<o.length;u++)o[u][0]==a&&(d=o[u][1]);Oc(n,c).forEach(u=>{d||o.push([a,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let s=e[r.join(",")]=new er(r.indexOf(n.length-1)>-1);for(let l=0;l<o.length;l++){let a=o[l][1].sort(Lc);s.next.push({type:o[l][0],next:e[a.join(",")]||t(a)})}return s}}function og(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],s=!o.validEnd,l=[];for(let a=0;a<o.next.length;a++){let{type:c,next:d}=o.next[a];l.push(c.name),s&&!(c.isText||c.hasRequiredAttrs())&&(s=!1),r.indexOf(d)==-1&&r.push(d)}s&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Ic(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function Dc(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let s=n[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function Rc(n,e,t,r){for(let o in e)if(!(o in n))throw new RangeError(`Unsupported attribute ${o} for ${t} of type ${o}`);for(let o in n){let s=n[o];s.validate&&s.validate(e[o])}}function Fc(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new lg(n,r,e[r]);return t}let Pc=class $m{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Fc(e,r.attrs),this.defaultAttrs=Ic(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==er.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:Dc(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Sn(this,this.computeAttrs(e),F.from(t),Se.setFrom(r))}createChecked(e=null,t,r){return t=F.from(t),this.checkContent(t),new Sn(this,this.computeAttrs(e),t,Se.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=F.from(t),t.size){let l=this.contentMatch.fillBefore(t);if(!l)return null;t=l.append(t)}let o=this.contentMatch.matchFragment(t),s=o&&o.fillBefore(F.empty,!0);return s?new Sn(this,e,t.append(s),Se.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.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){Rc(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:Se.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,l)=>r[s]=new $m(s,t,l));let o=t.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 sg(n,e,t){let r=t.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 ${n}, got ${s}`)}}class lg{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?sg(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Xo{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=Fc(e,o.attrs),this.excluded=null;let s=Ic(this.attrs);this.instance=s?new Se(this,s):null}create(e=null){return!e&&this.instance?this.instance:new Se(this,Dc(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((s,l)=>r[s]=new Xo(s,o++,t,l)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Rc(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class $c{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=et.from(e.nodes),t.marks=et.from(e.marks||{}),this.nodes=Pc.compile(this.spec.nodes,this),this.marks=Xo.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],l=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[l]||(r[l]=er.parse(l,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=a=="_"?null:a?zc(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],l=s.spec.excludes;s.excluded=l==null?[s]:l==""?[]:zc(this,l.split(" "))}this.nodeFromJSON=o=>Sn.fromJSON(this,o),this.markFromJSON=o=>Se.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Pc){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Yo(r,r.defaultAttrs,e,Se.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function zc(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],s=n.marks[o],l=s;if(s)t.push(s);else for(let a in n.marks){let c=n.marks[a];(o=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(o)>-1)&&t.push(l=c)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function ig(n){return n.tag!=null}function ag(n){return n.style!=null}let wr=class wc{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(o=>{if(ig(o))this.tags.push(o);else if(ag(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,t={}){let r=new Wc(this,t,!1);return r.addAll(e,Se.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Wc(this,t,!0);return r.addAll(e,Se.none,t.from,t.to),J.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(ug(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}matchStyle(e,t,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let l=this.styles[s],a=l.style;if(!(a.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(l.getAttrs){let c=l.getAttrs(t);if(c===!1)continue;l.attrs=c||void 0}return l}}}static schemaRules(e){let t=[];function r(o){let s=o.priority==null?50:o.priority,l=0;for(;l<t.length;l++){let a=t[l];if((a.priority==null?50:a.priority)<s)break}t.splice(l,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(l=>{r(l=Kc(l)),l.mark||l.ignore||l.clearMark||(l.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(l=>{r(l=Kc(l)),l.node||l.ignore||l.mark||(l.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new wc(e,wc.schemaRules(e)))}};const Hc={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},cg={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},jc={ol:!0,ul:!0},Jr=1,$l=2,Yr=4;function Uc(n,e,t){return e!=null?(e?Jr:0)|(e==="full"?$l:0):n&&n.whitespace=="pre"?Jr|$l:t&~Yr}class Zo{constructor(e,t,r,o,s,l){this.type=e,this.attrs=t,this.marks=r,this.solid=o,this.options=l,this.content=[],this.activeMarks=Se.none,this.match=s||(l&Yr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(F.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);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&Jr)){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 t=F.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(F.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Hc.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Wc{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=t.topNode,s,l=Uc(null,t.preserveWhitespace,0)|(r?Yr:0);o?s=new Zo(o.type,o.attrs,Se.none,!0,t.topMatch||o.type.contentMatch,l):r?s=new Zo(null,null,Se.none,!0,null,l):s=new Zo(e.schema.topNodeType,null,Se.none,!0,null,l),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,o=this.top,s=o.options&$l?"full":this.localPreserveWS||(o.options&Jr)>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
+ `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let o=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),a;jc.hasOwnProperty(l)&&this.parser.normalizeLists&&dg(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(c?c.ignore:cg.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(Hc.hasOwnProperty(l))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),d=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=c&&c.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),d&&this.sync(s),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let s=this.parser.matchedStyles[o],l=r.getPropertyValue(s);if(l)for(let a=void 0;;){let c=this.parser.matchStyle(s,l,this,a);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)a=c;else break}}return t}addElementByRule(e,t,r,o){let s,l;if(t.node)if(l=this.parser.schema.nodes[t.node],l.isLeaf)this.insertNode(l.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(l,t.attrs||null,r,t.preserveWhitespace);c&&(s=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let a=this.top;if(l&&l.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}s&&this.sync(a)&&this.open--}addAll(e,t,r,o){let s=r||0;for(let l=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];l!=a;l=l.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(l,t);this.findAtPoint(e,s)}findPlace(e,t,r){let o,s;for(let l=this.open,a=0;l>=0;l--){let c=this.nodes[l],d=c.findWrapping(e);if(d&&(!o||o.length>d.length+a)&&(o=d,s=c,!d.length))break;if(c.solid){if(r)break;a+=2}}if(!o)return null;this.sync(s);for(let l=0;l<o.length;l++)t=this.enterInner(o[l],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let o=this.findPlace(e,t,r);if(o){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let l=Se.none;for(let a of o.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):qc(a.type,e.type))&&(l=a.addToSet(l));return s.content.push(e.mark(l)),!0}return!1}enter(e,t,r,o){let s=this.findPlace(e.create(t),r,!1);return s&&(s=this.enterInner(e,t,r,!0,o)),s}enterInner(e,t,r,o=!1,s){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let a=Uc(e,s,l.options);l.options&Yr&&l.content.length==0&&(a|=Yr);let c=Se.none;return r=r.filter(d=>(l.type?l.type.allowsMarkType(d.type):qc(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Zo(e,t,c,o,null,a)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Jr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&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)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),l=(a,c)=>{for(;a>=0;a--){let d=t[a];if(d==""){if(a==t.length-1||a==0)continue;for(;c>=s;c--)if(l(a-1,c))return!0;return!1}else{let u=c>0||c==0&&o?this.nodes[c].type:r&&c>=s?r.node(c-s).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return l(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function dg(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&jc.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function ug(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Kc(n){let e={};for(let t in n)e[t]=n[t];return e}function qc(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let s=[],l=a=>{s.push(a);for(let c=0;c<a.edgeCount;c++){let{type:d,next:u}=a.edge(c);if(d==e||s.indexOf(u)<0&&l(u))return!0}};if(l(o.contentMatch))return!0}}class tr{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=zl(t).createDocumentFragment());let o=r,s=[];return e.forEach(l=>{if(s.length||l.marks.length){let a=0,c=0;for(;a<s.length&&c<l.marks.length;){let d=l.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(s[a][0])||d.type.spec.spanning===!1)break;a++,c++}for(;a<s.length;)o=s.pop()[1];for(;c<l.marks.length;){let d=l.marks[c++],u=this.serializeMark(d,l.isInline,t);u&&(s.push([d,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(l,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=Qo(zl(t),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,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Qo(zl(r),o(e,t),null,e.attrs)}static renderSpec(e,t,r=null,o){return Qo(e,t,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new tr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Gc(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Gc(e.marks)}}function Gc(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function zl(n){return n.document||window.document}const Jc=new WeakMap;function fg(n){let e=Jc.get(n);return e===void 0&&Jc.set(n,e=pg(n)),e}function pg(n){let e=null;function t(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++)t(r[o]);else for(let o in r)t(r[o])}return t(n),e}function Qo(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],s;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=fg(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 l=o.indexOf(" ");l>0&&(t=o.slice(0,l),o=o.slice(l+1));let a,c=t?n.createElementNS(t,o):n.createElement(o),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Qo(n,p,t,r);if(c.appendChild(h),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:c,contentDOM:a}}const Yc=65535,Xc=Math.pow(2,16);function hg(n,e){return n+e*Xc}function Zc(n){return n&Yc}function mg(n){return(n-(n&Yc))/Xc}const Qc=1,ed=2,es=4,td=8;class Hl{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&td)>0}get deletedBefore(){return(this.delInfo&(Qc|es))>0}get deletedAfter(){return(this.delInfo&(ed|es))>0}get deletedAcross(){return(this.delInfo&es)>0}}class Ct{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Ct.empty)return Ct.empty}recover(e){let t=0,r=Zc(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+mg(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[a+s],u=this.ranges[a+l],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:t:t,h=c+o+(p<0?0:u);if(r)return h;let m=e==(t<0?c:f)?null:hg(a/3,e-c),g=e==c?ed:e==f?Qc:es;return(t<0?e!=c:e!=f)&&(g|=td),new Hl(h,g,m)}o+=u-d}return r?e+o:new Hl(e+o,0,null)}touches(e,t){let r=0,o=Zc(t),s=this.inverted?2:1,l=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let c=this.ranges[a]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[a+s],u=c+d;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+l]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let l=this.ranges[o],a=l-(this.inverted?s:0),c=l+(this.inverted?0:s),d=this.ranges[o+t],u=this.ranges[o+r];e(a,a+d,c,c+u),s+=u-d}}invert(){return new Ct(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ct.empty:new Ct(e<0?[0,-e,0]:[0,0,e])}}Ct.empty=new Ct([]);class Xr{constructor(e,t,r=0,o=e?e.length:0){this.mirror=t,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Xr(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let o=e.getMirror(t);this.appendMap(e._maps[t],o!=null&&o<t?r+o:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e._maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new Xr;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let s=this.from;s<this.to;s++){let l=this._maps[s],a=l.mapResult(e,t);if(a.recover!=null){let c=this.getMirror(s);if(c!=null&&c>s&&c<this.to){s=c,e=this._maps[c].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new Hl(e,o,null)}}const jl=Object.create(null);class st{getMap(){return Ct.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=jl[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jl)throw new RangeError("Duplicate use of step JSON ID "+e);return jl[e]=t,t.prototype.jsonID=e,t}}class ze{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ze(e,null)}static fail(e){return new ze(null,e)}static fromReplace(e,t,r,o){try{return ze.ok(e.replace(t,r,o))}catch(s){if(s instanceof qo)return ze.fail(s.message);throw s}}}function Ul(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let s=n.child(o);s.content.size&&(s=s.copy(Ul(s.content,e,s))),s.isInline&&(s=e(s,t,o)),r.push(s)}return F.fromArray(r)}class Nn extends st{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new J(Ul(t.content,(l,a)=>!l.isAtom||!a.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),o),t.openStart,t.openEnd);return ze.fromReplace(e,this.from,this.to,s)}invert(){return new zt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Nn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Nn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Nn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Nn(t.from,t.to,e.markFromJSON(t.mark))}}st.jsonID("addMark",Nn);class zt extends st{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new J(Ul(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return ze.fromReplace(e,this.from,this.to,r)}invert(){return new Nn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new zt(t.pos,r.pos,this.mark)}merge(e){return e instanceof zt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new zt(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new zt(t.from,t.to,e.markFromJSON(t.mark))}}st.jsonID("removeMark",zt);class Mn extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ze.fromReplace(e,this.pos,this.pos+1,new J(F.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new Mn(this.pos,t.marks[o]);return new Mn(this.pos,this.mark)}}return new nr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Mn(t.pos,e.markFromJSON(t.mark))}}st.jsonID("addNodeMark",Mn);class nr extends st{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ze.fromReplace(e,this.pos,this.pos+1,new J(F.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Mn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new nr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new nr(t.pos,e.markFromJSON(t.mark))}}st.jsonID("removeNodeMark",nr);class Ge extends st{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Wl(e,this.from,this.to)?ze.fail("Structure replace would overwrite content"):ze.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ct([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ge(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new Ge(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ge)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?J.empty:new J(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ge(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?J.empty:new J(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ge(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ge(t.from,t.to,J.fromJSON(e,t.slice),!!t.structure)}}st.jsonID("replace",Ge);class Je extends st{constructor(e,t,r,o,s,l,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=l,this.structure=a}apply(e){if(this.structure&&(Wl(e,this.from,this.gapFrom)||Wl(e,this.gapTo,this.to)))return ze.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ze.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ze.fromReplace(e,this.from,this.to,r):ze.fail("Content does not fit in gap")}getMap(){return new Ct([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Je(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||s>r.pos?null:new Je(t.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,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Je(t.from,t.to,t.gapFrom,t.gapTo,J.fromJSON(e,t.slice),t.insert,!!t.structure)}}st.jsonID("replaceAround",Je);function Wl(n,e,t){let r=n.resolve(e),o=t-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let l=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,o--}}return!1}function gg(n,e,t,r){let o=[],s=[],l,a;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(l&&l.to==p&&l.mark.eq(f[g])?l.to=h:o.push(l=new zt(p,h,f[g])));a&&a.to==p?a.to=h:s.push(a=new Nn(p,h,r))}}),o.forEach(c=>n.step(c)),s.forEach(c=>n.step(c))}function yg(n,e,t,r){let o=[],s=0;n.doc.nodesBetween(e,t,(l,a)=>{if(!l.isInline)return;s++;let c=null;if(r instanceof Xo){let d=l.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(l.marks)&&(c=[r]):c=l.marks;if(c&&c.length){let d=Math.min(a+l.nodeSize,t);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<o.length;h++){let m=o[h];m.step==s-1&&f.eq(o[h].style)&&(p=m)}p?(p.to=d,p.step=s):o.push({style:f,from:Math.max(a,e),to:d,step:s})}}}),o.forEach(l=>n.step(new zt(l.from,l.to,l.style)))}function Kl(n,e,t,r=t.contentMatch,o=!0){let s=n.doc.nodeAt(e),l=[],a=e+1;for(let c=0;c<s.childCount;c++){let d=s.child(c),u=a+d.nodeSize,f=r.matchType(d.type);if(!f)l.push(new Ge(a,u,J.empty));else{r=f;for(let p=0;p<d.marks.length;p++)t.allowsMarkType(d.marks[p].type)||n.step(new zt(a,u,d.marks[p]));if(o&&d.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new J(F.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),l.push(new Ge(a+p.index,a+p.index+p[0].length,m))}}a=u}if(!r.validEnd){let c=r.fillBefore(F.empty,!0);n.replace(a,a,new J(c,0,0))}for(let c=l.length-1;c>=0;c--)n.step(l[c])}function bg(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Er(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),s=n.$from.index(r),l=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(s,l,t))return r;if(r==0||o.type.spec.isolating||!bg(o,s,l))break}return null}function kg(n,e,t){let{$from:r,$to:o,depth:s}=e,l=r.before(s+1),a=o.after(s+1),c=l,d=a,u=F.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=F.from(r.node(m).copy(u)),f++):c--;let p=F.empty,h=0;for(let m=s,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,p=F.from(o.node(m).copy(p)),h++):d++;n.step(new Je(c,d,l,a,new J(u.append(p),f,h),u.size-f,!0))}function ql(n,e,t=null,r=n){let o=xg(n,e),s=o&&wg(r,e);return s?o.map(nd).concat({type:e,attrs:t}).concat(s.map(nd)):null}function nd(n){return{type:n,attrs:null}}function xg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let l=s.length?s[0]:e;return t.canReplaceWith(r,o,l)?s:null}function wg(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.child(r),l=e.contentMatch.findWrapping(s.type);if(!l)return null;let c=(l.length?l[l.length-1]:e).contentMatch;for(let d=r;c&&d<o;d++)c=c.matchType(t.child(d).type);return!c||!c.validEnd?null:l}function Eg(n,e,t){let r=F.empty;for(let l=t.length-1;l>=0;l--){if(r.size){let a=t[l].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=F.from(t[l].type.create(t[l].attrs,r))}let o=e.start,s=e.end;n.step(new Je(o,s,o,s,new J(r,0,0),t.length,!0))}function Cg(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(l,a)=>{let c=typeof o=="function"?o(l):o;if(l.isTextblock&&!l.hasMarkup(r,c)&&vg(n.doc,n.mapping.slice(s).map(a),r)){let d=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&od(n,l,a,s),Kl(n,n.mapping.slice(s).map(a,1),r,void 0,d===null);let u=n.mapping.slice(s),f=u.map(a,1),p=u.map(a+l.nodeSize,1);return n.step(new Je(f,p,f+1,p-1,new J(F.from(r.create(c,null,l.marks)),0,0),1,!0)),d===!0&&rd(n,l,a,s),!1}})}function rd(n,e,t,r){e.forEach((o,s)=>{if(o.isText){let l,a=/\r?\n|\r/g;for(;l=a.exec(o.text);){let c=n.mapping.slice(r).map(t+1+s+l.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function od(n,e,t,r){e.forEach((o,s)=>{if(o.type==o.type.schema.linebreakReplacement){let l=n.mapping.slice(r).map(t+1+s);n.replaceWith(l,l+1,e.type.schema.text(`
5
+ `))}})}function vg(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function _g(n,e,t,r,o){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let l=t.create(r,null,o||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,l);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Je(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new J(F.from(l),0,0),1,!0))}function un(n,e,t=1,r){let o=n.resolve(e),s=o.depth-t,l=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!l.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let d=o.depth-1,u=t-2;d>s;d--,u--){let f=o.node(d),p=o.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=r&&r[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let a=o.indexAfter(s),c=r&&r[0];return o.node(s).canReplaceWith(a,a,c?c.type:o.node(s+1).type)}function Sg(n,e,t=1,r){let o=n.doc.resolve(e),s=F.empty,l=F.empty;for(let a=o.depth,c=o.depth-t,d=t-1;a>c;a--,d--){s=F.from(o.node(a).copy(s));let u=r&&r[d];l=F.from(u?u.type.create(u.attrs,l):o.node(a).copy(l))}n.step(new Ge(e,e,new J(s.append(l),t,t),!0))}function Tn(n,e){let t=n.resolve(e),r=t.index();return sd(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Ng(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let o=0;o<e.childCount;o++){let s=e.child(o),l=s.type==r?n.type.schema.nodes.text:s.type;if(t=t.matchType(l),!t||!n.type.allowsMarks(s.marks))return!1}return t.validEnd}function sd(n,e){return!!(n&&e&&!n.isLeaf&&Ng(n,e))}function ts(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let s,l,a=r.index(o);if(o==r.depth?(s=r.nodeBefore,l=r.nodeAfter):t>0?(s=r.node(o+1),a++,l=r.node(o).maybeChild(a)):(s=r.node(o).maybeChild(a-1),l=r.node(o+1)),s&&!s.isTextblock&&sd(s,l)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function Mg(n,e,t){let r=null,{linebreakReplacement:o}=n.doc.type.schema,s=n.doc.resolve(e-t),l=s.node().type;if(o&&l.inlineContent){let u=l.whitespace=="pre",f=!!l.contentMatch.matchType(o);u&&!f?r=!1:!u&&f&&(r=!0)}let a=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);od(n,u.node(),u.before(),a)}l.inlineContent&&Kl(n,e+t-1,l,s.node().contentMatchAt(s.index()),r==null);let c=n.mapping.slice(a),d=c.map(e-t);if(n.step(new Ge(d,c.map(e+t,-1),J.empty,!0)),r===!0){let u=n.doc.resolve(d);rd(n,u.node(),u.before(),n.steps.length)}return n}function Tg(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))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,t))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,t))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function ld(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let s=0;s<t.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let l=r.depth;l>=0;l--){let a=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,c=r.index(l)+(a>0?1:0),d=r.node(l),u=!1;if(s==1)u=d.canReplace(c,c,o);else{let f=d.contentMatchAt(c).findWrapping(o.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return a==0?r.pos:a<0?r.before(l+1):r.after(l+1)}return null}function ns(n,e,t=e,r=J.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),s=n.resolve(t);return id(o,s,r)?new Ge(e,t,r):new Ag(o,s,r).fit()}function id(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class Ag{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=F.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=F.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,l=r.depth,a=o.depth;for(;l&&a&&s.childCount==1;)s=s.firstChild.content,l--,a--;let c=new J(s,l,a);return e>-1?new Je(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new Ge(r.pos,o.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=Gl(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let l=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:c,match:d}=this.frontier[a],u,f=null;if(t==1&&(l?d.matchType(l.type)||(f=d.fillBefore(F.from(l),!1)):s&&c.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:f};if(t==2&&l&&(u=d.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:u};if(s&&d.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Gl(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new J(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=Gl(e,t);if(o.childCount<=1&&t>0){let s=e.size-t<=t+o.size;this.unplaced=new J(Zr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new J(Zr(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let l=this.unplaced,a=r?r.content:l.content,c=l.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)u.push(o.child(g));f=f.matchFragment(o)}let h=a.size+e-(l.content.size-l.openEnd);for(;d<a.childCount;){let g=a.child(d),y=f.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(f=y,u.push(ad(g.mark(p.allowedMarks(g.marks)),d==1?c:0,d==a.childCount?h:-1)))}let m=d==a.childCount;m||(h=-1),this.placed=Qr(this.placed,t,F.from(u)),this.frontier[t].match=f,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=a;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?J.empty:new J(Zr(l.content,e-1,1),e-1,h<0?l.openEnd:e-1):new J(Zr(l.content,e,d),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Jl(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),l=Jl(e,t,o,r,s);if(l){for(let a=t-1;a>=0;a--){let{match:c,type:d}=this.frontier[a],u=Jl(e,a,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:l,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Qr(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.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,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Qr(this.placed,this.depth,F.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(F.empty,!0);t.childCount&&(this.placed=Qr(this.placed,this.frontier.length,t))}}function Zr(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Zr(n.firstChild.content,e-1,t)))}function Qr(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Qr(n.lastChild.content,e-1,t)))}function Gl(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function ad(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,ad(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(F.empty,!0)))),n.copy(r)}function Jl(n,e,t,r,o){let s=n.node(e),l=o?n.indexAfter(e):n.index(e);if(l==s.childCount&&!t.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,l);return a&&!Bg(t,s.content,l)?a:null}function Bg(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Vg(n){return n.spec.defining||n.spec.definingForContent}function Lg(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),s=n.doc.resolve(t);if(id(o,s,r))return n.step(new Ge(e,t,r));let l=dd(o,n.doc.resolve(t));l[l.length-1]==0&&l.pop();let a=-(o.depth+1);l.unshift(a);for(let p=o.depth,h=o.pos-1;p>0;p--,h--){let m=o.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;l.indexOf(p)>-1?a=p:o.before(p)==h&&l.splice(1,0,-p)}let c=l.indexOf(a),d=[],u=r.openStart;for(let p=r.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==r.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=Vg(h.type);if(m&&!h.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let h=(p+u+1)%(r.openStart+1),m=d[h];if(m)for(let g=0;g<l.length;g++){let y=l[(g+c)%l.length],b=!0;y<0&&(b=!1,y=-y);let k=o.node(y-1),E=o.index(y-1);if(k.canReplaceWith(E,E,m.type,m.marks))return n.replace(o.before(y),b?s.after(y):t,new J(cd(r.content,0,r.openStart,h),h,r.openEnd))}}let f=n.steps.length;for(let p=l.length-1;p>=0&&(n.replace(e,t,r),!(n.steps.length>f));p--){let h=l[p];h<0||(e=o.before(h),t=s.after(h))}}function cd(n,e,t,r,o){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(cd(s.content,e+1,t,r,s)))}if(e>r){let s=o.contentMatchAt(0),l=s.fillBefore(n).append(n);n=l.append(s.matchFragment(l).fillBefore(F.empty,!0))}return n}function Og(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Tg(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new J(F.from(r),0,0))}function Ig(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),s=dd(r,o);for(let l=0;l<s.length;l++){let a=s[l],c=l==s.length-1;if(c&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),o.end(a));if(a>0&&(c||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return n.delete(r.before(a),o.after(a))}for(let l=1;l<=r.depth&&l<=o.depth;l++)if(e-r.start(l)==r.depth-l&&t>r.end(l)&&o.end(l)-t!=o.depth-l&&r.start(l-1)==o.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),o.index(l-1)))return n.delete(r.before(l),t);n.delete(e,t)}function dd(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let s=n.start(o);if(s<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&t.push(o)}return t}class Cr extends st{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ze.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return ze.fromReplace(e,this.pos,this.pos+1,new J(F.from(o),0,t.isLeaf?0:1))}getMap(){return Ct.empty}invert(e){return new Cr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Cr(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Cr(t.pos,t.attr,t.value)}}st.jsonID("attr",Cr);class eo extends st{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ze.ok(r)}getMap(){return Ct.empty}invert(e){return new eo(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new eo(t.attr,t.value)}}st.jsonID("docAttr",eo);let vr=class extends Error{};vr=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},vr.prototype=Object.create(Error.prototype),vr.prototype.constructor=vr,vr.prototype.name="TransformError";class Yl{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Xr}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new vr(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=J.empty){let o=ns(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new J(F.from(r),0,0))}delete(e,t){return this.replace(e,t,J.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Lg(this,e,t,r),this}replaceRangeWith(e,t,r){return Og(this,e,t,r),this}deleteRange(e,t){return Ig(this,e,t),this}lift(e,t){return kg(this,e,t),this}join(e,t=1){return Mg(this,e,t),this}wrap(e,t){return Eg(this,e,t),this}setBlockType(e,t=e,r,o=null){return Cg(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return _g(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Cr(e,t,r)),this}setDocAttribute(e,t){return this.step(new eo(e,t)),this}addNodeMark(e,t){return this.step(new Mn(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof Se)t.isInSet(r.marks)&&this.step(new nr(e,t));else{let o=r.marks,s,l=[];for(;s=t.isInSet(o);)l.push(new nr(e,s)),o=s.removeFromSet(o);for(let a=l.length-1;a>=0;a--)this.step(l[a])}return this}split(e,t=1,r){return Sg(this,e,t,r),this}addMark(e,t,r){return gg(this,e,t,r),this}removeMark(e,t,r){return yg(this,e,t,r),this}clearIncompatible(e,t,r){return Kl(this,e,t,r),this}}const Xl=Object.create(null);class le{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new ud(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=J.empty){let r=t.content.lastChild,o=null;for(let a=0;a<t.openEnd;a++)o=r,r=r.lastChild;let s=e.steps.length,l=this.ranges;for(let a=0;a<l.length;a++){let{$from:c,$to:d}=l[a],u=e.mapping.slice(s);e.replaceRange(u.map(c.pos),u.map(d.pos),a?J.empty:t),a==0&&hd(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r),d=c.map(l.pos),u=c.map(a.pos);s?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),hd(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new se(e):_r(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let l=t<0?_r(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):_r(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(l)return l}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new vt(e.node(0))}static atStart(e){return _r(e,e,0,0,1)||new vt(e)}static atEnd(e){return _r(e,e,e.content.size,e.childCount,-1)||new vt(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Xl[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Xl)throw new RangeError("Duplicate use of selection JSON ID "+e);return Xl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return se.between(this.$anchor,this.$head).getBookmark()}}le.prototype.visible=!0;class ud{constructor(e,t){this.$from=e,this.$to=t}}let fd=!1;function pd(n){!fd&&!n.parent.inlineContent&&(fd=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class se extends le{constructor(e,t=e){pd(e),pd(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return le.near(r);let o=e.resolve(t.map(this.anchor));return new se(o.parent.inlineContent?o:r,r)}replace(e,t=J.empty){if(super.replace(e,t),t==J.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof se&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new rs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new se(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let s=le.findFrom(t,r,!0)||le.findFrom(t,-r,!0);if(s)t=s.$head;else return le.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(le.findFrom(e,-r,!0)||le.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new se(e,t)}}le.jsonID("text",se);class rs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new rs(e.map(this.anchor),e.map(this.head))}resolve(e){return se.between(e.resolve(this.anchor),e.resolve(this.head))}}class oe extends le{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),s=e.resolve(o);return r?le.near(s):new oe(s)}content(){return new J(F.from(this.node),0,0)}eq(e){return e instanceof oe&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Zl(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new oe(e.resolve(t.anchor))}static create(e,t){return new oe(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}oe.prototype.visible=!1,le.jsonID("node",oe);class Zl{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new rs(r,r):new Zl(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&oe.isSelectable(r)?new oe(t):le.near(t)}}class vt extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=J.empty){if(t==J.empty){e.delete(0,e.doc.content.size);let r=le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new vt(e)}map(e){return new vt(e)}eq(e){return e instanceof vt}getBookmark(){return Dg}}le.jsonID("all",vt);const Dg={map(){return this},resolve(n){return new vt(n)}};function _r(n,e,t,r,o,s=!1){if(e.inlineContent)return se.create(n,t);for(let l=r-(o>0?0:1);o>0?l<e.childCount:l>=0;l+=o){let a=e.child(l);if(a.isAtom){if(!s&&oe.isSelectable(a))return oe.create(n,t-(o<0?a.nodeSize:0))}else{let c=_r(n,a,t+o,o<0?a.childCount:0,o,s);if(c)return c}t+=a.nodeSize*o}return null}function hd(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof Ge||o instanceof Je))return;let s=n.mapping.maps[r],l;s.forEach((a,c,d,u)=>{l==null&&(l=u)}),n.setSelection(le.near(n.doc.resolve(l),t))}const md=1,ss=2,gd=4;class Rg extends Yl{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|md)&~ss,this.storedMarks=null,this}get selectionSet(){return(this.updated&md)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ss,this}ensureMarks(e){return Se.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&ss)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ss,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Se.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let l=this.doc.resolve(t);s=r==t?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,s)),this.selection.empty||this.setSelection(le.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=gd,this}get scrolledIntoView(){return(this.updated&gd)>0}}function yd(n,e){return!e||!n?n:n.bind(e)}class to{constructor(e,t,r){this.name=e,this.init=yd(t.init,r),this.apply=yd(t.apply,r)}}const Fg=[new to("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new to("selection",{init(n,e){return n.selection||le.atStart(e.doc)},apply(n){return n.selection}}),new to("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new to("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Ql{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Fg.slice(),t&&t.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 to(r.key,r.spec.state,r))})}}class Sr{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){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 t=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let l=0;l<this.config.plugins.length;l++){let a=this.config.plugins[l];if(a.spec.appendTransaction){let c=o?o[l].n:0,d=o?o[l].state:this,u=c<t.length&&a.spec.appendTransaction.call(a,c?t.slice(c):t,d,r);if(u&&r.filterTransaction(u,l)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let f=0;f<this.config.plugins.length;f++)o.push(f<l?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),s=!0}o&&(o[l]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Sr(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Rg(this)}static create(e){let t=new Ql(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Sr(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new Ql(this.schema,e.plugins),r=t.fields,o=new Sr(t);for(let s=0;s<r.length;s++){let l=r[s].name;o[l]=this.hasOwnProperty(l)?this[l]:r[s].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.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&&(t[r]=s.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Ql(e.schema,e.plugins),s=new Sr(o);return o.fields.forEach(l=>{if(l.name=="doc")s.doc=Sn.fromJSON(e.schema,t.doc);else if(l.name=="selection")s.selection=le.fromJSON(s.doc,t.selection);else if(l.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let c=r[a],d=c.spec.state;if(c.key==l.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,a)){s[l.name]=d.fromJSON.call(c,e,t[a],s);return}}s[l.name]=l.init(e,s)}}),s}}function bd(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=bd(o,e,{})),t[r]=o}return t}class Oe{constructor(e){this.spec=e,this.props={},e.props&&bd(e.props,this,this.props),this.key=e.key?e.key.key:kd("plugin")}getState(e){return e[this.key]}}const ei=Object.create(null);function kd(n){return n in ei?n+"$"+ ++ei[n]:(ei[n]=0,n+"$")}class $e{constructor(e="key"){this.key=kd(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ti=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function xd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const wd=(n,e,t)=>{let r=xd(n,t);if(!r)return!1;let o=ni(r);if(!o){let l=r.blockRange(),a=l&&Er(l);return a==null?!1:(e&&e(n.tr.lift(l,a).scrollIntoView()),!0)}let s=o.nodeBefore;if(Ad(n,o,e,-1))return!0;if(r.parent.content.size==0&&(Nr(s,"end")||oe.isSelectable(s)))for(let l=r.depth;;l--){let a=ns(n.doc,r.before(l),r.after(l),J.empty);if(a&&a.slice.size<a.to-a.from){if(e){let c=n.tr.step(a);c.setSelection(Nr(s,"end")?le.findFrom(c.doc.resolve(c.mapping.map(o.pos,-1)),-1):oe.create(c.doc,o.pos-s.nodeSize)),e(c.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return s.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos-s.nodeSize,o.pos).scrollIntoView()),!0):!1},Pg=(n,e,t)=>{let r=xd(n,t);if(!r)return!1;let o=ni(r);return o?Ed(n,o,e):!1},$g=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let o=ri(r);return o?Ed(n,o,e):!1};function Ed(n,e,t){let r=e.nodeBefore,o=r,s=e.pos-1;for(;!o.isTextblock;s--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let l=e.nodeAfter,a=l,c=e.pos+1;for(;!a.isTextblock;c++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let d=ns(n.doc,s,c,J.empty);if(!d||d.from!=s||d instanceof Ge&&d.slice.size>=c-s)return!1;if(t){let u=n.tr.step(d);u.setSelection(se.create(u.doc,s)),t(u.scrollIntoView())}return!0}function Nr(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const Cd=(n,e,t)=>{let{$head:r,empty:o}=n.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=ni(r)}let l=s&&s.nodeBefore;return!l||!oe.isSelectable(l)?!1:(e&&e(n.tr.setSelection(oe.create(n.doc,s.pos-l.nodeSize)).scrollIntoView()),!0)};function ni(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function vd(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const _d=(n,e,t)=>{let r=vd(n,t);if(!r)return!1;let o=ri(r);if(!o)return!1;let s=o.nodeAfter;if(Ad(n,o,e,1))return!0;if(r.parent.content.size==0&&(Nr(s,"start")||oe.isSelectable(s))){let l=ns(n.doc,r.before(),r.after(),J.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(Nr(s,"start")?le.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):oe.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&o.depth==r.depth-1?(e&&e(n.tr.delete(o.pos,o.pos+s.nodeSize).scrollIntoView()),!0):!1},Sd=(n,e,t)=>{let{$head:r,empty:o}=n.selection,s=r;if(!o)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;s=ri(r)}let l=s&&s.nodeAfter;return!l||!oe.isSelectable(l)?!1:(e&&e(n.tr.setSelection(oe.create(n.doc,s.pos)).scrollIntoView()),!0)};function ri(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const zg=(n,e)=>{let t=n.selection,r=t instanceof oe,o;if(r){if(t.node.isTextblock||!Tn(n.doc,t.from))return!1;o=t.from}else if(o=ts(n.doc,t.from,-1),o==null)return!1;if(e){let s=n.tr.join(o);r&&s.setSelection(oe.create(s.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Hg=(n,e)=>{let t=n.selection,r;if(t instanceof oe){if(t.node.isTextblock||!Tn(n.doc,t.to))return!1;r=t.to}else if(r=ts(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},jg=(n,e)=>{let{$from:t,$to:r}=n.selection,o=t.blockRange(r),s=o&&Er(o);return s==null?!1:(e&&e(n.tr.lift(o,s).scrollIntoView()),!0)},Nd=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function oi(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Ug=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let o=t.node(-1),s=t.indexAfter(-1),l=oi(o.contentMatchAt(s));if(!l||!o.canReplaceWith(s,s,l))return!1;if(e){let a=t.after(),c=n.tr.replaceWith(a,a,l.createAndFill());c.setSelection(le.near(c.doc.resolve(a),1)),e(c.scrollIntoView())}return!0},Md=(n,e)=>{let t=n.selection,{$from:r,$to:o}=t;if(t instanceof vt||r.parent.inlineContent||o.parent.inlineContent)return!1;let s=oi(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let l=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=n.tr.insert(l,s.createAndFill());a.setSelection(se.create(a.doc,l+1)),e(a.scrollIntoView())}return!0},Td=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(un(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),o=r&&Er(r);return o==null?!1:(e&&e(n.tr.lift(r,o).scrollIntoView()),!0)};function Wg(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof oe&&e.selection.node.isBlock)return!r.parentOffset||!un(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],l,a,c=!1,d=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){c=r.end(h)==r.pos+(r.depth-h),d=r.start(h)==r.pos-(r.depth-h),a=oi(r.node(h-1).contentMatchAt(r.indexAfter(h-1))),s.unshift(c&&a?{type:a}:null),l=h;break}else{if(h==1)return!1;s.unshift(null)}let u=e.tr;(e.selection instanceof se||e.selection instanceof vt)&&u.deleteSelection();let f=u.mapping.map(r.pos),p=un(u.doc,f,s.length,s);if(p||(s[0]=a?{type:a}:null,p=un(u.doc,f,s.length,s)),!p)return!1;if(u.split(f,s.length,s),!c&&d&&r.node(l).type!=a){let h=u.mapping.map(r.before(l)),m=u.doc.resolve(h);a&&r.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(l)),a)}return t&&t(u.scrollIntoView()),!0}}const Kg=Wg(),qg=(n,e)=>{let{$from:t,to:r}=n.selection,o,s=t.sharedDepth(r);return s==0?!1:(o=t.before(s),e&&e(n.tr.setSelection(oe.create(n.doc,o))),!0)};function Gg(n,e,t){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)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(o.isTextblock||Tn(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function Ad(n,e,t,r){let o=e.nodeBefore,s=e.nodeAfter,l,a,c=o.type.spec.isolating||s.type.spec.isolating;if(!c&&Gg(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(l=(a=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&a.matchType(l[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,m=F.empty;for(let b=l.length-1;b>=0;b--)m=F.from(l[b].create(null,m));m=F.from(o.copy(m));let g=n.tr.step(new Je(e.pos-1,h,e.pos,h,new J(m,1,0),l.length,!0)),y=g.doc.resolve(h+2*l.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Tn(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=s.type.spec.isolating||r>0&&c?null:le.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&Er(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(d&&Nr(s,"start",!0)&&Nr(o,"end")){let h=o,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=s,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=F.empty;for(let E=m.length-1;E>=0;E--)b=F.from(m[E].copy(b));let k=n.tr.step(new Je(e.pos-m.length,e.pos+s.nodeSize,e.pos+y,e.pos+s.nodeSize-y,new J(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function Bd(n){return function(e,t){let r=e.selection,o=n<0?r.$from:r.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return o.node(s).isTextblock?(t&&t(e.tr.setSelection(se.create(e.doc,n<0?o.start(s):o.end(s)))),!0):!1}}const Jg=Bd(-1),Yg=Bd(1);function Xg(n,e=null){return function(t,r){let{$from:o,$to:s}=t.selection,l=o.blockRange(s),a=l&&ql(l,n,e);return a?(r&&r(t.tr.wrap(l,a).scrollIntoView()),!0):!1}}function Vd(n,e=null){return function(t,r){let o=!1;for(let s=0;s<t.selection.ranges.length&&!o;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];t.doc.nodesBetween(l,a,(c,d)=>{if(o)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)o=!0;else{let u=t.doc.resolve(d),f=u.index();o=u.parent.canReplaceWith(f,f+1,n)}})}if(!o)return!1;if(r){let s=t.tr;for(let l=0;l<t.selection.ranges.length;l++){let{$from:{pos:a},$to:{pos:c}}=t.selection.ranges[l];s.setBlockType(a,c,n,e)}r(s.scrollIntoView())}return!0}}function si(...n){return function(e,t,r){for(let o=0;o<n.length;o++)if(n[o](e,t,r))return!0;return!1}}si(ti,wd,Cd),si(ti,_d,Sd),si(Nd,Md,Td,Kg),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Zg(n,e=null){return function(t,r){let{$from:o,$to:s}=t.selection,l=o.blockRange(s);if(!l)return!1;let a=r?t.tr:null;return Qg(a,l,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Qg(n,e,t,r=null){let o=!1,s=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=l.resolve(e.start-2);s=new Jo(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Jo(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=ql(s,t,r,e);return a?(n&&e0(n,e,a,o,t),!0):!1}function e0(n,e,t,r,o){let s=F.empty;for(let u=t.length-1;u>=0;u--)s=F.from(t[u].type.create(t[u].attrs,s));n.step(new Je(e.start-(r?2:0),e.end,e.start,e.end,new J(s,0,0),t.length,!0));let l=0;for(let u=0;u<t.length;u++)t[u].type==o&&(l=u+1);let a=t.length-l,c=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&un(n.doc,c,a)&&(n.split(c,a),c+=2*a),c+=d.child(u).nodeSize;return n}function t0(n){return function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,l=>l.childCount>0&&l.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?n0(e,t,n,s):r0(e,t,s):!0:!1}}function n0(n,e,t,r){let o=n.tr,s=r.end,l=r.$to.end(r.depth);s<l&&(o.step(new Je(s-1,l,s,l,new J(F.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Jo(o.doc.resolve(r.$from.pos),o.doc.resolve(l),r.depth));const a=Er(r);if(a==null)return!1;o.lift(r,a);let c=o.doc.resolve(o.mapping.map(s,-1)-1);return Tn(o.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&o.join(c.pos),e(o.scrollIntoView()),!0}function r0(n,e,t){let r=n.tr,o=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=o.child(m).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),l=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let a=t.startIndex==0,c=t.endIndex==o.childCount,d=s.node(-1),u=s.index(-1);if(!d.canReplace(u+(a?0:1),u+1,l.content.append(c?F.empty:F.from(o))))return!1;let f=s.pos,p=f+l.nodeSize;return r.step(new Je(f-(a?1:0),p+(c?1:0),f+1,p-1,new J((a?F.empty:F.from(o.copy(F.empty))).append(c?F.empty:F.from(o.copy(F.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function o0(n){return function(e,t){let{$from:r,$to:o}=e.selection,s=r.blockRange(o,d=>d.childCount>0&&d.firstChild.type==n);if(!s)return!1;let l=s.startIndex;if(l==0)return!1;let a=s.parent,c=a.child(l-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==a.type,u=F.from(d?n.create():null),f=new J(F.from(n.create(null,F.from(a.type.create(null,u)))),d?3:1,0),p=s.start,h=s.end;t(e.tr.step(new Je(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const tt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mr=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let li=null;const fn=function(n,e,t){let r=li||(li=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},s0=function(){li=null},rr=function(n,e,t,r){return t&&(Ld(n,e,t,r,-1)||Ld(n,e,t,r,1))},l0=/^(img|br|input|textarea|hr)$/i;function Ld(n,e,t,r,o){for(var s;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Tt(n))){let l=n.parentNode;if(!l||l.nodeType!=1||no(n)||l0.test(n.nodeName)||n.contentEditable=="false")return!1;e=tt(n)+(o<0?0:1),n=l}else if(n.nodeType==1){let l=n.childNodes[e+(o<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((s=l.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=o;else return!1;else n=l,e=o<0?Tt(n):0}else return!1}}function Tt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function i0(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Tt(n)}else if(n.parentNode&&!no(n))e=tt(n),n=n.parentNode;else return null}}function a0(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!no(n))e=tt(n)+1,n=n.parentNode;else return null}}function c0(n,e,t){for(let r=e==0,o=e==Tt(n);r||o;){if(n==t)return!0;let s=tt(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,o=o&&s==Tt(n)}}function no(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const ls=function(n){return n.focusNode&&rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function or(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function d0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function u0(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Tt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Tt(r.startContainer),r.startOffset)}}}const Jt=typeof navigator<"u"?navigator:null,Od=typeof document<"u"?document:null,An=Jt&&Jt.userAgent||"",ii=/Edge\/(\d+)/.exec(An),Id=/MSIE \d/.exec(An),ai=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(An),bt=!!(Id||ai||ii),Bn=Id?document.documentMode:ai?+ai[1]:ii?+ii[1]:0,At=!bt&&/gecko\/(\d+)/i.test(An);At&&+(/Firefox\/(\d+)/.exec(An)||[0,0])[1];const ci=!bt&&/Chrome\/(\d+)/.exec(An),lt=!!ci,Dd=ci?+ci[1]:0,ut=!bt&&!!Jt&&/Apple Computer/.test(Jt.vendor),Tr=ut&&(/Mobile\/\w+/.test(An)||!!Jt&&Jt.maxTouchPoints>2),Bt=Tr||(Jt?/Mac/.test(Jt.platform):!1),f0=Jt?/Win/.test(Jt.platform):!1,pn=/Android \d/.test(An),ro=!!Od&&"webkitFontSmoothing"in Od.documentElement.style,p0=ro?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function h0(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function hn(n,e){return typeof n=="number"?n:n[e]}function m0(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Rd(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let l=t||n.dom;l;){if(l.nodeType!=1){l=Mr(l);continue}let a=l,c=a==s.body,d=c?h0(s):m0(a),u=0,f=0;if(e.top<d.top+hn(r,"top")?f=-(d.top-e.top+hn(o,"top")):e.bottom>d.bottom-hn(r,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+hn(o,"top")-d.top:e.bottom-d.bottom+hn(o,"bottom")),e.left<d.left+hn(r,"left")?u=-(d.left-e.left+hn(o,"left")):e.right>d.right-hn(r,"right")&&(u=e.right-d.right+hn(o,"right")),u||f)if(c)s.defaultView.scrollBy(u,f);else{let h=a.scrollLeft,m=a.scrollTop;f&&(a.scrollTop+=f),u&&(a.scrollLeft+=u);let g=a.scrollLeft-h,y=a.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=c?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(p))break;l=p=="absolute"?l.offsetParent:Mr(l)}}function g0(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,l=t+1;l<Math.min(innerHeight,e.bottom);l+=5){let a=n.root.elementFromPoint(s,l);if(!a||a==n.dom||!n.dom.contains(a))continue;let c=a.getBoundingClientRect();if(c.top>=t-20){r=a,o=c.top;break}}return{refDOM:r,refTop:o,stack:Fd(n.dom)}}function Fd(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Mr(r));return e}function y0({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Pd(t,r==0?0:r-e)}function Pd(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:s}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ar=null;function b0(n){if(n.setActive)return n.setActive();if(Ar)return n.focus(Ar);let e=Fd(n);n.focus(Ar==null?{get preventScroll(){return Ar={preventScroll:!0},!0}}:void 0),Ar||(Ar=!1,Pd(e,0))}function $d(n,e){let t,r=2e8,o,s=0,l=e.top,a=e.top,c,d;for(let u=n.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=fn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=l&&m.bottom>=a){l=Math.max(m.bottom,l),a=Math.min(m.top,a);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&c&&(t=c,o=d,r=0),t&&t.nodeType==3?k0(t,o):!t||r&&t.nodeType==1?{node:n,offset:s}:$d(t,o)}function k0(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=Vn(r,1);if(s.top!=s.bottom&&di(e,s))return{node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function di(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function x0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function w0(n,e,t){let{node:r,offset:o}=$d(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();s=l.left!=l.right&&t.left>(l.left+l.right)/2?1:-1}return n.docView.posFromDOM(r,o,s)}function E0(n,e,t,r){let o=-1;for(let s=e,l=!1;s!=n.dom;){let a=n.docView.nearestDesc(s,!0),c;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((c=a.dom.getBoundingClientRect()).width||c.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!l&&c.left>r.left||c.top>r.top?o=a.posBefore:(!l&&c.right<r.left||c.bottom<r.top)&&(o=a.posAfter),l=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function zd(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=o;;){let l=n.childNodes[s];if(l.nodeType==1){let a=l.getClientRects();for(let c=0;c<a.length;c++){let d=a[c];if(di(e,d))return zd(l,e,d)}}if((s=(s+1)%r)==o)break}return n}function C0(n,e){let t=n.dom.ownerDocument,r,o=0,s=u0(t,e.left,e.top);s&&({node:r,offset:o}=s);let l=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),a;if(!l||!n.dom.contains(l.nodeType!=1?l.parentNode:l)){let d=n.dom.getBoundingClientRect();if(!di(e,d)||(l=zd(n.dom,e,d),!l))return null}if(ut)for(let d=l;r&&d;d=Mr(d))d.draggable&&(r=void 0);if(l=x0(l,e),r){if(At&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&o++}let d;ro&&o&&r.nodeType==1&&(d=r.childNodes[o-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=E0(n,r,o,e))}a==null&&(a=w0(n,l,e));let c=n.docView.nearestDesc(l,!0);return{pos:a,inside:c?c.posAtStart-c.border:-1}}function Hd(n){return n.top<n.bottom||n.left<n.right}function Vn(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Hd(r))return r}return Array.prototype.find.call(t,Hd)||n.getBoundingClientRect()}const v0=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function jd(n,e,t){let{node:r,offset:o,atom:s}=n.docView.domFromPos(e,t<0?-1:1),l=ro||At;if(r.nodeType==3)if(l&&(v0.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let c=Vn(fn(r,o,o),t);if(At&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let d=Vn(fn(r,o-1,o-1),-1);if(d.top==c.top){let u=Vn(fn(r,o,o+1),-1);if(u.top!=c.top)return oo(u,u.left<d.left)}}return c}else{let c=o,d=o,u=t<0?1:-1;return t<0&&!o?(d++,u=-1):t>=0&&o==r.nodeValue.length?(c--,u=1):t<0?c--:d++,oo(Vn(fn(r,c,d),u),u<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(t<0||o==Tt(r))){let c=r.childNodes[o-1];if(c.nodeType==1)return ui(c.getBoundingClientRect(),!1)}if(s==null&&o<Tt(r)){let c=r.childNodes[o];if(c.nodeType==1)return ui(c.getBoundingClientRect(),!0)}return ui(r.getBoundingClientRect(),t>=0)}if(s==null&&o&&(t<0||o==Tt(r))){let c=r.childNodes[o-1],d=c.nodeType==3?fn(c,Tt(c)-(l?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return oo(Vn(d,1),!1)}if(s==null&&o<Tt(r)){let c=r.childNodes[o];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?fn(c,0,l?0:1):c.nodeType==1?c:null:null;if(d)return oo(Vn(d,-1),!0)}return oo(Vn(r.nodeType==3?fn(r):r,-t),t>=0)}function oo(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function ui(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Ud(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function _0(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Ud(n,e,()=>{let{node:s}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let l=jd(n,o.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let c;if(a.nodeType==1)c=a.getClientRects();else if(a.nodeType==3)c=fn(a,0,a.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?l.top-u.top>(u.bottom-l.top)*2:u.bottom-l.bottom>(l.bottom-u.top)*2))return!1}}return!0})}const S0=/[\u0590-\u08ac]/;function N0(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,l=o==r.parent.content.size,a=n.domSelection();return a?!S0.test(r.parent.textContent)||!a.modify?t=="left"||t=="backward"?s:l:Ud(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=n.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{a.collapse(u,f),c&&(c!=u||d!=f)&&a.extend&&a.extend(c,d)}catch{}return p!=null&&(a.caretBidiLevel=p),y}):r.pos==r.start()||r.pos==r.end()}let Wd=null,Kd=null,qd=!1;function M0(n,e,t){return Wd==e&&Kd==t?qd:(Wd=e,Kd=t,qd=t=="up"||t=="down"?_0(n,e,t):N0(n,e,t))}const Vt=0,Gd=1,sr=2,Yt=3;class so{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Vt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let o=this.children[t];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,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,l;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(l)+l.size:this.posAtStart}else{let s,l;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((l=s.pmViewDesc)&&l.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(l):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>tt(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(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&t==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,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),l;if(s&&(!t||s.node))if(r&&(l=s.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)for(let l=0;l<o.children.length;l++){let a=o.children[l];if(a.size){o=a;break}}return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,t){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 l=this.children[r],a=s+l.size;if(a>e||l instanceof Xd){o=e-s;break}s=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Jd&&s.side>=0;r--);if(t<=0){let s,l=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,l=!1);return s&&t&&l&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?tt(s.dom)+1:0}}else{let s,l=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,l=!1);return s&&l&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?tt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let l=r,a=0;;a++){let c=this.children[a],d=l+c.size;if(o==-1&&e<=d){let u=l+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=l;for(let f=a;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=tt(p.dom)+1;break}e-=p.size}o==-1&&(o=0)}if(o>-1&&(d>t||a==this.children.length-1)){t=d;for(let u=a+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=tt(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}l=d}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let s=Math.min(e,t),l=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(s>m&&l<y)return g.setSelection(e-m-g.border,t-m-g.border,r,o);m=y}let a=this.domFromPos(e,e?-1:1),c=t==e?a:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),f=!1;if((At||ut)&&e==t){let{node:h,offset:m}=a;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
7
+ `),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(a=c={node:y.parentNode,offset:tt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(At&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||f&&ut)&&rr(a.node,a.offset,u.anchorNode,u.anchorOffset)&&rr(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==t)&&!(f&&At)){d.collapse(a.node,a.offset);try{e!=t&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>t){let m=a;a=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(a.node,a.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,o=0;o<this.children.length;o++){let s=this.children[o],l=r+s.size;if(r==l?e<=l&&t>=r:e<l&&t>r){let a=r+s.border,c=l-s.border;if(e>=a&&t<=c){this.dirty=e==r||t==l?sr:Gd,e==a&&t==c&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Yt:s.markDirty(e-a,t-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?sr:Yt}r=l}this.dirty=sr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?sr:Gd;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Jd extends so{constructor(e,t,r,o){let s,l=t.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!s)return o;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(l.nodeType!=1){let a=document.createElement("span");a.appendChild(l),l=a}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==Vt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class T0 extends so{constructor(e,t,r,o){super(e,[],t,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class lr extends so{constructor(e,t,r,o,s){super(e,[],r,o),this.mark=t,this.spec=s}static create(e,t,r,o){let s=o.nodeViews[t.type.name],l=s&&s(t,o,r);return(!l||!l.dom)&&(l=tr.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new lr(e,t,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Yt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Yt&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=Vt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Vt}}slice(e,t,r){let o=lr.create(this.parent,this.mark,!0,r),s=this.children,l=this.size;t<l&&(s=pi(s,t,l,r)),e>0&&(s=pi(s,0,e,r));for(let a=0;a<s.length;a++)s[a].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 Ln extends so{constructor(e,t,r,o,s,l,a,c,d){super(e,[],s,l),this.node=t,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,t,r,o,s,l){let a=s.nodeViews[t.type.name],c,d=a&&a(t,s,()=>{if(!c)return l;if(c.parent)return c.parent.posBeforeChild(c)},r,o),u=d&&d.dom,f=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=tr.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let p=u;return u=eu(u,r,t),d?c=new A0(e,t,r,o,u,f||null,p,d,s,l+1):t.isText?new is(e,t,r,o,u,p,s):new Ln(e,t,r,o,u,f||null,p,s,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>F.empty)}return e}matchesNode(e,t,r){return this.dirty==Vt&&e.eq(this.node)&&as(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,o=t,s=e.composing?this.localCompositionInfo(e,t):null,l=s&&s.pos>-1?s:null,a=s&&s.pos<0,c=new V0(this,l&&l.node,e);I0(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?Se.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,o)},(d,u,f,p)=>{c.syncToMarks(d.marks,r,e);let h;c.findNodeMatch(d,u,f,p)||a&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(h=c.findIndexWithChild(s.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,o)||c.addNode(d,u,f,e,o),o+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==sr)&&(l&&this.protectLocalComposition(e,l),Zd(this.contentDOM,this.children,e),Tr&&D0(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof se)||r<t||o>t+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 l=s.nodeValue,a=R0(this.node.content,l,r-t,o-t);return a<0?null:{node:s,pos:a,text:l}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:o}){if(this.getDesc(t))return;let s=t;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 l=new T0(this,s,t,o);e.input.compositionNodes.push(l),this.children=pi(this.children,r,r+o.length,e,l)}update(e,t,r,o){return this.dirty==Yt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,o),!0)}updateInner(e,t,r,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Vt}updateOuterDeco(e){if(as(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Qd(this.dom,this.nodeDOM,fi(this.outerDeco,this.node,t),fi(e,this.node,t)),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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Yd(n,e,t,r,o){eu(r,e,n);let s=new Ln(void 0,n,e,t,r,r,r,o,0);return s.contentDOM&&s.updateChildren(o,0),s}class is extends Ln{constructor(e,t,r,o,s,l,a){super(e,t,r,o,s,null,l,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,o){return this.dirty==Yt||this.dirty!=Vt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Vt||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=Vt,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let o=this.node.cut(e,t),s=document.createTextNode(o.text);return new is(this.parent,o,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Yt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Xd extends so{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Vt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class A0 extends Ln{constructor(e,t,r,o,s,l,a,c,d,u){super(e,t,r,o,s,l,a,d,u),this.spec=c}update(e,t,r,o){if(this.dirty==Yt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,o),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,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 Zd(n,e,t){let r=n.firstChild,o=!1;for(let s=0;s<e.length;s++){let l=e[s],a=l.dom;if(a.parentNode==n){for(;a!=r;)r=tu(r),o=!0;r=r.nextSibling}else o=!0,n.insertBefore(a,r);if(l instanceof lr){let c=r?r.previousSibling:n.lastChild;Zd(l.contentDOM,l.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=tu(r),o=!0;o&&t.trackWrites==n&&(t.trackWrites=null)}const lo=function(n){n&&(this.nodeName=n)};lo.prototype=Object.create(null);const ir=[new lo];function fi(n,e,t){if(n.length==0)return ir;let r=t?ir[0]:new lo,o=[r];for(let s=0;s<n.length;s++){let l=n[s].type.attrs;if(l){l.nodeName&&o.push(r=new lo(l.nodeName));for(let a in l){let c=l[a];c!=null&&(t&&o.length==1&&o.push(r=new lo(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+c:a=="style"?r.style=(r.style?r.style+";":"")+c:a!="nodeName"&&(r[a]=c))}}}return o}function Qd(n,e,t,r){if(t==ir&&r==ir)return e;let o=e;for(let s=0;s<r.length;s++){let l=r[s],a=t[s];if(s){let c;a&&a.nodeName==l.nodeName&&o!=n&&(c=o.parentNode)&&c.nodeName.toLowerCase()==l.nodeName||(c=document.createElement(l.nodeName),c.pmIsDeco=!0,c.appendChild(o),a=ir[0]),o=c}B0(o,a||ir[0],l)}return o}function B0(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)o.indexOf(r[s])==-1&&n.classList.remove(r[s]);for(let s=0;s<o.length;s++)r.indexOf(o[s])==-1&&n.classList.add(o[s]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)n.style.removeProperty(o[1])}t.style&&(n.style.cssText+=t.style)}}function eu(n,e,t){return Qd(n,n,ir,fi(e,t,n.nodeType!=1))}function as(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function tu(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class V0{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=L0(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let o=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;o<l&&(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=Vt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let c=lr.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,o){let s=-1,l;if(o>=this.preMatch.index&&(l=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&l.matchesNode(e,t,r))s=this.top.children.indexOf(l,this.index);else for(let a=this.index,c=Math.min(this.top.children.length,a+5);a<c;a++){let d=this.top.children[a];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,r,o,s){let l=this.top.children[o];return l.dirty==Yt&&l.dom==l.contentDOM&&(l.dirty=sr),l.update(e,t,r,s)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==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=t}}updateNextNode(e,t,r,o,s,l){for(let a=this.index;a<this.top.children.length;a++){let c=this.top.children[a];if(c instanceof Ln){let d=this.preMatch.matched.get(c);if(d!=null&&d!=s)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Yt&&as(t,c.outerDeco));if(!p&&c.update(e,t,r,o))return this.destroyBetween(this.index,a),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,t,r,o,l)))return this.destroyBetween(this.index,a),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=sr,f.updateChildren(o,l+1),f.dirty=Vt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,o,s,l){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!as(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Ln.create(this.top,t,r,o,s,l);if(a.contentDOM){a.children=e.children,e.children=[];for(let c of a.children)c.parent=a}return e.destroy(),a}addNode(e,t,r,o,s){let l=Ln.create(this.top,e,t,r,o,s);l.contentDOM&&l.updateChildren(o,s+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,t,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 Jd(this.top,e,t,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof lr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof is)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((ut||lt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Xd(this.top,[],r,null);t!=this.top?t.children.push(o):t.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 L0(n,e){let t=e,r=t.children.length,o=n.childCount,s=new Map,l=[];e:for(;o>0;){let a;for(;;)if(r){let d=t.children[r-1];if(d instanceof lr)t=d,r=d.children.length;else{a=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=a.node;if(c){if(c!=n.child(o-1))break;--o,s.set(a,o),l.push(a)}}return{index:o,matched:s,matches:l.reverse()}}function O0(n,e){return n.type.side-e.type.side}function I0(n,e,t,r){let o=e.locals(n),s=0;if(o.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,o,e.forChild(s,u),d),s+=u.nodeSize}return}let l=0,a=[],c=null;for(let d=0;;){let u,f;for(;l<o.length&&o[l].to==s;){let y=o[l++];y.widget&&(u?(f||(f=[u])).push(y):u=y)}if(u)if(f){f.sort(O0);for(let y=0;y<f.length;y++)t(f[y],d,!!c)}else t(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<n.childCount)h=d,p=n.child(d++);else break;for(let y=0;y<a.length;y++)a[y].to<=s&&a.splice(y--,1);for(;l<o.length&&o[l].from<=s&&o[l].to>s;)a.push(o[l++]);let m=s+p.nodeSize;if(p.isText){let y=m;l<o.length&&o[l].from<y&&(y=o[l].from);for(let b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<m&&(c=p.cut(y-s),p=p.cut(0,y-s),m=y,h=-1)}else for(;l<o.length&&o[l].to<m;)l++;let g=p.isInline&&!p.isLeaf?a.filter(y=>!y.inline):a.slice();r(p,g,e.forChild(s,p),h),s=m}}function D0(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function R0(n,e,t,r){for(let o=0,s=0;o<n.childCount&&s<=r;){let l=n.child(o++),a=s;if(s+=l.nodeSize,!l.isText)continue;let c=l.text;for(;o<n.childCount;){let d=n.child(o++);if(s+=d.nodeSize,!d.isText)break;c+=d.text}if(s>=t){if(s>=r&&c.slice(r-e.length-a,r-a)==e)return r-e.length;let d=a<r?c.lastIndexOf(e,r-a-1):-1;if(d>=0&&d+e.length+a>=t)return a+d;if(t==r&&c.length>=r+e.length-a&&c.slice(r-a,r-a+e.length)==e)return r}}return-1}function pi(n,e,t,r,o){let s=[];for(let l=0,a=0;l<n.length;l++){let c=n[l],d=a,u=a+=c.size;d>=t||u<=e?s.push(c):(d<e&&s.push(c.slice(0,e-d,r)),o&&(s.push(o),o=void 0),u>t&&s.push(c.slice(t-d,c.size,r)))}return s}function hi(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let o=n.docView.nearestDesc(t.focusNode),s=o&&o.size==0,l=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(l<0)return null;let a=r.resolve(l),c,d;if(ls(t)){for(c=l;o&&!o.node;)o=o.parent;let f=o.node;if(o&&f.isAtom&&oe.isSelectable(f)&&o.parent&&!(f.isInline&&c0(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;d=new oe(l==p?a:r.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=l,p=l;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,l]=p==n.state.selection.anchor?[p,f]:[f,p],a=r.resolve(l)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let f=e=="pointer"||n.state.selection.head<a.pos&&!s?1:-1;d=gi(n,u,a,f)}return d}function nu(n){return n.editable?n.hasFocus():cu(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function mn(n,e=!1){let t=n.state.selection;if(lu(n,t),!!nu(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&lt){let r=n.domSelectionRange(),o=n.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&rr(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)P0(n);else{let{anchor:r,head:o}=t,s,l;ru&&!(t instanceof se)&&(t.$from.parent.inlineContent||(s=ou(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(l=ou(n,t.to))),n.docView.setSelection(r,o,n,e),ru&&(s&&su(s),l&&su(l)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&F0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ru=ut||lt&&Dd<63;function ou(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),o=r<t.childNodes.length?t.childNodes[r]:null,s=r?t.childNodes[r-1]:null;if(ut&&o&&o.contentEditable=="false")return mi(o);if((!o||o.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(o)return mi(o);if(s)return mi(s)}}function mi(n){return n.contentEditable="true",ut&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function su(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function F0(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,o=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=o)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!nu(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function P0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,tt(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&bt&&Bn<=11&&(t.disabled=!0,t.disabled=!1)}function lu(n,e){if(e instanceof oe){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(iu(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else iu(n)}function iu(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function gi(n,e,t,r){return n.someProp("createSelectionBetween",o=>o(n,e,t))||se.between(e,t,r)}function au(n){return n.editable&&!n.hasFocus()?!1:cu(n)}function cu(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function $0(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return rr(e.node,e.offset,t.anchorNode,t.anchorOffset)}function yi(n,e){let{$anchor:t,$head:r}=n.selection,o=e>0?t.max(r):t.min(r),s=o.parent.inlineContent?o.depth?n.doc.resolve(e>0?o.after():o.before()):null:o;return s&&le.findFrom(s,e)}function On(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function du(n,e,t){let r=n.state.selection;if(r instanceof se)if(t.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 l=n.state.doc.resolve(o.pos+s.nodeSize*(e<0?-1:1));return On(n,new se(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=yi(n.state,e);return o&&o instanceof oe?On(n,o):!1}else if(!(Bt&&t.indexOf("m")>-1)){let o=r.$head,s=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,l;if(!s||s.isText)return!1;let a=e<0?o.pos-s.nodeSize:o.pos;return s.isAtom||(l=n.docView.descAt(a))&&!l.contentDOM?oe.isSelectable(s)?On(n,new oe(e<0?n.state.doc.resolve(o.pos-s.nodeSize):o)):ro?On(n,new se(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof oe&&r.node.isInline)return On(n,new se(e>0?r.$to:r.$from));{let o=yi(n.state,e);return o?On(n,o):!1}}}function cs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function io(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Br(n,e){return e<0?z0(n):H0(n)}function z0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,s,l=!1;for(At&&t.nodeType==1&&r<cs(t)&&io(t.childNodes[r],-1)&&(l=!0);;)if(r>0){if(t.nodeType!=1)break;{let a=t.childNodes[r-1];if(io(a,-1))o=t,s=--r;else if(a.nodeType==3)t=a,r=t.nodeValue.length;else break}}else{if(uu(t))break;{let a=t.previousSibling;for(;a&&io(a,-1);)o=t.parentNode,s=tt(a),a=a.previousSibling;if(a)t=a,r=cs(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}l?bi(n,t,r):o&&bi(n,o,s)}function H0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o=cs(t),s,l;for(;;)if(r<o){if(t.nodeType!=1)break;let a=t.childNodes[r];if(io(a,1))s=t,l=++r;else break}else{if(uu(t))break;{let a=t.nextSibling;for(;a&&io(a,1);)s=a.parentNode,l=tt(a)+1,a=a.nextSibling;if(a)t=a,r=0,o=cs(t);else{if(t=t.parentNode,t==n.dom)break;r=o=0}}}s&&bi(n,s,l)}function uu(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function j0(n,e){for(;n&&e==n.childNodes.length&&!no(n);)e=tt(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function U0(n,e){for(;n&&!e&&!no(n);)e=tt(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function bi(n,e,t){if(e.nodeType!=3){let s,l;(l=j0(e,t))?(e=l,t=0):(s=U0(e,t))&&(e=s,t=s.nodeValue.length)}let r=n.domSelection();if(!r)return;if(ls(r)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:o}=n;setTimeout(()=>{n.state==o&&mn(n)},50)}function fu(n,e){let t=n.state.doc.resolve(e);if(!(lt||f0)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left<o.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>o.top&&l<o.bottom&&Math.abs(s.left-o.left)>1)return s.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function pu(n,e,t){let r=n.state.selection;if(r instanceof se&&!r.empty||t.indexOf("s")>-1||Bt&&t.indexOf("m")>-1)return!1;let{$from:o,$to:s}=r;if(!o.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let l=yi(n.state,e);if(l&&l instanceof oe)return On(n,l)}if(!o.parent.inlineContent){let l=e<0?o:s,a=r instanceof vt?le.near(l,e):le.findFrom(l,e);return a?On(n,a):!1}return!1}function hu(n,e){if(!(n.state.selection instanceof se))return!0;let{$head:t,$anchor:r,empty:o}=n.state.selection;if(!t.sameParent(r))return!0;if(!o)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let l=n.state.tr;return e<0?l.delete(t.pos-s.nodeSize,t.pos):l.delete(t.pos,t.pos+s.nodeSize),n.dispatch(l),!0}return!1}function mu(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function W0(n){if(!ut||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;mu(n,r,"true"),setTimeout(()=>mu(n,r,"false"),20)}return!1}function K0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function q0(n,e){let t=e.keyCode,r=K0(e);if(t==8||Bt&&t==72&&r=="c")return hu(n,-1)||Br(n,-1);if(t==46&&!e.shiftKey||Bt&&t==68&&r=="c")return hu(n,1)||Br(n,1);if(t==13||t==27)return!0;if(t==37||Bt&&t==66&&r=="c"){let o=t==37?fu(n,n.state.selection.from)=="ltr"?-1:1:-1;return du(n,o,r)||Br(n,o)}else if(t==39||Bt&&t==70&&r=="c"){let o=t==39?fu(n,n.state.selection.from)=="ltr"?1:-1:1;return du(n,o,r)||Br(n,o)}else{if(t==38||Bt&&t==80&&r=="c")return pu(n,-1,r)||Br(n,-1);if(t==40||Bt&&t==78&&r=="c")return W0(n)||pu(n,1,r)||Br(n,1);if(r==(Bt?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function ki(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:o,openEnd:s}=e;for(;o>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let l=n.someProp("clipboardSerializer")||tr.fromSchema(n.state.schema),a=Cu(),c=a.createElement("div");c.appendChild(l.serializeFragment(r,{document:a}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=wu[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=a.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${o} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:c,text:p,slice:e}}function gu(n,e,t,r,o){let s=o.parent.type.spec.code,l,a;if(!t&&!e)return null;let c=!!e&&(r||s||!t);if(c){if(n.someProp("transformPastedText",p=>{e=p(e,s||r,n)}),s)return a=new J(F.from(n.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),n.someProp("transformPasted",p=>{a=p(a,n,!0)}),a;let f=n.someProp("clipboardTextParser",p=>p(e,o,r,n));if(f)a=f;else{let p=o.marks(),{schema:h}=n.state,m=tr.fromSchema(h);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=l.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),l=X0(t),ro&&Z0(l);let d=l&&l.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=l.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;l=p}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||wr.fromSchema(n.state.schema)).parseSlice(l,{preserveWhitespace:!!(c||u),context:o,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!G0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Q0(xu(a,+u[1],+u[2]),u[4]);else if(a=J.maxOpen(J0(a.content,o),!0),a.openStart||a.openEnd){let f=0,p=0;for(let h=a.content.firstChild;f<a.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=a.content.lastChild;p<a.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);a=xu(a,f,p)}return n.someProp("transformPasted",f=>{a=f(a,n,c)}),a}const G0=/^(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 J0(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),s,l=[];if(n.forEach(a=>{if(!l)return;let c=o.findWrapping(a.type),d;if(!c)return l=null;if(d=l.length&&s.length&&bu(c,s,a,l[l.length-1],0))l[l.length-1]=d;else{l.length&&(l[l.length-1]=ku(l[l.length-1],s.length));let u=yu(a,c);l.push(u),o=o.matchType(u.type),s=c}}),l)return F.from(l)}return n}function yu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,F.from(n));return n}function bu(n,e,t,r,o){if(o<n.length&&o<e.length&&n[o]==e[o]){let s=bu(n,e,t,r.lastChild,o+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(o==n.length-1?t.type:n[o+1]))return r.copy(r.content.append(F.from(yu(t,n,o+1))))}}function ku(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,ku(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(F.empty,!0);return n.copy(t.append(r))}function xi(n,e,t,r,o,s){let l=e<0?n.firstChild:n.lastChild,a=l.content;return n.childCount>1&&(s=0),o<r-1&&(a=xi(a,e,t,r,o+1,s)),o>=t&&(a=e<0?l.contentMatchAt(0).fillBefore(a,s<=o).append(a):a.append(l.contentMatchAt(l.childCount).fillBefore(F.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,l.copy(a))}function xu(n,e,t){return e<n.openStart&&(n=new J(xi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new J(xi(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const wu={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 Eu=null;function Cu(){return Eu||(Eu=document.implementation.createHTMLDocument("title"))}let wi=null;function Y0(n){let e=window.trustedTypes;return e?(wi||(wi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),wi.createHTML(n)):n}function X0(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Cu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),o;if((o=r&&wu[r[1].toLowerCase()])&&(n=o.map(s=>"<"+s+">").join("")+n+o.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=Y0(n),o)for(let s=0;s<o.length;s++)t=t.querySelector(o[s])||t;return t}function Z0(n){let e=n.querySelectorAll(lt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Q0(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:o,openStart:s,openEnd:l}=n;for(let a=r.length-2;a>=0;a-=2){let c=t.nodes[r[a]];if(!c||c.hasRequiredAttrs())break;o=F.from(c.create(r[a+1],o)),s++,l++}return new J(o,s,l)}const ft={},pt={},ey={touchstart:!0,touchmove:!0};class ty{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function ny(n){for(let e in ft){let t=ft[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{oy(n,r)&&!Ci(n,r)&&(n.editable||!(r.type in pt))&&t(n,r)},ey[e]?{passive:!0}:void 0)}ut&&n.dom.addEventListener("input",()=>null),Ei(n)}function In(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function ry(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ei(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ci(n,r))})}function Ci(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function oy(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function sy(n,e){!Ci(n,e)&&ft[e.type]&&(n.editable||!(e.type in pt))&&ft[e.type](n,e)}pt.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!_u(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(pn&&lt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Tr&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",o=>o(n,or(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||q0(n,t)?t.preventDefault():In(n,"key")},pt.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},pt.keypress=(n,e)=>{let t=e;if(_u(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||Bt&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof se)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(t.charCode),s=()=>n.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!n.someProp("handleTextInput",l=>l(n,r.$from.pos,r.$to.pos,o,s))&&n.dispatch(s()),t.preventDefault()}};function ds(n){return{left:n.clientX,top:n.clientY}}function ly(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function vi(n,e,t,r,o){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let l=s.depth+1;l>0;l--)if(n.someProp(e,a=>l>s.depth?a(n,t,s.nodeAfter,s.before(l),o,!0):a(n,t,s.node(l),s.before(l),o,!1)))return!0;return!1}function Vr(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function iy(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&oe.isSelectable(r)?(Vr(n,new oe(t)),!0):!1}function ay(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof oe&&(r=t.node);let s=n.state.doc.resolve(e);for(let l=s.depth+1;l>0;l--){let a=l>s.depth?s.nodeAfter:s.node(l);if(oe.isSelectable(a)){r&&t.$from.depth>0&&l>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?o=s.before(t.$from.depth):o=s.before(l);break}}return o!=null?(Vr(n,oe.create(n.state.doc,o)),!0):!1}function cy(n,e,t,r,o){return vi(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(o?ay(n,t):iy(n,t))}function dy(n,e,t,r){return vi(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function uy(n,e,t,r){return vi(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||fy(n,t,r)}function fy(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Vr(n,se.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let s=o.depth+1;s>0;s--){let l=s>o.depth?o.nodeAfter:o.node(s),a=o.before(s);if(l.inlineContent)Vr(n,se.create(r,a+1,a+1+l.content.size));else if(oe.isSelectable(l))Vr(n,oe.create(r,a));else continue;return!0}}function _i(n){return us(n)}const vu=Bt?"metaKey":"ctrlKey";ft.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=_i(n),o=Date.now(),s="singleClick";o-n.input.lastClick.time<500&&ly(t,n.input.lastClick)&&!t[vu]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:o,x:t.clientX,y:t.clientY,type:s,button:t.button};let l=n.posAtCoords(ds(t));l&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new py(n,l,t,!!r)):(s=="doubleClick"?dy:uy)(n,l.pos,l.inside,t)?t.preventDefault():In(n,"pointer"))};class py{constructor(e,t,r,o){this.view=e,this.pos=t,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[vu],this.allowDefault=r.shiftKey;let s,l;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),l=t.inside;else{let u=e.state.doc.resolve(t.pos);s=u.parent,l=u.depth?u.before():0}const a=o?null:r.target,c=a?e.docView.nearestDesc(a,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||d instanceof oe&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&At&&!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)),In(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(()=>mn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ds(e))),this.updateAllowDefault(e),this.allowDefault||!t?In(this.view,"pointer"):cy(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||ut&&this.mightDrag&&!this.mightDrag.node.isAtom||lt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Vr(this.view,le.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):In(this.view,"pointer")}move(e){this.updateAllowDefault(e),In(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)}}ft.touchstart=n=>{n.input.lastTouch=Date.now(),_i(n),In(n,"pointer")},ft.touchmove=n=>{n.input.lastTouch=Date.now(),In(n,"pointer")},ft.contextmenu=n=>_i(n);function _u(n,e){return n.composing?!0:ut&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const hy=pn?5e3:-1;pt.compositionstart=pt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof se&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),us(n,!0),n.markCursor=null;else if(us(n,!e.selection.empty),At&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let o=r.focusNode,s=r.focusOffset;o&&o.nodeType==1&&s!=0;){let l=s<0?o.lastChild:o.childNodes[s-1];if(!l)break;if(l.nodeType==3){let a=n.domSelection();a&&a.collapse(l,l.nodeValue.length);break}else o=l,s=-1}}n.input.composing=!0}Su(n,hy)},pt.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Su(n,20))};function Su(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>us(n),e))}function Nu(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=gy());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function my(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=i0(e.focusNode,e.focusOffset),r=a0(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let o=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!o||!o.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let l=t.pmViewDesc;if(!(!l||!l.isText(t.nodeValue)))return r}}return t||r}function gy(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function us(n,e=!1){if(!(pn&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Nu(n),e||n.docView&&n.docView.dirty){let t=hi(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function yy(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const ao=bt&&Bn<15||Tr&&p0<604;ft.copy=pt.cut=(n,e)=>{let t=e,r=n.state.selection,o=t.type=="cut";if(r.empty)return;let s=ao?null:t.clipboardData,l=r.content(),{dom:a,text:c}=ki(n,l);s?(t.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",c)):yy(n,a),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function by(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function ky(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?co(n,r.value,null,o,e):co(n,r.textContent,r.innerHTML,o,e)},50)}function co(n,e,t,r,o){let s=gu(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,o,s||J.empty)))return!0;if(!s)return!1;let l=by(s),a=l?n.state.tr.replaceSelectionWith(l,r):n.state.tr.replaceSelection(s);return n.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Mu(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}pt.paste=(n,e)=>{let t=e;if(n.composing&&!pn)return;let r=ao?null:t.clipboardData,o=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&co(n,Mu(r),r.getData("text/html"),o,t)?t.preventDefault():ky(n,t)};class Tu{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const xy=Bt?"altKey":"ctrlKey";function Au(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[xy]}ft.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let o=n.state.selection,s=o.empty?null:n.posAtCoords(ds(t)),l;if(!(s&&s.pos>=o.from&&s.pos<=(o instanceof oe?o.to-1:o.to))){if(r&&r.mightDrag)l=oe.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(l=oe.create(n.state.doc,f.posBefore))}}let a=(l||n.state.selection).content(),{dom:c,text:d,slice:u}=ki(n,a);(!t.dataTransfer.files.length||!lt||Dd>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(ao?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",ao||t.dataTransfer.setData("text/plain",d),n.dragging=new Tu(u,Au(n,t),l)},ft.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},pt.dragover=pt.dragenter=(n,e)=>e.preventDefault(),pt.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let o=n.posAtCoords(ds(t));if(!o)return;let s=n.state.doc.resolve(o.pos),l=r&&r.slice;l?n.someProp("transformPasted",m=>{l=m(l,n,!1)}):l=gu(n,Mu(t.dataTransfer),ao?null:t.dataTransfer.getData("text/html"),!1,s);let a=!!(r&&Au(n,t));if(n.someProp("handleDrop",m=>m(n,t,l||J.empty,a))){t.preventDefault();return}if(!l)return;t.preventDefault();let c=l?ld(n.state.doc,s.pos,l):s.pos;c==null&&(c=s.pos);let d=n.state.tr;if(a){let{node:m}=r;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),f=l.openStart==0&&l.openEnd==0&&l.content.childCount==1,p=d.doc;if(f?d.replaceRangeWith(u,u,l.content.firstChild):d.replaceRange(u,u,l),d.doc.eq(p))return;let h=d.doc.resolve(u);if(f&&oe.isSelectable(l.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(l.content.firstChild))d.setSelection(new oe(h));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),d.setSelection(gi(n,h,d.doc.resolve(m)))}n.focus(),n.dispatch(d.setMeta("uiEvent","drop"))},ft.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&mn(n)},20))},ft.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},ft.beforeinput=(n,e)=>{if(lt&&pn&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,or(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in pt)ft[n]=pt[n];function uo(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class fs{constructor(e,t){this.toDOM=e,this.spec=t||ar,this.side=this.spec.side||0}map(e,t,r,o){let{pos:s,deleted:l}=e.mapResult(t.from+o,this.side<0?-1:1);return l?null:new Ye(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof fs&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&uo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Dn{constructor(e,t){this.attrs=e,this.spec=t||ar}map(e,t,r,o){let s=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-r,l=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-r;return s>=l?null:new Ye(s,l,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Dn&&uo(this.attrs,e.attrs)&&uo(this.spec,e.spec)}static is(e){return e.type instanceof Dn}destroy(){}}class Si{constructor(e,t){this.attrs=e,this.spec=t||ar}map(e,t,r,o){let s=e.mapResult(t.from+o,1);if(s.deleted)return null;let l=e.mapResult(t.to+o,-1);return l.deleted||l.pos<=s.pos?null:new Ye(s.pos-r,l.pos-r,this)}valid(e,t){let{index:r,offset:o}=e.content.findIndex(t.from),s;return o==t.from&&!(s=e.child(r)).isText&&o+s.nodeSize==t.to}eq(e){return this==e||e instanceof Si&&uo(this.attrs,e.attrs)&&uo(this.spec,e.spec)}destroy(){}}class Ye{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ye(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Ye(e,e,new fs(t,r))}static inline(e,t,r,o){return new Ye(e,t,new Dn(r,o))}static node(e,t,r,o){return new Ye(e,t,new Si(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Dn}get widget(){return this.type instanceof fs}}const Lr=[],ar={};class Me{constructor(e,t){this.local=e.length?e:Lr,this.children=t.length?t:Lr}static create(e,t){return t.length?ps(t,e,0,ar):it}find(e,t,r){let o=[];return this.findInner(e??0,t??1e9,o,0,r),o}findInner(e,t,r,o,s){for(let l=0;l<this.local.length;l++){let a=this.local[l];a.from<=t&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<t&&this.children[l+1]>e){let a=this.children[l]+1;this.children[l+2].findInner(e-a,t-a,r,o+a,s)}}map(e,t,r){return this==it||e.maps.length==0?this:this.mapInner(e,t,0,0,r||ar)}mapInner(e,t,r,o,s){let l;for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(t,c)?(l||(l=[])).push(c):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?wy(this.children,l||[],e,t,r,o,s):l?new Me(l.sort(cr),Lr):it}add(e,t){return t.length?this==it?Me.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let o,s=0;e.forEach((a,c)=>{let d=c+r,u;if(u=Vu(t,a,d)){for(o||(o=this.children.slice());s<o.length&&o[s]<c;)s+=3;o[s]==c?o[s+2]=o[s+2].addInner(a,u,d+1):o.splice(s,0,c,c+a.nodeSize,ps(u,a,d+1,ar)),s+=3}});let l=Bu(s?Lu(t):t,-r);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||l.splice(a--,1);return new Me(l.length?this.local.concat(l).sort(cr):this.local,o||this.children)}remove(e){return e.length==0||this==it?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,o=this.local;for(let s=0;s<r.length;s+=3){let l,a=r[s]+t,c=r[s+1]+t;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>a&&f.to<c&&(e[u]=null,(l||(l=[])).push(f));if(!l)continue;r==this.children&&(r=this.children.slice());let d=r[s+2].removeInner(l,a+1);d!=it?r[s+2]=d:(r.splice(s,3),s-=3)}if(o.length){for(let s=0,l;s<e.length;s++)if(l=e[s])for(let a=0;a<o.length;a++)o[a].eq(l,t)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Me(o,r):it}forChild(e,t){if(this==it)return this;if(t.isLeaf)return Me.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,l=s+t.content.size;for(let a=0;a<this.local.length;a++){let c=this.local[a];if(c.from<l&&c.to>s&&c.type instanceof Dn){let d=Math.max(s,c.from)-s,u=Math.min(l,c.to)-s;d<u&&(o||(o=[])).push(c.copy(d,u))}}if(o){let a=new Me(o.sort(cr),Lr);return r?new Rn([a,r]):a}return r||it}eq(e){if(this==e)return!0;if(!(e instanceof Me)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ni(this.localsInner(e))}localsInner(e){if(this==it)return Lr;if(e.inlineContent||!this.local.some(Dn.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Dn||t.push(this.local[r]);return t}forEachSet(e){e(this)}}Me.empty=new Me([],[]),Me.removeOverlap=Ni;const it=Me.empty;class Rn{constructor(e){this.members=e}map(e,t){const r=this.members.map(o=>o.map(e,t,ar));return Rn.from(r)}forChild(e,t){if(t.isLeaf)return Me.empty;let r=[];for(let o=0;o<this.members.length;o++){let s=this.members[o].forChild(e,t);s!=it&&(s instanceof Rn?r=r.concat(s.members):r.push(s))}return Rn.from(r)}eq(e){if(!(e instanceof Rn)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let o=0;o<this.members.length;o++){let s=this.members[o].localsInner(e);if(s.length)if(!t)t=s;else{r&&(t=t.slice(),r=!1);for(let l=0;l<s.length;l++)t.push(s[l])}}return t?Ni(r?t:t.sort(cr)):Lr}static from(e){switch(e.length){case 0:return it;case 1:return e[0];default:return new Rn(e.every(t=>t instanceof Me)?e:e.reduce((t,r)=>t.concat(r instanceof Me?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function wy(n,e,t,r,o,s,l){let a=n.slice();for(let d=0,u=s;d<t.maps.length;d++){let f=0;t.maps[d].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<a.length;b+=3){let k=a[b+1];if(k<0||p>k+u-f)continue;let E=a[b]+u-f;h>=E?a[b+1]=p<=E?-2:-1:p>=u&&y&&(a[b]+=y,a[b+1]+=y)}f+=y}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<a.length;d+=3)if(a[d+1]<0){if(a[d+1]==-2){c=!0,a[d+1]=-1;continue}let u=t.map(n[d]+s),f=u-o;if(f<0||f>=r.content.size){c=!0;continue}let p=t.map(n[d+1]+s,-1),h=p-o,{index:m,offset:g}=r.content.findIndex(f),y=r.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=a[d+2].mapInner(t,y,u+1,n[d]+s+1,l);b!=it?(a[d]=f,a[d+1]=h,a[d+2]=b):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=Ey(a,n,e,t,o,s,l),u=ps(d,r,0,l);e=u.local;for(let f=0;f<a.length;f+=3)a[f+1]<0&&(a.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<a.length&&a[p]<h;)p+=3;a.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new Me(e.sort(cr),a)}function Bu(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let o=n[r];t.push(new Ye(o.from+e,o.to+e,o.type))}return t}function Ey(n,e,t,r,o,s,l){function a(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(r,o,d);f?t.push(f):l.onRemove&&l.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)a(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&a(n[c+2],e[c]+s+1);return t}function Vu(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,o=null;for(let s=0,l;s<n.length;s++)(l=n[s])&&l.from>t&&l.to<r&&((o||(o=[])).push(l),n[s]=null);return o}function Lu(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function ps(n,e,t,r){let o=[],s=!1;e.forEach((a,c)=>{let d=Vu(n,a,c+t);if(d){s=!0;let u=ps(d,a,t+c+1,r);u!=it&&o.push(c,c+a.nodeSize,u)}});let l=Bu(s?Lu(n):n,-t).sort(cr);for(let a=0;a<l.length;a++)l[a].type.valid(e,l[a])||(r.onRemove&&r.onRemove(l[a].spec),l.splice(a--,1));return l.length||o.length?new Me(l,o):it}function cr(n,e){return n.from-e.from||n.to-e.to}function Ni(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let o=t+1;o<e.length;o++){let s=e[o];if(s.from==r.from){s.to!=r.to&&(e==n&&(e=n.slice()),e[o]=s.copy(s.from,r.to),Ou(e,o+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,s.from),Ou(e,o,r.copy(s.from,r.to)));break}}}return e}function Ou(n,e,t){for(;e<n.length&&cr(t,n[e])>0;)e++;n.splice(e,0,t)}function Mi(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=it&&e.push(r)}),n.cursorWrapper&&e.push(Me.create(n.state.doc,[n.cursorWrapper.deco])),Rn.from(e)}const Cy={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},vy=bt&&Bn<=11;class _y{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 Sy{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _y,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]);bt&&Bn<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),vy&&(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,Cy)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(au(this.view)){if(this.suppressingSelectionUpdates)return mn(this.view);if(bt&&Bn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&rr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Mr(s))t.add(s);for(let s=e.anchorNode;s;s=Mr(s))if(t.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 t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&au(e)&&!this.ignoreSelectionChange(r),s=-1,l=-1,a=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let f=this.registerMutation(t[u],c);f&&(s=s<0?f.from:Math.min(f.from,s),l=l<0?f.to:Math.max(f.to,l),f.typeOver&&(a=!0))}if(At&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||Ty(e,f)!=h)&&p.remove()}}}let d=null;s<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ls(r)&&(d=hi(e))&&d.eq(le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,mn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||o)&&(s>-1&&(e.docView.markDirty(s,l),Ny(e)),this.handleDOMChange(s,l,a,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||mn(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.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 u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}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(bt&&Bn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(o=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p)}let l=o&&o.parentNode==e.target?tt(o)+1:0,a=r.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?tt(s):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:a,to:d}}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 Iu=new WeakMap,Du=!1;function Ny(n){if(!Iu.has(n)&&(Iu.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=At,Du)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."),Du=!0}}function Ru(n,e){let t=e.startContainer,r=e.startOffset,o=e.endContainer,s=e.endOffset,l=n.domAtPos(n.state.selection.anchor);return rr(l.node,l.offset,o,s)&&([t,r,o,s]=[o,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:o,focusOffset:s}}function My(n,e){if(e.getComposedRanges){let o=e.getComposedRanges(n.root)[0];if(o)return Ru(n,o)}let t;function r(o){o.preventDefault(),o.stopImmediatePropagation(),t=o.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Ru(n,t):null}function Ty(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Ay(n,e,t){let{node:r,fromOffset:o,toOffset:s,from:l,to:a}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ls(c)||d.push({node:c.focusNode,offset:c.focusOffset})),lt&&n.input.lastKeyCode===8)for(let y=s;y>o;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){s=y;break}if(!k||k.size)break}let f=n.state.doc,p=n.someProp("domParser")||wr.fromSchema(n.state.schema),h=f.resolve(l),m=null,g=p.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:o,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:By,context:h});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+l,head:b+l}}return{doc:g,sel:m,from:l,to:a}}function By(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(ut&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||ut&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Vy=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Ly(n,e,t,r,o){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let w=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,T=hi(n,w);if(T&&!n.state.selection.eq(T)){if(lt&&pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",R=>R(n,or(13,"Enter"))))return;let D=n.state.tr.setSelection(T);w=="pointer"?D.setMeta("pointer",!0):w=="key"&&D.scrollIntoView(),s&&D.setMeta("composition",s),n.dispatch(D)}return}let l=n.state.doc.resolve(e),a=l.sharedDepth(t);e=l.before(a+1),t=n.state.doc.resolve(t).after(a+1);let c=n.state.selection,d=Ay(n,e,t),u=n.state.doc,f=u.slice(d.from,d.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=Dy(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Tr&&n.input.lastIOSEnter>Date.now()-225||pn)&&o.some(w=>w.nodeType==1&&!Vy.test(w.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",w=>w(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof se&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let w=Fu(n,n.state.doc,d.sel);if(w&&!w.eq(n.state.selection)){let T=n.state.tr.setSelection(w);s&&T.setMeta("composition",s),n.dispatch(T)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof se&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),bt&&Bn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),b=u.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((Tr&&n.input.lastIOSEnter>Date.now()-225&&(!k||o.some(w=>w.nodeName=="DIV"||w.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",w=>w(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&Iy(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",w=>w(n,or(8,"Backspace")))){pn&&lt&&n.domObserver.suppressSelectionUpdates();return}lt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),pn&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(w){return w(n,or(13,"Enter"))})},20));let E=m.start,x=m.endA,C=w=>{let T=w||n.state.tr.replace(E,x,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let D=Fu(n,T.doc,d.sel);D&&!(lt&&n.composing&&D.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(D.head==E||D.head==T.mapping.map(x)-1)||bt&&D.empty&&D.head==E)&&T.setSelection(D)}return s&&T.setMeta("composition",s),T.scrollIntoView()},_;if(k){if(g.pos==y.pos){bt&&Bn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>mn(n),20));let w=C(n.state.tr.delete(E,x)),T=u.resolve(m.start).marksAcross(u.resolve(m.endA));T&&w.ensureMarks(T),n.dispatch(w)}else if(m.endA==m.endB&&(_=Oy(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let w=C(n.state.tr);_.type=="add"?w.addMark(E,x,_.mark):w.removeMark(E,x,_.mark),n.dispatch(w)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let w=g.parent.textBetween(g.parentOffset,y.parentOffset),T=()=>C(n.state.tr.insertText(w,E,x));n.someProp("handleTextInput",D=>D(n,E,x,w,T))||n.dispatch(T())}}else n.dispatch(C())}function Fu(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:gi(n,e.resolve(t.anchor),e.resolve(t.head))}function Oy(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,o=t,s=r,l,a,c;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<t.length;u++)s=t[u].removeFromSet(s);if(o.length==1&&s.length==0)a=o[0],l="add",c=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&s.length==1)a=s[0],l="remove",c=u=>u.mark(a.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(F.from(d).eq(n))return{mark:a,type:l}}function Iy(n,e,t,r,o){if(t-e<=o.pos-r.pos||Ti(r,!0,!1)<o.pos)return!1;let s=n.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&t==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=n.resolve(Ti(s,!0,!0));return!l.parent.isTextblock||l.pos>t||Ti(l,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Ti(n,e,t){let r=n.depth,o=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,o++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,o++}return o}function Dy(n,e,t,r,o){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:l,b:a}=n.findDiffEnd(e,t+n.size,t+e.size);if(o=="end"){let c=Math.max(0,s-Math.min(l,a));r-=l+c-s}if(l<s&&n.size<e.size){let c=r<=s&&r>=l?s-r:0;s-=c,s&&s<e.size&&Pu(e.textBetween(s-1,s+1))&&(s+=c?1:-1),a=s+(a-l),l=s}else if(a<s){let c=r<=s&&r>=a?s-r:0;s-=c,s&&s<n.size&&Pu(n.textBetween(s-1,s+1))&&(s+=c?1:-1),l=s+(l-a),a=s}return{start:s,endA:l,endB:a}}function Pu(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class $u{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ty,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Wu),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=ju(this),Hu(this),this.nodeViews=Uu(this),this.docView=Yd(this.state.doc,zu(this),Mi(this),this.dom,this),this.domObserver=new Sy(this,(r,o,s,l)=>Ly(this,r,o,s,l)),this.domObserver.start(),ny(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ei(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Wu),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let o=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(Nu(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Uu(this);Fy(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&Ei(this),this.editable=ju(this),Hu(this);let c=Mi(this),d=zu(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(o.selection))&&(l=!0);let p=u=="preserve"&&l&&this.dom.style.overflowAnchor==null&&g0(this);if(l){this.domObserver.stop();let h=f&&(bt||lt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Ry(o.selection,e.selection);if(f){let m=lt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=my(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=Yd(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&$0(this))?mn(this,h):(lu(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),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&y0(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof oe){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Rd(this,t.getBoundingClientRect(),e)}else Rd(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){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-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==r.node&&(o=s)}this.dragging=new Tu(e.slice,e.move,o<0?void 0:oe.create(this.state.doc,o))}someProp(e,t){let r=this._props&&this._props[e],o;if(r!=null&&(o=t?t(r):r))return o;for(let l=0;l<this.directPlugins.length;l++){let a=this.directPlugins[l].props[e];if(a!=null&&(o=t?t(a):a))return o}let s=this.state.plugins;if(s)for(let l=0;l<s.length;l++){let a=s[l].props[e];if(a!=null&&(o=t?t(a):a))return o}}hasFocus(){if(bt){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&&b0(this.dom),mn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return C0(this,e)}coordsAtPos(e,t=1){return jd(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let o=this.docView.posFromDOM(e,t,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return M0(this,t||this.state,e)}pasteHTML(e,t){return co(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return co(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return ki(this,e)}destroy(){this.docView&&(ry(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Mi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,s0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return sy(this,e)}domSelectionRange(){let e=this.domSelection();return e?ut&&this.root.nodeType===11&&d0(this.dom.ownerDocument)==this.dom&&My(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}$u.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function zu(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ye.node(0,n.state.doc.content.size,e)]}function Hu(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ye.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ju(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ry(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Uu(n){let e=Object.create(null);function t(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Fy(n,e){let t=0,r=0;for(let o in n){if(n[o]!=e[o])return!0;t++}for(let o in e)r++;return t!=r}function Wu(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Fn={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:"'"},hs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Py=typeof navigator<"u"&&/Mac/.test(navigator.platform),$y=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),nt=0;nt<10;nt++)Fn[48+nt]=Fn[96+nt]=String(nt);for(var nt=1;nt<=24;nt++)Fn[nt+111]="F"+nt;for(var nt=65;nt<=90;nt++)Fn[nt]=String.fromCharCode(nt+32),hs[nt]=String.fromCharCode(nt);for(var Ai in Fn)hs.hasOwnProperty(Ai)||(hs[Ai]=Fn[Ai]);function zy(n){var e=Py&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||$y&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?hs:Fn)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Hy=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),jy=typeof navigator<"u"&&/Win/.test(navigator.platform);function Uy(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,o,s,l;for(let a=0;a<e.length-1;a++){let c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))Hy?l=!0:o=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),o&&(t="Ctrl-"+t),l&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function Wy(n){let e=Object.create(null);for(let t in n)e[Uy(t)]=n[t];return e}function Bi(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Ky(n){return new Oe({props:{handleKeyDown:Vi(n)}})}function Vi(n){let e=Wy(n);return function(t,r){let o=zy(r),s,l=e[Bi(o,r)];if(l&&l(t.state,t.dispatch,t))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[Bi(o,r,!1)];if(a&&a(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(jy&&r.ctrlKey&&r.altKey)&&(s=Fn[r.keyCode])&&s!=o){let a=e[Bi(s,r)];if(a&&a(t.state,t.dispatch,t))return!0}}return!1}}var qy=Object.defineProperty,Li=(n,e)=>{for(var t in e)qy(n,t,{get:e[t],enumerable:!0})};function ms(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:o}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=t.selection,o=t.doc,s=t.storedMarks,t}}}var gs=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:o}=t,s=this.buildProps(o);return Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...d)=>{const u=a(...d)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:o}=this,{view:s}=r,l=[],a=!!n,c=n||o.tr,d=()=>(!a&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(c,e),y=p(...m)(g);return l.push(y),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,o=n||t.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([a,c])=>[a,(...d)=>c(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:o}=this,{view:s}=r,l={tr:n,editor:r,view:s,state:ms({state:o,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...d)=>c(...d)(l)]))}};return l}},Ku={};Li(Ku,{blur:()=>Gy,clearContent:()=>Jy,clearNodes:()=>Yy,command:()=>Xy,createParagraphNear:()=>Zy,cut:()=>Qy,deleteCurrentNode:()=>eb,deleteNode:()=>tb,deleteRange:()=>nb,deleteSelection:()=>rb,enter:()=>ob,exitCode:()=>sb,extendMarkRange:()=>lb,first:()=>ib,focus:()=>cb,forEach:()=>db,insertContent:()=>ub,insertContentAt:()=>hb,joinBackward:()=>yb,joinDown:()=>gb,joinForward:()=>bb,joinItemBackward:()=>kb,joinItemForward:()=>xb,joinTextblockBackward:()=>wb,joinTextblockForward:()=>Eb,joinUp:()=>mb,keyboardShortcut:()=>vb,lift:()=>_b,liftEmptyBlock:()=>Sb,liftListItem:()=>Nb,newlineInCode:()=>Mb,resetAttributes:()=>Tb,scrollIntoView:()=>Ab,selectAll:()=>Bb,selectNodeBackward:()=>Vb,selectNodeForward:()=>Lb,selectParentNode:()=>Ob,selectTextblockEnd:()=>Ib,selectTextblockStart:()=>Db,setContent:()=>Rb,setMark:()=>e1,setMeta:()=>t1,setNode:()=>n1,setNodeSelection:()=>r1,setTextSelection:()=>o1,sinkListItem:()=>s1,splitBlock:()=>l1,splitListItem:()=>i1,toggleList:()=>a1,toggleMark:()=>c1,toggleNode:()=>d1,toggleWrap:()=>u1,undoInputRule:()=>f1,unsetAllMarks:()=>p1,unsetMark:()=>h1,updateAttributes:()=>m1,wrapIn:()=>g1,wrapInList:()=>y1});var Gy=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Jy=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Yy=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:o}=r;return t&&o.forEach(({$from:s,$to:l})=>{n.doc.nodesBetween(s.pos,l.pos,(a,c)=>{if(a.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+a.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Er(h);if(a.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},Xy=n=>e=>n(e),Zy=()=>({state:n,dispatch:e})=>Md(n,e),Qy=(n,e)=>({editor:t,tr:r})=>{const{state:o}=t,s=o.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const l=r.mapping.map(e);return r.insert(l,s.content),r.setSelection(new se(r.doc.resolve(Math.max(l-1,0)))),!0},eb=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const o=n.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===r.type){if(e){const a=o.before(s),c=o.after(s);n.delete(a,c).scrollIntoView()}return!0}return!1};function He(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var tb=n=>({tr:e,state:t,dispatch:r})=>{const o=He(n,t.schema),s=e.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===o){if(r){const c=s.before(l),d=s.after(l);e.delete(c,d).scrollIntoView()}return!0}return!1},nb=n=>({tr:e,dispatch:t})=>{const{from:r,to:o}=n;return t&&e.delete(r,o),!0},rb=()=>({state:n,dispatch:e})=>ti(n,e),ob=()=>({commands:n})=>n.keyboardShortcut("Enter"),sb=()=>({state:n,dispatch:e})=>Ug(n,e);function Oi(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ys(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>t.strict?e[o]===n[o]:Oi(e[o])?e[o].test(n[o]):e[o]===n[o]):!0}function qu(n,e,t={}){return n.find(r=>r.type===e&&ys(Object.fromEntries(Object.keys(t).map(o=>[o,r.attrs[o]])),t))}function Gu(n,e,t={}){return!!qu(n,e,t)}function Ii(n,e,t){var r;if(!n||!e)return;let o=n.parent.childAfter(n.parentOffset);if((!o.node||!o.node.marks.some(u=>u.type===e))&&(o=n.parent.childBefore(n.parentOffset)),!o.node||!o.node.marks.some(u=>u.type===e)||(t=t||((r=o.node.marks[0])==null?void 0:r.attrs),!qu([...o.node.marks],e,t)))return;let l=o.index,a=n.start()+o.offset,c=l+1,d=a+o.node.nodeSize;for(;l>0&&Gu([...n.parent.child(l-1).marks],e,t);)l-=1,a-=n.parent.child(l).nodeSize;for(;c<n.parent.childCount&&Gu([...n.parent.child(c).marks],e,t);)d+=n.parent.child(c).nodeSize,c+=1;return{from:a,to:d}}function gn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var lb=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const s=gn(n,r.schema),{doc:l,selection:a}=t,{$from:c,from:d,to:u}=a;if(o){const f=Ii(c,s,e);if(f&&f.from<=d&&f.to>=u){const p=se.create(l,f.from,f.to);t.setSelection(p)}}return!0},ib=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function Ju(n){return n instanceof se}function dr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Yu(n,e=null){if(!e)return null;const t=le.atStart(n),r=le.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const o=t.from,s=r.to;return e==="all"?se.create(n,dr(0,o,s),dr(n.content.size,o,s)):se.create(n,dr(e,o,s),dr(e,o,s))}function ab(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Di(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var cb=(n=null,e={})=>({editor:t,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Di()||ab())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!Ju(t.state.selection))return l(),!0;const a=Yu(o.doc,n)||t.state.selection,c=t.state.selection.eq(a);return s&&(c||o.setSelection(a),c&&o.storedMarks&&o.setStoredMarks(o.storedMarks),l()),!0},db=(n,e)=>t=>n.every((r,o)=>e(r,{...t,index:o})),ub=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),Xu=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Xu(r)}return n};function bs(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Xu(t)}function fo(n,e,t){if(n instanceof Sn||n instanceof F)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,o=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return F.fromArray(n.map(a=>e.nodeFromJSON(a)));const l=e.nodeFromJSON(n);return t.errorOnInvalidContent&&l.check(),l}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),fo("",e,t)}if(o){if(t.errorOnInvalidContent){let l=!1,a="";const c=new $c({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(l=!0,a=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?wr.fromSchema(c).parseSlice(bs(n),t.parseOptions):wr.fromSchema(c).parse(bs(n),t.parseOptions),t.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=wr.fromSchema(e);return t.slice?s.parseSlice(bs(n),t.parseOptions).content:s.parse(bs(n),t.parseOptions)}return fo("",e,t)}function fb(n,e,t){const r=n.steps.length-1;if(r<e)return;const o=n.steps[r];if(!(o instanceof Ge||o instanceof Je))return;const s=n.mapping.maps[r];let l=0;s.forEach((a,c,d,u)=>{l===0&&(l=u)}),n.setSelection(le.near(n.doc.resolve(l),t))}var pb=n=>!("type"in n),hb=(n,e,t)=>({tr:r,dispatch:o,editor:s})=>{var l;if(o){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let a;const c=y=>{s.emit("contentError",{editor:s,error:y,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{fo(e,s.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(y){c(y)}try{a=fo(e,s.schema,{parseOptions:d,errorOnInvalidContent:(l=t.errorOnInvalidContent)!=null?l:s.options.enableContentCheck})}catch(y){return c(y),!1}let{from:u,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((pb(a)?a:[a]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===f&&h){const{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof F){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=a;const y=r.doc.resolve(u),b=y.node(),k=y.parentOffset===0,E=b.isText||b.isTextblock,x=b.content.size>0;k&&E&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&fb(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},mb=()=>({state:n,dispatch:e})=>zg(n,e),gb=()=>({state:n,dispatch:e})=>Hg(n,e),yb=()=>({state:n,dispatch:e})=>wd(n,e),bb=()=>({state:n,dispatch:e})=>_d(n,e),kb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ts(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},xb=()=>({state:n,dispatch:e,tr:t})=>{try{const r=ts(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},wb=()=>({state:n,dispatch:e})=>Pg(n,e),Eb=()=>({state:n,dispatch:e})=>$g(n,e);function Zu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Cb(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,o,s,l;for(let a=0;a<e.length-1;a+=1){const c=e[a];if(/^(cmd|meta|m)$/i.test(c))l=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))o=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))Di()||Zu()?l=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),o&&(t=`Ctrl-${t}`),l&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var vb=n=>({editor:e,view:t,tr:r,dispatch:o})=>{const s=Cb(n).split(/-(?!$)/),l=s.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),a=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,a))});return c?.steps.forEach(d=>{const u=d.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function Pn(n,e,t={}){const{from:r,to:o,empty:s}=n.selection,l=e?He(e,n.schema):null,a=[];n.doc.nodesBetween(r,o,(f,p)=>{if(f.isText)return;const h=Math.max(r,p),m=Math.min(o,p+f.nodeSize);a.push({node:f,from:h,to:m})});const c=o-r,d=a.filter(f=>l?l.name===f.node.type.name:!0).filter(f=>ys(f.node.attrs,t,{strict:!1}));return s?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var _b=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?jg(t,r):!1},Sb=()=>({state:n,dispatch:e})=>Td(n,e),Nb=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return t0(r)(e,t)},Mb=()=>({state:n,dispatch:e})=>Nd(n,e);function ks(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Qu(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,o)=>(t.includes(o)||(r[o]=n[o]),r),{})}var Tb=(n,e)=>({tr:t,state:r,dispatch:o})=>{let s=null,l=null;const a=ks(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=He(n,r.schema)),a==="mark"&&(l=gn(n,r.schema)),o&&t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{s&&s===d.type&&t.setNodeMarkup(u,void 0,Qu(d.attrs,e)),l&&d.marks.length&&d.marks.forEach(f=>{l===f.type&&t.addMark(u,u+d.nodeSize,l.create(Qu(f.attrs,e)))})})}),!0):!1},Ab=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Bb=()=>({tr:n,dispatch:e})=>{if(e){const t=new vt(n.doc);n.setSelection(t)}return!0},Vb=()=>({state:n,dispatch:e})=>Cd(n,e),Lb=()=>({state:n,dispatch:e})=>Sd(n,e),Ob=()=>({state:n,dispatch:e})=>qg(n,e),Ib=()=>({state:n,dispatch:e})=>Yg(n,e),Db=()=>({state:n,dispatch:e})=>Jg(n,e);function Ri(n,e,t={},r={}){return fo(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Rb=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:l,commands:a})=>{const{doc:c}=s;if(r.preserveWhitespace!=="full"){const d=Ri(n,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});return l&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return l&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function ef(n,e){const t=gn(e,n.schema),{from:r,to:o,empty:s}=n.selection,l=[];s?(n.storedMarks&&l.push(...n.storedMarks),l.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,o,c=>{l.push(...c.marks)});const a=l.find(c=>c.type.name===t.name);return a?{...a.attrs}:{}}function tf(n,e){const t=new Yl(n);return e.forEach(r=>{r.steps.forEach(o=>{t.step(o)})}),t}function Fb(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Pb(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(o,s)=>{t(o)&&r.push({node:o,pos:s})}),r}function nf(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function xs(n){return e=>nf(e.$from,n)}function ne(n,e,t){return n.config[e]===void 0&&n.parent?ne(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ne(n.parent,e,t):null}):n.config[e]}function Fi(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=ne(e,"addExtensions",t);return r?[e,...Fi(r())]:e}).flat(10)}function Pi(n,e){const t=tr.fromSchema(e).serializeFragment(n),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(t),o.innerHTML}function rf(n){return typeof n=="function"}function ke(n,e=void 0,...t){return rf(n)?e?n.bind(e)(...t):n(...t):n}function $b(n={}){return Object.keys(n).length===0&&n.constructor===Object}function po(n){const e=n.filter(o=>o.type==="extension"),t=n.filter(o=>o.type==="node"),r=n.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function of(n){const e=[],{nodeExtensions:t,markExtensions:r}=po(n),o=[...t,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage,extensions:o},c=ne(l,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...s,...h}})})})})}),o.forEach(l=>{const a={name:l.name,options:l.options,storage:l.storage},c=ne(l,"addAttributes",a);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...s,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:l.name,name:u,attribute:p})})}),e}function we(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([o,s])=>{if(!r[o]){r[o]=s;return}if(o==="class"){const a=s?String(s).split(" "):[],c=r[o]?r[o].split(" "):[],d=a.filter(u=>!c.includes(u));r[o]=[...c,...d].join(" ")}else if(o==="style"){const a=s?s.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[o]?r[o].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),a.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),r[o]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else r[o]=s}),r},{})}function ws(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>we(t,r),{})}function zb(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function sf(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const o=e.reduce((s,l)=>{const a=l.attribute.parseHTML?l.attribute.parseHTML(t):zb(t.getAttribute(l.name));return a==null?s:{...s,[l.name]:a}},{});return{...r,...o}}}}function lf(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&$b(t)?!1:t!=null))}function Hb(n,e){var t;const r=of(n),{nodeExtensions:o,markExtensions:s}=po(n),l=(t=o.find(d=>ne(d,"topNode")))==null?void 0:t.name,a=Object.fromEntries(o.map(d=>{const u=r.filter(b=>b.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((b,k)=>{const E=ne(k,"extendNodeSchema",f);return{...b,...E?E(d):{}}},{}),h=lf({...p,content:ke(ne(d,"content",f)),marks:ke(ne(d,"marks",f)),group:ke(ne(d,"group",f)),inline:ke(ne(d,"inline",f)),atom:ke(ne(d,"atom",f)),selectable:ke(ne(d,"selectable",f)),draggable:ke(ne(d,"draggable",f)),code:ke(ne(d,"code",f)),whitespace:ke(ne(d,"whitespace",f)),linebreakReplacement:ke(ne(d,"linebreakReplacement",f)),defining:ke(ne(d,"defining",f)),isolating:ke(ne(d,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var k,E;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(E=b?.attribute)==null?void 0:E.validate}]}))}),m=ke(ne(d,"parseHTML",f));m&&(h.parseDOM=m.map(b=>sf(b,u)));const g=ne(d,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ws(b,u)}));const y=ne(d,"renderText",f);return y&&(h.toText=y),[d.name,h]})),c=Object.fromEntries(s.map(d=>{const u=r.filter(y=>y.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=n.reduce((y,b)=>{const k=ne(b,"extendMarkSchema",f);return{...y,...k?k(d):{}}},{}),h=lf({...p,inclusive:ke(ne(d,"inclusive",f)),excludes:ke(ne(d,"excludes",f)),group:ke(ne(d,"group",f)),spanning:ke(ne(d,"spanning",f)),code:ke(ne(d,"code",f)),attrs:Object.fromEntries(u.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=ke(ne(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>sf(y,u)));const g=ne(d,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:ws(y,u)})),[d.name,h]}));return new $c({topNode:l,nodes:a,marks:c})}function jb(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function $i(n){return n.sort((t,r)=>{const o=ne(t,"priority")||100,s=ne(r,"priority")||100;return o>s?-1:o<s?1:0})}function af(n){const e=$i(Fi(n)),t=jb(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function cf(n,e,t){const{from:r,to:o}=e,{blockSeparator:s=`
11
+
12
+ `,textSerializers:l={}}=t||{};let a="";return n.nodesBetween(r,o,(c,d,u,f)=>{var p;c.isBlock&&d>r&&(a+=s);const h=l?.[c.type.name];if(h)return u&&(a+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(a+=(p=c?.text)==null?void 0:p.slice(Math.max(r,d)-d,o-d))}),a}function Ub(n,e){const t={from:0,to:n.content.size};return cf(n,t,e)}function df(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Wb(n,e){const t=He(e,n.schema),{from:r,to:o}=n.selection,s=[];n.doc.nodesBetween(r,o,a=>{s.push(a)});const l=s.reverse().find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function uf(n,e){const t=ks(typeof e=="string"?e:e.name,n.schema);return t==="node"?Wb(n,e):t==="mark"?ef(n,e):{}}function Kb(n,e=JSON.stringify){const t={};return n.filter(r=>{const o=e(r);return Object.prototype.hasOwnProperty.call(t,o)?!1:t[o]=!0})}function qb(n){const e=Kb(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,l)=>l!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function ff(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((o,s)=>{const l=[];if(o.ranges.length)o.forEach((a,c)=>{l.push({from:a,to:c})});else{const{from:a,to:c}=t[s];if(a===void 0||c===void 0)return;l.push({from:a,to:c})}l.forEach(({from:a,to:c})=>{const d=e.slice(s).map(a,-1),u=e.slice(s).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);r.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),qb(r)}function zi(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(o=>{const s=t.resolve(n),l=Ii(s,o.type);l&&r.push({mark:o,...l})}):t.nodesBetween(n,e,(o,s)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(l=>({from:s,to:s+o.nodeSize,mark:l})))}),r}var Gb=(n,e,t,r=20)=>{const o=n.doc.resolve(t);let s=r,l=null;for(;s>0&&l===null;){const a=o.node(s);a?.type.name===e?l=a:s-=1}return[l,s]};function Hi(n,e){return e.nodes[n]||e.marks[n]||null}function Es(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const o=n.find(s=>s.type===e&&s.name===r);return o?o.attribute.keepOnSplit:!1}))}var Jb=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(o,s,l,a)=>{var c,d;const u=((d=(c=o.type.spec).toText)==null?void 0:d.call(c,{node:o,pos:s,parent:l,index:a}))||o.textContent||"%leaf%";t+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-s))}),t};function ji(n,e,t={}){const{empty:r,ranges:o}=n.selection,s=e?gn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>s?s.name===f.type.name:!0).find(f=>ys(f.attrs,t,{strict:!1}));let l=0;const a=[];if(o.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),k=Math.min(m,y+g.nodeSize),E=k-b;l+=E,a.push(...g.marks.map(x=>({mark:x,from:b,to:k})))})}),l===0)return!1;const c=a.filter(f=>s?s.name===f.mark.type.name:!0).filter(f=>ys(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=a.filter(f=>s?f.mark.type!==s&&f.mark.type.excludes(s):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=l}function Yb(n,e,t={}){if(!e)return Pn(n,null,t)||ji(n,null,t);const r=ks(e,n.schema);return r==="node"?Pn(n,e,t):r==="mark"?ji(n,e,t):!1}var Xb=(n,e)=>{const{$from:t,$to:r,$anchor:o}=n.selection;if(e){const s=xs(a=>a.type.name===e)(n.selection);if(!s)return!1;const l=n.doc.resolve(s.pos+1);return o.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},Zb=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function pf(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function hf(n,e){const{nodeExtensions:t}=po(e),r=t.find(l=>l.name===n);if(!r)return!1;const o={name:r.name,options:r.options,storage:r.storage},s=ke(ne(r,"group",o));return typeof s!="string"?!1:s.split(" ").includes("list")}function Cs(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let o=!0;return n.content.forEach(s=>{o!==!1&&(Cs(s,{ignoreWhitespace:t,checkChildren:e})||(o=!1))}),o}return!1}function mf(n){return n instanceof oe}function Qb(n,e,t){var r;const{selection:o}=e;let s=null;if(Ju(o)&&(s=o.$cursor),s){const a=(r=n.storedMarks)!=null?r:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(a)||!a.some(d=>d.type.excludes(t)))}const{ranges:l}=o;return l.some(({$from:a,$to:c})=>{let d=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(a.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=h&&m}return!d}),d})}var e1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{const{selection:s}=t,{empty:l,ranges:a}=s,c=gn(n,r.schema);if(o)if(l){const d=ef(r,c);t.addStoredMark(c.create({...d,...e}))}else a.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;r.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),g=Math.min(h+p.nodeSize,f);p.marks.find(b=>b.type===c)?p.marks.forEach(b=>{c===b.type&&t.addMark(m,g,c.create({...b.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Qb(r,t,c)},t1=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),n1=(n,e={})=>({state:t,dispatch:r,chain:o})=>{const s=He(n,t.schema);let l;return t.selection.$anchor.sameParent(t.selection.$head)&&(l=t.selection.$anchor.parent.attrs),s.isTextblock?o().command(({commands:a})=>Vd(s,{...l,...e})(t)?!0:a.clearNodes()).command(({state:a})=>Vd(s,{...l,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},r1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,o=dr(n,0,r.content.size),s=oe.create(r,o);e.setSelection(s)}return!0},o1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:o,to:s}=typeof n=="number"?{from:n,to:n}:n,l=se.atStart(r).from,a=se.atEnd(r).to,c=dr(o,l,a),d=dr(s,l,a),u=se.create(r,c,d);e.setSelection(u)}return!0},s1=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return o0(r)(e,t)};function gf(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(o=>e?.includes(o.type.name));n.tr.ensureMarks(r)}}var l1=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:o})=>{const{selection:s,doc:l}=e,{$from:a,$to:c}=s,d=o.extensionManager.attributes,u=Es(d,a.node().type.name,a.node().attrs);if(s instanceof oe&&s.node.isBlock)return!a.parentOffset||!un(l,a.pos)?!1:(r&&(n&&gf(t,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=a.depth===0?void 0:Fb(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=un(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!m&&un(e.doc,e.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),r){if(m&&(s instanceof se&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),p&&!f&&!a.parentOffset&&a.parent.type!==p)){const g=e.mapping.map(a.before()),y=e.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(a.before()),p)}n&&gf(t,o.extensionManager.splittableMarks),e.scrollIntoView()}return m},i1=(n,e={})=>({tr:t,state:r,dispatch:o,editor:s})=>{var l;const a=He(n,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==a)return!1;const p=s.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let b=F.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let T=c.depth-k;T>=c.depth-3;T-=1)b=F.from(c.node(T).copy(b));const E=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,x={...Es(p,c.node().type.name,c.node().attrs),...e},C=((l=a.contentMatch.defaultType)==null?void 0:l.createAndFill(x))||void 0;b=b.append(F.from(a.createAndFill(null,C)||void 0));const _=c.before(c.depth-(k-1));t.replace(_,c.after(-E),new J(b,4-k,0));let w=-1;t.doc.nodesBetween(_,t.doc.content.size,(T,D)=>{if(w>-1)return!1;T.isTextblock&&T.content.size===0&&(w=D+1)}),w>-1&&t.setSelection(se.near(t.doc.resolve(w))),t.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...Es(p,f.type.name,f.attrs),...e},g={...Es(p,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=h?[{type:a,attrs:m},{type:h,attrs:g}]:[{type:a,attrs:m}];if(!un(t.doc,c.pos,2))return!1;if(o){const{selection:b,storedMarks:k}=r,{splittableMarks:E}=s.extensionManager,x=k||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!x||!o)return!0;const C=x.filter(_=>E.includes(_.type.name));t.ensureMarks(C)}return!0},Ui=(n,e)=>{const t=xs(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===o?.type&&Tn(n.doc,t.pos)&&n.join(t.pos),!0},Wi=(n,e)=>{const t=xs(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const o=n.doc.nodeAt(r);return t.node.type===o?.type&&Tn(n.doc,r)&&n.join(r),!0},a1=(n,e,t,r={})=>({editor:o,tr:s,state:l,dispatch:a,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=o.extensionManager,h=He(n,l.schema),m=He(e,l.schema),{selection:g,storedMarks:y}=l,{$from:b,$to:k}=g,E=b.blockRange(k),x=y||g.$to.parentOffset&&g.$from.marks();if(!E)return!1;const C=xs(_=>hf(_.type.name,f))(g);if(E.depth>=1&&C&&E.depth-C.depth<=1){if(C.node.type===h)return d.liftListItem(m);if(hf(C.node.type.name,f)&&h.validContent(C.node.content)&&a)return c().command(()=>(s.setNodeMarkup(C.pos,h),!0)).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run()}return!t||!x||!a?c().command(()=>u().wrapInList(h,r)?!0:d.clearNodes()).wrapInList(h,r).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run():c().command(()=>{const _=u().wrapInList(h,r),w=x.filter(T=>p.includes(T.type.name));return s.ensureMarks(w),_?!0:d.clearNodes()}).wrapInList(h,r).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run()},c1=(n,e={},t={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=t,l=gn(n,r.schema);return ji(r,l,e)?o.unsetMark(l,{extendEmptyMarkRange:s}):o.setMark(l,e)},d1=(n,e,t={})=>({state:r,commands:o})=>{const s=He(n,r.schema),l=He(e,r.schema),a=Pn(r,s,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?o.setNode(l,c):o.setNode(s,{...c,...t})},u1=(n,e={})=>({state:t,commands:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?r.lift(o):r.wrapIn(o,e)},f1=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const o=t[r];let s;if(o.spec.isInputRules&&(s=o.getState(n))){if(e){const l=n.tr,a=s.transform;for(let c=a.steps.length-1;c>=0;c-=1)l.step(a.steps[c].invert(a.docs[c]));if(s.text){const c=l.doc.resolve(s.from).marks();l.replaceWith(s.from,s.to,n.schema.text(s.text,c))}else l.delete(s.from,s.to)}return!0}}return!1},p1=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:o}=t;return r||e&&o.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},h1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:l=!1}=e,{selection:a}=t,c=gn(n,r.schema),{$from:d,empty:u,ranges:f}=a;if(!o)return!0;if(u&&l){let{from:p,to:h}=a;const m=(s=d.marks().find(y=>y.type===c))==null?void 0:s.attrs,g=Ii(d,c,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,c)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,c)});return t.removeStoredMark(c),!0},m1=(n,e={})=>({tr:t,state:r,dispatch:o})=>{let s=null,l=null;const a=ks(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(s=He(n,r.schema)),a==="mark"&&(l=gn(n,r.schema)),o&&t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let f,p,h,m;t.selection.empty?r.doc.nodesBetween(d,u,(g,y)=>{s&&s===g.type&&(h=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,p=g)}):r.doc.nodesBetween(d,u,(g,y)=>{y<d&&s&&s===g.type&&(h=Math.max(y,d),m=Math.min(y+g.nodeSize,u),f=y,p=g),y>=d&&y<=u&&(s&&s===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),l&&g.marks.length&&g.marks.forEach(b=>{if(l===b.type){const k=Math.max(y,d),E=Math.min(y+g.nodeSize,u);t.addMark(k,E,l.create({...b.attrs,...e}))}}))}),p&&(f!==void 0&&t.setNodeMarkup(f,void 0,{...p.attrs,...e}),l&&p.marks.length&&p.marks.forEach(g=>{l===g.type&&t.addMark(h,m,l.create({...g.attrs,...e}))}))}),!0):!1},g1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Xg(o,e)(t,r)},y1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Zg(o,e)(t,r)},b1=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},vs=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},k1=(n,e)=>{if(Oi(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function _s(n){var e;const{editor:t,from:r,to:o,text:s,rules:l,plugin:a}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=Jb(d)+s;return l.forEach(p=>{if(u)return;const h=k1(f,p.find);if(!h)return;const m=c.state.tr,g=ms({state:c.state,transaction:m}),y={from:r-(h[0].length-s.length),to:o},{commands:b,chain:k,can:E}=new gs({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:k,can:E})===null||!m.steps.length||(p.undoable&&m.setMeta(a,{transform:m,from:r,to:o,text:s}),c.dispatch(m),u=!0)}),u}function x1(n){const{editor:e,rules:t}=n,r=new Oe({state:{init(){return null},apply(o,s,l){const a=o.getMeta(r);if(a)return a;const c=o.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Pi(F.from(u),l.schema);const{from:f}=c,p=f+u.length;_s({editor:e,from:f,to:p,text:u,rules:t,plugin:r})}),o.selectionSet||o.docChanged?null:s}},props:{handleTextInput(o,s,l,a){return _s({editor:e,from:s,to:l,text:a,rules:t,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{const{$cursor:s}=o.state.selection;s&&_s({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(o,s){if(s.key!=="Enter")return!1;const{$cursor:l}=o.state.selection;return l?_s({editor:e,from:l.pos,to:l.pos,text:`
13
+ `,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function w1(n){return Object.prototype.toString.call(n).slice(8,-1)}function Ss(n){return w1(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function yf(n,e){const t={...n};return Ss(n)&&Ss(e)&&Object.keys(e).forEach(r=>{Ss(e[r])&&Ss(n[r])?t[r]=yf(n[r],e[r]):t[r]=e[r]}),t}var Ki=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...ke(ne(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(ne(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>yf(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},Ht=class zm extends Ki{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new zm(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const l=o.marks();if(!!!l.find(d=>d?.type.name===t.name))return!1;const c=l.find(d=>d?.type.name===t.name);return c&&r.removeStoredMark(c),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function E1(n){return typeof n=="number"}var C1=class{constructor(n){this.find=n.find,this.handler=n.handler}},v1=(n,e,t)=>{if(Oi(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(o=>{const s=[o.text];return s.index=o.index,s.input=n,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 _1(n){const{editor:e,state:t,from:r,to:o,rule:s,pasteEvent:l,dropEvent:a}=n,{commands:c,chain:d,can:u}=new gs({editor:e,state:t}),f=[];return t.doc.nodesBetween(r,o,(h,m)=>{var g,y,b,k,E;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(E=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?E:0,C=Math.max(r,m),_=Math.min(o,m+x);if(C>=_)return;const w=h.isText?h.text||"":h.textBetween(C-m,_-m,void 0,"");v1(w,s.find,l).forEach(D=>{if(D.index===void 0)return;const R=C+D.index+1,A=R+D[0].length,B={from:t.tr.mapping.map(R),to:t.tr.mapping.map(A)},U=s.handler({state:t,range:B,match:D,commands:c,chain:d,can:u,pasteEvent:l,dropEvent:a});f.push(U)})}),f.every(h=>h!==null)}var Ns=null,S1=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function N1(n){const{editor:e,rules:t}=n;let r=null,o=!1,s=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const g=u.tr,y=ms({state:u,transaction:g});if(!(!_1({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(u=>new Oe({view(f){const p=m=>{var g;r=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,r&&(Ns=e)},h=()=>{Ns&&(Ns=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(s=r===f.dom.parentElement,a=p,!s){const h=Ns;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return l=p,o=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!o,y=m.getMeta("uiEvent")==="drop"&&!s,b=m.getMeta("applyPasteRules"),k=!!b;if(!g&&!y&&!k)return;if(k){let{text:C}=b;typeof C=="string"?C=C:C=Pi(F.from(C),h.schema);const{from:_}=b,w=_+C.length,T=S1(C);return c({rule:u,state:h,from:_,to:{b:w},pasteEvt:T})}const E=p.doc.content.findDiffStart(h.doc.content),x=p.doc.content.findDiffEnd(h.doc.content);if(!(!E1(E)||!x||E===x.b))return c({rule:u,state:h,from:E,to:x,pasteEvt:l})}}))}var Ms=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=af(n),this.schema=Hb(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Hi(e.name,this.schema)},r=ne(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return $i([...this.extensions].reverse()).flatMap(r=>{const o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:n,type:Hi(r.name,this.schema)},s=[],l=ne(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&ne(r,"exitable",o)&&(a.ArrowRight=()=>Ht.handleExit({editor:n,mark:r})),l){const p=Object.fromEntries(Object.entries(l()).map(([h,m])=>[h,()=>m({editor:n})]));a={...a,...p}}const c=Ky(a);s.push(c);const d=ne(r,"addInputRules",o);if(pf(r,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=x1({editor:n,rules:p}),m=Array.isArray(h)?h:[h];s.push(...m)}}const u=ne(r,"addPasteRules",o);if(pf(r,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=N1({editor:n,rules:p});s.push(...h)}}const f=ne(r,"addProseMirrorPlugins",o);if(f){const p=f();s.push(...p)}return s})}get attributes(){return of(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=po(this.extensions);return Object.fromEntries(e.filter(t=>!!ne(t,"addNodeView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:He(t.name,this.schema)},s=ne(t,"addNodeView",o);if(!s)return[];const l=(a,c,d,u,f)=>{const p=ws(a,r);return s()({node:a,view:c,getPos:d,decorations:u,innerDecorations:f,editor:n,extension:t,HTMLAttributes:p})};return[t.name,l]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=po(this.extensions);return Object.fromEntries(e.filter(t=>!!ne(t,"addMarkView")).map(t=>{const r=this.attributes.filter(a=>a.type===t.name),o={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:gn(t.name,this.schema)},s=ne(t,"addMarkView",o);if(!s)return[];const l=(a,c,d)=>{const u=ws(a,r);return s()({mark:a,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:f=>{H1(a,n,f)}})};return[t.name,l]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Hi(e.name,this.schema)};e.type==="mark"&&((t=ke(ne(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const o=ne(e,"onBeforeCreate",r),s=ne(e,"onCreate",r),l=ne(e,"onUpdate",r),a=ne(e,"onSelectionUpdate",r),c=ne(e,"onTransaction",r),d=ne(e,"onFocus",r),u=ne(e,"onBlur",r),f=ne(e,"onDestroy",r);o&&this.editor.on("beforeCreate",o),s&&this.editor.on("create",s),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};Ms.resolve=af,Ms.sort=$i,Ms.flatten=Fi;var M1={};Li(M1,{ClipboardTextSerializer:()=>bf,Commands:()=>kf,Delete:()=>xf,Drop:()=>wf,Editable:()=>Ef,FocusEvents:()=>vf,Keymap:()=>_f,Paste:()=>Sf,Tabindex:()=>Nf,focusEventsPluginKey:()=>Cf});var Ce=class Hm extends Ki{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Hm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},bf=Ce.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Oe({key:new $e("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:o}=e,{ranges:s}=o,l=Math.min(...s.map(u=>u.$from.pos)),a=Math.max(...s.map(u=>u.$to.pos)),c=df(t);return cf(r,{from:l,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),kf=Ce.create({name:"commands",addCommands(){return{...Ku}}}),xf=Ce.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,o;const s=()=>{var l,a,c,d;if((d=(c=(a=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:a.filterTransaction)==null?void 0:c.call(a,n))!=null?d:n.getMeta("y-sync$"))return;const u=tf(n.before,[n,...e]);ff(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:u.mapping.map(g),newTo:u.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var g,y;if(h instanceof zt){const b=p.slice(m).map(h.from,-1),k=p.slice(m).map(h.to),E=p.invert().map(b,-1),x=p.invert().map(k),C=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(w=>w.eq(h.mark)),_=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(w=>w.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:E,to:x},newRange:{from:b,to:k},partial:!!(_||C),editor:this.editor,transaction:n,combinedTransform:u})}})};(o=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||o?setTimeout(s,0):s()}}),wf=Ce.create({name:"drop",addProseMirrorPlugins(){return[new Oe({key:new $e("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Ef=Ce.create({name:"editable",addProseMirrorPlugins(){return[new Oe({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Cf=new $e("focusEvents"),vf=Ce.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new Oe({key:Cf,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),_f=Ce.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:a})=>{const{selection:c,doc:d}=a,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?a.doc.resolve(p-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:le.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},s={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Di()||Zu()?s:o},addProseMirrorPlugins(){return[new Oe({key:new $e("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const r=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),o=n.some(g=>g.getMeta("preventClearDocument"));if(!r||o)return;const{empty:s,from:l,to:a}=e.selection,c=le.atStart(e.doc).from,d=le.atEnd(e.doc).to;if(s||!(l===c&&a===d)||!Cs(t.doc))return;const p=t.tr,h=ms({state:t,transaction:p}),{commands:m}=new gs({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Sf=Ce.create({name:"paste",addProseMirrorPlugins(){return[new Oe({key:new $e("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),Nf=Ce.create({name:"tabindex",addProseMirrorPlugins(){return[new Oe({key:new $e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),T1=class Kr{constructor(e,t,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=o}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,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}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,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),t=this.resolvedPos.doc.resolve(e);return new Kr(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Kr(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 Kr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const o=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,l=this.pos+r+(s?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(l);if(!o&&a.depth<=this.depth)return;const c=new Kr(a,this.editor,o,o?t:null);o&&(c.actualDepth=this.depth+1),e.push(new Kr(a,this.editor,o,o?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(t).length>0){const s=o.node.attrs,l=Object.keys(t);for(let a=0;a<l.length;a+=1){const c=l[a];if(s[c]!==t[c])break}}else r=o;o=o.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;const s=Object.keys(t);return this.children.forEach(l=>{r&&o.length>0||(l.node.type.name===e&&s.every(c=>t[c]===l.node.attrs[c])&&o.push(l),!(r&&o.length>0)&&(o=o.concat(l.querySelectorAll(e,t,r))))}),o}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},A1=`.ProseMirror {
14
14
  position: relative;
15
15
  }
16
16
 
@@ -80,9 +80,23 @@ img.ProseMirror-separator {
80
80
 
81
81
  .ProseMirror-focused .ProseMirror-gapcursor {
82
82
  display: block;
83
- }`;function _1(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(o),o}var S1=class extends Hy{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:o})=>{throw o},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:o,slice:s,moved:l})=>this.options.onDrop(o,s,l)),this.on("paste",({event:o,slice:s})=>this.options.onPaste(o,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=df(t,this.options.autofocus);this.editorState=Sr.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=_1(v1,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=qu(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const l=typeof s=="string"?`${s}$`:s.key;r=r.filter(a=>!a.key.startsWith(l))}),t.length===r.length)return;const o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,t;const o=[...this.options.enableCoreExtensions?[xf,ff.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),yf,Ef,Cf,_f,kf,vf,bf].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Ms(o,this)}createCommandManager(){this.commandManager=new gs({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Li(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Li(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new vu(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),o=!this.state.selection.eq(t.selection),s=r.includes(e),l=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=a?.getMeta("focus"),d=a?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),d&&this.emit("blur",{editor:this,event:d.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||l.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return tf(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return tb(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ii(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
83
+ }`;function B1(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style",""),o.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(o),o}var V1=class extends b1{constructor(e={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:o})=>{throw o},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:o,slice:s,moved:l})=>this.options.onDrop(o,s,l)),this.on("paste",({event:o,slice:s})=>this.options.onPaste(o,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),r=Yu(t,this.options.autofocus);this.editorState=Sr.create({doc:t,schema:this.schema,selection:r||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=B1(A1,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const r=rf(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let r=t;if([].concat(e).forEach(s=>{const l=typeof s=="string"?`${s}$`:s.key;r=r.filter(a=>!a.key.startsWith(l))}),t.length===r.length)return;const o=this.state.reconfigure({plugins:r});return this.view.updateState(o),o}createExtensionManager(){var e,t;const o=[...this.options.enableCoreExtensions?[Ef,bf.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),kf,vf,_f,Nf,wf,Sf,xf].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Ms(o,this)}createCommandManager(){this.commandManager=new gs({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ri(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),e=Ri(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new $u(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.prependClass(),this.injectCSS();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:t,transactions:r}=this.state.applyTransaction(e),o=!this.state.selection.eq(t.selection),s=r.includes(e),l=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:r.slice(1)}),o&&this.emit("selectionUpdate",{editor:this,transaction:e});const a=r.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=a?.getMeta("focus"),d=a?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:a}),d&&this.emit("blur",{editor:this,event:d.event,transaction:a}),!(e.getMeta("preventUpdate")||!r.some(u=>u.docChanged)||l.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:r.slice(1)})}getAttributes(e){return uf(this.state,e)}isActive(e,t){const r=typeof e=="string"?e:null,o=typeof e=="string"?t:e;return Yb(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Pi(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
84
84
 
85
- `,textSerializers:r={}}=e||{};return Jy(this.state.doc,{blockSeparator:t,textSerializers:{...Qu(this.schema),...r}})}get isEmpty(){return Cs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new C1(t,this)}get $doc(){return this.$pos(0)}};function ur(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=ke(n.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];if(l){const c=a.search(/\S/),d=t.from+a.indexOf(l),u=d+l.length;if(Pi(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&s.delete(u,t.to),d>t.from&&s.delete(t.from+c,d);const p=t.from+c+l.length;s.addMark(t.from+c,p,n.type.create(o||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function Sf(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=ke(n.getAttributes,void 0,r)||{},{tr:s}=e,l=t.from;let a=t.to;const c=n.type.create(o);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=l+d;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,l+r[0].length-1),s.replaceWith(u,a,c)}else if(r[0]){const d=n.type.isInline?l:l-1;s.insert(d,n.type.create(o)).delete(s.mapping.map(l),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function Ki(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=e.doc.resolve(t.from),s=ke(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function Or(n){return new vs({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{const s=ke(n.getAttributes,void 0,r)||{},l=e.tr.delete(t.from,t.to),c=l.doc.resolve(t.from).blockRange(),d=c&&ql(c,n.type,s);if(!d)return null;if(l.wrap(c,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));l.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(f,s).run()}const u=l.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Tn(l.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&l.join(t.from-1)},undoable:n.undoable})}function N1(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof oe){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}function M1(n,e,t={}){const{state:r}=e,{doc:o,tr:s}=r,l=n;o.descendants((a,c)=>{const d=s.mapping.map(c),u=s.mapping.map(c)+a.nodeSize;let f=null;if(a.marks.forEach(h=>{if(h!==l)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});s.removeMark(d,u,n.type),s.addMark(d,u,h)}}),s.docChanged&&e.view.dispatch(s)}var Ue=class Rm extends Hi{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Rm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function $n(n){return new cb({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{const s=ke(n.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:l}=e,a=r[r.length-1],c=r[0];let d=t.to;if(a){const u=c.search(/\S/),f=t.from+c.indexOf(a),p=f+a.length;if(Pi(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&l.delete(p,t.to),f>t.from&&l.delete(t.from+u,f),d=t.from+u+a.length,l.addMark(t.from+u,d,n.type.create(s||{})),l.removeStoredMark(n.type)}}})}function Nf(n){return i.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var T1=class extends S1{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=Nf(this.view.state),this.reactiveExtensionStorage=Nf(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,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(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},Mf=i.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=i.ref(),t=i.getCurrentInstance();return i.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&i.nextTick(()=>{var o;if(!e.value||!((o=r.view.dom)!=null&&o.firstChild))return;const s=i.unref(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),i.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return i.h("div",{ref:n=>{this.rootEl=n}})}});i.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return i.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),i.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return i.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var A1=(n={})=>{const e=i.shallowRef();return i.onMounted(()=>{e.value=new T1(n)}),i.onBeforeUnmount(()=>{var t,r,o;const s=(t=e.value)==null?void 0:t.view.dom,l=s?.cloneNode(!0);(r=s?.parentNode)==null||r.replaceChild(l,s),(o=e.value)==null||o.destroy()}),e};i.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return i.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var B1=20,Tf=(n,e=0)=>{const t=[];return!n.children.length||e>B1||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...Tf(r,e+1))}),t},V1=n=>{if(!n.children.length)return;const e=Tf(n);e&&e.forEach(t=>{var r,o;const s=t.getAttribute("style"),l=(o=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");t.setAttribute("style",`${l};${s}`)})},qi=Ht.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&V1(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",we(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(s=>!!s))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),L1=Ce.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(l==="background-color")return a.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),O1=Ce.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(l==="color")return a.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),I1=Ce.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),D1=Ce.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),R1=Ce.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),F1=Ce.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(L1.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(O1.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(I1.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(D1.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(R1.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(qi.configure(this.options.textStyle)),n}}),Gi,Ji;if(typeof WeakMap<"u"){let n=new WeakMap;Gi=e=>n.get(e),Ji=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Gi=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},Ji=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}var Re=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,l=o+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;l<this.height&&this.map[e+this.width*a]==t;a++)l++;return{left:r,top:o,right:s,bottom:l}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:o,top:s,bottom:l}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[s*this.width+(t<0?r-1:o)]:(t<0?s==0:l==this.height)?null:this.map[r+this.width*(t<0?s-1:l)]}rectBetween(n,e){const{left:t,right:r,top:o,bottom:s}=this.findCell(n),{left:l,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(t,l),top:Math.min(o,c),right:Math.max(r,a),bottom:Math.max(s,d)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){const s=r*this.width+o,l=this.map[s];t[l]||(t[l]=!0,!(o==n.left&&o&&this.map[s-1]==l||r==n.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){const s=o+t.child(r).nodeSize;if(r==n){let l=e+n*this.width;const a=(n+1)*this.width;for(;l<a&&this.map[l]<o;)l++;return l==a?s-1:this.map[l]}o=s}}static get(n){return Gi(n)||Ji(n,P1(n))}};function P1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=$1(n),t=n.childCount,r=[];let o=0,s=null;const l=[];for(let d=0,u=e*t;d<u;d++)r[d]=0;for(let d=0,u=0;d<t;d++){const f=n.child(d);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let E=0;E<b;E++){if(E+d>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-E});break}const x=o+E*e;for(let C=0;C<y;C++){r[x+C]==0?r[x+C]=u:(s||(s=[])).push({type:"collision",row:d,pos:u,n:y-C});const S=k&&k[C];if(S){const w=(x+C)%e*2,T=l[w];T==null||T!=S&&l[w+1]==1?(l[w]=S,l[w+1]=1):T==S&&l[w+1]++}}}o+=y,u+=g.nodeSize}const p=(d+1)*e;let h=0;for(;o<p;)r[o++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:d,n:h}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Re(e,t,r,s);let c=!1;for(let d=0;!c&&d<l.length;d+=2)l[d]!=null&&l[d+1]<t&&(c=!0);return c&&z1(a,l,n),a}function $1(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const o=n.child(r);let s=0;if(t)for(let l=0;l<r;l++){const a=n.child(l);for(let c=0;c<a.childCount;c++){const d=a.child(c);l+d.attrs.rowspan>r&&(s+=d.attrs.colspan)}}for(let l=0;l<o.childCount;l++){const a=o.child(l);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function z1(n,e,t){n.problems||(n.problems=[]);const r={};for(let o=0;o<n.map.length;o++){const s=n.map[o];if(r[s])continue;r[s]=!0;const l=t.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let a=null;const c=l.attrs;for(let d=0;d<c.colspan;d++){const u=(o+d)%n.width,f=e[u*2];f!=null&&(!c.colwidth||c.colwidth[d]!=f)&&((a||(a=H1(c)))[d]=f)}a&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function H1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function at(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var zn=new $e("selectingCells");function Ir(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function j1(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function jt(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Ts(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Ir(e.$head)||U1(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function U1(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Yi(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function W1(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function Xi(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Af(n,e,t){const r=n.node(-1),o=Re.get(r),s=n.start(-1),l=o.nextCell(n.pos-s,e,t);return l==null?null:n.node(0).resolve(s+l)}function fr(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Bf(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function K1(n,e,t){const r=at(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}var Te=class _n extends le{constructor(e,t=e){const r=e.node(-1),o=Re.get(r),s=e.start(-1),l=o.rectBetween(e.pos-s,t.pos-s),a=e.node(0),c=o.cellsInRect(l).filter(u=>u!=t.pos-s);c.unshift(t.pos-s);const d=c.map(u=>{const f=r.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const p=s+u+1;return new ad(a.resolve(p),a.resolve(p+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Yi(r)&&Yi(o)&&Xi(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?_n.rowSelection(r,o):s&&this.isColSelection()?_n.colSelection(r,o):new _n(r,o)}return se.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=Re.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let c=o.top;c<o.bottom;c++){const d=[];for(let u=c*t.width+o.left,f=o.left;f<o.right;f++,u++){const p=t.map[u];if(s[p])continue;s[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw RangeError(`No cell with offset ${p} found`);const g=o.left-h.left,y=h.right-o.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=fr(b,0,g)),y>0&&(b=fr(b,b.colspan-y,y)),h.left<o.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<o.top||h.bottom>o.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}l.push(e.child(c).copy(F.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new J(F.from(a),1,1)}replace(e,t=J.empty){const r=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){const{$from:a,$to:c}=o[l],d=e.mapping.slice(r);e.replace(d.map(a.pos),d.map(c.pos),l?J.empty:t)}const s=le.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new J(F.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=Re.get(t),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let l=0;l<s.length;l++)e(t.nodeAt(s[l]),o+s[l])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),o=Re.get(r),s=e.start(-1),l=o.findCell(e.pos-s),a=o.findCell(t.pos-s),c=e.node(0);return l.top<=a.top?(l.top>0&&(e=c.resolve(s+o.map[l.left])),a.bottom<o.height&&(t=c.resolve(s+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(t=c.resolve(s+o.map[a.left])),l.bottom<o.height&&(e=c.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))),new _n(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Re.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const l=o+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,a)==t.width}eq(e){return e instanceof _n&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),o=Re.get(r),s=e.start(-1),l=o.findCell(e.pos-s),a=o.findCell(t.pos-s),c=e.node(0);return l.left<=a.left?(l.left>0&&(e=c.resolve(s+o.map[l.top*o.width])),a.right<o.width&&(t=c.resolve(s+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(t=c.resolve(s+o.map[a.top*o.width])),l.right<o.width&&(e=c.resolve(s+o.map[o.width*(l.top+1)-1]))),new _n(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new _n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new _n(e.resolve(t),e.resolve(r))}getBookmark(){return new q1(this.$anchorCell.pos,this.$headCell.pos)}};Te.prototype.visible=!1,le.jsonID("cell",Te);var q1=class Fm{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Fm(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&Xi(t,r)?new Te(t,r):le.near(r,1)}};function G1(n){if(!(n.selection instanceof Te))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(Ye.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Me.create(n.doc,e)}function J1({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function Y1({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){const s=n.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=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 t!==r&&e.parentOffset===0}function X1(n,e,t){const r=(e||n).selection,o=(e||n).doc;let s,l;if(r instanceof oe&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=Te.create(o,r.from);else if(l=="row"){const a=o.resolve(r.from+1);s=Te.rowSelection(a,a)}else if(!t){const a=Re.get(r.node),c=r.from+1,d=c+a.map[a.width*a.height-1];s=Te.create(o,c+1,d)}}else r instanceof se&&J1(r)?s=se.create(o,r.from):r instanceof se&&Y1(r)&&(s=se.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var Z1=new $e("fix-tables");function Vf(n,e,t,r){const o=n.childCount,s=e.childCount;e:for(let l=0,a=0;l<s;l++){const c=e.child(l);for(let d=a,u=Math.min(o,l+3);d<u;d++)if(n.child(d)==c){a=d+1,t+=c.nodeSize;continue e}r(c,t),a<o&&n.child(a).sameMarkup(c)?Vf(n.child(a),c,t+1,r):c.nodesBetween(0,c.content.size,r,t+1),t+=c.nodeSize}}function Lf(n,e){let t;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(t=Q1(n,o,s,t))};return e?e.doc!=n.doc&&Vf(e.doc,n.doc,0,r):n.doc.descendants(r),t}function Q1(n,e,t,r){const o=Re.get(e);if(!o.problems)return r;r||(r=n.tr);const s=[];for(let c=0;c<o.height;c++)s.push(0);for(let c=0;c<o.problems.length;c++){const d=o.problems[c];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const f=u.attrs;for(let p=0;p<f.rowspan;p++)s[d.row+p]+=d.n;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,fr(f,f.colspan-d.n,d.n))}else if(d.type=="missing")s[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let l,a;for(let c=0;c<s.length;c++)s[c]&&(l==null&&(l=c),a=c);for(let c=0,d=t+1;c<o.height;c++){const u=e.child(c),f=d+u.nodeSize,p=s[c];if(p>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=at(n.schema)[h].createAndFill();b&&m.push(b)}const g=(c==0||l==c-1)&&a==c?d+1:f-1;r.insert(r.mapping.map(g),m)}d=f}return r.setMeta(Z1,{fixTables:!0})}function Xt(n){const e=n.selection,t=Ts(n),r=t.node(-1),o=t.start(-1),s=Re.get(r);return{...e instanceof Te?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(t.pos-o),tableStart:o,map:s,table:r}}function Of(n,{map:e,tableStart:t,table:r},o){let s=o>0?-1:0;K1(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let l=0;l<e.height;l++){const a=l*e.width+o;if(o>0&&o<e.width&&e.map[a-1]==e.map[a]){const c=e.map[a],d=r.nodeAt(c);n.setNodeMarkup(n.mapping.map(t+c),null,Bf(d.attrs,o-e.colCount(c))),l+=d.attrs.rowspan-1}else{const c=s==null?at(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,d=e.positionAt(l,o,r);n.insert(n.mapping.map(t+d),c.createAndFill())}}return n}function ek(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Of(n.tr,t,t.left))}return!0}function tk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Of(n.tr,t,t.right))}return!0}function nk(n,{map:e,table:t,tableStart:r},o){const s=n.mapping.maps.length;for(let l=0;l<e.height;){const a=l*e.width+o,c=e.map[a],d=t.nodeAt(c),u=d.attrs;if(o>0&&e.map[a-1]==c||o<e.width-1&&e.map[a+1]==c)n.setNodeMarkup(n.mapping.slice(s).map(r+c),null,fr(u,o-e.colCount(c)));else{const f=n.mapping.slice(s).map(r+c);n.delete(f,f+d.nodeSize)}l+=u.rowspan}}function rk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;nk(r,t,o),o!=t.left;o--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=Re.get(s)}e(r)}return!0}function ok(n,e,t){var r;const o=at(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(((r=e.nodeAt(n.map[s+t*n.width]))==null?void 0:r.type)!=o)return!1;return!0}function If(n,{map:e,tableStart:t,table:r},o){var s;let l=t;for(let d=0;d<o;d++)l+=r.child(d).nodeSize;const a=[];let c=o>0?-1:0;ok(e,r,o+c)&&(c=o==0||o==e.height?null:0);for(let d=0,u=e.width*o;d<e.width;d++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const f=e.map[u],p=r.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),d+=p.colspan-1}else{const f=c==null?at(r.type.schema).cell:(s=r.nodeAt(e.map[u+c*e.width]))==null?void 0:s.type,p=f?.createAndFill();p&&a.push(p)}return n.insert(l,at(r.type.schema).row.create(null,a)),n}function sk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(If(n.tr,t,t.top))}return!0}function lk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(If(n.tr,t,t.bottom))}return!0}function ik(n,{map:e,table:t,tableStart:r},o){let s=0;for(let d=0;d<o;d++)s+=t.child(d).nodeSize;const l=s+t.child(o).nodeSize,a=n.mapping.maps.length;n.delete(s+r,l+r);const c=new Set;for(let d=0,u=o*e.width;d<e.width;d++,u++){const f=e.map[u];if(!c.has(f)){if(c.add(f),o>0&&f==e.map[u-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,{...p,rowspan:p.rowspan-1}),d+=p.colspan-1}else if(o<e.height&&f==e.map[u+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(o+1,d,t);n.insert(n.mapping.slice(a).map(r+g),m),d+=h.colspan-1}}}}function ak(n,e){if(!jt(n))return!1;if(e){const t=Xt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;ik(r,t,o),o!=t.top;o--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=Re.get(t.table)}e(r)}return!0}function Df(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function ck({width:n,height:e,map:t},r){let o=r.top*n+r.left,s=o,l=(r.bottom-1)*n+r.left,a=o+(r.right-r.left-1);for(let c=r.top;c<r.bottom;c++){if(r.left>0&&t[s]==t[s-1]||r.right<n&&t[a]==t[a+1])return!0;s+=n,a+=n}for(let c=r.left;c<r.right;c++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[l]==t[l+n])return!0;o++,l++}return!1}function Rf(n,e){const t=n.selection;if(!(t instanceof Te)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=Xt(n),{map:o}=r;if(ck(o,r))return!1;if(e){const s=n.tr,l={};let a=F.empty,c,d;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){const p=o.map[u*o.width+f],h=r.table.nodeAt(p);if(!(l[p]||!h))if(l[p]=!0,c==null)c=p,d=h;else{Df(h)||(a=a.append(h.content));const m=s.mapping.map(p+r.tableStart);s.delete(m,m+h.nodeSize)}}if(c==null||d==null)return!0;if(s.setNodeMarkup(c+r.tableStart,null,{...Bf(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const u=c+1+d.content.size,f=Df(d)?c+1:u;s.replaceWith(f+r.tableStart,u+r.tableStart,a)}s.setSelection(new Te(s.doc.resolve(c+r.tableStart))),e(s)}return!0}function Ff(n,e){const t=at(n.schema);return dk(({node:r})=>t[r.type.spec.tableRole])(n,e)}function dk(n){return(e,t)=>{var r;const o=e.selection;let s,l;if(o instanceof Te){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;s=o.$anchorCell.nodeAfter,l=o.$anchorCell.pos}else{if(s=j1(o.$from),!s)return!1;l=(r=Ir(o.$from))==null?void 0:r.pos}if(s==null||l==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let a=s.attrs;const c=[],d=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=Xt(e),f=e.tr;for(let h=0;h<u.right-u.left;h++)c.push(d?{...a,colwidth:d&&d[h]?[d[h]]:null}:a);let p;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=s.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||f.insert(p=f.mapping.map(m+u.tableStart,1),n({node:s,row:h,col:g}).createAndFill(c[y]))}f.setNodeMarkup(l,n({node:s,row:u.top,col:u.left}),c[0]),o instanceof Te&&f.setSelection(new Te(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function uk(n,e){return function(t,r){if(!jt(t))return!1;const o=Ts(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){const s=t.tr;t.selection instanceof Te?t.selection.forEachCell((l,a)=>{l.attrs[n]!==e&&s.setNodeMarkup(a,null,{...l.attrs,[n]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function fk(n){return function(e,t){if(!jt(e))return!1;if(t){const r=at(e.schema),o=Xt(e),s=e.tr,l=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=l.map(c=>o.table.nodeAt(c));for(let c=0;c<l.length;c++)a[c].type==r.header_cell&&s.setNodeMarkup(o.tableStart+l[c],r.cell,a[c].attrs);if(s.steps.length==0)for(let c=0;c<l.length;c++)s.setNodeMarkup(o.tableStart+l[c],r.header_cell,a[c].attrs);t(s)}return!0}}function Pf(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==t.header_cell)return!1}return!0}function ho(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?fk(n):function(t,r){if(!jt(t))return!1;if(r){const o=at(t.schema),s=Xt(t),l=t.tr,a=Pf("row",s,o),c=Pf("column",s,o),u=(n==="column"?a:n==="row"?c:!1)?1:0,f=n=="column"?{left:0,top:u,right:1,bottom:s.map.height}:n=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,p=n=="column"?c?o.cell:o.header_cell:n=="row"?a?o.cell:o.header_cell:o.cell;s.map.cellsInRect(f).forEach(h=>{const m=h+s.tableStart,g=l.doc.nodeAt(m);g&&l.setNodeMarkup(m,p,g.attrs)}),r(l)}return!0}}ho("row",{useDeprecatedLogic:!0}),ho("column",{useDeprecatedLogic:!0});var pk=ho("cell",{useDeprecatedLogic:!0});function hk(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){const s=n.node(-1).child(r),l=s.lastChild;if(l)return o-1-l.nodeSize;o-=s.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){const s=t.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function $f(n){return function(e,t){if(!jt(e))return!1;const r=hk(Ts(e),n);if(r==null)return!1;if(t){const o=e.doc.resolve(r);t(e.tr.setSelection(se.between(o,W1(o))).scrollIntoView())}return!0}}function mk(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function As(n,e){const t=n.selection;if(!(t instanceof Te))return!1;if(e){const r=n.tr,o=at(n.schema).cell.createAndFill().content;t.forEachCell((s,l)=>{s.content.eq(o)||r.replace(r.mapping.map(l+1),r.mapping.map(l+s.nodeSize-1),new J(o,0,0))}),r.docChanged&&e(r)}return!0}function gk(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,l=o.type.schema,a=[];if(s=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const u=c?0:Math.max(0,t-1),f=c<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(d=Zi(at(l).row,new J(d,u,f)).content),a.push(d)}else if(s=="cell"||s=="header_cell")a.push(t||r?Zi(at(l).row,new J(e,t,r)).content:e);else return null;return yk(l,a)}function yk(n,e){const t=[];for(let o=0;o<e.length;o++){const s=e[o];for(let l=s.childCount-1;l>=0;l--){const{rowspan:a,colspan:c}=s.child(l).attrs;for(let d=o;d<o+a;d++)t[d]=(t[d]||0)+c}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(F.empty),t[o]<r){const s=at(n).cell.createAndFill(),l=[];for(let a=t[o];a<r;a++)l.push(s);e[o]=e[o].append(F.from(l))}return{height:e.length,width:r,rows:e}}function Zi(n,e){const t=n.createAndFill();return new Yl(t).replace(0,t.content.size,e).doc}function bk({width:n,height:e,rows:t},r,o){if(n!=r){const s=[],l=[];for(let a=0;a<t.length;a++){const c=t[a],d=[];for(let u=s[a]||0,f=0;u<r;f++){let p=c.child(f%c.childCount);u+p.attrs.colspan>r&&(p=p.type.createChecked(fr(p.attrs,p.attrs.colspan,u+p.attrs.colspan-r),p.content)),d.push(p),u+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)s[a+h]=(s[a+h]||0)+p.attrs.colspan}l.push(F.from(d))}t=l,n=r}if(e!=o){const s=[];for(let l=0,a=0;l<o;l++,a++){const c=[],d=t[a%e];for(let u=0;u<d.childCount;u++){let f=d.child(u);l+f.attrs.rowspan>o&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,o-f.attrs.rowspan)},f.content)),c.push(f)}s.push(F.from(c))}t=s,e=o}return{width:n,height:e,rows:t}}function kk(n,e,t,r,o,s,l){const a=n.doc.type.schema,c=at(a);let d,u;if(o>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=u||(u=c.header_cell.createAndFill());for(let y=e.width;y<o;y++)m.push(g);n.insert(n.mapping.slice(l).map(p-1+r),m)}if(s>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==c.header_cell;f.push(y?u||(u=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const p=c.row.create(null,F.from(f)),h=[];for(let m=e.height;m<s;m++)h.push(p);n.insert(n.mapping.slice(l).map(r+t.nodeSize-2),h)}return!!(d||u)}function zf(n,e,t,r,o,s,l,a){if(l==0||l==e.height)return!1;let c=!1;for(let d=o;d<s;d++){const u=l*e.width+d,f=e.map[u];if(e.map[u-e.width]==f){c=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,{...p.attrs,rowspan:l-h}),n.insert(n.mapping.slice(a).map(e.positionAt(l,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-l})),d+=p.attrs.colspan-1}}return c}function Hf(n,e,t,r,o,s,l,a){if(l==0||l==e.width)return!1;let c=!1;for(let d=o;d<s;d++){const u=d*e.width+l,f=e.map[u];if(e.map[u-1]==f){c=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(a).map(f+r);n.setNodeMarkup(m,null,fr(p.attrs,l-h,p.attrs.colspan-(l-h))),n.insert(m+p.nodeSize,p.type.createAndFill(fr(p.attrs,0,l-h))),d+=p.attrs.rowspan-1}}return c}function jf(n,e,t,r,o){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let l=Re.get(s);const{top:a,left:c}=r,d=c+o.width,u=a+o.height,f=n.tr;let p=0;function h(){if(s=t?f.doc.nodeAt(t-1):f.doc,!s)throw new Error("No table found");l=Re.get(s),p=f.mapping.maps.length}kk(f,l,s,t,d,u,p)&&h(),zf(f,l,s,t,c,d,a,p)&&h(),zf(f,l,s,t,c,d,u,p)&&h(),Hf(f,l,s,t,a,u,c,p)&&h(),Hf(f,l,s,t,a,u,d,p)&&h();for(let m=a;m<u;m++){const g=l.positionAt(m,c,s),y=l.positionAt(m,d,s);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new J(o.rows[m-a],0,0))}h(),f.setSelection(new Te(f.doc.resolve(t+l.positionAt(a,c,s)),f.doc.resolve(t+l.positionAt(u-1,d-1,s)))),e(f)}var xk=Ni({ArrowLeft:Vs("horiz",-1),ArrowRight:Vs("horiz",1),ArrowUp:Vs("vert",-1),ArrowDown:Vs("vert",1),"Shift-ArrowLeft":Ls("horiz",-1),"Shift-ArrowRight":Ls("horiz",1),"Shift-ArrowUp":Ls("vert",-1),"Shift-ArrowDown":Ls("vert",1),Backspace:As,"Mod-Backspace":As,Delete:As,"Mod-Delete":As});function Bs(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Vs(n,e){return(t,r,o)=>{if(!o)return!1;const s=t.selection;if(s instanceof Te)return Bs(t,r,le.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const l=Uf(o,n,e);if(l==null)return!1;if(n=="horiz")return Bs(t,r,le.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(l),c=Af(a,n,e);let d;return c?d=le.near(c,1):e<0?d=le.near(t.doc.resolve(a.before(-1)),-1):d=le.near(t.doc.resolve(a.after(-1)),1),Bs(t,r,d)}}}function Ls(n,e){return(t,r,o)=>{if(!o)return!1;const s=t.selection;let l;if(s instanceof Te)l=s;else{const c=Uf(o,n,e);if(c==null)return!1;l=new Te(t.doc.resolve(c))}const a=Af(l.$headCell,n,e);return a?Bs(t,r,new Te(l.$anchorCell,a)):!1}}function wk(n,e){const t=n.state.doc,r=Ir(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new Te(r))),!0):!1}function Ek(n,e,t){if(!jt(n.state))return!1;let r=gk(t);const o=n.state.selection;if(o instanceof Te){r||(r={width:1,height:1,rows:[F.from(Zi(at(n.state.schema).cell,t))]});const s=o.$anchorCell.node(-1),l=o.$anchorCell.start(-1),a=Re.get(s).rectBetween(o.$anchorCell.pos-l,o.$headCell.pos-l);return r=bk(r,a.right-a.left,a.bottom-a.top),jf(n.state,n.dispatch,l,a,r),!0}else if(r){const s=Ts(n.state),l=s.start(-1);return jf(n.state,n.dispatch,l,Re.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function Ck(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=Wf(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof Te)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Ir(n.state.selection.$anchor))!=null&&((t=Qi(n,e))==null?void 0:t.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(c,d){let u=Qi(n,d);const f=zn.getState(n.state)==null;if(!u||!Xi(c,u))if(f)u=c;else return;const p=new Te(c,u);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(zn,c.pos),n.dispatch(h)}}function l(){n.root.removeEventListener("mouseup",l),n.root.removeEventListener("dragstart",l),n.root.removeEventListener("mousemove",a),zn.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(zn,-1))}function a(c){const d=c,u=zn.getState(n.state);let f;if(u!=null)f=n.state.doc.resolve(u);else if(Wf(n,d.target)!=r&&(f=Qi(n,e),!f))return l();f&&s(f,d)}n.root.addEventListener("mouseup",l),n.root.addEventListener("dragstart",l),n.root.addEventListener("mousemove",a)}function Uf(n,e,t){if(!(n.state.selection instanceof se))return null;const{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(o),c=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(c)?a:null}}return null}function Wf(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Qi(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Ir(n.state.doc.resolve(t.pos)):null}var vk=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ea(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ea(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ea(n,e,t,r,o,s){var l;let a=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g++,p++){const y=o==p?s:m&&m[g],b=y?y+"px":"";if(a+=y||r,y||(c=!1),d)d.style.width!=b&&(d.style.width=b),d=d.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;d;){const f=d.nextSibling;(l=d.parentNode)==null||l.removeChild(d),d=f}c?(t.style.width=a+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=a+"px")}}var _t=new $e("tableColumnResizing");function _k({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=vk,lastColumnResizable:o=!0}={}){const s=new Oe({key:_t,state:{init(l,a){var c,d;const u=(d=(c=s.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,f=at(a.schema).table.name;return r&&u&&(u[f]=(p,h)=>new r(p,t,h)),new Sk(-1,!1)},apply(l,a){return a.apply(l)}},props:{attributes:l=>{const a=_t.getState(l);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,a)=>{Nk(l,a,n,o)},mouseleave:l=>{Mk(l)},mousedown:(l,a)=>{Tk(l,a,e,t)}},decorations:l=>{const a=_t.getState(l);if(a&&a.activeHandle>-1)return Ok(l,a.activeHandle)},nodeViews:{}}});return s}var Sk=class Rl{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(_t);if(r&&r.setHandle!=null)return new Rl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Rl(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Yi(e.doc.resolve(o))||(o=-1),new Rl(o,t.dragging)}return t}};function Nk(n,e,t,r){if(!n.editable)return;const o=_t.getState(n.state);if(o&&!o.dragging){const s=Bk(e.target);let l=-1;if(s){const{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=Kf(n,e,"left",t):c-e.clientX<=t&&(l=Kf(n,e,"right",t))}if(l!=o.activeHandle){if(!r&&l!==-1){const a=n.state.doc.resolve(l),c=a.node(-1),d=Re.get(c),u=a.start(-1);if(d.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==d.width-1)return}Gf(n,l)}}}function Mk(n){if(!n.editable)return;const e=_t.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Gf(n,-1)}function Tk(n,e,t,r){var o;if(!n.editable)return!1;const s=(o=n.dom.ownerDocument.defaultView)!=null?o:window,l=_t.getState(n.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const a=n.state.doc.nodeAt(l.activeHandle),c=Ak(n,l.activeHandle,a.attrs);n.dispatch(n.state.tr.setMeta(_t,{setDragging:{startX:e.clientX,startWidth:c}}));function d(f){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",u);const p=_t.getState(n.state);p?.dragging&&(Vk(n,p.activeHandle,qf(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(_t,{setDragging:null})))}function u(f){if(!f.which)return d(f);const p=_t.getState(n.state);if(p&&p.dragging){const h=qf(p.dragging,f,t);Jf(n,p.activeHandle,h,r)}}return Jf(n,l.activeHandle,c,r),s.addEventListener("mouseup",d),s.addEventListener("mousemove",u),e.preventDefault(),!0}function Ak(n,e,{colspan:t,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=n.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,c=t;if(r)for(let d=0;d<t;d++)r[d]&&(a-=r[d],c--);return a/c}function Bk(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Kf(n,e,t,r){const o=t=="right"?-r:r,s=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:l}=s,a=Ir(n.state.doc.resolve(l));if(!a)return-1;if(t=="right")return a.pos;const c=Re.get(a.node(-1)),d=a.start(-1),u=c.map.indexOf(a.pos-d);return u%c.width==0?-1:d+c.map[u-1]}function qf(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Gf(n,e){n.dispatch(n.state.tr.setMeta(_t,{setHandle:e}))}function Vk(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),s=Re.get(o),l=r.start(-1),a=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,c=n.state.tr;for(let d=0;d<s.height;d++){const u=d*s.width+a;if(d&&s.map[u]==s.map[u-s.width])continue;const f=s.map[u],p=o.nodeAt(f).attrs,h=p.colspan==1?0:a-s.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():Lk(p.colspan);m[h]=t,c.setNodeMarkup(l+f,null,{...p,colwidth:m})}c.docChanged&&n.dispatch(c)}function Jf(n,e,t,r){const o=n.state.doc.resolve(e),s=o.node(-1),l=o.start(-1),a=Re.get(s).colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;let c=n.domAtPos(o.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&ea(s,c.firstChild,c,r,a,t)}function Lk(n){return Array(n).fill(0)}function Ok(n,e){var t;const r=[],o=n.doc.resolve(e),s=o.node(-1);if(!s)return Me.empty;const l=Re.get(s),a=o.start(-1),c=l.colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;for(let d=0;d<l.height;d++){const u=c+d*l.width;if((c==l.width-1||l.map[u]!=l.map[u+1])&&(d==0||l.map[u]!=l.map[u-l.width])){const f=l.map[u],p=a+f+s.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=_t.getState(n))!=null&&t.dragging&&r.push(Ye.node(a+f,a+f+s.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),r.push(Ye.widget(p,h))}}return Me.create(n.doc,r)}function Ik({allowTableNodeSelection:n=!1}={}){return new Oe({key:zn,state:{init(){return null},apply(e,t){const r=e.getMeta(zn);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:o,pos:s}=e.mapping.mapResult(t);return o?null:s}},props:{decorations:G1,handleDOMEvents:{mousedown:Ck},createSelectionBetween(e){return zn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:wk,handleKeyDown:xk,handlePaste:Ek},appendTransaction(e,t,r){return X1(r,Lf(r,t),n)}})}var Dk=Ue.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const r=n.getAttribute("colwidth"),o=r?r.split(",").map(s=>parseInt(s,10)):null;if(!o){const s=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),l=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(l&&l>-1&&s&&s[l]){const a=s[l].getAttribute("width");return a?[parseInt(a,10)]:null}}return o}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",we(this.options.HTMLAttributes,n),0]}}),Rk=Ue.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",we(this.options.HTMLAttributes,n),0]}}),Fk=Ue.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",we(this.options.HTMLAttributes,n),0]}});function ta(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Yf(n,e,t,r,o,s){var l;let a=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u!==null)for(let f=0,p=0;f<u.childCount;f+=1){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=o===p?s:m&&m[g],b=y?`${y}px`:"";if(a+=y||r,y||(c=!1),d){if(d.style.width!==b){const[k,E]=ta(r,y);d.style.setProperty(k,E)}d=d.nextSibling}else{const k=document.createElement("col"),[E,x]=ta(r,y);k.style.setProperty(E,x),e.appendChild(k)}}}for(;d;){const f=d.nextSibling;(l=d.parentNode)==null||l.removeChild(d),d=f}c?(t.style.width=`${a}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${a}px`)}var Pk=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Yf(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,Yf(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(t&&!r&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function $k(n,e,t,r){let o=0,s=!0;const l=[],a=n.firstChild;if(!a)return{};for(let f=0,p=0;f<a.childCount;f+=1){const{colspan:h,colwidth:m}=a.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=t===p?r:m&&m[g];o+=y||e,y||(s=!1);const[b,k]=ta(e,y);l.push(["col",{style:`${b}: ${k}`}])}}const c=s?`${o}px`:"",d=s?"":`${o}px`;return{colgroup:["colgroup",{},...l],tableWidth:c,tableMinWidth:d}}function Xf(n,e){return n.createAndFill()}function zk(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function Hk(n,e,t,r,o){const s=zk(n),l=[],a=[];for(let d=0;d<t;d+=1){const u=Xf(s.cell);if(u&&a.push(u),r){const f=Xf(s.header_cell);f&&l.push(f)}}const c=[];for(let d=0;d<e;d+=1)c.push(s.row.createChecked(null,r&&d===0?l:a));return s.table.createChecked(null,c)}function jk(n){return n instanceof Te}var Os=({editor:n})=>{const{selection:e}=n.state;if(!jk(e))return!1;let t=0;const r=Ku(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},Uk=Ue.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Pk,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:o}=$k(n,this.options.cellMinWidth);return["table",we(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const l=Hk(s.schema,n,e,t);if(o){const a=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(se.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>ek(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>tk(n,e),deleteColumn:()=>({state:n,dispatch:e})=>rk(n,e),addRowBefore:()=>({state:n,dispatch:e})=>sk(n,e),addRowAfter:()=>({state:n,dispatch:e})=>lk(n,e),deleteRow:()=>({state:n,dispatch:e})=>ak(n,e),deleteTable:()=>({state:n,dispatch:e})=>mk(n,e),mergeCells:()=>({state:n,dispatch:e})=>Rf(n,e),splitCell:()=>({state:n,dispatch:e})=>Ff(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>ho("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>ho("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>pk(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Rf(n,e)?!0:Ff(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>uk(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>$f(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>$f(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&Lf(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=Te.create(e.doc,n.anchorCell,n.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:Os,"Mod-Backspace":Os,Delete:Os,"Mod-Delete":Os}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[_k({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Ik({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:ke(ne(n,"tableRole",e))}}}),Wk=Ce.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(Uk.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Dk.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(Rk.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(Fk.configure(this.options.tableRow)),n}}),Kk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,qk=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,Gk=Ht.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ur({find:Kk,type:this.type})]},addPasteRules(){return[$n({find:qk,type:this.type})]}}),Jk=Ht.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Yk=Ht.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Is=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},Xk=/^\s*>\s$/,Zk=Ue.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Is("blockquote",{...we(this.options.HTMLAttributes,n),children:Is("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Or({find:Xk,type:this.type})]}}),Qk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,ex=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,tx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,nx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,rx=Ht.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Is("strong",{...we(this.options.HTMLAttributes,n),children:Is("slot",{})})},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ur({find:Qk,type:this.type}),ur({find:tx,type:this.type})]},addPasteRules(){return[$n({find:ex,type:this.type}),$n({find:nx,type:this.type})]}}),ox=/(^|[^`])`([^`]+)`(?!`)$/,sx=/(^|[^`])`([^`]+)`(?!`)/g,lx=Ht.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ur({find:ox,type:this.type})]},addPasteRules(){return[$n({find:sx,type:this.type})]}}),ix=/^```([a-z]+)?[\s\n]$/,ax=/^~~~([a-z]+)?[\s\n]$/,cx=Ue.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(t)).map(l=>l.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",we(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{if(!this.options.enableTabIndentation)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(r.parent.type!==this.type)return!1;const s=" ".repeat(this.options.tabSize);return o?n.commands.insertContent(s):n.commands.command(({tr:l})=>{const{from:a,to:c}=t,f=e.doc.textBetween(a,c,`
85
+ `,textSerializers:r={}}=e||{};return Ub(this.state.doc,{blockSeparator:t,textSerializers:{...df(this.schema),...r}})}get isEmpty(){return Cs(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)==null?void 0:r.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new T1(t,this)}get $doc(){return this.$pos(0)}};function ur(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=ke(n.getAttributes,void 0,r);if(o===!1||o===null)return null;const{tr:s}=e,l=r[r.length-1],a=r[0];if(l){const c=a.search(/\S/),d=t.from+a.indexOf(l),u=d+l.length;if(zi(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&s.delete(u,t.to),d>t.from&&s.delete(t.from+c,d);const p=t.from+c+l.length;s.addMark(t.from+c,p,n.type.create(o||{})),s.removeStoredMark(n.type)}},undoable:n.undoable})}function Mf(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=ke(n.getAttributes,void 0,r)||{},{tr:s}=e,l=t.from;let a=t.to;const c=n.type.create(o);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=l+d;u>a?u=a:a=u+r[1].length;const f=r[0][r[0].length-1];s.insertText(f,l+r[0].length-1),s.replaceWith(u,a,c)}else if(r[0]){const d=n.type.isInline?l:l-1;s.insert(d,n.type.create(o)).delete(s.mapping.map(l),s.mapping.map(a))}s.scrollIntoView()},undoable:n.undoable})}function qi(n){return new vs({find:n.find,handler:({state:e,range:t,match:r})=>{const o=e.doc.resolve(t.from),s=ke(n.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)},undoable:n.undoable})}function Or(n){return new vs({find:n.find,handler:({state:e,range:t,match:r,chain:o})=>{const s=ke(n.getAttributes,void 0,r)||{},l=e.tr.delete(t.from,t.to),c=l.doc.resolve(t.from).blockRange(),d=c&&ql(c,n.type,s);if(!d)return null;if(l.wrap(c,d),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));l.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(f,s).run()}const u=l.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Tn(l.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,u))&&l.join(t.from-1)},undoable:n.undoable})}function L1(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof oe){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let o=r.depth;for(;o>=0;){const s=r.index(o);if(r.node(o).contentMatchAt(s).matchType(e))return!0;o-=1}return!1}var O1={};Li(O1,{createAtomBlockMarkdownSpec:()=>I1,createBlockMarkdownSpec:()=>D1,createInlineMarkdownSpec:()=>P1,parseAttributes:()=>Gi,parseIndentedBlocks:()=>$1,renderNestedMarkdownContent:()=>z1,serializeAttributes:()=>Ji});function Gi(n){if(!n?.trim())return{};const e={},t=[],r=n.replace(/["']([^"']*)["']/g,d=>(t.push(d),`__QUOTED_${t.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const d=o.map(u=>u.trim().slice(1));e.class=d.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(l)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[d]=h.slice(1,-1))});const c=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function Ji(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,r])=>{t==="class"||t==="id"||(r===!0?e.push(t):r!==!1&&r!=null&&e.push(`${t}="${String(r)}"`))}),e.join(" ")}function I1(n){const{nodeName:e,name:t,parseAttributes:r=Gi,serializeAttributes:o=Ji,defaultAttributes:s={},requiredAttributes:l=[],allowedAttributes:a}=n,c=t||e,d=u=>{if(!a)return u;const f={};return a.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...s,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const g=m[1]||"",y=r(g);if(!l.find(k=>!(k in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=o(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function D1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:o=Gi,serializeAttributes:s=Ji,defaultAttributes:l={},content:a="block",allowedAttributes:c}=n,d=t||e,u=f=>{if(!c)return f;const p={};return c.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(r){const g=r(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...l,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,k=""]=y,E=o(k);let x=1;const C=b.length;let _="";const w=/^:::([\w-]*)(\s.*)?/gm,T=f.slice(C);for(w.lastIndex=0;;){const D=w.exec(T);if(D===null)break;const R=D.index,A=D[1];if(!((m=D[2])!=null&&m.endsWith(":::"))){if(A)x+=1;else if(x-=1,x===0){const B=T.slice(0,R);_=B.trim();const U=f.slice(0,C+R+D[0].length);let Y=[];if(_)if(a==="block")for(Y=h.blockTokens(B),Y.forEach(O=>{O.text&&(!O.tokens||O.tokens.length===0)&&(O.tokens=h.inlineTokens(O.text))});Y.length>0;){const O=Y[Y.length-1];if(O.type==="paragraph"&&(!O.text||O.text.trim()===""))Y.pop();else break}else Y=h.inlineTokens(_);return{type:e,raw:U,attributes:E,content:_,tokens:Y}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=s(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
86
+
87
+ `);return`:::${d}${g}
88
+
89
+ ${y}
90
+
91
+ :::`}}}function R1(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=t.exec(n);for(;r!==null;){const[,o,s,l]=r;e[o]=s||l,r=t.exec(n)}return e}function F1(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function P1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:o=R1,serializeAttributes:s=F1,defaultAttributes:l={},selfClosing:a=!1,allowedAttributes:c}=n,d=t||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{m in p&&(h[m]=p[m])}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...l,...p.attributes};if(a)return h.createNode(e,m);const g=r?r(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=a?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m?.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=a?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",k="";if(a){const[,x]=y;k=x}else{const[,x,C]=y;k=x,b=C||""}const E=o(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:E}}},renderMarkdown:p=>{let h="";r?h=r(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=u(p.attrs||{}),g=s(m),y=g?` ${g}`:"";return a?`[${d}${y}]`:`[${d}${y}]${h}[/${d}]`}}}function $1(n,e,t){var r,o,s,l;const a=n.split(`
92
+ `),c=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<a.length;){const p=a[u],h=p.match(e.itemPattern);if(!h){if(c.length>0)break;if(p.trim()===""){u+=1;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;d=`${d}${p}
93
+ `;const b=[y];for(u+=1;u<a.length;){const C=a[u];if(C.trim()===""){const w=a.slice(u+1).findIndex(R=>R.trim()!=="");if(w===-1)break;if((((o=(r=a[u+1+w].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>g){b.push(C),d=`${d}${C}
94
+ `,u+=1;continue}else break}if((((l=(s=C.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:l.length)||0)>g)b.push(C),d=`${d}${C}
95
+ `,u+=1;else break}let k;const E=b.slice(1);if(E.length>0){const C=E.map(_=>_.slice(g+f)).join(`
96
+ `);C.trim()&&(e.customNestedParser?k=e.customNestedParser(C):k=t.blockTokens(C))}const x=e.createToken(m,k);c.push(x)}if(c.length!==0)return{items:c,raw:d.trim()}}function z1(n,e,t,r){if(!n||!Array.isArray(n.content))return"";const o=typeof t=="function"?t(r):t,[s,...l]=n.content,a=e.renderChildren([s]),c=[`${o}${a}`];return l&&l.length>0&&l.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
97
+ `).map(p=>p?e.indent(p):"").join(`
98
+ `);c.push(f)}}),c.join(`
99
+ `)}function H1(n,e,t={}){const{state:r}=e,{doc:o,tr:s}=r,l=n;o.descendants((a,c)=>{const d=s.mapping.map(c),u=s.mapping.map(c)+a.nodeSize;let f=null;if(a.marks.forEach(h=>{if(h!==l)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});s.removeMark(d,u,n.type),s.addMark(d,u,h)}}),s.docChanged&&e.view.dispatch(s)}var Ue=class jm extends Ki{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new jm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function $n(n){return new C1({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:o})=>{const s=ke(n.getAttributes,void 0,r,o);if(s===!1||s===null)return null;const{tr:l}=e,a=r[r.length-1],c=r[0];let d=t.to;if(a){const u=c.search(/\S/),f=t.from+c.indexOf(a),p=f+a.length;if(zi(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&l.delete(p,t.to),f>t.from&&l.delete(t.from+u,f),d=t.from+u+a.length,l.addMark(t.from+u,d,n.type.create(s||{})),l.removeStoredMark(n.type)}}})}function Tf(n){return i.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var j1=class extends V1{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=Tf(this.view.state),this.reactiveExtensionStorage=Tf(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,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(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},Af=i.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=i.ref(),t=i.getCurrentInstance();return i.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&i.nextTick(()=>{var o;if(!e.value||!((o=r.view.dom)!=null&&o.firstChild))return;const s=i.unref(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:s}),r.createNodeViews()})}),i.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return i.h("div",{ref:n=>{this.rootEl=n}})}});i.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return i.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),i.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return i.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var U1=(n={})=>{const e=i.shallowRef();return i.onMounted(()=>{e.value=new j1(n)}),i.onBeforeUnmount(()=>{var t,r,o;const s=(t=e.value)==null?void 0:t.view.dom,l=s?.cloneNode(!0);(r=s?.parentNode)==null||r.replaceChild(l,s),(o=e.value)==null||o.destroy()}),e};i.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return i.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var W1=20,Bf=(n,e=0)=>{const t=[];return!n.children.length||e>W1||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...Bf(r,e+1))}),t},K1=n=>{if(!n.children.length)return;const e=Bf(n);e&&e.forEach(t=>{var r,o;const s=t.getAttribute("style"),l=(o=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:o.getAttribute("style");t.setAttribute("style",`${l};${s}`)})},Yi=Ht.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&K1(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",we(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(o=>o.type===this.type).some(o=>Object.values(o.attrs).some(s=>!!s))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),q1=Ce.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(l==="background-color")return a.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),G1=Ce.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){const s=r[o].split(":");if(s.length>=2){const l=s[0].trim().toLowerCase(),a=s.slice(1).join(":").trim();if(l==="color")return a.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),J1=Ce.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Y1=Ce.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),X1=Ce.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),Z1=Ce.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(q1.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(G1.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(J1.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(Y1.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(X1.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(Yi.configure(this.options.textStyle)),n}}),Xi,Zi;if(typeof WeakMap<"u"){let n=new WeakMap;Xi=e=>n.get(e),Zi=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Xi=r=>{for(let o=0;o<n.length;o+=2)if(n[o]==r)return n[o+1]},Zi=(r,o)=>(t==10&&(t=0),n[t++]=r,n[t++]=o)}var Re=class{constructor(n,e,t,r){this.width=n,this.height=e,this.map=t,this.problems=r}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const r=e%this.width,o=e/this.width|0;let s=r+1,l=o+1;for(let a=1;s<this.width&&this.map[e+a]==t;a++)s++;for(let a=1;l<this.height&&this.map[e+this.width*a]==t;a++)l++;return{left:r,top:o,right:s,bottom:l}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:r,right:o,top:s,bottom:l}=this.findCell(n);return e=="horiz"?(t<0?r==0:o==this.width)?null:this.map[s*this.width+(t<0?r-1:o)]:(t<0?s==0:l==this.height)?null:this.map[r+this.width*(t<0?s-1:l)]}rectBetween(n,e){const{left:t,right:r,top:o,bottom:s}=this.findCell(n),{left:l,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(t,l),top:Math.min(o,c),right:Math.max(r,a),bottom:Math.max(s,d)}}cellsInRect(n){const e=[],t={};for(let r=n.top;r<n.bottom;r++)for(let o=n.left;o<n.right;o++){const s=r*this.width+o,l=this.map[s];t[l]||(t[l]=!0,!(o==n.left&&o&&this.map[s-1]==l||r==n.top&&r&&this.map[s-this.width]==l)&&e.push(l))}return e}positionAt(n,e,t){for(let r=0,o=0;;r++){const s=o+t.child(r).nodeSize;if(r==n){let l=e+n*this.width;const a=(n+1)*this.width;for(;l<a&&this.map[l]<o;)l++;return l==a?s-1:this.map[l]}o=s}}static get(n){return Xi(n)||Zi(n,Q1(n))}};function Q1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=ek(n),t=n.childCount,r=[];let o=0,s=null;const l=[];for(let d=0,u=e*t;d<u;d++)r[d]=0;for(let d=0,u=0;d<t;d++){const f=n.child(d);u++;for(let m=0;;m++){for(;o<r.length&&r[o]!=0;)o++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let E=0;E<b;E++){if(E+d>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-E});break}const x=o+E*e;for(let C=0;C<y;C++){r[x+C]==0?r[x+C]=u:(s||(s=[])).push({type:"collision",row:d,pos:u,n:y-C});const _=k&&k[C];if(_){const w=(x+C)%e*2,T=l[w];T==null||T!=_&&l[w+1]==1?(l[w]=_,l[w+1]=1):T==_&&l[w+1]++}}}o+=y,u+=g.nodeSize}const p=(d+1)*e;let h=0;for(;o<p;)r[o++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:d,n:h}),u++}(e===0||t===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Re(e,t,r,s);let c=!1;for(let d=0;!c&&d<l.length;d+=2)l[d]!=null&&l[d+1]<t&&(c=!0);return c&&tk(a,l,n),a}function ek(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const o=n.child(r);let s=0;if(t)for(let l=0;l<r;l++){const a=n.child(l);for(let c=0;c<a.childCount;c++){const d=a.child(c);l+d.attrs.rowspan>r&&(s+=d.attrs.colspan)}}for(let l=0;l<o.childCount;l++){const a=o.child(l);s+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function tk(n,e,t){n.problems||(n.problems=[]);const r={};for(let o=0;o<n.map.length;o++){const s=n.map[o];if(r[s])continue;r[s]=!0;const l=t.nodeAt(s);if(!l)throw new RangeError(`No cell with offset ${s} found`);let a=null;const c=l.attrs;for(let d=0;d<c.colspan;d++){const u=(o+d)%n.width,f=e[u*2];f!=null&&(!c.colwidth||c.colwidth[d]!=f)&&((a||(a=nk(c)))[d]=f)}a&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function nk(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function at(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var zn=new $e("selectingCells");function Ir(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function rk(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function jt(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Ts(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Ir(e.$head)||ok(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function ok(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Qi(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function sk(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function ea(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function Vf(n,e,t){const r=n.node(-1),o=Re.get(r),s=n.start(-1),l=o.nextCell(n.pos-s,e,t);return l==null?null:n.node(0).resolve(s+l)}function fr(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function Lf(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<t;o++)r.colwidth.splice(e,0,0)}return r}function lk(n,e,t){const r=at(e.type.schema).header_cell;for(let o=0;o<n.height;o++)if(e.nodeAt(n.map[t+o*n.width]).type!=r)return!1;return!0}var Te=class _n extends le{constructor(e,t=e){const r=e.node(-1),o=Re.get(r),s=e.start(-1),l=o.rectBetween(e.pos-s,t.pos-s),a=e.node(0),c=o.cellsInRect(l).filter(u=>u!=t.pos-s);c.unshift(t.pos-s);const d=c.map(u=>{const f=r.nodeAt(u);if(!f)throw RangeError(`No cell with offset ${u} found`);const p=s+u+1;return new ud(a.resolve(p),a.resolve(p+f.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),o=e.resolve(t.map(this.$headCell.pos));if(Qi(r)&&Qi(o)&&ea(r,o)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?_n.rowSelection(r,o):s&&this.isColSelection()?_n.colSelection(r,o):new _n(r,o)}return se.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=Re.get(e),r=this.$anchorCell.start(-1),o=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},l=[];for(let c=o.top;c<o.bottom;c++){const d=[];for(let u=c*t.width+o.left,f=o.left;f<o.right;f++,u++){const p=t.map[u];if(s[p])continue;s[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw RangeError(`No cell with offset ${p} found`);const g=o.left-h.left,y=h.right-o.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=fr(b,0,g)),y>0&&(b=fr(b,b.colspan-y,y)),h.left<o.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<o.top||h.bottom>o.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}l.push(e.child(c).copy(F.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new J(F.from(a),1,1)}replace(e,t=J.empty){const r=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){const{$from:a,$to:c}=o[l],d=e.mapping.slice(r);e.replace(d.map(a.pos),d.map(c.pos),l?J.empty:t)}const s=le.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,t){this.replace(e,new J(F.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=Re.get(t),o=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let l=0;l<s.length;l++)e(t.nodeAt(s[l]),o+s[l])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),o=Re.get(r),s=e.start(-1),l=o.findCell(e.pos-s),a=o.findCell(t.pos-s),c=e.node(0);return l.top<=a.top?(l.top>0&&(e=c.resolve(s+o.map[l.left])),a.bottom<o.height&&(t=c.resolve(s+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(t=c.resolve(s+o.map[a.left])),l.bottom<o.height&&(e=c.resolve(s+o.map[o.width*(o.height-1)+l.right-1]))),new _n(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Re.get(e),r=this.$anchorCell.start(-1),o=t.colCount(this.$anchorCell.pos-r),s=t.colCount(this.$headCell.pos-r);if(Math.min(o,s)>0)return!1;const l=o+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,a)==t.width}eq(e){return e instanceof _n&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),o=Re.get(r),s=e.start(-1),l=o.findCell(e.pos-s),a=o.findCell(t.pos-s),c=e.node(0);return l.left<=a.left?(l.left>0&&(e=c.resolve(s+o.map[l.top*o.width])),a.right<o.width&&(t=c.resolve(s+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(t=c.resolve(s+o.map[a.top*o.width])),l.right<o.width&&(e=c.resolve(s+o.map[o.width*(l.top+1)-1]))),new _n(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new _n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new _n(e.resolve(t),e.resolve(r))}getBookmark(){return new ik(this.$anchorCell.pos,this.$headCell.pos)}};Te.prototype.visible=!1,le.jsonID("cell",Te);var ik=class Um{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Um(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&ea(t,r)?new Te(t,r):le.near(r,1)}};function ak(n){if(!(n.selection instanceof Te))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(Ye.node(r,r+t.nodeSize,{class:"selectedCell"}))}),Me.create(n.doc,e)}function ck({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,o=n.depth;for(;o>=0&&!(n.after(o+1)<n.end(o));o--,t++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return t==r&&/row|table/.test(n.node(o).type.spec.tableRole)}function dk({$from:n,$to:e}){let t,r;for(let o=n.depth;o>0;o--){const s=n.node(o);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){t=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 t!==r&&e.parentOffset===0}function uk(n,e,t){const r=(e||n).selection,o=(e||n).doc;let s,l;if(r instanceof oe&&(l=r.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")s=Te.create(o,r.from);else if(l=="row"){const a=o.resolve(r.from+1);s=Te.rowSelection(a,a)}else if(!t){const a=Re.get(r.node),c=r.from+1,d=c+a.map[a.width*a.height-1];s=Te.create(o,c+1,d)}}else r instanceof se&&ck(r)?s=se.create(o,r.from):r instanceof se&&dk(r)&&(s=se.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var fk=new $e("fix-tables");function Of(n,e,t,r){const o=n.childCount,s=e.childCount;e:for(let l=0,a=0;l<s;l++){const c=e.child(l);for(let d=a,u=Math.min(o,l+3);d<u;d++)if(n.child(d)==c){a=d+1,t+=c.nodeSize;continue e}r(c,t),a<o&&n.child(a).sameMarkup(c)?Of(n.child(a),c,t+1,r):c.nodesBetween(0,c.content.size,r,t+1),t+=c.nodeSize}}function If(n,e){let t;const r=(o,s)=>{o.type.spec.tableRole=="table"&&(t=pk(n,o,s,t))};return e?e.doc!=n.doc&&Of(e.doc,n.doc,0,r):n.doc.descendants(r),t}function pk(n,e,t,r){const o=Re.get(e);if(!o.problems)return r;r||(r=n.tr);const s=[];for(let c=0;c<o.height;c++)s.push(0);for(let c=0;c<o.problems.length;c++){const d=o.problems[c];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const f=u.attrs;for(let p=0;p<f.rowspan;p++)s[d.row+p]+=d.n;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,fr(f,f.colspan-d.n,d.n))}else if(d.type=="missing")s[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let l,a;for(let c=0;c<s.length;c++)s[c]&&(l==null&&(l=c),a=c);for(let c=0,d=t+1;c<o.height;c++){const u=e.child(c),f=d+u.nodeSize,p=s[c];if(p>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=at(n.schema)[h].createAndFill();b&&m.push(b)}const g=(c==0||l==c-1)&&a==c?d+1:f-1;r.insert(r.mapping.map(g),m)}d=f}return r.setMeta(fk,{fixTables:!0})}function Xt(n){const e=n.selection,t=Ts(n),r=t.node(-1),o=t.start(-1),s=Re.get(r);return{...e instanceof Te?s.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):s.findCell(t.pos-o),tableStart:o,map:s,table:r}}function Df(n,{map:e,tableStart:t,table:r},o){let s=o>0?-1:0;lk(e,r,o+s)&&(s=o==0||o==e.width?null:0);for(let l=0;l<e.height;l++){const a=l*e.width+o;if(o>0&&o<e.width&&e.map[a-1]==e.map[a]){const c=e.map[a],d=r.nodeAt(c);n.setNodeMarkup(n.mapping.map(t+c),null,Lf(d.attrs,o-e.colCount(c))),l+=d.attrs.rowspan-1}else{const c=s==null?at(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,d=e.positionAt(l,o,r);n.insert(n.mapping.map(t+d),c.createAndFill())}}return n}function hk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Df(n.tr,t,t.left))}return!0}function mk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Df(n.tr,t,t.right))}return!0}function gk(n,{map:e,table:t,tableStart:r},o){const s=n.mapping.maps.length;for(let l=0;l<e.height;){const a=l*e.width+o,c=e.map[a],d=t.nodeAt(c),u=d.attrs;if(o>0&&e.map[a-1]==c||o<e.width-1&&e.map[a+1]==c)n.setNodeMarkup(n.mapping.slice(s).map(r+c),null,fr(u,o-e.colCount(c)));else{const f=n.mapping.slice(s).map(r+c);n.delete(f,f+d.nodeSize)}l+=u.rowspan}}function yk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let o=t.right-1;gk(r,t,o),o!=t.left;o--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=Re.get(s)}e(r)}return!0}function bk(n,e,t){var r;const o=at(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(((r=e.nodeAt(n.map[s+t*n.width]))==null?void 0:r.type)!=o)return!1;return!0}function Rf(n,{map:e,tableStart:t,table:r},o){var s;let l=t;for(let d=0;d<o;d++)l+=r.child(d).nodeSize;const a=[];let c=o>0?-1:0;bk(e,r,o+c)&&(c=o==0||o==e.height?null:0);for(let d=0,u=e.width*o;d<e.width;d++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){const f=e.map[u],p=r.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),d+=p.colspan-1}else{const f=c==null?at(r.type.schema).cell:(s=r.nodeAt(e.map[u+c*e.width]))==null?void 0:s.type,p=f?.createAndFill();p&&a.push(p)}return n.insert(l,at(r.type.schema).row.create(null,a)),n}function kk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Rf(n.tr,t,t.top))}return!0}function xk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Rf(n.tr,t,t.bottom))}return!0}function wk(n,{map:e,table:t,tableStart:r},o){let s=0;for(let d=0;d<o;d++)s+=t.child(d).nodeSize;const l=s+t.child(o).nodeSize,a=n.mapping.maps.length;n.delete(s+r,l+r);const c=new Set;for(let d=0,u=o*e.width;d<e.width;d++,u++){const f=e.map[u];if(!c.has(f)){if(c.add(f),o>0&&f==e.map[u-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,{...p,rowspan:p.rowspan-1}),d+=p.colspan-1}else if(o<e.height&&f==e.map[u+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(o+1,d,t);n.insert(n.mapping.slice(a).map(r+g),m),d+=h.colspan-1}}}}function Ek(n,e){if(!jt(n))return!1;if(e){const t=Xt(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let o=t.bottom-1;wk(r,t,o),o!=t.top;o--){const s=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!s)throw RangeError("No table found");t.table=s,t.map=Re.get(t.table)}e(r)}return!0}function Ff(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Ck({width:n,height:e,map:t},r){let o=r.top*n+r.left,s=o,l=(r.bottom-1)*n+r.left,a=o+(r.right-r.left-1);for(let c=r.top;c<r.bottom;c++){if(r.left>0&&t[s]==t[s-1]||r.right<n&&t[a]==t[a+1])return!0;s+=n,a+=n}for(let c=r.left;c<r.right;c++){if(r.top>0&&t[o]==t[o-n]||r.bottom<e&&t[l]==t[l+n])return!0;o++,l++}return!1}function Pf(n,e){const t=n.selection;if(!(t instanceof Te)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=Xt(n),{map:o}=r;if(Ck(o,r))return!1;if(e){const s=n.tr,l={};let a=F.empty,c,d;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){const p=o.map[u*o.width+f],h=r.table.nodeAt(p);if(!(l[p]||!h))if(l[p]=!0,c==null)c=p,d=h;else{Ff(h)||(a=a.append(h.content));const m=s.mapping.map(p+r.tableStart);s.delete(m,m+h.nodeSize)}}if(c==null||d==null)return!0;if(s.setNodeMarkup(c+r.tableStart,null,{...Lf(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const u=c+1+d.content.size,f=Ff(d)?c+1:u;s.replaceWith(f+r.tableStart,u+r.tableStart,a)}s.setSelection(new Te(s.doc.resolve(c+r.tableStart))),e(s)}return!0}function $f(n,e){const t=at(n.schema);return vk(({node:r})=>t[r.type.spec.tableRole])(n,e)}function vk(n){return(e,t)=>{var r;const o=e.selection;let s,l;if(o instanceof Te){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;s=o.$anchorCell.nodeAfter,l=o.$anchorCell.pos}else{if(s=rk(o.$from),!s)return!1;l=(r=Ir(o.$from))==null?void 0:r.pos}if(s==null||l==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let a=s.attrs;const c=[],d=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=Xt(e),f=e.tr;for(let h=0;h<u.right-u.left;h++)c.push(d?{...a,colwidth:d&&d[h]?[d[h]]:null}:a);let p;for(let h=u.top;h<u.bottom;h++){let m=u.map.positionAt(h,u.left,u.table);h==u.top&&(m+=s.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&h==u.top||f.insert(p=f.mapping.map(m+u.tableStart,1),n({node:s,row:h,col:g}).createAndFill(c[y]))}f.setNodeMarkup(l,n({node:s,row:u.top,col:u.left}),c[0]),o instanceof Te&&f.setSelection(new Te(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function _k(n,e){return function(t,r){if(!jt(t))return!1;const o=Ts(t);if(o.nodeAfter.attrs[n]===e)return!1;if(r){const s=t.tr;t.selection instanceof Te?t.selection.forEachCell((l,a)=>{l.attrs[n]!==e&&s.setNodeMarkup(a,null,{...l.attrs,[n]:e})}):s.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[n]:e}),r(s)}return!0}}function Sk(n){return function(e,t){if(!jt(e))return!1;if(t){const r=at(e.schema),o=Xt(e),s=e.tr,l=o.map.cellsInRect(n=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:n=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=l.map(c=>o.table.nodeAt(c));for(let c=0;c<l.length;c++)a[c].type==r.header_cell&&s.setNodeMarkup(o.tableStart+l[c],r.cell,a[c].attrs);if(s.steps.length==0)for(let c=0;c<l.length;c++)s.setNodeMarkup(o.tableStart+l[c],r.header_cell,a[c].attrs);t(s)}return!0}}function zf(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let o=0;o<r.length;o++){const s=e.table.nodeAt(r[o]);if(s&&s.type!==t.header_cell)return!1}return!0}function ho(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Sk(n):function(t,r){if(!jt(t))return!1;if(r){const o=at(t.schema),s=Xt(t),l=t.tr,a=zf("row",s,o),c=zf("column",s,o),u=(n==="column"?a:n==="row"?c:!1)?1:0,f=n=="column"?{left:0,top:u,right:1,bottom:s.map.height}:n=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,p=n=="column"?c?o.cell:o.header_cell:n=="row"?a?o.cell:o.header_cell:o.cell;s.map.cellsInRect(f).forEach(h=>{const m=h+s.tableStart,g=l.doc.nodeAt(m);g&&l.setNodeMarkup(m,p,g.attrs)}),r(l)}return!0}}ho("row",{useDeprecatedLogic:!0}),ho("column",{useDeprecatedLogic:!0});var Nk=ho("cell",{useDeprecatedLogic:!0});function Mk(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,o=n.before();r>=0;r--){const s=n.node(-1).child(r),l=s.lastChild;if(l)return o-1-l.nodeSize;o-=s.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),o=n.after();r<t.childCount;r++){const s=t.child(r);if(s.childCount)return o+1;o+=s.nodeSize}}return null}function Hf(n){return function(e,t){if(!jt(e))return!1;const r=Mk(Ts(e),n);if(r==null)return!1;if(t){const o=e.doc.resolve(r);t(e.tr.setSelection(se.between(o,sk(o))).scrollIntoView())}return!0}}function Tk(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function As(n,e){const t=n.selection;if(!(t instanceof Te))return!1;if(e){const r=n.tr,o=at(n.schema).cell.createAndFill().content;t.forEachCell((s,l)=>{s.content.eq(o)||r.replace(r.mapping.map(l+1),r.mapping.map(l+s.nodeSize-1),new J(o,0,0))}),r.docChanged&&e(r)}return!0}function Ak(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const o=e.child(0),s=o.type.spec.tableRole,l=o.type.schema,a=[];if(s=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const u=c?0:Math.max(0,t-1),f=c<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(d=ta(at(l).row,new J(d,u,f)).content),a.push(d)}else if(s=="cell"||s=="header_cell")a.push(t||r?ta(at(l).row,new J(e,t,r)).content:e);else return null;return Bk(l,a)}function Bk(n,e){const t=[];for(let o=0;o<e.length;o++){const s=e[o];for(let l=s.childCount-1;l>=0;l--){const{rowspan:a,colspan:c}=s.child(l).attrs;for(let d=o;d<o+a;d++)t[d]=(t[d]||0)+c}}let r=0;for(let o=0;o<t.length;o++)r=Math.max(r,t[o]);for(let o=0;o<t.length;o++)if(o>=e.length&&e.push(F.empty),t[o]<r){const s=at(n).cell.createAndFill(),l=[];for(let a=t[o];a<r;a++)l.push(s);e[o]=e[o].append(F.from(l))}return{height:e.length,width:r,rows:e}}function ta(n,e){const t=n.createAndFill();return new Yl(t).replace(0,t.content.size,e).doc}function Vk({width:n,height:e,rows:t},r,o){if(n!=r){const s=[],l=[];for(let a=0;a<t.length;a++){const c=t[a],d=[];for(let u=s[a]||0,f=0;u<r;f++){let p=c.child(f%c.childCount);u+p.attrs.colspan>r&&(p=p.type.createChecked(fr(p.attrs,p.attrs.colspan,u+p.attrs.colspan-r),p.content)),d.push(p),u+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)s[a+h]=(s[a+h]||0)+p.attrs.colspan}l.push(F.from(d))}t=l,n=r}if(e!=o){const s=[];for(let l=0,a=0;l<o;l++,a++){const c=[],d=t[a%e];for(let u=0;u<d.childCount;u++){let f=d.child(u);l+f.attrs.rowspan>o&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,o-f.attrs.rowspan)},f.content)),c.push(f)}s.push(F.from(c))}t=s,e=o}return{width:n,height:e,rows:t}}function Lk(n,e,t,r,o,s,l){const a=n.doc.type.schema,c=at(a);let d,u;if(o>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=u||(u=c.header_cell.createAndFill());for(let y=e.width;y<o;y++)m.push(g);n.insert(n.mapping.slice(l).map(p-1+r),m)}if(s>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,o);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==c.header_cell;f.push(y?u||(u=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const p=c.row.create(null,F.from(f)),h=[];for(let m=e.height;m<s;m++)h.push(p);n.insert(n.mapping.slice(l).map(r+t.nodeSize-2),h)}return!!(d||u)}function jf(n,e,t,r,o,s,l,a){if(l==0||l==e.height)return!1;let c=!1;for(let d=o;d<s;d++){const u=l*e.width+d,f=e.map[u];if(e.map[u-e.width]==f){c=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,{...p.attrs,rowspan:l-h}),n.insert(n.mapping.slice(a).map(e.positionAt(l,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-l})),d+=p.attrs.colspan-1}}return c}function Uf(n,e,t,r,o,s,l,a){if(l==0||l==e.width)return!1;let c=!1;for(let d=o;d<s;d++){const u=d*e.width+l,f=e.map[u];if(e.map[u-1]==f){c=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(a).map(f+r);n.setNodeMarkup(m,null,fr(p.attrs,l-h,p.attrs.colspan-(l-h))),n.insert(m+p.nodeSize,p.type.createAndFill(fr(p.attrs,0,l-h))),d+=p.attrs.rowspan-1}}return c}function Wf(n,e,t,r,o){let s=t?n.doc.nodeAt(t-1):n.doc;if(!s)throw new Error("No table found");let l=Re.get(s);const{top:a,left:c}=r,d=c+o.width,u=a+o.height,f=n.tr;let p=0;function h(){if(s=t?f.doc.nodeAt(t-1):f.doc,!s)throw new Error("No table found");l=Re.get(s),p=f.mapping.maps.length}Lk(f,l,s,t,d,u,p)&&h(),jf(f,l,s,t,c,d,a,p)&&h(),jf(f,l,s,t,c,d,u,p)&&h(),Uf(f,l,s,t,a,u,c,p)&&h(),Uf(f,l,s,t,a,u,d,p)&&h();for(let m=a;m<u;m++){const g=l.positionAt(m,c,s),y=l.positionAt(m,d,s);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new J(o.rows[m-a],0,0))}h(),f.setSelection(new Te(f.doc.resolve(t+l.positionAt(a,c,s)),f.doc.resolve(t+l.positionAt(u-1,d-1,s)))),e(f)}var Ok=Vi({ArrowLeft:Vs("horiz",-1),ArrowRight:Vs("horiz",1),ArrowUp:Vs("vert",-1),ArrowDown:Vs("vert",1),"Shift-ArrowLeft":Ls("horiz",-1),"Shift-ArrowRight":Ls("horiz",1),"Shift-ArrowUp":Ls("vert",-1),"Shift-ArrowDown":Ls("vert",1),Backspace:As,"Mod-Backspace":As,Delete:As,"Mod-Delete":As});function Bs(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Vs(n,e){return(t,r,o)=>{if(!o)return!1;const s=t.selection;if(s instanceof Te)return Bs(t,r,le.near(s.$headCell,e));if(n!="horiz"&&!s.empty)return!1;const l=Kf(o,n,e);if(l==null)return!1;if(n=="horiz")return Bs(t,r,le.near(t.doc.resolve(s.head+e),e));{const a=t.doc.resolve(l),c=Vf(a,n,e);let d;return c?d=le.near(c,1):e<0?d=le.near(t.doc.resolve(a.before(-1)),-1):d=le.near(t.doc.resolve(a.after(-1)),1),Bs(t,r,d)}}}function Ls(n,e){return(t,r,o)=>{if(!o)return!1;const s=t.selection;let l;if(s instanceof Te)l=s;else{const c=Kf(o,n,e);if(c==null)return!1;l=new Te(t.doc.resolve(c))}const a=Vf(l.$headCell,n,e);return a?Bs(t,r,new Te(l.$anchorCell,a)):!1}}function Ik(n,e){const t=n.state.doc,r=Ir(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new Te(r))),!0):!1}function Dk(n,e,t){if(!jt(n.state))return!1;let r=Ak(t);const o=n.state.selection;if(o instanceof Te){r||(r={width:1,height:1,rows:[F.from(ta(at(n.state.schema).cell,t))]});const s=o.$anchorCell.node(-1),l=o.$anchorCell.start(-1),a=Re.get(s).rectBetween(o.$anchorCell.pos-l,o.$headCell.pos-l);return r=Vk(r,a.right-a.left,a.bottom-a.top),Wf(n.state,n.dispatch,l,a,r),!0}else if(r){const s=Ts(n.state),l=s.start(-1);return Wf(n.state,n.dispatch,l,Re.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function Rk(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=qf(n,e.target);let o;if(e.shiftKey&&n.state.selection instanceof Te)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Ir(n.state.selection.$anchor))!=null&&((t=na(n,e))==null?void 0:t.pos)!=o.pos)s(o,e),e.preventDefault();else if(!r)return;function s(c,d){let u=na(n,d);const f=zn.getState(n.state)==null;if(!u||!ea(c,u))if(f)u=c;else return;const p=new Te(c,u);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(zn,c.pos),n.dispatch(h)}}function l(){n.root.removeEventListener("mouseup",l),n.root.removeEventListener("dragstart",l),n.root.removeEventListener("mousemove",a),zn.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(zn,-1))}function a(c){const d=c,u=zn.getState(n.state);let f;if(u!=null)f=n.state.doc.resolve(u);else if(qf(n,d.target)!=r&&(f=na(n,e),!f))return l();f&&s(f,d)}n.root.addEventListener("mouseup",l),n.root.addEventListener("dragstart",l),n.root.addEventListener("mousemove",a)}function Kf(n,e,t){if(!(n.state.selection instanceof se))return null;const{$head:r}=n.state.selection;for(let o=r.depth-1;o>=0;o--){const s=r.node(o);if((t<0?r.index(o):r.indexAfter(o))!=(t<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const a=r.before(o),c=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(c)?a:null}}return null}function qf(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function na(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?Ir(n.state.doc.resolve(t.pos)):null}var Fk=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),ra(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,ra(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function ra(n,e,t,r,o,s){var l;let a=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g++,p++){const y=o==p?s:m&&m[g],b=y?y+"px":"";if(a+=y||r,y||(c=!1),d)d.style.width!=b&&(d.style.width=b),d=d.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;d;){const f=d.nextSibling;(l=d.parentNode)==null||l.removeChild(d),d=f}c?(t.style.width=a+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=a+"px")}}var _t=new $e("tableColumnResizing");function Pk({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=Fk,lastColumnResizable:o=!0}={}){const s=new Oe({key:_t,state:{init(l,a){var c,d;const u=(d=(c=s.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,f=at(a.schema).table.name;return r&&u&&(u[f]=(p,h)=>new r(p,t,h)),new $k(-1,!1)},apply(l,a){return a.apply(l)}},props:{attributes:l=>{const a=_t.getState(l);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,a)=>{zk(l,a,n,o)},mouseleave:l=>{Hk(l)},mousedown:(l,a)=>{jk(l,a,e,t)}},decorations:l=>{const a=_t.getState(l);if(a&&a.activeHandle>-1)return Gk(l,a.activeHandle)},nodeViews:{}}});return s}var $k=class Rl{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(_t);if(r&&r.setHandle!=null)return new Rl(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Rl(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let o=e.mapping.map(t.activeHandle,-1);return Qi(e.doc.resolve(o))||(o=-1),new Rl(o,t.dragging)}return t}};function zk(n,e,t,r){if(!n.editable)return;const o=_t.getState(n.state);if(o&&!o.dragging){const s=Wk(e.target);let l=-1;if(s){const{left:a,right:c}=s.getBoundingClientRect();e.clientX-a<=t?l=Gf(n,e,"left",t):c-e.clientX<=t&&(l=Gf(n,e,"right",t))}if(l!=o.activeHandle){if(!r&&l!==-1){const a=n.state.doc.resolve(l),c=a.node(-1),d=Re.get(c),u=a.start(-1);if(d.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==d.width-1)return}Yf(n,l)}}}function Hk(n){if(!n.editable)return;const e=_t.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Yf(n,-1)}function jk(n,e,t,r){var o;if(!n.editable)return!1;const s=(o=n.dom.ownerDocument.defaultView)!=null?o:window,l=_t.getState(n.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const a=n.state.doc.nodeAt(l.activeHandle),c=Uk(n,l.activeHandle,a.attrs);n.dispatch(n.state.tr.setMeta(_t,{setDragging:{startX:e.clientX,startWidth:c}}));function d(f){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",u);const p=_t.getState(n.state);p?.dragging&&(Kk(n,p.activeHandle,Jf(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(_t,{setDragging:null})))}function u(f){if(!f.which)return d(f);const p=_t.getState(n.state);if(p&&p.dragging){const h=Jf(p.dragging,f,t);Xf(n,p.activeHandle,h,r)}}return Xf(n,l.activeHandle,c,r),s.addEventListener("mouseup",d),s.addEventListener("mousemove",u),e.preventDefault(),!0}function Uk(n,e,{colspan:t,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const s=n.domAtPos(e);let a=s.node.childNodes[s.offset].offsetWidth,c=t;if(r)for(let d=0;d<t;d++)r[d]&&(a-=r[d],c--);return a/c}function Wk(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function Gf(n,e,t,r){const o=t=="right"?-r:r,s=n.posAtCoords({left:e.clientX+o,top:e.clientY});if(!s)return-1;const{pos:l}=s,a=Ir(n.state.doc.resolve(l));if(!a)return-1;if(t=="right")return a.pos;const c=Re.get(a.node(-1)),d=a.start(-1),u=c.map.indexOf(a.pos-d);return u%c.width==0?-1:d+c.map[u-1]}function Jf(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Yf(n,e){n.dispatch(n.state.tr.setMeta(_t,{setHandle:e}))}function Kk(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),s=Re.get(o),l=r.start(-1),a=s.colCount(r.pos-l)+r.nodeAfter.attrs.colspan-1,c=n.state.tr;for(let d=0;d<s.height;d++){const u=d*s.width+a;if(d&&s.map[u]==s.map[u-s.width])continue;const f=s.map[u],p=o.nodeAt(f).attrs,h=p.colspan==1?0:a-s.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():qk(p.colspan);m[h]=t,c.setNodeMarkup(l+f,null,{...p,colwidth:m})}c.docChanged&&n.dispatch(c)}function Xf(n,e,t,r){const o=n.state.doc.resolve(e),s=o.node(-1),l=o.start(-1),a=Re.get(s).colCount(o.pos-l)+o.nodeAfter.attrs.colspan-1;let c=n.domAtPos(o.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&ra(s,c.firstChild,c,r,a,t)}function qk(n){return Array(n).fill(0)}function Gk(n,e){var t;const r=[],o=n.doc.resolve(e),s=o.node(-1);if(!s)return Me.empty;const l=Re.get(s),a=o.start(-1),c=l.colCount(o.pos-a)+o.nodeAfter.attrs.colspan-1;for(let d=0;d<l.height;d++){const u=c+d*l.width;if((c==l.width-1||l.map[u]!=l.map[u+1])&&(d==0||l.map[u]!=l.map[u-l.width])){const f=l.map[u],p=a+f+s.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",(t=_t.getState(n))!=null&&t.dragging&&r.push(Ye.node(a+f,a+f+s.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),r.push(Ye.widget(p,h))}}return Me.create(n.doc,r)}function Jk({allowTableNodeSelection:n=!1}={}){return new Oe({key:zn,state:{init(){return null},apply(e,t){const r=e.getMeta(zn);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:o,pos:s}=e.mapping.mapResult(t);return o?null:s}},props:{decorations:ak,handleDOMEvents:{mousedown:Rk},createSelectionBetween(e){return zn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Ik,handleKeyDown:Ok,handlePaste:Dk},appendTransaction(e,t,r){return uk(r,If(r,t),n)}})}var Zf=Ue.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const r=n.getAttribute("colwidth"),o=r?r.split(",").map(s=>parseInt(s,10)):null;if(!o){const s=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),l=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(l&&l>-1&&s&&s[l]){const a=s[l].getAttribute("width");return a?[parseInt(a,10)]:null}}return o}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",we(this.options.HTMLAttributes,n),0]}}),Qf=Ue.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",we(this.options.HTMLAttributes,n),0]}}),ep=Ue.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",we(this.options.HTMLAttributes,n),0]}});function oa(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function tp(n,e,t,r,o,s){var l;let a=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u!==null)for(let f=0,p=0;f<u.childCount;f+=1){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=o===p?s:m&&m[g],b=y?`${y}px`:"";if(a+=y||r,y||(c=!1),d){if(d.style.width!==b){const[k,E]=oa(r,y);d.style.setProperty(k,E)}d=d.nextSibling}else{const k=document.createElement("col"),[E,x]=oa(r,y);k.style.setProperty(E,x),e.appendChild(k)}}}for(;d;){const f=d.nextSibling;(l=d.parentNode)==null||l.removeChild(d),d=f}c?(t.style.width=`${a}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${a}px`)}var Yk=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),tp(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,tp(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(t&&!r&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function Xk(n,e,t,r){let o=0,s=!0;const l=[],a=n.firstChild;if(!a)return{};for(let f=0,p=0;f<a.childCount;f+=1){const{colspan:h,colwidth:m}=a.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=t===p?r:m&&m[g];o+=y||e,y||(s=!1);const[b,k]=oa(e,y);l.push(["col",{style:`${b}: ${k}`}])}}const c=s?`${o}px`:"",d=s?"":`${o}px`;return{colgroup:["colgroup",{},...l],tableWidth:c,tableMinWidth:d}}function np(n,e){return n.createAndFill()}function Zk(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function Qk(n,e,t,r,o){const s=Zk(n),l=[],a=[];for(let d=0;d<t;d+=1){const u=np(s.cell);if(u&&a.push(u),r){const f=np(s.header_cell);f&&l.push(f)}}const c=[];for(let d=0;d<e;d+=1)c.push(s.row.createChecked(null,r&&d===0?l:a));return s.table.createChecked(null,c)}function ex(n){return n instanceof Te}var Os=({editor:n})=>{const{selection:e}=n.state;if(!ex(e))return!1;let t=0;const r=nf(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},rp=Ue.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Yk,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:o}=Xk(n,this.options.cellMinWidth);return["table",we(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${o}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:o,editor:s})=>{const l=Qk(s.schema,n,e,t);if(o){const a=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(se.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>hk(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>mk(n,e),deleteColumn:()=>({state:n,dispatch:e})=>yk(n,e),addRowBefore:()=>({state:n,dispatch:e})=>kk(n,e),addRowAfter:()=>({state:n,dispatch:e})=>xk(n,e),deleteRow:()=>({state:n,dispatch:e})=>Ek(n,e),deleteTable:()=>({state:n,dispatch:e})=>Tk(n,e),mergeCells:()=>({state:n,dispatch:e})=>Pf(n,e),splitCell:()=>({state:n,dispatch:e})=>$f(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>ho("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>ho("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>Nk(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Pf(n,e)?!0:$f(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>_k(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>Hf(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>Hf(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&If(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=Te.create(e.doc,n.anchorCell,n.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:Os,"Mod-Backspace":Os,Delete:Os,"Mod-Delete":Os}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Pk({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Jk({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:ke(ne(n,"tableRole",e))}}}),tx=Ce.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(rp.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Zf.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(Qf.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(ep.configure(this.options.tableRow)),n}});const nx=rp.extend({renderHTML({HTMLAttributes:n}){return["div",{style:"overflow-x: auto;"},["table",n,0]]},parseHTML(){return[{tag:"div.table-wrapper table",priority:100},{tag:"table"}]}}),rx=tx.extend({addExtensions(){return[nx.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),ep,Zf,Qf]}});var ox=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,sx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,lx=Ht.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[ur({find:ox,type:this.type})]},addPasteRules(){return[$n({find:sx,type:this.type})]}}),ix=Ht.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),ax=Ht.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Is=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},cx=/^\s*>\s$/,dx=Ue.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Is("blockquote",{...we(this.options.HTMLAttributes,n),children:Is("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Or({find:cx,type:this.type})]}}),ux=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,fx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,px=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,hx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,mx=Ht.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return Is("strong",{...we(this.options.HTMLAttributes,n),children:Is("slot",{})})},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ur({find:ux,type:this.type}),ur({find:px,type:this.type})]},addPasteRules(){return[$n({find:fx,type:this.type}),$n({find:hx,type:this.type})]}}),gx=/(^|[^`])`([^`]+)`(?!`)$/,yx=/(^|[^`])`([^`]+)`(?!`)/g,bx=Ht.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ur({find:gx,type:this.type})]},addPasteRules(){return[$n({find:yx,type:this.type})]}}),kx=/^```([a-z]+)?[\s\n]$/,xx=/^~~~([a-z]+)?[\s\n]$/,wx=Ue.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options,s=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(t)).map(l=>l.replace(t,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",we(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{if(!this.options.enableTabIndentation)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(r.parent.type!==this.type)return!1;const s=" ".repeat(this.options.tabSize);return o?n.commands.insertContent(s):n.commands.command(({tr:l})=>{const{from:a,to:c}=t,f=e.doc.textBetween(a,c,`
86
100
  `,`
87
101
  `).split(`
88
102
  `).map(p=>s+p).join(`
@@ -95,38 +109,38 @@ img.ProseMirror-separator {
95
109
  `).map(f=>{var p;const h=((p=f.match(/^ */))==null?void 0:p[0])||"",m=Math.min(h.length,this.options.tabSize);return f.slice(m)}).join(`
96
110
  `);return s.replaceWith(l,a,e.schema.text(u)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:o}=t;if(!o||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
97
111
 
98
- `);return!s||!l?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:o,empty:s}=t;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:d})=>(d.setSelection(le.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[Ki({find:ix,type:this.type,getAttributes:n=>({language:n[1]})}),Ki({find:ax,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Oe({key:new $e("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!t||!s)return!1;const{tr:l,schema:a}=n.state,c=a.text(t.replace(/\r\n?/g,`
99
- `));return l.replaceSelectionWith(this.type.create({language:s},c)),l.selection.$from.parent.type!==this.type&&l.setSelection(se.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),dx=Ue.create({name:"doc",topNode:!0,content:"block+"}),ux=Ue.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",we(this.options.HTMLAttributes,n)]},renderText(){return`
100
- `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:o,storedMarks:s}=t;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:a}=r.extensionManager,c=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&l){const f=c.filter(p=>a.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Zf=Ue.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,we(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Ki({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),fx=Ue.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",we(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!N1(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,o=n();return af(t)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var a;if(l){const{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(se.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(oe.create(s.doc,c.pos)):s.setSelection(se.create(s.doc,c.pos));else{const u=(a=c.parent.type.contentMatch.defaultType)==null?void 0:a.create();u&&(s.insert(d,u),s.setSelection(se.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Sf({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),px=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,hx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,mx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,gx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,yx=Ht.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ur({find:px,type:this.type}),ur({find:mx,type:this.type})]},addPasteRules(){return[$n({find:hx,type:this.type}),$n({find:gx,type:this.type})]}});const bx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",kx="ελ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",na="numeric",ra="ascii",oa="alpha",mo="asciinumeric",go="alphanumeric",sa="domain",Qf="emoji",xx="scheme",wx="slashscheme",la="whitespace";function Ex(n,e){return n in e||(e[n]=[]),e[n]}function pr(n,e,t){e[na]&&(e[mo]=!0,e[go]=!0),e[ra]&&(e[mo]=!0,e[oa]=!0),e[mo]&&(e[go]=!0),e[oa]&&(e[go]=!0),e[go]&&(e[sa]=!0),e[Qf]&&(e[sa]=!0);for(const r in e){const o=Ex(r,t);o.indexOf(n)<0&&o.push(n)}}function Cx(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function kt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}kt.groups={},kt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let o=0;o<n.length;o++)this.tt(n[o],e,t,r)},tr(n,e,t,r){r=r||kt.groups;let o;return e&&e.j?o=e:(o=new kt(e),t&&r&&pr(e,t,r)),this.jr.push([n,o]),o},ts(n,e,t,r){let o=this;const s=n.length;if(!s)return o;for(let l=0;l<s-1;l++)o=o.tt(n[l]);return o.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||kt.groups;const o=this;if(e&&e.j)return o.j[n]=e,e;const s=e;let l,a=o.go(n);if(a?(l=new kt,Object.assign(l.j,a.j),l.jr.push.apply(l.jr,a.jr),l.jd=a.jd,l.t=a.t):l=new kt,s){if(r)if(l.t&&typeof l.t=="string"){const c=Object.assign(Cx(l.t,r),t);pr(s,c,r)}else t&&pr(s,t,r);l.t=s}return o.j[n]=l,l}};const ue=(n,e,t,r,o)=>n.ta(e,t,r,o),Fe=(n,e,t,r,o)=>n.tr(e,t,r,o),ep=(n,e,t,r,o)=>n.ts(e,t,r,o),j=(n,e,t,r,o)=>n.tt(e,t,r,o),yn="WORD",ia="UWORD",tp="ASCIINUMERICAL",np="ALPHANUMERICAL",yo="LOCALHOST",aa="TLD",ca="UTLD",Ds="SCHEME",Dr="SLASH_SCHEME",da="NUM",ua="WS",fa="NL",bo="OPENBRACE",ko="CLOSEBRACE",Rs="OPENBRACKET",Fs="CLOSEBRACKET",Ps="OPENPAREN",$s="CLOSEPAREN",zs="OPENANGLEBRACKET",Hs="CLOSEANGLEBRACKET",js="FULLWIDTHLEFTPAREN",Us="FULLWIDTHRIGHTPAREN",Ws="LEFTCORNERBRACKET",Ks="RIGHTCORNERBRACKET",qs="LEFTWHITECORNERBRACKET",Gs="RIGHTWHITECORNERBRACKET",Js="FULLWIDTHLESSTHAN",Ys="FULLWIDTHGREATERTHAN",Xs="AMPERSAND",Zs="APOSTROPHE",Qs="ASTERISK",Hn="AT",el="BACKSLASH",tl="BACKTICK",nl="CARET",jn="COLON",pa="COMMA",rl="DOLLAR",Zt="DOT",ol="EQUALS",ha="EXCLAMATION",Lt="HYPHEN",xo="PERCENT",sl="PIPE",ll="PLUS",il="POUND",wo="QUERY",ma="QUOTE",rp="FULLWIDTHMIDDLEDOT",ga="SEMI",Qt="SLASH",Eo="TILDE",al="UNDERSCORE",op="EMOJI",cl="SYM";var sp=Object.freeze({__proto__:null,ALPHANUMERICAL:np,AMPERSAND:Xs,APOSTROPHE:Zs,ASCIINUMERICAL:tp,ASTERISK:Qs,AT:Hn,BACKSLASH:el,BACKTICK:tl,CARET:nl,CLOSEANGLEBRACKET:Hs,CLOSEBRACE:ko,CLOSEBRACKET:Fs,CLOSEPAREN:$s,COLON:jn,COMMA:pa,DOLLAR:rl,DOT:Zt,EMOJI:op,EQUALS:ol,EXCLAMATION:ha,FULLWIDTHGREATERTHAN:Ys,FULLWIDTHLEFTPAREN:js,FULLWIDTHLESSTHAN:Js,FULLWIDTHMIDDLEDOT:rp,FULLWIDTHRIGHTPAREN:Us,HYPHEN:Lt,LEFTCORNERBRACKET:Ws,LEFTWHITECORNERBRACKET:qs,LOCALHOST:yo,NL:fa,NUM:da,OPENANGLEBRACKET:zs,OPENBRACE:bo,OPENBRACKET:Rs,OPENPAREN:Ps,PERCENT:xo,PIPE:sl,PLUS:ll,POUND:il,QUERY:wo,QUOTE:ma,RIGHTCORNERBRACKET:Ks,RIGHTWHITECORNERBRACKET:Gs,SCHEME:Ds,SEMI:ga,SLASH:Qt,SLASH_SCHEME:Dr,SYM:cl,TILDE:Eo,TLD:aa,UNDERSCORE:al,UTLD:ca,UWORD:ia,WORD:yn,WS:ua});const bn=/[a-z]/,Co=new RegExp("\\p{L}","u"),ya=new RegExp("\\p{Emoji}","u"),kn=/\d/,ba=/\s/,lp="\r",ka=`
101
- `,vx="️",_x="‍",xa="";let dl=null,ul=null;function Sx(n=[]){const e={};kt.groups=e;const t=new kt;dl==null&&(dl=ap(bx)),ul==null&&(ul=ap(kx)),j(t,"'",Zs),j(t,"{",bo),j(t,"}",ko),j(t,"[",Rs),j(t,"]",Fs),j(t,"(",Ps),j(t,")",$s),j(t,"<",zs),j(t,">",Hs),j(t,"(",js),j(t,")",Us),j(t,"「",Ws),j(t,"」",Ks),j(t,"『",qs),j(t,"』",Gs),j(t,"<",Js),j(t,">",Ys),j(t,"&",Xs),j(t,"*",Qs),j(t,"@",Hn),j(t,"`",tl),j(t,"^",nl),j(t,":",jn),j(t,",",pa),j(t,"$",rl),j(t,".",Zt),j(t,"=",ol),j(t,"!",ha),j(t,"-",Lt),j(t,"%",xo),j(t,"|",sl),j(t,"+",ll),j(t,"#",il),j(t,"?",wo),j(t,'"',ma),j(t,"/",Qt),j(t,";",ga),j(t,"~",Eo),j(t,"_",al),j(t,"\\",el),j(t,"・",rp);const r=Fe(t,kn,da,{[na]:!0});Fe(r,kn,r);const o=Fe(r,bn,tp,{[mo]:!0}),s=Fe(r,Co,np,{[go]:!0}),l=Fe(t,bn,yn,{[ra]:!0});Fe(l,kn,o),Fe(l,bn,l),Fe(o,kn,o),Fe(o,bn,o);const a=Fe(t,Co,ia,{[oa]:!0});Fe(a,bn),Fe(a,kn,s),Fe(a,Co,a),Fe(s,kn,s),Fe(s,bn),Fe(s,Co,s);const c=j(t,ka,fa,{[la]:!0}),d=j(t,lp,ua,{[la]:!0}),u=Fe(t,ba,ua,{[la]:!0});j(t,xa,u),j(d,ka,c),j(d,xa,u),Fe(d,ba,u),j(u,lp),j(u,ka),Fe(u,ba,u),j(u,xa,u);const f=Fe(t,ya,op,{[Qf]:!0});j(f,"#"),Fe(f,ya,f),j(f,vx,f);const p=j(f,_x);j(p,"#"),Fe(p,ya,f);const h=[[bn,l],[kn,o]],m=[[bn,null],[Co,a],[kn,s]];for(let g=0;g<dl.length;g++)Un(t,dl[g],aa,yn,h);for(let g=0;g<ul.length;g++)Un(t,ul[g],ca,ia,m);pr(aa,{tld:!0,ascii:!0},e),pr(ca,{utld:!0,alpha:!0},e),Un(t,"file",Ds,yn,h),Un(t,"mailto",Ds,yn,h),Un(t,"http",Dr,yn,h),Un(t,"https",Dr,yn,h),Un(t,"ftp",Dr,yn,h),Un(t,"ftps",Dr,yn,h),pr(Ds,{scheme:!0,ascii:!0},e),pr(Dr,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[xx]:!0}:{[wx]:!0};y.indexOf("-")>=0?k[sa]=!0:bn.test(y)?kn.test(y)?k[mo]=!0:k[ra]=!0:k[na]=!0,ep(t,y,y,k)}return ep(t,"localhost",yo,{ascii:!0}),t.jd=new kt(cl),{start:t,tokens:Object.assign({groups:e},sp)}}function ip(n,e){const t=Nx(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,o=[];let s=0,l=0;for(;l<r;){let a=n,c=null,d=0,u=null,f=-1,p=-1;for(;l<r&&(c=a.go(t[l]));)a=c,a.accepts()?(f=0,p=0,u=a):f>=0&&(f+=t[l].length,p++),d+=t[l].length,s+=t[l].length,l++;s-=f,l-=p,d-=f,o.push({t:u.t,v:e.slice(s-d,s),s:s-d,e:s})}return o}function Nx(n){const e=[],t=n.length;let r=0;for(;r<t;){let o=n.charCodeAt(r),s,l=o<55296||o>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(l),r+=l.length}return e}function Un(n,e,t,r,o){let s;const l=e.length;for(let a=0;a<l-1;a++){const c=e[a];n.j[c]?s=n.j[c]:(s=new kt(r),s.jr=o.slice(),n.j[c]=s),n=s}return s=new kt(t),s.jr=o.slice(),n.j[e[l-1]]=s,s}function ap(n){const e=[],t=[];let r=0,o="0123456789";for(;r<n.length;){let s=0;for(;o.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let l=parseInt(n.substring(r,r+s),10);l>0;l--)t.pop();r+=s}else t.push(n[r]),r++}return e}const vo={defaultProtocol:"http",events:null,format:cp,formatHref:cp,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function wa(n,e=null){let t=Object.assign({},vo);n&&(t=Object.assign(t,n instanceof wa?n.o:n));const r=t.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=o}wa.prototype={o:vo,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let o=this.o[n];return o&&(typeof o=="object"?(o=t.t in o?o[t.t]:vo[n],typeof o=="function"&&r&&(o=o(e,t))):typeof o=="function"&&r&&(o=o(e,t.t,t)),o)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function cp(n){return n}function dp(n,e){this.t="token",this.v=n,this.tk=e}dp.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=vo.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),s=this.toFormattedString(n),l={},a=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return l.href=r,a&&(l.class=a),c&&(l.target=c),d&&(l.rel=d),u&&Object.assign(l,u),{tagName:o,attributes:l,content:s,eventListeners:f}}};function fl(n,e){class t extends dp{constructor(o,s){super(o,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const up=fl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fp=fl("text"),Mx=fl("nl"),pl=fl("url",{isLink:!0,toHref(n=vo.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==yo&&n[1].t===jn}}),Ot=n=>new kt(n);function Tx({groups:n}){const e=n.domain.concat([Xs,Qs,Hn,el,tl,nl,rl,ol,Lt,da,xo,sl,ll,il,Qt,cl,Eo,al]),t=[Zs,jn,pa,Zt,ha,xo,wo,ma,ga,zs,Hs,bo,ko,Fs,Rs,Ps,$s,js,Us,Ws,Ks,qs,Gs,Js,Ys],r=[Xs,Zs,Qs,el,tl,nl,rl,ol,Lt,bo,ko,xo,sl,ll,il,wo,Qt,cl,Eo,al],o=Ot(),s=j(o,Eo);ue(s,r,s),ue(s,n.domain,s);const l=Ot(),a=Ot(),c=Ot();ue(o,n.domain,l),ue(o,n.scheme,a),ue(o,n.slashscheme,c),ue(l,r,s),ue(l,n.domain,l);const d=j(l,Hn);j(s,Hn,d),j(a,Hn,d),j(c,Hn,d);const u=j(s,Zt);ue(u,r,s),ue(u,n.domain,s);const f=Ot();ue(d,n.domain,f),ue(f,n.domain,f);const p=j(f,Zt);ue(p,n.domain,f);const h=Ot(up);ue(p,n.tld,h),ue(p,n.utld,h),j(d,yo,h);const m=j(f,Lt);j(m,Lt,m),ue(m,n.domain,f),ue(h,n.domain,f),j(h,Zt,p),j(h,Lt,m);const g=j(h,jn);ue(g,n.numeric,up);const y=j(l,Lt),b=j(l,Zt);j(y,Lt,y),ue(y,n.domain,l),ue(b,r,s),ue(b,n.domain,l);const k=Ot(pl);ue(b,n.tld,k),ue(b,n.utld,k),ue(k,n.domain,l),ue(k,r,s),j(k,Zt,b),j(k,Lt,y),j(k,Hn,d);const E=j(k,jn),x=Ot(pl);ue(E,n.numeric,x);const C=Ot(pl),S=Ot();ue(C,e,C),ue(C,t,S),ue(S,e,C),ue(S,t,S),j(k,Qt,C),j(x,Qt,C);const w=j(a,jn),T=j(c,jn),D=j(T,Qt),R=j(D,Qt);ue(a,n.domain,l),j(a,Zt,b),j(a,Lt,y),ue(c,n.domain,l),j(c,Zt,b),j(c,Lt,y),ue(w,n.domain,C),j(w,Qt,C),j(w,wo,C),ue(R,n.domain,C),ue(R,e,C),j(R,Qt,C);const A=[[bo,ko],[Rs,Fs],[Ps,$s],[zs,Hs],[js,Us],[Ws,Ks],[qs,Gs],[Js,Ys]];for(let B=0;B<A.length;B++){const[W,Q]=A[B],I=j(C,W);j(S,W,I),j(I,Q,C);const z=Ot(pl);ue(I,e,z);const K=Ot();ue(I,t),ue(z,e,z),ue(z,t,K),ue(K,e,z),ue(K,t,K),j(z,Q,C),j(K,Q,C)}return j(o,yo,k),j(o,fa,Mx),{start:o,tokens:sp}}function Ax(n,e,t){let r=t.length,o=0,s=[],l=[];for(;o<r;){let a=n,c=null,d=null,u=0,f=null,p=-1;for(;o<r&&!(c=a.go(t[o].t));)l.push(t[o++]);for(;o<r&&(d=c||a.go(t[o].t));)c=null,a=d,a.accepts()?(p=0,f=a):p>=0&&p++,o++,u++;if(p<0)o-=u,o<r&&(l.push(t[o]),o++);else{l.length>0&&(s.push(Ea(fp,e,l)),l=[]),o-=p,u-=p;const h=f.t,m=t.slice(o-u,o);s.push(Ea(h,e,m))}}return l.length>0&&s.push(Ea(fp,e,l)),s}function Ea(n,e,t){const r=t[0].s,o=t[t.length-1].e,s=e.slice(r,o);return new n(s,t)}const Bx=typeof console<"u"&&console&&console.warn||(()=>{}),Vx="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ve={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Lx(){return kt.groups={},Ve.scanner=null,Ve.parser=null,Ve.tokenQueue=[],Ve.pluginQueue=[],Ve.customSchemes=[],Ve.initialized=!1,Ve}function pp(n,e=!1){if(Ve.initialized&&Bx(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Vx}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
112
+ `);return!s||!l?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:o,empty:s}=t;if(!s||o.parent.type!==this.type||!(o.parentOffset===o.parent.nodeSize-2))return!1;const a=o.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:d})=>(d.setSelection(le.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[qi({find:kx,type:this.type,getAttributes:n=>({language:n[1]})}),qi({find:xx,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new Oe({key:new $e("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,s=o?.mode;if(!t||!s)return!1;const{tr:l,schema:a}=n.state,c=a.text(t.replace(/\r\n?/g,`
113
+ `));return l.replaceSelectionWith(this.type.create({language:s},c)),l.selection.$from.parent.type!==this.type&&l.setSelection(se.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),Ex=Ue.create({name:"doc",topNode:!0,content:"block+"}),Cx=Ue.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",we(this.options.HTMLAttributes,n)]},renderText(){return`
114
+ `},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:o,storedMarks:s}=t;if(o.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:a}=r.extensionManager,c=s||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&l){const f=c.filter(p=>a.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),op=Ue.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,we(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>qi({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),vx=Ue.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",we(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!L1(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,o=n();return mf(t)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:l})=>{var a;if(l){const{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(se.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(oe.create(s.doc,c.pos)):s.setSelection(se.create(s.doc,c.pos));else{const u=(a=c.parent.type.contentMatch.defaultType)==null?void 0:a.create();u&&(s.insert(d,u),s.setSelection(se.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Mf({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),_x=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Nx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Mx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Tx=Ht.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ur({find:_x,type:this.type}),ur({find:Nx,type:this.type})]},addPasteRules(){return[$n({find:Sx,type:this.type}),$n({find:Mx,type:this.type})]}});const Ax="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Bx="ελ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",sa="numeric",la="ascii",ia="alpha",mo="asciinumeric",go="alphanumeric",aa="domain",sp="emoji",Vx="scheme",Lx="slashscheme",ca="whitespace";function Ox(n,e){return n in e||(e[n]=[]),e[n]}function pr(n,e,t){e[sa]&&(e[mo]=!0,e[go]=!0),e[la]&&(e[mo]=!0,e[ia]=!0),e[mo]&&(e[go]=!0),e[ia]&&(e[go]=!0),e[go]&&(e[aa]=!0),e[sp]&&(e[aa]=!0);for(const r in e){const o=Ox(r,t);o.indexOf(n)<0&&o.push(n)}}function Ix(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function kt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}kt.groups={},kt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const o=e.jr[r][0],s=e.jr[r][1];if(s&&o.test(n))return s}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let o=0;o<n.length;o++)this.tt(n[o],e,t,r)},tr(n,e,t,r){r=r||kt.groups;let o;return e&&e.j?o=e:(o=new kt(e),t&&r&&pr(e,t,r)),this.jr.push([n,o]),o},ts(n,e,t,r){let o=this;const s=n.length;if(!s)return o;for(let l=0;l<s-1;l++)o=o.tt(n[l]);return o.tt(n[s-1],e,t,r)},tt(n,e,t,r){r=r||kt.groups;const o=this;if(e&&e.j)return o.j[n]=e,e;const s=e;let l,a=o.go(n);if(a?(l=new kt,Object.assign(l.j,a.j),l.jr.push.apply(l.jr,a.jr),l.jd=a.jd,l.t=a.t):l=new kt,s){if(r)if(l.t&&typeof l.t=="string"){const c=Object.assign(Ix(l.t,r),t);pr(s,c,r)}else t&&pr(s,t,r);l.t=s}return o.j[n]=l,l}};const ue=(n,e,t,r,o)=>n.ta(e,t,r,o),Fe=(n,e,t,r,o)=>n.tr(e,t,r,o),lp=(n,e,t,r,o)=>n.ts(e,t,r,o),j=(n,e,t,r,o)=>n.tt(e,t,r,o),yn="WORD",da="UWORD",ip="ASCIINUMERICAL",ap="ALPHANUMERICAL",yo="LOCALHOST",ua="TLD",fa="UTLD",Ds="SCHEME",Dr="SLASH_SCHEME",pa="NUM",ha="WS",ma="NL",bo="OPENBRACE",ko="CLOSEBRACE",Rs="OPENBRACKET",Fs="CLOSEBRACKET",Ps="OPENPAREN",$s="CLOSEPAREN",zs="OPENANGLEBRACKET",Hs="CLOSEANGLEBRACKET",js="FULLWIDTHLEFTPAREN",Us="FULLWIDTHRIGHTPAREN",Ws="LEFTCORNERBRACKET",Ks="RIGHTCORNERBRACKET",qs="LEFTWHITECORNERBRACKET",Gs="RIGHTWHITECORNERBRACKET",Js="FULLWIDTHLESSTHAN",Ys="FULLWIDTHGREATERTHAN",Xs="AMPERSAND",Zs="APOSTROPHE",Qs="ASTERISK",Hn="AT",el="BACKSLASH",tl="BACKTICK",nl="CARET",jn="COLON",ga="COMMA",rl="DOLLAR",Zt="DOT",ol="EQUALS",ya="EXCLAMATION",Lt="HYPHEN",xo="PERCENT",sl="PIPE",ll="PLUS",il="POUND",wo="QUERY",ba="QUOTE",cp="FULLWIDTHMIDDLEDOT",ka="SEMI",Qt="SLASH",Eo="TILDE",al="UNDERSCORE",dp="EMOJI",cl="SYM";var up=Object.freeze({__proto__:null,ALPHANUMERICAL:ap,AMPERSAND:Xs,APOSTROPHE:Zs,ASCIINUMERICAL:ip,ASTERISK:Qs,AT:Hn,BACKSLASH:el,BACKTICK:tl,CARET:nl,CLOSEANGLEBRACKET:Hs,CLOSEBRACE:ko,CLOSEBRACKET:Fs,CLOSEPAREN:$s,COLON:jn,COMMA:ga,DOLLAR:rl,DOT:Zt,EMOJI:dp,EQUALS:ol,EXCLAMATION:ya,FULLWIDTHGREATERTHAN:Ys,FULLWIDTHLEFTPAREN:js,FULLWIDTHLESSTHAN:Js,FULLWIDTHMIDDLEDOT:cp,FULLWIDTHRIGHTPAREN:Us,HYPHEN:Lt,LEFTCORNERBRACKET:Ws,LEFTWHITECORNERBRACKET:qs,LOCALHOST:yo,NL:ma,NUM:pa,OPENANGLEBRACKET:zs,OPENBRACE:bo,OPENBRACKET:Rs,OPENPAREN:Ps,PERCENT:xo,PIPE:sl,PLUS:ll,POUND:il,QUERY:wo,QUOTE:ba,RIGHTCORNERBRACKET:Ks,RIGHTWHITECORNERBRACKET:Gs,SCHEME:Ds,SEMI:ka,SLASH:Qt,SLASH_SCHEME:Dr,SYM:cl,TILDE:Eo,TLD:ua,UNDERSCORE:al,UTLD:fa,UWORD:da,WORD:yn,WS:ha});const bn=/[a-z]/,Co=new RegExp("\\p{L}","u"),xa=new RegExp("\\p{Emoji}","u"),kn=/\d/,wa=/\s/,fp="\r",Ea=`
115
+ `,Dx="️",Rx="‍",Ca="";let dl=null,ul=null;function Fx(n=[]){const e={};kt.groups=e;const t=new kt;dl==null&&(dl=hp(Ax)),ul==null&&(ul=hp(Bx)),j(t,"'",Zs),j(t,"{",bo),j(t,"}",ko),j(t,"[",Rs),j(t,"]",Fs),j(t,"(",Ps),j(t,")",$s),j(t,"<",zs),j(t,">",Hs),j(t,"(",js),j(t,")",Us),j(t,"「",Ws),j(t,"」",Ks),j(t,"『",qs),j(t,"』",Gs),j(t,"<",Js),j(t,">",Ys),j(t,"&",Xs),j(t,"*",Qs),j(t,"@",Hn),j(t,"`",tl),j(t,"^",nl),j(t,":",jn),j(t,",",ga),j(t,"$",rl),j(t,".",Zt),j(t,"=",ol),j(t,"!",ya),j(t,"-",Lt),j(t,"%",xo),j(t,"|",sl),j(t,"+",ll),j(t,"#",il),j(t,"?",wo),j(t,'"',ba),j(t,"/",Qt),j(t,";",ka),j(t,"~",Eo),j(t,"_",al),j(t,"\\",el),j(t,"・",cp);const r=Fe(t,kn,pa,{[sa]:!0});Fe(r,kn,r);const o=Fe(r,bn,ip,{[mo]:!0}),s=Fe(r,Co,ap,{[go]:!0}),l=Fe(t,bn,yn,{[la]:!0});Fe(l,kn,o),Fe(l,bn,l),Fe(o,kn,o),Fe(o,bn,o);const a=Fe(t,Co,da,{[ia]:!0});Fe(a,bn),Fe(a,kn,s),Fe(a,Co,a),Fe(s,kn,s),Fe(s,bn),Fe(s,Co,s);const c=j(t,Ea,ma,{[ca]:!0}),d=j(t,fp,ha,{[ca]:!0}),u=Fe(t,wa,ha,{[ca]:!0});j(t,Ca,u),j(d,Ea,c),j(d,Ca,u),Fe(d,wa,u),j(u,fp),j(u,Ea),Fe(u,wa,u),j(u,Ca,u);const f=Fe(t,xa,dp,{[sp]:!0});j(f,"#"),Fe(f,xa,f),j(f,Dx,f);const p=j(f,Rx);j(p,"#"),Fe(p,xa,f);const h=[[bn,l],[kn,o]],m=[[bn,null],[Co,a],[kn,s]];for(let g=0;g<dl.length;g++)Un(t,dl[g],ua,yn,h);for(let g=0;g<ul.length;g++)Un(t,ul[g],fa,da,m);pr(ua,{tld:!0,ascii:!0},e),pr(fa,{utld:!0,alpha:!0},e),Un(t,"file",Ds,yn,h),Un(t,"mailto",Ds,yn,h),Un(t,"http",Dr,yn,h),Un(t,"https",Dr,yn,h),Un(t,"ftp",Dr,yn,h),Un(t,"ftps",Dr,yn,h),pr(Ds,{scheme:!0,ascii:!0},e),pr(Dr,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],k=n[g][1]?{[Vx]:!0}:{[Lx]:!0};y.indexOf("-")>=0?k[aa]=!0:bn.test(y)?kn.test(y)?k[mo]=!0:k[la]=!0:k[sa]=!0,lp(t,y,y,k)}return lp(t,"localhost",yo,{ascii:!0}),t.jd=new kt(cl),{start:t,tokens:Object.assign({groups:e},up)}}function pp(n,e){const t=Px(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,o=[];let s=0,l=0;for(;l<r;){let a=n,c=null,d=0,u=null,f=-1,p=-1;for(;l<r&&(c=a.go(t[l]));)a=c,a.accepts()?(f=0,p=0,u=a):f>=0&&(f+=t[l].length,p++),d+=t[l].length,s+=t[l].length,l++;s-=f,l-=p,d-=f,o.push({t:u.t,v:e.slice(s-d,s),s:s-d,e:s})}return o}function Px(n){const e=[],t=n.length;let r=0;for(;r<t;){let o=n.charCodeAt(r),s,l=o<55296||o>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(l),r+=l.length}return e}function Un(n,e,t,r,o){let s;const l=e.length;for(let a=0;a<l-1;a++){const c=e[a];n.j[c]?s=n.j[c]:(s=new kt(r),s.jr=o.slice(),n.j[c]=s),n=s}return s=new kt(t),s.jr=o.slice(),n.j[e[l-1]]=s,s}function hp(n){const e=[],t=[];let r=0,o="0123456789";for(;r<n.length;){let s=0;for(;o.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let l=parseInt(n.substring(r,r+s),10);l>0;l--)t.pop();r+=s}else t.push(n[r]),r++}return e}const vo={defaultProtocol:"http",events:null,format:mp,formatHref:mp,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function va(n,e=null){let t=Object.assign({},vo);n&&(t=Object.assign(t,n instanceof va?n.o:n));const r=t.ignoreTags,o=[];for(let s=0;s<r.length;s++)o.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=o}va.prototype={o:vo,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let o=this.o[n];return o&&(typeof o=="object"?(o=t.t in o?o[t.t]:vo[n],typeof o=="function"&&r&&(o=o(e,t))):typeof o=="function"&&r&&(o=o(e,t.t,t)),o)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function mp(n){return n}function gp(n,e){this.t="token",this.v=n,this.tk=e}gp.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=vo.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),o=n.get("tagName",t,e),s=this.toFormattedString(n),l={},a=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return l.href=r,a&&(l.class=a),c&&(l.target=c),d&&(l.rel=d),u&&Object.assign(l,u),{tagName:o,attributes:l,content:s,eventListeners:f}}};function fl(n,e){class t extends gp{constructor(o,s){super(o,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const yp=fl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bp=fl("text"),$x=fl("nl"),pl=fl("url",{isLink:!0,toHref(n=vo.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==yo&&n[1].t===jn}}),Ot=n=>new kt(n);function zx({groups:n}){const e=n.domain.concat([Xs,Qs,Hn,el,tl,nl,rl,ol,Lt,pa,xo,sl,ll,il,Qt,cl,Eo,al]),t=[Zs,jn,ga,Zt,ya,xo,wo,ba,ka,zs,Hs,bo,ko,Fs,Rs,Ps,$s,js,Us,Ws,Ks,qs,Gs,Js,Ys],r=[Xs,Zs,Qs,el,tl,nl,rl,ol,Lt,bo,ko,xo,sl,ll,il,wo,Qt,cl,Eo,al],o=Ot(),s=j(o,Eo);ue(s,r,s),ue(s,n.domain,s);const l=Ot(),a=Ot(),c=Ot();ue(o,n.domain,l),ue(o,n.scheme,a),ue(o,n.slashscheme,c),ue(l,r,s),ue(l,n.domain,l);const d=j(l,Hn);j(s,Hn,d),j(a,Hn,d),j(c,Hn,d);const u=j(s,Zt);ue(u,r,s),ue(u,n.domain,s);const f=Ot();ue(d,n.domain,f),ue(f,n.domain,f);const p=j(f,Zt);ue(p,n.domain,f);const h=Ot(yp);ue(p,n.tld,h),ue(p,n.utld,h),j(d,yo,h);const m=j(f,Lt);j(m,Lt,m),ue(m,n.domain,f),ue(h,n.domain,f),j(h,Zt,p),j(h,Lt,m);const g=j(h,jn);ue(g,n.numeric,yp);const y=j(l,Lt),b=j(l,Zt);j(y,Lt,y),ue(y,n.domain,l),ue(b,r,s),ue(b,n.domain,l);const k=Ot(pl);ue(b,n.tld,k),ue(b,n.utld,k),ue(k,n.domain,l),ue(k,r,s),j(k,Zt,b),j(k,Lt,y),j(k,Hn,d);const E=j(k,jn),x=Ot(pl);ue(E,n.numeric,x);const C=Ot(pl),_=Ot();ue(C,e,C),ue(C,t,_),ue(_,e,C),ue(_,t,_),j(k,Qt,C),j(x,Qt,C);const w=j(a,jn),T=j(c,jn),D=j(T,Qt),R=j(D,Qt);ue(a,n.domain,l),j(a,Zt,b),j(a,Lt,y),ue(c,n.domain,l),j(c,Zt,b),j(c,Lt,y),ue(w,n.domain,C),j(w,Qt,C),j(w,wo,C),ue(R,n.domain,C),ue(R,e,C),j(R,Qt,C);const A=[[bo,ko],[Rs,Fs],[Ps,$s],[zs,Hs],[js,Us],[Ws,Ks],[qs,Gs],[Js,Ys]];for(let B=0;B<A.length;B++){const[U,Y]=A[B],O=j(C,U);j(_,U,O),j(O,Y,C);const z=Ot(pl);ue(O,e,z);const K=Ot();ue(O,t),ue(z,e,z),ue(z,t,K),ue(K,e,z),ue(K,t,K),j(z,Y,C),j(K,Y,C)}return j(o,yo,k),j(o,ma,$x),{start:o,tokens:up}}function Hx(n,e,t){let r=t.length,o=0,s=[],l=[];for(;o<r;){let a=n,c=null,d=null,u=0,f=null,p=-1;for(;o<r&&!(c=a.go(t[o].t));)l.push(t[o++]);for(;o<r&&(d=c||a.go(t[o].t));)c=null,a=d,a.accepts()?(p=0,f=a):p>=0&&p++,o++,u++;if(p<0)o-=u,o<r&&(l.push(t[o]),o++);else{l.length>0&&(s.push(_a(bp,e,l)),l=[]),o-=p,u-=p;const h=f.t,m=t.slice(o-u,o);s.push(_a(h,e,m))}}return l.length>0&&s.push(_a(bp,e,l)),s}function _a(n,e,t){const r=t[0].s,o=t[t.length-1].e,s=e.slice(r,o);return new n(s,t)}const jx=typeof console<"u"&&console&&console.warn||(()=>{}),Ux="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ve={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Wx(){return kt.groups={},Ve.scanner=null,Ve.parser=null,Ve.tokenQueue=[],Ve.pluginQueue=[],Ve.customSchemes=[],Ve.initialized=!1,Ve}function kp(n,e=!1){if(Ve.initialized&&jx(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Ux}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
102
116
  1. Must only contain digits, lowercase ASCII letters or "-"
103
117
  2. Cannot start or end with "-"
104
- 3. "-" cannot repeat`);Ve.customSchemes.push([n,e])}function Ox(){Ve.scanner=Sx(Ve.customSchemes);for(let n=0;n<Ve.tokenQueue.length;n++)Ve.tokenQueue[n][1]({scanner:Ve.scanner});Ve.parser=Tx(Ve.scanner.tokens);for(let n=0;n<Ve.pluginQueue.length;n++)Ve.pluginQueue[n][1]({scanner:Ve.scanner,parser:Ve.parser});return Ve.initialized=!0,Ve}function Ca(n){return Ve.initialized||Ox(),Ax(Ve.parser.start,n,ip(Ve.scanner.start,n))}Ca.scan=ip;function hp(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new wa(t),o=Ca(n),s=[];for(let l=0;l<o.length;l++){const a=o[l];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var va="[\0-   ᠎ -\u2029  ]",Ix=new RegExp(va),Dx=new RegExp(`${va}$`),Rx=new RegExp(va,"g");function Fx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Px(n){return new Oe({key:new $e("autolink"),appendTransaction:(e,t,r)=>{const o=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!o||s)return;const{tr:l}=r,a=Uu(t.doc,[...e]);if(nf(a).forEach(({newRange:d})=>{const u=Uy(r.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(d.from,d.to," "," ");if(!Dx.test(h))return;f=u[0],p=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Ix).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=Ca(m).map(b=>b.toObject(n.defaultProtocol));if(!Fx(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Pi(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||l.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!l.steps.length)return l}})}function $x(n){return new Oe({key:new $e("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let u=r.target;const f=[];for(;u.nodeName!=="DIV";)f.push(u),u=u.parentNode;l=f.find(p=>p.nodeName==="A")}if(!l)return!1;const a=tf(e.state,n.type.name),c=(o=l?.href)!=null?o:a.href,d=(s=l?.target)!=null?s:a.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),l&&c?(window.open(c,d),!0):!1}}})}function zx(n){return new Oe({key:new $e("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const c=hp(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function hr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(Rx,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var mp=Ht.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){pp(n);return}pp(n.scheme,n.optionalSlashes)})},onDestroy(){Lx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!hr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!hr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!hr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",we(this.options.HTMLAttributes,n),0]:["a",we(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[$n({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,o=hp(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!hr(l,t),protocols:t,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:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Px({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!hr(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push($x({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(zx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),Hx=Object.defineProperty,jx=(n,e)=>{for(var t in e)Hx(n,t,{get:e[t],enumerable:!0})},Ux="listItem",gp="textStyle",yp=/^\s*([-+*])\s$/,bp=Ue.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",we(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ux,this.editor.getAttributes(gp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Or({find:yp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:yp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(gp),editor:this.editor})),[n]}}),kp=Ue.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",we(this.options.HTMLAttributes,n),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)}}}),Wx={};jx(Wx,{findListItemPos:()=>_o,getNextListDepth:()=>_a,handleBackspace:()=>Sa,handleDelete:()=>Na,hasListBefore:()=>xp,hasListItemAfter:()=>Kx,hasListItemBefore:()=>wp,listItemHasSubList:()=>Ep,nextListIsDeeper:()=>Cp,nextListIsHigher:()=>vp});var _o=(n,e)=>{const{$from:t}=e.selection,r=He(n,e.schema);let o=null,s=t.depth,l=t.pos,a=null;for(;s>0&&a===null;)o=t.node(s),o.type===r?a=s:(s-=1,l-=1);return a===null?null:{$pos:e.doc.resolve(l),depth:a}},_a=(n,e)=>{const t=_o(n,e);if(!t)return!1;const[,r]=Qy(e,n,t.$pos.pos+4);return r},xp=(n,e,t)=>{const{$anchor:r}=n.selection,o=Math.max(0,r.pos-2),s=n.doc.resolve(o).node();return!(!s||!t.includes(s.type.name))},wp=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((t=o.nodeBefore)==null?void 0:t.type.name)!==n)},Ep=(n,e,t)=>{if(!t)return!1;const r=He(n,e.schema);let o=!1;return t.descendants(s=>{s.type===r&&(o=!0)}),o},Sa=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Pn(n.state,e)&&xp(n.state,e,t)){const{$anchor:a}=n.state.selection,c=n.state.doc.resolve(a.before()-1),d=[];c.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Pn(n.state,e)||!rb(n.state))return!1;const r=_o(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=Ep(e,n.state,s);return wp(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Cp=(n,e)=>{const t=_a(n,e),r=_o(n,e);return!r||!t?!1:t>r.depth},vp=(n,e)=>{const t=_a(n,e),r=_o(n,e);return!r||!t?!1:t<r.depth},Na=(n,e)=>{if(!Pn(n.state,e)||!nb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:o}=t;return!t.empty&&r.sameParent(o)?!1:Cp(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():vp(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},Kx=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((t=o.nodeAfter)==null?void 0:t.type.name)!==n)},_p=Ce.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Na(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Na(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Sa(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Sa(n,t,r)&&(e=!0)}),e}}}}),qx="listItem",Sp="textStyle",Np=/^(\d+)\.\s$/,Mp=Ue.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",we(this.options.HTMLAttributes,t),0]:["ol",we(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(qx,this.editor.getAttributes(Sp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Or({find:Np,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:Np,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sp)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Gx=/^\s*(\[([( |x])?\])\s$/,Jx=Ue.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",we(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),d=u=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=t();if(typeof h!="number")return!1;const m=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,l),o.append(s,c),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:c,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[Or({find:Gx,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Yx=Ue.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",we(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ce.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(bp.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(kp.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(_p.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Mp.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Jx.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Yx.configure(this.options.taskList)),n}});var Tp=Ue.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Xx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Zx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Qx=Ht.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ur({find:Xx,type:this.type})]},addPasteRules(){return[$n({find:Zx,type:this.type})]}}),ew=Ue.create({name:"text",group:"inline"}),tw=Ht.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function nw(n={}){return new Oe({view(e){return new rw(e,n)}})}class rw{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=l=>{this[o](l)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*l;r={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=c.getBoundingClientRect(),p=f.width/c.offsetWidth,h=f.height/c.offsetHeight;d=f.left-c.scrollLeft*p,u=f.top-c.scrollTop*h}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!s){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=rd(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Pe extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Pe.valid(r)?new Pe(r):le.near(r)}content(){return J.empty}eq(e){return e instanceof Pe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Pe(e.resolve(t.pos))}getBookmark(){return new Ma(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!ow(e)||!sw(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Pe.valid(e))return e;let o=e.pos,s=null;for(let l=e.depth;;l--){let a=e.node(l);if(t>0?e.indexAfter(l)<a.childCount:e.index(l)>0){s=a.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;o+=t;let c=e.doc.resolve(o);if(Pe.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!oe.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*t),r=!1;continue e}break}s=l,o+=t;let a=e.doc.resolve(o);if(Pe.valid(a))return a}return null}}}Pe.prototype.visible=!1,Pe.findFrom=Pe.findGapCursorFrom,le.jsonID("gapcursor",Pe);class Ma{constructor(e){this.pos=e}map(e){return new Ma(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Pe.valid(t)?new Pe(t):le.near(t)}}function ow(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-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 sw(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;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 lw(){return new Oe({props:{decorations:dw,createSelectionBetween(n,e,t){return e.pos==t.pos&&Pe.valid(t)?new Pe(t):null},handleClick:aw,handleKeyDown:iw,handleDOMEvents:{beforeinput:cw}}})}const iw=Ni({ArrowLeft:hl("horiz",-1),ArrowRight:hl("horiz",1),ArrowUp:hl("vert",-1),ArrowDown:hl("vert",1)});function hl(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let l=r.selection,a=e>0?l.$to:l.$from,c=l.empty;if(l instanceof se){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Pe.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Pe(d))),!0):!1}}function aw(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Pe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&oe.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Pe(r))),!0)}function cw(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Pe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=F.empty;for(let l=r.length-1;l>=0;l--)o=F.from(r[l].createAndFill(null,o));let s=n.state.tr.replace(t.pos,t.pos,new J(o,0,0));return s.setSelection(se.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function dw(n){if(!(n.selection instanceof Pe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Me.create(n.doc,[Ye.widget(n.selection.head,e,{key:"gapcursor"})])}var ml=200,Xe=function(){};Xe.prototype.append=function(e){return e.length?(e=Xe.from(e),!this.length&&e||e.length<ml&&this.leafAppend(e)||this.length<ml&&e.leafPrepend(this)||this.appendInner(e)):this},Xe.prototype.prepend=function(e){return e.length?Xe.from(e).append(this):this},Xe.prototype.appendInner=function(e){return new uw(this,e)},Xe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Xe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Xe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,l){return o.push(e(s,l))},t,r),o},Xe.from=function(e){return e instanceof Xe?e:e&&e.length?new Ap(e):Xe.empty};var Ap=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(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,l,a){for(var c=s;c<l;c++)if(o(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,l,a){for(var c=s-1;c>=l;c--)if(o(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=ml)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ml)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Xe);Xe.empty=new Ap([]);var uw=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,l){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),l)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,l){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,l+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,l)===!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})(Xe);const fw=500;class Ut{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){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;t&&(o=this.remapping(r,this.items.length),s=o.maps.length);let l=e.tr,a,c,d=[],u=[];return this.items.forEach((f,p)=>{if(!f.step){o||(o=this.remapping(r,p+1),s=o.maps.length),s--,u.push(f);return}if(o){u.push(new en(f.map));let h=f.step.map(o.slice(s)),m;h&&l.maybeStep(h).doc&&(m=l.mapping.maps[l.mapping.maps.length-1],d.push(new en(m,void 0,void 0,d.length+u.length))),s--,m&&o.appendMap(m,s)}else l.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(s)):f.selection,c=new Ut(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:l,selection:a}}addTransform(e,t,r,o){let s=[],l=this.eventCount,a=this.items,c=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),p=new en(e.mapping.maps[u],f,t),h;(h=c&&c.merge(p))&&(p=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(p),t&&(l++,t=void 0),o||(c=p)}let d=l-r.depth;return d>hw&&(a=pw(a,d),l-=d),new Ut(a.append(s),l)}remapping(e,t){let r=new Xr;return this.items.forEach((o,s)=>{let l=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,l)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ut(this.items.append(e.map(t=>new en(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let c=t;this.items.forEach(p=>{let h=s.getMirror(--c);if(h==null)return;l=Math.min(l,h);let m=s.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(s.slice(c+1,h));y&&a++,r.push(new en(m,g,y))}else r.push(new en(m))},o);let d=[];for(let p=t;p<l;p++)d.push(new en(s.maps[p]));let u=this.items.slice(0,o).append(d).append(r),f=new Ut(u,a);return f.emptyItemCount()>fw&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],s=0;return this.items.forEach((l,a)=>{if(a>=e)o.push(l),l.selection&&s++;else if(l.step){let c=l.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=l.selection&&l.selection.map(t.slice(r));u&&s++;let f=new en(d.invert(),c,u),p,h=o.length-1;(p=o.length&&o[h].merge(f))?o[h]=p:o.push(f)}}else l.map&&r--},this.items.length,0),new Ut(Xe.from(o.reverse()),s)}}Ut.empty=new Ut(Xe.empty,0);function pw(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class en{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new en(t.getMap().invert(),t,this.selection)}}}class Wn{constructor(e,t,r,o,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const hw=20;function mw(n,e,t,r){let o=t.getMeta(mr),s;if(o)return o.historyState;t.getMeta(bw)&&(n=new Wn(n.done,n.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(l&&l.getMeta(mr))return l.getMeta(mr).redo?new Wn(n.done.addTransform(t,void 0,r,gl(e)),n.undone,Bp(t.mapping.maps),n.prevTime,n.prevComposition):new Wn(n.done,n.undone.addTransform(t,void 0,r,gl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!l&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!gw(t,n.prevRanges)),d=l?Ta(n.prevRanges,t.mapping):Bp(t.mapping.maps);return new Wn(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,gl(e)),Ut.empty,d,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Wn(n.done.rebased(t,s),n.undone.rebased(t,s),Ta(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Wn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ta(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function gw(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(t=!0)}),t}function Bp(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,s,l)=>e.push(s,l));return e}function Ta(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),s=e.map(n[r+1],-1);o<=s&&t.push(o,s)}return t}function yw(n,e,t){let r=gl(e),o=mr.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),c=new Wn(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(l).setMeta(mr,{redo:t,historyState:c})}let Aa=!1,Vp=null;function gl(n){let e=n.plugins;if(Vp!=e){Aa=!1,Vp=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Aa=!0;break}}return Aa}const mr=new $e("history"),bw=new $e("closeHistory");function kw(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Oe({key:mr,state:{init(){return new Wn(Ut.empty,Ut.empty,null,0,-1)},apply(e,t,r){return mw(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Op:r=="historyRedo"?Ip:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Lp(n,e){return(t,r)=>{let o=mr.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let s=yw(o,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Op=Lp(!1,!0),Ip=Lp(!0,!0);Ce.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.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=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Oe({key:new $e("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const o=this.options.limit;if(o==null||o===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const l=s-o,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(a,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:t.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 a=e.selection.$head.pos,c=s-r,d=a-c,u=a;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var xw=Ce.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[nw(this.options)]}});Ce.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oe({key:new $e("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!t||!r)return Me.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;l+=1});let a=0;return n.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&l-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Ye.node(d,d+c.nodeSize,{class:this.options.className}))}),Me.create(n,s)}}})]}});var ww=Ce.create({name:"gapCursor",addProseMirrorPlugins(){return[lw()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ke(ne(n,"allowGapCursor",t)))!=null?e:null}}});Ce.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Oe({key:new $e("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((l,a)=>{const c=r>=a&&r<=a+l.nodeSize,d=!l.isLeaf&&Cs(l);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const f=Ye.node(a,a+l.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:c}):this.options.placeholder});o.push(f)}return this.options.includeChildren}),Me.create(n,o)}}})]}}),Ce.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Oe({key:new $e("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||af(t.selection)||n.view.dragging?null:Me.create(t.doc,[Ye.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Dp({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Ew=Ce.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new $e(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new Oe({key:n,appendTransaction:(t,r,o)=>{const{doc:s,tr:l,schema:a}=o,c=n.getState(o),d=s.content.size,u=a.nodes[this.options.node];if(c)return l.insert(d,u.create())},state:{init:(t,r)=>{const o=r.tr.doc.lastChild;return!Dp({node:o,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const o=t.doc.lastChild;return!Dp({node:o,types:e})}}})]}}),Cw=Ce.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Op(n,e),redo:()=>({state:n,dispatch:e})=>Ip(n,e)}},addProseMirrorPlugins(){return[kw(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()}}}),vw=Ce.create({name:"starterKit",addExtensions(){var n,e,t,r;const o=[];return this.options.bold!==!1&&o.push(rx.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(Zk.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(bp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(lx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(cx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(dx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(xw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(ww.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(ux.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Zf.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(Cw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(fx.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(yx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(kp.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(_p.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&o.push(mp.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Mp.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Tp.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(Qx.configure(this.options.strike)),this.options.text!==!1&&o.push(ew.configure(this.options.text)),this.options.underline!==!1&&o.push(tw.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&o.push(Ew.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),_w=vw,Sw=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Nw=Ue.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},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",we(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Sf({find:Sw,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Mw=Ce.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});const Tw=async n=>{try{const e=new FormData;return e.append("unique","true"),e.append("file",n),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:e})).json())?.result}catch(e){console.error(e)}},Aw=async(n,e)=>{const t=e.clipboardData?.items;if(t){const r=e.clipboardData?.getData("text/html"),o=e.clipboardData?.getData("text/plain");if(r){const{state:s,dispatch:l}=n,{tr:a}=s,c=wr.fromSchema(n.state.schema),d=new DOMParser().parseFromString(r,"text/html").body,u=c.parse(d),f=a.replaceSelectionWith(u);return l(f),e.preventDefault(),!0}if(o){const{state:s,dispatch:l}=n,{tr:a}=s,c=a.insertText(o,s.selection.from,s.selection.to);return l(c),e.preventDefault(),!0}for(let s=0;s<t.length;s++){const l=t[s];if(l.type.startsWith("image/")){const a=l.getAsFile();if(a){const c=await Tw(a),{schema:d}=n.state,u=d.nodes.image.create({src:c?.file_path}),f=n.state.tr.replaceSelectionWith(u);return n.dispatch(f),e.preventDefault(),!0}}}}return!1},Bw={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},Vw=Zf.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:n=>{const e=n.level||1;return{class:`heading-level-${e}`,style:Bw[e-1]}}}}}}),Lw=Tp.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Ow=qi.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:n=>n.style.fontFamily?.replace(/['"]/g,""),renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Iw=qi.extend({addAttributes(){return{...this.parent?.(),fontSize:{default:null,parseHTML:n=>n.style.fontSize?.replace(/['"]/g,""),renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Dw=Ue.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",n]}});function Rp(n){let e=!1;const t=A1({content:n.modelValue,extensions:[_w.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),Yk,Jk,F1,Ow,Iw,Lw,Vw,Gk,Nw.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"editor-image"}}),Mw.configure({types:["heading","paragraph"]}),mp.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),Wk.configure({table:{HTMLAttributes:{class:"editor-content"},resizable:!0}}),Dw],editorProps:{handlePaste:Aw,handleKeyDown:(s,l)=>{if(l.key==="Tab"){const a=s.state,{selection:c}=a,{$anchor:d}=c;let u=!1;for(let f=d.depth;f>0;f--){const p=d.node(f);if(p&&(p.type.name==="bulletList"||p.type.name==="orderedList")){u=!0;break}}return u?!1:(l.preventDefault(),!0)}return!1}}}),r=i.computed(()=>t.value||null);return i.watch(t,s=>{s&&t.value.on("update",l=>{if(!e){e=!0;const a=l.editor.getHTML();n.modelValue,setTimeout(()=>{e=!1},10)}})}),{editor:t,editorInstance:r,focusEditor:()=>{t.value&&!t.value.isFocused&&t.value.commands.focus()}}}function Fp(n,e){const t=i.ref(!1),r=i.ref(""),o=i.ref(null);return{isHtmlMode:t,htmlContent:r,htmlTextarea:o,toggleHtmlMode:a=>{t.value=a,a?(n.value&&(r.value=n.value.getHTML()),i.nextTick(()=>{o.value&&(o.value.focus(),setTimeout(()=>{o.value.formatCode()},100))})):n.value&&r.value&&n.value.commands.setContent(r.value,!0)},onHtmlInput:a=>{r.value=a,e&&e("update:modelValue",a)}}}function Pp(){const n=i.ref(!1);return{isFullscreen:n,toggleFullscreen:()=>{n.value=!n.value}}}const Le=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Rw={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Fw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Blockquote",onClick:e[0]||(e[0]=(...l)=>s.toggleBlockquote&&s.toggleBlockquote(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":t.editor?.isActive("blockquote")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)])],2)}const Pw=Le(Rw,[["render",Fw]]),$w={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function zw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bullet List",onClick:e[0]||(e[0]=(...l)=>s.toggleBulletList&&s.toggleBulletList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bulletList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)])],2)}const Hw=Le($w,[["render",zw]]),jw={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function Uw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Ordered List",onClick:e[0]||(e[0]=(...l)=>s.toggleOrderedList&&s.toggleOrderedList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("orderedList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)])],2)}const Ww=Le(jw,[["render",Uw]]),Kw={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function qw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Code Block",onClick:e[0]||(e[0]=(...l)=>s.toggleCodeBlock&&s.toggleCodeBlock(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("codeBlock")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)])],2)}const Gw=Le(Kw,[["render",qw]]),Jw={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function Yw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bold Text",onClick:e[0]||(e[0]=(...l)=>s.toggleBold&&s.toggleBold(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bold")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),i.createElementVNode("span",{class:"sr-only"},"Bold",-1)])],2)}const Xw=Le(Jw,[["render",Yw]]),Zw={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function Qw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Italic Text",onClick:e[0]||(e[0]=(...l)=>s.toggleItalic&&s.toggleItalic(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("italic")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),i.createElementVNode("span",{class:"sr-only"},"Italic",-1)])],2)}const eE=Le(Zw,[["render",Qw]]),tE={__name:"vs-editor-underline",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Underline",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),i.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)])],2))}},nE={__name:"vs-editor-strike",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Strikethrough",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M5 12l14 0"}),i.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)])],2))}},rE={props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:n}){n==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(n,e){e&&n.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},oE={key:0,class:"vsTailwind ui-dialog__wrapper"},sE={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},lE={class:"font-medium text-gray-800 dark:text-[#ffffff]"},iE={class:"ui-dialog__content p-4"},aE={key:0,class:"flex justify-end gap-x-2"};function cE(n,e,t,r,o,s){return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[t.visible||t.modelValue?(i.openBlock(),i.createElementBlock("div",oE,[i.createElementVNode("div",{onMousedown:e[1]||(e[1]=l=>s.closeByClickBack(l,t.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[s.checkSize]])},[i.createElementVNode("div",sE,[i.createElementVNode("h3",lE,i.toDisplayString(t.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...l)=>s.handleClose&&s.handleClose(...l))},[...e[2]||(e[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",iE,[i.renderSlot(n.$slots,"default",{},void 0,!0)]),s.hasSlot?(i.openBlock(),i.createElementBlock("div",aE,[i.renderSlot(n.$slots,"footer",{handleClose:s.handleClose,handleConfirm:s.handleConfirm,handleCancel:s.handleCancel},void 0,!0)])):i.createCommentVNode("",!0)],2)]),_:3})],32)])):i.createCommentVNode("",!0)])}const $p=Le(rE,[["render",cE],["__scopeId","data-v-6d0970a6"]]),dE={},uE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function fE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",uE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const pE=Le(dE,[["render",fE]]),hE={},mE={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function gE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",mE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const yE=Le(hE,[["render",gE]]),bE={},kE={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function xE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",kE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),i.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)])])}const wE=Le(bE,[["render",xE]]),EE=i.defineComponent({components:{IconClose:pE,IconSearch:yE,IconEmail:wE},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){if((this.style?.size||this.size)==="xs")return"h-[32px] text-sm";if((this.style?.size||this.size)==="md")return"h-[38px] text-sm";this.style?.size||this.size},value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:n}=await this.$refs;await n.focus()}}}),CE={class:"vs-form-text relative bg-white rounded-lg"},vE={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},_E=["disabled","type","placeholder"];function SE(n,e,t,r,o,s){const l=i.resolveComponent("IconClose"),a=i.resolveComponent("IconSearch"),c=i.resolveComponent("IconEmail");return i.openBlock(),i.createElementBlock("div",CE,[n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),n.icon&&n.icon==="search"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",n.iconStylePosition])},[i.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):n.icon&&n.icon==="email"?(i.openBlock(),i.createElementBlock("div",vE,[i.createVNode(c,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(i.openBlock(),i.createElementBlock("i",{key:3,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+n.icon,n.iconStylePosition]])},null,2)),n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("input",i.mergeProps({ref:"vsText",disabled:n.disabled,type:n.type,onInput:e[2]||(e[2]=(...d)=>n.handleInput&&n.handleInput(...d)),placeholder:n.placeholder,"onUpdate:modelValue":e[3]||(e[3]=d=>n.value=d)},n.style?.attrs||n.attrs||{},{onFocus:e[4]||(e[4]=(...d)=>n.handleFocus&&n.handleFocus(...d)),onBlur:e[5]||(e[5]=(...d)=>n.handleBlur&&n.handleBlur(...d)),class:[[n.inputStyle,n.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,_E),[[i.vModelDynamic,n.value]])])}const zp=Le(EE,[["render",SE],["__scopeId","data-v-749b581f"]]);function Ba(){const n=i.ref("en");return{t:t=>({en:{type_tag:"Type Tag",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",paragraph:"Paragraph",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link"},uk:{type_tag:"Тип тегу",heading_1:"Заголовок 1",heading_2:"Заголовок 2",heading_3:"Заголовок 3",paragraph:"Параграф",createTable:"Створити Таблицю",addColumn:"Додати Колону",addRow:"Додати Рядок",deleteColumn:"Вилучити Колону",deleteRow:"Вилучити Рядок",deleteTable:"Вилучити Таблицю",mergeCells:"Об'єднати Клітинки",splitCells:"Розділити Клітинки",linkTitle:"Введіть Посилання"}})[n.value]?.[t]||t,locale:n}}const NE={class:"flex flex-col gap-3 p-[20px]"},ME={class:"relative flex items-center gap-2"},TE={class:"flex-1"},AE={key:0,class:"flex items-center gap-2 flex-shrink-0"},BE={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},VE=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(n){const{t:e}=Ba(),t=n,r=i.ref(!1),o=i.ref(""),s=i.ref(!1),l=()=>{if(!t.editor)return;t.editor.chain().focus().extendMarkRange("link").run();const f=t.editor.getAttributes("link");f.href?(s.value=!0,o.value=f.href):(s.value=!1,o.value=""),r.value=!0},a=()=>{r.value=!1,o.value="",s.value=!1},c=()=>{if(!t.editor||!o.value.trim())return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),t.editor.chain().focus().setLink({href:f}).run(),a()},d=()=>{t.editor&&(t.editor.chain().focus().unsetLink().run(),a())},u=()=>{if(!o.value)return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),window.open(f,"_blank","noopener,noreferrer")};return(f,p)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("button",{title:"Link",onClick:l,class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("link")}])},[...p[2]||(p[2]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])],2),i.createVNode($p,{title:s.value?i.unref(e)("editLink")||"Edit Link":i.unref(e)("linkTitle")||"Add Link",visible:r.value,"onUpdate:visible":p[1]||(p[1]=h=>r.value=h),size:"small"},{footer:i.withCtx(()=>[i.createElementVNode("div",BE,[i.createElementVNode("button",{style:{border:"1px solid #000"},onClick:a,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},i.toDisplayString(i.unref(e)("cancel")||"Cancel"),1),i.createElementVNode("button",{onClick:c,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},i.toDisplayString(s.value?i.unref(e)("update")||"Update":i.unref(e)("create")||"Create"),1)])]),default:i.withCtx(()=>[i.createElementVNode("div",NE,[i.createElementVNode("div",ME,[i.createElementVNode("div",TE,[i.createVNode(zp,{modelValue:o.value,"onUpdate:modelValue":p[0]||(p[0]=h=>o.value=h),placeholder:i.unref(e)("linkUrl")||"Enter URL",class:"w-full"},null,8,["modelValue","placeholder"])]),s.value?(i.openBlock(),i.createElementBlock("div",AE,[i.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:"Open link"},[...p[3]||(p[3]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14"})],-1)])]),i.createElementVNode("button",{onClick:d,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:"Remove link"},[...p[4]||(p[4]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])])])):i.createCommentVNode("",!0)])])]),_:1},8,["title","visible"])],64))}}),So=async(n,e,t,r=10)=>{if(!e||!t)return;await i.nextTick();const o=await t?.getBoundingClientRect(),s=await e?.getBoundingClientRect();if(!s||!o)return;const l=await parseInt(e?.getBoundingClientRect()?.height),a=await parseInt(e?.getBoundingClientRect()?.width),c=await parseInt(t?.getBoundingClientRect()?.height),d=await parseInt(t?.getBoundingClientRect()?.width),u=await window.innerHeight,f=await window.innerWidth;let p=0,h=0;const m=s.bottom+r+c;switch(n){case"top":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f>d+s.right+30?h=s.left-o.width/2+s.width/2:h=f-30-d;break;case"bottom":u>m?p=s.bottom+r:p=s.bottom-r-c-l,h=s.left-o.width/2+s.width/2;break;case"left":p=s.top-o.height/2+s.height/2,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"right":p=s.top-o.height/2+s.height/2,f-a>d?h=s.right+r:h=f-30-d;break;case"top-right":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f-a>d?h=s.right+r:h=f-30-d;break;case"top-left":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"top-start":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left>0?h=s.left:h=10;break;case"bottom-right":u>m?p=s.bottom+r:p=s.bottom-r-c-l,f-a>d?h=s.left:h=f-30-d;break;case"bottom-left":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.right-d:h=10;break;case"bottom-start":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.left:h=10;break}p+c>u?p=u-c-r:p<0&&(p=r),h+d>f?h=f-d-r:h<0&&(h=r),t instanceof HTMLElement&&(t.style.top=`${p}px`,t.style.left=`${h}px`,t.style.position="fixed")},LE={class:"text-center"},OE={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Kn=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(!1),l=i.ref([]),a=i.ref(null),c=i.ref(null),d=i.ref(null);i.watch(s,E=>{E?(u(),window.addEventListener("resize",()=>So(r.placement,c.value,d.value)),So(r.placement,c.value,d.value)):window.removeEventListener("resize",()=>So(r.placement,c.value,d.value)),o("isvisible",E)}),i.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",k,!0),u()}),i.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),f()});const u=()=>{let E=a.value;for(;E&&E!==document.body;)(E.scrollHeight>E.clientHeight||E.scrollWidth>E.clientWidth)&&(E.addEventListener("scroll",g),l.value.push(E)),E=E.parentElement;document.body&&(document.body.addEventListener("scroll",g),l.value.push(document.body))},f=()=>{l.value.forEach(E=>{E.removeEventListener("scroll",g)}),l.value=[]},p=()=>{s.value=!0,So(r.placement,c.value,d.value)},h=()=>{s.value=!1},m=async()=>{await So(r.placement,c.value,d.value),s.value=!s.value},g=()=>{s.value=!1},y=E=>{if(!E){s.value=!1;return}c.value?.contains(E.target)||d.value?.contains(E.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=E=>{s.value&&d.value&&!d.value.contains(E.target)&&(s.value=!1)};return e({togglePopover:m}),(E,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[i.createElementVNode("div",LE,[n.trigger==="click"?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:c,onClick:m,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(E.$slots,"reference",{},()=>[x[0]||(x[0]=i.createElementVNode("button",null,"Click me!",-1))])],2)):i.createCommentVNode("",!0),n.trigger==="hover"?(i.openBlock(),i.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:c,onMouseover:p,onMouseleave:h,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(E.$slots,"reference",{},()=>[x[1]||(x[1]=i.createElementVNode("button",null,"Click me!",-1))])],34)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:n.teleport},[i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",{class:i.normalizeClass(["vsTailwind vs-popover__content",n.placement]),ref_key:"contentPop",ref:d,style:i.normalizeStyle({width:n.width?n.width+"px":"fit-content",zIndex:100001})},[i.createElementVNode("div",OE,[i.renderSlot(E.$slots,"default",{},()=>[x[2]||(x[2]=i.createElementVNode("span",null,"Popover content",-1))])])],6),[[i.vShow,s.value]])]),_:3})],8,["to"]))])],512))}}),IE={class:"flex flex-col gap-[2px] p-[2px]"},DE=["onClick"],RE={__name:"vs-editor-table",props:{editor:Object},setup(n){const{t:e}=Ba(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),o.value.togglePopover())},l=()=>{t.editor&&(t.editor.chain().focus().addColumnAfter().run(),o.value.togglePopover())},a=()=>{t.editor&&(t.editor.chain().focus().addRowAfter().run(),o.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().deleteColumn().run(),o.value.togglePopover())},d=()=>{t.editor&&(t.editor.chain().focus().deleteRow().run(),o.value.togglePopover())},u=()=>{t.editor&&(t.editor.chain().focus().deleteTable().run(),o.value.togglePopover())},f=()=>{t.editor&&(t.editor.chain().focus().mergeCells().run(),o.value.togglePopover())},p=()=>{t.editor&&(t.editor.chain().focus().splitCell().run(),o.value.togglePopover())},h=i.computed(()=>[{text:e("createTable"),function:s},{text:e("addColumn"),function:l},{text:e("addRow"),function:a},{text:e("deleteColumn"),function:c},{text:e("deleteRow"),function:d},{text:e("deleteTable"),function:u},{text:e("mergeCells"),function:f},{text:e("splitCells"),function:p}]);return(m,g)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:g[0]||(g[0]=y=>r.value=y)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Table",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...g[1]||(g[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),i.createElementVNode("path",{d:"M3 10h18"}),i.createElementVNode("path",{d:"M10 3v18"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",IE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(y,b)=>(i.openBlock(),i.createElementBlock("button",{key:b,onClick:y?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},i.toDisplayString(y.text),9,DE))),128))])]),_:1},512))}},FE={},PE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-center"};function $E(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",PE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M8 12l8 0"},null,-1),i.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const zE=Le(FE,[["render",$E]]),HE={},jE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-right"};function UE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",jE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M10 12l10 0"},null,-1),i.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const WE=Le(HE,[["render",UE]]),KE={},qE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-left"};function GE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",qE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M4 12l10 0"},null,-1),i.createElementVNode("path",{d:"M4 18l14 0"},null,-1)])])}const JE=Le(KE,[["render",GE]]),YE={},XE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-justify"};function ZE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",XE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6h16"},null,-1),i.createElementVNode("path",{d:"M4 12h16"},null,-1),i.createElementVNode("path",{d:"M4 18h16"},null,-1)])])}const Hp={left:JE,center:zE,right:WE,justify:Le(YE,[["render",ZE]])},QE={class:"flex gap-[4px] p-1"},e2=["title","onClick"],t2={__name:"vs-editor-align",props:{editor:Object},setup(n){const e=n,t=i.ref(!1),r=i.ref("popover"),o=i.ref("left"),s=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"left"})||e.editor.isActive("heading",{textAlign:"left"}):!1),l=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"right"})||e.editor.isActive("heading",{textAlign:"right"}):!1),a=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"center"})||e.editor.isActive("heading",{textAlign:"center"}):!1),c=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"justify"})||e.editor.isActive("heading",{textAlign:"justify"}):!1),d=i.computed(()=>s.value||l.value||a.value||c.value),u=()=>{l.value?o.value="right":a.value?o.value="center":c.value?o.value="justify":o.value="left"};i.watch([s,l,a,c],()=>{u()},{immediate:!0}),i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",u),e.editor.on("update",u))}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",u),e.editor.off("update",u))});const f=h=>{e.editor&&(e.editor.chain().focus().setTextAlign(h).run(),o.value=h)},p=i.ref([{id:"left",isActive:s},{id:"center",isActive:a},{id:"right",isActive:l},{id:"justify",isActive:c}]);return(h,m)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:m[0]||(m[0]=g=>t.value=g)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Align",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[d.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Hp)[o.value]),{height:"16",width:"16"}))],2)]),default:i.withCtx(()=>[i.createElementVNode("div",QE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,g=>(i.openBlock(),i.createElementBlock("button",{title:"Text align "+g?.id,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":g?.isActive}]),key:g?.id,onClick:y=>f(g?.id)},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Hp)[g?.id]),{height:"16",width:"16"}))],10,e2))),128))])]),_:1},512))}},n2={class:"flex flex-col gap-[2px] p-[2px]"},r2=["onClick"],o2={__name:"vs-editor-type-tag",props:{editor:Object},setup(n){const{t:e}=Ba(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor?.chain().focus().setParagraph().run(),o.value.togglePopover())},l=c=>{t.editor&&(t.editor?.chain().focus().toggleHeading({level:c}).run(),o.value.togglePopover())},a=i.computed(()=>[{text:e("richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:e("richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:e("richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:e("richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:e("richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:e("richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>r.value=u)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Type Tag",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...d[1]||(d[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 7v-2h13v2"}),i.createElementVNode("path",{d:"M10 5v14"}),i.createElementVNode("path",{d:"M12 19h-4"}),i.createElementVNode("path",{d:"M15 13v-1h6v1"}),i.createElementVNode("path",{d:"M18 12v7"}),i.createElementVNode("path",{d:"M17 19h2"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",n2,[i.createElementVNode("button",{onClick:s,class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[n.editor?.isActive("paragraph")?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)("richtext.paragraph")),3),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(u,f)=>(i.openBlock(),i.createElementBlock("button",{key:f,onClick:p=>l(u?.id),class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,n.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)(`richtext.heading${u?.id}`)),11,r2))),128))])]),_:1},512))}},s2={},l2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function i2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",l2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const No=Le(s2,[["render",i2]]),a2={components:{VsText:zp},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}}}},c2={class:"flex items-center w-full max-w-[182px]"},d2=["disabled"];function u2(n,e,t,r,o,s){const l=i.resolveComponent("vs-text");return i.openBlock(),i.createElementBlock("div",c2,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>s.value=a),type:"color",class:i.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",t.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:t.disabled},null,10,d2),[[i.vModelText,s.value]]),t.isTextInputShown?(i.openBlock(),i.createBlock(l,{key:0,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=a=>s.value=a),class:"ml-2 w-full",disabled:t.disabled,clearable:t.clearable},null,8,["modelValue","disabled","clearable"])):i.createCommentVNode("",!0)])}const jp=Le(a2,[["render",u2]]),f2={class:"flex gap-[4px] mb-[8px]"},p2={class:"grid grid-rows-3 grid-cols-7"},h2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},m2=["onClick","title"],g2={__name:"vs-editor-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("#000000"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").color||"#000000"),s=i.computed(()=>o.value!=="#000000"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Color",class:i.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[1]||(p[1]=i.createElementVNode("span",{class:"leading-none"},"A",-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",f2,[i.createVNode(jp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",p2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",h2,[i.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,m2)])]))),128))])])]),_:1},512))}},y2={class:"flex gap-[4px] mb-[8px]"},b2={class:"grid grid-rows-3 grid-cols-7"},k2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},x2=["onClick","title"],w2=["onClick","title"],E2={__name:"vs-editor-background-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("transparent"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").backgroundColor||"transparent"),s=i.computed(()=>o.value!=="transparent"&&o.value!==""),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setBackgroundColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Background Color",class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[2]||(p[2]=i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"}),i.createElementVNode("path",{d:"m5 2 5 5"}),i.createElementVNode("path",{d:"M2 13h15"}),i.createElementVNode("path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z"})],-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",y2,[i.createVNode(jp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",b2,[i.createElementVNode("button",{onClick:p[1]||(p[1]=h=>c("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[...p[3]||(p[3]=[i.createElementVNode("svg",{fill:"#000000",width:"16",height:"16",viewBox:"0 0 52 52","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),i.createElementVNode("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),i.createElementVNode("g",{id:"SVGRepo_iconCarrier"},[i.createElementVNode("path",{d:"M48.5,5.6,46.4,3.5a1.67,1.67,0,0,0-2.4.3L32.59,15.21c-.77-1.3-1.51-2.61-2.21-4a36.5,36.5,0,0,1-3.15-8.36c-.13-.53-.39-.91-1-.89s-.86.4-1,.93c-.06.26-.11.51-.17.76A48.3,48.3,0,0,1,21,13.7,97.47,97.47,0,0,1,14.13,25a16,16,0,0,0-3,11.12c0,.14,0,.29.06.43L3.8,44a1.87,1.87,0,0,0-.3,2.4l2.1,2.1A1.67,1.67,0,0,0,8,48.2L48.2,8A1.67,1.67,0,0,0,48.5,5.6Z"}),i.createElementVNode("path",{d:"M38.42,23.79l-22,22.31A14.47,14.47,0,0,0,26.22,50a15.48,15.48,0,0,0,7-1.44c4.94-2.51,8.11-6.4,8.94-12A15.22,15.22,0,0,0,39,24.66C38.87,24.44,38.58,24,38.42,23.79Z"})])],-1),i.createElementVNode("p",null,"no color",-1)])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",k2,[h!=="transparent"?(i.openBlock(),i.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,x2)):i.createCommentVNode("",!0),h==="transparent"?(i.openBlock(),i.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],8,w2)):i.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},C2={__name:"vs-editor-highlight",props:{editor:Object},setup(n){const e=n,t=i.computed(()=>e.editor?.isActive("highlight")),r=()=>{e.editor&&e.editor.chain().focus().toggleHighlight().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Highlight",onClick:r,class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":t.value}])},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m9 11-6 6v3h9l3-3"}),i.createElementVNode("path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"})],-1)])],2))}},v2={class:"truncate"},_2={class:"w-[200px]"},S2={class:"max-h-[200px] overflow-y-auto"},N2=["onClick"],M2={__name:"vs-editor-font-family",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref(!1),o=i.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),s=i.computed(()=>{if(!e.editor)return"Arial, sans-serif";for(const d of o.value)if(e.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),l=i.computed(()=>o.value.find(u=>u.value===s.value)?.label||"Arial"),a=d=>e.editor?e.editor.isActive("textStyle",{fontFamily:d}):!1,c=d=>{e.editor&&(e.editor.chain().focus().setFontFamily(d).run(),t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom",onIsvisible:u[0]||(u[0]=f=>r.value=f)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Family",class:i.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[r.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:i.normalizeStyle({fontFamily:s.value})},[i.createElementVNode("span",v2,i.toDisplayString(l.value),1),u[1]||(u[1]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],6)]),default:i.withCtx(()=>[i.createElementVNode("div",_2,[i.createElementVNode("ul",S2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":a(f.value)}]),style:i.normalizeStyle({fontFamily:f.value}),onClick:p=>c(f.value)},i.toDisplayString(f.label),15,N2))),128))])])]),_:1},512))}},T2={class:"w-[120px]"},A2={class:"max-h-[200px] overflow-y-auto"},B2=["onClick"],V2={__name:"vs-editor-font-size",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("14px"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").fontSize||"14px"),s=i.computed(()=>o.value!=="14px"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),c=d=>{e.editor&&(e.editor.chain().focus().setFontSize(d).run(),r.value=d,t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Size",class:i.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":s.value}])},[...u[0]||(u[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-alarge-small-icon lucide-a-large-small"},[i.createElementVNode("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),i.createElementVNode("path",{d:"M15.697 14h5.606"}),i.createElementVNode("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),i.createElementVNode("path",{d:"M3.304 13h6.392"})],-1),i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",T2,[i.createElementVNode("ul",A2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:p=>c(f.value)},i.toDisplayString(f.label),9,B2))),128))])])]),_:1},512))}},L2={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function O2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Superscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSuperscript&&s.toggleSuperscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("superscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript-icon lucide-superscript"><path d="m4 19 8-8"></path><path d="m12 19-8-8"></path><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"></path></svg><span class="sr-only">Superscript</span>',2)])],2)}const I2=Le(L2,[["render",O2]]),D2={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function R2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Subscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSubscript&&s.toggleSubscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("subscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-subscript-icon lucide-subscript"><path d="m4 5 8 8"></path><path d="m12 5-8 8"></path><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"></path></svg><span class="sr-only">Subscript</span>',2)])],2)}const F2=Le(D2,[["render",R2]]),P2={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},$2={class:"truncate"},z2={class:"max-h-[200px] overflow-y-auto"},H2=["onClick"],j2=Le({__name:"vs-editor-heading",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),o=i.computed(()=>{if(!e.editor)return"Paragraph";for(let c=1;c<=6;c++)if(e.editor.isActive("heading",{level:c}))return`H ${c}`;return"P"}),s=c=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[c]||"",l=c=>{e.editor&&(e.editor.chain().focus().setHeading({level:c}).run(),t.value&&t.value.togglePopover())},a=()=>{e.editor&&(e.editor.chain().focus().setParagraph().run(),t.value&&t.value.togglePopover())};return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",P2,[i.createElementVNode("span",$2,i.toDisplayString(o.value),1),d[0]||(d[0]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))])]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("ul",z2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,u=>(i.openBlock(),i.createElementBlock("li",{key:u.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:i.normalizeStyle(s(u.value)),onClick:f=>l(u.value)},i.toDisplayString(u.label),15,H2))),128)),i.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:a}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-ef7c378e"]]),U2={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function W2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Clear Formatting",onClick:e[0]||(e[0]=(...l)=>s.clearFormatting&&s.clearFormatting(...l)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-remove-formatting-icon lucide-remove-formatting"><path d="M4 7V4h16v3"></path><path d="M5 20h6"></path><path d="M13 4 8 20"></path><path d="m15 15 5 5"></path><path d="m20 15-5 5"></path></svg><span class="sr-only">Clear Formatting</span>',2)])])}const K2=Le(U2,[["render",W2]]),Mo=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t};i.defineComponent({props:{modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},data(){return{}},mounted(){this.modelValue||this.$emit("update:modelValue",!1)},computed:{modelState:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}},methods:{handleEnterDown(n){const{keyCode:e}=n;e===13&&(this.modelState=!this.modelState)},addKeyHandler(){window.addEventListener("keydown",this.handleEnterDown)},removeKeyHandler(){window.removeEventListener("keydown",this.handleEnterDown)}}});const q2={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},G2={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},J2={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Y2={class:"ui-dialog__content p-4"},X2={key:0,class:"flex justify-end gap-x-2"},Z2={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},Q2=i.defineComponent({__name:"vs-modal",props:{title:{default:""},template:{},visible:{type:Boolean,default:!1},size:{default:"small"},closeClickBack:{type:Boolean,default:!1},content:{},buttonText:{},contentProps:{},teleport:{default:"body"}},emits:["update:visible","close","done"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.size==="small"?"md:w-5/12 w-9/12":t.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"),s=i.useAttrs();function l(){r("done")}function a(){r("update:visible",!1),r("close")}function c(u){u.key==="Escape"&&a()}function d(u,f){f&&u.target.classList.contains("vs-dialog-overlay")&&a()}return i.onMounted(()=>{window.addEventListener("keydown",c)}),i.onUnmounted(()=>{window.removeEventListener("keydown",c)}),(u,f)=>(i.openBlock(),i.createBlock(i.Teleport,{to:u.teleport},[u.visible?(i.openBlock(),i.createElementBlock("div",q2,[i.createElementVNode("div",{onMousedown:f[0]||(f[0]=p=>d(p,u.closeClickBack)),class:i.normalizeClass(["vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 bg-black bg-opacity-50",[i.unref(s).class]])},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",o.value])},[i.createElementVNode("div",G2,[i.createElementVNode("h3",J2,i.toDisplayString(u.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:a},[...f[1]||(f[1]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",Y2,[i.renderSlot(u.$slots,"default",{},void 0,!0)]),u.$slots.footer?(i.openBlock(),i.createElementBlock("div",X2,[i.renderSlot(u.$slots,"footer",{handleClose:a},void 0,!0)])):i.createCommentVNode("",!0),u.buttonText?(i.openBlock(),i.createElementBlock("div",Z2,[i.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:a}," Close "),i.createElementVNode("button",{type:"button",onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none"},i.toDisplayString(u.buttonText),1)])):i.createCommentVNode("",!0)],2)]),_:3})],34)])):i.createCommentVNode("",!0)],8,["to"]))}}),Va=Mo(Q2,[["__scopeId","data-v-a6807cab"]]),eC={},tC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-green-600"};function nC(n,e){return i.openBlock(),i.createElementBlock("svg",tC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const rC=Mo(eC,[["render",nC]]),oC={},sC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"orange",class:"size-6 text-orange-600"};function lC(n,e){return i.openBlock(),i.createElementBlock("svg",sC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const iC=Mo(oC,[["render",lC]]),aC={},cC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-blue-600"};function dC(n,e){return i.openBlock(),i.createElementBlock("svg",cC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)])])}const uC=Mo(aC,[["render",dC]]),fC={},pC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"red",class:"size-6 text-red-600"};function hC(n,e){return i.openBlock(),i.createElementBlock("svg",pC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const mC=Mo(fC,[["render",hC]]),gC={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},yC={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},bC={class:"flex-1"},kC={class:"font-medium text-gray-900"},xC={class:"mt-0.5 text-sm text-gray-700"},wC=i.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:rC,warning:iC,error:mC,info:uC};return(t,r)=>(i.openBlock(),i.createElementBlock("div",gC,[i.createElementVNode("div",yC,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e[t.type]))),i.createElementVNode("div",bC,[i.createElementVNode("strong",kC,i.toDisplayString(t.title),1),i.createElementVNode("p",xC,i.toDisplayString(t.message),1)]),r[0]||(r[0]=i.createElementVNode("button",{class:"m-3 rounded-full p-1.5 text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700",type:"button","aria-label":"Dismiss notify"},[i.createElementVNode("span",{class:"sr-only"},"Dismiss popup"),i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}});i.reactive({visible:!0});const EC=n=>{const{template:e="",title:t="",content:r,contentProps:o={},size:s="medium"}=n||{},l=document.querySelector("body");if(!l)return console.error('Modal root element with id "#modal" not found!'),{close:()=>{}};const a=document.createElement("div");l.appendChild(a);const c={title:t,template:e,visible:!0,size:s,closeClickBack:!0,onClose:u},d=i.createApp({render(){return i.h(Va,c,{default:()=>[r?i.h(r,o):i.h("p",e)]})}});function u(){d.unmount(),a.remove()}return d.mount(a),{close:u}},yl={top:"top-4 left-1/2 transform -translate-x-1/2","left-bottom":"bottom-4 left-4 transform","right-bottom":"bottom-4 right-4 transform",bottom:"bottom-4 left-1/2 transform -translate-x-1/2"},Ie=n=>{const{type:e="info",title:t,message:r,position:o="right-bottom"}=n||{};let s=document.querySelector("#notify-root");s||(s=document.createElement("div"),s.id="notify-root",s.className=`fixed z-[2000] flex flex-col gap-3 ${yl[o]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(s)),s.className.includes(yl[o])||(Object.values(yl).forEach(c=>{s.classList.remove(...c.split(" "))}),s.classList.add(...yl[o].split(" ")));const l=document.createElement("div");s.appendChild(l);const a=i.createApp({render(){return i.h(wC,{type:e,title:t,message:r,onClose:()=>{a.unmount(),l.remove()}})}});a.mount(l),l.querySelector("button")?.addEventListener("click",()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)}),setTimeout(()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)},3500)},CC={class:"w-full relative"},vC={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},_C={class:"opacity-100"},SC={key:0,class:"text-red-500 text-[14px]"},NC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},MC=i.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=i.ref("uk"),t=r=>{r.detail.key==="locale"&&(e.value=r.detail.newValue)};return i.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",t)}),i.onUnmounted(()=>{window.removeEventListener("resize",t)}),(r,o)=>(i.openBlock(),i.createElementBlock("div",CC,[r.ua||r.label?(i.openBlock(),i.createElementBlock("div",vC,[i.createElementVNode("span",_C,i.toDisplayString(r.item[e.value]||r.ua||r.label),1),r.item?.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",SC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(r.$slots,"default",i.mergeProps(r.$attrs,{class:{"opacity-60":r.item.disabled}})),r.error?(i.openBlock(),i.createElementBlock("span",NC,i.toDisplayString(r.error),1)):i.createCommentVNode("",!0)]))}}),TC={class:"w-full relative flex flex-row items-center gap-2"},AC={key:0,class:"text-red-500 text-[14px]"},BC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},VC=i.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(n){const e=n,t=i.computed(()=>e.columns??{container:12,label:3}),r=i.computed(()=>{const{container:a,label:c}=t.value;return!a||a<=0?0:Math.min(Math.max(c??0,0),a)/a}),o=i.computed(()=>e.item?.type==="html"||r.value<=0?!1:!!(e.ua||e.label)),s=i.computed(()=>{if(!o.value)return{};const a=`${r.value*100}%`;return{flexBasis:a,maxWidth:a}}),l=i.computed(()=>{const{container:a,label:c}=t.value;if(!a||a<=0)return{};if(e.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(a-Math.max(c??0,0),0)/a;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(a,c)=>(i.openBlock(),i.createElementBlock("div",TC,[o.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:i.normalizeStyle(s.value)},[i.createTextVNode(i.toDisplayString(a.ua||a.label)+" ",1),a.item?.rules?.includes("required")&&(a.ua||a.label)?(i.openBlock(),i.createElementBlock("span",AC,"*")):i.createCommentVNode("",!0)],4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"flex-1 min-w-0",style:i.normalizeStyle(l.value)},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],4),a.error?(i.openBlock(),i.createElementBlock("span",BC,i.toDisplayString(a.error),1)):i.createCommentVNode("",!0)]))}}),LC={class:"w-full relative"},OC={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},IC=i.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",LC,[i.renderSlot(e.$slots,"default",i.normalizeProps(i.guardReactiveProps(e.$attrs))),e.error?(i.openBlock(),i.createElementBlock("span",OC,i.toDisplayString(e.error),1)):i.createCommentVNode("",!0)]))}}),DC={class:"flex-1 min-w-0"},RC={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},FC={class:"truncate"},PC={key:0,class:"text-red-500 text-[14px]"},$C={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},zC={key:0,class:"mt-1 text-xs text-red-500"},HC=i.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=n,t=i.ref("uk");i.computed(()=>(e.item??{})?.[t.value]??e.ua??e.label??"");const r=i.computed(()=>e.item?.description??""),o=i.computed(()=>Array.isArray(e.item?.rules)&&e.item.rules.includes("required")),s=i.computed(()=>(typeof e.error=="string"?e.error:"")??""),l=a=>{a.key==="locale"&&(t.value=a.newValue??"uk")};return i.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",l)}),i.onUnmounted(()=>{window.removeEventListener("storage",l)}),(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["w-full relative",{"opacity-60":a.item?.disabled}])},[i.createElementVNode("div",{class:i.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(a.item.type)?"flex flex-col":""]])},[i.createElementVNode("div",DC,[a.ua||a.label?(i.openBlock(),i.createElementBlock("p",RC,[i.createElementVNode("span",FC,i.toDisplayString(a.item[t.value]||a.ua||a.label),1),o.value?(i.openBlock(),i.createElementBlock("span",PC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("p",$C,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["w-full",["select","native-select"].includes(a.item.type)?"md:w-[30%]":"md:w-auto"])},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],2)],2),s.value?(i.openBlock(),i.createElementBlock("p",zC,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0)],2))}}),jC={default:MC,horizontal:VC,inline:IC,settings:HC};function St(n){return{inputClass:i.computed(()=>{const e=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${n?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return n?.size==="sm"?`${e}h-[32px]`:`${e}h-[38px]`})}}const UC=["placeholder","disabled"],WC=i.defineComponent({__name:"vs-input-password",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"password","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,UC)),[[i.vModelText,r.value]])}}),KC=["placeholder","disabled"],bl=i.defineComponent({__name:"vs-input-text",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,KC)),[[i.vModelText,r.value]])}}),qC=["placeholder","disabled","min","max"],GC=i.defineComponent({__name:"vs-input-number",props:i.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled);return(s,l)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":l[0]||(l[0]=a=>r.value=a),placeholder:s.placeholder,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,qC)),[[i.vModelText,r.value]])}}),ge=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},JC={},YC={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function XC(n,e){return i.openBlock(),i.createElementBlock("svg",YC,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const ZC=ge(JC,[["render",XC]]),QC={class:"flex items-center gap-[4px]"},ev=["value","id","disabled"],tv=["for"],nv={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},rv=i.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=e,r=n,o=i.computed({get:()=>r.modelValue,set:l=>t("update:modelValue",l)}),s=i.computed(()=>!!r.disabled);return(l,a)=>(i.openBlock(),i.createElementBlock("div",QC,[i.withDirectives(i.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),class:i.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":s.value}]),id:l.id,disabled:s.value},null,10,ev),[[i.vModelCheckbox,o.value]]),i.createElementVNode("label",{for:l.id,class:i.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":s.value}])},[i.createElementVNode("div",{class:i.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",l.error?"border-red-600":""]])},[i.createVNode(ZC,{height:"12",width:"12"})],2),i.createElementVNode("span",nv,[i.renderSlot(l.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(l.label),1)])])],10,tv)]))}}),ov=["name","value","disabled"],sv={class:"flex items-center gap-[6px] text-[14px]"},lv={key:0,class:"text-[16px]"},iv=["src"],av=i.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed({get:()=>t.modelValue,set:a=>{r("update:modelValue",a)}}),s=i.computed(()=>Array.isArray(o.value)?o.value.includes(t.value):o.value===!0||o.value===t.value),l=i.computed(()=>t.style?.size==="xs"?"p-1.5 text-xs":t.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(a,c)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[l.value,s.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[i.withDirectives(i.createElementVNode("input",{type:"checkbox",class:"hidden",name:a.id,value:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:a.disabled},null,8,ov),[[i.vModelCheckbox,o.value]]),i.createElementVNode("span",sv,[a.icon||a.imgUrl?(i.openBlock(),i.createElementBlock("span",lv,[a.icon?(i.openBlock(),i.createElementBlock("i",{key:0,class:i.normalizeClass(a.icon)},null,2)):i.createCommentVNode("",!0),a.imgUrl?(i.openBlock(),i.createElementBlock("img",{key:1,src:a.imgUrl,width:"16",height:"16",alt:"icon"},null,8,iv)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(a.label),1)])])],2))}}),cv={class:"flex items-center"},La=i.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=`radio-${Math.floor(Math.random()*1e4)}`,s=i.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:a=>{if(Array.isArray(t.modelValue)){let c=[...t.modelValue];a?c.includes(t.value)||c.push(t.value):c=c.filter(d=>d!==t.value),r("update:modelValue",c)}else r("update:modelValue",a)}}),l=i.ref(`vs-checkbox-${t.view||"default"}`);return(a,c)=>(i.openBlock(),i.createElementBlock("div",cv,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value==="vs-checkbox-buttons"?i.unref(av):i.unref(rv)),{value:a.value,label:a.label,info:a.option?.info,disabled:a.disabled,modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),id:o,icon:a.icon,imgUrl:a.imgUrl,style:i.normalizeStyle(a.style),error:a.error},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),dv={},uv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function fv(n,e){return i.openBlock(),i.createElementBlock("svg",uv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const pv=ge(dv,[["render",fv]]),hv={},mv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function gv(n,e){return i.openBlock(),i.createElementBlock("svg",mv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const yv=ge(hv,[["render",gv]]),bv={},kv={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function xv(n,e){return i.openBlock(),i.createElementBlock("svg",kv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M12 9h.01"},null,-1),i.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),i.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const wv=ge(bv,[["render",xv]]),Ev={key:0,class:"flex items-start gap-x-1"},Cv={key:0,class:"text-red-500 text-[14px]"},vv=["title"],_v=["disabled"],Up=i.defineComponent({__name:"vs-input-switcher",props:i.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue");return(r,o)=>e.view==="checkbox"?(i.openBlock(),i.createElementBlock("div",Ev,[i.createVNode(La,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),label:r.text,error:r.error||""},null,8,["modelValue","label","error"]),r.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",Cv,"*")):i.createCommentVNode("",!0),r.i?(i.openBlock(),i.createElementBlock("button",{key:1,class:"cursor-pointer",title:r.i,onClick:o[1]||(o[1]=i.withModifiers(()=>{},["prevent"]))},[i.createVNode(i.unref(wv),{class:"text-gray-500 w-[14px] h-[14px]"})],8,vv)):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:i.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[t.value?`bg-${r.style?.primaryColor||"blue"}-500`:"bg-stone-200",r.customClass]]),disabled:r.disabled,onClick:o[2]||(o[2]=s=>t.value=!t.value)},[i.createElementVNode("span",{"data-state":"checked",class:i.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[t.value?"translate-x-4":"translate-x-0"]])},null,2)],10,_v))}}),Sv=["id","innerHTML"],Wp=i.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{id:e.name,class:i.normalizeClass(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,Sv))}}),Nv=["placeholder","disabled","name"],Mv=i.defineComponent({__name:"vs-input-mask",props:i.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.ref(null);let s=null;return i.onMounted(async()=>{if(o.value){const{default:l}=await Promise.resolve().then(()=>lO);s=l(o.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),s.on("accept",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.on("complete",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.value=r.value??""}}),i.onBeforeUnmount(()=>{s?.destroy()}),i.watch(()=>e.mask,l=>{s&&s.updateOptions({mask:l,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),i.watch(r,l=>{s&&s.unmaskedValue!==l&&(s.value=l||"")}),(l,a)=>(i.openBlock(),i.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,Nv))}}),Tv={class:"relative w-full bg-white rounded-lg"},Av=["placeholder","disabled"],Bv=i.defineComponent({__name:"vs-input-email",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue");return(o,s)=>(i.openBlock(),i.createElementBlock("div",Tv,[s[1]||(s[1]=i.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),i.withDirectives(i.createElementVNode("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),placeholder:o.placeholder,disabled:o.disabled,class:i.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Av),[[i.vModelText,r.value]])]))}}),Vv=["value","disabled"],Lv={class:"text-[13px] text-gray-700"},Ov=i.defineComponent({__name:"vs-input-radio-default",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center gap-0",[e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Vv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",{class:i.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${e.style?.primaryColor||"blue"}-500`,r.value?"opacity-50 cursor-not-allowed":""]])},[t.value==e.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${e.style?.primaryColor||"blue"}-500`]])},null,2)):i.createCommentVNode("",!0)],2),i.createElementVNode("span",Lv,i.toDisplayString(e.text),1)],2))}}),Iv=["value","disabled"],Dv={class:"text-[13px] text-gray-700"},Rv=i.defineComponent({__name:"vs-input-radio-buttons",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==e.value?`ring-2 ring-ring ring-${e.style?.primaryColor||"blue"}-500`:"",e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Iv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",Dv,i.toDisplayString(e.text),1)],2))}}),Fv={"vs-input-radio-default":Ov,"vs-input-radio-buttons":Rv},Kp=i.defineComponent({__name:"vs-input-radio",props:i.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>Fv[`vs-input-radio-${e.view}`]);return(o,s)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.options,l=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),i.mergeProps({key:l?.id,text:l.text,value:l.id.toString(),checked:t.value===l.id,modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Pv={key:1,class:"w-full flex flex-col gap-4"},$v={key:0,class:"text-sm font-medium text-muted-foreground my-2"},zv="Без категорії",Hv=i.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.ref([]),s=i.reactive({}),l=h=>h?.value||h?.id||h?.text||h,a=h=>h.text||String(h),c=h=>`lg:col-span-${h||12}`,d=i.computed(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),u=h=>h==null||h===""?null:typeof h=="string"||typeof h=="number"?h:String(h),f=i.computed(()=>{if(!t.group)return[];const h=new Map;o.value.forEach(k=>{const E=k[t.group],x=u(E);h.has(x)||h.set(x,[]),h.get(x)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const E=u(k);m.push(E)});const g=new Set,y=k=>{const E=h.get(k)||[];if(!E.length)return null;const x=k===null?"group-null":`group-${String(k)}`,C=k===null?zv:String(k);return g.add(k),{key:x,label:C,options:E}},b=[];return m.forEach(k=>{const E=y(k);E&&b.push(E)}),h.forEach((k,E)=>{if(g.has(E))return;const x=y(E);x&&b.push(x)}),b}),p=async()=>{try{const h=await fetch(`/api/suggest/${t.data}`).then(m=>m.json());o.value=h?.data||h}catch(h){console.error(h)}};return i.watch(()=>t.modelValue,h=>{if(typeof h=="boolean"&&o.value.length===1){const m=l(o.value[0]);s[m]=h}else if(Array.isArray(h)){const m=new Set(h);o.value.forEach(g=>{if(!g.disabled){const y=l(g);s[y]=m.has(y)}})}},{immediate:!0}),i.watch(s,()=>{if(!o.value.length){r("update:modelValue",null);return}const h=Object.entries(s).filter(([,m])=>m).map(([m])=>m);r("update:modelValue",h.length===0?[]:h)},{deep:!0}),i.onMounted(()=>{if(t.data)p().then(()=>{if(typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}});else if(o.value=t.options,typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}}),(h,m)=>t.group?(i.openBlock(),i.createElementBlock("div",Pv,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value,g=>(i.openBlock(),i.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(i.openBlock(),i.createElementBlock("span",$v,i.toDisplayString(g.label),1)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(g.options,y=>(i.openBlock(),i.createBlock(La,{modelValue:s[l(y)],"onUpdate:modelValue":b=>s[l(y)]=b,value:l(y),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||y.disabled,label:a(y),key:`${g.key}-${l(y)}`,icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,g=>(i.openBlock(),i.createBlock(La,{modelValue:s[l(g)],"onUpdate:modelValue":y=>s[l(g)]=y,value:l(g),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||g.disabled,label:a(g),key:l(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),jv=ge(Hv,[["__scopeId","data-v-8e66207e"]]),Uv=["type","placeholder","disabled"],Wv=i.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n;function r(u){return u?t.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:o}=St(t.style),s=e,l=i.computed({get:()=>r(t.modelValue),set:u=>s("update:modelValue",u)}),a=i.computed(()=>t.mode==="datetime"?"datetime-local":t.mode),c=i.computed(()=>!!t.disabled),d=i.computed(()=>t.placeholder??"");return(u,f)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:a.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),placeholder:d.value,disabled:c.value,ref:"date",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",i.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Uv)),[[i.vModelDynamic,l.value]])}}),qp=async(n,e,t,r)=>{try{const o=new FormData;return o.append("unique","true"),o.append("file",n),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${r||""}`,{method:"POST",body:o}).then(s=>s.json()))?.result}catch(o){return Ie({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},Kv=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},Gp=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),r=e.headers["content-type"],o=new TextDecoder("utf-8").decode(t),s=new Blob([o],{type:r}),l=document.createElement("a");l.setAttribute("download",n),l.href=window.URL.createObjectURL(s),l.click()}catch(e){console.error(e.message)}},qv={},Gv={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Jv(n,e){return i.openBlock(),i.createElementBlock("svg",Gv,e[0]||(e[0]=[i.createElementVNode("path",{d:"M5 12h14"},null,-1),i.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const To=ge(qv,[["render",Jv]]),Yv={},Xv={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Zv(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",Xv,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const Qv=ge(Yv,[["render",Zv]]),e_={},t_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function n_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",t_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),i.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),i.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const r_=ge(e_,[["render",n_]]),o_={},s_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function l_(n,e){return i.openBlock(),i.createElementBlock("svg",s_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const Jp=ge(o_,[["render",l_]]),i_={},a_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function c_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",a_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const d_=ge(i_,[["render",c_]]),u_={},f_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function p_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",f_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const h_=ge(u_,[["render",p_]]),m_=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},g_=n=>{const e=m_(n),t={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return t.imageFormat.includes(e)?"img":t.sheetsFormat.includes(e)?r_:t.textsFormat.includes(e)?h_:t.documentsFormat.includes(e)?Qv:t.archivesFormat.includes(e)?d_:Jp},y_={},b_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function k_(n,e){return i.openBlock(),i.createElementBlock("svg",b_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const kl=ge(y_,[["render",k_]]),x_={},w_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function E_(n,e){return i.openBlock(),i.createElementBlock("svg",w_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Yp=ge(x_,[["render",E_]]),C_=["title"],v_={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},__=i.defineComponent({__name:"vs-input-file-list-item",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(n){const e=i.useModel(n,"value"),t=i.useModel(n,"item"),r=n;return(o,s)=>(i.openBlock(),i.createElementBlock("div",{title:t.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(g_)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=l=>i.unref(Gp)(t.value))},null,8,["src"])),i.createElementVNode("div",v_,[i.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=l=>{i.unref(Kv)(t.value),e.value=r.multiple?e.value?.filter(a=>a!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[i.createVNode(kl,{class:"w-4 h-4"})]),i.createElementVNode("button",{type:"button",onClick:s[2]||(s[2]=l=>i.unref(Gp)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[i.createVNode(Yp,{class:"w-4 h-4"})])])],8,C_))}}),Xp=ge(__,[["__scopeId","data-v-286cdbc0"]]),S_={class:"flex items-center gap-x-2"},N_=["multiple","disabled"],M_={key:1,class:"flex items-center flex-wrap gap-2"},T_={key:1,class:"loader"},A_={key:1,class:"loader"},B_=i.defineComponent({__name:"vs-input-file",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["change"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=i.useModel(n,"modelValue"),o=e,s=i.ref(null),l=i.ref(!1),a=u=>Array.isArray(r.value)&&r.value[u]||"",c=u=>{if(t.max_size&&u.size>t.max_size*1024*1024){const f=(u.size/1048576).toFixed(2);return Ie({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${f} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:f}=u.target;if(!f||f.length===0)return;const p=Array.from(f);if(t.max_size&&p.filter(h=>!c(h)).length>0){s.value&&(s.value.value="");return}l.value=!0;try{if(t.multiple){const h=Array.from(f).map(async g=>t.format&&!g.name.endsWith(t.format)?null:await qp(g,"1","form","table")),m=(await Promise.all(h)).filter(g=>g!==null).map(g=>g?.file_path).filter(Boolean);r.value=[...r.value||[],...m],o("change",r.value)}else{const h=f[0];if(t.format&&!h.name.endsWith(t.format))return;const m=await qp(h,"1","form","table");r.value=m?.file_path,o("change",r.value||"")}}finally{l.value=!1,s.value&&(s.value.value="")}};return(u,f)=>(i.openBlock(),i.createElementBlock("div",S_,[i.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:u.multiple,onChange:d,disabled:l.value||u.disabled},null,40,N_),!u.multiple&&r.value?(i.openBlock(),i.createBlock(Xp,{key:0,item:r.value,"onUpdate:item":f[0]||(f[0]=p=>r.value=p),value:r.value,"onUpdate:value":f[1]||(f[1]=p=>r.value=p)},null,8,["item","value"])):u.multiple?(i.openBlock(),i.createElementBlock("div",M_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(p,h)=>(i.openBlock(),i.createBlock(Xp,{multiple:u.multiple,key:h,value:r.value,"onUpdate:value":f[2]||(f[2]=m=>r.value=m),item:a(h)},null,8,["multiple","value","item"]))),128)),i.createElementVNode("div",{onClick:f[3]||(f[3]=p=>!u.disabled&&!l.value&&s.value?.click()),class:i.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",T_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2)])):i.createCommentVNode("",!0),u.multiple?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:2,onClick:f[4]||(f[4]=p=>s.value?.click()),class:i.normalizeClass([u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",A_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2))]))}}),V_=ge(B_,[["__scopeId","data-v-e613a523"]]),L_={class:"max-w-[55vw]"},O_={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},I_={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},D_={class:"px-[5px]"},R_={class:""},xl=i.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(n){const e=n,t=i.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function r(o){if(o<1024)return`${o} B`;const s=o/1024;return s<1024?`${s.toFixed(2)} KB`:`${(s/1024).toFixed(2)} MB`}return(o,s)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[s[1]||(s[1]=i.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),i.createElementVNode("div",L_,[i.createElementVNode("p",O_,i.toDisplayString(o.item?.uploaded_name),1),i.createElementVNode("p",I_,[i.createElementVNode("span",null,i.toDisplayString(o.item?.username),1),i.withDirectives(i.createElementVNode("span",D_,"|",512),[[i.vShow,o.item?.username]]),i.createElementVNode("span",null,i.toDisplayString(t.value),1),s[0]||(s[0]=i.createElementVNode("span",{class:"px-[5px]"},"|",-1)),i.createElementVNode("span",R_,i.toDisplayString(r(o.item?.size)),1)])])],64))}}),F_={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},P_={key:0,class:"flex w-full gap-x-3 items-center"},$_={key:1,class:"flex gap-x-3 w-full items-center"},z_={key:2,class:"flex gap-x-3 w-full items-center"},H_=["href"],j_={key:3,class:"flex gap-x-3 w-full items-center"},U_={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},W_={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},K_={class:"inline-block"},q_={class:"inline-block"},G_=i.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(n,{emit:e}){const t=n,r=e;function o(u){return["pdf","json"].includes(u.ext)}function s(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function l(u){const f=document.createElement("a");f.setAttribute("download",u?.uploaded_name),f.href=u?.file_path,f.click()}async function a(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),r("update")}catch(u){console.error(u)}}function c(){r("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:a,updateListOnConfirm:!0})}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&r("openLightbox",{item:t.item,index:u})}return(u,f)=>(i.openBlock(),i.createElementBlock("div",F_,[u.item.ext==="jpg"||u.item.ext==="png"?(i.openBlock(),i.createElementBlock("div",P_,[i.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=p=>d(u.index))},[i.createVNode(xl,{item:u.item},null,8,["item"])])])):o(u.item)?(i.openBlock(),i.createElementBlock("div",$_,[i.createVNode(xl,{item:u.item},null,8,["item"])])):s(u.item)?(i.openBlock(),i.createElementBlock("div",z_,[i.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[i.createVNode(xl,{item:u.item},null,8,["item"])],8,H_)])):(i.openBlock(),i.createElementBlock("div",j_,[i.createVNode(xl,{item:u.item},null,8,["item"])])),i.createElementVNode("div",U_,[i.createElementVNode("div",W_,[i.createElementVNode("div",K_,[i.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:f[1]||(f[1]=p=>l(u.item))},[i.createVNode(Yp,{height:"14",width:"14"})])]),f[3]||(f[3]=i.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),i.createElementVNode("div",q_,[i.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:f[2]||(f[2]=p=>c())},[i.createVNode(kl,{height:"14",width:"14"})])])])])]))}}),J_={},Y_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function X_(n,e){return i.openBlock(),i.createElementBlock("svg",Y_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Z_=ge(J_,[["render",X_]]),Q_={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},eS={class:"flex w-full mb-[12px] items-center gap-x-2"},tS={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},nS={class1:"ml-auto"},rS={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},oS={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},sS={class:"relative"},lS={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},iS={key:0},aS=i.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(n,{emit:e}){const t=n,r=i.inject("form"),o=i.computed(()=>r.value.formId),s=i.ref(!1),l=i.ref(0),a=e,c=i.ref(!1),d=i.ref({}),u=i.ref([]),f=i.ref(""),p=i.computed(()=>Array.isArray(u.value)?u.value.filter(E=>E.ext==="jpg"||E.ext==="png").map(E=>E?.file_path):[]),h=i.computed(()=>f.value===""?u.value:u.value.filter(E=>E?.uploaded_name?.includes(f.value))),m=E=>{const x=p.value.findIndex(C=>C===E.item.file_path);x!==-1&&(s.value=!0,l.value=x)},g=async()=>{try{const E=await fetch(`${t.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=E?.rows}catch(E){console.error(E)}},y=async E=>{await Promise.all(Array.from(E.target.files).map(async x=>{const C=new FormData;C.append("file",x);try{const S=`${t.prefix}/widget/file/${o.value}`,w=await fetch(S,{method:"POST",body:C});return w.ok?(a("update","file-list"),x):(Ie({type:w.status>=400&&w.status<500?"warning":"error",title:"Error",message:`Error code: ${w.status}`}),null)}catch(S){return Ie({type:"error",title:"Error",message:S.message||"Unknown error"}),console.error(S),null}})),await g()},b=E=>{const x={...E};return E.cancel||(x.cancel=()=>{c.value=!1}),E.updateListOnConfirm&&(x.confirm=async()=>{await E.confirm(),c.value=!1,g()}),x},k=E=>{d.value=b(E),c.value=!0};return i.watch(o,E=>{E&&g()}),i.onMounted(()=>{o.value&&g()}),(E,x)=>{const C=i.resolveComponent("Lightbox"),S=i.resolveComponent("MessageBox");return i.openBlock(),i.createElementBlock("div",Q_,[i.createElementVNode("div",eS,[i.createElementVNode("h2",tS," Файлів: "+i.toDisplayString(u.value?.length),1),i.createElementVNode("div",nS,[i.createElementVNode("label",null,[i.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=w=>y(w))},null,32),i.createElementVNode("div",rS,[i.createVNode(Z_,{height:"16",width:"16"})])])])]),u.value?.length>4?(i.openBlock(),i.createElementBlock("div",oS,[i.createElementVNode("div",null,[i.createElementVNode("div",sS,[x[8]||(x[8]=i.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[i.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),i.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":x[1]||(x[1]=w=>f.value=w),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[i.vModelText,f.value,void 0,{trim:!0}]])])])])):i.createCommentVNode("",!0),u.value?.length?(i.openBlock(),i.createElementBlock("div",lS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(w,T)=>(i.openBlock(),i.createBlock(G_,{key:T,prefix:E.prefix,item:w,index:T,onUpdate:x[2]||(x[2]=D=>E.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=D=>k(D)),onOpenLightbox:x[4]||(x[4]=D=>m(D))},null,8,["prefix","item","index"]))),128)),h.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",iS,x[9]||(x[9]=[i.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):i.createCommentVNode("",!0),i.createVNode(C,{modelValue:s.value,"onUpdate:modelValue":x[5]||(x[5]=w=>s.value=w),startIndex:l.value,"onUpdate:index":x[6]||(x[6]=w=>l.value=w),images:p.value},null,8,["modelValue","startIndex","images"]),i.createVNode(S,i.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=w=>c.value=w),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),cS={class:"flex items-center justify-between"},dS={class:"text-[16px] text-gray-900 font-medium"},uS={class:"grid gap-3"},fS=i.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",cS,[i.createElementVNode("p",dS,i.toDisplayString(n.title),1),i.createVNode(Up,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),style:i.normalizeStyle(n.style)},null,8,["modelValue","style"])]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",uS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),pS=ge(fS,[["__scopeId","data-v-90320b87"]]),hS={class:"text-[16px] text-gray-900 font-medium"},mS={class:"grid gap-3"},gS=i.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=s=>t.value=!t.value),class:"flex items-center gap-2"},[i.createVNode(i.unref(pv),{class:i.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),i.createElementVNode("span",hS,i.toDisplayString(n.title),1)]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",mS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),yS=ge(gS,[["__scopeId","data-v-590eff11"]]),bS={class:"flex items-center justify-between"},kS=i.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",bS,[i.createElementVNode("p",null,i.toDisplayString(n.title),1)]),i.renderSlot(e.$slots,"default")]))}}),xS={switcher:pS,accordion:yS,default:kS},It={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},wS=(n,e)=>String(n)===String(e),ES=(n,e)=>String(n)!==String(e),CS=(n,e)=>n>e,vS=(n,e)=>n>=e,_S=(n,e)=>n<e,SS=(n,e)=>n<=e,NS=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,MS=(n,e)=>String(n).startsWith(String(e)),TS=(n,e)=>String(n).endsWith(String(e)),AS=(n,e)=>String(n).includes(String(e)),BS=(n,e)=>Array.isArray(e)?e.includes(n):!1,VS=(n,e)=>Array.isArray(e)?!e.includes(n):!0,Zp=(n,e)=>{if(!e)return!0;switch(e?.[1]){case It.Equal:return wS(n,e?.[2]);case It.Inequal:return ES(n,e?.[2]);case It.Higer:return CS(n,e?.[2]);case It.HigerOrEqual:return vS(n,e?.[2]);case It.Lower:return _S(n,e?.[2]);case It.LowerOrEqual:return SS(n,e?.[2]);case It.Between:return NS(n,e?.[2]);case It.StartWith:return MS(n,e?.[2]);case It.EndWith:return TS(n,e?.[2]);case It.Contain:return AS(n,e?.[2]);case It.In:return BS(n,e?.[2]);case It.NotIn:return VS(n,e?.[2]);default:return!0}},LS=i.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(n){const e=n,t=i.inject("values",i.ref({})),r=i.inject("form"),o=i.computed(()=>e.schema?.filter(a=>{const c=a?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=e.name?t.value?.[e.name]?.[d]??t.value?.[d]:t.value?.[d];return Zp(u,c)})),s=i.computed(()=>xS[e.view]),l=i.computed(()=>{if(t.value||(t.value={}),!e.name)return t.value;const a=t.value[e.name];if(a)return a;const c={};return t.value={...t.value,[e.name]:c},c});return(a,c)=>n.schema?.length?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value),{key:0,title:n.title,style:i.normalizeStyle(n.style)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,d=>(i.openBlock(),i.createBlock(th,i.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:l.value[d.name],"onUpdate:modelValue":u=>l.value[d.name]=u,style:n.style,error:i.unref(r)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):i.createCommentVNode("",!0)}}),OS=["aria-expanded","data-focus"],IS={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},DS={class:"flex items-center min-w-0"},RS=["title"],FS=["innerHTML"],PS=["onClick"],$S={class:"flex-1 min-w-[2px]"},zS=["placeholder"],HS=["title"],jS=["innerHTML"],US={key:2,class:"flex-1 min-w-[2px]"},WS=["placeholder"],KS={class:"flex items-center shrink-0"},qS=["disabled"],GS=["disabled","title"],JS=["aria-disabled","onClick"],YS=["innerHTML"],XS={key:1,class:"px-3 py-2 text-center text-gray-500"},ZS=["disabled"],Qp=i.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.multiple),s=i.computed(()=>t.disabled);St(t.style);const l=i.computed({get:()=>t.modelValue,set:V=>r("update:modelValue",V)});!l.value&&t.defaultValue&&(l.value=t.defaultValue);const a=i.ref(null),c=i.ref(null),d=i.ref(null),u=i.ref(null),f=i.ref(!1),p=i.ref(!1),h=i.ref(null),m=i.ref([]),g=i.ref(-1),y=i.ref([]),b=i.ref(""),k=i.ref(null),E=i.ref("bottom"),x=i.ref({}),C=i.ref([]),S=i.computed(()=>{if(!C.value.length)return[];const V=m.value,$=new Map(V.map(q=>[q.id?.toString(),q]));return C.value.map(q=>$.get(q?.toString())).filter(q=>!!q)}),w=i.computed(()=>t.placeholder||"Select..."),T=i.computed(()=>K(h.value));i.computed(()=>o.value?!C.value.length&&b.value==="":!T.value&&b.value==="");const D=i.computed(()=>s.value?!1:o.value?C.value.length>0:!!l.value),R=V=>o.value?C.value.some($=>$?.toString()===V?.toString()):l.value?.toString()===V?.toString(),A=i.computed(()=>{let V=m.value??[];if(!t.data&&b.value.trim()!==""){const $=b.value.toLowerCase();V=V.filter(q=>{const ae=K(q).toLowerCase(),_e=q.text?.toLowerCase?.()||"";return ae.includes($)||_e.includes($)})}if(o.value&&C.value.length){const $=new Set(C.value.map(q=>q?.toString()));V=V.filter(q=>!$.has(q.id?.toString()))}return V}),B=i.inject("values"),W=/\{\{\s*([^}]+?)\s*\}\}/g,Q=V=>(V?String(V):"").replace(/<[^>]*>/g,"").trim(),I=i.computed(()=>t.slot??t?.optionTemplate??""),z=V=>{if(!V)return"";const $=I.value;return $?$.replace(W,(q,ae)=>{const _e=ae.trim(),Qe=V[_e];return Qe!=null?String(Qe):""}):V.text??""},K=V=>{if(!V)return"";if(!I.value)return V.text??"";const $=z(V);return Q($)||V.text||""},ee=V=>{t.set&&B?.value&&Object.entries(t.set).forEach(([$,q])=>{if(!$)return;const ae=V?V[q]:null;B.value[$]=ae??null})},re=i.computed(()=>t.parent?B?.value?.[t.parent]?.toString()??null:null),xe=async V=>{if(!t.data){let $=t.options??[];if(V?.trim()){const q=V.toLowerCase();$=$.filter(ae=>{const _e=K(ae).toLowerCase(),Qe=ae.text?.toLowerCase?.()||"";return _e.includes(q)||Qe.includes(q)})}return $}try{const $=t.host??"",q=t.prefix??"api",ae=t.api??`/${q}/suggest/${t.data}`,_e=`${$}${ae}`,Qe=new URLSearchParams;return Qe.set("json","1"),V&&Qe.set("key",V),re.value!==void 0&&re.value!==null&&re.value!==""&&Qe.set("parent",re.value),(await fetch(`${_e}?${Qe.toString()}`).then(Mt=>Mt.json()))?.data??[]}catch{return[]}},Ze=async()=>{t.data?m.value=await xe(b.value):m.value=t.options?[...t.options]:[]},ht=async V=>{if(V==null)return null;const $=m.value?.find(q=>q?.id?.toString()===String(V));if($)return $;if(t.data)try{const q=t.host??"",ae=t.prefix??"api",_e=t.api??`/${ae}/suggest/${t.data}`,Qe=`${q}${_e}`,Mt=new URLSearchParams;return Mt.set("json","1"),Mt.set("val",String(V)),re.value!==void 0&&re.value!==null&&re.value!==""&&Mt.set("parent",re.value),((await fetch(`${Qe}?${Mt.toString()}`).then(Wr=>Wr.json()))?.data??[])?.[0]??null}catch{return null}return null},mt=async V=>{const $=new Set(m.value.map(ae=>ae.id?.toString())),q=V.filter(ae=>!$.has(ae?.toString()));q.length&&await q.reduce(async(ae,_e)=>{await ae;const Qe=await ht(_e);Qe&&m.value.push(Qe)},Promise.resolve())},Ke=async()=>{s.value||(f.value=!0,await Ze(),await i.nextTick(()=>{$t(),k.value?.focus(),A.value.length?g.value=0:g.value=-1}))},gt=()=>{f.value=!1,g.value=-1},En=async V=>{s.value||(f.value?gt():await Ke())},Cn=async()=>{f.value?k.value?.focus():await Ke()},vn=()=>{o.value?(C.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null)),ee(null),b.value="",i.nextTick(()=>k.value?.focus())},xr=V=>{o.value&&(C.value=C.value.filter($=>$?.toString()!==V?.toString()),l.value=[...C.value],r("change",l.value),i.nextTick(()=>k.value?.focus()))},yt=V=>{o.value?(R(V.id)||(C.value=[...C.value,V.id],l.value=[...C.value],r("change",l.value)),b.value="",i.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,A.value.length-1)}),ee(null)):(h.value=V,l.value=V.id,r("change",l.value),b.value="",gt(),ee(V))},Pt=V=>{R(V.id)||yt(V)},cn=(V,$)=>{if(!V||!$)return;const q=V.offsetTop,ae=q+V.offsetHeight,_e=$.scrollTop,Qe=_e+$.clientHeight;let Mt=$.scrollTop;q<_e?Mt=q-80:ae>Qe&&(Mt=ae-$.clientHeight+4);const Wr=$;Wr.scrollTop=Mt},qe=V=>{let $=V.parentElement;for(;$;){if($.classList.contains("ui-dialog__content"))return $;const q=window.getComputedStyle($),ae=q.overflow+q.overflowY+q.overflowX;if(ae.includes("auto")||ae.includes("scroll")||$===document.body||$===document.documentElement)return $;$=$.parentElement}return document.body},$t=()=>{if(!c.value)return;const V=c.value.getBoundingClientRect(),$=window.innerHeight||document.documentElement.clientHeight,q=window.innerWidth||document.documentElement.clientWidth,ae=8,_e=8,Qe=t.maxHeight||300,Mt=$-V.bottom-_e-ae,Wr=V.top-_e-ae,Dl=Mt>=Wr,mc=Math.max(q-ae*2,0);let{width:jo}=V;mc>0&&jo>mc&&(jo=mc);let{left:Uo}=V;Uo+jo+ae>q&&(Uo=q-jo-ae),Uo=Math.max(Uo,ae);const iO=Math.min(Qe,Math.max(Dl?Mt:Wr,50));E.value=Dl?"bottom":"top",x.value={position:"fixed",left:`${Uo}px`,width:`${jo}px`,minWidth:"300px",maxHeight:`${iO}px`,transform:Dl?"none":"translateY(-100%)",top:Dl?`${V.bottom+_e}px`:`${V.top-_e}px`}},qt=async V=>{s.value||!f.value&&(V.key==="ArrowDown"||V.key==="ArrowUp")&&(V.preventDefault(),await Ke())},dn=V=>{if(!f.value)return;const{key:$}=V;if($==="ArrowDown")V.preventDefault(),g.value+1<A.value.length&&(g.value+=1,cn(y.value[g.value],d.value));else if($==="ArrowUp")V.preventDefault(),g.value>0&&(g.value-=1,cn(y.value[g.value],d.value));else if($==="Enter"){V.preventDefault();const q=A.value[g.value];q&&yt(q),k.value?.blur()}else $==="Escape"?(V.preventDefault(),gt()):$==="Backspace"?o.value&&b.value===""&&C.value.length&&(C.value=C.value.slice(0,-1),l.value=[...C.value],r("change",l.value)):$==="Home"?(g.value=0,cn(y.value[0],d.value)):$==="End"?(g.value=A.value.length-1,cn(y.value[g.value],d.value)):$==="Tab"&&gt()},Xn=()=>{s.value||(p.value=!0)},_=()=>{p.value=!1,b.value=""},N=V=>{V.key==="Escape"&&f.value&&gt()},P=V=>{const $=V.target;a.value?.contains($)||u.value?.contains($)||gt()},X=V=>{f.value&&d.value&&!d.value.contains(V.target)&&$t()},Ee=()=>{f.value&&$t()},Be=()=>{f.value&&$t()};i.watch(()=>t.options,V=>{V?.length&&(m.value=[...V],pe())},{immediate:!0});async function pe(){if(o.value)Array.isArray(l.value)?C.value=[...l.value]:(C.value=l.value==null?[]:[l.value],l.value=[...C.value]),t.data&&C.value.length&&(await mt(C.value),await i.nextTick());else{if(Array.isArray(l.value)){const V=l.value[0]??null;l.value=V??null}l.value!=null&&(h.value=await ht(l.value)),ee(h.value??null)}}i.watch(l,()=>{pe()}),i.onMounted(async()=>{addEventListener("keydown",N),addEventListener("scroll",X,!0),addEventListener("resize",Ee),document.addEventListener("click",P,!0),c.value&&qe(c.value).addEventListener("scroll",Be,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await xe("")),await pe(),fe.value=!1}),i.onUnmounted(()=>{removeEventListener("keydown",N),removeEventListener("scroll",X,!0),removeEventListener("resize",Ee),document.removeEventListener("click",P,!0),c.value&&qe(c.value).removeEventListener("scroll",Be,!0)});const O=i.ref(!1),H=i.ref({}),he=i.ref([]),v=i.ref(null);async function M(){if(!t.add?.token||v?.value.validate())return;const V=t.add.api??`/api/table/${t.add.token}`,{id:$}=await fetch(V,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H.value)}).then(q=>q.json());if(!t.options?.length&&t.data){const{data:q}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${$}`).then(ae=>ae.json());h.value=q[0],m.value.push(q[0]),l.value=$}O.value=!1,Ie({title:"Success!",message:"Object created."})}async function U(){if(!t.add)return null;const V=await fetch(`/api/template/form/${t.add.form}`).then($=>$.json());return he.value=V.schema,O.value=!0,null}function G(V,$=200){let q;return(...ae)=>{q&&clearTimeout(q),q=window.setTimeout(()=>V(...ae),$)}}const Z=G(async V=>{m.value=await xe(V)},200);i.watch(b,V=>{t.data&&Z(V.trim())}),i.watch(()=>t.options,V=>{!t.data&&V?.length&&(m.value=[...V],pe())},{immediate:!0}),i.watch(()=>t.parent??t.parentValue,()=>{t.data&&Ze()});const fe=i.ref(!0);return i.watch(re,async()=>{if(t.data&&(fe.value||(o.value?(C.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null))),await Ze(),t.auto===1&&re.value&&m.value.length>0)){const V=m.value[0];V&&yt(V)}}),(V,$)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(i.unref(Va),{visible:O.value,"onUpdate:visible":$[1]||($[1]=q=>O.value=q),title:"Додати",buttonText:"Додати",onDone:M,teleport:V.teleport},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:he.value,modelValue:H.value,"onUpdate:modelValue":$[0]||($[0]=q=>H.value=q),ref_key:"addForm",ref:v},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),i.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:a,onClick:$[5]||($[5]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass])},[$[10]||($[10]=i.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),$[11]||($[11]=i.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||p.value?"border-blue-500 ring-1 ring-blue-500":"",s.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:qt,onClick:Cn,"data-focus":f.value||p.value?"true":"false"},[i.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:c},[o.value?(i.openBlock(),i.createElementBlock("div",IS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(S.value,q=>(i.openBlock(),i.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:q.id},[i.createElementVNode("div",DS,[q?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:i.normalizeStyle({backgroundColor:q?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:K(q)},[I.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:z(q)},null,8,FS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(q.text),1)],64))],8,RS)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:i.withModifiers(ae=>xr(q.id),["stop"])},$[6]||($[6]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,PS)]))),128)),i.createElementVNode("div",$S,[!s.value&&V.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:C.value.length?" ":w.value,"onUpdate:modelValue":$[2]||($[2]=q=>b.value=q),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,zS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)])])):!o.value&&!p.value&&T.value&&b.value===""?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["truncate text-gray-900"]),title:T.value},[h.value?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:i.normalizeStyle({backgroundColor:h.value?.color})},null,4)):i.createCommentVNode("",!0),I.value?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({"pl-5":h.value?.color}),innerHTML:z(h.value)},null,10,jS)):(i.openBlock(),i.createElementBlock("span",{key:2,class:i.normalizeClass({"pl-5":h.value?.color})},i.toDisplayString(h.value?.text),3))],8,HS)):i.createCommentVNode("",!0),o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",US,[!s.value&&V.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:T.value?" ":w.value,"onUpdate:modelValue":$[3]||($[3]=q=>b.value=q),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,WS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)]))],512),i.createElementVNode("div",KS,[D.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:i.withModifiers(vn,["stop"])},$[7]||($[7]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,qS)):i.createCommentVNode("",!0),$[9]||($[9]=i.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),i.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:$[4]||($[4]=i.withModifiers(q=>En(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},$[8]||($[8]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,GS)])],42,OS),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[f.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:i.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:i.normalizeStyle(x.value),role:"listbox"},[i.createElementVNode("div",{class:"overflow-y-auto py-1",style:i.normalizeStyle({maxHeight:x.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[A.value.length?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(A.value,(q,ae)=>(i.openBlock(),i.createElementBlock("div",{key:q.id,ref_for:!0,ref:_e=>y.value[ae]=_e,class:i.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",R(q.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===ae&&!R(q.id)?"bg-blue-100":""]),"aria-disabled":R(q.id)?"true":"false",role:"option",tabindex:"-1",onClick:_e=>Pt(q)},[q?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:i.normalizeStyle({backgroundColor:q?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["leading-[19px]",g.value===q.id?"text-white":"",(g.value,"")])},[I.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:z(q)},null,8,YS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(q.text),1)],64))],2)],10,JS))),128)):(i.openBlock(),i.createElementBlock("div",XS," No options "))],4)],4)):i.createCommentVNode("",!0)]))],2),t.add?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:U,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:s.value,type:"button"},[i.createVNode(To,{width:"16",height:"16"}),$[12]||($[12]=i.createElementVNode("span",null,"Додати",-1))],8,ZS)):i.createCommentVNode("",!0)],512)],64))}}),QS=["placeholder","disabled"],eN=i.defineComponent({__name:"vs-input-textarea",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,row:"2",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,QS)),[[i.vModelText,r.value]])}}),tN={},nN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function rN(n,e){return i.openBlock(),i.createElementBlock("svg",nN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const oN=ge(tN,[["render",rN]]),sN={},lN={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function iN(n,e){return i.openBlock(),i.createElementBlock("svg",lN,e[0]||(e[0]=[i.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),i.createElementVNode("path",{d:"M7 20V4"},null,-1),i.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),i.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const aN=ge(sN,[["render",iN]]),cN={},dN={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function uN(n,e){return i.openBlock(),i.createElementBlock("svg",dN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const fN=ge(cN,[["render",uN]]),pN={},hN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function mN(n,e){return i.openBlock(),i.createElementBlock("svg",hN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const gN=ge(pN,[["render",mN]]),yN={},bN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function kN(n,e){return i.openBlock(),i.createElementBlock("svg",bN,e[0]||(e[0]=[i.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const eh=ge(yN,[["render",kN]]),xN={},wN={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function EN(n,e){return i.openBlock(),i.createElementBlock("svg",wN,e[0]||(e[0]=[i.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const CN=ge(xN,[["render",EN]]),vN={},_N={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function SN(n,e){return i.openBlock(),i.createElementBlock("svg",_N,e[0]||(e[0]=[i.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const NN=ge(vN,[["render",SN]]),MN={class:"vs-datatable border rounded-xl w-full flex-grow"},TN={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},AN={class:"relative w-full"},BN={class:"table-wrapper flex gap-2"},VN={class:"vs-popover inline-block text-slate-700"},LN={class:"text-center"},ON={class:""},IN={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},DN={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},RN={class:"text-sm items-center text-gray-800 flex gap-1"},FN={class:"w-full overflow-x-auto"},PN={class:"w-full table-auto caption-bottom text-sm"},$N={class:"[&_tr]:border-b"},zN={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},HN={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},jN={key:0,colspan:"100%",class:"text-center"},UN={class:"w-full"},WN={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},KN=["onDragstart","onDragover","onDrop"],qN={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},GN={class:"flex items-center justify-center"},JN={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},YN={key:0},XN=["src"],ZN={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},QN=["innerHTML"],eM={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},tM={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},nM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},rM={class:"flex items-center justify-center gap-2"},oM=["onClick"],sM=["onClick"],lM={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},iM=i.defineComponent({__name:"vs-input-datatable",props:i.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref({}),o=i.ref(""),s=i.computed(()=>{if(!o.value)return t.value??[];const I=o.value.toLowerCase();return t.value.filter(z=>e.colModel?.some(K=>{const ee=z[K.key];return ee?Array.isArray(ee)?ee.join(", ").toLowerCase().includes(I):String(ee).toLowerCase().includes(I):!1}))}),l=i.ref(null),a=i.ref(null),c=i.ref(!1),d=i.ref(null),u=i.ref({top:0,left:0}),f=I=>{l.value=I},p=I=>{a.value=I},h=I=>{if(l.value===null||l.value===I){l.value=null,a.value=null;return}const z=[...t.value],[K]=z.splice(l.value,1);z.splice(I,0,K),t.value=z,l.value=null,a.value=null},m=I=>{const z=I.currentTarget.getBoundingClientRect();u.value={top:z.bottom+window.scrollY,left:z.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=I=>{const z=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],K=I.toLowerCase();return z.some(ee=>K.endsWith(ee))},b=I=>{const z=I.target.files?.[0];if(!z)return;const K=new FileReader;K.onload=ee=>{try{const re=ee.target?.result;if(typeof re=="string"){const xe=JSON.parse(re);Array.isArray(xe)&&t.value.push(...xe)}}catch(re){console.error("Error parsing file:",re)}},K.readAsText(z)},k=()=>{const I=JSON.stringify(t.value,null,2),z=new Blob([I],{type:"application/json"}),K=URL.createObjectURL(z),ee=document.createElement("a");ee.href=K,ee.download="data.json",ee.click(),URL.revokeObjectURL(K)};i.onMounted(async()=>{const I=e.colModel?.filter(z=>z.data);I?.length&&Promise.all(I.map(async z=>{const K=await(await fetch(`/api/suggest/${z.data}`)).json();r.value[z.key]=K.data}))});const E=i.ref(""),x=i.ref(!1);let C="edit",S=0;const w=i.ref({}),T=i.ref({});async function D(){E.value="Додати",x.value=!0,C="add",w.value={}}function R(I,z){const K=z.key||z.name;return r.value[K]&&I[K]?r.value[K].find(ee=>ee.id.toString()===I[K].toString())?.text??I[K]:I[K]||"-"}async function A(I,z){E.value="Редагувати",x.value=!0,C="edit",S=z,w.value={...I}}function B(){const I=T.value.validate();if(I){Ie({type:"warning",title:"Помилка валідації",message:Object.entries(I).map(([z,K])=>`${z}: ${K}`).join(`
105
- `)});return}C==="add"?Array.isArray(t.value)?t.value=[...t.value,w.value]:t.value=[w.value]:t.value=t.value.map((z,K)=>K===S?w.value:z),x.value=!1}function W(I){t.value=t.value.filter((z,K)=>K!==I)}function Q(){x.value=!1}return(I,z)=>(i.openBlock(),i.createElementBlock("div",MN,[i.createElementVNode("div",TN,[i.createElementVNode("div",AN,[i.createVNode(oN,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":z[0]||(z[0]=K=>o.value=K),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[i.vModelText,o.value]])]),i.createElementVNode("div",BN,[i.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),i.createElementVNode("div",VN,[i.createElementVNode("div",LN,[i.createElementVNode("div",ON,[i.createElementVNode("button",{onClick:m,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(aN,{height:"16",width:"16"})])])])])]),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:i.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:u.value.top+"px",left:u.value.left+"px"}])},[i.createElementVNode("div",IN,[i.createElementVNode("div",DN,[i.createElementVNode("button",{onClick:g,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createVNode(fN,{class:"text-black",width:"14",height:"14"}),z[4]||(z[4]=i.createTextVNode(" Імпортувати ",-1))]),i.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createElementVNode("span",RN,[i.createVNode(gN,{class:"text-black",width:"14",height:"14"}),z[5]||(z[5]=i.createTextVNode(" Експортувати ",-1))])])])])],4)):i.createCommentVNode("",!0)])),i.createElementVNode("button",{onClick:D,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(To),z[6]||(z[6]=i.createTextVNode(" Додати ",-1))])]),i.createElementVNode("div",FN,[i.createElementVNode("table",PN,[i.createElementVNode("thead",$N,[i.createElementVNode("tr",zN,[i.createElementVNode("th",HN,[i.createVNode(eh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(I.colModel,K=>(i.openBlock(),i.createElementBlock("th",{key:K.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},i.toDisplayString(K.ua||K.label),1))),128)),z[7]||(z[7]=i.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),i.createElementVNode("tbody",{class:i.normalizeClass({"[&_tr:last-child]:border-0":!a.value})},[s.value.length===0?(i.openBlock(),i.createElementBlock("td",jN,[i.createElementVNode("div",UN,[i.createElementVNode("div",WN,[i.createVNode(CN,{class:"w-48 mx-auto"}),z[8]||(z[8]=i.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[i.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),i.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(K,ee)=>(i.openBlock(),i.createElementBlock("tr",{key:K.id,class:i.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":l.value===ee,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":a.value===ee}]),draggable:"true",onDragstart:re=>f(ee),onDragover:i.withModifiers(re=>p(ee),["prevent"]),onDrop:re=>h(ee)},[i.createElementVNode("td",qN,[i.createElementVNode("div",GN,[i.createVNode(eh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(I.colModel,re=>(i.openBlock(),i.createElementBlock("td",{key:re.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[re.type==="file"?(i.openBlock(),i.createElementBlock("div",JN,[y(R(K,re))?(i.openBlock(),i.createElementBlock("div",YN,[i.createElementVNode("img",{src:R(K,re),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,XN)])):(i.openBlock(),i.createElementBlock("div",ZN,[i.createVNode(Jp,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):re.type==="tiptap-editor"?(i.openBlock(),i.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:R(K,re)},null,8,QN)):re.type==="reference"?(i.openBlock(),i.createElementBlock("div",eM,i.toDisplayString(R(K,re)),1)):(i.openBlock(),i.createElementBlock("div",tM,i.toDisplayString(R(K,re)),1))]))),128)),i.createElementVNode("td",nM,[i.createElementVNode("div",rM,[i.createElementVNode("button",{onClick:re=>A(K,ee),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(NN,{width:"24",height:"24",class:"w-3 h-3"})],8,oM),i.createElementVNode("button",{onClick:re=>W(ee),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(kl,{width:"24",height:"24",class:"w-3 h-3"})],8,sM)])])],42,KN))),128))],2)])]),i.createVNode(i.unref(Va),{teleport:"#modal",visible:x.value,title:E.value,size:"lg",onClose:Q},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:e.colModel,values:w.value,"onUpdate:values":z[1]||(z[1]=K=>w.value=K),form:T.value,"onUpdate:form":z[2]||(z[2]=K=>T.value=K)},null,8,["schema","values","form"]),i.createElementVNode("div",lM,[i.createElementVNode("button",{type:"button",onClick:z[3]||(z[3]=K=>x.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:B,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),aM={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function Ao(n){return n?n.type==="Polygon"?{type:"MultiPolygon",coordinates:[n.coordinates]}:n.type==="Feature"?{...n,geometry:Ao(n.geometry)}:n.type==="FeatureCollection"?{...n,features:(n.features||[]).map(e=>Ao(e)).filter(Boolean)}:n:null}function cM(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?Ao(n):n.geom?{type:"Feature",geometry:Ao({type:n.geom.type,coordinates:n.geom.coordinates}),properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:Ao(n),properties:{}}:null:null}const dM={},uM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function fM(n,e){return i.openBlock(),i.createElementBlock("svg",uM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),i.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const pM=ge(dM,[["render",fM]]),hM={},mM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function gM(n,e){return i.openBlock(),i.createElementBlock("svg",mM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const yM=ge(hM,[["render",gM]]),bM={},kM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function xM(n,e){return i.openBlock(),i.createElementBlock("svg",kM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const wM=ge(bM,[["render",xM]]),EM={},CM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function vM(n,e){return i.openBlock(),i.createElementBlock("svg",CM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const _M=ge(EM,[["render",vM]]),SM={},NM={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function MM(n,e){return i.openBlock(),i.createElementBlock("svg",NM,e[0]||(e[0]=[i.createElementVNode("title",null,null,-1),i.createElementVNode("desc",null,null,-1),i.createElementVNode("defs",null,null,-1),i.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[i.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[i.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[i.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const TM=ge(SM,[["render",MM]]),AM={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},BM={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},VM=["onClick"],LM={class:"relative flex-1 min-w-[140px]"},OM=["placeholder"],IM="https://data.softpro.ua/api-user/gis-url-proxy",DM="https://geo.rv.ua/api-user/dzk.api",RM=i.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(n,{emit:e}){const t=n,r=e,o=["here","xy","parcel"],s=i.computed(()=>{const x=t.config?.tools?.filter(C=>o.includes(C));return x&&x.length?x:o}),l=i.computed(()=>t.config?.placeholder?.trim()||"Пошук…"),a=i.ref(s.value[0]??o[0]);i.watch(s,x=>{x.includes(a.value)||(a.value=x[0])});const c=i.ref(""),d=i.ref(!1),u=i.ref(null);i.watch(a,()=>{c.value="",d.value=!1});function f(x){a.value=x}function p(x){if(!d.value)return;const C=u.value;C&&!C.contains(x.target)&&(d.value=!1)}i.onMounted(()=>{window.addEventListener("click",p,!0)}),i.onBeforeUnmount(()=>{window.removeEventListener("click",p,!0)});function h(x){return x==="xy"?"Координати":x==="parcel"?"Кадастр":"Адреси"}function m(x){const C=x.replace(/[,]+/g," ").trim();if(!C)return null;const S=C.split(/\s+/).filter(Boolean);if(S.length<2)return null;const w=S.slice(0,2).map(Number);if(!w.every(Q=>Number.isFinite(Q)))return null;let[T,D]=w,R=T,A=D;const B=Q=>Math.abs(Q)<=90,W=Q=>Math.abs(Q)<=180;if(!B(R)||!W(A))if(B(A)&&W(R))R=D,A=T;else return null;return{lat:R,lng:A}}function g(x){return(x?.items||[]).map((C,S)=>({id:String(C?.id??S),title:C?.title||C?.address?.label||"Знайдений обʼєкт",lat:Number(C?.position?.lat),lng:Number(C?.position?.lng)})).filter(C=>Number.isFinite(C.lat)&&Number.isFinite(C.lng))}function y(x){const C=x?.result||x?.data||x;if(!C)return[];const S=C.geom_centroid;if(!S||!Array.isArray(S.coordinates))return[];const[w,T]=S.coordinates;return!Number.isFinite(T)||!Number.isFinite(w)?[]:[{id:"parcel",title:C.cadnum||C.cad_num||"Земельна ділянка",lat:T,lng:w}]}function b(x){const C=x.replace(/\s+/g,"").split(":");if(C.length!==4)return!1;const S=[10,2,3,4];return C.every((w,T)=>w.length===S[T]&&/^\d+$/.test(w))}function k(x){r("goToCoordinates",[x.lat,x.lng])}async function E(){const x=c.value.trim();if(x){if(a.value==="xy"){const C=m(x);if(!C){Ie({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(C),c.value="";return}try{const C=new URL(a.value==="here"?IM:DM);if(a.value==="here")C.searchParams.set("searchtext",x);else{if(!b(x)){Ie({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}C.searchParams.set("cad_num",x)}const S=await fetch(C.toString());if(!S.ok)throw new Error(`HTTP ${S.status}`);const w=await S.json(),T=a.value==="here"?g(w):y(w);if(!T.length)Ie({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const D=T[0];k(D),c.value=""}}catch(C){const S=C?.message||"Помилка пошуку";Ie({type:"error",title:"Пошук",message:S})}}}return(x,C)=>(i.openBlock(),i.createElementBlock("div",AM,[i.createElementVNode("form",{class:"flex gap-2",onSubmit:i.withModifiers(E,["prevent"])},[s.value.length>1?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[i.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:C[0]||(C[0]=S=>d.value=!d.value)},[i.createElementVNode("span",null,i.toDisplayString(h(a.value)),1),(i.openBlock(),i.createElementBlock("svg",{class:i.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},C[2]||(C[2]=[i.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(i.openBlock(),i.createElementBlock("div",BM,[i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,S=>(i.openBlock(),i.createElementBlock("li",{key:S,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:w=>f(S)},i.toDisplayString(h(S)),9,VM))),128))])])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createElementVNode("div",LM,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":C[1]||(C[1]=S=>c.value=S),placeholder:l.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,OM),[[i.vModelText,c.value,void 0,{trim:!0}]]),C[3]||(C[3]=i.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),FM=ge(RM,[["__scopeId","data-v-3048520a"]]),PM={class:"bg-white/30 p-1 rounded-md shadow"},$M={class:"flex gap-2"},zM=["onClick","title"],HM=["src"],jM=i.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(n,{emit:e}){const t=i.ref(Object.keys(n.basemaps)[0]),r=e;function o(s){r("onLayerChange",s),t.value=s}return(s,l)=>(i.openBlock(),i.createElementBlock("div",PM,[i.createElementVNode("div",$M,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.basemaps,(a,c)=>(i.openBlock(),i.createElementBlock("div",{key:c,class:i.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":t.value===c}]),onClick:d=>o(c),title:a.name||c,role:"button",tabindex:"0"},[i.createElementVNode("img",{src:a.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,HM)],10,zM))),128))])]))}}),UM={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},WM={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},KM={class:"text-sm font-medium"},qM={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},GM={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},JM={class:"flex items-center gap-1"},YM=["disabled"],XM=["disabled"],ZM=["disabled"],QM={class:"absolute top-4 right-4 z-[1000]"},eT={class:"flex flex-col gap-[2px]"},tT=["disabled"],nT=["disabled"],rT=["disabled"],oT=["disabled"],sT={class:"flex flex-col gap-2"},lT={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},iT={class:"flex flex-col gap-1"},aT=["checked","disabled","onChange"],cT={class:"text-gray-700 text-xs font-medium"},dT={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},uT={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},fT={class:"shrink-0"},pT={class:"font-bold"},hT={class:"flex items-center"},mT={class:"text-xs mr-2"},gT={key:0,class:"text-xs"},yT={key:1,class:"text-xs"},bT=["disabled"],kT=["disabled"],xT=i.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=i.getCurrentInstance(),r=n,o=e,s=i.computed(()=>{const v={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools||!r.tools.length)return v;const M=new Set(r.tools.map(U=>U.toLowerCase()));return{search:M.has("search"),import:M.has("import"),export:M.has("export"),point:M.has("point"),line:M.has("line"),polygon:M.has("polygon"),rectangle:M.has("rectangle")}}),l=i.computed(()=>!!r.disabled),a=i.ref(!1),c=i.ref(null),d=i.ref(null),u=i.ref(!1),f=i.ref(""),p=i.reactive({}),h=i.ref([]),m=i.computed(()=>h.value.map(v=>p[v]).filter(v=>!!v)),g=i.computed(()=>Array.isArray(r.layers)&&r.layers.some(v=>`${v?.service??""}`.toLowerCase()==="vtile"));let y,b,k;function E(){return navigator.platform.toUpperCase().indexOf("MAC")>=0,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const x=i.ref(null),C=i.ref(null);let S=null;const w=i.ref(null),T=v=>{v.ctrlKey&&v.preventDefault()};function D(v,M){return v?.id?String(v.id):v?.url?`${v.url}-${M}`:`layer-${M}`}function R(v){if(!v)return"";if(/^https?:\/\//i.test(v))return v.replace(/\/+$/,"");const M=v.replace(/^\/+/,"").replace(/\/+$/,"");return M?`/${M}`:""}function A(v){const M=v?.url??"";if(!M||/^https?:\/\//i.test(M))return M;const U=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(M.startsWith("/"))return U?`${U}${M}`:M;const G=R(v?.prefix),Z=R(r.prefix),fe=G||Z,V=M.replace(/^\/+/,""),$=fe?`${fe.replace(/\/$/,"")}/${V}`:`/${V}`;return U?`${U}${$}`:$}function B(v){const M=v?.style??{};return U=>{const G=M.colorAttr,Z=M.colorSet??{},fe=typeof G=="string"?Z?.[U?.[G]]??M.color??"#3388ff":M.color??"#3388ff",V=M.stroke??fe;return{weight:M.width??1,color:V,opacity:M.opacity??1,fill:M.type?M.type!=="polyline":!0,fillColor:fe,fillOpacity:M.opacity??.5}}}function W(v){const M=v?.colorSet||v?.colors;if(v?.colorAttr&&M){const U=Object.entries(M).flat();return["match",["get",v.colorAttr],...U,v.color??"#94a3b8"]}return v?.color??"#3388ff"}function Q(v,M,U){if(!v)return[];const G=[],Z=W(v);return v.icon&&G.push({id:`${M}-icon`,type:"symbol",source:M,"source-layer":U,minzoom:v.iconZoom||0,layout:{"icon-image":v.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),v.pointZoom&&G.push({id:`${M}-point`,type:"circle",source:M,"source-layer":U,maxzoom:v.pointZoom,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Z,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),v.type==="polygon"?G.push({id:`${M}-fill`,type:"fill",source:M,"source-layer":U,minzoom:v.pointZoom||0,paint:{"fill-color":Z,"fill-opacity":v.opacity??.5,"fill-outline-color":v.stroke||Z}}):v.type==="line"?G.push({id:`${M}-line`,type:"line",source:M,"source-layer":U,paint:{"line-color":Z,"line-opacity":v.opacity??1,"line-width":v.width??1.5}}):v.icon||G.push({id:`${M}-circle`,type:"circle",source:M,"source-layer":U,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Z,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),G}function I(v,M){const U=v.id||`source-${Math.random().toString(36).slice(2,8)}`,G=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name||U,Z=Q(v.style||{},U,G||U);return Z.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[U]:{type:"vector",tiles:[M],minzoom:v.minzoom??0,maxzoom:v.maxzoom??19}},layers:Z}:null}function z(v){const M=(v?.service??"").toLowerCase(),U=A(v),G=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name;if(console.info("[vs-input-map] create overlay layer",{id:v.id,service:M,url:U,sourceLayer:G,hasSourceLayer:!!G}),M==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(U,{interactive:!0,vectorTileLayerStyles:{default:B(v)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const Z=I(v,U);return Z?L.maplibreGL({style:Z,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",v.id),null)}return null}return M==="tile"||/^https?:\/\//i.test(U)||U.includes("{z}")?L.tileLayer(U,{opacity:v?.style?.opacity??1}):L.tileLayer(U,{opacity:v?.style?.opacity??1})}function K(){y&&h.value.forEach(v=>{const M=p[v];M&&(M.visible?(M.layer||(M.layer=z(M.config)),M.layer&&!y.hasLayer(M.layer)?(console.info("[vs-input-map] add overlay layer to map",M.id),M.layer.addTo(y)):M.layer||console.warn("[vs-input-map] overlay layer is null",M.id)):M.layer&&y.hasLayer(M.layer)&&(console.info("[vs-input-map] remove overlay layer from map",M.id),y.removeLayer(M.layer)))})}function ee(v){if(l.value)return;const M=p[v];M&&(M.visible=!M.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:v,nextVisible:M.visible,hasLayerInstance:!!M.layer}),M.visible?(M.layer||(M.layer=z(M.config)),M.layer&&!y.hasLayer(M.layer)&&(console.info("[vs-input-map] add overlay layer to map",M.id),M.layer.addTo(y))):M.layer&&y.hasLayer(M.layer)&&y.removeLayer(M.layer)))}function re(){if(!r.handleZoom)return null;let v;const M=G=>{const Z=G.ctrlKey||G.metaKey,fe=G.shiftKey;if(!Z&&!fe){u.value=!0,f.value=E(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},U=G=>{if(G.touches.length===1){u.value=!0,f.value=E(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return C.value&&(C.value.addEventListener("wheel",M,{passive:!1}),C.value.addEventListener("touchstart",U,{passive:!0})),y&&y.on("wheel",G=>{const Z=G.originalEvent.ctrlKey||G.originalEvent.metaKey,fe=G.originalEvent.shiftKey;!Z&&!fe&&(G.originalEvent.preventDefault(),G.originalEvent.stopPropagation())}),()=>{C.value&&(C.value.removeEventListener("wheel",M),C.value.removeEventListener("touchstart",U)),y&&y.off("wheel"),clearTimeout(v)}}const xe=i.ref(null),Ze=i.ref(6),ht=i.ref(0),mt=i.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),Ke=i.ref(null),gt=H();let En;const Cn=i.ref("topo100");function vn(v){return v?v.type==="Polygon"?{type:"MultiPolygon",coordinates:[v.coordinates]}:(v.type,v):null}function xr(){return new Promise((v,M)=>{window.L&&window.L.Draw&&v(0);const U=fe=>{if(Array.from(document.styleSheets).some($=>$?.href?.includes(fe)))return;const V=document.createElement("link");V.rel="stylesheet",V.href=fe,document.head.appendChild(V)},G=fe=>new Promise((V,$)=>{const q=Array.from(document.scripts).find(_e=>_e.src===fe);if(q){q.addEventListener("load",()=>V()),q.addEventListener("error",_e=>$(_e));return}const ae=document.createElement("script");ae.src=fe,ae.async=!0,ae.onload=()=>V(),ae.onerror=_e=>$(_e),document.body.appendChild(ae)});U("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),U("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&U("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let Z=G("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>G("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?Z=Z.then(()=>G("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),G("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):Z=Z.then(()=>G("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),Z.then(()=>v(0)).catch(M)})}function yt(){const v=b.toGeoJSON(),M=[];let U=null;const G=fe=>{if(fe)switch(fe.type){case"Point":U=fe;break;case"Polygon":M.push(fe.coordinates);break;case"MultiPolygon":M.push(...fe.coordinates);break;case"GeometryCollection":(fe.geometries||[]).forEach(G);break}};(v?.features||[]).forEach(fe=>G(fe.geometry));const Z=U||(M.length?{type:"MultiPolygon",coordinates:M}:null);o("update:modelValue",Z?vn(Z):null),ht.value=b.getLayers().length}function Pt(v=30){const M=b.getLayers();if(!M.length)return;const U=L.featureGroup(M).getBounds();U&&U.isValid()&&y.fitBounds(U,{padding:[v,v]})}function cn(){l.value||w.value?.click()}const qe=i.ref("");i.watch(s,v=>{qe.value&&!Object.entries(v).filter(([M,U])=>U).map(([M])=>M).includes(qe.value)&&(k?.disable&&k.disable(),qe.value="")}),i.watch(()=>r.layers,v=>{const M=Array.isArray(v)?v:[],U=[],G=new Set;M.forEach((Z,fe)=>{if(!Z)return;const V=D(Z,fe);U.push(V),G.add(V),console.info("[vs-input-map] overlay register",{id:V,service:Z?.service,url:Z?.url});const $=p[V];$?p[V]={...$,config:{...Z,id:V}}:p[V]={id:V,config:{...Z,id:V},visible:Z?.overlay!==!1,layer:null}}),Object.keys(p).forEach(Z=>{if(G.has(Z))return;const fe=p[Z];fe?.layer&&y?.hasLayer&&y.hasLayer(fe.layer)&&y.removeLayer(fe.layer),delete p[Z]}),h.value=U,K()},{immediate:!0,deep:!0}),i.watch(l,v=>{v&&k&&(k.disable(),qe.value=""),b&&b.eachLayer(M=>{v?M.dragging?.disable?.():M.dragging?.enable&&(M.dragging.enable(),M.dragging.enabled?.())})});function $t(v){return v instanceof L.Circle?"Circle":v instanceof L.Rectangle?"Rectangle":v instanceof L.Polygon&&!(v instanceof L.Rectangle)?"Polygon":v instanceof L.Polyline&&!(v instanceof L.Polygon)?"Polyline":v instanceof L.Marker?"Point":"Feature"}function qt(v){if(v instanceof L.Circle){const M=v.getRadius();return Math.PI*(M*M)/1e6}if(v instanceof L.Polygon||v instanceof L.Rectangle)try{const M=v.getLatLngs(),U=Array.isArray(M[0])?M[0]:M,G=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(U):0;return G?G/1e6:0}catch{return null}return null}function dn(v){return v instanceof L.Circle?v.getLatLng():v.getBounds?v.getBounds().getCenter():v.getLatLng?v.getLatLng():y.getCenter()}async function Xn(v,M){if(x.value="",!r.api?.length)return;const[U,G]=r.api;try{const Z=new URL(U);Z.searchParams.set("lat",String(v)),Z.searchParams.set("lon",String(M));const fe=await fetch(Z.toString());if(!fe.ok)throw new Error("Request failed");const V=await fe.json();G&&V[G]!==void 0?x.value=String(V[G]):x.value=JSON.stringify(V)}catch(Z){console.error("[vs-input-map] reverse geocode failed:",Z),x.value=null}}function _(){const v=b.getLayers();if(!v.length){Ke.value=null,ht.value=0;return}const M=v[v.length-1],U=$t(M),G=dn(M),Z=qt(M);Ke.value={type:U,center:G,areaKm2:Z,layer:M},ht.value=v.length,Xn(G.lat,G.lng)}function N(){if(l.value)return;const v=Ke.value?.layer;v&&(v instanceof L.Circle&&v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getLatLng&&y.setView(v.getLatLng(),Math.max(Ze.value,14)))}function P(){if(l.value)return;const v=Ke.value?.layer;v&&(b.removeLayer(v),yt(),_())}i.onMounted(async()=>{document.addEventListener("wheel",T,{passive:!1}),await xr(),L.drawLocal=aM;const v=r.handleZoom;y=L.map(C.value,{zoomControl:!1,scrollWheelZoom:!v}).setView(mt.value,10),setTimeout(()=>{S=re()},100),L.control.zoom({position:"bottomright"}).addTo(y),Cn.value=Object.keys(gt)[0],En=L.tileLayer(gt[Cn.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,G=>{if(l.value)return;const{layer:Z}=G;b.clearLayers(),b.addLayer(Z),yt(),Pt(),qe.value=""}),y.on(L.Draw.Event.EDITED,()=>{l.value||(yt(),_(),Pt())}),y.on(L.Draw.Event.DELETED,()=>{l.value||(yt(),_(),Pt())});let M=!1;y.on("mousemove",G=>{M||(y.invalidateSize(),M=!0),xe.value=G.latlng}),y.on("zoomend",()=>{Ze.value=y.getZoom()});const U=cM(r.modelValue);if(U){const G=[];L.geoJSON(U).eachLayer(Z=>G.push(Z)),G.length&&b.addLayer(G[0]),yt(),_(),Pt()}K()}),i.onUnmounted(()=>{document.removeEventListener("wheel",T),S&&S(),Object.values(p).forEach(v=>{v?.layer&&(y?.hasLayer?.(v.layer)&&y.removeLayer(v.layer),typeof v.layer.remove=="function"&&v.layer.remove())})});function X(v){if(!l.value&&y){switch(k&&k.disable(),v){case"marker":k=new L.Draw.Marker(y);break;case"polyline":k=new L.Draw.Polyline(y);break;case"polygon":k=new L.Draw.Polygon(y);break;case"rectangle":k=new L.Draw.Rectangle(y);break;default:k=new L.Draw.Rectangle(y);break}k&&(k.enable(),qe.value=v)}}function Ee(){if(l.value)return;const v=b.toGeoJSON(),M=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),U=URL.createObjectURL(M),G=document.createElement("a");G.href=U,G.download="data.geojson",G.click(),URL.revokeObjectURL(U)}function Be(v){if(l.value)return;const M=v.target,U=M.files?.[0];if(!U)return;const G=new FileReader;G.onload=()=>{if(typeof G.result=="string")try{const Z=JSON.parse(G.result);b.clearLayers(),Z&&L.geoJSON({type:"Feature",geometry:Z}).eachLayer(fe=>{b.addLayer(fe)}),yt(),_(),Pt()}finally{M.value=""}},G.readAsText(U)}function pe(v){y&&(En&&y.removeLayer(En),En=L.tileLayer(gt[v].url,{maxZoom:19,minZoom:6}).addTo(y),Cn.value=v)}function O(v){const M=L.latLng(v[0],v[1]);y.setView(M,13)}i.watch(()=>r.modelValue,v=>{const M=vn(v);if(v&&M!==v){o("update:modelValue",M);return}b.clearLayers(),M&&L.geoJSON({type:"Feature",geometry:M}).eachLayer(U=>{if(b.addLayer(U),l.value){U.dragging?.disable?.();return}U.dragging?.enable?.(),U.dragging?.enabled?.(),U.on("dragend",G=>{const Z=G.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[Z.lng,Z.lat]})})}),ht.value=b.getLayers().length,_(),Pt()});function H(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((v,M)=>Object.assign(v,{key:`b${M}`,preview:v.preview||v.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((v,M)=>({...v,[M.key]:M}),{}):{topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const he=i.ref(!1);return i.watch(he,()=>{setTimeout(()=>{y.invalidateSize()},50)}),i.watch(a,async v=>{if(!v||!d.value){c.value=null;return}await i.nextTick();const M=d.value.getBoundingClientRect();c.value={top:M.bottom+6,left:M.left}}),i.onUnmounted(()=>{a.value=!1,c.value=null}),(v,M)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:he.value}])},[i.createElementVNode("div",{ref_key:"mapContainer",ref:C,class:"w-full h-full"},null,512),i.createVNode(i.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:i.withCtx(()=>[u.value&&r.handleZoom?(i.openBlock(),i.createElementBlock("div",UM,[i.createElementVNode("div",WM,[i.createElementVNode("p",KM,i.toDisplayString(f.value),1)])])):i.createCommentVNode("",!0)]),_:1}),s.value.search||s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",qM,[s.value.search?(i.openBlock(),i.createBlock(FM,{key:0,onGoToCoordinates:O})):i.createCommentVNode("",!0),s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",GM,[i.createElementVNode("div",JM,[s.value.import?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:cn,disabled:l.value}," Import ",8,YM)):i.createCommentVNode("",!0),s.value.export?(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Ee,disabled:l.value||ht.value===0}," Export ",8,XM)):i.createCommentVNode("",!0)]),i.createElementVNode("input",{ref_key:"importRef",ref:w,type:"file",onChange:Be,accept:".json,.geojson",class:"hidden",disabled:l.value},null,40,ZM)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("div",QM,[i.createElementVNode("div",eT,[s.value.point?(i.openBlock(),i.createElementBlock("button",{key:0,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="marker"}]),title:"Point",onClick:M[0]||(M[0]=U=>X("marker")),disabled:l.value},[i.createVNode(pM)],10,tT)):i.createCommentVNode("",!0),s.value.line?(i.openBlock(),i.createElementBlock("button",{key:1,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polyline"}]),title:"Line",onClick:M[1]||(M[1]=U=>X("polyline")),disabled:l.value},[i.createVNode(yM)],10,nT)):i.createCommentVNode("",!0),s.value.polygon?(i.openBlock(),i.createElementBlock("button",{key:2,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polygon"}]),title:"Polygon",onClick:M[2]||(M[2]=U=>X("polygon")),disabled:l.value},[i.createVNode(wM)],10,rT)):i.createCommentVNode("",!0),s.value.rectangle?(i.openBlock(),i.createElementBlock("button",{key:3,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="rectangle"}]),title:"Rectangle",onClick:M[3]||(M[3]=U=>X("rectangle")),disabled:l.value},[i.createVNode(_M)],10,oT)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"vs-btn mt-5",onClick:M[4]||(M[4]=U=>he.value=!he.value),title:"Full Screen"},[i.createVNode(TM,{style:{width:"12px",height:"12px"}})])])]),i.createElementVNode("div",{class:i.normalizeClass(["absolute left-4 z-[1000]",Ke.value?"bottom-8":"bottom-4"])},[i.createElementVNode("div",sT,[i.createVNode(jM,{basemaps:i.unref(gt),onOnLayerChange:pe},null,8,["basemaps"]),m.value.length?(i.openBlock(),i.createElementBlock("div",lT,[M[9]||(M[9]=i.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),i.createElementVNode("div",iT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,U=>(i.openBlock(),i.createElementBlock("label",{key:U.id,class:"flex items-center gap-2 cursor-pointer select-none"},[i.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:U.visible,disabled:l.value,onChange:G=>ee(U.id)},null,40,aT),i.createElementVNode("span",cT,i.toDisplayString(U.config.title||U.config.name||U.id),1)]))),128))])])):i.createCommentVNode("",!0)])],2),i.createElementVNode("div",dT,[Ke.value?(i.openBlock(),i.createElementBlock("div",uT,[i.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:M[5]||(M[5]=U=>a.value=!0),onMouseleave:M[6]||(M[6]=U=>a.value=!1)},[i.createElementVNode("div",fT,[M[10]||(M[10]=i.createTextVNode(" Type: ",-1)),i.createElementVNode("span",pT,i.toDisplayString(Ke.value.type),1)]),x.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"addressEl",ref:d,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+i.toDisplayString(x.value),513)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[a.value&&x.value&&c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:i.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"})},i.toDisplayString(x.value),5)):i.createCommentVNode("",!0)]))],32),i.createElementVNode("div",hT,[i.createElementVNode("div",mT,[M[11]||(M[11]=i.createTextVNode(" Center: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.center.lat.toFixed(5))+", "+i.toDisplayString(Ke.value.center.lng.toFixed(5)),1)]),Ke.value.areaKm2!==null?(i.openBlock(),i.createElementBlock("div",gT,[M[12]||(M[12]=i.createTextVNode(" Area: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.areaKm2.toFixed(1))+" km²",1)])):(i.openBlock(),i.createElementBlock("div",yT,M[13]||(M[13]=[i.createTextVNode("Area: ",-1),i.createElementVNode("b",null,"—",-1)]))),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:M[7]||(M[7]=U=>N()),disabled:l.value},M[14]||(M[14]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-150e767b><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-150e767b></path><path d="M7 10l6 0" data-v-150e767b></path><path d="M10 7l0 6" data-v-150e767b></path><path d="M21 21l-6 -6" data-v-150e767b></path></svg>',1)]),8,bT),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:M[8]||(M[8]=U=>P()),disabled:l.value},[i.createVNode(kl,{class:"w-3 h-3"})],8,kT)])])):i.createCommentVNode("",!0)])],2))}}),wT=ge(xT,[["__scopeId","data-v-150e767b"]]),ET=["data-focus"],CT={class:"flex items-center"},vT={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},_T=["onClick","aria-label"],ST={key:0,class:"absolute text-gray-500 truncate pl-2"},NT={class:"flex-1 min-w-[2px]"},MT=["placeholder"],TT={class:"flex items-center shrink-0"},AT=["disabled"],BT=i.defineComponent({__name:"vs-input-tag",props:i.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e;St(t.style);const o=i.ref(null),s=i.ref(null),l=i.ref(null),a=i.ref(!1),c=i.ref(""),d=i.useModel(n,"modelValue"),u=i.computed(()=>t.placeholder||"Add tag…"),f=i.computed(()=>d.value?.length===0&&c.value===""),p=i.computed(()=>!t.disabled&&d.value?.length>0),h=i.computed(()=>t.disabled),m=async()=>{h.value||await i.nextTick(()=>l.value?.focus())},g=S=>{const w=S.trim();w!==""&&(!d.value||!Array.isArray(d.value)?d.value=[w]:t.unique?d.value.includes(w)||(d.value=[...d.value,w]):d.value=[...d.value,w],c.value="")},y=()=>{const S=c.value;S.trim()!==""&&g(S),c.value=""},b=S=>{const w=d.value.slice();w.splice(S,1),r("update:modelValue",w)},k=()=>{r("update:modelValue",[])},E=()=>{h.value||(a.value=!0)},x=()=>{a.value=!1,!h.value&&y()},C=S=>{const{key:w}=S;w==="Enter"?(S.preventDefault(),y()):w==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(S,w)=>(i.openBlock(),i.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:w[1]||(w[1]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",a.value?"border-blue-500 ring-1 ring-blue-500":"",h.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":a.value?"true":"false",onClick:m},[i.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:s},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value,(T,D)=>(i.openBlock(),i.createElementBlock("div",{key:D,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[i.createElementVNode("div",CT,[i.createElementVNode("div",vT,i.toDisplayString(T),1)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:i.withModifiers(R=>b(D),["stop"]),"aria-label":`Remove ${T}`},w[2]||(w[2]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,_T)]))),128)),f.value?(i.openBlock(),i.createElementBlock("div",ST,i.toDisplayString(u.value),1)):i.createCommentVNode("",!0),i.createElementVNode("div",NT,[h.value?i.createCommentVNode("",!0):i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:l,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":w[0]||(w[0]=T=>c.value=T),onFocus:E,onBlur:x,onKeydown:C,placeholder:d.value&&d.value.length?"":void 0},null,40,MT)),[[i.vModelText,c.value]])])],512),i.createElementVNode("div",TT,[p.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:h.value,onClick:i.withModifiers(k,["stop"])},w[3]||(w[3]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,AT)):i.createCommentVNode("",!0)])],10,ET)],2)],512))}}),VT={class:"relative flex gap-1 bg-white w-full"},LT=["disabled","placeholder"],OT=i.defineComponent({__name:"vs-input-slug",props:i.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=i.inject("values"),t=n,r=i.useModel(n,"modelValue");function o(l){const a={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return l.toLowerCase().split("").map(c=>a[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const s=()=>{const l=e?.value?.[t.parent||""]?.toString(),a=o(l);r.value=a.toString()};return(l,a)=>(i.openBlock(),i.createElementBlock("div",VT,[i.withDirectives(i.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,LT),[[i.vModelText,r.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),IT=ge(OT,[["__scopeId","data-v-b0eba370"]]),DT={class:"relative flex gap-1 bg-white w-full"},RT=["disabled","placeholder"],FT=["disabled"],PT={key:0},$T={key:1},zT=i.defineComponent({__name:"vs-input-codegen",props:i.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref(!1),o=i.computed(()=>e.init!==!1),s=i.computed(()=>!!e.table&&!!e.code),l=()=>{if(!s.value)return"";const d=encodeURIComponent(String(e.table)),u=encodeURIComponent(String(e.code));return`/api/code-gen/${d}/${u}`},a=async()=>{if(!s.value||r.value)return;const d=l();if(d){r.value=!0;try{const u=await(await fetch(d)).text();t.value=u}finally{r.value=!1}}},c=()=>{o.value&&(t.value||a())};return i.onMounted(()=>{c()}),i.watch(()=>[e.table,e.code,e.init],()=>{c()}),(d,u)=>(i.openBlock(),i.createElementBlock("div",DT,[i.withDirectives(i.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=f=>t.value=f),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,RT),[[i.vModelText,t.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:r.value||d.disabled||!s.value,onClick:a},[r.value?(i.openBlock(),i.createElementBlock("span",$T,"...")):(i.openBlock(),i.createElementBlock("span",PT,"Gen"))],8,FT)]))}}),HT=ge(zT,[["__scopeId","data-v-6ee5237d"]]),jT={class:"w-full"},UT={ref:"sortableContainer",class:"flex flex-col gap-1"},WT=["onDragstart","onDrop"],KT={class:"w-1/3"},qT={class:"w-2/3"},GT=["onClick"],JT={key:0,class:"text-[14px] text-gray-700"},YT={class:"mt-2 w-full flex items-center"},XT=["disabled"],ZT=i.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,r=i.inject("values"),o=n,s=e,l=o.addButtonText??"Додати",a=o.ignore??[],c=i.ref([]),d=i.ref(null);(()=>{const g=o.parent&&r?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([y])=>!a.includes(y)).map(([y,b])=>({id:t("key-value-"),key:y,value:b}))})();function u(g){d.value=g}function f(g){if(d.value===null||d.value===g)return;const y=c.value.splice(d.value,1)[0];c.value.splice(g,0,y),d.value=null}const p=i.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),h=()=>{c.value.push({id:t("key-value-"),key:"",value:""})},m=g=>{c.value=c.value.filter(y=>y.id!==g)};return i.watch(c,g=>{const y={};g.forEach(k=>{k.key&&k.value!==void 0&&(y[k.key]=k.value)});const b={};a.length&&a.forEach(k=>{b[k]=o.parent?r?.value?.[o.parent]?.[k]:void 0}),r?.value&&o.parent&&(r.value[o.parent]={...b,...y}),s("update:modelValue",y)},{deep:!0}),(g,y)=>(i.openBlock(),i.createElementBlock("div",jT,[i.createElementVNode("div",UT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(b,k)=>(i.openBlock(),i.createElementBlock("div",{key:b.id,class:i.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:E=>u(k),onDragover:y[0]||(y[0]=i.withModifiers(()=>{},["prevent"])),onDrop:E=>f(k)},[y[1]||(y[1]=i.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),i.createElementVNode("div",KT,[i.createVNode(bl,{modelValue:b.key,"onUpdate:modelValue":E=>b.key=E,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("div",qT,[i.createVNode(bl,{modelValue:b.value,"onUpdate:modelValue":E=>b.value=E,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("button",{onClick:E=>m(b.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[i.createVNode(i.unref(yv),{height:"16",width:"16"})],8,GT)],42,WT))),128))],512),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",JT," Дані для відображення відсутні ")),i.createElementVNode("div",YT,[i.createElementVNode("button",{type:"button",onClick:h,disabled:p.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[i.createVNode(To,{height:"14",width:"14"}),i.createTextVNode(" "+i.toDisplayString(i.unref(l)),1)],8,XT)])]))}}),QT=ge(ZT,[["__scopeId","data-v-a0f7fbfc"]]),eA={class:"flex items-center gap-2 w-full"},tA=["disabled"],nA=["disabled"],rA=i.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=St(t.style),o=e,s=i.computed({get:()=>t.modelValue||"#000000",set:a=>o("update:modelValue",a)}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",eA,[i.withDirectives(i.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:l.value,ref:"color",class:i.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,tA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,nA),[[i.vModelText,s.value]])]))}}),oA={class:"flex items-center gap-2 w-full"},sA=["min","max","step","disabled"],lA=["disabled"],iA=i.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=St(t.style),o=e,s=i.computed({get:()=>Number(t.modelValue??t.min),set:a=>o("update:modelValue",Number(a))}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",oA,[i.withDirectives(i.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),min:a.min,max:a.max,step:a.step,disabled:l.value,ref:"range",class:i.normalizeClass(["w-full cursor-pointer accent-blue-500",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")])},null,10,sA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,lA),[[i.vModelText,s.value]])]))}}),aA=["type","value","onInput","placeholder","disabled"],cA=i.defineComponent({__name:"vs-input-array",props:i.mergeModels({count:{default:1},limit:{default:n=>n.count??1},inputType:{default:"text"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");i.watchEffect(()=>{const a=r.value?.length??0;a<e.count&&(r.value=[...r.value??[],...Array(e.count-a)])});function l(a,c){if(o.value)return;const d=a.target.value,u=[...r.value];u[c]=e.inputType==="text"?d:Number(d),r.value=u}return(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["grid gap-2",`grid-cols-${a.limit}`])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.count,d=>(i.openBlock(),i.createElementBlock("input",{type:a.inputType,value:r.value?.[d-1]??"",onInput:u=>l(u,d-1),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,aA))),256))],2))}}),dA={class:"flex items-center gap-2 w-full"},uA={class:"relative flex-1"},fA=["placeholder","disabled","onKeydown"],pA=["disabled"],hA={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},mA={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},gA={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},yA={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},bA={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},kA=["onClick"],xA={key:0,class:"p-4 text-sm text-gray-500"},wA=i.defineComponent({__name:"vs-input-address",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e,{inputClass:o}=St(t.style),s=i.useModel(n,"modelValue"),l=i.computed({get:()=>s.value,set:b=>{s.value=b}}),a=i.ref(!1),c=i.ref([]),d=i.ref(!1),u=i.computed(()=>t.placeholder??""),f=i.computed(()=>!!t.disabled),p=i.inject("values");function h(){!f.value&&l.value.trim()&&m()}async function m(){const b=(l.value||"").trim();if(!b)return;let k=b;if(t.includes?.length&&p?.value){const x=t.includes.map(C=>p.value?.[C]).filter(Boolean);x.length&&(k=`${x.join(", ")}, ${b}`)}const E=t.api.replace("{{value}}",encodeURIComponent(k));a.value=!0;try{const x=await(await fetch(E)).json();c.value=Array.isArray(x)?x:[],d.value=!0}catch(x){console.error("Address search error:",x)}finally{a.value=!1}}function g(){d.value=!d.value}function y(b){if(!b)return;d.value=!1;const k=parseFloat(b.lat),E={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&p?.value&&(p.value[t.geom]=E),r("update:geom",E)}return(b,k)=>(i.openBlock(),i.createElementBlock("div",dA,[i.createElementVNode("div",uA,[i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":k[0]||(k[0]=E=>l.value=E),placeholder:u.value,disabled:f.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[i.unref(o),{"!border-red-600":t.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:i.withKeys(i.withModifiers(h,["prevent"]),["enter"])},null,42,fA),[[i.vModelText,l.value]]),c.value.length?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:g,title:"Show search results"},k[2]||(k[2]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M12 16v-4"}),i.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):i.createCommentVNode("",!0)]),i.createElementVNode("button",{type:"button",onClick:m,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:a.value||!l.value?.trim()},[a.value?(i.openBlock(),i.createElementBlock("svg",mA,k[4]||(k[4]=[i.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),i.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",hA,k[3]||(k[3]=[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),i.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,pA),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[d.value?(i.openBlock(),i.createElementBlock("div",gA,[i.createElementVNode("div",yA,[i.createElementVNode("div",bA,[k[6]||(k[6]=i.createElementVNode("span",null,"Search results",-1)),i.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:k[1]||(k[1]=E=>d.value=!1),title:"Close"},k[5]||(k[5]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(E,x)=>(i.openBlock(),i.createElementBlock("li",{key:x,onClick:C=>y(E),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},i.toDisplayString(E.display_name),9,kA))),128))]),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",xA," No results found "))])])):i.createCommentVNode("",!0)]))]))}}),EA={VsInputText:bl,VsInputRadio:Kp,"vs-input-text":bl,"vs-input-password":WC,"vs-input-textarea":eN,"vs-input-mask":Mv,"vs-input-number":GC,"vs-input-radio":Kp,"vs-input-select":Qp,"vs-input-switcher":Up,"vs-input-static":Wp,"vs-input-container":LS,"vs-input-date":Wv,"vs-input-checkbox":jv,"vs-input-file":V_,"vs-input-html":Wp,"vs-input-email":Bv,"vs-input-datatable":iM,"vs-input-map":wT,"vs-input-file-list":aS,"vs-input-tags":BT,"vs-input-slug":IT,"vs-input-codegen":HT,"vs-input-key-value":QT,"vs-input-range":iA,"vs-input-color":rA,"vs-input-native-select":Qp,"vs-input-array":cA,"vs-input-address":wA},CA=i.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=i.inject("values");async function r(){try{if(!e.api)return;const o=e.api.replace("{{value}}",e.value),s=await fetch(o);if(!s.ok){Ie({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const l=await s.json();if(!e.set||!t)return;for(const[a,c]of Object.entries(e.set))t.value[a]=l.result[c]}catch(o){console.error(e.error,o)}}return(o,s)=>(i.openBlock(),i.createElementBlock("button",{onClick:r,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},i.toDisplayString(o.button),1))}}),vA={class:"flex flex-col gap-1 w-full"},_A={key:0,class:"text-sm text-gray-500"},th=i.defineComponent({__name:"vs-compact-form-layout",props:i.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>jC[`${e.layout}`]),o=i.computed(()=>EA?.[`vs-input-${e.item.type}`]),s=i.computed(()=>{const a=i.unref(o);if(!a)return new Set;const c=a.props??a.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),l=i.computed(()=>{const a=e.item??{},c=s.value;return c.size?Object.fromEntries(Object.entries(a).filter(([d])=>c.has(d))):{}});return(a,c)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),{ua:e.item.ua,error:e.error||"",item:a.item,columns:e.columns,label:e.item.label},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["flex w-full",`${e.item.type}-component`])},[i.createElementVNode("div",vA,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(o.value),i.mergeProps(l.value,{modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=d=>t.value=d)}),null,16,["modelValue"])),a.item.description&&e.layout!=="settings"?(i.openBlock(),i.createElementBlock("p",_A,i.toDisplayString(a.item.description),1)):i.createCommentVNode("",!0)]),a.item.behavior?.api&&a.item.behavior?.button?(i.openBlock(),i.createBlock(CA,i.mergeProps({key:0},a.item.behavior,{value:t.value}),null,16,["value"])):i.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),SA={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},NA={class:"vs-compact-form-navigation__rail mt-[6px]"},MA=["onClick"],TA=i.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(n,{expose:e}){const t=n,r=i.ref([]),o=i.ref(""),s=i.ref(""),l=i.computed(()=>!!t.enabled),a=i.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=i.computed(()=>{const A=t.width;if(A==null)return{};const B=typeof A=="number"?`${A}px`:`${A}`;return{width:B,minWidth:B}});let d=null,u=0,f=0,p=null,h=null,m=null;const g=()=>D(),y=()=>k();i.watch(()=>t.target,async A=>{if(S(),!A){p=null,r.value=[],o.value="";return}p=A,l.value&&(await i.nextTick(),C(A),k())},{immediate:!0}),i.watch(()=>t.scrollContainer,A=>{if(!l.value){h=A??null;return}b(A??null),i.nextTick(()=>k())},{immediate:!0}),i.onMounted(()=>{t.scrollContainer||b(null),k()}),i.onBeforeUnmount(()=>{S(),b(null,!0),p=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),f&&window.cancelAnimationFrame(f))});function b(A,B=!1){if(m&&(m(),m=null),B){h=null;return}if(h=A??null,typeof window>"u")return;const W=A??window,Q=window;W.addEventListener("scroll",g,{passive:!0}),Q.addEventListener("resize",y),m=()=>{W.removeEventListener("scroll",g),Q.removeEventListener("resize",y)}}function k(){if(!l.value||!p)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const A=()=>{E(),u=0};typeof window>"u"?A():u=window.requestAnimationFrame(A)}function E(){if(!l.value||!p)return;const A=Array.from(p.querySelectorAll("h1, h2")),B=new Set,W=[];A.forEach((Q,I)=>{const z=Q.textContent?.trim()??"";if(!z)return;let K=(Q.getAttribute("id")??"").trim();K||(K=x(z)||`heading-${I+1}`);let ee=K,re=1;for(;B.has(ee);)ee=`${K}-${re+=1}`;Q.id!==ee&&Object.assign(Q,{id:ee}),B.add(ee),W.push({id:ee,text:z,level:Q.tagName.toLowerCase()==="h1"?1:2})}),r.value=W,W.length||(o.value=""),T()}function x(A){return A.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function C(A){!A||!l.value||typeof MutationObserver>"u"||(S(),d=new MutationObserver(()=>k()),d.observe(A,{childList:!0,subtree:!0}))}function S(){d&&(d.disconnect(),d=null)}function w(A){const B=h;if(!B)return typeof window>"u"?A.offsetTop:A.getBoundingClientRect().top+window.scrollY;const W=A.getBoundingClientRect(),Q=B.getBoundingClientRect();return W.top-Q.top+B.scrollTop}function T(){if(!l.value||!r.value.length)return;const A=h,B=(A?A.scrollTop:null)||(typeof window<"u"?window.scrollY:0),W=(A?A.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=B+W;let I=null;for(let K=0;K<r.value.length;K+=1){const ee=r.value[K],re=document.getElementById(ee.id);if(re){const xe=w(re);xe+re.offsetHeight>B&&xe<Q&&(I=ee.id)}}!I&&s.value&&(I=s.value),I&&(s.value=I);const z=A?A.scrollHeight-A.clientHeight:document.documentElement.scrollHeight-window.innerHeight;B+5>=z&&(I=r.value[r.value.length-1].id),I&&(o.value=I)}function D(){l.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{T(),f=0}))}function R(A){if(!l.value)return;const B=document.getElementById(A);if(!B)return;const W=h,Q=Math.max(0,w(B));W?W.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return e({refresh:k}),(A,B)=>l.value&&r.value.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(a.value),style:i.normalizeStyle(c.value)},[i.createElementVNode("h2",SA,i.toDisplayString(A.title),1),i.createElementVNode("div",NA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,W=>(i.openBlock(),i.createElementBlock("div",{key:W.id,class:i.normalizeClass(["vs-compact-form-navigation__item relative",W.level===2?"vs-compact-form-navigation__item--nested":"",W.id===o.value?"vs-compact-form-navigation__item--active":""])},[i.createElementVNode("button",{type:"button",onClick:Q=>R(W.id),class:i.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",W.level===2?"pl-[15px]":"pl-[18px]",W.id===o.value?"text-gray-800":"text-gray-500"])},[i.createElementVNode("span",null,i.toDisplayString(W.text),1)],10,MA)],2))),128))])],6)):i.createCommentVNode("",!0)}}),AA=ge(TA,[["__scopeId","data-v-1584a562"]]),nh={required:"Це поле є обов’язковим",email:"Неправильний email"},BA=n=>n?!1:nh.required,VA=n=>n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?!1:nh.email:!1,LA=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},OA=(n,e)=>!1,IA=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return BA(n);case"email":return VA(n);case"regexp":return LA(n,e);case"custom":return OA();default:return!1}},DA={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function rh(n){const e=n.toLowerCase();return DA[e]||e}function Oa(n,e=!1){if(Array.isArray(n)){const r=[];return n.forEach(o=>{const s={...o};s.name=(o.name||o.id||o.key||"").toString(),s.type=rh(o.type),s.label=o.label||o.ua,s.rules=o.rules||o.validators,s.type==="email"&&!s.rules&&(s.rules=["email"]),o.data&&(s.api=`/api/suggest/${o.data}`),s.disabled=e||s.disabled,Array.isArray(s.schema)&&(s.schema=Oa(s.schema,s.disabled)),r.push(s)}),r}const t=[];return Object.entries(n).forEach(r=>{const o={name:r[0],...r[1],type:rh(r[1].type),label:r[1].label||r[1].ua,rules:r[1].rules||r[1].validators,disabled:e};o.type==="email"&&!o.rules&&(o.rules=["email"]),r[1].type.includes("list")&&(o.multiple=!0),!o.api&&r[1].data&&(o.api=`/api/suggest/${r[1].data}`),Array.isArray(o.schema)&&(o.schema=Oa(o.schema,o.disabled)),t.push(o)}),t}function RA(n,e,t=!1){const r=i.computed(()=>Oa(e,typeof t=="boolean"?t:t.value)),o=i.ref({});function s(c){const d=c?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,f=n?.value?.[u];return Zp(f,d)}const l=(c=r.value,d=!0)=>(c.forEach(u=>{if(u.rules){if(!s(u)){delete o.value[u.name];return}let f=!1,p=null;u.rules.forEach(h=>{const m=IA(n.value[u.name],h);m&&(f=!0,!p&&typeof m=="string"&&(p=m))}),f&&p?o.value[u.name]=p:delete o.value[u.name]}u.schema&&l(u.schema,!1)}),d&&Object.values(o.value).some(Boolean)?o.value:null),a=i.computed(()=>r.value?.filter(c=>c.hidden!==!0&&s(c)));return{errors:o,validate:l,reset:()=>{n.value={},o.value={}},visibleSchema:a}}const FA={class:"flex w-full h-full min-h-0 gap-6"},PA={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Rr=i.defineComponent({__name:"vs-compact-form",props:i.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:i.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(n,{expose:e,emit:t}){const r=t,o=n,s=i.useModel(n,"form"),l=i.useModel(n,"values"),{errors:a,validate:c,reset:d,visibleSchema:u}=RA(l,o.schema,i.toRef(o,"disabled")),f=i.ref(null),p=i.ref(null),h=i.computed(()=>o.navigation),m=i.computed(()=>o.navWidth),g=i.computed(()=>o.style?.columns),y=Object.freeze({container:12,label:3}),b=i.computed(()=>o.columns??g.value??y),k=i.computed(()=>o.columns!=null||g.value!=null),E=i.computed(()=>k.value?"horizontal":o.layout),x=T=>T?.columns?"horizontal":E.value,C=T=>T?.columns??b.value,S=()=>{r("update:modelValue",l.value),c(),r("handle-submit",l.value)};e({validate:c,reset:d,errors:a}),i.onMounted(()=>{o.modelValue&&(l.value=o.modelValue),s.value={value:l.value,errors:a.value,reset:d,validate:c,formId:o.formId}});function w(T,D){if(T===D)return!0;if(typeof T!="object"||typeof D!="object"||!T||!D)return!1;const R=Object.keys(T),A=Object.keys(D);return R.length!==A.length?!1:R.every(B=>T[B]===D[B])}return i.provide("form",s),i.provide("values",l),(T,D)=>(i.openBlock(),i.createElementBlock("div",FA,[i.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:p},[i.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:i.withModifiers(S,["prevent"]),class:i.normalizeClass(["grid grid-cols-12 p-1",E.value==="default"?"gap-6":"gap-4"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(u),(R,A)=>(i.openBlock(),i.createElementBlock("div",{key:R.name,class:i.normalizeClass(x(R)==="horizontal"?"col-span-12":`col-span-${R.col||12}`)},[i.createVNode(th,{style:i.normalizeStyle(T.style),item:R,layout:x(R),columns:C(R),"model-value":l.value[R.name],"onUpdate:modelValue":B=>{const W=l.value[R.name];w(W,B)||(l.value[R.name]=B)},error:i.unref(a)[R.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),x(R)==="settings"&&A+1!==i.unref(u).length?(i.openBlock(),i.createElementBlock("div",PA)):i.createCommentVNode("",!0)],2))),128))],34)],512),i.createVNode(AA,{target:f.value,"scroll-container":p.value,enabled:h.value,width:m.value},null,8,["target","scroll-container","enabled","width"])]))}}),$A={class:"relative"},zA={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},HA={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},jA={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},UA={class:"font-medium text-gray-800 dark:text-[#ffffff]"},WA={class:"p-4 mim-h-0 h-full overflow-auto"},KA=i.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,r=e,o=i.ref(t.schema),s=i.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),l=i.ref({}),a=i.ref(),c=i.ref(t.mode);async function d(){const f=l.value.validate();if(f){Ie({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([p,h])=>`${p}: ${h}`).join(`
106
- `)});return}if(a.value)try{const p=await fetch(`/api/table/${a.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(p.ok)await p.json(),Ie({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Ie({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Ie({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Ie({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Ie({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function u(){r("close")}return i.onMounted(async()=>{try{if(t.form){const f=await fetch(`/api/template/form/${t.form}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,a.value=p.token}else if(t.token){a.value=t.token;const f=await fetch(`/api/form/${a.value}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,p.data?s.value=p.data:c.value="add"}}catch(f){Ie({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",$A,[i.createElementVNode("div",zA,[i.createElementVNode("div",HA,[i.createElementVNode("div",jA,[i.createElementVNode("h3",UA,i.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),i.createElementVNode("button",{onClick:u,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},p[2]||(p[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),i.createElementVNode("div",WA,[o.value?(i.openBlock(),i.createBlock(Rr,{key:0,schema:o.value,values:s.value,"onUpdate:values":p[0]||(p[0]=h=>s.value=h),form:l.value,"onUpdate:form":p[1]||(p[1]=h=>l.value=h)},null,8,["schema","values","form"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[i.createElementVNode("button",{type:"button",onClick:u,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),oh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=EC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:KA,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Rr.install=function(n){n.component("VForm",Rr),Object.assign(n.config.globalProperties,{$form:oh}),n.provide("form",oh),window.v3plugin||(window.v3plugin={})};const qA={class:"relative"},GA={key:0,class:"mt-4"},JA=["src","alt","title"],YA={key:0,class:"text-sm text-red-500"},XA={key:1,class:"mt-4"},ZA={class:"text-sm text-gray-600 mb-2"},QA={class:"flex flex-wrap gap-2"},eB=["src","alt","onError"],tB=["onClick"],nB={class:"flex justify-end gap-x-2 p-[20px]"},rB=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=i.ref(!1),r=i.ref(!1),o=i.ref({}),s=i.ref(!1),l=i.ref([]),a=i.ref(null),c=i.ref({src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),d=i.computed(()=>Array.isArray(c.value.file)&&c.value.file.length>1),u=i.computed(()=>Array.isArray(c.value.file)&&c.value.file.length===1),f=i.computed(()=>{if(d.value)return"";if(c.value.src)return c.value.src;if(u.value){const S=c.value.file[0];if(S instanceof File){const w=l.value.find(T=>T.file===S);return w?w.preview:""}else if(typeof S=="string")return S}return""}),p=i.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл (можна вибрати кілька)",type:"file",multiple:!0,required:!1,placeholder:"Шлях до файлу зображення",accept:"image/*"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення"},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення"},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"},{name:"link",label:"Посилання",type:"text",required:!1,placeholder:"https://example.com"},{name:"openInNewTab",label:"Відкривати у новій вкладці?",type:"switcher",required:!1}]),h=()=>{if(!e.editor)return;if(e.editor.isActive("image")){const{state:w}=e.editor,{selection:T}=w,{$from:D}=T;let R=null,A=null;if(D.parent.type.name==="image")R=D.before(D.depth),A=D.parent;else for(let ee=D.depth;ee>0;ee--){const re=D.node(ee),xe=D.before(ee);re.type.name==="paragraph"&&re.forEach((Ze,ht)=>{if(Ze.type.name==="image"){const mt=xe+ht+1;(R===null||Math.abs(mt-T.$from.pos)<Math.abs(R-T.$from.pos))&&(R=mt,A=Ze)}})}if(R!==null&&A){try{e.editor.chain().focus().setNodeSelection(R).run()}catch{e.editor.chain().focus().setTextSelection(R).run()}a.value=R}else{e.editor.chain().focus().selectParentNode().run();const{state:ee}=e.editor;a.value=ee.selection.$from.pos}const B=A?A.attrs:e.editor.getAttributes("image");s.value=!0;let W="",Q=!1;const I=e.editor.getAttributes("link");I&&I.href&&(W=I.href,Q=I.target==="_blank");const z=B.src||"",K=z?[z]:[];c.value={src:z,file:K,alt:B.alt||"",title:B.title||"",width:B.width||"",height:B.height||"",link:W,openInNewTab:Q}}else s.value=!1,c.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};r.value=!1,t.value=!0},m=()=>{t.value=!1,r.value=!1,s.value=!1,l.value=[],a.value=null,c.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},g=async S=>{if(!(!S||S.length===0)){for(const w of S)if(w&&w.type&&w.type.startsWith("image/")&&!l.value.some(D=>D.file===w)){const D=new FileReader;D.onload=R=>{l.value.push({file:w,preview:R.target.result,error:!1})},D.readAsDataURL(w)}}},y=S=>{l.value.splice(S,1),Array.isArray(c.value.file)&&c.value.file.splice(S,1)},b=async()=>{const S=Array.isArray(c.value.file)?c.value.file.filter(R=>R instanceof File):[],w=S.length;if(s.value&&w<=1||w>0&&await g(S),!s.value&&(w>1||l.value.length>1)&&l.value.length>0){await E();return}let T=c.value.src;if(u.value){const R=c.value.file[0];if(R instanceof File)try{const A=new FileReader,B=await new Promise((W,Q)=>{A.onload=I=>W(I.target.result),A.onerror=Q,A.readAsDataURL(R)});T=B,s.value&&(c.value.src=B)}catch(A){console.error("Помилка при читанні файлу:",A),Ie({type:"error",title:"Помилка",message:"Не вдалося прочитати файл"});return}else typeof R=="string"&&(T=R,s.value&&R!==c.value.src&&(c.value.src=R,T=R))}const D=T||Array.isArray(c.value.file)&&c.value.file.length>0||c.value.file instanceof FileList&&c.value.file.length>0;if(!T&&!D){Ie({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}if(!d.value&&!D&&await o.value.validate()){Ie({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(e.editor&&T)if(s.value&&a.value!==null){const{state:R}=e.editor;try{e.editor.chain().focus().setNodeSelection(a.value).run()}catch{e.editor.chain().focus().setTextSelection(a.value).run()}const A=e.editor.getAttributes("link"),B=A&&A.href;if(e.editor.chain().focus().updateAttributes("image",{src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run(),c.value.link&&c.value.link.trim()!==""){let W=c.value.link.trim();W.match(/^https?:\/\//i)||(W="https://"+W),B?e.editor.chain().focus().extendMarkRange("link").setLink({href:W,target:c.value.openInNewTab?"_blank":null}).run():e.editor.chain().focus().selectParentNode().setLink({href:W,target:c.value.openInNewTab?"_blank":null}).run()}else B&&e.editor.chain().focus().extendMarkRange("link").unsetLink().run()}else{const{state:R}=e.editor,{selection:A}=R,{$anchor:B}=A;let W=null;for(let I=B.depth;I>0;I--){const z=B.node(I);if(z&&z.type.name==="paragraph"){W=z;break}}if(W&&W.content.content.some(I=>I.type.name==="image")){const I=k(W,B.before(B.depth));if(I!==null){const z=R.schema.nodes.image.create({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""});if(c.value.link&&c.value.link.trim()!==""){let K=c.value.link.trim();K.match(/^https?:\/\//i)||(K="https://"+K);const ee=R.schema.marks.link.create({href:K,target:c.value.openInNewTab?"_blank":null}),re=z.type.create(z.attrs,z.content,[ee]);e.editor.chain().focus().insertContentAt(I+1,re).run()}else e.editor.chain().focus().insertContentAt(I+1,z).run()}else c.value.link&&c.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run(),setTimeout(()=>{let z=c.value.link.trim();z.match(/^https?:\/\//i)||(z="https://"+z),e.editor.chain().focus().selectParentNode().setLink({href:z,target:c.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run()}else c.value.link&&c.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run(),setTimeout(()=>{let I=c.value.link.trim();I.match(/^https?:\/\//i)||(I="https://"+I),e.editor.chain().focus().selectParentNode().setLink({href:I,target:c.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run()}m()},k=(S,w)=>{let T=null;return S.forEach((D,R)=>{D.type.name==="image"&&(T=w+R+1)}),T},E=async()=>{if(e.editor&&(l.value.length===0&&d.value&&await g(c.value.file),l.value.length!==0))try{const S=[];for(const w of l.value){const T=w.preview,D=e.editor.schema.nodes.image.create({src:T,alt:"",width:"",height:""});S.push(D)}S.length>0&&e.editor.chain().focus().command(({tr:w,dispatch:T})=>{if(T){const{selection:D}=w,{$anchor:R}=D;let A=D.$anchor.pos,B=null,W=null;for(let I=R.depth;I>0;I--){const z=R.node(I);if(z&&z.type.name==="paragraph"){B=z,W=R.start(I);break}}if(B){let I=null;B.forEach((z,K)=>{z.type.name==="image"&&(I=W+K+1)}),I!==null?A=I+1:A=W+B.content.size}let Q=A;return S.forEach(I=>{w.insert(Q,I),Q+=I.nodeSize}),!0}return!1}).run(),m()}catch(S){console.error("Помилка при додаванні зображень:",S),Ie({type:"error",title:"Помилка",message:"Не вдалося додати зображення"})}},x=async()=>{await b()},C=()=>{m()};return i.watch(()=>c.value.file,async(S,w)=>{if(r.value=!1,!(s.value&&Array.isArray(S)&&S.length===1&&typeof S[0]=="string"&&!S.some(D=>D instanceof File)))if(Array.isArray(S)&&S.length>0){const T=S.filter(R=>R instanceof File),D=S.filter(R=>typeof R=="string");if(T.length>0){if(s.value?s.value&&T.length===1&&(l.value=[]):l.value=[],(!s.value||T.length>1)&&await g(T),s.value&&T.length===1){const R=new FileReader;R.onload=A=>{c.value.src=A.target.result},R.readAsDataURL(T[0])}}else D.length>0&&!s.value&&(l.value=[])}else S&&typeof S=="object"&&S instanceof FileList?(s.value||(l.value=[]),await g(Array.from(S))):S&&typeof S=="object"&&!Array.isArray(S)&&S instanceof File?(s.value||(l.value=[]),await g([S])):s.value||(l.value=[])},{immediate:!1}),i.watch(()=>c.value.src,()=>{r.value=!1}),(S,w)=>(i.openBlock(),i.createElementBlock("div",qA,[i.createElementVNode("button",{onClick:h,class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",n.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Додати зображення"},[...w[4]||(w[4]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Додати зображення</span>',2)])],2),i.createVNode($p,{modelValue:t.value,"onUpdate:modelValue":w[3]||(w[3]=T=>t.value=T),title:s.value?"Редагувати зображення":"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",nB,[i.createElementVNode("button",{onClick:C,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Скасувати "),i.createElementVNode("button",{onClick:x,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"},i.toDisplayString(s.value?"Оновити зображення":"Додати зображення"),1)])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=T=>c.value=T),schema:p.value,form:o.value,"onUpdate:form":w[1]||(w[1]=T=>o.value=T)},null,8,["modelValue","schema","form"]),f.value&&!d.value?(i.openBlock(),i.createElementBlock("div",GA,[w[5]||(w[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:f.value,alt:c.value.alt||"Попередній перегляд зображення",title:c.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:w[2]||(w[2]=T=>r.value=!0)},null,40,JA),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",YA," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),l.value.length>0?(i.openBlock(),i.createElementBlock("div",XA,[i.createElementVNode("p",ZA,"Попередній перегляд ("+i.toDisplayString(l.value.length)+" зображень):",1),w[6]||(w[6]=i.createElementVNode("p",{class:"text-xs text-gray-500 mb-2"}," Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ",-1)),i.createElementVNode("div",QA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(T,D)=>(i.openBlock(),i.createElementBlock("div",{key:D,class:"relative"},[i.withDirectives(i.createElementVNode("img",{src:T.preview,alt:`Попередній перегляд ${D+1}`,class:"max-w-[100px] max-h-[100px] rounded border object-contain",onError:R=>T.error=!0},null,40,eB),[[i.vShow,!T.error]]),i.createElementVNode("button",{onClick:R=>y(D),class:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs hover:bg-red-600",type:"button"}," × ",8,tB)]))),128))])])):i.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])]))}}),oB={class:"flex items-center"},sB=["disabled"],lB=["disabled"],iB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor?.can().undo()&&e.editor.chain().focus().undo().run()},r=()=>{e.editor?.can().redo()&&e.editor.chain().focus().redo().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("div",oB,[i.createElementVNode("button",{onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[n.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M3 7v6h6"}),i.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,sB),i.createElementVNode("button",{onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[...s[1]||(s[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M21 7v6h-6"}),i.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,lB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),aB={class:"relative"},cB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=i.ref(!1),t=i.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,l)=>(i.openBlock(),i.createElementBlock("div",aB,[i.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[e.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[...l[1]||(l[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[i.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:l[0]||(l[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:"p-6"},[i.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[l[3]||(l[3]=i.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),i.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...l[2]||(l[2]=[i.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),l[4]||(l[4]=i.createStaticVNode('<div class="space-y-6" data-v-72ce3024><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Markdown Syntax</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Example</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>_italic text_</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>###### Heading 6</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>1. First item</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Start with a greater-than sign (&gt;) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>`</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Images</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>![alt text](url)</code> syntax. </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Links</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Action</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Select all text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply bold formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Copy selected text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply italic formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Save the current document</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Paste copied text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Cut selected text</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),dB={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Horizontal Rule",onClick:t,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},uB={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Fullscreen",onClick:r,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])]))}},fB=["title"],pB={class:"vs-editor-html-mode__text"},sh={bold:Xw,italic:eE,color:g2,background_color:E2,highlight:C2,bullet_list:Hw,ordered_list:Ww,blockquote:Pw,codeblock:Gw,underline:tE,strike:nE,link:VE,table:RE,text_align:t2,type_tag:o2,font_family:M2,font_size:V2,superscript:I2,subscript:F2,heading:j2,clear_formatting:K2,image:rB,history:iB,help:cB,horizontal_rule:dB,fullscreen:uB,html_mode:Le({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=i.ref(!1),o=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(s,l)=>(i.openBlock(),i.createElementBlock("button",{onClick:o,class:i.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[l[0]||(l[0]=i.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),i.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),i.createElementVNode("span",pB,i.toDisplayString((r.value,"HTML")),1)],10,fB))}},[["__scopeId","data-v-99a48167"]]),tab:Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=()=>{e.editor&&(e.editor.isActive("bulletList")||e.editor.isActive("orderedList"))&&e.editor.chain().focus().sinkListItem("listItem").run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:t,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[...o[0]||(o[0]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-indent-increase"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 6l-11 0"></path><path d="M20 12l-7 0"></path><path d="M20 18l-11 0"></path><path d="M4 8l4 4l-4 4"></path></svg>',1)])]))}})},wl={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help","html_mode"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help","html_mode"]},hB=Le({__name:"monaco-editor",props:{modelValue:{type:String,default:""},height:{type:String,default:"280px"},language:{type:String,default:"html"},theme:{type:String,default:"vs"}},emits:["update:modelValue","change"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(null);let l=null,a=null,c=!1,d=null;const u=()=>{const A=document.querySelector("link[data-monaco-editor-css]");if(!A)return!1;try{return A.sheet||A.styleSheet||A.href}catch{return!1}},f=()=>u()?new Promise(A=>setTimeout(A,50)):new Promise((A,B)=>{const W=document.createElement("link");W.rel="stylesheet",W.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",W.setAttribute("data-monaco-editor-css","true");const Q=()=>{const ee=()=>{u()?setTimeout(()=>A(),100):setTimeout(ee,50)};ee()};W.addEventListener?(W.addEventListener("load",Q),W.addEventListener("error",()=>B(new Error("Failed to load Monaco Editor CSS")))):(W.onload=Q,W.onerror=()=>B(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(W);let I=0;const z=20,K=setInterval(()=>{I++,u()?(clearInterval(K),setTimeout(()=>A(),100)):I>=z&&(clearInterval(K),setTimeout(()=>A(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((B,W)=>{const Q=document.createElement("script");Q.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",Q.setAttribute("data-monaco-editor-loader","true"),Q.onload=()=>B(),Q.onerror=()=>W(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(Q)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((A,B)=>{if(c){const W=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(W),a=window.monaco,A(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const W=setInterval(()=>{window.require&&(clearInterval(W),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{a=window.monaco,c=!1,A(a)},Q=>{c=!1,console.error("Failed to load Monaco Editor:",Q),B(Q)}))},50);setTimeout(()=>{clearInterval(W),c=!1,B(new Error("Monaco Editor loader not found"))},1e4)}).catch(W=>{c=!1,B(W)})}),d)),m=A=>{try{const B=document.createElement("div");B.innerHTML=A;const W=(I,z=0)=>{const K=" ".repeat(z);let ee="";if(I.nodeType===Node.TEXT_NODE){const re=I.textContent.trim();return re&&(ee+=K+re+`
107
- `),ee}if(I.nodeType===Node.ELEMENT_NODE){const re=I.tagName.toLowerCase(),xe=Array.from(I.attributes).map(mt=>`${mt.name}="${mt.value}"`).join(" "),Ze=I.children.length>0;I.textContent.trim()&&!Ze?ee+=K+`<${re}${xe?" "+xe:""}>${I.textContent}</${re}>
118
+ 3. "-" cannot repeat`);Ve.customSchemes.push([n,e])}function Kx(){Ve.scanner=Fx(Ve.customSchemes);for(let n=0;n<Ve.tokenQueue.length;n++)Ve.tokenQueue[n][1]({scanner:Ve.scanner});Ve.parser=zx(Ve.scanner.tokens);for(let n=0;n<Ve.pluginQueue.length;n++)Ve.pluginQueue[n][1]({scanner:Ve.scanner,parser:Ve.parser});return Ve.initialized=!0,Ve}function Sa(n){return Ve.initialized||Kx(),Hx(Ve.parser.start,n,pp(Ve.scanner.start,n))}Sa.scan=pp;function xp(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new va(t),o=Sa(n),s=[];for(let l=0;l<o.length;l++){const a=o[l];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var Na="[\0-   ᠎ -\u2029  ]",qx=new RegExp(Na),Gx=new RegExp(`${Na}$`),Jx=new RegExp(Na,"g");function Yx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Xx(n){return new Oe({key:new $e("autolink"),appendTransaction:(e,t,r)=>{const o=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!o||s)return;const{tr:l}=r,a=tf(t.doc,[...e]);if(ff(a).forEach(({newRange:d})=>{const u=Pb(r.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(d.from,d.to," "," ");if(!Gx.test(h))return;f=u[0],p=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(qx).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=Sa(m).map(b=>b.toObject(n.defaultProtocol));if(!Yx(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{zi(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||l.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!l.steps.length)return l}})}function Zx(n){return new Oe({key:new $e("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let u=r.target;const f=[];for(;u.nodeName!=="DIV";)f.push(u),u=u.parentNode;l=f.find(p=>p.nodeName==="A")}if(!l)return!1;const a=uf(e.state,n.type.name),c=(o=l?.href)!=null?o:a.href,d=(s=l?.target)!=null?s:a.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),l&&c?(window.open(c,d),!0):!1}}})}function Qx(n){return new Oe({key:new $e("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const c=xp(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function hr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(Jx,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var wp=Ht.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){kp(n);return}kp(n.scheme,n.optionalSlashes)})},onDestroy(){Wx()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!hr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!hr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!hr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",we(this.options.HTMLAttributes,n),0]:["a",we(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[$n({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,o=xp(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!hr(l,t),protocols:t,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:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(Xx({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!hr(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(Zx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Qx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),ew=Object.defineProperty,tw=(n,e)=>{for(var t in e)ew(n,t,{get:e[t],enumerable:!0})},nw="listItem",Ep="textStyle",Cp=/^\s*([-+*])\s$/,vp=Ue.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",we(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(nw,this.editor.getAttributes(Ep)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Or({find:Cp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:Cp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ep),editor:this.editor})),[n]}}),_p=Ue.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",we(this.options.HTMLAttributes,n),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)}}}),rw={};tw(rw,{findListItemPos:()=>_o,getNextListDepth:()=>Ma,handleBackspace:()=>Ta,handleDelete:()=>Aa,hasListBefore:()=>Sp,hasListItemAfter:()=>ow,hasListItemBefore:()=>Np,listItemHasSubList:()=>Mp,nextListIsDeeper:()=>Tp,nextListIsHigher:()=>Ap});var _o=(n,e)=>{const{$from:t}=e.selection,r=He(n,e.schema);let o=null,s=t.depth,l=t.pos,a=null;for(;s>0&&a===null;)o=t.node(s),o.type===r?a=s:(s-=1,l-=1);return a===null?null:{$pos:e.doc.resolve(l),depth:a}},Ma=(n,e)=>{const t=_o(n,e);if(!t)return!1;const[,r]=Gb(e,n,t.$pos.pos+4);return r},Sp=(n,e,t)=>{const{$anchor:r}=n.selection,o=Math.max(0,r.pos-2),s=n.doc.resolve(o).node();return!(!s||!t.includes(s.type.name))},Np=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((t=o.nodeBefore)==null?void 0:t.type.name)!==n)},Mp=(n,e,t)=>{if(!t)return!1;const r=He(n,e.schema);let o=!1;return t.descendants(s=>{s.type===r&&(o=!0)}),o},Ta=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Pn(n.state,e)&&Sp(n.state,e,t)){const{$anchor:a}=n.state.selection,c=n.state.doc.resolve(a.before()-1),d=[];c.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Pn(n.state,e)||!Zb(n.state))return!1;const r=_o(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=Mp(e,n.state,s);return Np(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Tp=(n,e)=>{const t=Ma(n,e),r=_o(n,e);return!r||!t?!1:t>r.depth},Ap=(n,e)=>{const t=Ma(n,e),r=_o(n,e);return!r||!t?!1:t<r.depth},Aa=(n,e)=>{if(!Pn(n.state,e)||!Xb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:o}=t;return!t.empty&&r.sameParent(o)?!1:Tp(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Ap(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},ow=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((t=o.nodeAfter)==null?void 0:t.type.name)!==n)},Bp=Ce.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Aa(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Aa(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ta(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Ta(n,t,r)&&(e=!0)}),e}}}}),sw="listItem",Vp="textStyle",Lp=/^(\d+)\.\s$/,Op=Ue.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",we(this.options.HTMLAttributes,t),0]:["ol",we(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(sw,this.editor.getAttributes(Vp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Or({find:Lp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:Lp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Vp)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),lw=/^\s*(\[([( |x])?\])\s$/,iw=Ue.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",we(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const o=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),d=u=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=t();if(typeof h!="number")return!1;const m=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,l),o.append(s,c),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:c,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[Or({find:lw,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),aw=Ue.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",we(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Ce.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(vp.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(_p.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Bp.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Op.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(iw.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(aw.configure(this.options.taskList)),n}});var Ip=Ue.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,dw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,uw=Ht.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ur({find:cw,type:this.type})]},addPasteRules(){return[$n({find:dw,type:this.type})]}}),fw=Ue.create({name:"text",group:"inline"}),pw=Ht.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",we(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function hw(n={}){return new Oe({view(e){return new mw(e,n)}})}class mw{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let s=l=>{this[o](l)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*l;r={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let f=c.getBoundingClientRect(),p=f.width/c.offsetWidth,h=f.height/c.offsetHeight;d=f.left-c.scrollLeft*p,u=f.top-c.scrollTop*h}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!s){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=ld(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Pe extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Pe.valid(r)?new Pe(r):le.near(r)}content(){return J.empty}eq(e){return e instanceof Pe&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Pe(e.resolve(t.pos))}getBookmark(){return new Ba(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!gw(e)||!yw(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Pe.valid(e))return e;let o=e.pos,s=null;for(let l=e.depth;;l--){let a=e.node(l);if(t>0?e.indexAfter(l)<a.childCount:e.index(l)>0){s=a.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;o+=t;let c=e.doc.resolve(o);if(Pe.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!oe.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*t),r=!1;continue e}break}s=l,o+=t;let a=e.doc.resolve(o);if(Pe.valid(a))return a}return null}}}Pe.prototype.visible=!1,Pe.findFrom=Pe.findGapCursorFrom,le.jsonID("gapcursor",Pe);class Ba{constructor(e){this.pos=e}map(e){return new Ba(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Pe.valid(t)?new Pe(t):le.near(t)}}function gw(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t-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 yw(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(t);;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 bw(){return new Oe({props:{decorations:Ew,createSelectionBetween(n,e,t){return e.pos==t.pos&&Pe.valid(t)?new Pe(t):null},handleClick:xw,handleKeyDown:kw,handleDOMEvents:{beforeinput:ww}}})}const kw=Vi({ArrowLeft:hl("horiz",-1),ArrowRight:hl("horiz",1),ArrowUp:hl("vert",-1),ArrowDown:hl("vert",1)});function hl(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let l=r.selection,a=e>0?l.$to:l.$from,c=l.empty;if(l instanceof se){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Pe.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Pe(d))),!0):!1}}function xw(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Pe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&oe.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Pe(r))),!0)}function ww(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Pe))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let o=F.empty;for(let l=r.length-1;l>=0;l--)o=F.from(r[l].createAndFill(null,o));let s=n.state.tr.replace(t.pos,t.pos,new J(o,0,0));return s.setSelection(se.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function Ew(n){if(!(n.selection instanceof Pe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Me.create(n.doc,[Ye.widget(n.selection.head,e,{key:"gapcursor"})])}var ml=200,Xe=function(){};Xe.prototype.append=function(e){return e.length?(e=Xe.from(e),!this.length&&e||e.length<ml&&this.leafAppend(e)||this.length<ml&&e.leafPrepend(this)||this.appendInner(e)):this},Xe.prototype.prepend=function(e){return e.length?Xe.from(e).append(this):this},Xe.prototype.appendInner=function(e){return new Cw(this,e)},Xe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Xe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Xe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,l){return o.push(e(s,l))},t,r),o},Xe.from=function(e){return e instanceof Xe?e:e&&e.length?new Dp(e):Xe.empty};var Dp=(function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(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,l,a){for(var c=s;c<l;c++)if(o(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,l,a){for(var c=s-1;c>=l;c--)if(o(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=ml)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ml)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Xe);Xe.empty=new Dp([]);var Cw=(function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,l){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),l)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,l){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,l+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,l)===!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})(Xe);const vw=500;class Ut{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){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;t&&(o=this.remapping(r,this.items.length),s=o.maps.length);let l=e.tr,a,c,d=[],u=[];return this.items.forEach((f,p)=>{if(!f.step){o||(o=this.remapping(r,p+1),s=o.maps.length),s--,u.push(f);return}if(o){u.push(new en(f.map));let h=f.step.map(o.slice(s)),m;h&&l.maybeStep(h).doc&&(m=l.mapping.maps[l.mapping.maps.length-1],d.push(new en(m,void 0,void 0,d.length+u.length))),s--,m&&o.appendMap(m,s)}else l.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(s)):f.selection,c=new Ut(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:l,selection:a}}addTransform(e,t,r,o){let s=[],l=this.eventCount,a=this.items,c=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),p=new en(e.mapping.maps[u],f,t),h;(h=c&&c.merge(p))&&(p=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(p),t&&(l++,t=void 0),o||(c=p)}let d=l-r.depth;return d>Sw&&(a=_w(a,d),l-=d),new Ut(a.append(s),l)}remapping(e,t){let r=new Xr;return this.items.forEach((o,s)=>{let l=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,l)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ut(this.items.append(e.map(t=>new en(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let c=t;this.items.forEach(p=>{let h=s.getMirror(--c);if(h==null)return;l=Math.min(l,h);let m=s.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(s.slice(c+1,h));y&&a++,r.push(new en(m,g,y))}else r.push(new en(m))},o);let d=[];for(let p=t;p<l;p++)d.push(new en(s.maps[p]));let u=this.items.slice(0,o).append(d).append(r),f=new Ut(u,a);return f.emptyItemCount()>vw&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],s=0;return this.items.forEach((l,a)=>{if(a>=e)o.push(l),l.selection&&s++;else if(l.step){let c=l.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=l.selection&&l.selection.map(t.slice(r));u&&s++;let f=new en(d.invert(),c,u),p,h=o.length-1;(p=o.length&&o[h].merge(f))?o[h]=p:o.push(f)}}else l.map&&r--},this.items.length,0),new Ut(Xe.from(o.reverse()),s)}}Ut.empty=new Ut(Xe.empty,0);function _w(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class en{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new en(t.getMap().invert(),t,this.selection)}}}class Wn{constructor(e,t,r,o,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const Sw=20;function Nw(n,e,t,r){let o=t.getMeta(mr),s;if(o)return o.historyState;t.getMeta(Aw)&&(n=new Wn(n.done,n.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(l&&l.getMeta(mr))return l.getMeta(mr).redo?new Wn(n.done.addTransform(t,void 0,r,gl(e)),n.undone,Rp(t.mapping.maps),n.prevTime,n.prevComposition):new Wn(n.done,n.undone.addTransform(t,void 0,r,gl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!l&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!Mw(t,n.prevRanges)),d=l?Va(n.prevRanges,t.mapping):Rp(t.mapping.maps);return new Wn(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,gl(e)),Ut.empty,d,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Wn(n.done.rebased(t,s),n.undone.rebased(t,s),Va(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Wn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Va(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function Mw(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(t=!0)}),t}function Rp(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,s,l)=>e.push(s,l));return e}function Va(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),s=e.map(n[r+1],-1);o<=s&&t.push(o,s)}return t}function Tw(n,e,t){let r=gl(e),o=mr.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),c=new Wn(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(l).setMeta(mr,{redo:t,historyState:c})}let La=!1,Fp=null;function gl(n){let e=n.plugins;if(Fp!=e){La=!1,Fp=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){La=!0;break}}return La}const mr=new $e("history"),Aw=new $e("closeHistory");function Bw(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Oe({key:mr,state:{init(){return new Wn(Ut.empty,Ut.empty,null,0,-1)},apply(e,t,r){return Nw(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?$p:r=="historyRedo"?zp:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Pp(n,e){return(t,r)=>{let o=mr.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let s=Tw(o,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const $p=Pp(!1,!0),zp=Pp(!0,!0);Ce.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.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=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new Oe({key:new $e("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const o=this.options.limit;if(o==null||o===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const l=s-o,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(a,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const o=this.storage.characters({node:t.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 a=e.selection.$head.pos,c=s-r,d=a-c,u=a;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var Vw=Ce.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[hw(this.options)]}});Ce.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oe({key:new $e("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!t||!r)return Me.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;l+=1});let a=0;return n.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&l-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Ye.node(d,d+c.nodeSize,{class:this.options.className}))}),Me.create(n,s)}}})]}});var Lw=Ce.create({name:"gapCursor",addProseMirrorPlugins(){return[bw()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ke(ne(n,"allowGapCursor",t)))!=null?e:null}}});Ce.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Oe({key:new $e("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((l,a)=>{const c=r>=a&&r<=a+l.nodeSize,d=!l.isLeaf&&Cs(l);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const f=Ye.node(a,a+l.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:c}):this.options.placeholder});o.push(f)}return this.options.includeChildren}),Me.create(n,o)}}})]}}),Ce.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Oe({key:new $e("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||mf(t.selection)||n.view.dragging?null:Me.create(t.doc,[Ye.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Hp({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Ow=Ce.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new $e(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new Oe({key:n,appendTransaction:(t,r,o)=>{const{doc:s,tr:l,schema:a}=o,c=n.getState(o),d=s.content.size,u=a.nodes[this.options.node];if(c)return l.insert(d,u.create())},state:{init:(t,r)=>{const o=r.tr.doc.lastChild;return!Hp({node:o,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const o=t.doc.lastChild;return!Hp({node:o,types:e})}}})]}}),Iw=Ce.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>$p(n,e),redo:()=>({state:n,dispatch:e})=>zp(n,e)}},addProseMirrorPlugins(){return[Bw(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()}}}),Dw=Ce.create({name:"starterKit",addExtensions(){var n,e,t,r;const o=[];return this.options.bold!==!1&&o.push(mx.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(dx.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(vp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(bx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(wx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(Ex.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Vw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Lw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(Cx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(op.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(Iw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(vx.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Tx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(_p.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Bp.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&o.push(wp.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Op.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Ip.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(uw.configure(this.options.strike)),this.options.text!==!1&&o.push(fw.configure(this.options.text)),this.options.underline!==!1&&o.push(pw.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&o.push(Ow.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),Rw=Dw,Fw=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Pw=Ue.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},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",we(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Mf({find:Fw,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),$w=Ce.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});const zw=async n=>{try{const e=new FormData;return e.append("unique","true"),e.append("file",n),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:e})).json())?.result}catch(e){console.error(e)}},Hw=async(n,e)=>{const t=e.clipboardData?.items;if(t){const r=e.clipboardData?.getData("text/html"),o=e.clipboardData?.getData("text/plain");if(r){const{state:s,dispatch:l}=n,{tr:a}=s,c=wr.fromSchema(n.state.schema),d=new DOMParser().parseFromString(r,"text/html").body,u=c.parse(d),f=a.replaceSelectionWith(u);return l(f),e.preventDefault(),!0}if(o){const{state:s,dispatch:l}=n,{tr:a}=s,c=a.insertText(o,s.selection.from,s.selection.to);return l(c),e.preventDefault(),!0}for(let s=0;s<t.length;s++){const l=t[s];if(l.type.startsWith("image/")){const a=l.getAsFile();if(a){const c=await zw(a),{schema:d}=n.state,u=d.nodes.image.create({src:c?.file_path}),f=n.state.tr.replaceSelectionWith(u);return n.dispatch(f),e.preventDefault(),!0}}}}return!1},jw={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},Uw=op.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:n=>{const e=n.level||1;return{class:`heading-level-${e}`,style:jw[e-1]}}}}}}),Ww=Ip.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Kw=Yi.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:n=>n.style.fontFamily?.replace(/['"]/g,""),renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),qw=Yi.extend({addAttributes(){return{...this.parent?.(),fontSize:{default:null,parseHTML:n=>n.style.fontSize?.replace(/['"]/g,""),renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),Gw=Ue.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",n]}});function jp(n){let e=!1;const t=U1({content:n.modelValue,extensions:[Rw.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),ax,ix,Z1,Kw,qw,Ww,Uw,lx,Pw.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"editor-image"}}),$w.configure({types:["heading","paragraph"]}),wp.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),rx,Gw],editorProps:{handlePaste:Hw,handleKeyDown:(s,l)=>{if(l.key==="Tab"){const a=s.state,{selection:c}=a,{$anchor:d}=c;let u=!1;for(let f=d.depth;f>0;f--){const p=d.node(f);if(p&&(p.type.name==="bulletList"||p.type.name==="orderedList")){u=!0;break}}return u?!1:(l.preventDefault(),!0)}return!1}}}),r=i.computed(()=>t.value||null);return i.watch(t,s=>{s&&t.value.on("update",l=>{if(!e){e=!0;const a=l.editor.getHTML();n.modelValue,setTimeout(()=>{e=!1},10)}})}),{editor:t,editorInstance:r,focusEditor:()=>{t.value&&!t.value.isFocused&&t.value.commands.focus()}}}function Up(n,e){const t=i.ref(!1),r=i.ref(""),o=i.ref(null);return{isHtmlMode:t,htmlContent:r,htmlTextarea:o,toggleHtmlMode:a=>{t.value=a,a?(n.value&&(r.value=n.value.getHTML()),i.nextTick(()=>{o.value&&(o.value.focus(),setTimeout(()=>{o.value.formatCode()},100))})):n.value&&r.value&&n.value.commands.setContent(r.value,!0)},onHtmlInput:a=>{r.value=a,e&&e("update:modelValue",a)}}}function Wp(){const n=i.ref(!1);return{isFullscreen:n,toggleFullscreen:()=>{n.value=!n.value}}}const Le=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Jw={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Yw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Blockquote",onClick:e[0]||(e[0]=(...l)=>s.toggleBlockquote&&s.toggleBlockquote(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":t.editor?.isActive("blockquote")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)])],2)}const Xw=Le(Jw,[["render",Yw]]),Zw={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function Qw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bullet List",onClick:e[0]||(e[0]=(...l)=>s.toggleBulletList&&s.toggleBulletList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bulletList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)])],2)}const eE=Le(Zw,[["render",Qw]]),tE={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function nE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Ordered List",onClick:e[0]||(e[0]=(...l)=>s.toggleOrderedList&&s.toggleOrderedList(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("orderedList")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)])],2)}const rE=Le(tE,[["render",nE]]),oE={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function sE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Code Block",onClick:e[0]||(e[0]=(...l)=>s.toggleCodeBlock&&s.toggleCodeBlock(...l)),class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("codeBlock")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)])],2)}const lE=Le(oE,[["render",sE]]),iE={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function aE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bold Text",onClick:e[0]||(e[0]=(...l)=>s.toggleBold&&s.toggleBold(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bold")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),i.createElementVNode("span",{class:"sr-only"},"Bold",-1)])],2)}const cE=Le(iE,[["render",aE]]),dE={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function uE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Italic Text",onClick:e[0]||(e[0]=(...l)=>s.toggleItalic&&s.toggleItalic(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("italic")}])},[...e[1]||(e[1]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),i.createElementVNode("span",{class:"sr-only"},"Italic",-1)])],2)}const fE=Le(dE,[["render",uE]]),pE={__name:"vs-editor-underline",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Underline",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),i.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)])],2))}},hE={__name:"vs-editor-strike",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Strikethrough",onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M5 12l14 0"}),i.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)])],2))}},mE={props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:n}){n==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(n,e){e&&n.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},gE={key:0,class:"vsTailwind ui-dialog__wrapper"},yE={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},bE={class:"font-medium text-gray-800 dark:text-[#ffffff]"},kE={class:"ui-dialog__content p-4"},xE={key:0,class:"flex justify-end gap-x-2"};function wE(n,e,t,r,o,s){return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[t.visible||t.modelValue?(i.openBlock(),i.createElementBlock("div",gE,[i.createElementVNode("div",{onMousedown:e[1]||(e[1]=l=>s.closeByClickBack(l,t.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[s.checkSize]])},[i.createElementVNode("div",yE,[i.createElementVNode("h3",bE,i.toDisplayString(t.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...l)=>s.handleClose&&s.handleClose(...l))},[...e[2]||(e[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",kE,[i.renderSlot(n.$slots,"default",{},void 0,!0)]),s.hasSlot?(i.openBlock(),i.createElementBlock("div",xE,[i.renderSlot(n.$slots,"footer",{handleClose:s.handleClose,handleConfirm:s.handleConfirm,handleCancel:s.handleCancel},void 0,!0)])):i.createCommentVNode("",!0)],2)]),_:3})],32)])):i.createCommentVNode("",!0)])}const Kp=Le(mE,[["render",wE],["__scopeId","data-v-6d0970a6"]]),EE={},CE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function vE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",CE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const _E=Le(EE,[["render",vE]]),SE={},NE={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function ME(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",NE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const TE=Le(SE,[["render",ME]]),AE={},BE={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-mail"};function VE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",BE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"},null,-1),i.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)])])}const LE=Le(AE,[["render",VE]]),OE=i.defineComponent({components:{IconClose:_E,IconSearch:TE,IconEmail:LE},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){if((this.style?.size||this.size)==="xs")return"h-[32px] text-sm";if((this.style?.size||this.size)==="md")return"h-[38px] text-sm";this.style?.size||this.size},value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:n}=await this.$refs;await n.focus()}}}),IE={class:"vs-form-text relative bg-white rounded-lg"},DE={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},RE=["disabled","type","placeholder"];function FE(n,e,t,r,o,s){const l=i.resolveComponent("IconClose"),a=i.resolveComponent("IconSearch"),c=i.resolveComponent("IconEmail");return i.openBlock(),i.createElementBlock("div",IE,[n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),n.icon&&n.icon==="search"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",n.iconStylePosition])},[i.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):n.icon&&n.icon==="email"?(i.openBlock(),i.createElementBlock("div",DE,[i.createVNode(c,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(i.openBlock(),i.createElementBlock("i",{key:3,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+n.icon,n.iconStylePosition]])},null,2)),n.clearable&&n.value?(i.openBlock(),i.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...d)=>n.clearInput&&n.clearInput(...d))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("input",i.mergeProps({ref:"vsText",disabled:n.disabled,type:n.type,onInput:e[2]||(e[2]=(...d)=>n.handleInput&&n.handleInput(...d)),placeholder:n.placeholder,"onUpdate:modelValue":e[3]||(e[3]=d=>n.value=d)},n.style?.attrs||n.attrs||{},{onFocus:e[4]||(e[4]=(...d)=>n.handleFocus&&n.handleFocus(...d)),onBlur:e[5]||(e[5]=(...d)=>n.handleBlur&&n.handleBlur(...d)),class:[[n.inputStyle,n.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,RE),[[i.vModelDynamic,n.value]])])}const qp=Le(OE,[["render",FE],["__scopeId","data-v-749b581f"]]);function Oa(){const n=i.ref("en");return{t:t=>({en:{type_tag:"Type Tag",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",paragraph:"Paragraph",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link"},uk:{type_tag:"Тип тегу",heading_1:"Заголовок 1",heading_2:"Заголовок 2",heading_3:"Заголовок 3",paragraph:"Параграф",createTable:"Створити Таблицю",addColumn:"Додати Колону",addRow:"Додати Рядок",deleteColumn:"Вилучити Колону",deleteRow:"Вилучити Рядок",deleteTable:"Вилучити Таблицю",mergeCells:"Об'єднати Клітинки",splitCells:"Розділити Клітинки",linkTitle:"Введіть Посилання"}})[n.value]?.[t]||t,locale:n}}const PE={class:"flex flex-col gap-3 p-[20px]"},$E={class:"relative flex items-center gap-2"},zE={class:"flex-1"},HE={key:0,class:"flex items-center gap-2 flex-shrink-0"},jE={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},UE=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref(""),s=i.ref(!1),l=()=>{if(!t.editor)return;t.editor.chain().focus().extendMarkRange("link").run();const f=t.editor.getAttributes("link");f.href?(s.value=!0,o.value=f.href):(s.value=!1,o.value=""),r.value=!0},a=()=>{r.value=!1,o.value="",s.value=!1},c=()=>{if(!t.editor||!o.value.trim())return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),t.editor.chain().focus().setLink({href:f}).run(),a()},d=()=>{t.editor&&(t.editor.chain().focus().unsetLink().run(),a())},u=()=>{if(!o.value)return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),window.open(f,"_blank","noopener,noreferrer")};return(f,p)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("button",{title:"Link",onClick:l,class:i.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("link")}])},[...p[2]||(p[2]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])],2),i.createVNode(Kp,{title:s.value?i.unref(e)("editLink")||"Edit Link":i.unref(e)("linkTitle")||"Add Link",visible:r.value,"onUpdate:visible":p[1]||(p[1]=h=>r.value=h),size:"small"},{footer:i.withCtx(()=>[i.createElementVNode("div",jE,[i.createElementVNode("button",{style:{border:"1px solid #000"},onClick:a,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},i.toDisplayString(i.unref(e)("cancel")||"Cancel"),1),i.createElementVNode("button",{onClick:c,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},i.toDisplayString(s.value?i.unref(e)("update")||"Update":i.unref(e)("create")||"Create"),1)])]),default:i.withCtx(()=>[i.createElementVNode("div",PE,[i.createElementVNode("div",$E,[i.createElementVNode("div",zE,[i.createVNode(qp,{modelValue:o.value,"onUpdate:modelValue":p[0]||(p[0]=h=>o.value=h),placeholder:i.unref(e)("linkUrl")||"Enter URL",class:"w-full"},null,8,["modelValue","placeholder"])]),s.value?(i.openBlock(),i.createElementBlock("div",HE,[i.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:"Open link"},[...p[3]||(p[3]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14"})],-1)])]),i.createElementVNode("button",{onClick:d,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:"Remove link"},[...p[4]||(p[4]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])])])):i.createCommentVNode("",!0)])])]),_:1},8,["title","visible"])],64))}}),So=async(n,e,t,r=10)=>{if(!e||!t)return;await i.nextTick();const o=await t?.getBoundingClientRect(),s=await e?.getBoundingClientRect();if(!s||!o)return;const l=await parseInt(e?.getBoundingClientRect()?.height),a=await parseInt(e?.getBoundingClientRect()?.width),c=await parseInt(t?.getBoundingClientRect()?.height),d=await parseInt(t?.getBoundingClientRect()?.width),u=await window.innerHeight,f=await window.innerWidth;let p=0,h=0;const m=s.bottom+r+c;switch(n){case"top":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f>d+s.right+30?h=s.left-o.width/2+s.width/2:h=f-30-d;break;case"bottom":u>m?p=s.bottom+r:p=s.bottom-r-c-l,h=s.left-o.width/2+s.width/2;break;case"left":p=s.top-o.height/2+s.height/2,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"right":p=s.top-o.height/2+s.height/2,f-a>d?h=s.right+r:h=f-30-d;break;case"top-right":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f-a>d?h=s.right+r:h=f-30-d;break;case"top-left":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"top-start":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left>0?h=s.left:h=10;break;case"bottom-right":u>m?p=s.bottom+r:p=s.bottom-r-c-l,f-a>d?h=s.left:h=f-30-d;break;case"bottom-left":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.right-d:h=10;break;case"bottom-start":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.left:h=10;break}p+c>u?p=u-c-r:p<0&&(p=r),h+d>f?h=f-d-r:h<0&&(h=r),t instanceof HTMLElement&&(t.style.top=`${p}px`,t.style.left=`${h}px`,t.style.position="fixed")},WE={class:"text-center"},KE={class:"py-2 px-4 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Kn=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(!1),l=i.ref([]),a=i.ref(null),c=i.ref(null),d=i.ref(null);i.watch(s,E=>{E?(u(),window.addEventListener("resize",()=>So(r.placement,c.value,d.value)),So(r.placement,c.value,d.value)):window.removeEventListener("resize",()=>So(r.placement,c.value,d.value)),o("isvisible",E)}),i.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",k,!0),u()}),i.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),f()});const u=()=>{let E=a.value;for(;E&&E!==document.body;)(E.scrollHeight>E.clientHeight||E.scrollWidth>E.clientWidth)&&(E.addEventListener("scroll",g),l.value.push(E)),E=E.parentElement;document.body&&(document.body.addEventListener("scroll",g),l.value.push(document.body))},f=()=>{l.value.forEach(E=>{E.removeEventListener("scroll",g)}),l.value=[]},p=()=>{s.value=!0,So(r.placement,c.value,d.value)},h=()=>{s.value=!1},m=async()=>{await So(r.placement,c.value,d.value),s.value=!s.value},g=()=>{s.value=!1},y=E=>{if(!E){s.value=!1;return}c.value?.contains(E.target)||d.value?.contains(E.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=E=>{s.value&&d.value&&!d.value.contains(E.target)&&(s.value=!1)};return e({togglePopover:m}),(E,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[i.createElementVNode("div",WE,[n.trigger==="click"?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:c,onClick:m,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(E.$slots,"reference",{},()=>[x[0]||(x[0]=i.createElementVNode("button",null,"Click me!",-1))])],2)):i.createCommentVNode("",!0),n.trigger==="hover"?(i.openBlock(),i.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:c,onMouseover:p,onMouseleave:h,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(E.$slots,"reference",{},()=>[x[1]||(x[1]=i.createElementVNode("button",null,"Click me!",-1))])],34)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:n.teleport},[i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",{class:i.normalizeClass(["vsTailwind vs-popover__content",n.placement]),ref_key:"contentPop",ref:d,style:i.normalizeStyle({width:n.width?n.width+"px":"fit-content",zIndex:100001})},[i.createElementVNode("div",KE,[i.renderSlot(E.$slots,"default",{},()=>[x[2]||(x[2]=i.createElementVNode("span",null,"Popover content",-1))])])],6),[[i.vShow,s.value]])]),_:3})],8,["to"]))])],512))}}),qE={class:"flex flex-col gap-[2px] p-[2px]"},GE=["onClick"],JE={__name:"vs-editor-table",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),o.value.togglePopover())},l=()=>{t.editor&&(t.editor.chain().focus().addColumnAfter().run(),o.value.togglePopover())},a=()=>{t.editor&&(t.editor.chain().focus().addRowAfter().run(),o.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().deleteColumn().run(),o.value.togglePopover())},d=()=>{t.editor&&(t.editor.chain().focus().deleteRow().run(),o.value.togglePopover())},u=()=>{t.editor&&(t.editor.chain().focus().deleteTable().run(),o.value.togglePopover())},f=()=>{t.editor&&(t.editor.chain().focus().mergeCells().run(),o.value.togglePopover())},p=()=>{t.editor&&(t.editor.chain().focus().splitCell().run(),o.value.togglePopover())},h=i.computed(()=>[{text:e("createTable"),function:s},{text:e("addColumn"),function:l},{text:e("addRow"),function:a},{text:e("deleteColumn"),function:c},{text:e("deleteRow"),function:d},{text:e("deleteTable"),function:u},{text:e("mergeCells"),function:f},{text:e("splitCells"),function:p}]);return(m,g)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:g[0]||(g[0]=y=>r.value=y)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Table",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...g[1]||(g[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),i.createElementVNode("path",{d:"M3 10h18"}),i.createElementVNode("path",{d:"M10 3v18"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",qE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(y,b)=>(i.openBlock(),i.createElementBlock("button",{key:b,onClick:y?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},i.toDisplayString(y.text),9,GE))),128))])]),_:1},512))}},YE={},XE={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-center"};function ZE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",XE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M8 12l8 0"},null,-1),i.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const QE=Le(YE,[["render",ZE]]),e2={},t2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-right"};function n2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",t2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M10 12l10 0"},null,-1),i.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const r2=Le(e2,[["render",n2]]),o2={},s2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-left"};function l2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",s2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M4 12l10 0"},null,-1),i.createElementVNode("path",{d:"M4 18l14 0"},null,-1)])])}const i2=Le(o2,[["render",l2]]),a2={},c2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-align-justify"};function d2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",c2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6h16"},null,-1),i.createElementVNode("path",{d:"M4 12h16"},null,-1),i.createElementVNode("path",{d:"M4 18h16"},null,-1)])])}const Gp={left:i2,center:QE,right:r2,justify:Le(a2,[["render",d2]])},u2={class:"flex gap-[4px] p-1"},f2=["title","onClick"],p2={__name:"vs-editor-align",props:{editor:Object},setup(n){const e=n,t=i.ref(!1),r=i.ref("popover"),o=i.ref("left"),s=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"left"})||e.editor.isActive("heading",{textAlign:"left"}):!1),l=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"right"})||e.editor.isActive("heading",{textAlign:"right"}):!1),a=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"center"})||e.editor.isActive("heading",{textAlign:"center"}):!1),c=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"justify"})||e.editor.isActive("heading",{textAlign:"justify"}):!1),d=i.computed(()=>s.value||l.value||a.value||c.value),u=()=>{l.value?o.value="right":a.value?o.value="center":c.value?o.value="justify":o.value="left"};i.watch([s,l,a,c],()=>{u()},{immediate:!0}),i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",u),e.editor.on("update",u))}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",u),e.editor.off("update",u))});const f=h=>{e.editor&&(e.editor.chain().focus().setTextAlign(h).run(),o.value=h)},p=i.ref([{id:"left",isActive:s},{id:"center",isActive:a},{id:"right",isActive:l},{id:"justify",isActive:c}]);return(h,m)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:m[0]||(m[0]=g=>t.value=g)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Align",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[d.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Gp)[o.value]),{height:"16",width:"16"}))],2)]),default:i.withCtx(()=>[i.createElementVNode("div",u2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,g=>(i.openBlock(),i.createElementBlock("button",{title:"Text align "+g?.id,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":g?.isActive}]),key:g?.id,onClick:y=>f(g?.id)},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Gp)[g?.id]),{height:"16",width:"16"}))],10,f2))),128))])]),_:1},512))}},h2={class:"flex flex-col gap-[2px] p-[2px]"},m2=["onClick"],g2={__name:"vs-editor-type-tag",props:{editor:Object},setup(n){const{t:e}=Oa(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor?.chain().focus().setParagraph().run(),o.value.togglePopover())},l=c=>{t.editor&&(t.editor?.chain().focus().toggleHeading({level:c}).run(),o.value.togglePopover())},a=i.computed(()=>[{text:e("richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:e("richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:e("richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:e("richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:e("richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:e("richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>r.value=u)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Type Tag",class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...d[1]||(d[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 7v-2h13v2"}),i.createElementVNode("path",{d:"M10 5v14"}),i.createElementVNode("path",{d:"M12 19h-4"}),i.createElementVNode("path",{d:"M15 13v-1h6v1"}),i.createElementVNode("path",{d:"M18 12v7"}),i.createElementVNode("path",{d:"M17 19h2"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",h2,[i.createElementVNode("button",{onClick:s,class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[n.editor?.isActive("paragraph")?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)("richtext.paragraph")),3),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(u,f)=>(i.openBlock(),i.createElementBlock("button",{key:f,onClick:p=>l(u?.id),class:i.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,n.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},i.toDisplayString(i.unref(e)(`richtext.heading${u?.id}`)),11,m2))),128))])]),_:1},512))}},y2={},b2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function k2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",b2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const No=Le(y2,[["render",k2]]),x2={components:{VsText:qp},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}}}},w2={class:"flex items-center w-full max-w-[182px]"},E2=["disabled"];function C2(n,e,t,r,o,s){const l=i.resolveComponent("vs-text");return i.openBlock(),i.createElementBlock("div",w2,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>s.value=a),type:"color",class:i.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",t.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:t.disabled},null,10,E2),[[i.vModelText,s.value]]),t.isTextInputShown?(i.openBlock(),i.createBlock(l,{key:0,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=a=>s.value=a),class:"ml-2 w-full",disabled:t.disabled,clearable:t.clearable},null,8,["modelValue","disabled","clearable"])):i.createCommentVNode("",!0)])}const Jp=Le(x2,[["render",C2]]),v2={class:"flex gap-[4px] mb-[8px]"},_2={class:"grid grid-rows-3 grid-cols-7"},S2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},N2=["onClick","title"],M2={__name:"vs-editor-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("#000000"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").color||"#000000"),s=i.computed(()=>o.value!=="#000000"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Color",class:i.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[1]||(p[1]=i.createElementVNode("span",{class:"leading-none"},"A",-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",v2,[i.createVNode(Jp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",_2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",S2,[i.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,N2)])]))),128))])])]),_:1},512))}},T2={class:"flex gap-[4px] mb-[8px]"},A2={class:"grid grid-rows-3 grid-cols-7"},B2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},V2=["onClick","title"],L2=["onClick","title"],O2={__name:"vs-editor-background-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("transparent"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").backgroundColor||"transparent"),s=i.computed(()=>o.value!=="transparent"&&o.value!==""),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setBackgroundColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Background Color",class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[2]||(p[2]=i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"}),i.createElementVNode("path",{d:"m5 2 5 5"}),i.createElementVNode("path",{d:"M2 13h15"}),i.createElementVNode("path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z"})],-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",T2,[i.createVNode(Jp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",A2,[i.createElementVNode("button",{onClick:p[1]||(p[1]=h=>c("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[...p[3]||(p[3]=[i.createElementVNode("svg",{fill:"#000000",width:"16",height:"16",viewBox:"0 0 52 52","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),i.createElementVNode("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),i.createElementVNode("g",{id:"SVGRepo_iconCarrier"},[i.createElementVNode("path",{d:"M48.5,5.6,46.4,3.5a1.67,1.67,0,0,0-2.4.3L32.59,15.21c-.77-1.3-1.51-2.61-2.21-4a36.5,36.5,0,0,1-3.15-8.36c-.13-.53-.39-.91-1-.89s-.86.4-1,.93c-.06.26-.11.51-.17.76A48.3,48.3,0,0,1,21,13.7,97.47,97.47,0,0,1,14.13,25a16,16,0,0,0-3,11.12c0,.14,0,.29.06.43L3.8,44a1.87,1.87,0,0,0-.3,2.4l2.1,2.1A1.67,1.67,0,0,0,8,48.2L48.2,8A1.67,1.67,0,0,0,48.5,5.6Z"}),i.createElementVNode("path",{d:"M38.42,23.79l-22,22.31A14.47,14.47,0,0,0,26.22,50a15.48,15.48,0,0,0,7-1.44c4.94-2.51,8.11-6.4,8.94-12A15.22,15.22,0,0,0,39,24.66C38.87,24.44,38.58,24,38.42,23.79Z"})])],-1),i.createElementVNode("p",null,"no color",-1)])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",B2,[h!=="transparent"?(i.openBlock(),i.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,V2)):i.createCommentVNode("",!0),h==="transparent"?(i.openBlock(),i.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],8,L2)):i.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},I2={__name:"vs-editor-highlight",props:{editor:Object},setup(n){const e=n,t=i.computed(()=>e.editor?.isActive("highlight")),r=()=>{e.editor&&e.editor.chain().focus().toggleHighlight().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Highlight",onClick:r,class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":t.value}])},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"m9 11-6 6v3h9l3-3"}),i.createElementVNode("path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"})],-1)])],2))}},D2={class:"truncate"},R2={class:"w-[200px]"},F2={class:"max-h-[200px] overflow-y-auto"},P2=["onClick"],$2={__name:"vs-editor-font-family",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref(!1),o=i.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),s=i.computed(()=>{if(!e.editor)return"Arial, sans-serif";for(const d of o.value)if(e.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),l=i.computed(()=>o.value.find(u=>u.value===s.value)?.label||"Arial"),a=d=>e.editor?e.editor.isActive("textStyle",{fontFamily:d}):!1,c=d=>{e.editor&&(e.editor.chain().focus().setFontFamily(d).run(),t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom",onIsvisible:u[0]||(u[0]=f=>r.value=f)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Family",class:i.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[r.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:i.normalizeStyle({fontFamily:s.value})},[i.createElementVNode("span",D2,i.toDisplayString(l.value),1),u[1]||(u[1]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],6)]),default:i.withCtx(()=>[i.createElementVNode("div",R2,[i.createElementVNode("ul",F2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":a(f.value)}]),style:i.normalizeStyle({fontFamily:f.value}),onClick:p=>c(f.value)},i.toDisplayString(f.label),15,P2))),128))])])]),_:1},512))}},z2={class:"w-[120px]"},H2={class:"max-h-[200px] overflow-y-auto"},j2=["onClick"],U2={__name:"vs-editor-font-size",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("14px"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").fontSize||"14px"),s=i.computed(()=>o.value!=="14px"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),c=d=>{e.editor&&(e.editor.chain().focus().setFontSize(d).run(),r.value=d,t.value&&t.value.togglePopover())};return(d,u)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Size",class:i.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":s.value}])},[...u[0]||(u[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-alarge-small-icon lucide-a-large-small"},[i.createElementVNode("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),i.createElementVNode("path",{d:"M15.697 14h5.606"}),i.createElementVNode("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),i.createElementVNode("path",{d:"M3.304 13h6.392"})],-1),i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",z2,[i.createElementVNode("ul",H2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:p=>c(f.value)},i.toDisplayString(f.label),9,j2))),128))])])]),_:1},512))}},W2={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function K2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Superscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSuperscript&&s.toggleSuperscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("superscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript-icon lucide-superscript"><path d="m4 19 8-8"></path><path d="m12 19-8-8"></path><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"></path></svg><span class="sr-only">Superscript</span>',2)])],2)}const q2=Le(W2,[["render",K2]]),G2={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function J2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Subscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSubscript&&s.toggleSubscript(...l)),class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("subscript")}])},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-subscript-icon lucide-subscript"><path d="m4 5 8 8"></path><path d="m12 5-8 8"></path><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"></path></svg><span class="sr-only">Subscript</span>',2)])],2)}const Y2=Le(G2,[["render",J2]]),X2={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},Z2={class:"truncate"},Q2={class:"max-h-[200px] overflow-y-auto"},eC=["onClick"],tC=Le({__name:"vs-editor-heading",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),o=i.computed(()=>{if(!e.editor)return"Paragraph";for(let c=1;c<=6;c++)if(e.editor.isActive("heading",{level:c}))return`H ${c}`;return"P"}),s=c=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[c]||"",l=c=>{e.editor&&(e.editor.chain().focus().setHeading({level:c}).run(),t.value&&t.value.togglePopover())},a=()=>{e.editor&&(e.editor.chain().focus().setParagraph().run(),t.value&&t.value.togglePopover())};return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",X2,[i.createElementVNode("span",Z2,i.toDisplayString(o.value),1),d[0]||(d[0]=i.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))])]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("ul",Q2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,u=>(i.openBlock(),i.createElementBlock("li",{key:u.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:i.normalizeStyle(s(u.value)),onClick:f=>l(u.value)},i.toDisplayString(u.label),15,eC))),128)),i.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:a}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-ef7c378e"]]),nC={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function rC(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Clear Formatting",onClick:e[0]||(e[0]=(...l)=>s.clearFormatting&&s.clearFormatting(...l)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[...e[1]||(e[1]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-remove-formatting-icon lucide-remove-formatting"><path d="M4 7V4h16v3"></path><path d="M5 20h6"></path><path d="M13 4 8 20"></path><path d="m15 15 5 5"></path><path d="m20 15-5 5"></path></svg><span class="sr-only">Clear Formatting</span>',2)])])}const oC=Le(nC,[["render",rC]]),Mo=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t};i.defineComponent({props:{modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},data(){return{}},mounted(){this.modelValue||this.$emit("update:modelValue",!1)},computed:{modelState:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}},methods:{handleEnterDown(n){const{keyCode:e}=n;e===13&&(this.modelState=!this.modelState)},addKeyHandler(){window.addEventListener("keydown",this.handleEnterDown)},removeKeyHandler(){window.removeEventListener("keydown",this.handleEnterDown)}}});const sC={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},lC={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},iC={class:"font-medium text-gray-800 dark:text-[#ffffff]"},aC={class:"ui-dialog__content p-4"},cC={key:0,class:"flex justify-end gap-x-2"},dC={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},uC=i.defineComponent({__name:"vs-modal",props:{title:{default:""},template:{},visible:{type:Boolean,default:!1},size:{default:"small"},closeClickBack:{type:Boolean,default:!1},content:{},buttonText:{},contentProps:{},teleport:{default:"body"}},emits:["update:visible","close","done"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.size==="small"?"md:w-5/12 w-9/12":t.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"),s=i.useAttrs();function l(){r("done")}function a(){r("update:visible",!1),r("close")}function c(u){u.key==="Escape"&&a()}function d(u,f){f&&u.target.classList.contains("vs-dialog-overlay")&&a()}return i.onMounted(()=>{window.addEventListener("keydown",c)}),i.onUnmounted(()=>{window.removeEventListener("keydown",c)}),(u,f)=>(i.openBlock(),i.createBlock(i.Teleport,{to:u.teleport},[u.visible?(i.openBlock(),i.createElementBlock("div",sC,[i.createElementVNode("div",{onMousedown:f[0]||(f[0]=p=>d(p,u.closeClickBack)),class:i.normalizeClass(["vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 bg-black bg-opacity-50",[i.unref(s).class]])},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",o.value])},[i.createElementVNode("div",lC,[i.createElementVNode("h3",iC,i.toDisplayString(u.title),1),i.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:a},[...f[1]||(f[1]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",aC,[i.renderSlot(u.$slots,"default",{},void 0,!0)]),u.$slots.footer?(i.openBlock(),i.createElementBlock("div",cC,[i.renderSlot(u.$slots,"footer",{handleClose:a},void 0,!0)])):i.createCommentVNode("",!0),u.buttonText?(i.openBlock(),i.createElementBlock("div",dC,[i.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:a}," Close "),i.createElementVNode("button",{type:"button",onClick:l,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none"},i.toDisplayString(u.buttonText),1)])):i.createCommentVNode("",!0)],2)]),_:3})],34)])):i.createCommentVNode("",!0)],8,["to"]))}}),Ia=Mo(uC,[["__scopeId","data-v-a6807cab"]]),fC={},pC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-green-600"};function hC(n,e){return i.openBlock(),i.createElementBlock("svg",pC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const mC=Mo(fC,[["render",hC]]),gC={},yC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"orange",class:"size-6 text-orange-600"};function bC(n,e){return i.openBlock(),i.createElementBlock("svg",yC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])}const kC=Mo(gC,[["render",bC]]),xC={},wC={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-blue-600"};function EC(n,e){return i.openBlock(),i.createElementBlock("svg",wC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)])])}const CC=Mo(xC,[["render",EC]]),vC={},_C={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"red",class:"size-6 text-red-600"};function SC(n,e){return i.openBlock(),i.createElementBlock("svg",_C,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const NC=Mo(vC,[["render",SC]]),MC={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},TC={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},AC={class:"flex-1"},BC={class:"font-medium text-gray-900"},VC={class:"mt-0.5 text-sm text-gray-700"},LC=i.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:mC,warning:kC,error:NC,info:CC};return(t,r)=>(i.openBlock(),i.createElementBlock("div",MC,[i.createElementVNode("div",TC,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e[t.type]))),i.createElementVNode("div",AC,[i.createElementVNode("strong",BC,i.toDisplayString(t.title),1),i.createElementVNode("p",VC,i.toDisplayString(t.message),1)]),r[0]||(r[0]=i.createElementVNode("button",{class:"m-3 rounded-full p-1.5 text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700",type:"button","aria-label":"Dismiss notify"},[i.createElementVNode("span",{class:"sr-only"},"Dismiss popup"),i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}});i.reactive({visible:!0});const OC=n=>{const{template:e="",title:t="",content:r,contentProps:o={},size:s="medium"}=n||{},l=document.querySelector("body");if(!l)return console.error('Modal root element with id "#modal" not found!'),{close:()=>{}};const a=document.createElement("div");l.appendChild(a);const c={title:t,template:e,visible:!0,size:s,closeClickBack:!0,onClose:u},d=i.createApp({render(){return i.h(Ia,c,{default:()=>[r?i.h(r,o):i.h("p",e)]})}});function u(){d.unmount(),a.remove()}return d.mount(a),{close:u}},yl={top:"top-4 left-1/2 transform -translate-x-1/2","left-bottom":"bottom-4 left-4 transform","right-bottom":"bottom-4 right-4 transform",bottom:"bottom-4 left-1/2 transform -translate-x-1/2"},Ie=n=>{const{type:e="info",title:t,message:r,position:o="right-bottom"}=n||{};let s=document.querySelector("#notify-root");s||(s=document.createElement("div"),s.id="notify-root",s.className=`fixed z-[2000] flex flex-col gap-3 ${yl[o]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(s)),s.className.includes(yl[o])||(Object.values(yl).forEach(c=>{s.classList.remove(...c.split(" "))}),s.classList.add(...yl[o].split(" ")));const l=document.createElement("div");s.appendChild(l);const a=i.createApp({render(){return i.h(LC,{type:e,title:t,message:r,onClose:()=>{a.unmount(),l.remove()}})}});a.mount(l),l.querySelector("button")?.addEventListener("click",()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)}),setTimeout(()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)},3500)},IC={class:"w-full relative"},DC={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},RC={class:"opacity-100"},FC={key:0,class:"text-red-500 text-[14px]"},PC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},$C=i.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=i.ref("uk"),t=r=>{r.detail.key==="locale"&&(e.value=r.detail.newValue)};return i.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",t)}),i.onUnmounted(()=>{window.removeEventListener("resize",t)}),(r,o)=>(i.openBlock(),i.createElementBlock("div",IC,[r.ua||r.label?(i.openBlock(),i.createElementBlock("div",DC,[i.createElementVNode("span",RC,i.toDisplayString(r.item[e.value]||r.ua||r.label),1),r.item?.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",FC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(r.$slots,"default",i.mergeProps(r.$attrs,{class:{"opacity-60":r.item.disabled}})),r.error?(i.openBlock(),i.createElementBlock("span",PC,i.toDisplayString(r.error),1)):i.createCommentVNode("",!0)]))}}),zC={class:"w-full relative flex flex-row items-center gap-2"},HC={key:0,class:"text-red-500 text-[14px]"},jC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},UC=i.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(n){const e=n,t=i.computed(()=>e.columns??{container:12,label:3}),r=i.computed(()=>{const{container:a,label:c}=t.value;return!a||a<=0?0:Math.min(Math.max(c??0,0),a)/a}),o=i.computed(()=>e.item?.type==="html"||r.value<=0?!1:!!(e.ua||e.label)),s=i.computed(()=>{if(!o.value)return{};const a=`${r.value*100}%`;return{flexBasis:a,maxWidth:a}}),l=i.computed(()=>{const{container:a,label:c}=t.value;if(!a||a<=0)return{};if(e.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(a-Math.max(c??0,0),0)/a;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(a,c)=>(i.openBlock(),i.createElementBlock("div",zC,[o.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:i.normalizeStyle(s.value)},[i.createTextVNode(i.toDisplayString(a.ua||a.label)+" ",1),a.item?.rules?.includes("required")&&(a.ua||a.label)?(i.openBlock(),i.createElementBlock("span",HC,"*")):i.createCommentVNode("",!0)],4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"flex-1 min-w-0",style:i.normalizeStyle(l.value)},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],4),a.error?(i.openBlock(),i.createElementBlock("span",jC,i.toDisplayString(a.error),1)):i.createCommentVNode("",!0)]))}}),WC={class:"w-full relative"},KC={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},qC=i.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",WC,[i.renderSlot(e.$slots,"default",i.normalizeProps(i.guardReactiveProps(e.$attrs))),e.error?(i.openBlock(),i.createElementBlock("span",KC,i.toDisplayString(e.error),1)):i.createCommentVNode("",!0)]))}}),GC={class:"flex-1 min-w-0"},JC={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},YC={class:"truncate"},XC={key:0,class:"text-red-500 text-[14px]"},ZC={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},QC={key:0,class:"mt-1 text-xs text-red-500"},ev=i.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=n,t=i.ref("uk");i.computed(()=>(e.item??{})?.[t.value]??e.ua??e.label??"");const r=i.computed(()=>e.item?.description??""),o=i.computed(()=>Array.isArray(e.item?.rules)&&e.item.rules.includes("required")),s=i.computed(()=>(typeof e.error=="string"?e.error:"")??""),l=a=>{a.key==="locale"&&(t.value=a.newValue??"uk")};return i.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",l)}),i.onUnmounted(()=>{window.removeEventListener("storage",l)}),(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["w-full relative",{"opacity-60":a.item?.disabled}])},[i.createElementVNode("div",{class:i.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(a.item.type)?"flex flex-col":""]])},[i.createElementVNode("div",GC,[a.ua||a.label?(i.openBlock(),i.createElementBlock("p",JC,[i.createElementVNode("span",YC,i.toDisplayString(a.item[t.value]||a.ua||a.label),1),o.value?(i.openBlock(),i.createElementBlock("span",XC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("p",ZC,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["w-full",["select","native-select"].includes(a.item.type)?"md:w-[30%]":"md:w-auto"])},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],2)],2),s.value?(i.openBlock(),i.createElementBlock("p",QC,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0)],2))}}),tv={default:$C,horizontal:UC,inline:qC,settings:ev};function St(n){return{inputClass:i.computed(()=>{const e=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${n?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return n?.size==="sm"?`${e}h-[32px]`:`${e}h-[38px]`})}}const nv=["placeholder","disabled"],rv=i.defineComponent({__name:"vs-input-password",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"password","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,nv)),[[i.vModelText,r.value]])}}),ov=["placeholder","disabled"],bl=i.defineComponent({__name:"vs-input-text",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ov)),[[i.vModelText,r.value]])}}),sv=["placeholder","disabled","min","max"],lv=i.defineComponent({__name:"vs-input-number",props:i.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled);return(s,l)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":l[0]||(l[0]=a=>r.value=a),placeholder:s.placeholder,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,sv)),[[i.vModelText,r.value]])}}),ge=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},iv={},av={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function cv(n,e){return i.openBlock(),i.createElementBlock("svg",av,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const dv=ge(iv,[["render",cv]]),uv={class:"flex items-center gap-[4px]"},fv=["value","id","disabled"],pv=["for"],hv={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},mv=i.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=e,r=n,o=i.computed({get:()=>r.modelValue,set:l=>t("update:modelValue",l)}),s=i.computed(()=>!!r.disabled);return(l,a)=>(i.openBlock(),i.createElementBlock("div",uv,[i.withDirectives(i.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),class:i.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":s.value}]),id:l.id,disabled:s.value},null,10,fv),[[i.vModelCheckbox,o.value]]),i.createElementVNode("label",{for:l.id,class:i.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":s.value}])},[i.createElementVNode("div",{class:i.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",l.error?"border-red-600":""]])},[i.createVNode(dv,{height:"12",width:"12"})],2),i.createElementVNode("span",hv,[i.renderSlot(l.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(l.label),1)])])],10,pv)]))}}),gv=["name","value","disabled"],yv={class:"flex items-center gap-[6px] text-[14px]"},bv={key:0,class:"text-[16px]"},kv=["src"],xv=i.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed({get:()=>t.modelValue,set:a=>{r("update:modelValue",a)}}),s=i.computed(()=>Array.isArray(o.value)?o.value.includes(t.value):o.value===!0||o.value===t.value),l=i.computed(()=>t.style?.size==="xs"?"p-1.5 text-xs":t.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(a,c)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[l.value,s.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[i.withDirectives(i.createElementVNode("input",{type:"checkbox",class:"hidden",name:a.id,value:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:a.disabled},null,8,gv),[[i.vModelCheckbox,o.value]]),i.createElementVNode("span",yv,[a.icon||a.imgUrl?(i.openBlock(),i.createElementBlock("span",bv,[a.icon?(i.openBlock(),i.createElementBlock("i",{key:0,class:i.normalizeClass(a.icon)},null,2)):i.createCommentVNode("",!0),a.imgUrl?(i.openBlock(),i.createElementBlock("img",{key:1,src:a.imgUrl,width:"16",height:"16",alt:"icon"},null,8,kv)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(a.label),1)])])],2))}}),wv={class:"flex items-center"},Da=i.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=`radio-${Math.floor(Math.random()*1e4)}`,s=i.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:a=>{if(Array.isArray(t.modelValue)){let c=[...t.modelValue];a?c.includes(t.value)||c.push(t.value):c=c.filter(d=>d!==t.value),r("update:modelValue",c)}else r("update:modelValue",a)}}),l=i.ref(`vs-checkbox-${t.view||"default"}`);return(a,c)=>(i.openBlock(),i.createElementBlock("div",wv,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value==="vs-checkbox-buttons"?i.unref(xv):i.unref(mv)),{value:a.value,label:a.label,info:a.option?.info,disabled:a.disabled,modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),id:o,icon:a.icon,imgUrl:a.imgUrl,style:i.normalizeStyle(a.style),error:a.error},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Ev={},Cv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function vv(n,e){return i.openBlock(),i.createElementBlock("svg",Cv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const _v=ge(Ev,[["render",vv]]),Sv={},Nv={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function Mv(n,e){return i.openBlock(),i.createElementBlock("svg",Nv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Tv=ge(Sv,[["render",Mv]]),Av={},Bv={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Vv(n,e){return i.openBlock(),i.createElementBlock("svg",Bv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M12 9h.01"},null,-1),i.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),i.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const Lv=ge(Av,[["render",Vv]]),Ov={key:0,class:"flex items-start gap-x-1"},Iv={key:0,class:"text-red-500 text-[14px]"},Dv=["title"],Rv=["disabled"],Yp=i.defineComponent({__name:"vs-input-switcher",props:i.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue");return(r,o)=>e.view==="checkbox"?(i.openBlock(),i.createElementBlock("div",Ov,[i.createVNode(Da,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),label:r.text,error:r.error||""},null,8,["modelValue","label","error"]),r.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",Iv,"*")):i.createCommentVNode("",!0),r.i?(i.openBlock(),i.createElementBlock("button",{key:1,class:"cursor-pointer",title:r.i,onClick:o[1]||(o[1]=i.withModifiers(()=>{},["prevent"]))},[i.createVNode(i.unref(Lv),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Dv)):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:i.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[t.value?`bg-${r.style?.primaryColor||"blue"}-500`:"bg-stone-200",r.customClass]]),disabled:r.disabled,onClick:o[2]||(o[2]=s=>t.value=!t.value)},[i.createElementVNode("span",{"data-state":"checked",class:i.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[t.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Rv))}}),Fv=["id","innerHTML"],Xp=i.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{id:e.name,class:i.normalizeClass(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,Fv))}}),Pv=["placeholder","disabled","name"],$v=i.defineComponent({__name:"vs-input-mask",props:i.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.ref(null);let s=null;return i.onMounted(async()=>{if(o.value){const{default:l}=await Promise.resolve().then(()=>bO);s=l(o.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),s.on("accept",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.on("complete",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.value=r.value??""}}),i.onBeforeUnmount(()=>{s?.destroy()}),i.watch(()=>e.mask,l=>{s&&s.updateOptions({mask:l,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),i.watch(r,l=>{s&&s.unmaskedValue!==l&&(s.value=l||"")}),(l,a)=>(i.openBlock(),i.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,Pv))}}),zv={class:"relative w-full bg-white rounded-lg"},Hv=["placeholder","disabled"],jv=i.defineComponent({__name:"vs-input-email",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue");return(o,s)=>(i.openBlock(),i.createElementBlock("div",zv,[s[1]||(s[1]=i.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),i.withDirectives(i.createElementVNode("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),placeholder:o.placeholder,disabled:o.disabled,class:i.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Hv),[[i.vModelText,r.value]])]))}}),Uv=["value","disabled"],Wv={class:"text-[13px] text-gray-700"},Kv=i.defineComponent({__name:"vs-input-radio-default",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center gap-0",[e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Uv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",{class:i.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${e.style?.primaryColor||"blue"}-500`,r.value?"opacity-50 cursor-not-allowed":""]])},[t.value==e.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${e.style?.primaryColor||"blue"}-500`]])},null,2)):i.createCommentVNode("",!0)],2),i.createElementVNode("span",Wv,i.toDisplayString(e.text),1)],2))}}),qv=["value","disabled"],Gv={class:"text-[13px] text-gray-700"},Jv=i.defineComponent({__name:"vs-input-radio-buttons",props:i.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==e.value?`ring-2 ring-ring ring-${e.style?.primaryColor||"blue"}-500`:"",e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,qv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",Gv,i.toDisplayString(e.text),1)],2))}}),Yv={"vs-input-radio-default":Kv,"vs-input-radio-buttons":Jv},Zp=i.defineComponent({__name:"vs-input-radio",props:i.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>Yv[`vs-input-radio-${e.view}`]);return(o,s)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.options,l=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),i.mergeProps({key:l?.id,text:l.text,value:l.id.toString(),checked:t.value===l.id,modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Xv={key:1,class:"w-full flex flex-col gap-4"},Zv={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Qv="Без категорії",e_=i.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.ref([]),s=i.reactive({}),l=h=>h?.value||h?.id||h?.text||h,a=h=>h.text||String(h),c=h=>`lg:col-span-${h||12}`,d=i.computed(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),u=h=>h==null||h===""?null:typeof h=="string"||typeof h=="number"?h:String(h),f=i.computed(()=>{if(!t.group)return[];const h=new Map;o.value.forEach(k=>{const E=k[t.group],x=u(E);h.has(x)||h.set(x,[]),h.get(x)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const E=u(k);m.push(E)});const g=new Set,y=k=>{const E=h.get(k)||[];if(!E.length)return null;const x=k===null?"group-null":`group-${String(k)}`,C=k===null?Qv:String(k);return g.add(k),{key:x,label:C,options:E}},b=[];return m.forEach(k=>{const E=y(k);E&&b.push(E)}),h.forEach((k,E)=>{if(g.has(E))return;const x=y(E);x&&b.push(x)}),b}),p=async()=>{try{const h=await fetch(`/api/suggest/${t.data}`).then(m=>m.json());o.value=h?.data||h}catch(h){console.error(h)}};return i.watch(()=>t.modelValue,h=>{if(typeof h=="boolean"&&o.value.length===1){const m=l(o.value[0]);s[m]=h}else if(Array.isArray(h)){const m=new Set(h);o.value.forEach(g=>{if(!g.disabled){const y=l(g);s[y]=m.has(y)}})}},{immediate:!0}),i.watch(s,()=>{if(!o.value.length){r("update:modelValue",null);return}const h=Object.entries(s).filter(([,m])=>m).map(([m])=>m);r("update:modelValue",h.length===0?[]:h)},{deep:!0}),i.onMounted(()=>{if(t.data)p().then(()=>{if(typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}});else if(o.value=t.options,typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}}),(h,m)=>t.group?(i.openBlock(),i.createElementBlock("div",Xv,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value,g=>(i.openBlock(),i.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(i.openBlock(),i.createElementBlock("span",Zv,i.toDisplayString(g.label),1)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(g.options,y=>(i.openBlock(),i.createBlock(Da,{modelValue:s[l(y)],"onUpdate:modelValue":b=>s[l(y)]=b,value:l(y),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||y.disabled,label:a(y),key:`${g.key}-${l(y)}`,icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,g=>(i.openBlock(),i.createBlock(Da,{modelValue:s[l(g)],"onUpdate:modelValue":y=>s[l(g)]=y,value:l(g),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||g.disabled,label:a(g),key:l(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),t_=ge(e_,[["__scopeId","data-v-8e66207e"]]),n_=["type","placeholder","disabled"],r_=i.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n;function r(u){return u?t.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:o}=St(t.style),s=e,l=i.computed({get:()=>r(t.modelValue),set:u=>s("update:modelValue",u)}),a=i.computed(()=>t.mode==="datetime"?"datetime-local":t.mode),c=i.computed(()=>!!t.disabled),d=i.computed(()=>t.placeholder??"");return(u,f)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:a.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),placeholder:d.value,disabled:c.value,ref:"date",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",i.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,n_)),[[i.vModelDynamic,l.value]])}}),Qp=async(n,e,t,r)=>{try{const o=new FormData;return o.append("unique","true"),o.append("file",n),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${r||""}`,{method:"POST",body:o}).then(s=>s.json()))?.result}catch(o){return Ie({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},o_=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},eh=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),r=e.headers["content-type"],o=new TextDecoder("utf-8").decode(t),s=new Blob([o],{type:r}),l=document.createElement("a");l.setAttribute("download",n),l.href=window.URL.createObjectURL(s),l.click()}catch(e){console.error(e.message)}},s_={},l_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function i_(n,e){return i.openBlock(),i.createElementBlock("svg",l_,e[0]||(e[0]=[i.createElementVNode("path",{d:"M5 12h14"},null,-1),i.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const To=ge(s_,[["render",i_]]),a_={},c_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function d_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",c_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const u_=ge(a_,[["render",d_]]),f_={},p_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function h_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",p_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),i.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),i.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const m_=ge(f_,[["render",h_]]),g_={},y_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function b_(n,e){return i.openBlock(),i.createElementBlock("svg",y_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const th=ge(g_,[["render",b_]]),k_={},x_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function w_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",x_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const E_=ge(k_,[["render",w_]]),C_={},v_={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function __(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",v_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const S_=ge(C_,[["render",__]]),N_=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},M_=n=>{const e=N_(n),t={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return t.imageFormat.includes(e)?"img":t.sheetsFormat.includes(e)?m_:t.textsFormat.includes(e)?S_:t.documentsFormat.includes(e)?u_:t.archivesFormat.includes(e)?E_:th},T_={},A_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function B_(n,e){return i.openBlock(),i.createElementBlock("svg",A_,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const kl=ge(T_,[["render",B_]]),V_={},L_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function O_(n,e){return i.openBlock(),i.createElementBlock("svg",L_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const nh=ge(V_,[["render",O_]]),I_=["title"],D_={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},R_=i.defineComponent({__name:"vs-input-file-list-item",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(n){const e=i.useModel(n,"value"),t=i.useModel(n,"item"),r=n;return(o,s)=>(i.openBlock(),i.createElementBlock("div",{title:t.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(M_)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=l=>i.unref(eh)(t.value))},null,8,["src"])),i.createElementVNode("div",D_,[i.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=l=>{i.unref(o_)(t.value),e.value=r.multiple?e.value?.filter(a=>a!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[i.createVNode(kl,{class:"w-4 h-4"})]),i.createElementVNode("button",{type:"button",onClick:s[2]||(s[2]=l=>i.unref(eh)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[i.createVNode(nh,{class:"w-4 h-4"})])])],8,I_))}}),rh=ge(R_,[["__scopeId","data-v-286cdbc0"]]),F_={class:"flex items-center gap-x-2"},P_=["multiple","disabled"],$_={key:1,class:"flex items-center flex-wrap gap-2"},z_={key:1,class:"loader"},H_={key:1,class:"loader"},j_=i.defineComponent({__name:"vs-input-file",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["change"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=i.useModel(n,"modelValue"),o=e,s=i.ref(null),l=i.ref(!1),a=u=>Array.isArray(r.value)&&r.value[u]||"",c=u=>{if(t.max_size&&u.size>t.max_size*1024*1024){const f=(u.size/1048576).toFixed(2);return Ie({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${f} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:f}=u.target;if(!f||f.length===0)return;const p=Array.from(f);if(t.max_size&&p.filter(h=>!c(h)).length>0){s.value&&(s.value.value="");return}l.value=!0;try{if(t.multiple){const h=Array.from(f).map(async g=>t.format&&!g.name.endsWith(t.format)?null:await Qp(g,"1","form","table")),m=(await Promise.all(h)).filter(g=>g!==null).map(g=>g?.file_path).filter(Boolean);r.value=[...r.value||[],...m],o("change",r.value)}else{const h=f[0];if(t.format&&!h.name.endsWith(t.format))return;const m=await Qp(h,"1","form","table");r.value=m?.file_path,o("change",r.value||"")}}finally{l.value=!1,s.value&&(s.value.value="")}};return(u,f)=>(i.openBlock(),i.createElementBlock("div",F_,[i.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:u.multiple,onChange:d,disabled:l.value||u.disabled},null,40,P_),!u.multiple&&r.value?(i.openBlock(),i.createBlock(rh,{key:0,item:r.value,"onUpdate:item":f[0]||(f[0]=p=>r.value=p),value:r.value,"onUpdate:value":f[1]||(f[1]=p=>r.value=p)},null,8,["item","value"])):u.multiple?(i.openBlock(),i.createElementBlock("div",$_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(p,h)=>(i.openBlock(),i.createBlock(rh,{multiple:u.multiple,key:h,value:r.value,"onUpdate:value":f[2]||(f[2]=m=>r.value=m),item:a(h)},null,8,["multiple","value","item"]))),128)),i.createElementVNode("div",{onClick:f[3]||(f[3]=p=>!u.disabled&&!l.value&&s.value?.click()),class:i.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",z_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2)])):i.createCommentVNode("",!0),u.multiple?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:2,onClick:f[4]||(f[4]=p=>s.value?.click()),class:i.normalizeClass([u.disabled||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",H_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2))]))}}),U_=ge(j_,[["__scopeId","data-v-e613a523"]]),W_={class:"max-w-[55vw]"},K_={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},q_={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},G_={class:"px-[5px]"},J_={class:""},xl=i.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(n){const e=n,t=i.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function r(o){if(o<1024)return`${o} B`;const s=o/1024;return s<1024?`${s.toFixed(2)} KB`:`${(s/1024).toFixed(2)} MB`}return(o,s)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[s[1]||(s[1]=i.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),i.createElementVNode("div",W_,[i.createElementVNode("p",K_,i.toDisplayString(o.item?.uploaded_name),1),i.createElementVNode("p",q_,[i.createElementVNode("span",null,i.toDisplayString(o.item?.username),1),i.withDirectives(i.createElementVNode("span",G_,"|",512),[[i.vShow,o.item?.username]]),i.createElementVNode("span",null,i.toDisplayString(t.value),1),s[0]||(s[0]=i.createElementVNode("span",{class:"px-[5px]"},"|",-1)),i.createElementVNode("span",J_,i.toDisplayString(r(o.item?.size)),1)])])],64))}}),Y_={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},X_={key:0,class:"flex w-full gap-x-3 items-center"},Z_={key:1,class:"flex gap-x-3 w-full items-center"},Q_={key:2,class:"flex gap-x-3 w-full items-center"},eS=["href"],tS={key:3,class:"flex gap-x-3 w-full items-center"},nS={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},rS={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},oS={class:"inline-block"},sS={class:"inline-block"},lS=i.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(n,{emit:e}){const t=n,r=e;function o(u){return["pdf","json"].includes(u.ext)}function s(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function l(u){const f=document.createElement("a");f.setAttribute("download",u?.uploaded_name),f.href=u?.file_path,f.click()}async function a(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),r("update")}catch(u){console.error(u)}}function c(){r("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:a,updateListOnConfirm:!0})}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&r("openLightbox",{item:t.item,index:u})}return(u,f)=>(i.openBlock(),i.createElementBlock("div",Y_,[u.item.ext==="jpg"||u.item.ext==="png"?(i.openBlock(),i.createElementBlock("div",X_,[i.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=p=>d(u.index))},[i.createVNode(xl,{item:u.item},null,8,["item"])])])):o(u.item)?(i.openBlock(),i.createElementBlock("div",Z_,[i.createVNode(xl,{item:u.item},null,8,["item"])])):s(u.item)?(i.openBlock(),i.createElementBlock("div",Q_,[i.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[i.createVNode(xl,{item:u.item},null,8,["item"])],8,eS)])):(i.openBlock(),i.createElementBlock("div",tS,[i.createVNode(xl,{item:u.item},null,8,["item"])])),i.createElementVNode("div",nS,[i.createElementVNode("div",rS,[i.createElementVNode("div",oS,[i.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:f[1]||(f[1]=p=>l(u.item))},[i.createVNode(nh,{height:"14",width:"14"})])]),f[3]||(f[3]=i.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),i.createElementVNode("div",sS,[i.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:f[2]||(f[2]=p=>c())},[i.createVNode(kl,{height:"14",width:"14"})])])])])]))}}),iS={},aS={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function cS(n,e){return i.openBlock(),i.createElementBlock("svg",aS,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const dS=ge(iS,[["render",cS]]),uS={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},fS={class:"flex w-full mb-[12px] items-center gap-x-2"},pS={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},hS={class1:"ml-auto"},mS={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},gS={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},yS={class:"relative"},bS={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},kS={key:0},xS=i.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(n,{emit:e}){const t=n,r=i.inject("form"),o=i.computed(()=>r.value.formId),s=i.ref(!1),l=i.ref(0),a=e,c=i.ref(!1),d=i.ref({}),u=i.ref([]),f=i.ref(""),p=i.computed(()=>Array.isArray(u.value)?u.value.filter(E=>E.ext==="jpg"||E.ext==="png").map(E=>E?.file_path):[]),h=i.computed(()=>f.value===""?u.value:u.value.filter(E=>E?.uploaded_name?.includes(f.value))),m=E=>{const x=p.value.findIndex(C=>C===E.item.file_path);x!==-1&&(s.value=!0,l.value=x)},g=async()=>{try{const E=await fetch(`${t.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=E?.rows}catch(E){console.error(E)}},y=async E=>{await Promise.all(Array.from(E.target.files).map(async x=>{const C=new FormData;C.append("file",x);try{const _=`${t.prefix}/widget/file/${o.value}`,w=await fetch(_,{method:"POST",body:C});return w.ok?(a("update","file-list"),x):(Ie({type:w.status>=400&&w.status<500?"warning":"error",title:"Error",message:`Error code: ${w.status}`}),null)}catch(_){return Ie({type:"error",title:"Error",message:_.message||"Unknown error"}),console.error(_),null}})),await g()},b=E=>{const x={...E};return E.cancel||(x.cancel=()=>{c.value=!1}),E.updateListOnConfirm&&(x.confirm=async()=>{await E.confirm(),c.value=!1,g()}),x},k=E=>{d.value=b(E),c.value=!0};return i.watch(o,E=>{E&&g()}),i.onMounted(()=>{o.value&&g()}),(E,x)=>{const C=i.resolveComponent("Lightbox"),_=i.resolveComponent("MessageBox");return i.openBlock(),i.createElementBlock("div",uS,[i.createElementVNode("div",fS,[i.createElementVNode("h2",pS," Файлів: "+i.toDisplayString(u.value?.length),1),i.createElementVNode("div",hS,[i.createElementVNode("label",null,[i.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=w=>y(w))},null,32),i.createElementVNode("div",mS,[i.createVNode(dS,{height:"16",width:"16"})])])])]),u.value?.length>4?(i.openBlock(),i.createElementBlock("div",gS,[i.createElementVNode("div",null,[i.createElementVNode("div",yS,[x[8]||(x[8]=i.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[i.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),i.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":x[1]||(x[1]=w=>f.value=w),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[i.vModelText,f.value,void 0,{trim:!0}]])])])])):i.createCommentVNode("",!0),u.value?.length?(i.openBlock(),i.createElementBlock("div",bS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(w,T)=>(i.openBlock(),i.createBlock(lS,{key:T,prefix:E.prefix,item:w,index:T,onUpdate:x[2]||(x[2]=D=>E.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=D=>k(D)),onOpenLightbox:x[4]||(x[4]=D=>m(D))},null,8,["prefix","item","index"]))),128)),h.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",kS,x[9]||(x[9]=[i.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):i.createCommentVNode("",!0),i.createVNode(C,{modelValue:s.value,"onUpdate:modelValue":x[5]||(x[5]=w=>s.value=w),startIndex:l.value,"onUpdate:index":x[6]||(x[6]=w=>l.value=w),images:p.value},null,8,["modelValue","startIndex","images"]),i.createVNode(_,i.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=w=>c.value=w),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),wS={class:"flex items-center justify-between"},ES={class:"text-[16px] text-gray-900 font-medium"},CS={class:"grid gap-3"},vS=i.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",wS,[i.createElementVNode("p",ES,i.toDisplayString(n.title),1),i.createVNode(Yp,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),style:i.normalizeStyle(n.style)},null,8,["modelValue","style"])]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",CS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),_S=ge(vS,[["__scopeId","data-v-90320b87"]]),SS={class:"text-[16px] text-gray-900 font-medium"},NS={class:"grid gap-3"},MS=i.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=s=>t.value=!t.value),class:"flex items-center gap-2"},[i.createVNode(i.unref(_v),{class:i.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),i.createElementVNode("span",SS,i.toDisplayString(n.title),1)]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",NS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),TS=ge(MS,[["__scopeId","data-v-590eff11"]]),AS={class:"flex items-center justify-between"},BS=i.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",AS,[i.createElementVNode("p",null,i.toDisplayString(n.title),1)]),i.renderSlot(e.$slots,"default")]))}}),VS={switcher:_S,accordion:TS,default:BS},It={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},LS=(n,e)=>String(n)===String(e),OS=(n,e)=>String(n)!==String(e),IS=(n,e)=>n>e,DS=(n,e)=>n>=e,RS=(n,e)=>n<e,FS=(n,e)=>n<=e,PS=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,$S=(n,e)=>String(n).startsWith(String(e)),zS=(n,e)=>String(n).endsWith(String(e)),HS=(n,e)=>String(n).includes(String(e)),jS=(n,e)=>Array.isArray(e)?e.includes(n):!1,US=(n,e)=>Array.isArray(e)?!e.includes(n):!0,oh=(n,e)=>{if(!e)return!0;switch(e?.[1]){case It.Equal:return LS(n,e?.[2]);case It.Inequal:return OS(n,e?.[2]);case It.Higer:return IS(n,e?.[2]);case It.HigerOrEqual:return DS(n,e?.[2]);case It.Lower:return RS(n,e?.[2]);case It.LowerOrEqual:return FS(n,e?.[2]);case It.Between:return PS(n,e?.[2]);case It.StartWith:return $S(n,e?.[2]);case It.EndWith:return zS(n,e?.[2]);case It.Contain:return HS(n,e?.[2]);case It.In:return jS(n,e?.[2]);case It.NotIn:return US(n,e?.[2]);default:return!0}},WS=i.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(n){const e=n,t=i.inject("values",i.ref({})),r=i.inject("form"),o=i.computed(()=>e.schema?.filter(a=>{const c=a?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=e.name?t.value?.[e.name]?.[d]??t.value?.[d]:t.value?.[d];return oh(u,c)})),s=i.computed(()=>VS[e.view]),l=i.computed(()=>{if(t.value||(t.value={}),!e.name)return t.value;const a=t.value[e.name];if(a)return a;const c={};return t.value={...t.value,[e.name]:c},c});return(a,c)=>n.schema?.length?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value),{key:0,title:n.title,style:i.normalizeStyle(n.style)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,d=>(i.openBlock(),i.createBlock(ih,i.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:l.value[d.name],"onUpdate:modelValue":u=>l.value[d.name]=u,style:n.style,error:i.unref(r)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):i.createCommentVNode("",!0)}}),KS=["aria-expanded","data-focus"],qS={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},GS={class:"flex items-center min-w-0"},JS=["title"],YS=["innerHTML"],XS=["onClick"],ZS={class:"flex-1 min-w-[2px]"},QS=["placeholder"],eN=["title"],tN=["innerHTML"],nN={key:2,class:"flex-1 min-w-[2px]"},rN=["placeholder"],oN={class:"flex items-center shrink-0"},sN=["disabled"],lN=["disabled","title"],iN=["aria-disabled","onClick"],aN=["innerHTML"],cN={key:1,class:"px-3 py-2 text-center text-gray-500"},dN=["disabled"],sh=i.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(n,{emit:e}){const t=n,r=e,o=i.computed(()=>t.multiple),s=i.computed(()=>t.disabled);St(t.style);const l=i.computed({get:()=>t.modelValue,set:V=>r("update:modelValue",V)});!l.value&&t.defaultValue&&(l.value=t.defaultValue);const a=i.ref(null),c=i.ref(null),d=i.ref(null),u=i.ref(null),f=i.ref(!1),p=i.ref(!1),h=i.ref(null),m=i.ref([]),g=i.ref(-1),y=i.ref([]),b=i.ref(""),k=i.ref(null),E=i.ref("bottom"),x=i.ref({}),C=i.ref([]),_=i.computed(()=>{if(!C.value.length)return[];const V=m.value,$=new Map(V.map(q=>[q.id?.toString(),q]));return C.value.map(q=>$.get(q?.toString())).filter(q=>!!q)}),w=i.computed(()=>t.placeholder||"Select..."),T=i.computed(()=>K(h.value));i.computed(()=>o.value?!C.value.length&&b.value==="":!T.value&&b.value==="");const D=i.computed(()=>s.value?!1:o.value?C.value.length>0:!!l.value),R=V=>o.value?C.value.some($=>$?.toString()===V?.toString()):l.value?.toString()===V?.toString(),A=i.computed(()=>{let V=m.value??[];if(!t.data&&b.value.trim()!==""){const $=b.value.toLowerCase();V=V.filter(q=>{const ae=K(q).toLowerCase(),_e=q.text?.toLowerCase?.()||"";return ae.includes($)||_e.includes($)})}if(o.value&&C.value.length){const $=new Set(C.value.map(q=>q?.toString()));V=V.filter(q=>!$.has(q.id?.toString()))}return V}),B=i.inject("values"),U=/\{\{\s*([^}]+?)\s*\}\}/g,Y=V=>(V?String(V):"").replace(/<[^>]*>/g,"").trim(),O=i.computed(()=>t.slot??t?.optionTemplate??""),z=V=>{if(!V)return"";const $=O.value;return $?$.replace(U,(q,ae)=>{const _e=ae.trim(),Qe=V[_e];return Qe!=null?String(Qe):""}):V.text??""},K=V=>{if(!V)return"";if(!O.value)return V.text??"";const $=z(V);return Y($)||V.text||""},ee=V=>{t.set&&B?.value&&Object.entries(t.set).forEach(([$,q])=>{if(!$)return;const ae=V?V[q]:null;B.value[$]=ae??null})},re=i.computed(()=>t.parent?B?.value?.[t.parent]?.toString()??null:null),xe=async V=>{if(!t.data){let $=t.options??[];if(V?.trim()){const q=V.toLowerCase();$=$.filter(ae=>{const _e=K(ae).toLowerCase(),Qe=ae.text?.toLowerCase?.()||"";return _e.includes(q)||Qe.includes(q)})}return $}try{const $=t.host??"",q=t.prefix??"api",ae=t.api??`/${q}/suggest/${t.data}`,_e=`${$}${ae}`,Qe=new URLSearchParams;return Qe.set("json","1"),V&&Qe.set("key",V),re.value!==void 0&&re.value!==null&&re.value!==""&&Qe.set("parent",re.value),(await fetch(`${_e}?${Qe.toString()}`).then(Mt=>Mt.json()))?.data??[]}catch{return[]}},Ze=async()=>{t.data?m.value=await xe(b.value):m.value=t.options?[...t.options]:[]},ht=async V=>{if(V==null)return null;const $=m.value?.find(q=>q?.id?.toString()===String(V));if($)return $;if(t.data)try{const q=t.host??"",ae=t.prefix??"api",_e=t.api??`/${ae}/suggest/${t.data}`,Qe=`${q}${_e}`,Mt=new URLSearchParams;return Mt.set("json","1"),Mt.set("val",String(V)),re.value!==void 0&&re.value!==null&&re.value!==""&&Mt.set("parent",re.value),((await fetch(`${Qe}?${Mt.toString()}`).then(Wr=>Wr.json()))?.data??[])?.[0]??null}catch{return null}return null},mt=async V=>{const $=new Set(m.value.map(ae=>ae.id?.toString())),q=V.filter(ae=>!$.has(ae?.toString()));q.length&&await q.reduce(async(ae,_e)=>{await ae;const Qe=await ht(_e);Qe&&m.value.push(Qe)},Promise.resolve())},Ke=async()=>{s.value||(f.value=!0,await Ze(),await i.nextTick(()=>{$t(),k.value?.focus(),A.value.length?g.value=0:g.value=-1}))},gt=()=>{f.value=!1,g.value=-1},En=async V=>{s.value||(f.value?gt():await Ke())},Cn=async()=>{f.value?k.value?.focus():await Ke()},vn=()=>{o.value?(C.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null)),ee(null),b.value="",i.nextTick(()=>k.value?.focus())},xr=V=>{o.value&&(C.value=C.value.filter($=>$?.toString()!==V?.toString()),l.value=[...C.value],r("change",l.value),i.nextTick(()=>k.value?.focus()))},yt=V=>{o.value?(R(V.id)||(C.value=[...C.value,V.id],l.value=[...C.value],r("change",l.value)),b.value="",i.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,A.value.length-1)}),ee(null)):(h.value=V,l.value=V.id,r("change",l.value),b.value="",gt(),ee(V))},Pt=V=>{R(V.id)||yt(V)},cn=(V,$)=>{if(!V||!$)return;const q=V.offsetTop,ae=q+V.offsetHeight,_e=$.scrollTop,Qe=_e+$.clientHeight;let Mt=$.scrollTop;q<_e?Mt=q-80:ae>Qe&&(Mt=ae-$.clientHeight+4);const Wr=$;Wr.scrollTop=Mt},qe=V=>{let $=V.parentElement;for(;$;){if($.classList.contains("ui-dialog__content"))return $;const q=window.getComputedStyle($),ae=q.overflow+q.overflowY+q.overflowX;if(ae.includes("auto")||ae.includes("scroll")||$===document.body||$===document.documentElement)return $;$=$.parentElement}return document.body},$t=()=>{if(!c.value)return;const V=c.value.getBoundingClientRect(),$=window.innerHeight||document.documentElement.clientHeight,q=window.innerWidth||document.documentElement.clientWidth,ae=8,_e=8,Qe=t.maxHeight||300,Mt=$-V.bottom-_e-ae,Wr=V.top-_e-ae,Dl=Mt>=Wr,bc=Math.max(q-ae*2,0);let{width:jo}=V;bc>0&&jo>bc&&(jo=bc);let{left:Uo}=V;Uo+jo+ae>q&&(Uo=q-jo-ae),Uo=Math.max(Uo,ae);const kO=Math.min(Qe,Math.max(Dl?Mt:Wr,50));E.value=Dl?"bottom":"top",x.value={position:"fixed",left:`${Uo}px`,width:`${jo}px`,minWidth:"300px",maxHeight:`${kO}px`,transform:Dl?"none":"translateY(-100%)",top:Dl?`${V.bottom+_e}px`:`${V.top-_e}px`}},qt=async V=>{s.value||!f.value&&(V.key==="ArrowDown"||V.key==="ArrowUp")&&(V.preventDefault(),await Ke())},dn=V=>{if(!f.value)return;const{key:$}=V;if($==="ArrowDown")V.preventDefault(),g.value+1<A.value.length&&(g.value+=1,cn(y.value[g.value],d.value));else if($==="ArrowUp")V.preventDefault(),g.value>0&&(g.value-=1,cn(y.value[g.value],d.value));else if($==="Enter"){V.preventDefault();const q=A.value[g.value];q&&yt(q),k.value?.blur()}else $==="Escape"?(V.preventDefault(),gt()):$==="Backspace"?o.value&&b.value===""&&C.value.length&&(C.value=C.value.slice(0,-1),l.value=[...C.value],r("change",l.value)):$==="Home"?(g.value=0,cn(y.value[0],d.value)):$==="End"?(g.value=A.value.length-1,cn(y.value[g.value],d.value)):$==="Tab"&&gt()},Xn=()=>{s.value||(p.value=!0)},S=()=>{p.value=!1,b.value=""},N=V=>{V.key==="Escape"&&f.value&&gt()},P=V=>{const $=V.target;a.value?.contains($)||u.value?.contains($)||gt()},Z=V=>{f.value&&d.value&&!d.value.contains(V.target)&&$t()},Ee=()=>{f.value&&$t()},Be=()=>{f.value&&$t()};i.watch(()=>t.options,V=>{V?.length&&(m.value=[...V],pe())},{immediate:!0});async function pe(){if(o.value)Array.isArray(l.value)?C.value=[...l.value]:(C.value=l.value==null?[]:[l.value],l.value=[...C.value]),t.data&&C.value.length&&(await mt(C.value),await i.nextTick());else{if(Array.isArray(l.value)){const V=l.value[0]??null;l.value=V??null}l.value!=null&&(h.value=await ht(l.value)),ee(h.value??null)}}i.watch(l,()=>{pe()}),i.onMounted(async()=>{addEventListener("keydown",N),addEventListener("scroll",Z,!0),addEventListener("resize",Ee),document.addEventListener("click",P,!0),c.value&&qe(c.value).addEventListener("scroll",Be,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await xe("")),await pe(),fe.value=!1}),i.onUnmounted(()=>{removeEventListener("keydown",N),removeEventListener("scroll",Z,!0),removeEventListener("resize",Ee),document.removeEventListener("click",P,!0),c.value&&qe(c.value).removeEventListener("scroll",Be,!0)});const I=i.ref(!1),H=i.ref({}),he=i.ref([]),v=i.ref(null);async function M(){if(!t.add?.token||v?.value.validate())return;const V=t.add.api??`/api/table/${t.add.token}`,{id:$}=await fetch(V,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H.value)}).then(q=>q.json());if(!t.options?.length&&t.data){const{data:q}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${$}`).then(ae=>ae.json());h.value=q[0],m.value.push(q[0]),l.value=$}I.value=!1,Ie({title:"Success!",message:"Object created."})}async function W(){if(!t.add)return null;const V=await fetch(`/api/template/form/${t.add.form}`).then($=>$.json());return he.value=V.schema,I.value=!0,null}function G(V,$=200){let q;return(...ae)=>{q&&clearTimeout(q),q=window.setTimeout(()=>V(...ae),$)}}const Q=G(async V=>{m.value=await xe(V)},200);i.watch(b,V=>{t.data&&Q(V.trim())}),i.watch(()=>t.options,V=>{!t.data&&V?.length&&(m.value=[...V],pe())},{immediate:!0}),i.watch(()=>t.parent??t.parentValue,()=>{t.data&&Ze()});const fe=i.ref(!0);return i.watch(re,async()=>{if(t.data&&(fe.value||(o.value?(C.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null))),await Ze(),t.auto===1&&re.value&&m.value.length>0)){const V=m.value[0];V&&yt(V)}}),(V,$)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(i.unref(Ia),{visible:I.value,"onUpdate:visible":$[1]||($[1]=q=>I.value=q),title:"Додати",buttonText:"Додати",onDone:M,teleport:V.teleport},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:he.value,modelValue:H.value,"onUpdate:modelValue":$[0]||($[0]=q=>H.value=q),ref_key:"addForm",ref:v},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),i.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:a,onClick:$[5]||($[5]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass])},[$[10]||($[10]=i.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),$[11]||($[11]=i.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||p.value?"border-blue-500 ring-1 ring-blue-500":"",s.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:qt,onClick:Cn,"data-focus":f.value||p.value?"true":"false"},[i.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:c},[o.value?(i.openBlock(),i.createElementBlock("div",qS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(_.value,q=>(i.openBlock(),i.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:q.id},[i.createElementVNode("div",GS,[q?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:i.normalizeStyle({backgroundColor:q?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:K(q)},[O.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:z(q)},null,8,YS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(q.text),1)],64))],8,JS)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:i.withModifiers(ae=>xr(q.id),["stop"])},$[6]||($[6]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,XS)]))),128)),i.createElementVNode("div",ZS,[!s.value&&V.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:C.value.length?" ":w.value,"onUpdate:modelValue":$[2]||($[2]=q=>b.value=q),onFocus:Xn,onBlur:S,onKeydown:dn},null,40,QS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)])])):!o.value&&!p.value&&T.value&&b.value===""?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["truncate text-gray-900"]),title:T.value},[h.value?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:i.normalizeStyle({backgroundColor:h.value?.color})},null,4)):i.createCommentVNode("",!0),O.value?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({"pl-5":h.value?.color}),innerHTML:z(h.value)},null,10,tN)):(i.openBlock(),i.createElementBlock("span",{key:2,class:i.normalizeClass({"pl-5":h.value?.color})},i.toDisplayString(h.value?.text),3))],8,eN)):i.createCommentVNode("",!0),o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",nN,[!s.value&&V.search?i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:T.value?" ":w.value,"onUpdate:modelValue":$[3]||($[3]=q=>b.value=q),onFocus:Xn,onBlur:S,onKeydown:dn},null,40,rN)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)]))],512),i.createElementVNode("div",oN,[D.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:i.withModifiers(vn,["stop"])},$[7]||($[7]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,sN)):i.createCommentVNode("",!0),$[9]||($[9]=i.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),i.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:$[4]||($[4]=i.withModifiers(q=>En(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},$[8]||($[8]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,lN)])],42,KS),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[f.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:i.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:i.normalizeStyle(x.value),role:"listbox"},[i.createElementVNode("div",{class:"overflow-y-auto py-1",style:i.normalizeStyle({maxHeight:x.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[A.value.length?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(A.value,(q,ae)=>(i.openBlock(),i.createElementBlock("div",{key:q.id,ref_for:!0,ref:_e=>y.value[ae]=_e,class:i.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",R(q.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===ae&&!R(q.id)?"bg-blue-100":""]),"aria-disabled":R(q.id)?"true":"false",role:"option",tabindex:"-1",onClick:_e=>Pt(q)},[q?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:i.normalizeStyle({backgroundColor:q?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["leading-[19px]",g.value===q.id?"text-white":"",(g.value,"")])},[O.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:z(q)},null,8,aN)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(q.text),1)],64))],2)],10,iN))),128)):(i.openBlock(),i.createElementBlock("div",cN," No options "))],4)],4)):i.createCommentVNode("",!0)]))],2),t.add?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:W,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:s.value,type:"button"},[i.createVNode(To,{width:"16",height:"16"}),$[12]||($[12]=i.createElementVNode("span",null,"Додати",-1))],8,dN)):i.createCommentVNode("",!0)],512)],64))}}),uN=["placeholder","disabled"],fN=i.defineComponent({__name:"vs-input-textarea",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,row:"2",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,uN)),[[i.vModelText,r.value]])}}),pN={},hN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function mN(n,e){return i.openBlock(),i.createElementBlock("svg",hN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const gN=ge(pN,[["render",mN]]),yN={},bN={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function kN(n,e){return i.openBlock(),i.createElementBlock("svg",bN,e[0]||(e[0]=[i.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),i.createElementVNode("path",{d:"M7 20V4"},null,-1),i.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),i.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const xN=ge(yN,[["render",kN]]),wN={},EN={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function CN(n,e){return i.openBlock(),i.createElementBlock("svg",EN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const vN=ge(wN,[["render",CN]]),_N={},SN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function NN(n,e){return i.openBlock(),i.createElementBlock("svg",SN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const MN=ge(_N,[["render",NN]]),TN={},AN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function BN(n,e){return i.openBlock(),i.createElementBlock("svg",AN,e[0]||(e[0]=[i.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const lh=ge(TN,[["render",BN]]),VN={},LN={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ON(n,e){return i.openBlock(),i.createElementBlock("svg",LN,e[0]||(e[0]=[i.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const IN=ge(VN,[["render",ON]]),DN={},RN={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function FN(n,e){return i.openBlock(),i.createElementBlock("svg",RN,e[0]||(e[0]=[i.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const PN=ge(DN,[["render",FN]]),$N={class:"vs-datatable border rounded-xl w-full flex-grow"},zN={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},HN={class:"relative w-full"},jN={class:"table-wrapper flex gap-2"},UN={class:"vs-popover inline-block text-slate-700"},WN={class:"text-center"},KN={class:""},qN={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},GN={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},JN={class:"text-sm items-center text-gray-800 flex gap-1"},YN={class:"w-full overflow-x-auto"},XN={class:"w-full table-auto caption-bottom text-sm"},ZN={class:"[&_tr]:border-b"},QN={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},eM={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},tM={key:0,colspan:"100%",class:"text-center"},nM={class:"w-full"},rM={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},oM=["onDragstart","onDragover","onDrop"],sM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},lM={class:"flex items-center justify-center"},iM={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},aM={key:0},cM=["src"],dM={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},uM=["innerHTML"],fM={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},pM={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},hM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},mM={class:"flex items-center justify-center gap-2"},gM=["onClick"],yM=["onClick"],bM={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},kM=i.defineComponent({__name:"vs-input-datatable",props:i.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref({}),o=i.ref(""),s=i.computed(()=>{if(!o.value)return t.value??[];const O=o.value.toLowerCase();return t.value.filter(z=>e.colModel?.some(K=>{const ee=z[K.key];return ee?Array.isArray(ee)?ee.join(", ").toLowerCase().includes(O):String(ee).toLowerCase().includes(O):!1}))}),l=i.ref(null),a=i.ref(null),c=i.ref(!1),d=i.ref(null),u=i.ref({top:0,left:0}),f=O=>{l.value=O},p=O=>{a.value=O},h=O=>{if(l.value===null||l.value===O){l.value=null,a.value=null;return}const z=[...t.value],[K]=z.splice(l.value,1);z.splice(O,0,K),t.value=z,l.value=null,a.value=null},m=O=>{const z=O.currentTarget.getBoundingClientRect();u.value={top:z.bottom+window.scrollY,left:z.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=O=>{const z=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],K=O.toLowerCase();return z.some(ee=>K.endsWith(ee))},b=O=>{const z=O.target.files?.[0];if(!z)return;const K=new FileReader;K.onload=ee=>{try{const re=ee.target?.result;if(typeof re=="string"){const xe=JSON.parse(re);Array.isArray(xe)&&t.value.push(...xe)}}catch(re){console.error("Error parsing file:",re)}},K.readAsText(z)},k=()=>{const O=JSON.stringify(t.value,null,2),z=new Blob([O],{type:"application/json"}),K=URL.createObjectURL(z),ee=document.createElement("a");ee.href=K,ee.download="data.json",ee.click(),URL.revokeObjectURL(K)};i.onMounted(async()=>{const O=e.colModel?.filter(z=>z.data);O?.length&&Promise.all(O.map(async z=>{const K=await(await fetch(`/api/suggest/${z.data}`)).json();r.value[z.key]=K.data}))});const E=i.ref(""),x=i.ref(!1);let C="edit",_=0;const w=i.ref({}),T=i.ref({});async function D(){E.value="Додати",x.value=!0,C="add",w.value={}}function R(O,z){const K=z.key||z.name;return r.value[K]&&O[K]?r.value[K].find(ee=>ee.id.toString()===O[K].toString())?.text??O[K]:O[K]||"-"}async function A(O,z){E.value="Редагувати",x.value=!0,C="edit",_=z,w.value={...O}}function B(){const O=T.value.validate();if(O){Ie({type:"warning",title:"Помилка валідації",message:Object.entries(O).map(([z,K])=>`${z}: ${K}`).join(`
119
+ `)});return}C==="add"?Array.isArray(t.value)?t.value=[...t.value,w.value]:t.value=[w.value]:t.value=t.value.map((z,K)=>K===_?w.value:z),x.value=!1}function U(O){t.value=t.value.filter((z,K)=>K!==O)}function Y(){x.value=!1}return(O,z)=>(i.openBlock(),i.createElementBlock("div",$N,[i.createElementVNode("div",zN,[i.createElementVNode("div",HN,[i.createVNode(gN,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":z[0]||(z[0]=K=>o.value=K),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[i.vModelText,o.value]])]),i.createElementVNode("div",jN,[i.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),i.createElementVNode("div",UN,[i.createElementVNode("div",WN,[i.createElementVNode("div",KN,[i.createElementVNode("button",{onClick:m,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(xN,{height:"16",width:"16"})])])])])]),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:i.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:u.value.top+"px",left:u.value.left+"px"}])},[i.createElementVNode("div",qN,[i.createElementVNode("div",GN,[i.createElementVNode("button",{onClick:g,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createVNode(vN,{class:"text-black",width:"14",height:"14"}),z[4]||(z[4]=i.createTextVNode(" Імпортувати ",-1))]),i.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createElementVNode("span",JN,[i.createVNode(MN,{class:"text-black",width:"14",height:"14"}),z[5]||(z[5]=i.createTextVNode(" Експортувати ",-1))])])])])],4)):i.createCommentVNode("",!0)])),i.createElementVNode("button",{onClick:D,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[i.createVNode(To),z[6]||(z[6]=i.createTextVNode(" Додати ",-1))])]),i.createElementVNode("div",YN,[i.createElementVNode("table",XN,[i.createElementVNode("thead",ZN,[i.createElementVNode("tr",QN,[i.createElementVNode("th",eM,[i.createVNode(lh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(O.colModel,K=>(i.openBlock(),i.createElementBlock("th",{key:K.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},i.toDisplayString(K.ua||K.label),1))),128)),z[7]||(z[7]=i.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),i.createElementVNode("tbody",{class:i.normalizeClass({"[&_tr:last-child]:border-0":!a.value})},[s.value.length===0?(i.openBlock(),i.createElementBlock("td",tM,[i.createElementVNode("div",nM,[i.createElementVNode("div",rM,[i.createVNode(IN,{class:"w-48 mx-auto"}),z[8]||(z[8]=i.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[i.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),i.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(K,ee)=>(i.openBlock(),i.createElementBlock("tr",{key:K.id,class:i.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":l.value===ee,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":a.value===ee}]),draggable:"true",onDragstart:re=>f(ee),onDragover:i.withModifiers(re=>p(ee),["prevent"]),onDrop:re=>h(ee)},[i.createElementVNode("td",sM,[i.createElementVNode("div",lM,[i.createVNode(lh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(O.colModel,re=>(i.openBlock(),i.createElementBlock("td",{key:re.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[re.type==="file"?(i.openBlock(),i.createElementBlock("div",iM,[y(R(K,re))?(i.openBlock(),i.createElementBlock("div",aM,[i.createElementVNode("img",{src:R(K,re),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,cM)])):(i.openBlock(),i.createElementBlock("div",dM,[i.createVNode(th,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):re.type==="tiptap-editor"?(i.openBlock(),i.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:R(K,re)},null,8,uM)):re.type==="reference"?(i.openBlock(),i.createElementBlock("div",fM,i.toDisplayString(R(K,re)),1)):(i.openBlock(),i.createElementBlock("div",pM,i.toDisplayString(R(K,re)),1))]))),128)),i.createElementVNode("td",hM,[i.createElementVNode("div",mM,[i.createElementVNode("button",{onClick:re=>A(K,ee),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(PN,{width:"24",height:"24",class:"w-3 h-3"})],8,gM),i.createElementVNode("button",{onClick:re=>U(ee),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[i.createVNode(kl,{width:"24",height:"24",class:"w-3 h-3"})],8,yM)])])],42,oM))),128))],2)])]),i.createVNode(i.unref(Ia),{teleport:"#modal",visible:x.value,title:E.value,size:"lg",onClose:Y},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:e.colModel,values:w.value,"onUpdate:values":z[1]||(z[1]=K=>w.value=K),form:T.value,"onUpdate:form":z[2]||(z[2]=K=>T.value=K)},null,8,["schema","values","form"]),i.createElementVNode("div",bM,[i.createElementVNode("button",{type:"button",onClick:z[3]||(z[3]=K=>x.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:B,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),xM={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function Ao(n){return n?n.type==="Polygon"?{type:"MultiPolygon",coordinates:[n.coordinates]}:n.type==="Feature"?{...n,geometry:Ao(n.geometry)}:n.type==="FeatureCollection"?{...n,features:(n.features||[]).map(e=>Ao(e)).filter(Boolean)}:n:null}function wM(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?Ao(n):n.geom?{type:"Feature",geometry:Ao({type:n.geom.type,coordinates:n.geom.coordinates}),properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:Ao(n),properties:{}}:null:null}const EM={},CM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function vM(n,e){return i.openBlock(),i.createElementBlock("svg",CM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),i.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const _M=ge(EM,[["render",vM]]),SM={},NM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function MM(n,e){return i.openBlock(),i.createElementBlock("svg",NM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const TM=ge(SM,[["render",MM]]),AM={},BM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function VM(n,e){return i.openBlock(),i.createElementBlock("svg",BM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const LM=ge(AM,[["render",VM]]),OM={},IM={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function DM(n,e){return i.openBlock(),i.createElementBlock("svg",IM,e[0]||(e[0]=[i.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const RM=ge(OM,[["render",DM]]),FM={},PM={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function $M(n,e){return i.openBlock(),i.createElementBlock("svg",PM,e[0]||(e[0]=[i.createElementVNode("title",null,null,-1),i.createElementVNode("desc",null,null,-1),i.createElementVNode("defs",null,null,-1),i.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[i.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[i.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[i.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const zM=ge(FM,[["render",$M]]),HM={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},jM={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},UM=["onClick"],WM={class:"relative flex-1 min-w-[140px]"},KM=["placeholder"],qM="https://data.softpro.ua/api-user/gis-url-proxy",GM="https://geo.rv.ua/api-user/dzk.api",JM=i.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(n,{emit:e}){const t=n,r=e,o=["here","xy","parcel"],s=i.computed(()=>{const x=t.config?.tools?.filter(C=>o.includes(C));return x&&x.length?x:o}),l=i.computed(()=>t.config?.placeholder?.trim()||"Пошук…"),a=i.ref(s.value[0]??o[0]);i.watch(s,x=>{x.includes(a.value)||(a.value=x[0])});const c=i.ref(""),d=i.ref(!1),u=i.ref(null);i.watch(a,()=>{c.value="",d.value=!1});function f(x){a.value=x}function p(x){if(!d.value)return;const C=u.value;C&&!C.contains(x.target)&&(d.value=!1)}i.onMounted(()=>{window.addEventListener("click",p,!0)}),i.onBeforeUnmount(()=>{window.removeEventListener("click",p,!0)});function h(x){return x==="xy"?"Координати":x==="parcel"?"Кадастр":"Адреси"}function m(x){const C=x.replace(/[,]+/g," ").trim();if(!C)return null;const _=C.split(/\s+/).filter(Boolean);if(_.length<2)return null;const w=_.slice(0,2).map(Number);if(!w.every(Y=>Number.isFinite(Y)))return null;let[T,D]=w,R=T,A=D;const B=Y=>Math.abs(Y)<=90,U=Y=>Math.abs(Y)<=180;if(!B(R)||!U(A))if(B(A)&&U(R))R=D,A=T;else return null;return{lat:R,lng:A}}function g(x){return(x?.items||[]).map((C,_)=>({id:String(C?.id??_),title:C?.title||C?.address?.label||"Знайдений обʼєкт",lat:Number(C?.position?.lat),lng:Number(C?.position?.lng)})).filter(C=>Number.isFinite(C.lat)&&Number.isFinite(C.lng))}function y(x){const C=x?.result||x?.data||x;if(!C)return[];const _=C.geom_centroid;if(!_||!Array.isArray(_.coordinates))return[];const[w,T]=_.coordinates;return!Number.isFinite(T)||!Number.isFinite(w)?[]:[{id:"parcel",title:C.cadnum||C.cad_num||"Земельна ділянка",lat:T,lng:w}]}function b(x){const C=x.replace(/\s+/g,"").split(":");if(C.length!==4)return!1;const _=[10,2,3,4];return C.every((w,T)=>w.length===_[T]&&/^\d+$/.test(w))}function k(x){r("goToCoordinates",[x.lat,x.lng])}async function E(){const x=c.value.trim();if(x){if(a.value==="xy"){const C=m(x);if(!C){Ie({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(C),c.value="";return}try{const C=new URL(a.value==="here"?qM:GM);if(a.value==="here")C.searchParams.set("searchtext",x);else{if(!b(x)){Ie({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}C.searchParams.set("cad_num",x)}const _=await fetch(C.toString());if(!_.ok)throw new Error(`HTTP ${_.status}`);const w=await _.json(),T=a.value==="here"?g(w):y(w);if(!T.length)Ie({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const D=T[0];k(D),c.value=""}}catch(C){const _=C?.message||"Помилка пошуку";Ie({type:"error",title:"Пошук",message:_})}}}return(x,C)=>(i.openBlock(),i.createElementBlock("div",HM,[i.createElementVNode("form",{class:"flex gap-2",onSubmit:i.withModifiers(E,["prevent"])},[s.value.length>1?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[i.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:C[0]||(C[0]=_=>d.value=!d.value)},[i.createElementVNode("span",null,i.toDisplayString(h(a.value)),1),(i.openBlock(),i.createElementBlock("svg",{class:i.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},C[2]||(C[2]=[i.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(i.openBlock(),i.createElementBlock("div",jM,[i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,_=>(i.openBlock(),i.createElementBlock("li",{key:_,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:w=>f(_)},i.toDisplayString(h(_)),9,UM))),128))])])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createElementVNode("div",WM,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":C[1]||(C[1]=_=>c.value=_),placeholder:l.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,KM),[[i.vModelText,c.value,void 0,{trim:!0}]]),C[3]||(C[3]=i.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),YM=ge(JM,[["__scopeId","data-v-3048520a"]]),XM={class:"bg-white/30 p-1 rounded-md shadow"},ZM={class:"flex gap-2"},QM=["onClick","title"],eT=["src"],tT=i.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(n,{emit:e}){const t=i.ref(Object.keys(n.basemaps)[0]),r=e;function o(s){r("onLayerChange",s),t.value=s}return(s,l)=>(i.openBlock(),i.createElementBlock("div",XM,[i.createElementVNode("div",ZM,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.basemaps,(a,c)=>(i.openBlock(),i.createElementBlock("div",{key:c,class:i.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":t.value===c}]),onClick:d=>o(c),title:a.name||c,role:"button",tabindex:"0"},[i.createElementVNode("img",{src:a.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,eT)],10,QM))),128))])]))}}),nT={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},rT={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},oT={class:"text-sm font-medium"},sT={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},lT={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},iT={class:"flex items-center gap-1"},aT=["disabled"],cT=["disabled"],dT=["disabled"],uT={class:"absolute top-4 right-4 z-[1000]"},fT={class:"flex flex-col gap-[2px]"},pT=["disabled"],hT=["disabled"],mT=["disabled"],gT=["disabled"],yT={class:"flex flex-col gap-2"},bT={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},kT={class:"flex flex-col gap-1"},xT=["checked","disabled","onChange"],wT={class:"text-gray-700 text-xs font-medium"},ET={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},CT={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},vT={class:"shrink-0"},_T={class:"font-bold"},ST={class:"flex items-center"},NT={class:"text-xs mr-2"},MT={key:0,class:"text-xs"},TT={key:1,class:"text-xs"},AT=["disabled"],BT=["disabled"],VT=i.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=i.getCurrentInstance(),r=n,o=e,s=i.computed(()=>{const v={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools||!r.tools.length)return v;const M=new Set(r.tools.map(W=>W.toLowerCase()));return{search:M.has("search"),import:M.has("import"),export:M.has("export"),point:M.has("point"),line:M.has("line"),polygon:M.has("polygon"),rectangle:M.has("rectangle")}}),l=i.computed(()=>!!r.disabled),a=i.ref(!1),c=i.ref(null),d=i.ref(null),u=i.ref(!1),f=i.ref(""),p=i.reactive({}),h=i.ref([]),m=i.computed(()=>h.value.map(v=>p[v]).filter(v=>!!v)),g=i.computed(()=>Array.isArray(r.layers)&&r.layers.some(v=>`${v?.service??""}`.toLowerCase()==="vtile"));let y,b,k;function E(){return navigator.platform.toUpperCase().indexOf("MAC")>=0,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const x=i.ref(null),C=i.ref(null);let _=null;const w=i.ref(null),T=v=>{v.ctrlKey&&v.preventDefault()};function D(v,M){return v?.id?String(v.id):v?.url?`${v.url}-${M}`:`layer-${M}`}function R(v){if(!v)return"";if(/^https?:\/\//i.test(v))return v.replace(/\/+$/,"");const M=v.replace(/^\/+/,"").replace(/\/+$/,"");return M?`/${M}`:""}function A(v){const M=v?.url??"";if(!M||/^https?:\/\//i.test(M))return M;const W=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(M.startsWith("/"))return W?`${W}${M}`:M;const G=R(v?.prefix),Q=R(r.prefix),fe=G||Q,V=M.replace(/^\/+/,""),$=fe?`${fe.replace(/\/$/,"")}/${V}`:`/${V}`;return W?`${W}${$}`:$}function B(v){const M=v?.style??{};return W=>{const G=M.colorAttr,Q=M.colorSet??{},fe=typeof G=="string"?Q?.[W?.[G]]??M.color??"#3388ff":M.color??"#3388ff",V=M.stroke??fe;return{weight:M.width??1,color:V,opacity:M.opacity??1,fill:M.type?M.type!=="polyline":!0,fillColor:fe,fillOpacity:M.opacity??.5}}}function U(v){const M=v?.colorSet||v?.colors;if(v?.colorAttr&&M){const W=Object.entries(M).flat();return["match",["get",v.colorAttr],...W,v.color??"#94a3b8"]}return v?.color??"#3388ff"}function Y(v,M,W){if(!v)return[];const G=[],Q=U(v);return v.icon&&G.push({id:`${M}-icon`,type:"symbol",source:M,"source-layer":W,minzoom:v.iconZoom||0,layout:{"icon-image":v.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),v.pointZoom&&G.push({id:`${M}-point`,type:"circle",source:M,"source-layer":W,maxzoom:v.pointZoom,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Q,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),v.type==="polygon"?G.push({id:`${M}-fill`,type:"fill",source:M,"source-layer":W,minzoom:v.pointZoom||0,paint:{"fill-color":Q,"fill-opacity":v.opacity??.5,"fill-outline-color":v.stroke||Q}}):v.type==="line"?G.push({id:`${M}-line`,type:"line",source:M,"source-layer":W,paint:{"line-color":Q,"line-opacity":v.opacity??1,"line-width":v.width??1.5}}):v.icon||G.push({id:`${M}-circle`,type:"circle",source:M,"source-layer":W,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Q,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),G}function O(v,M){const W=v.id||`source-${Math.random().toString(36).slice(2,8)}`,G=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name||W,Q=Y(v.style||{},W,G||W);return Q.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[W]:{type:"vector",tiles:[M],minzoom:v.minzoom??0,maxzoom:v.maxzoom??19}},layers:Q}:null}function z(v){const M=(v?.service??"").toLowerCase(),W=A(v),G=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name;if(console.info("[vs-input-map] create overlay layer",{id:v.id,service:M,url:W,sourceLayer:G,hasSourceLayer:!!G}),M==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(W,{interactive:!0,vectorTileLayerStyles:{default:B(v)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const Q=O(v,W);return Q?L.maplibreGL({style:Q,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",v.id),null)}return null}return M==="tile"||/^https?:\/\//i.test(W)||W.includes("{z}")?L.tileLayer(W,{opacity:v?.style?.opacity??1}):L.tileLayer(W,{opacity:v?.style?.opacity??1})}function K(){y&&h.value.forEach(v=>{const M=p[v];M&&(M.visible?(M.layer||(M.layer=z(M.config)),M.layer&&!y.hasLayer(M.layer)?(console.info("[vs-input-map] add overlay layer to map",M.id),M.layer.addTo(y)):M.layer||console.warn("[vs-input-map] overlay layer is null",M.id)):M.layer&&y.hasLayer(M.layer)&&(console.info("[vs-input-map] remove overlay layer from map",M.id),y.removeLayer(M.layer)))})}function ee(v){if(l.value)return;const M=p[v];M&&(M.visible=!M.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:v,nextVisible:M.visible,hasLayerInstance:!!M.layer}),M.visible?(M.layer||(M.layer=z(M.config)),M.layer&&!y.hasLayer(M.layer)&&(console.info("[vs-input-map] add overlay layer to map",M.id),M.layer.addTo(y))):M.layer&&y.hasLayer(M.layer)&&y.removeLayer(M.layer)))}function re(){if(!r.handleZoom)return null;let v;const M=G=>{const Q=G.ctrlKey||G.metaKey,fe=G.shiftKey;if(!Q&&!fe){u.value=!0,f.value=E(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},W=G=>{if(G.touches.length===1){u.value=!0,f.value=E(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return C.value&&(C.value.addEventListener("wheel",M,{passive:!1}),C.value.addEventListener("touchstart",W,{passive:!0})),y&&y.on("wheel",G=>{const Q=G.originalEvent.ctrlKey||G.originalEvent.metaKey,fe=G.originalEvent.shiftKey;!Q&&!fe&&(G.originalEvent.preventDefault(),G.originalEvent.stopPropagation())}),()=>{C.value&&(C.value.removeEventListener("wheel",M),C.value.removeEventListener("touchstart",W)),y&&y.off("wheel"),clearTimeout(v)}}const xe=i.ref(null),Ze=i.ref(6),ht=i.ref(0),mt=i.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),Ke=i.ref(null),gt=H();let En;const Cn=i.ref("topo100");function vn(v){return v?v.type==="Polygon"?{type:"MultiPolygon",coordinates:[v.coordinates]}:(v.type,v):null}function xr(){return new Promise((v,M)=>{window.L&&window.L.Draw&&v(0);const W=fe=>{if(Array.from(document.styleSheets).some($=>$?.href?.includes(fe)))return;const V=document.createElement("link");V.rel="stylesheet",V.href=fe,document.head.appendChild(V)},G=fe=>new Promise((V,$)=>{const q=Array.from(document.scripts).find(_e=>_e.src===fe);if(q){q.addEventListener("load",()=>V()),q.addEventListener("error",_e=>$(_e));return}const ae=document.createElement("script");ae.src=fe,ae.async=!0,ae.onload=()=>V(),ae.onerror=_e=>$(_e),document.body.appendChild(ae)});W("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),W("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&W("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let Q=G("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>G("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?Q=Q.then(()=>G("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),G("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):Q=Q.then(()=>G("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),Q.then(()=>v(0)).catch(M)})}function yt(){const v=b.toGeoJSON(),M=[];let W=null;const G=fe=>{if(fe)switch(fe.type){case"Point":W=fe;break;case"Polygon":M.push(fe.coordinates);break;case"MultiPolygon":M.push(...fe.coordinates);break;case"GeometryCollection":(fe.geometries||[]).forEach(G);break}};(v?.features||[]).forEach(fe=>G(fe.geometry));const Q=W||(M.length?{type:"MultiPolygon",coordinates:M}:null);o("update:modelValue",Q?vn(Q):null),ht.value=b.getLayers().length}function Pt(v=30){const M=b.getLayers();if(!M.length)return;const W=L.featureGroup(M).getBounds();W&&W.isValid()&&y.fitBounds(W,{padding:[v,v]})}function cn(){l.value||w.value?.click()}const qe=i.ref("");i.watch(s,v=>{qe.value&&!Object.entries(v).filter(([M,W])=>W).map(([M])=>M).includes(qe.value)&&(k?.disable&&k.disable(),qe.value="")}),i.watch(()=>r.layers,v=>{const M=Array.isArray(v)?v:[],W=[],G=new Set;M.forEach((Q,fe)=>{if(!Q)return;const V=D(Q,fe);W.push(V),G.add(V),console.info("[vs-input-map] overlay register",{id:V,service:Q?.service,url:Q?.url});const $=p[V];$?p[V]={...$,config:{...Q,id:V}}:p[V]={id:V,config:{...Q,id:V},visible:Q?.overlay!==!1,layer:null}}),Object.keys(p).forEach(Q=>{if(G.has(Q))return;const fe=p[Q];fe?.layer&&y?.hasLayer&&y.hasLayer(fe.layer)&&y.removeLayer(fe.layer),delete p[Q]}),h.value=W,K()},{immediate:!0,deep:!0}),i.watch(l,v=>{v&&k&&(k.disable(),qe.value=""),b&&b.eachLayer(M=>{v?M.dragging?.disable?.():M.dragging?.enable&&(M.dragging.enable(),M.dragging.enabled?.())})});function $t(v){return v instanceof L.Circle?"Circle":v instanceof L.Rectangle?"Rectangle":v instanceof L.Polygon&&!(v instanceof L.Rectangle)?"Polygon":v instanceof L.Polyline&&!(v instanceof L.Polygon)?"Polyline":v instanceof L.Marker?"Point":"Feature"}function qt(v){if(v instanceof L.Circle){const M=v.getRadius();return Math.PI*(M*M)/1e6}if(v instanceof L.Polygon||v instanceof L.Rectangle)try{const M=v.getLatLngs(),W=Array.isArray(M[0])?M[0]:M,G=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(W):0;return G?G/1e6:0}catch{return null}return null}function dn(v){return v instanceof L.Circle?v.getLatLng():v.getBounds?v.getBounds().getCenter():v.getLatLng?v.getLatLng():y.getCenter()}async function Xn(v,M){if(x.value="",!r.api?.length)return;const[W,G]=r.api;try{const Q=new URL(W);Q.searchParams.set("lat",String(v)),Q.searchParams.set("lon",String(M));const fe=await fetch(Q.toString());if(!fe.ok)throw new Error("Request failed");const V=await fe.json();G&&V[G]!==void 0?x.value=String(V[G]):x.value=JSON.stringify(V)}catch(Q){console.error("[vs-input-map] reverse geocode failed:",Q),x.value=null}}function S(){const v=b.getLayers();if(!v.length){Ke.value=null,ht.value=0;return}const M=v[v.length-1],W=$t(M),G=dn(M),Q=qt(M);Ke.value={type:W,center:G,areaKm2:Q,layer:M},ht.value=v.length,Xn(G.lat,G.lng)}function N(){if(l.value)return;const v=Ke.value?.layer;v&&(v instanceof L.Circle&&v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getLatLng&&y.setView(v.getLatLng(),Math.max(Ze.value,14)))}function P(){if(l.value)return;const v=Ke.value?.layer;v&&(b.removeLayer(v),yt(),S())}i.onMounted(async()=>{document.addEventListener("wheel",T,{passive:!1}),await xr(),L.drawLocal=xM;const v=r.handleZoom;y=L.map(C.value,{zoomControl:!1,scrollWheelZoom:!v}).setView(mt.value,10),setTimeout(()=>{_=re()},100),L.control.zoom({position:"bottomright"}).addTo(y),Cn.value=Object.keys(gt)[0],En=L.tileLayer(gt[Cn.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,G=>{if(l.value)return;const{layer:Q}=G;b.clearLayers(),b.addLayer(Q),yt(),Pt(),qe.value=""}),y.on(L.Draw.Event.EDITED,()=>{l.value||(yt(),S(),Pt())}),y.on(L.Draw.Event.DELETED,()=>{l.value||(yt(),S(),Pt())});let M=!1;y.on("mousemove",G=>{M||(y.invalidateSize(),M=!0),xe.value=G.latlng}),y.on("zoomend",()=>{Ze.value=y.getZoom()});const W=wM(r.modelValue);if(W){const G=[];L.geoJSON(W).eachLayer(Q=>G.push(Q)),G.length&&b.addLayer(G[0]),yt(),S(),Pt()}K()}),i.onUnmounted(()=>{document.removeEventListener("wheel",T),_&&_(),Object.values(p).forEach(v=>{v?.layer&&(y?.hasLayer?.(v.layer)&&y.removeLayer(v.layer),typeof v.layer.remove=="function"&&v.layer.remove())})});function Z(v){if(!l.value&&y){switch(k&&k.disable(),v){case"marker":k=new L.Draw.Marker(y);break;case"polyline":k=new L.Draw.Polyline(y);break;case"polygon":k=new L.Draw.Polygon(y);break;case"rectangle":k=new L.Draw.Rectangle(y);break;default:k=new L.Draw.Rectangle(y);break}k&&(k.enable(),qe.value=v)}}function Ee(){if(l.value)return;const v=b.toGeoJSON(),M=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),W=URL.createObjectURL(M),G=document.createElement("a");G.href=W,G.download="data.geojson",G.click(),URL.revokeObjectURL(W)}function Be(v){if(l.value)return;const M=v.target,W=M.files?.[0];if(!W)return;const G=new FileReader;G.onload=()=>{if(typeof G.result=="string")try{const Q=JSON.parse(G.result);b.clearLayers(),Q&&L.geoJSON({type:"Feature",geometry:Q}).eachLayer(fe=>{b.addLayer(fe)}),yt(),S(),Pt()}finally{M.value=""}},G.readAsText(W)}function pe(v){y&&(En&&y.removeLayer(En),En=L.tileLayer(gt[v].url,{maxZoom:19,minZoom:6}).addTo(y),Cn.value=v)}function I(v){const M=L.latLng(v[0],v[1]);y.setView(M,13)}i.watch(()=>r.modelValue,v=>{const M=vn(v);if(v&&M!==v){o("update:modelValue",M);return}b.clearLayers(),M&&L.geoJSON({type:"Feature",geometry:M}).eachLayer(W=>{if(b.addLayer(W),l.value){W.dragging?.disable?.();return}W.dragging?.enable?.(),W.dragging?.enabled?.(),W.on("dragend",G=>{const Q=G.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[Q.lng,Q.lat]})})}),ht.value=b.getLayers().length,S(),Pt()});function H(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((v,M)=>Object.assign(v,{key:`b${M}`,preview:v.preview||v.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((v,M)=>({...v,[M.key]:M}),{}):{topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const he=i.ref(!1);return i.watch(he,()=>{setTimeout(()=>{y.invalidateSize()},50)}),i.watch(a,async v=>{if(!v||!d.value){c.value=null;return}await i.nextTick();const M=d.value.getBoundingClientRect();c.value={top:M.bottom+6,left:M.left}}),i.onUnmounted(()=>{a.value=!1,c.value=null}),(v,M)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:he.value}])},[i.createElementVNode("div",{ref_key:"mapContainer",ref:C,class:"w-full h-full"},null,512),i.createVNode(i.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:i.withCtx(()=>[u.value&&r.handleZoom?(i.openBlock(),i.createElementBlock("div",nT,[i.createElementVNode("div",rT,[i.createElementVNode("p",oT,i.toDisplayString(f.value),1)])])):i.createCommentVNode("",!0)]),_:1}),s.value.search||s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",sT,[s.value.search?(i.openBlock(),i.createBlock(YM,{key:0,onGoToCoordinates:I})):i.createCommentVNode("",!0),s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",lT,[i.createElementVNode("div",iT,[s.value.import?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:cn,disabled:l.value}," Import ",8,aT)):i.createCommentVNode("",!0),s.value.export?(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Ee,disabled:l.value||ht.value===0}," Export ",8,cT)):i.createCommentVNode("",!0)]),i.createElementVNode("input",{ref_key:"importRef",ref:w,type:"file",onChange:Be,accept:".json,.geojson",class:"hidden",disabled:l.value},null,40,dT)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("div",uT,[i.createElementVNode("div",fT,[s.value.point?(i.openBlock(),i.createElementBlock("button",{key:0,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="marker"}]),title:"Point",onClick:M[0]||(M[0]=W=>Z("marker")),disabled:l.value},[i.createVNode(_M)],10,pT)):i.createCommentVNode("",!0),s.value.line?(i.openBlock(),i.createElementBlock("button",{key:1,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polyline"}]),title:"Line",onClick:M[1]||(M[1]=W=>Z("polyline")),disabled:l.value},[i.createVNode(TM)],10,hT)):i.createCommentVNode("",!0),s.value.polygon?(i.openBlock(),i.createElementBlock("button",{key:2,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polygon"}]),title:"Polygon",onClick:M[2]||(M[2]=W=>Z("polygon")),disabled:l.value},[i.createVNode(LM)],10,mT)):i.createCommentVNode("",!0),s.value.rectangle?(i.openBlock(),i.createElementBlock("button",{key:3,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="rectangle"}]),title:"Rectangle",onClick:M[3]||(M[3]=W=>Z("rectangle")),disabled:l.value},[i.createVNode(RM)],10,gT)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"vs-btn mt-5",onClick:M[4]||(M[4]=W=>he.value=!he.value),title:"Full Screen"},[i.createVNode(zM,{style:{width:"12px",height:"12px"}})])])]),i.createElementVNode("div",{class:i.normalizeClass(["absolute left-4 z-[1000]",Ke.value?"bottom-8":"bottom-4"])},[i.createElementVNode("div",yT,[i.createVNode(tT,{basemaps:i.unref(gt),onOnLayerChange:pe},null,8,["basemaps"]),m.value.length?(i.openBlock(),i.createElementBlock("div",bT,[M[9]||(M[9]=i.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),i.createElementVNode("div",kT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,W=>(i.openBlock(),i.createElementBlock("label",{key:W.id,class:"flex items-center gap-2 cursor-pointer select-none"},[i.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:W.visible,disabled:l.value,onChange:G=>ee(W.id)},null,40,xT),i.createElementVNode("span",wT,i.toDisplayString(W.config.title||W.config.name||W.id),1)]))),128))])])):i.createCommentVNode("",!0)])],2),i.createElementVNode("div",ET,[Ke.value?(i.openBlock(),i.createElementBlock("div",CT,[i.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:M[5]||(M[5]=W=>a.value=!0),onMouseleave:M[6]||(M[6]=W=>a.value=!1)},[i.createElementVNode("div",vT,[M[10]||(M[10]=i.createTextVNode(" Type: ",-1)),i.createElementVNode("span",_T,i.toDisplayString(Ke.value.type),1)]),x.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"addressEl",ref:d,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+i.toDisplayString(x.value),513)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[a.value&&x.value&&c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:i.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"})},i.toDisplayString(x.value),5)):i.createCommentVNode("",!0)]))],32),i.createElementVNode("div",ST,[i.createElementVNode("div",NT,[M[11]||(M[11]=i.createTextVNode(" Center: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.center.lat.toFixed(5))+", "+i.toDisplayString(Ke.value.center.lng.toFixed(5)),1)]),Ke.value.areaKm2!==null?(i.openBlock(),i.createElementBlock("div",MT,[M[12]||(M[12]=i.createTextVNode(" Area: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.areaKm2.toFixed(1))+" km²",1)])):(i.openBlock(),i.createElementBlock("div",TT,M[13]||(M[13]=[i.createTextVNode("Area: ",-1),i.createElementVNode("b",null,"—",-1)]))),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:M[7]||(M[7]=W=>N()),disabled:l.value},M[14]||(M[14]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-150e767b><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-150e767b></path><path d="M7 10l6 0" data-v-150e767b></path><path d="M10 7l0 6" data-v-150e767b></path><path d="M21 21l-6 -6" data-v-150e767b></path></svg>',1)]),8,AT),i.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:M[8]||(M[8]=W=>P()),disabled:l.value},[i.createVNode(kl,{class:"w-3 h-3"})],8,BT)])])):i.createCommentVNode("",!0)])],2))}}),LT=ge(VT,[["__scopeId","data-v-150e767b"]]),OT=["data-focus"],IT={class:"flex items-center"},DT={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},RT=["onClick","aria-label"],FT={key:0,class:"absolute text-gray-500 truncate pl-2"},PT={class:"flex-1 min-w-[2px]"},$T=["placeholder"],zT={class:"flex items-center shrink-0"},HT=["disabled"],jT=i.defineComponent({__name:"vs-input-tag",props:i.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e;St(t.style);const o=i.ref(null),s=i.ref(null),l=i.ref(null),a=i.ref(!1),c=i.ref(""),d=i.useModel(n,"modelValue"),u=i.computed(()=>t.placeholder||"Add tag…"),f=i.computed(()=>d.value?.length===0&&c.value===""),p=i.computed(()=>!t.disabled&&d.value?.length>0),h=i.computed(()=>t.disabled),m=async()=>{h.value||await i.nextTick(()=>l.value?.focus())},g=_=>{const w=_.trim();w!==""&&(!d.value||!Array.isArray(d.value)?d.value=[w]:t.unique?d.value.includes(w)||(d.value=[...d.value,w]):d.value=[...d.value,w],c.value="")},y=()=>{const _=c.value;_.trim()!==""&&g(_),c.value=""},b=_=>{const w=d.value.slice();w.splice(_,1),r("update:modelValue",w)},k=()=>{r("update:modelValue",[])},E=()=>{h.value||(a.value=!0)},x=()=>{a.value=!1,!h.value&&y()},C=_=>{const{key:w}=_;w==="Enter"?(_.preventDefault(),y()):w==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(_,w)=>(i.openBlock(),i.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:w[1]||(w[1]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",a.value?"border-blue-500 ring-1 ring-blue-500":"",h.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":a.value?"true":"false",onClick:m},[i.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:s},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value,(T,D)=>(i.openBlock(),i.createElementBlock("div",{key:D,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[i.createElementVNode("div",IT,[i.createElementVNode("div",DT,i.toDisplayString(T),1)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:i.withModifiers(R=>b(D),["stop"]),"aria-label":`Remove ${T}`},w[2]||(w[2]=[i.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,RT)]))),128)),f.value?(i.openBlock(),i.createElementBlock("div",FT,i.toDisplayString(u.value),1)):i.createCommentVNode("",!0),i.createElementVNode("div",PT,[h.value?i.createCommentVNode("",!0):i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:l,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":w[0]||(w[0]=T=>c.value=T),onFocus:E,onBlur:x,onKeydown:C,placeholder:d.value&&d.value.length?"":void 0},null,40,$T)),[[i.vModelText,c.value]])])],512),i.createElementVNode("div",zT,[p.value?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:h.value,onClick:i.withModifiers(k,["stop"])},w[3]||(w[3]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,HT)):i.createCommentVNode("",!0)])],10,OT)],2)],512))}}),UT={class:"relative flex gap-1 bg-white w-full"},WT=["disabled","placeholder"],KT=i.defineComponent({__name:"vs-input-slug",props:i.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=i.inject("values"),t=n,r=i.useModel(n,"modelValue");function o(l){const a={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return l.toLowerCase().split("").map(c=>a[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const s=()=>{const l=e?.value?.[t.parent||""]?.toString(),a=o(l);r.value=a.toString()};return(l,a)=>(i.openBlock(),i.createElementBlock("div",UT,[i.withDirectives(i.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,WT),[[i.vModelText,r.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),qT=ge(KT,[["__scopeId","data-v-b0eba370"]]),GT={class:"relative flex gap-1 bg-white w-full"},JT=["disabled","placeholder"],YT=["disabled"],XT={key:0},ZT={key:1},QT=i.defineComponent({__name:"vs-input-codegen",props:i.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref(!1),o=i.computed(()=>e.init!==!1),s=i.computed(()=>!!e.table&&!!e.code),l=()=>{if(!s.value)return"";const d=encodeURIComponent(String(e.table)),u=encodeURIComponent(String(e.code));return`/api/code-gen/${d}/${u}`},a=async()=>{if(!s.value||r.value)return;const d=l();if(d){r.value=!0;try{const u=await(await fetch(d)).text();t.value=u}finally{r.value=!1}}},c=()=>{o.value&&(t.value||a())};return i.onMounted(()=>{c()}),i.watch(()=>[e.table,e.code,e.init],()=>{c()}),(d,u)=>(i.openBlock(),i.createElementBlock("div",GT,[i.withDirectives(i.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=f=>t.value=f),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,JT),[[i.vModelText,t.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:r.value||d.disabled||!s.value,onClick:a},[r.value?(i.openBlock(),i.createElementBlock("span",ZT,"...")):(i.openBlock(),i.createElementBlock("span",XT,"Gen"))],8,YT)]))}}),eA=ge(QT,[["__scopeId","data-v-6ee5237d"]]),tA={class:"w-full"},nA={ref:"sortableContainer",class:"flex flex-col gap-1"},rA=["onDragstart","onDrop"],oA={class:"w-1/3"},sA={class:"w-2/3"},lA=["onClick"],iA={key:0,class:"text-[14px] text-gray-700"},aA={class:"mt-2 w-full flex items-center"},cA=["disabled"],dA=i.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,r=i.inject("values"),o=n,s=e,l=o.addButtonText??"Додати",a=o.ignore??[],c=i.ref([]),d=i.ref(null);(()=>{const g=o.parent&&r?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([y])=>!a.includes(y)).map(([y,b])=>({id:t("key-value-"),key:y,value:b}))})();function u(g){d.value=g}function f(g){if(d.value===null||d.value===g)return;const y=c.value.splice(d.value,1)[0];c.value.splice(g,0,y),d.value=null}const p=i.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),h=()=>{c.value.push({id:t("key-value-"),key:"",value:""})},m=g=>{c.value=c.value.filter(y=>y.id!==g)};return i.watch(c,g=>{const y={};g.forEach(k=>{k.key&&k.value!==void 0&&(y[k.key]=k.value)});const b={};a.length&&a.forEach(k=>{b[k]=o.parent?r?.value?.[o.parent]?.[k]:void 0}),r?.value&&o.parent&&(r.value[o.parent]={...b,...y}),s("update:modelValue",y)},{deep:!0}),(g,y)=>(i.openBlock(),i.createElementBlock("div",tA,[i.createElementVNode("div",nA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(b,k)=>(i.openBlock(),i.createElementBlock("div",{key:b.id,class:i.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:E=>u(k),onDragover:y[0]||(y[0]=i.withModifiers(()=>{},["prevent"])),onDrop:E=>f(k)},[y[1]||(y[1]=i.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),i.createElementVNode("div",oA,[i.createVNode(bl,{modelValue:b.key,"onUpdate:modelValue":E=>b.key=E,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("div",sA,[i.createVNode(bl,{modelValue:b.value,"onUpdate:modelValue":E=>b.value=E,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("button",{onClick:E=>m(b.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[i.createVNode(i.unref(Tv),{height:"16",width:"16"})],8,lA)],42,rA))),128))],512),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",iA," Дані для відображення відсутні ")),i.createElementVNode("div",aA,[i.createElementVNode("button",{type:"button",onClick:h,disabled:p.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[i.createVNode(To,{height:"14",width:"14"}),i.createTextVNode(" "+i.toDisplayString(i.unref(l)),1)],8,cA)])]))}}),uA=ge(dA,[["__scopeId","data-v-a0f7fbfc"]]),fA={class:"flex items-center gap-2 w-full"},pA=["disabled"],hA=["disabled"],mA=i.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=St(t.style),o=e,s=i.computed({get:()=>t.modelValue||"#000000",set:a=>o("update:modelValue",a)}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",fA,[i.withDirectives(i.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:l.value,ref:"color",class:i.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,pA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,hA),[[i.vModelText,s.value]])]))}}),gA={class:"flex items-center gap-2 w-full"},yA=["min","max","step","disabled"],bA=["disabled"],kA=i.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=St(t.style),o=e,s=i.computed({get:()=>Number(t.modelValue??t.min),set:a=>o("update:modelValue",Number(a))}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",gA,[i.withDirectives(i.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),min:a.min,max:a.max,step:a.step,disabled:l.value,ref:"range",class:i.normalizeClass(["w-full cursor-pointer accent-blue-500",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")])},null,10,yA),[[i.vModelText,s.value]]),i.withDirectives(i.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>s.value=d),disabled:l.value},null,8,bA),[[i.vModelText,s.value]])]))}}),xA=["type","value","onInput","placeholder","disabled"],wA=i.defineComponent({__name:"vs-input-array",props:i.mergeModels({count:{default:1},limit:{default:n=>n.count??1},inputType:{default:"text"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=St(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");i.watchEffect(()=>{const a=r.value?.length??0;a<e.count&&(r.value=[...r.value??[],...Array(e.count-a)])});function l(a,c){if(o.value)return;const d=a.target.value,u=[...r.value];u[c]=e.inputType==="text"?d:Number(d),r.value=u}return(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["grid gap-2",`grid-cols-${a.limit}`])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.count,d=>(i.openBlock(),i.createElementBlock("input",{type:a.inputType,value:r.value?.[d-1]??"",onInput:u=>l(u,d-1),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,xA))),256))],2))}}),EA={class:"flex items-center gap-2 w-full"},CA={class:"relative flex-1"},vA=["placeholder","disabled","onKeydown"],_A=["disabled"],SA={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},NA={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},MA={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},TA={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},AA={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},BA=["onClick"],VA={key:0,class:"p-4 text-sm text-gray-500"},LA=i.defineComponent({__name:"vs-input-address",props:i.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e,{inputClass:o}=St(t.style),s=i.useModel(n,"modelValue"),l=i.computed({get:()=>s.value,set:b=>{s.value=b}}),a=i.ref(!1),c=i.ref([]),d=i.ref(!1),u=i.computed(()=>t.placeholder??""),f=i.computed(()=>!!t.disabled),p=i.inject("values");function h(){!f.value&&l.value.trim()&&m()}async function m(){const b=(l.value||"").trim();if(!b)return;let k=b;if(t.includes?.length&&p?.value){const x=t.includes.map(C=>p.value?.[C]).filter(Boolean);x.length&&(k=`${x.join(", ")}, ${b}`)}const E=t.api.replace("{{value}}",encodeURIComponent(k));a.value=!0;try{const x=await(await fetch(E)).json();c.value=Array.isArray(x)?x:[],d.value=!0}catch(x){console.error("Address search error:",x)}finally{a.value=!1}}function g(){d.value=!d.value}function y(b){if(!b)return;d.value=!1;const k=parseFloat(b.lat),E={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&p?.value&&(p.value[t.geom]=E),r("update:geom",E)}return(b,k)=>(i.openBlock(),i.createElementBlock("div",EA,[i.createElementVNode("div",CA,[i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":k[0]||(k[0]=E=>l.value=E),placeholder:u.value,disabled:f.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[i.unref(o),{"!border-red-600":t.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:i.withKeys(i.withModifiers(h,["prevent"]),["enter"])},null,42,vA),[[i.vModelText,l.value]]),c.value.length?(i.openBlock(),i.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:g,title:"Show search results"},k[2]||(k[2]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M12 16v-4"}),i.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):i.createCommentVNode("",!0)]),i.createElementVNode("button",{type:"button",onClick:m,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:a.value||!l.value?.trim()},[a.value?(i.openBlock(),i.createElementBlock("svg",NA,k[4]||(k[4]=[i.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),i.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",SA,k[3]||(k[3]=[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),i.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,_A),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[d.value?(i.openBlock(),i.createElementBlock("div",MA,[i.createElementVNode("div",TA,[i.createElementVNode("div",AA,[k[6]||(k[6]=i.createElementVNode("span",null,"Search results",-1)),i.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:k[1]||(k[1]=E=>d.value=!1),title:"Close"},k[5]||(k[5]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(E,x)=>(i.openBlock(),i.createElementBlock("li",{key:x,onClick:C=>y(E),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},i.toDisplayString(E.display_name),9,BA))),128))]),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",VA," No results found "))])])):i.createCommentVNode("",!0)]))]))}}),OA={VsInputText:bl,VsInputRadio:Zp,"vs-input-text":bl,"vs-input-password":rv,"vs-input-textarea":fN,"vs-input-mask":$v,"vs-input-number":lv,"vs-input-radio":Zp,"vs-input-select":sh,"vs-input-switcher":Yp,"vs-input-static":Xp,"vs-input-container":WS,"vs-input-date":r_,"vs-input-checkbox":t_,"vs-input-file":U_,"vs-input-html":Xp,"vs-input-email":jv,"vs-input-datatable":kM,"vs-input-map":LT,"vs-input-file-list":xS,"vs-input-tags":jT,"vs-input-slug":qT,"vs-input-codegen":eA,"vs-input-key-value":uA,"vs-input-range":kA,"vs-input-color":mA,"vs-input-native-select":sh,"vs-input-array":wA,"vs-input-address":LA},IA=i.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=i.inject("values");async function r(){try{if(!e.api)return;const o=e.api.replace("{{value}}",e.value),s=await fetch(o);if(!s.ok){Ie({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const l=await s.json();if(!e.set||!t)return;for(const[a,c]of Object.entries(e.set))t.value[a]=l.result[c]}catch(o){console.error(e.error,o)}}return(o,s)=>(i.openBlock(),i.createElementBlock("button",{onClick:r,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},i.toDisplayString(o.button),1))}}),DA={class:"flex flex-col gap-1 w-full"},RA={key:0,class:"text-sm text-gray-500"},ih=i.defineComponent({__name:"vs-compact-form-layout",props:i.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.computed(()=>tv[`${e.layout}`]),o=i.computed(()=>OA?.[`vs-input-${e.item.type}`]),s=i.computed(()=>{const a=i.unref(o);if(!a)return new Set;const c=a.props??a.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),l=i.computed(()=>{const a=e.item??{},c=s.value;return c.size?Object.fromEntries(Object.entries(a).filter(([d])=>c.has(d))):{}});return(a,c)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),{ua:e.item.ua,error:e.error||"",item:a.item,columns:e.columns,label:e.item.label},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["flex w-full",`${e.item.type}-component`])},[i.createElementVNode("div",DA,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(o.value),i.mergeProps(l.value,{modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=d=>t.value=d)}),null,16,["modelValue"])),a.item.description&&e.layout!=="settings"?(i.openBlock(),i.createElementBlock("p",RA,i.toDisplayString(a.item.description),1)):i.createCommentVNode("",!0)]),a.item.behavior?.api&&a.item.behavior?.button?(i.openBlock(),i.createBlock(IA,i.mergeProps({key:0},a.item.behavior,{value:t.value}),null,16,["value"])):i.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),FA={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},PA={class:"vs-compact-form-navigation__rail mt-[6px]"},$A=["onClick"],zA=i.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(n,{expose:e}){const t=n,r=i.ref([]),o=i.ref(""),s=i.ref(""),l=i.computed(()=>!!t.enabled),a=i.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=i.computed(()=>{const A=t.width;if(A==null)return{};const B=typeof A=="number"?`${A}px`:`${A}`;return{width:B,minWidth:B}});let d=null,u=0,f=0,p=null,h=null,m=null;const g=()=>D(),y=()=>k();i.watch(()=>t.target,async A=>{if(_(),!A){p=null,r.value=[],o.value="";return}p=A,l.value&&(await i.nextTick(),C(A),k())},{immediate:!0}),i.watch(()=>t.scrollContainer,A=>{if(!l.value){h=A??null;return}b(A??null),i.nextTick(()=>k())},{immediate:!0}),i.onMounted(()=>{t.scrollContainer||b(null),k()}),i.onBeforeUnmount(()=>{_(),b(null,!0),p=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),f&&window.cancelAnimationFrame(f))});function b(A,B=!1){if(m&&(m(),m=null),B){h=null;return}if(h=A??null,typeof window>"u")return;const U=A??window,Y=window;U.addEventListener("scroll",g,{passive:!0}),Y.addEventListener("resize",y),m=()=>{U.removeEventListener("scroll",g),Y.removeEventListener("resize",y)}}function k(){if(!l.value||!p)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const A=()=>{E(),u=0};typeof window>"u"?A():u=window.requestAnimationFrame(A)}function E(){if(!l.value||!p)return;const A=Array.from(p.querySelectorAll("h1, h2")),B=new Set,U=[];A.forEach((Y,O)=>{const z=Y.textContent?.trim()??"";if(!z)return;let K=(Y.getAttribute("id")??"").trim();K||(K=x(z)||`heading-${O+1}`);let ee=K,re=1;for(;B.has(ee);)ee=`${K}-${re+=1}`;Y.id!==ee&&Object.assign(Y,{id:ee}),B.add(ee),U.push({id:ee,text:z,level:Y.tagName.toLowerCase()==="h1"?1:2})}),r.value=U,U.length||(o.value=""),T()}function x(A){return A.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function C(A){!A||!l.value||typeof MutationObserver>"u"||(_(),d=new MutationObserver(()=>k()),d.observe(A,{childList:!0,subtree:!0}))}function _(){d&&(d.disconnect(),d=null)}function w(A){const B=h;if(!B)return typeof window>"u"?A.offsetTop:A.getBoundingClientRect().top+window.scrollY;const U=A.getBoundingClientRect(),Y=B.getBoundingClientRect();return U.top-Y.top+B.scrollTop}function T(){if(!l.value||!r.value.length)return;const A=h,B=(A?A.scrollTop:null)||(typeof window<"u"?window.scrollY:0),U=(A?A.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Y=B+U;let O=null;for(let K=0;K<r.value.length;K+=1){const ee=r.value[K],re=document.getElementById(ee.id);if(re){const xe=w(re);xe+re.offsetHeight>B&&xe<Y&&(O=ee.id)}}!O&&s.value&&(O=s.value),O&&(s.value=O);const z=A?A.scrollHeight-A.clientHeight:document.documentElement.scrollHeight-window.innerHeight;B+5>=z&&(O=r.value[r.value.length-1].id),O&&(o.value=O)}function D(){l.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{T(),f=0}))}function R(A){if(!l.value)return;const B=document.getElementById(A);if(!B)return;const U=h,Y=Math.max(0,w(B));U?U.scrollTo({top:Y,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Y,behavior:"smooth"})}return e({refresh:k}),(A,B)=>l.value&&r.value.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(a.value),style:i.normalizeStyle(c.value)},[i.createElementVNode("h2",FA,i.toDisplayString(A.title),1),i.createElementVNode("div",PA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,U=>(i.openBlock(),i.createElementBlock("div",{key:U.id,class:i.normalizeClass(["vs-compact-form-navigation__item relative",U.level===2?"vs-compact-form-navigation__item--nested":"",U.id===o.value?"vs-compact-form-navigation__item--active":""])},[i.createElementVNode("button",{type:"button",onClick:Y=>R(U.id),class:i.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",U.level===2?"pl-[15px]":"pl-[18px]",U.id===o.value?"text-gray-800":"text-gray-500"])},[i.createElementVNode("span",null,i.toDisplayString(U.text),1)],10,$A)],2))),128))])],6)):i.createCommentVNode("",!0)}}),HA=ge(zA,[["__scopeId","data-v-1584a562"]]),ah={required:"Це поле є обов’язковим",email:"Неправильний email"},jA=n=>n?!1:ah.required,UA=n=>n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?!1:ah.email:!1,WA=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},KA=(n,e)=>!1,qA=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return jA(n);case"email":return UA(n);case"regexp":return WA(n,e);case"custom":return KA();default:return!1}},GA={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function ch(n){const e=n.toLowerCase();return GA[e]||e}function Ra(n,e=!1){if(Array.isArray(n)){const r=[];return n.forEach(o=>{const s={...o};s.name=(o.name||o.id||o.key||"").toString(),s.type=ch(o.type),s.label=o.label||o.ua,s.rules=o.rules||o.validators,s.type==="email"&&!s.rules&&(s.rules=["email"]),o.data&&(s.api=`/api/suggest/${o.data}`),s.disabled=e||s.disabled,Array.isArray(s.schema)&&(s.schema=Ra(s.schema,s.disabled)),r.push(s)}),r}const t=[];return Object.entries(n).forEach(r=>{const o={name:r[0],...r[1],type:ch(r[1].type),label:r[1].label||r[1].ua,rules:r[1].rules||r[1].validators,disabled:e};o.type==="email"&&!o.rules&&(o.rules=["email"]),r[1].type.includes("list")&&(o.multiple=!0),!o.api&&r[1].data&&(o.api=`/api/suggest/${r[1].data}`),Array.isArray(o.schema)&&(o.schema=Ra(o.schema,o.disabled)),t.push(o)}),t}function JA(n,e,t=!1){const r=i.computed(()=>Ra(e,typeof t=="boolean"?t:t.value)),o=i.ref({});function s(c){const d=c?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,f=n?.value?.[u];return oh(f,d)}const l=(c=r.value,d=!0)=>(c.forEach(u=>{if(u.rules){if(!s(u)){delete o.value[u.name];return}let f=!1,p=null;u.rules.forEach(h=>{const m=qA(n.value[u.name],h);m&&(f=!0,!p&&typeof m=="string"&&(p=m))}),f&&p?o.value[u.name]=p:delete o.value[u.name]}u.schema&&l(u.schema,!1)}),d&&Object.values(o.value).some(Boolean)?o.value:null),a=i.computed(()=>r.value?.filter(c=>c.hidden!==!0&&s(c)));return{errors:o,validate:l,reset:()=>{n.value={},o.value={}},visibleSchema:a}}const YA={class:"flex w-full h-full min-h-0 gap-6"},XA={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Rr=i.defineComponent({__name:"vs-compact-form",props:i.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:i.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(n,{expose:e,emit:t}){const r=t,o=n,s=i.useModel(n,"form"),l=i.useModel(n,"values"),{errors:a,validate:c,reset:d,visibleSchema:u}=JA(l,o.schema,i.toRef(o,"disabled")),f=i.ref(null),p=i.ref(null),h=i.computed(()=>o.navigation),m=i.computed(()=>o.navWidth),g=i.computed(()=>o.style?.columns),y=Object.freeze({container:12,label:3}),b=i.computed(()=>o.columns??g.value??y),k=i.computed(()=>o.columns!=null||g.value!=null),E=i.computed(()=>k.value?"horizontal":o.layout),x=T=>T?.columns?"horizontal":E.value,C=T=>T?.columns??b.value,_=()=>{r("update:modelValue",l.value),c(),r("handle-submit",l.value)};e({validate:c,reset:d,errors:a}),i.onMounted(()=>{o.modelValue&&(l.value=o.modelValue),s.value={value:l.value,errors:a.value,reset:d,validate:c,formId:o.formId}});function w(T,D){if(T===D)return!0;if(typeof T!="object"||typeof D!="object"||!T||!D)return!1;const R=Object.keys(T),A=Object.keys(D);return R.length!==A.length?!1:R.every(B=>T[B]===D[B])}return i.provide("form",s),i.provide("values",l),(T,D)=>(i.openBlock(),i.createElementBlock("div",YA,[i.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:p},[i.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:i.withModifiers(_,["prevent"]),class:i.normalizeClass(["grid grid-cols-12 p-1",E.value==="default"?"gap-6":"gap-4"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(u),(R,A)=>(i.openBlock(),i.createElementBlock("div",{key:R.name,class:i.normalizeClass(x(R)==="horizontal"?"col-span-12":`col-span-${R.col||12}`)},[i.createVNode(ih,{style:i.normalizeStyle(T.style),item:R,layout:x(R),columns:C(R),"model-value":l.value[R.name],"onUpdate:modelValue":B=>{const U=l.value[R.name];w(U,B)||(l.value[R.name]=B)},error:i.unref(a)[R.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),x(R)==="settings"&&A+1!==i.unref(u).length?(i.openBlock(),i.createElementBlock("div",XA)):i.createCommentVNode("",!0)],2))),128))],34)],512),i.createVNode(HA,{target:f.value,"scroll-container":p.value,enabled:h.value,width:m.value},null,8,["target","scroll-container","enabled","width"])]))}}),ZA={class:"relative"},QA={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},eB={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},tB={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},nB={class:"font-medium text-gray-800 dark:text-[#ffffff]"},rB={class:"p-4 mim-h-0 h-full overflow-auto"},oB=i.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,r=e,o=i.ref(t.schema),s=i.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),l=i.ref({}),a=i.ref(),c=i.ref(t.mode);async function d(){const f=l.value.validate();if(f){Ie({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([p,h])=>`${p}: ${h}`).join(`
120
+ `)});return}if(a.value)try{const p=await fetch(`/api/table/${a.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(p.ok)await p.json(),Ie({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Ie({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Ie({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Ie({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Ie({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function u(){r("close")}return i.onMounted(async()=>{try{if(t.form){const f=await fetch(`/api/template/form/${t.form}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,a.value=p.token}else if(t.token){a.value=t.token;const f=await fetch(`/api/form/${a.value}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,p.data?s.value=p.data:c.value="add"}}catch(f){Ie({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",ZA,[i.createElementVNode("div",QA,[i.createElementVNode("div",eB,[i.createElementVNode("div",tB,[i.createElementVNode("h3",nB,i.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),i.createElementVNode("button",{onClick:u,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},p[2]||(p[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),i.createElementVNode("div",rB,[o.value?(i.openBlock(),i.createBlock(Rr,{key:0,schema:o.value,values:s.value,"onUpdate:values":p[0]||(p[0]=h=>s.value=h),form:l.value,"onUpdate:form":p[1]||(p[1]=h=>l.value=h)},null,8,["schema","values","form"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[i.createElementVNode("button",{type:"button",onClick:u,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),i.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),dh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=OC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:oB,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Rr.install=function(n){n.component("VForm",Rr),Object.assign(n.config.globalProperties,{$form:dh}),n.provide("form",dh),window.v3plugin||(window.v3plugin={})};const sB={class:"relative"},lB={key:0,class:"mt-4"},iB=["src","alt","title"],aB={key:0,class:"text-sm text-red-500"},cB={key:1,class:"mt-4"},dB={class:"text-sm text-gray-600 mb-2"},uB={class:"flex flex-wrap gap-2"},fB=["src","alt","onError"],pB=["onClick"],hB={class:"flex justify-end gap-x-2 p-[20px]"},mB=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=i.ref(!1),r=i.ref(!1),o=i.ref({}),s=i.ref(!1),l=i.ref([]),a=i.ref(null),c=i.ref({src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),d=i.computed(()=>Array.isArray(c.value.file)&&c.value.file.length>1),u=i.computed(()=>Array.isArray(c.value.file)&&c.value.file.length===1),f=i.computed(()=>{if(d.value)return"";if(c.value.src)return c.value.src;if(u.value){const _=c.value.file[0];if(_ instanceof File){const w=l.value.find(T=>T.file===_);return w?w.preview:""}else if(typeof _=="string")return _}return""}),p=i.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл (можна вибрати кілька)",type:"file",multiple:!0,required:!1,placeholder:"Шлях до файлу зображення",accept:"image/*"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення"},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення"},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"},{name:"link",label:"Посилання",type:"text",required:!1,placeholder:"https://example.com"},{name:"openInNewTab",label:"Відкривати у новій вкладці?",type:"switcher",required:!1}]),h=()=>{if(!e.editor)return;if(e.editor.isActive("image")){const{state:w}=e.editor,{selection:T}=w,{$from:D}=T;let R=null,A=null;if(D.parent.type.name==="image")R=D.before(D.depth),A=D.parent;else for(let ee=D.depth;ee>0;ee--){const re=D.node(ee),xe=D.before(ee);re.type.name==="paragraph"&&re.forEach((Ze,ht)=>{if(Ze.type.name==="image"){const mt=xe+ht+1;(R===null||Math.abs(mt-T.$from.pos)<Math.abs(R-T.$from.pos))&&(R=mt,A=Ze)}})}if(R!==null&&A){try{e.editor.chain().focus().setNodeSelection(R).run()}catch{e.editor.chain().focus().setTextSelection(R).run()}a.value=R}else{e.editor.chain().focus().selectParentNode().run();const{state:ee}=e.editor;a.value=ee.selection.$from.pos}const B=A?A.attrs:e.editor.getAttributes("image");s.value=!0;let U="",Y=!1;const O=e.editor.getAttributes("link");O&&O.href&&(U=O.href,Y=O.target==="_blank");const z=B.src||"",K=z?[z]:[];c.value={src:z,file:K,alt:B.alt||"",title:B.title||"",width:B.width||"",height:B.height||"",link:U,openInNewTab:Y}}else s.value=!1,c.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};r.value=!1,t.value=!0},m=()=>{t.value=!1,r.value=!1,s.value=!1,l.value=[],a.value=null,c.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},g=async _=>{if(!(!_||_.length===0)){for(const w of _)if(w&&w.type&&w.type.startsWith("image/")&&!l.value.some(D=>D.file===w)){const D=new FileReader;D.onload=R=>{l.value.push({file:w,preview:R.target.result,error:!1})},D.readAsDataURL(w)}}},y=_=>{l.value.splice(_,1),Array.isArray(c.value.file)&&c.value.file.splice(_,1)},b=async()=>{const _=Array.isArray(c.value.file)?c.value.file.filter(R=>R instanceof File):[],w=_.length;if(s.value&&w<=1||w>0&&await g(_),!s.value&&(w>1||l.value.length>1)&&l.value.length>0){await E();return}let T=c.value.src;if(u.value){const R=c.value.file[0];if(R instanceof File)try{const A=new FileReader,B=await new Promise((U,Y)=>{A.onload=O=>U(O.target.result),A.onerror=Y,A.readAsDataURL(R)});T=B,s.value&&(c.value.src=B)}catch(A){console.error("Помилка при читанні файлу:",A),Ie({type:"error",title:"Помилка",message:"Не вдалося прочитати файл"});return}else typeof R=="string"&&(T=R,s.value&&R!==c.value.src&&(c.value.src=R,T=R))}const D=T||Array.isArray(c.value.file)&&c.value.file.length>0||c.value.file instanceof FileList&&c.value.file.length>0;if(!T&&!D){Ie({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}if(!d.value&&!D&&await o.value.validate()){Ie({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(e.editor&&T)if(s.value&&a.value!==null){const{state:R}=e.editor;try{e.editor.chain().focus().setNodeSelection(a.value).run()}catch{e.editor.chain().focus().setTextSelection(a.value).run()}const A=e.editor.getAttributes("link"),B=A&&A.href;if(e.editor.chain().focus().updateAttributes("image",{src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run(),c.value.link&&c.value.link.trim()!==""){let U=c.value.link.trim();U.match(/^https?:\/\//i)||(U="https://"+U),B?e.editor.chain().focus().extendMarkRange("link").setLink({href:U,target:c.value.openInNewTab?"_blank":null}).run():e.editor.chain().focus().selectParentNode().setLink({href:U,target:c.value.openInNewTab?"_blank":null}).run()}else B&&e.editor.chain().focus().extendMarkRange("link").unsetLink().run()}else{const{state:R}=e.editor,{selection:A}=R,{$anchor:B}=A;let U=null;for(let O=B.depth;O>0;O--){const z=B.node(O);if(z&&z.type.name==="paragraph"){U=z;break}}if(U&&U.content.content.some(O=>O.type.name==="image")){const O=k(U,B.before(B.depth));if(O!==null){const z=R.schema.nodes.image.create({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""});if(c.value.link&&c.value.link.trim()!==""){let K=c.value.link.trim();K.match(/^https?:\/\//i)||(K="https://"+K);const ee=R.schema.marks.link.create({href:K,target:c.value.openInNewTab?"_blank":null}),re=z.type.create(z.attrs,z.content,[ee]);e.editor.chain().focus().insertContentAt(O+1,re).run()}else e.editor.chain().focus().insertContentAt(O+1,z).run()}else c.value.link&&c.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run(),setTimeout(()=>{let z=c.value.link.trim();z.match(/^https?:\/\//i)||(z="https://"+z),e.editor.chain().focus().selectParentNode().setLink({href:z,target:c.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run()}else c.value.link&&c.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run(),setTimeout(()=>{let O=c.value.link.trim();O.match(/^https?:\/\//i)||(O="https://"+O),e.editor.chain().focus().selectParentNode().setLink({href:O,target:c.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:T,alt:c.value.alt||"",title:c.value.title||"",width:c.value.width||"",height:c.value.height||""}).run()}m()},k=(_,w)=>{let T=null;return _.forEach((D,R)=>{D.type.name==="image"&&(T=w+R+1)}),T},E=async()=>{if(e.editor&&(l.value.length===0&&d.value&&await g(c.value.file),l.value.length!==0))try{const _=[];for(const w of l.value){const T=w.preview,D=e.editor.schema.nodes.image.create({src:T,alt:"",width:"",height:""});_.push(D)}_.length>0&&e.editor.chain().focus().command(({tr:w,dispatch:T})=>{if(T){const{selection:D}=w,{$anchor:R}=D;let A=D.$anchor.pos,B=null,U=null;for(let O=R.depth;O>0;O--){const z=R.node(O);if(z&&z.type.name==="paragraph"){B=z,U=R.start(O);break}}if(B){let O=null;B.forEach((z,K)=>{z.type.name==="image"&&(O=U+K+1)}),O!==null?A=O+1:A=U+B.content.size}let Y=A;return _.forEach(O=>{w.insert(Y,O),Y+=O.nodeSize}),!0}return!1}).run(),m()}catch(_){console.error("Помилка при додаванні зображень:",_),Ie({type:"error",title:"Помилка",message:"Не вдалося додати зображення"})}},x=async()=>{await b()},C=()=>{m()};return i.watch(()=>c.value.file,async(_,w)=>{if(r.value=!1,!(s.value&&Array.isArray(_)&&_.length===1&&typeof _[0]=="string"&&!_.some(D=>D instanceof File)))if(Array.isArray(_)&&_.length>0){const T=_.filter(R=>R instanceof File),D=_.filter(R=>typeof R=="string");if(T.length>0){if(s.value?s.value&&T.length===1&&(l.value=[]):l.value=[],(!s.value||T.length>1)&&await g(T),s.value&&T.length===1){const R=new FileReader;R.onload=A=>{c.value.src=A.target.result},R.readAsDataURL(T[0])}}else D.length>0&&!s.value&&(l.value=[])}else _&&typeof _=="object"&&_ instanceof FileList?(s.value||(l.value=[]),await g(Array.from(_))):_&&typeof _=="object"&&!Array.isArray(_)&&_ instanceof File?(s.value||(l.value=[]),await g([_])):s.value||(l.value=[])},{immediate:!1}),i.watch(()=>c.value.src,()=>{r.value=!1}),(_,w)=>(i.openBlock(),i.createElementBlock("div",sB,[i.createElementVNode("button",{onClick:h,class:i.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",n.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Додати зображення"},[...w[4]||(w[4]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Додати зображення</span>',2)])],2),i.createVNode(Kp,{modelValue:t.value,"onUpdate:modelValue":w[3]||(w[3]=T=>t.value=T),title:s.value?"Редагувати зображення":"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",hB,[i.createElementVNode("button",{onClick:C,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Скасувати "),i.createElementVNode("button",{onClick:x,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"},i.toDisplayString(s.value?"Оновити зображення":"Додати зображення"),1)])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=T=>c.value=T),schema:p.value,form:o.value,"onUpdate:form":w[1]||(w[1]=T=>o.value=T)},null,8,["modelValue","schema","form"]),f.value&&!d.value?(i.openBlock(),i.createElementBlock("div",lB,[w[5]||(w[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:f.value,alt:c.value.alt||"Попередній перегляд зображення",title:c.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:w[2]||(w[2]=T=>r.value=!0)},null,40,iB),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",aB," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),l.value.length>0?(i.openBlock(),i.createElementBlock("div",cB,[i.createElementVNode("p",dB,"Попередній перегляд ("+i.toDisplayString(l.value.length)+" зображень):",1),w[6]||(w[6]=i.createElementVNode("p",{class:"text-xs text-gray-500 mb-2"}," Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ",-1)),i.createElementVNode("div",uB,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(T,D)=>(i.openBlock(),i.createElementBlock("div",{key:D,class:"relative"},[i.withDirectives(i.createElementVNode("img",{src:T.preview,alt:`Попередній перегляд ${D+1}`,class:"max-w-[100px] max-h-[100px] rounded border object-contain",onError:R=>T.error=!0},null,40,fB),[[i.vShow,!T.error]]),i.createElementVNode("button",{onClick:R=>y(D),class:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs hover:bg-red-600",type:"button"}," × ",8,pB)]))),128))])])):i.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])]))}}),gB={class:"flex items-center"},yB=["disabled"],bB=["disabled"],kB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor?.can().undo()&&e.editor.chain().focus().undo().run()},r=()=>{e.editor?.can().redo()&&e.editor.chain().focus().redo().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("div",gB,[i.createElementVNode("button",{onClick:t,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[n.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M3 7v6h6"}),i.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,yB),i.createElementVNode("button",{onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[...s[1]||(s[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M21 7v6h-6"}),i.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,bB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),xB={class:"relative"},wB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=i.ref(!1),t=i.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,l)=>(i.openBlock(),i.createElementBlock("div",xB,[i.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:i.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[e.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[...l[1]||(l[1]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[i.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:l[0]||(l[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:"p-6"},[i.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[l[3]||(l[3]=i.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),i.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...l[2]||(l[2]=[i.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),l[4]||(l[4]=i.createStaticVNode('<div class="space-y-6" data-v-72ce3024><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Markdown Syntax</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Example</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>_italic text_</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>###### Heading 6</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>1. First item</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Start with a greater-than sign (&gt;) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>`</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Images</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>![alt text](url)</code> syntax. </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Links</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Action</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Select all text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply bold formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Copy selected text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply italic formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Save the current document</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Paste copied text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Cut selected text</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),EB={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Horizontal Rule",onClick:t,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[...o[0]||(o[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},CB={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Fullscreen",onClick:r,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[...s[0]||(s[0]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])]))}},vB=["title"],_B={class:"vs-editor-html-mode__text"},uh={bold:cE,italic:fE,color:M2,background_color:O2,highlight:I2,bullet_list:eE,ordered_list:rE,blockquote:Xw,codeblock:lE,underline:pE,strike:hE,link:UE,table:JE,text_align:p2,type_tag:g2,font_family:$2,font_size:U2,superscript:q2,subscript:Y2,heading:tC,clear_formatting:oC,image:mB,history:kB,help:wB,horizontal_rule:EB,fullscreen:CB,html_mode:Le({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=i.ref(!1),o=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(s,l)=>(i.openBlock(),i.createElementBlock("button",{onClick:o,class:i.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[l[0]||(l[0]=i.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),i.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),i.createElementVNode("span",_B,i.toDisplayString((r.value,"HTML")),1)],10,vB))}},[["__scopeId","data-v-99a48167"]]),tab:Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=()=>{e.editor&&(e.editor.isActive("bulletList")||e.editor.isActive("orderedList"))&&e.editor.chain().focus().sinkListItem("listItem").run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:t,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[...o[0]||(o[0]=[i.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-indent-increase"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 6l-11 0"></path><path d="M20 12l-7 0"></path><path d="M20 18l-11 0"></path><path d="M4 8l4 4l-4 4"></path></svg>',1)])]))}})},wl={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help","html_mode"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help","html_mode"]},SB=Le({__name:"monaco-editor",props:{modelValue:{type:String,default:""},height:{type:String,default:"280px"},language:{type:String,default:"html"},theme:{type:String,default:"vs"}},emits:["update:modelValue","change"],setup(n,{expose:e,emit:t}){const r=n,o=t,s=i.ref(null);let l=null,a=null,c=!1,d=null;const u=()=>{const A=document.querySelector("link[data-monaco-editor-css]");if(!A)return!1;try{return A.sheet||A.styleSheet||A.href}catch{return!1}},f=()=>u()?new Promise(A=>setTimeout(A,50)):new Promise((A,B)=>{const U=document.createElement("link");U.rel="stylesheet",U.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",U.setAttribute("data-monaco-editor-css","true");const Y=()=>{const ee=()=>{u()?setTimeout(()=>A(),100):setTimeout(ee,50)};ee()};U.addEventListener?(U.addEventListener("load",Y),U.addEventListener("error",()=>B(new Error("Failed to load Monaco Editor CSS")))):(U.onload=Y,U.onerror=()=>B(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(U);let O=0;const z=20,K=setInterval(()=>{O++,u()?(clearInterval(K),setTimeout(()=>A(),100)):O>=z&&(clearInterval(K),setTimeout(()=>A(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((B,U)=>{const Y=document.createElement("script");Y.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",Y.setAttribute("data-monaco-editor-loader","true"),Y.onload=()=>B(),Y.onerror=()=>U(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(Y)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((A,B)=>{if(c){const U=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(U),a=window.monaco,A(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const U=setInterval(()=>{window.require&&(clearInterval(U),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{a=window.monaco,c=!1,A(a)},Y=>{c=!1,console.error("Failed to load Monaco Editor:",Y),B(Y)}))},50);setTimeout(()=>{clearInterval(U),c=!1,B(new Error("Monaco Editor loader not found"))},1e4)}).catch(U=>{c=!1,B(U)})}),d)),m=A=>{try{const B=document.createElement("div");B.innerHTML=A;const U=(O,z=0)=>{const K=" ".repeat(z);let ee="";if(O.nodeType===Node.TEXT_NODE){const re=O.textContent.trim();return re&&(ee+=K+re+`
121
+ `),ee}if(O.nodeType===Node.ELEMENT_NODE){const re=O.tagName.toLowerCase(),xe=Array.from(O.attributes).map(mt=>`${mt.name}="${mt.value}"`).join(" "),Ze=O.children.length>0;O.textContent.trim()&&!Ze?ee+=K+`<${re}${xe?" "+xe:""}>${O.textContent}</${re}>
108
122
  `:Ze?(ee+=K+`<${re}${xe?" "+xe:""}>
109
- `,Array.from(I.childNodes).forEach(mt=>{ee+=W(mt,z+1)}),ee+=K+`</${re}>
123
+ `,Array.from(O.childNodes).forEach(mt=>{ee+=U(mt,z+1)}),ee+=K+`</${re}>
110
124
  `):ee+=K+`<${re}${xe?" "+xe:""} />
111
- `}return ee};let Q="";return Array.from(B.childNodes).forEach(I=>{Q+=W(I)}),Q.trim()}catch(B){return console.warn("HTML formatting error:",B),A}},g=async()=>{if(!s.value)return;if(!a)try{await h();let B=!1,W=0;for(;!B&&W<10;){const Q=document.querySelector("link[data-monaco-editor-css]");if(Q&&(Q.sheet||Q.styleSheet))try{const I=Q.sheet||Q.styleSheet;I&&I.cssRules&&I.cssRules.length>0&&(B=!0)}catch{B=!0}B||(await new Promise(I=>setTimeout(I,50)),W++)}}catch(B){console.error("Failed to load Monaco Editor:",B);return}const A=r.language;if(l=a.editor.create(s.value,{value:r.modelValue,language:A,theme:r.theme,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",lineNumbers:"on",folding:!0,lineDecorationsWidth:0,lineNumbersMinChars:3,renderLineHighlight:"line",selectOnLineNumbers:!0,roundedSelection:!1,readOnly:!1,cursorStyle:"line",cursorBlinking:"blink",cursorSmoothCaretAnimation:!0,cursorWidth:1,fontFamily:"'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace",fontSize:13,lineHeight:1.5,tabSize:2,insertSpaces:!0,detectIndentation:!1,trimAutoWhitespace:!0,formatOnPaste:!0,formatOnType:!0,autoClosingBrackets:"always",autoClosingQuotes:"always",autoSurround:"languageDefined",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},fixedOverflowWidgets:!1,overflowWidgetsDomNode:s.value,suggest:{showKeywords:!0,showSnippets:!0,showClasses:!0,showFunctions:!0,showVariables:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showIssues:!0,showUsers:!0,showWords:!0,showCustomcolors:!0,showInterfaces:!0,showText:!0,showEnums:!0,showStructs:!0,showTypeAliases:!0,showConstants:!0,showConstructors:!0,showFields:!0,showMethods:!0,showNamespaces:!0,showPackages:!0,showSymbols:!0,showTypeParameters:!0},quickSuggestions:{other:!0,comments:!1,strings:!0},html:{format:{enable:!0,tabSize:2,insertSpaces:!0,wrapLineLength:120,unformatted:"default",contentUnformatted:"pre,code,textarea",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:2,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{html5:!0,angular1:!1,ionic:!1},validate:{scripts:!0,styles:!0}},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,verticalSliderSize:4,horizontalSliderSize:4,arrowSize:0,verticalSliderHasArrows:!1,horizontalSliderHasArrows:!1}}),r.language==="html"){a.languages.register({id:"html"}),a.languages.setMonarchTokensProvider("html",{tokenizer:{root:[[/<!--/,"comment","@comment"],[/<[^>]+>/,"tag"],[/\w+\s*=\s*"[^"]*"/,"attribute"],[/\w+\s*=\s*'[^']*'/,"attribute"],[/"[^"]*"/,"string"],[/'[^']*'/,"string"],[/\b(doctype|html|head|body|title|meta|link|script|style|div|span|p|h1|h2|h3|h4|h5|h6|ul|ol|li|table|tr|td|th|form|input|button|img|a|br|hr)\b/i,"keyword"],[/\d+/,"number"],[/\s+/,"white"],[/./,"text"]],comment:[[/-->/,"comment","@pop"],[/./,"comment"]]}});try{a.languages.setLanguageConfiguration("html",{wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<",">"],["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"<",close:">",notIn:["string"]},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string"]}],surroundingPairs:[{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"}]})}catch(B){console.warn("HTML language configuration failed:",B)}}l.onDidChangeModelContent(()=>{const B=l.getValue();o("update:modelValue",B),o("change",B)})},y=A=>{l&&A!==l.getValue()&&l.setValue(A)},b=A=>{if(l&&a)if(r.language==="html"){const B=A==="vs-dark"||A==="hc-black";a.editor.defineTheme("html-custom",{base:B?"vs-dark":"vs",inherit:!0,rules:[{token:"tag",foreground:B?"#4FC1FF":"#0066CC",fontStyle:"bold"},{token:"attribute",foreground:B?"#9CDCFE":"#0000FF"},{token:"string",foreground:B?"#FF6B6B":"#CC0000"},{token:"comment",foreground:B?"#6A9955":"#008000",fontStyle:"italic"},{token:"keyword",foreground:B?"#FFA500":"#FF6600",fontStyle:"bold"},{token:"number",foreground:B?"#B5CEA8":"#098658"},{token:"text",foreground:B?"#D4D4D4":"#000000"},{token:"white",foreground:B?"#D4D4D4":"#000000"}],colors:{"editor.background":B?"#1e1e1e":"#ffffff","editor.foreground":B?"#d4d4d4":"#000000"}}),a.editor.setTheme("html-custom")}else a.editor.setTheme(A)},k=A=>{l&&a&&a.editor.setModelLanguage(l.getModel(),A)},E=()=>{l&&l.focus()},x=()=>l?l.getPosition():null,C=A=>{l&&A&&(l.setPosition(A),l.revealPosition(A))},S=()=>{if(l){const A=l.getSelection();return l.getModel().getValueInRange(A)}return""},w=A=>{if(l){const B=l.getSelection();l.executeEdits("replace-selection",[{range:B,text:A,forceMoveMarkers:!0}])}},T=()=>{if(l){const A=l.getValue(),B=m(A);B!==A&&(l.setValue(B),l.setPosition({lineNumber:1,column:1}))}},D=()=>{if(r.language==="html"&&a)try{a.languages.registerCompletionItemProvider("html",{provideCompletionItems:(A,B)=>({suggestions:[{label:"class",kind:a.languages.CompletionItemKind.Property,insertText:'class="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"CSS class attribute"},{label:"id",kind:a.languages.CompletionItemKind.Property,insertText:'id="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Unique identifier"},{label:"style",kind:a.languages.CompletionItemKind.Property,insertText:'style="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Inline CSS styles"},{label:"data-*",kind:a.languages.CompletionItemKind.Property,insertText:'data-$1="$2"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Custom data attribute"}]})})}catch(A){console.warn("HTML completion provider failed:",A)}},R=()=>{l&&l.layout()};return i.onMounted(async()=>{await i.nextTick();try{await h(),await i.nextTick(),await g(),D(),window.addEventListener("resize",R)}catch(A){console.error("Failed to initialize Monaco Editor:",A)}}),i.onUnmounted(()=>{l&&l.dispose(),window.removeEventListener("resize",R)}),i.watch(()=>r.modelValue,y),i.watch(()=>r.theme,b),i.watch(()=>r.language,k),i.watch(()=>r.height,()=>{i.nextTick(()=>{R()})}),e({editor:l,focus:E,getPosition:x,setPosition:C,getSelectedText:S,replaceSelection:w,formatCode:T}),(A,B)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"monacoContainer",ref:s,class:"monaco-editor-container",style:i.normalizeStyle({height:n.height})},null,4))}},[["__scopeId","data-v-b1d773a1"]]),mB={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},gB={key:1,class:"html-source-editor"},El=Object.assign({inheritAttrs:!1},{__name:"vs-richtext",props:i.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"300px"},toolbar:{type:[Array,String],default:()=>"default"}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n){const e=n,t=i.useModel(n,"modelValue"),{editor:r,editorInstance:o,focusEditor:s}=Rp(e),{isHtmlMode:l,htmlContent:a,htmlTextarea:c,toggleHtmlMode:d,onHtmlInput:u}=Fp(r,(g,y)=>{g==="update:modelValue"&&(t.value=y)}),{isFullscreen:f,toggleFullscreen:p}=Pp(),h=i.computed(()=>typeof e.toolbar=="string"?wl[e.toolbar]||wl.default:e.toolbar),m=i.computed(()=>h.value.map(g=>sh[g]).filter(Boolean));return i.watch(()=>e.modelValue,g=>{if(r.value){const y=g||"",b=r.value.getHTML();y!==b&&y!=="<p></p>"&&r.value.commands.setContent(y,!1)}},{immediate:!0}),i.watch(r,g=>{g&&r.value.on("update",y=>{const b=y.editor.getHTML();b!==e.modelValue&&b!=="<p></p>"&&(t.value=b)})}),(g,y)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["bg-white border border border-solid border-gray-200 rounded-xl w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":i.unref(f)}])},[i.createElementVNode("div",mB,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b},[i.unref(r)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(b),{key:0,editor:i.unref(o),onToggleFullscreen:i.unref(p),onToggleHtmlMode:i.unref(d)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):i.createCommentVNode("",!0)],64))),128))]),i.createElementVNode("div",{onClick:y[2]||(y[2]=(...b)=>i.unref(s)&&i.unref(s)(...b)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800",style:i.normalizeStyle({height:i.unref(f)?"95vh":n.height})},[i.unref(l)?(i.openBlock(),i.createElementBlock("div",gB,[i.createVNode(hB,{ref_key:"htmlTextarea",ref:c,modelValue:i.unref(a),"onUpdate:modelValue":y[0]||(y[0]=b=>i.isRef(a)?a.value=b:null),height:i.unref(f)?"calc(95vh - 100px)":"100%",language:"html",theme:"vs",onChange:y[1]||(y[1]=b=>i.unref(u)(b))},null,8,["modelValue","height"])])):(i.openBlock(),i.createBlock(i.unref(Mf),{key:0,editor:i.unref(r),class:"relative w-full"},null,8,["editor"]))],4)],2))}}),yB={class:"bg-white border-b flex-wrap border-b-gray-200 px-[10px] py-3 border-solid border-transparent"},bB={class:"flex flex-col mx-auto max-w-6xl"},kB={class:"flex justify-center gap-x-2"},lh=Object.assign({inheritAttrs:!1},{__name:"vs-richtext-page",props:i.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"min-h-[800px]"},width:{type:String,default:()=>"max-w-4xl"}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n){const e=n,t=i.useModel(n,"modelValue"),r=["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table"],{editor:o,editorInstance:s,focusEditor:l}=Rp(e),{toggleHtmlMode:a}=Fp(o,(f,p)=>{f==="update:modelValue"&&(t.value=p)}),{toggleFullscreen:c}=Pp(),d=i.computed(()=>typeof r=="string"?wl[r]||wl.default:r),u=i.computed(()=>d.value.map(f=>sh[f]).filter(Boolean));return i.watch(()=>e.modelValue,f=>{if(o.value){const p=f||"",h=o.value.getHTML();p!==h&&p!=="<p></p>"&&o.value.commands.setContent(p,!1)}},{immediate:!0}),i.watch(o,f=>{f&&o.value.on("update",p=>{const h=p.editor.getHTML();h!==e.modelValue&&h!=="<p></p>"&&(t.value=h)})}),(f,p)=>(i.openBlock(),i.createElementBlock("div",i.mergeProps(f.$attrs,{class:["w-full bg-[#f1f5f9] flex flex-col overflow-hidden",n.height]}),[i.createElementVNode("div",yB,[i.createElementVNode("div",bB,[i.renderSlot(f.$slots,"header"),i.createElementVNode("div",kB,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,h=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:h},[i.unref(o)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(h),{key:0,editor:i.unref(s),onToggleFullscreen:i.unref(c),onToggleHtmlMode:i.unref(a)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):i.createCommentVNode("",!0)],64))),128))])])]),i.createElementVNode("div",{onClick:p[0]||(p[0]=(...h)=>i.unref(l)&&i.unref(l)(...h)),class:"relative w-full h-full px-6 py-8 flex justify-center rounded-b-lg editor-page-content dark:bg-gray-800 max-h-[95vh]"},[i.createVNode(i.unref(Mf),{editor:i.unref(o),class:i.normalizeClass(["relative w-full bg-white shadow-lg rounded-lg min-h-[800px] h-[fit-content] p-16",[n.width]])},null,8,["editor","class"])])],16))}});/*!
125
+ `}return ee};let Y="";return Array.from(B.childNodes).forEach(O=>{Y+=U(O)}),Y.trim()}catch(B){return console.warn("HTML formatting error:",B),A}},g=async()=>{if(!s.value)return;if(!a)try{await h();let B=!1,U=0;for(;!B&&U<10;){const Y=document.querySelector("link[data-monaco-editor-css]");if(Y&&(Y.sheet||Y.styleSheet))try{const O=Y.sheet||Y.styleSheet;O&&O.cssRules&&O.cssRules.length>0&&(B=!0)}catch{B=!0}B||(await new Promise(O=>setTimeout(O,50)),U++)}}catch(B){console.error("Failed to load Monaco Editor:",B);return}const A=r.language;if(l=a.editor.create(s.value,{value:r.modelValue,language:A,theme:r.theme,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",lineNumbers:"on",folding:!0,lineDecorationsWidth:0,lineNumbersMinChars:3,renderLineHighlight:"line",selectOnLineNumbers:!0,roundedSelection:!1,readOnly:!1,cursorStyle:"line",cursorBlinking:"blink",cursorSmoothCaretAnimation:!0,cursorWidth:1,fontFamily:"'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace",fontSize:13,lineHeight:1.5,tabSize:2,insertSpaces:!0,detectIndentation:!1,trimAutoWhitespace:!0,formatOnPaste:!0,formatOnType:!0,autoClosingBrackets:"always",autoClosingQuotes:"always",autoSurround:"languageDefined",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},fixedOverflowWidgets:!1,overflowWidgetsDomNode:s.value,suggest:{showKeywords:!0,showSnippets:!0,showClasses:!0,showFunctions:!0,showVariables:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showIssues:!0,showUsers:!0,showWords:!0,showCustomcolors:!0,showInterfaces:!0,showText:!0,showEnums:!0,showStructs:!0,showTypeAliases:!0,showConstants:!0,showConstructors:!0,showFields:!0,showMethods:!0,showNamespaces:!0,showPackages:!0,showSymbols:!0,showTypeParameters:!0},quickSuggestions:{other:!0,comments:!1,strings:!0},html:{format:{enable:!0,tabSize:2,insertSpaces:!0,wrapLineLength:120,unformatted:"default",contentUnformatted:"pre,code,textarea",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:2,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{html5:!0,angular1:!1,ionic:!1},validate:{scripts:!0,styles:!0}},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,verticalSliderSize:4,horizontalSliderSize:4,arrowSize:0,verticalSliderHasArrows:!1,horizontalSliderHasArrows:!1}}),r.language==="html"){a.languages.register({id:"html"}),a.languages.setMonarchTokensProvider("html",{tokenizer:{root:[[/<!--/,"comment","@comment"],[/<[^>]+>/,"tag"],[/\w+\s*=\s*"[^"]*"/,"attribute"],[/\w+\s*=\s*'[^']*'/,"attribute"],[/"[^"]*"/,"string"],[/'[^']*'/,"string"],[/\b(doctype|html|head|body|title|meta|link|script|style|div|span|p|h1|h2|h3|h4|h5|h6|ul|ol|li|table|tr|td|th|form|input|button|img|a|br|hr)\b/i,"keyword"],[/\d+/,"number"],[/\s+/,"white"],[/./,"text"]],comment:[[/-->/,"comment","@pop"],[/./,"comment"]]}});try{a.languages.setLanguageConfiguration("html",{wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<",">"],["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"<",close:">",notIn:["string"]},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string"]}],surroundingPairs:[{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"}]})}catch(B){console.warn("HTML language configuration failed:",B)}}l.onDidChangeModelContent(()=>{const B=l.getValue();o("update:modelValue",B),o("change",B)})},y=A=>{l&&A!==l.getValue()&&l.setValue(A)},b=A=>{if(l&&a)if(r.language==="html"){const B=A==="vs-dark"||A==="hc-black";a.editor.defineTheme("html-custom",{base:B?"vs-dark":"vs",inherit:!0,rules:[{token:"tag",foreground:B?"#4FC1FF":"#0066CC",fontStyle:"bold"},{token:"attribute",foreground:B?"#9CDCFE":"#0000FF"},{token:"string",foreground:B?"#FF6B6B":"#CC0000"},{token:"comment",foreground:B?"#6A9955":"#008000",fontStyle:"italic"},{token:"keyword",foreground:B?"#FFA500":"#FF6600",fontStyle:"bold"},{token:"number",foreground:B?"#B5CEA8":"#098658"},{token:"text",foreground:B?"#D4D4D4":"#000000"},{token:"white",foreground:B?"#D4D4D4":"#000000"}],colors:{"editor.background":B?"#1e1e1e":"#ffffff","editor.foreground":B?"#d4d4d4":"#000000"}}),a.editor.setTheme("html-custom")}else a.editor.setTheme(A)},k=A=>{l&&a&&a.editor.setModelLanguage(l.getModel(),A)},E=()=>{l&&l.focus()},x=()=>l?l.getPosition():null,C=A=>{l&&A&&(l.setPosition(A),l.revealPosition(A))},_=()=>{if(l){const A=l.getSelection();return l.getModel().getValueInRange(A)}return""},w=A=>{if(l){const B=l.getSelection();l.executeEdits("replace-selection",[{range:B,text:A,forceMoveMarkers:!0}])}},T=()=>{if(l){const A=l.getValue(),B=m(A);B!==A&&(l.setValue(B),l.setPosition({lineNumber:1,column:1}))}},D=()=>{if(r.language==="html"&&a)try{a.languages.registerCompletionItemProvider("html",{provideCompletionItems:(A,B)=>({suggestions:[{label:"class",kind:a.languages.CompletionItemKind.Property,insertText:'class="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"CSS class attribute"},{label:"id",kind:a.languages.CompletionItemKind.Property,insertText:'id="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Unique identifier"},{label:"style",kind:a.languages.CompletionItemKind.Property,insertText:'style="$1"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Inline CSS styles"},{label:"data-*",kind:a.languages.CompletionItemKind.Property,insertText:'data-$1="$2"',insertTextRules:a.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Custom data attribute"}]})})}catch(A){console.warn("HTML completion provider failed:",A)}},R=()=>{l&&l.layout()};return i.onMounted(async()=>{await i.nextTick();try{await h(),await i.nextTick(),await g(),D(),window.addEventListener("resize",R)}catch(A){console.error("Failed to initialize Monaco Editor:",A)}}),i.onUnmounted(()=>{l&&l.dispose(),window.removeEventListener("resize",R)}),i.watch(()=>r.modelValue,y),i.watch(()=>r.theme,b),i.watch(()=>r.language,k),i.watch(()=>r.height,()=>{i.nextTick(()=>{R()})}),e({editor:l,focus:E,getPosition:x,setPosition:C,getSelectedText:_,replaceSelection:w,formatCode:T}),(A,B)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"monacoContainer",ref:s,class:"monaco-editor-container",style:i.normalizeStyle({height:n.height})},null,4))}},[["__scopeId","data-v-2ff3aa5c"]]),NB={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},MB={key:1,class:"html-source-editor"},El=Object.assign({inheritAttrs:!1},{__name:"vs-richtext",props:i.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"300px"},toolbar:{type:[Array,String],default:()=>"default"}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n){const e=n,t=i.useModel(n,"modelValue"),{editor:r,editorInstance:o,focusEditor:s}=jp(e),{isHtmlMode:l,htmlContent:a,htmlTextarea:c,toggleHtmlMode:d,onHtmlInput:u}=Up(r,(g,y)=>{g==="update:modelValue"&&(t.value=y)}),{isFullscreen:f,toggleFullscreen:p}=Wp(),h=i.computed(()=>typeof e.toolbar=="string"?wl[e.toolbar]||wl.default:e.toolbar),m=i.computed(()=>h.value.map(g=>uh[g]).filter(Boolean));return i.watch(()=>e.modelValue,g=>{if(r.value){const y=g||"",b=r.value.getHTML();y!==b&&y!=="<p></p>"&&r.value.commands.setContent(y,!1)}},{immediate:!0}),i.watch(r,g=>{g&&r.value.on("update",y=>{const b=y.editor.getHTML();b!==e.modelValue&&b!=="<p></p>"&&(t.value=b)})}),(g,y)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["bg-white border border border-solid border-gray-200 rounded-xl w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":i.unref(f)}])},[i.createElementVNode("div",NB,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b},[i.unref(r)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(b),{key:0,editor:i.unref(o),onToggleFullscreen:i.unref(p),onToggleHtmlMode:i.unref(d)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):i.createCommentVNode("",!0)],64))),128))]),i.createElementVNode("div",{onClick:y[2]||(y[2]=(...b)=>i.unref(s)&&i.unref(s)(...b)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800",style:i.normalizeStyle({height:i.unref(f)?"95vh":n.height})},[i.unref(l)?(i.openBlock(),i.createElementBlock("div",MB,[i.createVNode(SB,{ref_key:"htmlTextarea",ref:c,modelValue:i.unref(a),"onUpdate:modelValue":y[0]||(y[0]=b=>i.isRef(a)?a.value=b:null),height:i.unref(f)?"calc(95vh - 100px)":"100%",language:"html",theme:"vs",onChange:y[1]||(y[1]=b=>i.unref(u)(b))},null,8,["modelValue","height"])])):(i.openBlock(),i.createBlock(i.unref(Af),{key:0,editor:i.unref(r),class:"relative w-full"},null,8,["editor"]))],4)],2))}}),TB={class:"bg-white border-b flex-wrap border-b-gray-200 px-[10px] py-3 border-solid border-transparent"},AB={class:"flex flex-col mx-auto max-w-6xl"},BB={class:"flex justify-center gap-x-2"},fh=Object.assign({inheritAttrs:!1},{__name:"vs-richtext-page",props:i.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"min-h-[800px]"},width:{type:String,default:()=>"max-w-4xl"}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n){const e=n,t=i.useModel(n,"modelValue"),r=["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table"],{editor:o,editorInstance:s,focusEditor:l}=jp(e),{toggleHtmlMode:a}=Up(o,(f,p)=>{f==="update:modelValue"&&(t.value=p)}),{toggleFullscreen:c}=Wp(),d=i.computed(()=>typeof r=="string"?wl[r]||wl.default:r),u=i.computed(()=>d.value.map(f=>uh[f]).filter(Boolean));return i.watch(()=>e.modelValue,f=>{if(o.value){const p=f||"",h=o.value.getHTML();p!==h&&p!=="<p></p>"&&o.value.commands.setContent(p,!1)}},{immediate:!0}),i.watch(o,f=>{f&&o.value.on("update",p=>{const h=p.editor.getHTML();h!==e.modelValue&&h!=="<p></p>"&&(t.value=h)})}),(f,p)=>(i.openBlock(),i.createElementBlock("div",i.mergeProps(f.$attrs,{class:["w-full bg-[#f1f5f9] flex flex-col overflow-hidden",n.height]}),[i.createElementVNode("div",TB,[i.createElementVNode("div",AB,[i.renderSlot(f.$slots,"header"),i.createElementVNode("div",BB,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,h=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:h},[i.unref(o)?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(h),{key:0,editor:i.unref(s),onToggleFullscreen:i.unref(c),onToggleHtmlMode:i.unref(a)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):i.createCommentVNode("",!0)],64))),128))])])]),i.createElementVNode("div",{onClick:p[0]||(p[0]=(...h)=>i.unref(l)&&i.unref(l)(...h)),class:"relative w-full h-full px-6 py-8 flex justify-center rounded-b-lg editor-page-content dark:bg-gray-800 max-h-[95vh]"},[i.createVNode(i.unref(Af),{editor:i.unref(o),class:i.normalizeClass(["relative w-full bg-white shadow-lg rounded-lg min-h-[800px] h-[fit-content] p-16",[n.width]])},null,8,["editor","class"])])],16))}});/*!
112
126
  * shared v11.1.12
113
127
  * (c) 2025 kazuya kawaguchi
114
128
  * Released under the MIT License.
115
- */function tn(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const ih={};function Ia(n){ih[n]||(ih[n]=!0,tn(n))}const Wt=typeof window<"u";let Nt,gr;if(process.env.NODE_ENV!=="production"){const n=Wt&&window.performance;n&&n.mark&&n.measure&&n.clearMarks&&n.clearMeasures&&(Nt=e=>{n.mark(e)},gr=(e,t,r)=>{n.measure(e,t,r),n.clearMarks(t),n.clearMarks(r)})}const xB=/\{([0-9a-zA-Z]+)\}/g;function Cl(n,...e){return e.length===1&&ye(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(xB,(t,r)=>e.hasOwnProperty(r)?e[r]:"")}const nn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),wB=(n,e,t)=>EB({l:n,k:e,s:t}),EB=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),je=n=>typeof n=="number"&&isFinite(n),CB=n=>Da(n)==="[object Date]",Fr=n=>Da(n)==="[object RegExp]",vl=n=>me(n)&&Object.keys(n).length===0,We=Object.assign,vB=Object.create,ve=(n=null)=>vB(n);let ah;const yr=()=>ah||(ah=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:ve());function ch(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\//g,"&#x2F;").replace(/=/g,"&#x3D;")}function dh(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _B(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(r,o,s)=>`${o}="${dh(s)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(r,o,s)=>`${o}='${dh(s)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(process.env.NODE_ENV!=="production"&&tn("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1&#111;n$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(r=>{n=n.replace(r,"$1javascript&#58;")}),n}const SB=Object.prototype.hasOwnProperty;function Kt(n,e){return SB.call(n,e)}const De=Array.isArray,Ne=n=>typeof n=="function",Y=n=>typeof n=="string",be=n=>typeof n=="boolean",ye=n=>n!==null&&typeof n=="object",NB=n=>ye(n)&&Ne(n.then)&&Ne(n.catch),uh=Object.prototype.toString,Da=n=>uh.call(n),me=n=>Da(n)==="[object Object]",MB=n=>n==null?"":De(n)||me(n)&&n.toString===uh?JSON.stringify(n,null,2):String(n);function Ra(n,e=""){return n.reduce((t,r,o)=>o===0?t+r:t+e+r,"")}const fh=2;function TB(n,e=0,t=n.length){const r=n.split(/\r?\n/);let o=0;const s=[];for(let l=0;l<r.length;l++)if(o+=r[l].length+1,o>=e){for(let a=l-fh;a<=l+fh||t>o;a++){if(a<0||a>=r.length)continue;const c=a+1;s.push(`${c}${" ".repeat(3-String(c).length)}| ${r[a]}`);const d=r[a].length;if(a===l){const u=e-(o-d)+1,f=Math.max(1,t>o?d-u:t-e);s.push(" | "+" ".repeat(u)+"^".repeat(f))}else if(a>l){if(t>o){const u=Math.max(Math.min(t-o,d),1);s.push(" | "+"^".repeat(u))}o+=d+1}}break}return s.join(`
116
- `)}function Fa(){const n=new Map;return{events:n,on(t,r){const o=n.get(t);o&&o.push(r)||n.set(t,[r])},off(t,r){const o=n.get(t);o&&o.splice(o.indexOf(r)>>>0,1)},emit(t,r){(n.get(t)||[]).slice().map(o=>o(r)),(n.get("*")||[]).slice().map(o=>o(t,r))}}}const _l=n=>!ye(n)||De(n);function Sl(n,e){if(_l(n)||_l(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:r,des:o}=t.pop();Object.keys(r).forEach(s=>{s!=="__proto__"&&(ye(r[s])&&!ye(o[s])&&(o[s]=Array.isArray(r[s])?[]:ve()),_l(o[s])||_l(r[s])?o[s]=r[s]:t.push({src:r[s],des:o[s]}))})}}/*!
129
+ */function tn(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const ph={};function Fa(n){ph[n]||(ph[n]=!0,tn(n))}const Wt=typeof window<"u";let Nt,gr;if(process.env.NODE_ENV!=="production"){const n=Wt&&window.performance;n&&n.mark&&n.measure&&n.clearMarks&&n.clearMeasures&&(Nt=e=>{n.mark(e)},gr=(e,t,r)=>{n.measure(e,t,r),n.clearMarks(t),n.clearMarks(r)})}const VB=/\{([0-9a-zA-Z]+)\}/g;function Cl(n,...e){return e.length===1&&ye(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(VB,(t,r)=>e.hasOwnProperty(r)?e[r]:"")}const nn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),LB=(n,e,t)=>OB({l:n,k:e,s:t}),OB=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),je=n=>typeof n=="number"&&isFinite(n),IB=n=>Pa(n)==="[object Date]",Fr=n=>Pa(n)==="[object RegExp]",vl=n=>me(n)&&Object.keys(n).length===0,We=Object.assign,DB=Object.create,ve=(n=null)=>DB(n);let hh;const yr=()=>hh||(hh=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:ve());function mh(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\//g,"&#x2F;").replace(/=/g,"&#x3D;")}function gh(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function RB(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(r,o,s)=>`${o}="${gh(s)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(r,o,s)=>`${o}='${gh(s)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(process.env.NODE_ENV!=="production"&&tn("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1&#111;n$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(r=>{n=n.replace(r,"$1javascript&#58;")}),n}const FB=Object.prototype.hasOwnProperty;function Kt(n,e){return FB.call(n,e)}const De=Array.isArray,Ne=n=>typeof n=="function",X=n=>typeof n=="string",be=n=>typeof n=="boolean",ye=n=>n!==null&&typeof n=="object",PB=n=>ye(n)&&Ne(n.then)&&Ne(n.catch),yh=Object.prototype.toString,Pa=n=>yh.call(n),me=n=>Pa(n)==="[object Object]",$B=n=>n==null?"":De(n)||me(n)&&n.toString===yh?JSON.stringify(n,null,2):String(n);function $a(n,e=""){return n.reduce((t,r,o)=>o===0?t+r:t+e+r,"")}const bh=2;function zB(n,e=0,t=n.length){const r=n.split(/\r?\n/);let o=0;const s=[];for(let l=0;l<r.length;l++)if(o+=r[l].length+1,o>=e){for(let a=l-bh;a<=l+bh||t>o;a++){if(a<0||a>=r.length)continue;const c=a+1;s.push(`${c}${" ".repeat(3-String(c).length)}| ${r[a]}`);const d=r[a].length;if(a===l){const u=e-(o-d)+1,f=Math.max(1,t>o?d-u:t-e);s.push(" | "+" ".repeat(u)+"^".repeat(f))}else if(a>l){if(t>o){const u=Math.max(Math.min(t-o,d),1);s.push(" | "+"^".repeat(u))}o+=d+1}}break}return s.join(`
130
+ `)}function za(){const n=new Map;return{events:n,on(t,r){const o=n.get(t);o&&o.push(r)||n.set(t,[r])},off(t,r){const o=n.get(t);o&&o.splice(o.indexOf(r)>>>0,1)},emit(t,r){(n.get(t)||[]).slice().map(o=>o(r)),(n.get("*")||[]).slice().map(o=>o(t,r))}}}const _l=n=>!ye(n)||De(n);function Sl(n,e){if(_l(n)||_l(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:r,des:o}=t.pop();Object.keys(r).forEach(s=>{s!=="__proto__"&&(ye(r[s])&&!ye(o[s])&&(o[s]=Array.isArray(r[s])?[]:ve()),_l(o[s])||_l(r[s])?o[s]=r[s]:t.push({src:r[s],des:o[s]}))})}}/*!
117
131
  * message-compiler v11.1.12
118
132
  * (c) 2025 kazuya kawaguchi
119
133
  * Released under the MIT License.
120
- */function AB(n,e,t){return{line:n,column:e,offset:t}}function Pa(n,e,t){return{start:n,end:e}}const ie={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},BB=17,VB={[ie.EXPECTED_TOKEN]:"Expected token: '{0}'",[ie.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[ie.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[ie.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[ie.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[ie.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[ie.EMPTY_PLACEHOLDER]:"Empty placeholder",[ie.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[ie.INVALID_LINKED_FORMAT]:"Invalid linked format",[ie.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[ie.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[ie.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[ie.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[ie.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[ie.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Pr(n,e,t={}){const{domain:r,messages:o,args:s}=t,l=process.env.NODE_ENV!=="production"?Cl((o||VB)[n]||"",...s||[]):n,a=new SyntaxError(String(l));return a.code=n,e&&(a.location=e),a.domain=r,a}function LB(n){throw n}const OB=/<\/?[\w\s="/.':;#-\/]+>/,IB=n=>OB.test(n),rn=" ",DB="\r",ct=`
121
- `,RB="\u2028",FB="\u2029";function PB(n){const e=n;let t=0,r=1,o=1,s=0;const l=w=>e[w]===DB&&e[w+1]===ct,a=w=>e[w]===ct,c=w=>e[w]===FB,d=w=>e[w]===RB,u=w=>l(w)||a(w)||c(w)||d(w),f=()=>t,p=()=>r,h=()=>o,m=()=>s,g=w=>l(w)||c(w)||d(w)?ct:e[w],y=()=>g(t),b=()=>g(t+s);function k(){return s=0,u(t)&&(r++,o=0),l(t)&&t++,t++,o++,e[t]}function E(){return l(t+s)&&s++,s++,e[t+s]}function x(){t=0,r=1,o=1,s=0}function C(w=0){s=w}function S(){const w=t+s;for(;w!==t;)k();s=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:k,peek:E,reset:x,resetPeek:C,skipToPeek:S}}const xn=void 0,$B=".",ph="'",zB="tokenizer";function HB(n,e={}){const t=e.location!==!1,r=PB(n),o=()=>r.index(),s=()=>AB(r.line(),r.column(),r.index()),l=s(),a=o(),c={currentType:13,offset:a,startLoc:l,endLoc:l,lastType:13,lastOffset:a,lastStartLoc:l,lastEndLoc:l,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(_,N,P,...X){const Ee=d();if(N.column+=P,N.offset+=P,u){const Be=t?Pa(Ee.startLoc,N):null,pe=Pr(_,Be,{domain:zB,args:X});u(pe)}}function p(_,N,P){_.endLoc=s(),_.currentType=N;const X={type:N};return t&&(X.loc=Pa(_.startLoc,_.endLoc)),P!=null&&(X.value=P),X}const h=_=>p(_,13);function m(_,N){return _.currentChar()===N?(_.next(),N):(f(ie.EXPECTED_TOKEN,s(),0,N),"")}function g(_){let N="";for(;_.currentPeek()===rn||_.currentPeek()===ct;)N+=_.currentPeek(),_.peek();return N}function y(_){const N=g(_);return _.skipToPeek(),N}function b(_){if(_===xn)return!1;const N=_.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N===95}function k(_){if(_===xn)return!1;const N=_.charCodeAt(0);return N>=48&&N<=57}function E(_,N){const{currentType:P}=N;if(P!==2)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function x(_,N){const{currentType:P}=N;if(P!==2)return!1;g(_);const X=_.currentPeek()==="-"?_.peek():_.currentPeek(),Ee=k(X);return _.resetPeek(),Ee}function C(_,N){const{currentType:P}=N;if(P!==2)return!1;g(_);const X=_.currentPeek()===ph;return _.resetPeek(),X}function S(_,N){const{currentType:P}=N;if(P!==7)return!1;g(_);const X=_.currentPeek()===".";return _.resetPeek(),X}function w(_,N){const{currentType:P}=N;if(P!==8)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function T(_,N){const{currentType:P}=N;if(!(P===7||P===11))return!1;g(_);const X=_.currentPeek()===":";return _.resetPeek(),X}function D(_,N){const{currentType:P}=N;if(P!==9)return!1;const X=()=>{const Be=_.currentPeek();return Be==="{"?b(_.peek()):Be==="@"||Be==="|"||Be===":"||Be==="."||Be===rn||!Be?!1:Be===ct?(_.peek(),X()):A(_,!1)},Ee=X();return _.resetPeek(),Ee}function R(_){g(_);const N=_.currentPeek()==="|";return _.resetPeek(),N}function A(_,N=!0){const P=(Ee=!1,Be="")=>{const pe=_.currentPeek();return pe==="{"||pe==="@"||!pe?Ee:pe==="|"?!(Be===rn||Be===ct):pe===rn?(_.peek(),P(!0,rn)):pe===ct?(_.peek(),P(!0,ct)):!0},X=P();return N&&_.resetPeek(),X}function B(_,N){const P=_.currentChar();return P===xn?xn:N(P)?(_.next(),P):null}function W(_){const N=_.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36}function Q(_){return B(_,W)}function I(_){const N=_.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36||N===45}function z(_){return B(_,I)}function K(_){const N=_.charCodeAt(0);return N>=48&&N<=57}function ee(_){return B(_,K)}function re(_){const N=_.charCodeAt(0);return N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102}function xe(_){return B(_,re)}function Ze(_){let N="",P="";for(;N=ee(_);)P+=N;return P}function ht(_){let N="";for(;;){const P=_.currentChar();if(P==="{"||P==="}"||P==="@"||P==="|"||!P)break;if(P===rn||P===ct)if(A(_))N+=P,_.next();else{if(R(_))break;N+=P,_.next()}else N+=P,_.next()}return N}function mt(_){y(_);let N="",P="";for(;N=z(_);)P+=N;const X=_.currentChar();if(X&&X!=="}"&&X!==xn&&X!==rn&&X!==ct&&X!==" "){const Ee=yt(_);return f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,P+Ee),P+Ee}return _.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),P}function Ke(_){y(_);let N="";return _.currentChar()==="-"?(_.next(),N+=`-${Ze(_)}`):N+=Ze(_),_.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),N}function gt(_){return _!==ph&&_!==ct}function En(_){y(_),m(_,"'");let N="",P="";for(;N=B(_,gt);)N==="\\"?P+=Cn(_):P+=N;const X=_.currentChar();return X===ct||X===xn?(f(ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),X===ct&&(_.next(),m(_,"'")),P):(m(_,"'"),P)}function Cn(_){const N=_.currentChar();switch(N){case"\\":case"'":return _.next(),`\\${N}`;case"u":return vn(_,N,4);case"U":return vn(_,N,6);default:return f(ie.UNKNOWN_ESCAPE_SEQUENCE,s(),0,N),""}}function vn(_,N,P){m(_,N);let X="";for(let Ee=0;Ee<P;Ee++){const Be=xe(_);if(!Be){f(ie.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${N}${X}${_.currentChar()}`);break}X+=Be}return`\\${N}${X}`}function xr(_){return _!=="{"&&_!=="}"&&_!==rn&&_!==ct}function yt(_){y(_);let N="",P="";for(;N=B(_,xr);)P+=N;return P}function Pt(_){let N="",P="";for(;N=Q(_);)P+=N;return P}function cn(_){const N=P=>{const X=_.currentChar();return X==="{"||X==="@"||X==="|"||X==="("||X===")"||!X||X===rn?P:(P+=X,_.next(),N(P))};return N("")}function qe(_){y(_);const N=m(_,"|");return y(_),N}function $t(_,N){let P=null;switch(_.currentChar()){case"{":return N.braceNest>=1&&f(ie.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),_.next(),P=p(N,2,"{"),y(_),N.braceNest++,P;case"}":return N.braceNest>0&&N.currentType===2&&f(ie.EMPTY_PLACEHOLDER,s(),0),_.next(),P=p(N,3,"}"),N.braceNest--,N.braceNest>0&&y(_),N.inLinked&&N.braceNest===0&&(N.inLinked=!1),P;case"@":return N.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),P=qt(_,N)||h(N),N.braceNest=0,P;default:{let Ee=!0,Be=!0,pe=!0;if(R(_))return N.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),P=p(N,1,qe(_)),N.braceNest=0,N.inLinked=!1,P;if(N.braceNest>0&&(N.currentType===4||N.currentType===5||N.currentType===6))return f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),N.braceNest=0,dn(_,N);if(Ee=E(_,N))return P=p(N,4,mt(_)),y(_),P;if(Be=x(_,N))return P=p(N,5,Ke(_)),y(_),P;if(pe=C(_,N))return P=p(N,6,En(_)),y(_),P;if(!Ee&&!Be&&!pe)return P=p(N,12,yt(_)),f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,P.value),y(_),P;break}}return P}function qt(_,N){const{currentType:P}=N;let X=null;const Ee=_.currentChar();switch((P===7||P===8||P===11||P===9)&&(Ee===ct||Ee===rn)&&f(ie.INVALID_LINKED_FORMAT,s(),0),Ee){case"@":return _.next(),X=p(N,7,"@"),N.inLinked=!0,X;case".":return y(_),_.next(),p(N,8,".");case":":return y(_),_.next(),p(N,9,":");default:return R(_)?(X=p(N,1,qe(_)),N.braceNest=0,N.inLinked=!1,X):S(_,N)||T(_,N)?(y(_),qt(_,N)):w(_,N)?(y(_),p(N,11,Pt(_))):D(_,N)?(y(_),Ee==="{"?$t(_,N)||X:p(N,10,cn(_))):(P===7&&f(ie.INVALID_LINKED_FORMAT,s(),0),N.braceNest=0,N.inLinked=!1,dn(_,N))}}function dn(_,N){let P={type:13};if(N.braceNest>0)return $t(_,N)||h(N);if(N.inLinked)return qt(_,N)||h(N);switch(_.currentChar()){case"{":return $t(_,N)||h(N);case"}":return f(ie.UNBALANCED_CLOSING_BRACE,s(),0),_.next(),p(N,3,"}");case"@":return qt(_,N)||h(N);default:{if(R(_))return P=p(N,1,qe(_)),N.braceNest=0,N.inLinked=!1,P;if(A(_))return p(N,0,ht(_));break}}return P}function Xn(){const{currentType:_,offset:N,startLoc:P,endLoc:X}=c;return c.lastType=_,c.lastOffset=N,c.lastStartLoc=P,c.lastEndLoc=X,c.offset=o(),c.startLoc=s(),r.currentChar()===xn?p(c,13):dn(r,c)}return{nextToken:Xn,currentOffset:o,currentPosition:s,context:d}}const jB="parser",UB=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function WB(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const r=parseInt(e||t,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}}function KB(n={}){const e=n.location!==!1,{onError:t}=n;function r(b,k,E,x,...C){const S=b.currentPosition();if(S.offset+=x,S.column+=x,t){const w=e?Pa(E,S):null,T=Pr(k,w,{domain:jB,args:C});t(T)}}function o(b,k,E){const x={type:b};return e&&(x.start=k,x.end=k,x.loc={start:E,end:E}),x}function s(b,k,E,x){e&&(b.end=k,b.loc&&(b.loc.end=E))}function l(b,k){const E=b.context(),x=o(3,E.offset,E.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function a(b,k){const E=b.context(),{lastOffset:x,lastStartLoc:C}=E,S=o(5,x,C);return S.index=parseInt(k,10),b.nextToken(),s(S,b.currentOffset(),b.currentPosition()),S}function c(b,k){const E=b.context(),{lastOffset:x,lastStartLoc:C}=E,S=o(4,x,C);return S.key=k,b.nextToken(),s(S,b.currentOffset(),b.currentPosition()),S}function d(b,k){const E=b.context(),{lastOffset:x,lastStartLoc:C}=E,S=o(9,x,C);return S.value=k.replace(UB,WB),b.nextToken(),s(S,b.currentOffset(),b.currentPosition()),S}function u(b){const k=b.nextToken(),E=b.context(),{lastOffset:x,lastStartLoc:C}=E,S=o(8,x,C);return k.type!==11?(r(b,ie.UNEXPECTED_EMPTY_LINKED_MODIFIER,E.lastStartLoc,0),S.value="",s(S,x,C),{nextConsumeToken:k,node:S}):(k.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,E.lastStartLoc,0,on(k)),S.value=k.value||"",s(S,b.currentOffset(),b.currentPosition()),{node:S})}function f(b,k){const E=b.context(),x=o(7,E.offset,E.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function p(b){const k=b.context(),E=o(6,k.offset,k.startLoc);let x=b.nextToken();if(x.type===8){const C=u(b);E.modifier=C.node,x=C.nextConsumeToken||b.nextToken()}switch(x.type!==9&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),x=b.nextToken(),x.type===2&&(x=b.nextToken()),x.type){case 10:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=f(b,x.value||"");break;case 4:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=c(b,x.value||"");break;case 5:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=a(b,x.value||"");break;case 6:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=d(b,x.value||"");break;default:{r(b,ie.UNEXPECTED_EMPTY_LINKED_KEY,k.lastStartLoc,0);const C=b.context(),S=o(7,C.offset,C.startLoc);return S.value="",s(S,C.offset,C.startLoc),E.key=S,s(E,C.offset,C.startLoc),{nextConsumeToken:x,node:E}}}return s(E,b.currentOffset(),b.currentPosition()),{node:E}}function h(b){const k=b.context(),E=k.currentType===1?b.currentOffset():k.offset,x=k.currentType===1?k.endLoc:k.startLoc,C=o(2,E,x);C.items=[];let S=null;do{const D=S||b.nextToken();switch(S=null,D.type){case 0:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(l(b,D.value||""));break;case 5:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(a(b,D.value||""));break;case 4:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(c(b,D.value||""));break;case 6:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(d(b,D.value||""));break;case 7:{const R=p(b);C.items.push(R.node),S=R.nextConsumeToken||null;break}}}while(k.currentType!==13&&k.currentType!==1);const w=k.currentType===1?k.lastOffset:b.currentOffset(),T=k.currentType===1?k.lastEndLoc:b.currentPosition();return s(C,w,T),C}function m(b,k,E,x){const C=b.context();let S=x.items.length===0;const w=o(1,k,E);w.cases=[],w.cases.push(x);do{const T=h(b);S||(S=T.items.length===0),w.cases.push(T)}while(C.currentType!==13);return S&&r(b,ie.MUST_HAVE_MESSAGES_IN_PLURAL,E,0),s(w,b.currentOffset(),b.currentPosition()),w}function g(b){const k=b.context(),{offset:E,startLoc:x}=k,C=h(b);return k.currentType===13?C:m(b,E,x,C)}function y(b){const k=HB(b,We({},n)),E=k.context(),x=o(0,E.offset,E.startLoc);return e&&x.loc&&(x.loc.source=b),x.body=g(k),n.onCacheKey&&(x.cacheKey=n.onCacheKey(b)),E.currentType!==13&&r(k,ie.UNEXPECTED_LEXICAL_ANALYSIS,E.lastStartLoc,0,b[E.offset]||""),s(x,k.currentOffset(),k.currentPosition()),x}return{parse:y}}function on(n){if(n.type===13)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function qB(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:s=>(t.helpers.add(s),s)}}function hh(n,e){for(let t=0;t<n.length;t++)$a(n[t],e)}function $a(n,e){switch(n.type){case 1:hh(n.cases,e),e.helper("plural");break;case 2:hh(n.items,e);break;case 6:{$a(n.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function GB(n,e={}){const t=qB(n);t.helper("normalize"),n.body&&$a(n.body,t);const r=t.context();n.helpers=Array.from(r.helpers)}function JB(n){const e=n.body;return e.type===2?mh(e):e.cases.forEach(t=>mh(t)),n}function mh(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const r=n.items[t];if(!(r.type===3||r.type===9)||r.value==null)break;e.push(r.value)}if(e.length===n.items.length){n.static=Ra(e);for(let t=0;t<n.items.length;t++){const r=n.items[t];(r.type===3||r.type===9)&&delete r.value}}}}const YB="minifier";function $r(n){switch(n.t=n.type,n.type){case 0:{const e=n;$r(e.body),e.b=e.body,delete e.body;break}case 1:{const e=n,t=e.cases;for(let r=0;r<t.length;r++)$r(t[r]);e.c=t,delete e.cases;break}case 2:{const e=n,t=e.items;for(let r=0;r<t.length;r++)$r(t[r]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=n;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=n;$r(e.key),e.k=e.key,delete e.key,e.modifier&&($r(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=n;e.i=e.index,delete e.index;break}case 4:{const e=n;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw Pr(ie.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:YB,args:[n.type]})}delete n.type}const XB="parser";function ZB(n,e){const{filename:t,breakLineCode:r,needIndent:o}=e,s=e.location!==!1,l={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};s&&n.loc&&(l.source=n.loc.source);const a=()=>l;function c(g,y){l.code+=g}function d(g,y=!0){const b=y?r:"";c(o?b+" ".repeat(g):b)}function u(g=!0){const y=++l.indentLevel;g&&d(y)}function f(g=!0){const y=--l.indentLevel;g&&d(y)}function p(){d(l.indentLevel)}return{context:a,push:c,indent:u,deindent:f,newline:p,helper:g=>`_${g}`,needIndent:()=>l.needIndent}}function QB(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),zr(n,e.key),e.modifier?(n.push(", "),zr(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function eV(n,e){const{helper:t,needIndent:r}=n;n.push(`${t("normalize")}([`),n.indent(r());const o=e.items.length;for(let s=0;s<o&&(zr(n,e.items[s]),s!==o-1);s++)n.push(", ");n.deindent(r()),n.push("])")}function tV(n,e){const{helper:t,needIndent:r}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(r());const o=e.cases.length;for(let s=0;s<o&&(zr(n,e.cases[s]),s!==o-1);s++)n.push(", ");n.deindent(r()),n.push("])")}}function nV(n,e){e.body?zr(n,e.body):n.push("null")}function zr(n,e){const{helper:t}=n;switch(e.type){case 0:nV(n,e);break;case 1:tV(n,e);break;case 2:eV(n,e);break;case 6:QB(n,e);break;case 8:n.push(JSON.stringify(e.value),e);break;case 7:n.push(JSON.stringify(e.value),e);break;case 5:n.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:n.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:n.push(JSON.stringify(e.value),e);break;case 3:n.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw Pr(ie.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:XB,args:[e.type]})}}const rV=(n,e={})=>{const t=Y(e.mode)?e.mode:"normal",r=Y(e.filename)?e.filename:"message.intl";e.sourceMap;const o=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
122
- `,s=e.needIndent?e.needIndent:t!=="arrow",l=n.helpers||[],a=ZB(n,{filename:r,breakLineCode:o,needIndent:s});a.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(s),l.length>0&&(a.push(`const { ${Ra(l.map(u=>`${u}: _${u}`),", ")} } = ctx`),a.newline()),a.push("return "),zr(a,n),a.deindent(s),a.push("}"),delete n.helpers;const{code:c,map:d}=a.context();return{ast:n,code:c,map:d?d.toJSON():void 0}};function oV(n,e={}){const t=We({},e),r=!!t.jit,o=!!t.minify,s=t.optimize==null?!0:t.optimize,a=KB(t).parse(n);return r?(s&&JB(a),o&&$r(a),{ast:a,code:""}):(GB(a,t),rV(a,t))}/*!
134
+ */function HB(n,e,t){return{line:n,column:e,offset:t}}function Ha(n,e,t){return{start:n,end:e}}const ie={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},jB=17,UB={[ie.EXPECTED_TOKEN]:"Expected token: '{0}'",[ie.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[ie.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[ie.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[ie.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[ie.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[ie.EMPTY_PLACEHOLDER]:"Empty placeholder",[ie.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[ie.INVALID_LINKED_FORMAT]:"Invalid linked format",[ie.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[ie.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[ie.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[ie.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[ie.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[ie.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Pr(n,e,t={}){const{domain:r,messages:o,args:s}=t,l=process.env.NODE_ENV!=="production"?Cl((o||UB)[n]||"",...s||[]):n,a=new SyntaxError(String(l));return a.code=n,e&&(a.location=e),a.domain=r,a}function WB(n){throw n}const KB=/<\/?[\w\s="/.':;#-\/]+>/,qB=n=>KB.test(n),rn=" ",GB="\r",ct=`
135
+ `,JB="\u2028",YB="\u2029";function XB(n){const e=n;let t=0,r=1,o=1,s=0;const l=w=>e[w]===GB&&e[w+1]===ct,a=w=>e[w]===ct,c=w=>e[w]===YB,d=w=>e[w]===JB,u=w=>l(w)||a(w)||c(w)||d(w),f=()=>t,p=()=>r,h=()=>o,m=()=>s,g=w=>l(w)||c(w)||d(w)?ct:e[w],y=()=>g(t),b=()=>g(t+s);function k(){return s=0,u(t)&&(r++,o=0),l(t)&&t++,t++,o++,e[t]}function E(){return l(t+s)&&s++,s++,e[t+s]}function x(){t=0,r=1,o=1,s=0}function C(w=0){s=w}function _(){const w=t+s;for(;w!==t;)k();s=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:k,peek:E,reset:x,resetPeek:C,skipToPeek:_}}const xn=void 0,ZB=".",kh="'",QB="tokenizer";function eV(n,e={}){const t=e.location!==!1,r=XB(n),o=()=>r.index(),s=()=>HB(r.line(),r.column(),r.index()),l=s(),a=o(),c={currentType:13,offset:a,startLoc:l,endLoc:l,lastType:13,lastOffset:a,lastStartLoc:l,lastEndLoc:l,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(S,N,P,...Z){const Ee=d();if(N.column+=P,N.offset+=P,u){const Be=t?Ha(Ee.startLoc,N):null,pe=Pr(S,Be,{domain:QB,args:Z});u(pe)}}function p(S,N,P){S.endLoc=s(),S.currentType=N;const Z={type:N};return t&&(Z.loc=Ha(S.startLoc,S.endLoc)),P!=null&&(Z.value=P),Z}const h=S=>p(S,13);function m(S,N){return S.currentChar()===N?(S.next(),N):(f(ie.EXPECTED_TOKEN,s(),0,N),"")}function g(S){let N="";for(;S.currentPeek()===rn||S.currentPeek()===ct;)N+=S.currentPeek(),S.peek();return N}function y(S){const N=g(S);return S.skipToPeek(),N}function b(S){if(S===xn)return!1;const N=S.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N===95}function k(S){if(S===xn)return!1;const N=S.charCodeAt(0);return N>=48&&N<=57}function E(S,N){const{currentType:P}=N;if(P!==2)return!1;g(S);const Z=b(S.currentPeek());return S.resetPeek(),Z}function x(S,N){const{currentType:P}=N;if(P!==2)return!1;g(S);const Z=S.currentPeek()==="-"?S.peek():S.currentPeek(),Ee=k(Z);return S.resetPeek(),Ee}function C(S,N){const{currentType:P}=N;if(P!==2)return!1;g(S);const Z=S.currentPeek()===kh;return S.resetPeek(),Z}function _(S,N){const{currentType:P}=N;if(P!==7)return!1;g(S);const Z=S.currentPeek()===".";return S.resetPeek(),Z}function w(S,N){const{currentType:P}=N;if(P!==8)return!1;g(S);const Z=b(S.currentPeek());return S.resetPeek(),Z}function T(S,N){const{currentType:P}=N;if(!(P===7||P===11))return!1;g(S);const Z=S.currentPeek()===":";return S.resetPeek(),Z}function D(S,N){const{currentType:P}=N;if(P!==9)return!1;const Z=()=>{const Be=S.currentPeek();return Be==="{"?b(S.peek()):Be==="@"||Be==="|"||Be===":"||Be==="."||Be===rn||!Be?!1:Be===ct?(S.peek(),Z()):A(S,!1)},Ee=Z();return S.resetPeek(),Ee}function R(S){g(S);const N=S.currentPeek()==="|";return S.resetPeek(),N}function A(S,N=!0){const P=(Ee=!1,Be="")=>{const pe=S.currentPeek();return pe==="{"||pe==="@"||!pe?Ee:pe==="|"?!(Be===rn||Be===ct):pe===rn?(S.peek(),P(!0,rn)):pe===ct?(S.peek(),P(!0,ct)):!0},Z=P();return N&&S.resetPeek(),Z}function B(S,N){const P=S.currentChar();return P===xn?xn:N(P)?(S.next(),P):null}function U(S){const N=S.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36}function Y(S){return B(S,U)}function O(S){const N=S.charCodeAt(0);return N>=97&&N<=122||N>=65&&N<=90||N>=48&&N<=57||N===95||N===36||N===45}function z(S){return B(S,O)}function K(S){const N=S.charCodeAt(0);return N>=48&&N<=57}function ee(S){return B(S,K)}function re(S){const N=S.charCodeAt(0);return N>=48&&N<=57||N>=65&&N<=70||N>=97&&N<=102}function xe(S){return B(S,re)}function Ze(S){let N="",P="";for(;N=ee(S);)P+=N;return P}function ht(S){let N="";for(;;){const P=S.currentChar();if(P==="{"||P==="}"||P==="@"||P==="|"||!P)break;if(P===rn||P===ct)if(A(S))N+=P,S.next();else{if(R(S))break;N+=P,S.next()}else N+=P,S.next()}return N}function mt(S){y(S);let N="",P="";for(;N=z(S);)P+=N;const Z=S.currentChar();if(Z&&Z!=="}"&&Z!==xn&&Z!==rn&&Z!==ct&&Z!==" "){const Ee=yt(S);return f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,P+Ee),P+Ee}return S.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),P}function Ke(S){y(S);let N="";return S.currentChar()==="-"?(S.next(),N+=`-${Ze(S)}`):N+=Ze(S),S.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),N}function gt(S){return S!==kh&&S!==ct}function En(S){y(S),m(S,"'");let N="",P="";for(;N=B(S,gt);)N==="\\"?P+=Cn(S):P+=N;const Z=S.currentChar();return Z===ct||Z===xn?(f(ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),Z===ct&&(S.next(),m(S,"'")),P):(m(S,"'"),P)}function Cn(S){const N=S.currentChar();switch(N){case"\\":case"'":return S.next(),`\\${N}`;case"u":return vn(S,N,4);case"U":return vn(S,N,6);default:return f(ie.UNKNOWN_ESCAPE_SEQUENCE,s(),0,N),""}}function vn(S,N,P){m(S,N);let Z="";for(let Ee=0;Ee<P;Ee++){const Be=xe(S);if(!Be){f(ie.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${N}${Z}${S.currentChar()}`);break}Z+=Be}return`\\${N}${Z}`}function xr(S){return S!=="{"&&S!=="}"&&S!==rn&&S!==ct}function yt(S){y(S);let N="",P="";for(;N=B(S,xr);)P+=N;return P}function Pt(S){let N="",P="";for(;N=Y(S);)P+=N;return P}function cn(S){const N=P=>{const Z=S.currentChar();return Z==="{"||Z==="@"||Z==="|"||Z==="("||Z===")"||!Z||Z===rn?P:(P+=Z,S.next(),N(P))};return N("")}function qe(S){y(S);const N=m(S,"|");return y(S),N}function $t(S,N){let P=null;switch(S.currentChar()){case"{":return N.braceNest>=1&&f(ie.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),S.next(),P=p(N,2,"{"),y(S),N.braceNest++,P;case"}":return N.braceNest>0&&N.currentType===2&&f(ie.EMPTY_PLACEHOLDER,s(),0),S.next(),P=p(N,3,"}"),N.braceNest--,N.braceNest>0&&y(S),N.inLinked&&N.braceNest===0&&(N.inLinked=!1),P;case"@":return N.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),P=qt(S,N)||h(N),N.braceNest=0,P;default:{let Ee=!0,Be=!0,pe=!0;if(R(S))return N.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),P=p(N,1,qe(S)),N.braceNest=0,N.inLinked=!1,P;if(N.braceNest>0&&(N.currentType===4||N.currentType===5||N.currentType===6))return f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),N.braceNest=0,dn(S,N);if(Ee=E(S,N))return P=p(N,4,mt(S)),y(S),P;if(Be=x(S,N))return P=p(N,5,Ke(S)),y(S),P;if(pe=C(S,N))return P=p(N,6,En(S)),y(S),P;if(!Ee&&!Be&&!pe)return P=p(N,12,yt(S)),f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,P.value),y(S),P;break}}return P}function qt(S,N){const{currentType:P}=N;let Z=null;const Ee=S.currentChar();switch((P===7||P===8||P===11||P===9)&&(Ee===ct||Ee===rn)&&f(ie.INVALID_LINKED_FORMAT,s(),0),Ee){case"@":return S.next(),Z=p(N,7,"@"),N.inLinked=!0,Z;case".":return y(S),S.next(),p(N,8,".");case":":return y(S),S.next(),p(N,9,":");default:return R(S)?(Z=p(N,1,qe(S)),N.braceNest=0,N.inLinked=!1,Z):_(S,N)||T(S,N)?(y(S),qt(S,N)):w(S,N)?(y(S),p(N,11,Pt(S))):D(S,N)?(y(S),Ee==="{"?$t(S,N)||Z:p(N,10,cn(S))):(P===7&&f(ie.INVALID_LINKED_FORMAT,s(),0),N.braceNest=0,N.inLinked=!1,dn(S,N))}}function dn(S,N){let P={type:13};if(N.braceNest>0)return $t(S,N)||h(N);if(N.inLinked)return qt(S,N)||h(N);switch(S.currentChar()){case"{":return $t(S,N)||h(N);case"}":return f(ie.UNBALANCED_CLOSING_BRACE,s(),0),S.next(),p(N,3,"}");case"@":return qt(S,N)||h(N);default:{if(R(S))return P=p(N,1,qe(S)),N.braceNest=0,N.inLinked=!1,P;if(A(S))return p(N,0,ht(S));break}}return P}function Xn(){const{currentType:S,offset:N,startLoc:P,endLoc:Z}=c;return c.lastType=S,c.lastOffset=N,c.lastStartLoc=P,c.lastEndLoc=Z,c.offset=o(),c.startLoc=s(),r.currentChar()===xn?p(c,13):dn(r,c)}return{nextToken:Xn,currentOffset:o,currentPosition:s,context:d}}const tV="parser",nV=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function rV(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const r=parseInt(e||t,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}}function oV(n={}){const e=n.location!==!1,{onError:t}=n;function r(b,k,E,x,...C){const _=b.currentPosition();if(_.offset+=x,_.column+=x,t){const w=e?Ha(E,_):null,T=Pr(k,w,{domain:tV,args:C});t(T)}}function o(b,k,E){const x={type:b};return e&&(x.start=k,x.end=k,x.loc={start:E,end:E}),x}function s(b,k,E,x){e&&(b.end=k,b.loc&&(b.loc.end=E))}function l(b,k){const E=b.context(),x=o(3,E.offset,E.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function a(b,k){const E=b.context(),{lastOffset:x,lastStartLoc:C}=E,_=o(5,x,C);return _.index=parseInt(k,10),b.nextToken(),s(_,b.currentOffset(),b.currentPosition()),_}function c(b,k){const E=b.context(),{lastOffset:x,lastStartLoc:C}=E,_=o(4,x,C);return _.key=k,b.nextToken(),s(_,b.currentOffset(),b.currentPosition()),_}function d(b,k){const E=b.context(),{lastOffset:x,lastStartLoc:C}=E,_=o(9,x,C);return _.value=k.replace(nV,rV),b.nextToken(),s(_,b.currentOffset(),b.currentPosition()),_}function u(b){const k=b.nextToken(),E=b.context(),{lastOffset:x,lastStartLoc:C}=E,_=o(8,x,C);return k.type!==11?(r(b,ie.UNEXPECTED_EMPTY_LINKED_MODIFIER,E.lastStartLoc,0),_.value="",s(_,x,C),{nextConsumeToken:k,node:_}):(k.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,E.lastStartLoc,0,on(k)),_.value=k.value||"",s(_,b.currentOffset(),b.currentPosition()),{node:_})}function f(b,k){const E=b.context(),x=o(7,E.offset,E.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function p(b){const k=b.context(),E=o(6,k.offset,k.startLoc);let x=b.nextToken();if(x.type===8){const C=u(b);E.modifier=C.node,x=C.nextConsumeToken||b.nextToken()}switch(x.type!==9&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),x=b.nextToken(),x.type===2&&(x=b.nextToken()),x.type){case 10:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=f(b,x.value||"");break;case 4:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=c(b,x.value||"");break;case 5:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=a(b,x.value||"");break;case 6:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),E.key=d(b,x.value||"");break;default:{r(b,ie.UNEXPECTED_EMPTY_LINKED_KEY,k.lastStartLoc,0);const C=b.context(),_=o(7,C.offset,C.startLoc);return _.value="",s(_,C.offset,C.startLoc),E.key=_,s(E,C.offset,C.startLoc),{nextConsumeToken:x,node:E}}}return s(E,b.currentOffset(),b.currentPosition()),{node:E}}function h(b){const k=b.context(),E=k.currentType===1?b.currentOffset():k.offset,x=k.currentType===1?k.endLoc:k.startLoc,C=o(2,E,x);C.items=[];let _=null;do{const D=_||b.nextToken();switch(_=null,D.type){case 0:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(l(b,D.value||""));break;case 5:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(a(b,D.value||""));break;case 4:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(c(b,D.value||""));break;case 6:D.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(D)),C.items.push(d(b,D.value||""));break;case 7:{const R=p(b);C.items.push(R.node),_=R.nextConsumeToken||null;break}}}while(k.currentType!==13&&k.currentType!==1);const w=k.currentType===1?k.lastOffset:b.currentOffset(),T=k.currentType===1?k.lastEndLoc:b.currentPosition();return s(C,w,T),C}function m(b,k,E,x){const C=b.context();let _=x.items.length===0;const w=o(1,k,E);w.cases=[],w.cases.push(x);do{const T=h(b);_||(_=T.items.length===0),w.cases.push(T)}while(C.currentType!==13);return _&&r(b,ie.MUST_HAVE_MESSAGES_IN_PLURAL,E,0),s(w,b.currentOffset(),b.currentPosition()),w}function g(b){const k=b.context(),{offset:E,startLoc:x}=k,C=h(b);return k.currentType===13?C:m(b,E,x,C)}function y(b){const k=eV(b,We({},n)),E=k.context(),x=o(0,E.offset,E.startLoc);return e&&x.loc&&(x.loc.source=b),x.body=g(k),n.onCacheKey&&(x.cacheKey=n.onCacheKey(b)),E.currentType!==13&&r(k,ie.UNEXPECTED_LEXICAL_ANALYSIS,E.lastStartLoc,0,b[E.offset]||""),s(x,k.currentOffset(),k.currentPosition()),x}return{parse:y}}function on(n){if(n.type===13)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function sV(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:s=>(t.helpers.add(s),s)}}function xh(n,e){for(let t=0;t<n.length;t++)ja(n[t],e)}function ja(n,e){switch(n.type){case 1:xh(n.cases,e),e.helper("plural");break;case 2:xh(n.items,e);break;case 6:{ja(n.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function lV(n,e={}){const t=sV(n);t.helper("normalize"),n.body&&ja(n.body,t);const r=t.context();n.helpers=Array.from(r.helpers)}function iV(n){const e=n.body;return e.type===2?wh(e):e.cases.forEach(t=>wh(t)),n}function wh(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const r=n.items[t];if(!(r.type===3||r.type===9)||r.value==null)break;e.push(r.value)}if(e.length===n.items.length){n.static=$a(e);for(let t=0;t<n.items.length;t++){const r=n.items[t];(r.type===3||r.type===9)&&delete r.value}}}}const aV="minifier";function $r(n){switch(n.t=n.type,n.type){case 0:{const e=n;$r(e.body),e.b=e.body,delete e.body;break}case 1:{const e=n,t=e.cases;for(let r=0;r<t.length;r++)$r(t[r]);e.c=t,delete e.cases;break}case 2:{const e=n,t=e.items;for(let r=0;r<t.length;r++)$r(t[r]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=n;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=n;$r(e.key),e.k=e.key,delete e.key,e.modifier&&($r(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=n;e.i=e.index,delete e.index;break}case 4:{const e=n;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw Pr(ie.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:aV,args:[n.type]})}delete n.type}const cV="parser";function dV(n,e){const{filename:t,breakLineCode:r,needIndent:o}=e,s=e.location!==!1,l={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:o,indentLevel:0};s&&n.loc&&(l.source=n.loc.source);const a=()=>l;function c(g,y){l.code+=g}function d(g,y=!0){const b=y?r:"";c(o?b+" ".repeat(g):b)}function u(g=!0){const y=++l.indentLevel;g&&d(y)}function f(g=!0){const y=--l.indentLevel;g&&d(y)}function p(){d(l.indentLevel)}return{context:a,push:c,indent:u,deindent:f,newline:p,helper:g=>`_${g}`,needIndent:()=>l.needIndent}}function uV(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),zr(n,e.key),e.modifier?(n.push(", "),zr(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function fV(n,e){const{helper:t,needIndent:r}=n;n.push(`${t("normalize")}([`),n.indent(r());const o=e.items.length;for(let s=0;s<o&&(zr(n,e.items[s]),s!==o-1);s++)n.push(", ");n.deindent(r()),n.push("])")}function pV(n,e){const{helper:t,needIndent:r}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(r());const o=e.cases.length;for(let s=0;s<o&&(zr(n,e.cases[s]),s!==o-1);s++)n.push(", ");n.deindent(r()),n.push("])")}}function hV(n,e){e.body?zr(n,e.body):n.push("null")}function zr(n,e){const{helper:t}=n;switch(e.type){case 0:hV(n,e);break;case 1:pV(n,e);break;case 2:fV(n,e);break;case 6:uV(n,e);break;case 8:n.push(JSON.stringify(e.value),e);break;case 7:n.push(JSON.stringify(e.value),e);break;case 5:n.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:n.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:n.push(JSON.stringify(e.value),e);break;case 3:n.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw Pr(ie.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:cV,args:[e.type]})}}const mV=(n,e={})=>{const t=X(e.mode)?e.mode:"normal",r=X(e.filename)?e.filename:"message.intl";e.sourceMap;const o=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
136
+ `,s=e.needIndent?e.needIndent:t!=="arrow",l=n.helpers||[],a=dV(n,{filename:r,breakLineCode:o,needIndent:s});a.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(s),l.length>0&&(a.push(`const { ${$a(l.map(u=>`${u}: _${u}`),", ")} } = ctx`),a.newline()),a.push("return "),zr(a,n),a.deindent(s),a.push("}"),delete n.helpers;const{code:c,map:d}=a.context();return{ast:n,code:c,map:d?d.toJSON():void 0}};function gV(n,e={}){const t=We({},e),r=!!t.jit,o=!!t.minify,s=t.optimize==null?!0:t.optimize,a=oV(t).parse(n);return r?(s&&iV(a),o&&$r(a),{ast:a,code:""}):(lV(a,t),mV(a,t))}/*!
123
137
  * core-base v11.1.12
124
138
  * (c) 2025 kazuya kawaguchi
125
139
  * Released under the MIT License.
126
- */function sV(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function Dt(n){return ye(n)&&za(n)===0&&(Kt(n,"b")||Kt(n,"body"))}const gh=["b","body"];function lV(n){return qn(n,gh)}const yh=["c","cases"];function iV(n){return qn(n,yh,[])}const bh=["s","static"];function aV(n){return qn(n,bh)}const kh=["i","items"];function cV(n){return qn(n,kh,[])}const xh=["t","type"];function za(n){return qn(n,xh)}const wh=["v","value"];function Nl(n,e){const t=qn(n,wh);if(t!=null)return t;throw Bo(e)}const Eh=["m","modifier"];function dV(n){return qn(n,Eh)}const Ch=["k","key"];function uV(n){const e=qn(n,Ch);if(e)return e;throw Bo(6)}function qn(n,e,t){for(let r=0;r<e.length;r++){const o=e[r];if(Kt(n,o)&&n[o]!=null)return n[o]}return t}const vh=[...gh,...yh,...bh,...kh,...Ch,...Eh,...wh,...xh];function Bo(n){return new Error(`unhandled node type: ${n}`)}function Ha(n){return t=>fV(t,n)}function fV(n,e){const t=lV(e);if(t==null)throw Bo(0);if(za(t)===1){const s=iV(t);return n.plural(s.reduce((l,a)=>[...l,_h(n,a)],[]))}else return _h(n,t)}function _h(n,e){const t=aV(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const r=cV(e).reduce((o,s)=>[...o,ja(n,s)],[]);return n.normalize(r)}}function ja(n,e){const t=za(e);switch(t){case 3:return Nl(e,t);case 9:return Nl(e,t);case 4:{const r=e;if(Kt(r,"k")&&r.k)return n.interpolate(n.named(r.k));if(Kt(r,"key")&&r.key)return n.interpolate(n.named(r.key));throw Bo(t)}case 5:{const r=e;if(Kt(r,"i")&&je(r.i))return n.interpolate(n.list(r.i));if(Kt(r,"index")&&je(r.index))return n.interpolate(n.list(r.index));throw Bo(t)}case 6:{const r=e,o=dV(r),s=uV(r);return n.linked(ja(n,s),o?ja(n,o):void 0,n.type)}case 7:return Nl(e,t);case 8:return Nl(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const pV="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function hV(n,e){e&&IB(n)&&tn(Cl(pV,{source:n}))}const mV=n=>n;let Ml=ve();function gV(n,e={}){let t=!1;const r=e.onError||LB;return e.onError=o=>{t=!0,r(o)},{...oV(n,e),detectError:t}}function yV(n,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&Y(n)){const t=be(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&hV(n,t);const o=(e.onCacheKey||mV)(n),s=Ml[o];if(s)return s;const{ast:l,detectError:a}=gV(n,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Ha(l);return a?c:Ml[o]=c}else{if(process.env.NODE_ENV!=="production"&&!Dt(n))return tn(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>n);const t=n.cacheKey;if(t){const r=Ml[t];return r||(Ml[t]=Ha(n))}else return Ha(n)}}let Vo=null;function bV(n){Vo=n}function kV(n,e,t){Vo&&Vo.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const xV=wV("function:translate");function wV(n){return e=>Vo&&Vo.emit(n,e)}const dt={INVALID_ARGUMENT:BB,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},EV=24;function wn(n){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:CV}:void 0)}const CV={[dt.INVALID_ARGUMENT]:"Invalid arguments",[dt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[dt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[dt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[dt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[dt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[dt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function Ua(n,e){return e.locale!=null?Sh(e.locale):Sh(n.locale)}let Wa;function Sh(n){if(Y(n))return n;if(Ne(n)){if(n.resolvedOnce&&Wa!=null)return Wa;if(n.constructor.name==="Function"){const e=n();if(NB(e))throw wn(dt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Wa=e}else throw wn(dt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw wn(dt.NOT_SUPPORT_LOCALE_TYPE)}function vV(n,e,t){return[...new Set([t,...De(e)?e:ye(e)?Object.keys(e):Y(e)?[e]:[t]])]}function Nh(n,e,t){const r=Y(t)?t:Lo,o=n;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let l=[t];for(;De(l);)l=Mh(s,l,e);const a=De(e)||!me(e)?e:e.default?e.default:null;l=Y(a)?[a]:a,De(l)&&Mh(s,l,!1),o.__localeChainCache.set(r,s)}return s}function Mh(n,e,t){let r=!0;for(let o=0;o<e.length&&be(r);o++){const s=e[o];Y(s)&&(r=_V(n,e[o],t))}return r}function _V(n,e,t){let r;const o=e.split("-");do{const s=o.join("-");r=SV(n,s,t),o.splice(-1,1)}while(o.length&&r===!0);return r}function SV(n,e,t){let r=!1;if(!n.includes(e)&&(r=!0,e)){r=e[e.length-1]!=="!";const o=e.replace(/!/g,"");n.push(o),(De(t)||me(t))&&t[o]&&(r=t[o])}return r}const Gn=[];Gn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Gn[1]={w:[1],".":[2],"[":[4],o:[7]},Gn[2]={w:[2],i:[3,0],0:[3,0]},Gn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Gn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Gn[5]={"'":[4,0],o:8,l:[5,0]},Gn[6]={'"':[4,0],o:8,l:[6,0]};const NV=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function MV(n){return NV.test(n)}function TV(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function AV(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function BV(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:MV(e)?TV(e):"*"+e}function VV(n){const e=[];let t=-1,r=0,o=0,s,l,a,c,d,u,f;const p=[];p[0]=()=>{l===void 0?l=a:l+=a},p[1]=()=>{l!==void 0&&(e.push(l),l=void 0)},p[2]=()=>{p[0](),o++},p[3]=()=>{if(o>0)o--,r=4,p[0]();else{if(o=0,l===void 0||(l=BV(l),l===!1))return!1;p[1]()}};function h(){const m=n[t+1];if(r===5&&m==="'"||r===6&&m==='"')return t++,a="\\"+m,p[0](),!0}for(;r!==null;)if(t++,s=n[t],!(s==="\\"&&h())){if(c=AV(s),f=Gn[r],d=f[c]||f.l||8,d===8||(r=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(a=s,u()===!1))))return;if(r===7)return e}}const Th=new Map;function LV(n,e){return ye(n)?n[e]:null}function OV(n,e){if(!ye(n))return null;let t=Th.get(e);if(t||(t=VV(e),t&&Th.set(e,t)),!t)return null;const r=t.length;let o=n,s=0;for(;s<r;){const l=t[s];if(vh.includes(l)&&Dt(o))return null;const a=o[l];if(a===void 0||Ne(o))return null;o=a,s++}return o}const xt={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},IV=8,DV={[xt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[xt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[xt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[xt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[xt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[xt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[xt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function br(n,...e){return Cl(DV[n],...e)}const RV="11.1.12",Tl=-1,Lo="en-US",Al="",Ah=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function FV(){return{upper:(n,e)=>e==="text"&&Y(n)?n.toUpperCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&Y(n)?n.toLowerCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&Y(n)?Ah(n):e==="vnode"&&ye(n)&&"__v_isVNode"in n?Ah(n.children):n}}let Bh;function PV(n){Bh=n}let Vh;function $V(n){Vh=n}let Lh;function zV(n){Lh=n}let Oh=null;const HV=n=>{Oh=n},jV=()=>Oh;let Ih=null;const Dh=n=>{Ih=n},UV=()=>Ih;let Rh=0;function WV(n={}){const e=Ne(n.onWarn)?n.onWarn:tn,t=Y(n.version)?n.version:RV,r=Y(n.locale)||Ne(n.locale)?n.locale:Lo,o=Ne(r)?Lo:r,s=De(n.fallbackLocale)||me(n.fallbackLocale)||Y(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:o,l=me(n.messages)?n.messages:Ka(o),a=me(n.datetimeFormats)?n.datetimeFormats:Ka(o),c=me(n.numberFormats)?n.numberFormats:Ka(o),d=We(ve(),n.modifiers,FV()),u=n.pluralRules||ve(),f=Ne(n.missing)?n.missing:null,p=be(n.missingWarn)||Fr(n.missingWarn)?n.missingWarn:!0,h=be(n.fallbackWarn)||Fr(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=Ne(n.postTranslation)?n.postTranslation:null,b=me(n.processor)?n.processor:null,k=be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,E=!!n.escapeParameter,x=Ne(n.messageCompiler)?n.messageCompiler:Bh;process.env.NODE_ENV!=="production"&&Ne(n.messageCompiler)&&Ia(br(xt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const C=Ne(n.messageResolver)?n.messageResolver:Vh||LV,S=Ne(n.localeFallbacker)?n.localeFallbacker:Lh||vV,w=ye(n.fallbackContext)?n.fallbackContext:void 0,T=n,D=ye(T.__datetimeFormatters)?T.__datetimeFormatters:new Map,R=ye(T.__numberFormatters)?T.__numberFormatters:new Map,A=ye(T.__meta)?T.__meta:{};Rh++;const B={version:t,cid:Rh,locale:r,fallbackLocale:s,messages:l,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:g,postTranslation:y,processor:b,warnHtmlMessage:k,escapeParameter:E,messageCompiler:x,messageResolver:C,localeFallbacker:S,fallbackContext:w,onWarn:e,__meta:A};return B.datetimeFormats=a,B.numberFormats=c,B.__datetimeFormatters=D,B.__numberFormatters=R,process.env.NODE_ENV!=="production"&&(B.__v_emitter=T.__v_emitter!=null?T.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&kV(B,t,A),B}const Ka=n=>({[n]:ve()});function Bl(n,e){return n instanceof RegExp?n.test(e):n}function Fh(n,e){return n instanceof RegExp?n.test(e):n}function qa(n,e,t,r,o){const{missing:s,onWarn:l}=n;if(process.env.NODE_ENV!=="production"){const a=n.__v_emitter;a&&a.emit("missing",{locale:t,key:e,type:o,groupId:`${o}:${e}`})}if(s!==null){const a=s(n,t,e,o);return Y(a)?a:e}else return process.env.NODE_ENV!=="production"&&Fh(r,e)&&l(br(xt.NOT_FOUND_KEY,{key:e,locale:t})),e}function Oo(n,e,t){const r=n;r.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function Ph(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function KV(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let r=t+1;r<e.length;r++)if(Ph(n,e[r]))return!0;return!1}const $h=typeof Intl<"u",zh={dateTimeFormat:$h&&typeof Intl.DateTimeFormat<"u",numberFormat:$h&&typeof Intl.NumberFormat<"u"};function Hh(n,...e){const{datetimeFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__datetimeFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!zh.dateTimeFormat)return s(br(xt.CANNOT_FORMAT_DATE)),Al;const[c,d,u,f]=Ga(...e),p=be(u.missingWarn)?u.missingWarn:n.missingWarn,h=be(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=Ua(n,u),y=l(n,o,g);if(!Y(c)||c==="")return new Intl.DateTimeFormat(g,f).format(d);let b={},k,E=null,x=g,C=null;const S="datetime format";for(let D=0;D<y.length;D++){if(k=C=y[D],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(xt.FALLBACK_TO_DATE_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const R=n.__v_emitter;R&&R.emit("fallback",{type:S,key:c,from:x,to:C,groupId:`${S}:${c}`})}if(b=t[k]||{},E=b[c],me(E))break;qa(n,c,k,p,S),x=C}if(!me(E)||!Y(k))return r?Tl:c;let w=`${k}__${c}`;vl(f)||(w=`${w}__${JSON.stringify(f)}`);let T=a.get(w);return T||(T=new Intl.DateTimeFormat(k,We({},E,f)),a.set(w,T)),m?T.formatToParts(d):T.format(d)}const jh=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Ga(...n){const[e,t,r,o]=n,s=ve();let l=ve(),a;if(Y(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw wn(dt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();a=new Date(d);try{a.toISOString()}catch{throw wn(dt.INVALID_ISO_DATE_ARGUMENT)}}else if(CB(e)){if(isNaN(e.getTime()))throw wn(dt.INVALID_DATE_ARGUMENT);a=e}else if(je(e))a=e;else throw wn(dt.INVALID_ARGUMENT);return Y(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{jh.includes(c)?l[c]=t[c]:s[c]=t[c]}),Y(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function Uh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__datetimeFormatters.has(s)&&r.__datetimeFormatters.delete(s)}}function Wh(n,...e){const{numberFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__numberFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!zh.numberFormat)return s(br(xt.CANNOT_FORMAT_NUMBER)),Al;const[c,d,u,f]=Ja(...e),p=be(u.missingWarn)?u.missingWarn:n.missingWarn,h=be(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=Ua(n,u),y=l(n,o,g);if(!Y(c)||c==="")return new Intl.NumberFormat(g,f).format(d);let b={},k,E=null,x=g,C=null;const S="number format";for(let D=0;D<y.length;D++){if(k=C=y[D],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(xt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const R=n.__v_emitter;R&&R.emit("fallback",{type:S,key:c,from:x,to:C,groupId:`${S}:${c}`})}if(b=t[k]||{},E=b[c],me(E))break;qa(n,c,k,p,S),x=C}if(!me(E)||!Y(k))return r?Tl:c;let w=`${k}__${c}`;vl(f)||(w=`${w}__${JSON.stringify(f)}`);let T=a.get(w);return T||(T=new Intl.NumberFormat(k,We({},E,f)),a.set(w,T)),m?T.formatToParts(d):T.format(d)}const Kh=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ja(...n){const[e,t,r,o]=n,s=ve();let l=ve();if(!je(e))throw wn(dt.INVALID_ARGUMENT);const a=e;return Y(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Kh.includes(c)?l[c]=t[c]:s[c]=t[c]}),Y(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function qh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__numberFormatters.has(s)&&r.__numberFormatters.delete(s)}}const qV=n=>n,GV=n=>"",JV="text",YV=n=>n.length===0?"":Ra(n),XV=MB;function Gh(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function ZV(n){const e=je(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(je(n.named.count)||je(n.named.n))?je(n.named.count)?n.named.count:je(n.named.n)?n.named.n:e:e}function QV(n,e){e.count||(e.count=n),e.n||(e.n=n)}function eL(n={}){const e=n.locale,t=ZV(n),r=ye(n.pluralRules)&&Y(e)&&Ne(n.pluralRules[e])?n.pluralRules[e]:Gh,o=ye(n.pluralRules)&&Y(e)&&Ne(n.pluralRules[e])?Gh:void 0,s=b=>b[r(t,b.length,o)],l=n.list||[],a=b=>l[b],c=n.named||ve();je(n.pluralIndex)&&QV(t,c);const d=b=>c[b];function u(b,k){const E=Ne(n.messages)?n.messages(b,!!k):ye(n.messages)?n.messages[b]:!1;return E||(n.parent?n.parent.message(b):GV)}const f=b=>n.modifiers?n.modifiers[b]:qV,p=me(n.processor)&&Ne(n.processor.normalize)?n.processor.normalize:YV,h=me(n.processor)&&Ne(n.processor.interpolate)?n.processor.interpolate:XV,m=me(n.processor)&&Y(n.processor.type)?n.processor.type:JV,y={list:a,named:d,plural:s,linked:(b,...k)=>{const[E,x]=k;let C="text",S="";k.length===1?ye(E)?(S=E.modifier||S,C=E.type||C):Y(E)&&(S=E||S):k.length===2&&(Y(E)&&(S=E||S),Y(x)&&(C=x||C));const w=u(b,!0)(y),T=C==="vnode"&&De(w)&&S?w[0]:w;return S?f(S)(T,C):T},message:u,type:m,interpolate:h,normalize:p,values:We(ve(),l,c)};return y}const Jh=()=>"",Rt=n=>Ne(n);function Yh(n,...e){const{fallbackFormat:t,postTranslation:r,unresolving:o,messageCompiler:s,fallbackLocale:l,messages:a}=n,[c,d]=Ya(...e),u=be(d.missingWarn)?d.missingWarn:n.missingWarn,f=be(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,p=be(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=Y(d.default)||be(d.default)?be(d.default)?s?c:()=>c:d.default:t?s?c:()=>c:null,g=t||m!=null&&(Y(m)||Ne(m)),y=Ua(n,d);p&&tL(d);let[b,k,E]=h?[c,y,a[y]||ve()]:Xh(n,c,y,l,f,u),x=b,C=c;if(!h&&!(Y(x)||Dt(x)||Rt(x))&&g&&(x=m,C=x),!h&&(!(Y(x)||Dt(x)||Rt(x))||!Y(k)))return o?Tl:c;if(process.env.NODE_ENV!=="production"&&Y(x)&&n.messageCompiler==null)return tn(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let S=!1;const w=()=>{S=!0},T=Rt(x)?x:Zh(n,c,k,x,C,w);if(S)return x;const D=sL(n,k,E,d),R=eL(D),A=nL(n,T,R);let B=r?r(A,c):A;if(p&&Y(B)&&(B=_B(B)),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const W={timestamp:Date.now(),key:Y(c)?c:Rt(x)?x.key:"",locale:k||(Rt(x)?x.locale:""),format:Y(x)?x:Rt(x)?x.source:"",message:B};W.meta=We({},n.__meta,jV()||{}),xV(W)}return B}function tL(n){De(n.list)?n.list=n.list.map(e=>Y(e)?ch(e):e):ye(n.named)&&Object.keys(n.named).forEach(e=>{Y(n.named[e])&&(n.named[e]=ch(n.named[e]))})}function Xh(n,e,t,r,o,s){const{messages:l,onWarn:a,messageResolver:c,localeFallbacker:d}=n,u=d(n,r,t);let f=ve(),p,h=null,m=t,g=null;const y="translate";for(let b=0;b<u.length;b++){if(p=g=u[b],process.env.NODE_ENV!=="production"&&t!==p&&!Ph(t,p)&&Bl(o,e)&&a(br(xt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&t!==p){const C=n.__v_emitter;C&&C.emit("fallback",{type:y,key:e,from:m,to:g,groupId:`${y}:${e}`})}f=l[p]||ve();let k=null,E,x;if(process.env.NODE_ENV!=="production"&&Wt&&(k=window.performance.now(),E="intlify-message-resolve-start",x="intlify-message-resolve-end",Nt&&Nt(E)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&Wt){const C=window.performance.now(),S=n.__v_emitter;S&&k&&h&&S.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:C-k,groupId:`${y}:${e}`}),E&&x&&Nt&&gr&&(Nt(x),gr("intlify message resolve",E,x))}if(Y(h)||Dt(h)||Rt(h))break;if(!KV(p,u)){const C=qa(n,e,p,s,y);C!==e&&(h=C)}m=g}return[h,p,f]}function Zh(n,e,t,r,o,s){const{messageCompiler:l,warnHtmlMessage:a}=n;if(Rt(r)){const p=r;return p.locale=p.locale||t,p.key=p.key||e,p}if(l==null){const p=(()=>r);return p.locale=t,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&Wt&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",Nt&&Nt(d));const f=l(r,rL(n,t,o,r,a,s));if(process.env.NODE_ENV!=="production"&&Wt){const p=window.performance.now(),h=n.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:r,time:p-c,groupId:`translate:${e}`}),d&&u&&Nt&&gr&&(Nt(u),gr("intlify message compilation",d,u))}return f.locale=t,f.key=e,f.source=r,f}function nL(n,e,t){let r=null,o,s;process.env.NODE_ENV!=="production"&&Wt&&(r=window.performance.now(),o="intlify-message-evaluation-start",s="intlify-message-evaluation-end",Nt&&Nt(o));const l=e(t);if(process.env.NODE_ENV!=="production"&&Wt){const a=window.performance.now(),c=n.__v_emitter;c&&r&&c.emit("message-evaluation",{type:"message-evaluation",value:l,time:a-r,groupId:`translate:${e.key}`}),o&&s&&Nt&&gr&&(Nt(s),gr("intlify message evaluation",o,s))}return l}function Ya(...n){const[e,t,r]=n,o=ve();if(!Y(e)&&!je(e)&&!Rt(e)&&!Dt(e))throw wn(dt.INVALID_ARGUMENT);const s=je(e)?String(e):(Rt(e),e);return je(t)?o.plural=t:Y(t)?o.default=t:me(t)&&!vl(t)?o.named=t:De(t)&&(o.list=t),je(r)?o.plural=r:Y(r)?o.default=r:me(r)&&We(o,r),[s,o]}function rL(n,e,t,r,o,s){return{locale:e,key:t,warnHtmlMessage:o,onError:l=>{if(s&&s(l),process.env.NODE_ENV!=="production"){const a=oL(r),c=`Message compilation error: ${l.message}`,d=l.location&&a&&TB(a,l.location.start.offset,l.location.end.offset),u=n.__v_emitter;u&&a&&u.emit("compile-error",{message:a,error:l.message,start:l.location&&l.location.start.offset,end:l.location&&l.location.end.offset,groupId:`translate:${t}`}),console.error(d?`${c}
127
- ${d}`:c)}else throw l},onCacheKey:l=>wB(e,t,l)}}function oL(n){if(Y(n))return n;if(n.loc&&n.loc.source)return n.loc.source}function sL(n,e,t,r){const{modifiers:o,pluralRules:s,messageResolver:l,fallbackLocale:a,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:o,pluralRules:s,messages:(h,m)=>{let g=l(t,h);if(g==null&&(u||m)){const[,,y]=Xh(u||n,h,e,a,c,d);g=l(y,h)}if(Y(g)||Dt(g)){let y=!1;const k=Zh(n,h,e,g,h,()=>{y=!0});return y?Jh:k}else return Rt(g)?g:Jh}};return n.processor&&(p.processor=n.processor),r.list&&(p.list=r.list),r.named&&(p.named=r.named),je(r.plural)&&(p.pluralIndex=r.plural),p}sV();function lL(){return Qh().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Qh(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const iL=typeof Proxy=="function",aL="devtools-plugin:setup",cL="plugin:settings:set";let Hr,Xa;function dL(){var n;return Hr!==void 0||(typeof window<"u"&&window.performance?(Hr=!0,Xa=window.performance):typeof globalThis<"u"&&(!((n=globalThis.perf_hooks)===null||n===void 0)&&n.performance)?(Hr=!0,Xa=globalThis.perf_hooks.performance):Hr=!1),Hr}function uL(){return dL()?Xa.now():Date.now()}class fL{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const r={};if(e.settings)for(const l in e.settings){const a=e.settings[l];r[l]=a.defaultValue}const o=`__vue-devtools-plugin-settings__${e.id}`;let s=Object.assign({},r);try{const l=localStorage.getItem(o),a=JSON.parse(l);Object.assign(s,a)}catch{}this.fallbacks={getSettings(){return s},setSettings(l){try{localStorage.setItem(o,JSON.stringify(l))}catch{}s=l},now(){return uL()}},t&&t.on(cL,(l,a)=>{l===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(l,a)=>this.target?this.target.on[a]:(...c)=>{this.onQueue.push({method:a,args:c})}}),this.proxiedTarget=new Proxy({},{get:(l,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...c)=>(this.targetQueue.push({method:a,args:c,resolve:()=>{}}),this.fallbacks[a](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:a,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function pL(n,e){const t=n,r=Qh(),o=lL(),s=iL&&t.enableEarlyProxy;if(o&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!s))o.emit(aL,n,e);else{const l=s?new fL(t,o):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:l}),l&&e(l.proxiedTarget)}}/*!
140
+ */function yV(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function Dt(n){return ye(n)&&Ua(n)===0&&(Kt(n,"b")||Kt(n,"body"))}const Eh=["b","body"];function bV(n){return qn(n,Eh)}const Ch=["c","cases"];function kV(n){return qn(n,Ch,[])}const vh=["s","static"];function xV(n){return qn(n,vh)}const _h=["i","items"];function wV(n){return qn(n,_h,[])}const Sh=["t","type"];function Ua(n){return qn(n,Sh)}const Nh=["v","value"];function Nl(n,e){const t=qn(n,Nh);if(t!=null)return t;throw Bo(e)}const Mh=["m","modifier"];function EV(n){return qn(n,Mh)}const Th=["k","key"];function CV(n){const e=qn(n,Th);if(e)return e;throw Bo(6)}function qn(n,e,t){for(let r=0;r<e.length;r++){const o=e[r];if(Kt(n,o)&&n[o]!=null)return n[o]}return t}const Ah=[...Eh,...Ch,...vh,..._h,...Th,...Mh,...Nh,...Sh];function Bo(n){return new Error(`unhandled node type: ${n}`)}function Wa(n){return t=>vV(t,n)}function vV(n,e){const t=bV(e);if(t==null)throw Bo(0);if(Ua(t)===1){const s=kV(t);return n.plural(s.reduce((l,a)=>[...l,Bh(n,a)],[]))}else return Bh(n,t)}function Bh(n,e){const t=xV(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const r=wV(e).reduce((o,s)=>[...o,Ka(n,s)],[]);return n.normalize(r)}}function Ka(n,e){const t=Ua(e);switch(t){case 3:return Nl(e,t);case 9:return Nl(e,t);case 4:{const r=e;if(Kt(r,"k")&&r.k)return n.interpolate(n.named(r.k));if(Kt(r,"key")&&r.key)return n.interpolate(n.named(r.key));throw Bo(t)}case 5:{const r=e;if(Kt(r,"i")&&je(r.i))return n.interpolate(n.list(r.i));if(Kt(r,"index")&&je(r.index))return n.interpolate(n.list(r.index));throw Bo(t)}case 6:{const r=e,o=EV(r),s=CV(r);return n.linked(Ka(n,s),o?Ka(n,o):void 0,n.type)}case 7:return Nl(e,t);case 8:return Nl(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const _V="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function SV(n,e){e&&qB(n)&&tn(Cl(_V,{source:n}))}const NV=n=>n;let Ml=ve();function MV(n,e={}){let t=!1;const r=e.onError||WB;return e.onError=o=>{t=!0,r(o)},{...gV(n,e),detectError:t}}function TV(n,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&X(n)){const t=be(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&SV(n,t);const o=(e.onCacheKey||NV)(n),s=Ml[o];if(s)return s;const{ast:l,detectError:a}=MV(n,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Wa(l);return a?c:Ml[o]=c}else{if(process.env.NODE_ENV!=="production"&&!Dt(n))return tn(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>n);const t=n.cacheKey;if(t){const r=Ml[t];return r||(Ml[t]=Wa(n))}else return Wa(n)}}let Vo=null;function AV(n){Vo=n}function BV(n,e,t){Vo&&Vo.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const VV=LV("function:translate");function LV(n){return e=>Vo&&Vo.emit(n,e)}const dt={INVALID_ARGUMENT:jB,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},OV=24;function wn(n){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:IV}:void 0)}const IV={[dt.INVALID_ARGUMENT]:"Invalid arguments",[dt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[dt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[dt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[dt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[dt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[dt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function qa(n,e){return e.locale!=null?Vh(e.locale):Vh(n.locale)}let Ga;function Vh(n){if(X(n))return n;if(Ne(n)){if(n.resolvedOnce&&Ga!=null)return Ga;if(n.constructor.name==="Function"){const e=n();if(PB(e))throw wn(dt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ga=e}else throw wn(dt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw wn(dt.NOT_SUPPORT_LOCALE_TYPE)}function DV(n,e,t){return[...new Set([t,...De(e)?e:ye(e)?Object.keys(e):X(e)?[e]:[t]])]}function Lh(n,e,t){const r=X(t)?t:Lo,o=n;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let l=[t];for(;De(l);)l=Oh(s,l,e);const a=De(e)||!me(e)?e:e.default?e.default:null;l=X(a)?[a]:a,De(l)&&Oh(s,l,!1),o.__localeChainCache.set(r,s)}return s}function Oh(n,e,t){let r=!0;for(let o=0;o<e.length&&be(r);o++){const s=e[o];X(s)&&(r=RV(n,e[o],t))}return r}function RV(n,e,t){let r;const o=e.split("-");do{const s=o.join("-");r=FV(n,s,t),o.splice(-1,1)}while(o.length&&r===!0);return r}function FV(n,e,t){let r=!1;if(!n.includes(e)&&(r=!0,e)){r=e[e.length-1]!=="!";const o=e.replace(/!/g,"");n.push(o),(De(t)||me(t))&&t[o]&&(r=t[o])}return r}const Gn=[];Gn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Gn[1]={w:[1],".":[2],"[":[4],o:[7]},Gn[2]={w:[2],i:[3,0],0:[3,0]},Gn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Gn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Gn[5]={"'":[4,0],o:8,l:[5,0]},Gn[6]={'"':[4,0],o:8,l:[6,0]};const PV=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function $V(n){return PV.test(n)}function zV(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function HV(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function jV(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:$V(e)?zV(e):"*"+e}function UV(n){const e=[];let t=-1,r=0,o=0,s,l,a,c,d,u,f;const p=[];p[0]=()=>{l===void 0?l=a:l+=a},p[1]=()=>{l!==void 0&&(e.push(l),l=void 0)},p[2]=()=>{p[0](),o++},p[3]=()=>{if(o>0)o--,r=4,p[0]();else{if(o=0,l===void 0||(l=jV(l),l===!1))return!1;p[1]()}};function h(){const m=n[t+1];if(r===5&&m==="'"||r===6&&m==='"')return t++,a="\\"+m,p[0](),!0}for(;r!==null;)if(t++,s=n[t],!(s==="\\"&&h())){if(c=HV(s),f=Gn[r],d=f[c]||f.l||8,d===8||(r=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(a=s,u()===!1))))return;if(r===7)return e}}const Ih=new Map;function WV(n,e){return ye(n)?n[e]:null}function KV(n,e){if(!ye(n))return null;let t=Ih.get(e);if(t||(t=UV(e),t&&Ih.set(e,t)),!t)return null;const r=t.length;let o=n,s=0;for(;s<r;){const l=t[s];if(Ah.includes(l)&&Dt(o))return null;const a=o[l];if(a===void 0||Ne(o))return null;o=a,s++}return o}const xt={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},qV=8,GV={[xt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[xt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[xt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[xt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[xt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[xt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[xt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function br(n,...e){return Cl(GV[n],...e)}const JV="11.1.12",Tl=-1,Lo="en-US",Al="",Dh=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function YV(){return{upper:(n,e)=>e==="text"&&X(n)?n.toUpperCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&X(n)?n.toLowerCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&X(n)?Dh(n):e==="vnode"&&ye(n)&&"__v_isVNode"in n?Dh(n.children):n}}let Rh;function XV(n){Rh=n}let Fh;function ZV(n){Fh=n}let Ph;function QV(n){Ph=n}let $h=null;const eL=n=>{$h=n},tL=()=>$h;let zh=null;const Hh=n=>{zh=n},nL=()=>zh;let jh=0;function rL(n={}){const e=Ne(n.onWarn)?n.onWarn:tn,t=X(n.version)?n.version:JV,r=X(n.locale)||Ne(n.locale)?n.locale:Lo,o=Ne(r)?Lo:r,s=De(n.fallbackLocale)||me(n.fallbackLocale)||X(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:o,l=me(n.messages)?n.messages:Ja(o),a=me(n.datetimeFormats)?n.datetimeFormats:Ja(o),c=me(n.numberFormats)?n.numberFormats:Ja(o),d=We(ve(),n.modifiers,YV()),u=n.pluralRules||ve(),f=Ne(n.missing)?n.missing:null,p=be(n.missingWarn)||Fr(n.missingWarn)?n.missingWarn:!0,h=be(n.fallbackWarn)||Fr(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=Ne(n.postTranslation)?n.postTranslation:null,b=me(n.processor)?n.processor:null,k=be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,E=!!n.escapeParameter,x=Ne(n.messageCompiler)?n.messageCompiler:Rh;process.env.NODE_ENV!=="production"&&Ne(n.messageCompiler)&&Fa(br(xt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const C=Ne(n.messageResolver)?n.messageResolver:Fh||WV,_=Ne(n.localeFallbacker)?n.localeFallbacker:Ph||DV,w=ye(n.fallbackContext)?n.fallbackContext:void 0,T=n,D=ye(T.__datetimeFormatters)?T.__datetimeFormatters:new Map,R=ye(T.__numberFormatters)?T.__numberFormatters:new Map,A=ye(T.__meta)?T.__meta:{};jh++;const B={version:t,cid:jh,locale:r,fallbackLocale:s,messages:l,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:g,postTranslation:y,processor:b,warnHtmlMessage:k,escapeParameter:E,messageCompiler:x,messageResolver:C,localeFallbacker:_,fallbackContext:w,onWarn:e,__meta:A};return B.datetimeFormats=a,B.numberFormats=c,B.__datetimeFormatters=D,B.__numberFormatters=R,process.env.NODE_ENV!=="production"&&(B.__v_emitter=T.__v_emitter!=null?T.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&BV(B,t,A),B}const Ja=n=>({[n]:ve()});function Bl(n,e){return n instanceof RegExp?n.test(e):n}function Uh(n,e){return n instanceof RegExp?n.test(e):n}function Ya(n,e,t,r,o){const{missing:s,onWarn:l}=n;if(process.env.NODE_ENV!=="production"){const a=n.__v_emitter;a&&a.emit("missing",{locale:t,key:e,type:o,groupId:`${o}:${e}`})}if(s!==null){const a=s(n,t,e,o);return X(a)?a:e}else return process.env.NODE_ENV!=="production"&&Uh(r,e)&&l(br(xt.NOT_FOUND_KEY,{key:e,locale:t})),e}function Oo(n,e,t){const r=n;r.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function Wh(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function oL(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let r=t+1;r<e.length;r++)if(Wh(n,e[r]))return!0;return!1}const Kh=typeof Intl<"u",qh={dateTimeFormat:Kh&&typeof Intl.DateTimeFormat<"u",numberFormat:Kh&&typeof Intl.NumberFormat<"u"};function Gh(n,...e){const{datetimeFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__datetimeFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!qh.dateTimeFormat)return s(br(xt.CANNOT_FORMAT_DATE)),Al;const[c,d,u,f]=Xa(...e),p=be(u.missingWarn)?u.missingWarn:n.missingWarn,h=be(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=qa(n,u),y=l(n,o,g);if(!X(c)||c==="")return new Intl.DateTimeFormat(g,f).format(d);let b={},k,E=null,x=g,C=null;const _="datetime format";for(let D=0;D<y.length;D++){if(k=C=y[D],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(xt.FALLBACK_TO_DATE_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const R=n.__v_emitter;R&&R.emit("fallback",{type:_,key:c,from:x,to:C,groupId:`${_}:${c}`})}if(b=t[k]||{},E=b[c],me(E))break;Ya(n,c,k,p,_),x=C}if(!me(E)||!X(k))return r?Tl:c;let w=`${k}__${c}`;vl(f)||(w=`${w}__${JSON.stringify(f)}`);let T=a.get(w);return T||(T=new Intl.DateTimeFormat(k,We({},E,f)),a.set(w,T)),m?T.formatToParts(d):T.format(d)}const Jh=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function Xa(...n){const[e,t,r,o]=n,s=ve();let l=ve(),a;if(X(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw wn(dt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();a=new Date(d);try{a.toISOString()}catch{throw wn(dt.INVALID_ISO_DATE_ARGUMENT)}}else if(IB(e)){if(isNaN(e.getTime()))throw wn(dt.INVALID_DATE_ARGUMENT);a=e}else if(je(e))a=e;else throw wn(dt.INVALID_ARGUMENT);return X(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Jh.includes(c)?l[c]=t[c]:s[c]=t[c]}),X(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function Yh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__datetimeFormatters.has(s)&&r.__datetimeFormatters.delete(s)}}function Xh(n,...e){const{numberFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__numberFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!qh.numberFormat)return s(br(xt.CANNOT_FORMAT_NUMBER)),Al;const[c,d,u,f]=Za(...e),p=be(u.missingWarn)?u.missingWarn:n.missingWarn,h=be(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=qa(n,u),y=l(n,o,g);if(!X(c)||c==="")return new Intl.NumberFormat(g,f).format(d);let b={},k,E=null,x=g,C=null;const _="number format";for(let D=0;D<y.length;D++){if(k=C=y[D],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(xt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const R=n.__v_emitter;R&&R.emit("fallback",{type:_,key:c,from:x,to:C,groupId:`${_}:${c}`})}if(b=t[k]||{},E=b[c],me(E))break;Ya(n,c,k,p,_),x=C}if(!me(E)||!X(k))return r?Tl:c;let w=`${k}__${c}`;vl(f)||(w=`${w}__${JSON.stringify(f)}`);let T=a.get(w);return T||(T=new Intl.NumberFormat(k,We({},E,f)),a.set(w,T)),m?T.formatToParts(d):T.format(d)}const Zh=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Za(...n){const[e,t,r,o]=n,s=ve();let l=ve();if(!je(e))throw wn(dt.INVALID_ARGUMENT);const a=e;return X(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Zh.includes(c)?l[c]=t[c]:s[c]=t[c]}),X(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function Qh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__numberFormatters.has(s)&&r.__numberFormatters.delete(s)}}const sL=n=>n,lL=n=>"",iL="text",aL=n=>n.length===0?"":$a(n),cL=$B;function em(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function dL(n){const e=je(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(je(n.named.count)||je(n.named.n))?je(n.named.count)?n.named.count:je(n.named.n)?n.named.n:e:e}function uL(n,e){e.count||(e.count=n),e.n||(e.n=n)}function fL(n={}){const e=n.locale,t=dL(n),r=ye(n.pluralRules)&&X(e)&&Ne(n.pluralRules[e])?n.pluralRules[e]:em,o=ye(n.pluralRules)&&X(e)&&Ne(n.pluralRules[e])?em:void 0,s=b=>b[r(t,b.length,o)],l=n.list||[],a=b=>l[b],c=n.named||ve();je(n.pluralIndex)&&uL(t,c);const d=b=>c[b];function u(b,k){const E=Ne(n.messages)?n.messages(b,!!k):ye(n.messages)?n.messages[b]:!1;return E||(n.parent?n.parent.message(b):lL)}const f=b=>n.modifiers?n.modifiers[b]:sL,p=me(n.processor)&&Ne(n.processor.normalize)?n.processor.normalize:aL,h=me(n.processor)&&Ne(n.processor.interpolate)?n.processor.interpolate:cL,m=me(n.processor)&&X(n.processor.type)?n.processor.type:iL,y={list:a,named:d,plural:s,linked:(b,...k)=>{const[E,x]=k;let C="text",_="";k.length===1?ye(E)?(_=E.modifier||_,C=E.type||C):X(E)&&(_=E||_):k.length===2&&(X(E)&&(_=E||_),X(x)&&(C=x||C));const w=u(b,!0)(y),T=C==="vnode"&&De(w)&&_?w[0]:w;return _?f(_)(T,C):T},message:u,type:m,interpolate:h,normalize:p,values:We(ve(),l,c)};return y}const tm=()=>"",Rt=n=>Ne(n);function nm(n,...e){const{fallbackFormat:t,postTranslation:r,unresolving:o,messageCompiler:s,fallbackLocale:l,messages:a}=n,[c,d]=Qa(...e),u=be(d.missingWarn)?d.missingWarn:n.missingWarn,f=be(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,p=be(d.escapeParameter)?d.escapeParameter:n.escapeParameter,h=!!d.resolvedMessage,m=X(d.default)||be(d.default)?be(d.default)?s?c:()=>c:d.default:t?s?c:()=>c:null,g=t||m!=null&&(X(m)||Ne(m)),y=qa(n,d);p&&pL(d);let[b,k,E]=h?[c,y,a[y]||ve()]:rm(n,c,y,l,f,u),x=b,C=c;if(!h&&!(X(x)||Dt(x)||Rt(x))&&g&&(x=m,C=x),!h&&(!(X(x)||Dt(x)||Rt(x))||!X(k)))return o?Tl:c;if(process.env.NODE_ENV!=="production"&&X(x)&&n.messageCompiler==null)return tn(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let _=!1;const w=()=>{_=!0},T=Rt(x)?x:om(n,c,k,x,C,w);if(_)return x;const D=yL(n,k,E,d),R=fL(D),A=hL(n,T,R);let B=r?r(A,c):A;if(p&&X(B)&&(B=RB(B)),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const U={timestamp:Date.now(),key:X(c)?c:Rt(x)?x.key:"",locale:k||(Rt(x)?x.locale:""),format:X(x)?x:Rt(x)?x.source:"",message:B};U.meta=We({},n.__meta,tL()||{}),VV(U)}return B}function pL(n){De(n.list)?n.list=n.list.map(e=>X(e)?mh(e):e):ye(n.named)&&Object.keys(n.named).forEach(e=>{X(n.named[e])&&(n.named[e]=mh(n.named[e]))})}function rm(n,e,t,r,o,s){const{messages:l,onWarn:a,messageResolver:c,localeFallbacker:d}=n,u=d(n,r,t);let f=ve(),p,h=null,m=t,g=null;const y="translate";for(let b=0;b<u.length;b++){if(p=g=u[b],process.env.NODE_ENV!=="production"&&t!==p&&!Wh(t,p)&&Bl(o,e)&&a(br(xt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&t!==p){const C=n.__v_emitter;C&&C.emit("fallback",{type:y,key:e,from:m,to:g,groupId:`${y}:${e}`})}f=l[p]||ve();let k=null,E,x;if(process.env.NODE_ENV!=="production"&&Wt&&(k=window.performance.now(),E="intlify-message-resolve-start",x="intlify-message-resolve-end",Nt&&Nt(E)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&Wt){const C=window.performance.now(),_=n.__v_emitter;_&&k&&h&&_.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:C-k,groupId:`${y}:${e}`}),E&&x&&Nt&&gr&&(Nt(x),gr("intlify message resolve",E,x))}if(X(h)||Dt(h)||Rt(h))break;if(!oL(p,u)){const C=Ya(n,e,p,s,y);C!==e&&(h=C)}m=g}return[h,p,f]}function om(n,e,t,r,o,s){const{messageCompiler:l,warnHtmlMessage:a}=n;if(Rt(r)){const p=r;return p.locale=p.locale||t,p.key=p.key||e,p}if(l==null){const p=(()=>r);return p.locale=t,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&Wt&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",Nt&&Nt(d));const f=l(r,mL(n,t,o,r,a,s));if(process.env.NODE_ENV!=="production"&&Wt){const p=window.performance.now(),h=n.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:r,time:p-c,groupId:`translate:${e}`}),d&&u&&Nt&&gr&&(Nt(u),gr("intlify message compilation",d,u))}return f.locale=t,f.key=e,f.source=r,f}function hL(n,e,t){let r=null,o,s;process.env.NODE_ENV!=="production"&&Wt&&(r=window.performance.now(),o="intlify-message-evaluation-start",s="intlify-message-evaluation-end",Nt&&Nt(o));const l=e(t);if(process.env.NODE_ENV!=="production"&&Wt){const a=window.performance.now(),c=n.__v_emitter;c&&r&&c.emit("message-evaluation",{type:"message-evaluation",value:l,time:a-r,groupId:`translate:${e.key}`}),o&&s&&Nt&&gr&&(Nt(s),gr("intlify message evaluation",o,s))}return l}function Qa(...n){const[e,t,r]=n,o=ve();if(!X(e)&&!je(e)&&!Rt(e)&&!Dt(e))throw wn(dt.INVALID_ARGUMENT);const s=je(e)?String(e):(Rt(e),e);return je(t)?o.plural=t:X(t)?o.default=t:me(t)&&!vl(t)?o.named=t:De(t)&&(o.list=t),je(r)?o.plural=r:X(r)?o.default=r:me(r)&&We(o,r),[s,o]}function mL(n,e,t,r,o,s){return{locale:e,key:t,warnHtmlMessage:o,onError:l=>{if(s&&s(l),process.env.NODE_ENV!=="production"){const a=gL(r),c=`Message compilation error: ${l.message}`,d=l.location&&a&&zB(a,l.location.start.offset,l.location.end.offset),u=n.__v_emitter;u&&a&&u.emit("compile-error",{message:a,error:l.message,start:l.location&&l.location.start.offset,end:l.location&&l.location.end.offset,groupId:`translate:${t}`}),console.error(d?`${c}
141
+ ${d}`:c)}else throw l},onCacheKey:l=>LB(e,t,l)}}function gL(n){if(X(n))return n;if(n.loc&&n.loc.source)return n.loc.source}function yL(n,e,t,r){const{modifiers:o,pluralRules:s,messageResolver:l,fallbackLocale:a,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:o,pluralRules:s,messages:(h,m)=>{let g=l(t,h);if(g==null&&(u||m)){const[,,y]=rm(u||n,h,e,a,c,d);g=l(y,h)}if(X(g)||Dt(g)){let y=!1;const k=om(n,h,e,g,h,()=>{y=!0});return y?tm:k}else return Rt(g)?g:tm}};return n.processor&&(p.processor=n.processor),r.list&&(p.list=r.list),r.named&&(p.named=r.named),je(r.plural)&&(p.pluralIndex=r.plural),p}yV();function bL(){return sm().__VUE_DEVTOOLS_GLOBAL_HOOK__}function sm(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const kL=typeof Proxy=="function",xL="devtools-plugin:setup",wL="plugin:settings:set";let Hr,ec;function EL(){var n;return Hr!==void 0||(typeof window<"u"&&window.performance?(Hr=!0,ec=window.performance):typeof globalThis<"u"&&(!((n=globalThis.perf_hooks)===null||n===void 0)&&n.performance)?(Hr=!0,ec=globalThis.perf_hooks.performance):Hr=!1),Hr}function CL(){return EL()?ec.now():Date.now()}class vL{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const r={};if(e.settings)for(const l in e.settings){const a=e.settings[l];r[l]=a.defaultValue}const o=`__vue-devtools-plugin-settings__${e.id}`;let s=Object.assign({},r);try{const l=localStorage.getItem(o),a=JSON.parse(l);Object.assign(s,a)}catch{}this.fallbacks={getSettings(){return s},setSettings(l){try{localStorage.setItem(o,JSON.stringify(l))}catch{}s=l},now(){return CL()}},t&&t.on(wL,(l,a)=>{l===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(l,a)=>this.target?this.target.on[a]:(...c)=>{this.onQueue.push({method:a,args:c})}}),this.proxiedTarget=new Proxy({},{get:(l,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...c)=>(this.targetQueue.push({method:a,args:c,resolve:()=>{}}),this.fallbacks[a](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:a,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function _L(n,e){const t=n,r=sm(),o=bL(),s=kL&&t.enableEarlyProxy;if(o&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!s))o.emit(xL,n,e);else{const l=s?new vL(t,o):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:l}),l&&e(l.proxiedTarget)}}/*!
128
142
  * vue-i18n v11.1.12
129
143
  * (c) 2025 kazuya kawaguchi
130
144
  * Released under the MIT License.
131
- */const hL="11.1.12";function mL(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(yr().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(yr().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1)}const Ae={UNEXPECTED_RETURN_TYPE:EV,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 wt(n,...e){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:gL,args:e}:void 0)}const gL={[Ae.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Ae.INVALID_ARGUMENT]:"Invalid argument",[Ae.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Ae.NOT_INSTALLED]:"Need to install with `app.use` function",[Ae.UNEXPECTED_ERROR]:"Unexpected error",[Ae.REQUIRED_VALUE]:"Required in value: {0}",[Ae.INVALID_VALUE]:"Invalid value",[Ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Ae.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Ae.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Ae.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},Za=nn("__translateVNode"),Qa=nn("__datetimeParts"),ec=nn("__numberParts"),kr=nn("__enableEmitter"),Io=nn("__disableEmitter"),em=nn("__setPluralRules"),tm=nn("__injectWithOption"),tc=nn("__dispose"),Ft={FALLBACK_TO_ROOT:IV,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_LEGACY_MODE:11,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:12,DUPLICATE_USE_I18N_CALLING:13},yL={[Ft.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Ft.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Ft.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Ft.DEPRECATE_LEGACY_MODE]:`Legacy API mode has been deprecated in v11. Use Composition API mode instead.
132
- About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[Ft.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead.",[Ft.DUPLICATE_USE_I18N_CALLING]:"Duplicate `useI18n` calling by local scope. Please don't call it on local scope, due to it does not work properly in component."};function jr(n,...e){return Cl(yL[n],...e)}function Do(n){if(!ye(n)||Dt(n))return n;for(const e in n)if(Kt(n,e))if(!e.includes("."))ye(n[e])&&Do(n[e]);else{const t=e.split("."),r=t.length-1;let o=n,s=!1;for(let l=0;l<r;l++){if(t[l]==="__proto__")throw new Error(`unsafe key: ${t[l]}`);if(t[l]in o||(o[t[l]]=ve()),!ye(o[t[l]])){process.env.NODE_ENV!=="production"&&tn(jr(Ft.IGNORE_OBJ_FLATTEN,{key:t[l]})),s=!0;break}o=o[t[l]]}if(s||(Dt(o)?vh.includes(t[r])||delete n[e]:(o[t[r]]=n[e],delete n[e])),!Dt(o)){const l=o[t[r]];ye(l)&&Do(l)}}return n}function nc(n,e){const{messages:t,__i18n:r,messageResolver:o,flatJson:s}=e,l=me(t)?t:De(r)?ve():{[n]:ve()};if(De(r)&&r.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:d}=a;c?(l[c]=l[c]||ve(),Sl(d,l[c])):Sl(d,l)}else Y(a)&&Sl(JSON.parse(a),l)}),o==null&&s)for(const a in l)Kt(l,a)&&Do(l[a]);return l}function nm(n){return n.type}function rm(n,e,t){let r=ye(e.messages)?e.messages:ve();"__i18nGlobal"in t&&(r=nc(n.locale.value,{messages:r,__i18n:t.__i18nGlobal}));const o=Object.keys(r);o.length&&o.forEach(s=>{n.mergeLocaleMessage(s,r[s])});{if(ye(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(l=>{n.mergeDateTimeFormat(l,e.datetimeFormats[l])})}if(ye(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(l=>{n.mergeNumberFormat(l,e.numberFormats[l])})}}}function om(n){return i.createVNode(i.Text,null,n,0)}const sm="__INTLIFY_META__",lm=()=>[],bL=()=>!1;let im=0;function am(n){return((e,t,r,o)=>n(t,r,i.getCurrentInstance()||void 0,o))}const kL=()=>{const n=i.getCurrentInstance();let e=null;return n&&(e=nm(n)[sm])?{[sm]:e}:null};function rc(n={}){const{__root:e,__injectWithOption:t}=n,r=e===void 0,o=n.flatJson,s=Wt?i.ref:i.shallowRef;let l=be(n.inheritLocale)?n.inheritLocale:!0;const a=s(e&&l?e.locale.value:Y(n.locale)?n.locale:Lo),c=s(e&&l?e.fallbackLocale.value:Y(n.fallbackLocale)||De(n.fallbackLocale)||me(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:a.value),d=s(nc(a.value,n)),u=s(me(n.datetimeFormats)?n.datetimeFormats:{[a.value]:{}}),f=s(me(n.numberFormats)?n.numberFormats:{[a.value]:{}});let p=e?e.missingWarn:be(n.missingWarn)||Fr(n.missingWarn)?n.missingWarn:!0,h=e?e.fallbackWarn:be(n.fallbackWarn)||Fr(n.fallbackWarn)?n.fallbackWarn:!0,m=e?e.fallbackRoot:be(n.fallbackRoot)?n.fallbackRoot:!0,g=!!n.fallbackFormat,y=Ne(n.missing)?n.missing:null,b=Ne(n.missing)?am(n.missing):null,k=Ne(n.postTranslation)?n.postTranslation:null,E=e?e.warnHtmlMessage:be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,x=!!n.escapeParameter;const C=e?e.modifiers:me(n.modifiers)?n.modifiers:{};let S=n.pluralRules||e&&e.pluralRules,w;w=(()=>{r&&Dh(null);const O={version:hL,locale:a.value,fallbackLocale:c.value,messages:d.value,modifiers:C,pluralRules:S,missing:b===null?void 0:b,missingWarn:p,fallbackWarn:h,fallbackFormat:g,unresolving:!0,postTranslation:k===null?void 0:k,warnHtmlMessage:E,escapeParameter:x,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};O.datetimeFormats=u.value,O.numberFormats=f.value,O.__datetimeFormatters=me(w)?w.__datetimeFormatters:void 0,O.__numberFormatters=me(w)?w.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(O.__v_emitter=me(w)?w.__v_emitter:void 0);const H=WV(O);return r&&Dh(H),H})(),Oo(w,a.value,c.value);function D(){return[a.value,c.value,d.value,u.value,f.value]}const R=i.computed({get:()=>a.value,set:O=>{w.locale=O,a.value=O}}),A=i.computed({get:()=>c.value,set:O=>{w.fallbackLocale=O,c.value=O,Oo(w,a.value,O)}}),B=i.computed(()=>d.value),W=i.computed(()=>u.value),Q=i.computed(()=>f.value);function I(){return Ne(k)?k:null}function z(O){k=O,w.postTranslation=O}function K(){return y}function ee(O){O!==null&&(b=am(O)),y=O,w.missing=b}function re(O,H){return O!=="translate"||!H.resolvedMessage}const xe=(O,H,he,v,M,U)=>{D();let G;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(w.fallbackContext=e?UV():void 0),G=O(w)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(w.fallbackContext=void 0)}if(he!=="translate exists"&&je(G)&&G===Tl||he==="translate exists"&&!G){const[Z,fe]=H();if(process.env.NODE_ENV!=="production"&&e&&Y(Z)&&re(he,fe)&&(m&&(Bl(h,Z)||Fh(p,Z))&&tn(jr(Ft.FALLBACK_TO_ROOT,{key:Z,type:he})),process.env.NODE_ENV!=="production")){const{__v_emitter:V}=w;V&&m&&V.emit("fallback",{type:he,key:Z,to:"global",groupId:`${he}:${Z}`})}return e&&m?v(e):M(Z)}else{if(U(G))return G;throw wt(Ae.UNEXPECTED_RETURN_TYPE)}};function Ze(...O){return xe(H=>Reflect.apply(Yh,null,[H,...O]),()=>Ya(...O),"translate",H=>Reflect.apply(H.t,H,[...O]),H=>H,H=>Y(H))}function ht(...O){const[H,he,v]=O;if(v&&!ye(v))throw wt(Ae.INVALID_ARGUMENT);return Ze(H,he,We({resolvedMessage:!0},v||{}))}function mt(...O){return xe(H=>Reflect.apply(Hh,null,[H,...O]),()=>Ga(...O),"datetime format",H=>Reflect.apply(H.d,H,[...O]),()=>Al,H=>Y(H)||De(H))}function Ke(...O){return xe(H=>Reflect.apply(Wh,null,[H,...O]),()=>Ja(...O),"number format",H=>Reflect.apply(H.n,H,[...O]),()=>Al,H=>Y(H)||De(H))}function gt(O){return O.map(H=>Y(H)||je(H)||be(H)?om(String(H)):H)}const Cn={normalize:gt,interpolate:O=>O,type:"vnode"};function vn(...O){return xe(H=>{let he;const v=H;try{v.processor=Cn,he=Reflect.apply(Yh,null,[v,...O])}finally{v.processor=null}return he},()=>Ya(...O),"translate",H=>H[Za](...O),H=>[om(H)],H=>De(H))}function xr(...O){return xe(H=>Reflect.apply(Wh,null,[H,...O]),()=>Ja(...O),"number format",H=>H[ec](...O),lm,H=>Y(H)||De(H))}function yt(...O){return xe(H=>Reflect.apply(Hh,null,[H,...O]),()=>Ga(...O),"datetime format",H=>H[Qa](...O),lm,H=>Y(H)||De(H))}function Pt(O){S=O,w.pluralRules=S}function cn(O,H){return xe(()=>{if(!O)return!1;const he=Y(H)?H:a.value,v=qt(he),M=w.messageResolver(v,O);return Dt(M)||Rt(M)||Y(M)},()=>[O],"translate exists",he=>Reflect.apply(he.te,he,[O,H]),bL,he=>be(he))}function qe(O){let H=null;const he=Nh(w,c.value,a.value);for(let v=0;v<he.length;v++){const M=d.value[he[v]]||{},U=w.messageResolver(M,O);if(U!=null){H=U;break}}return H}function $t(O){const H=qe(O);return H??(e?e.tm(O)||{}:{})}function qt(O){return d.value[O]||{}}function dn(O,H){if(o){const he={[O]:H};for(const v in he)Kt(he,v)&&Do(he[v]);H=he[O]}d.value[O]=H,w.messages=d.value}function Xn(O,H){d.value[O]=d.value[O]||{};const he={[O]:H};if(o)for(const v in he)Kt(he,v)&&Do(he[v]);H=he[O],Sl(H,d.value[O]),w.messages=d.value}function _(O){return u.value[O]||{}}function N(O,H){u.value[O]=H,w.datetimeFormats=u.value,Uh(w,O,H)}function P(O,H){u.value[O]=We(u.value[O]||{},H),w.datetimeFormats=u.value,Uh(w,O,H)}function X(O){return f.value[O]||{}}function Ee(O,H){f.value[O]=H,w.numberFormats=f.value,qh(w,O,H)}function Be(O,H){f.value[O]=We(f.value[O]||{},H),w.numberFormats=f.value,qh(w,O,H)}im++,e&&Wt&&(i.watch(e.locale,O=>{l&&(a.value=O,w.locale=O,Oo(w,a.value,c.value))}),i.watch(e.fallbackLocale,O=>{l&&(c.value=O,w.fallbackLocale=O,Oo(w,a.value,c.value))}));const pe={id:im,locale:R,fallbackLocale:A,get inheritLocale(){return l},set inheritLocale(O){l=O,O&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,Oo(w,a.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:B,get modifiers(){return C},get pluralRules(){return S||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(O){p=O,w.missingWarn=p},get fallbackWarn(){return h},set fallbackWarn(O){h=O,w.fallbackWarn=h},get fallbackRoot(){return m},set fallbackRoot(O){m=O},get fallbackFormat(){return g},set fallbackFormat(O){g=O,w.fallbackFormat=g},get warnHtmlMessage(){return E},set warnHtmlMessage(O){E=O,w.warnHtmlMessage=O},get escapeParameter(){return x},set escapeParameter(O){x=O,w.escapeParameter=O},t:Ze,getLocaleMessage:qt,setLocaleMessage:dn,mergeLocaleMessage:Xn,getPostTranslationHandler:I,setPostTranslationHandler:z,getMissingHandler:K,setMissingHandler:ee,[em]:Pt};return pe.datetimeFormats=W,pe.numberFormats=Q,pe.rt=ht,pe.te=cn,pe.tm=$t,pe.d=mt,pe.n=Ke,pe.getDateTimeFormat=_,pe.setDateTimeFormat=N,pe.mergeDateTimeFormat=P,pe.getNumberFormat=X,pe.setNumberFormat=Ee,pe.mergeNumberFormat=Be,pe[tm]=t,pe[Za]=vn,pe[Qa]=yt,pe[ec]=xr,process.env.NODE_ENV!=="production"&&(pe[kr]=O=>{w.__v_emitter=O},pe[Io]=()=>{w.__v_emitter=void 0}),pe}const cm="vue-i18n: composer properties",oc={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},xL={"vue-i18n-resource-inspector":"Search for scopes ..."},wL={"vue-i18n-timeline":16764185};let sc;async function EL(n,e){return new Promise((t,r)=>{try{pL({id:"vue-devtools-plugin-vue-i18n",label:oc["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:[cm],app:n},o=>{sc=o,o.on.visitComponentTree(({componentInstance:l,treeNode:a})=>{CL(l,a,e)}),o.on.inspectComponent(({componentInstance:l,instanceData:a})=>{l.vnode.el&&l.vnode.el.__VUE_I18N__&&a&&(e.mode==="legacy"?l.vnode.el.__VUE_I18N__!==e.global.__composer&&um(a,l.vnode.el.__VUE_I18N__):um(a,l.vnode.el.__VUE_I18N__))}),o.addInspector({id:"vue-i18n-resource-inspector",label:oc["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:xL["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&ML(l,e)});const s=new Map;o.on.getInspectorState(async l=>{if(l.app===n&&l.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),AL(l,e),l.nodeId==="global"){if(!s.has(l.app)){const[a]=await o.getComponentInstances(l.app);s.set(l.app,a)}o.highlightElement(s.get(l.app))}else{const a=TL(l.nodeId,e);a&&o.highlightElement(a)}}),o.on.editInspectorState(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&VL(l,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:oc["vue-i18n-timeline"],color:wL["vue-i18n-timeline"]}),t(!0)})}catch(o){console.error(o),r(!1)}})}function dm(n){return n.type.name||n.type.displayName||n.type.__file||"Anonymous"}function CL(n,e,t){const r=t.mode==="composition"?t.global:t.global.__composer;if(n&&n.vnode.el&&n.vnode.el.__VUE_I18N__&&n.vnode.el.__VUE_I18N__!==r){const o={label:`i18n (${dm(n)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function um(n,e){const t=cm;n.state.push({type:t,key:"locale",editable:!0,value:e.locale.value}),n.state.push({type:t,key:"availableLocales",editable:!1,value:e.availableLocales}),n.state.push({type:t,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),n.state.push({type:t,key:"inheritLocale",editable:!0,value:e.inheritLocale}),n.state.push({type:t,key:"messages",editable:!1,value:lc(e.messages.value)}),n.state.push({type:t,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),n.state.push({type:t,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function lc(n){const e={};return Object.keys(n).forEach(t=>{const r=n[t];Ne(r)&&"source"in r?e[t]=NL(r):Dt(r)&&r.loc&&r.loc.source?e[t]=r.loc.source:ye(r)?e[t]=lc(r):e[t]=r}),e}const vL={"<":"&lt;",">":"&gt;",'"':"&quot;","&":"&amp;"};function _L(n){return n.replace(/[<>"&]/g,SL)}function SL(n){return vL[n]||n}function NL(n){return{_custom:{type:"function",display:`<span>ƒ</span> ${n.source?`("${_L(n.source)}")`:"(?)"}`}}}function ML(n,e){n.rootNodes.push({id:"global",label:"Global Scope"});const t=e.mode==="composition"?e.global:e.global.__composer;for(const[r,o]of e.__instances){const s=e.mode==="composition"?o:o.__composer;t!==s&&n.rootNodes.push({id:s.id.toString(),label:`${dm(r)} Scope`})}}function TL(n,e){let t=null;if(n!=="global"){for(const[r,o]of e.__instances.entries())if(o.id.toString()===n){t=r;break}}return t}function fm(n,e){if(n==="global")return e.mode==="composition"?e.global:e.global.__composer;{const t=Array.from(e.__instances.values()).find(r=>r.id.toString()===n);return t?e.mode==="composition"?t:t.__composer:null}}function AL(n,e){const t=fm(n.nodeId,e);return t&&(n.state=BL(t)),null}function BL(n){const e={},t="Locale related info",r=[{type:t,key:"locale",editable:!0,value:n.locale.value},{type:t,key:"fallbackLocale",editable:!0,value:n.fallbackLocale.value},{type:t,key:"availableLocales",editable:!1,value:n.availableLocales},{type:t,key:"inheritLocale",editable:!0,value:n.inheritLocale}];e[t]=r;const o="Locale messages info",s=[{type:o,key:"messages",editable:!1,value:lc(n.messages.value)}];e[o]=s;{const l="Datetime formats info",a=[{type:l,key:"datetimeFormats",editable:!1,value:n.datetimeFormats.value}];e[l]=a;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:n.numberFormats.value}];e[c]=d}return e}function Ro(n,e){if(sc){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),sc.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:n,groupId:t,time:Date.now(),meta:{},data:e||{},logType:n==="compile-error"?"error":n==="fallback"||n==="missing"?"warning":"default"}})}}function VL(n,e){const t=fm(n.nodeId,e);if(t){const[r]=n.path;r==="locale"&&Y(n.state.value)?t.locale.value=n.state.value:r==="fallbackLocale"&&(Y(n.state.value)||De(n.state.value)||ye(n.state.value))?t.fallbackLocale.value=n.state.value:r==="inheritLocale"&&be(n.state.value)&&(t.inheritLocale=n.state.value)}}function LL(n){const e=Y(n.locale)?n.locale:Lo,t=Y(n.fallbackLocale)||De(n.fallbackLocale)||me(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:e,r=Ne(n.missing)?n.missing:void 0,o=be(n.silentTranslationWarn)||Fr(n.silentTranslationWarn)?!n.silentTranslationWarn:!0,s=be(n.silentFallbackWarn)||Fr(n.silentFallbackWarn)?!n.silentFallbackWarn:!0,l=be(n.fallbackRoot)?n.fallbackRoot:!0,a=!!n.formatFallbackMessages,c=me(n.modifiers)?n.modifiers:{},d=n.pluralizationRules,u=Ne(n.postTranslation)?n.postTranslation:void 0,f=Y(n.warnHtmlInMessage)?n.warnHtmlInMessage!=="off":!0,p=!!n.escapeParameterHtml,h=be(n.sync)?n.sync:!0;let m=n.messages;if(me(n.sharedMessages)){const C=n.sharedMessages;m=Object.keys(C).reduce((w,T)=>{const D=w[T]||(w[T]={});return We(D,C[T]),w},m||{})}const{__i18n:g,__root:y,__injectWithOption:b}=n,k=n.datetimeFormats,E=n.numberFormats,x=n.flatJson;return{locale:e,fallbackLocale:t,messages:m,flatJson:x,datetimeFormats:k,numberFormats:E,missing:r,missingWarn:o,fallbackWarn:s,fallbackRoot:l,fallbackFormat:a,modifiers:c,pluralRules:d,postTranslation:u,warnHtmlMessage:f,escapeParameter:p,messageResolver:n.messageResolver,inheritLocale:h,__i18n:g,__root:y,__injectWithOption:b}}function ic(n={}){const e=rc(LL(n)),{__extender:t}=n,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 be(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(o){e.missingWarn=be(o)?!o:o},get silentFallbackWarn(){return be(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(o){e.fallbackWarn=be(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])},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=t,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=o=>{const s=e;s[kr]&&s[kr](o)},r.__disableEmitter=()=>{const o=e;o[Io]&&o[Io]()}),r}function OL(n,e,t){return{beforeCreate(){const r=i.getCurrentInstance();if(!r)throw wt(Ae.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=pm(n,s);else{s.__injectWithOption=!0,s.__extender=t.__vueI18nExtend,this.$i18n=ic(s);const l=this.$i18n;l.__extender&&(l.__disposer=l.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=pm(n,o);else{this.$i18n=ic({__i18n:o.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=n;o.__i18nGlobal&&rm(e,o,o),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$te=(s,l)=>this.$i18n.te(s,l),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),t.__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=Fa();r.__enableEmitter&&r.__enableEmitter(o),o.on("*",Ro)}},unmounted(){const r=i.getCurrentInstance();if(!r)throw wt(Ae.UNEXPECTED_ERROR);const o=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",Ro),delete this.__v_emitter),this.$i18n&&(o.__disableEmitter&&o.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),t.__deleteInstance(r),delete this.$i18n}}}function pm(n,e){n.locale=e.locale||n.locale,n.fallbackLocale=e.fallbackLocale||n.fallbackLocale,n.missing=e.missing||n.missing,n.silentTranslationWarn=e.silentTranslationWarn||n.silentFallbackWarn,n.silentFallbackWarn=e.silentFallbackWarn||n.silentFallbackWarn,n.formatFallbackMessages=e.formatFallbackMessages||n.formatFallbackMessages,n.postTranslation=e.postTranslation||n.postTranslation,n.warnHtmlInMessage=e.warnHtmlInMessage||n.warnHtmlInMessage,n.escapeParameterHtml=e.escapeParameterHtml||n.escapeParameterHtml,n.sync=e.sync||n.sync,n.__composer[em](e.pluralizationRules||n.pluralizationRules);const t=nc(n.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(r=>n.mergeLocaleMessage(r,t[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>n.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>n.mergeNumberFormat(r,e.numberFormats[r])),n}const ac={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function IL({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((r,o)=>[...r,...o.type===i.Fragment?o.children:[o]],[]):e.reduce((t,r)=>{const o=n[r];return o&&(t[r]=o()),t},ve())}function hm(){return i.Fragment}const mm=i.defineComponent({name:"i18n-t",props:We({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>je(n)||!isNaN(n)}},ac),setup(n,e){const{slots:t,attrs:r}=e,o=n.i18n||cc({useScope:n.scope,__useComponent:!0});return()=>{const s=Object.keys(t).filter(f=>f[0]!=="_"),l=ve();n.locale&&(l.locale=n.locale),n.plural!==void 0&&(l.plural=Y(n.plural)?+n.plural:n.plural);const a=IL(e,s),c=o[Za](n.keypath,a,l),d=We(ve(),r),u=Y(n.tag)||ye(n.tag)?n.tag:hm();return i.h(u,d,c)}}});function DL(n){return De(n)&&!Y(n[0])}function gm(n,e,t,r){const{slots:o,attrs:s}=e;return()=>{const l={part:!0};let a=ve();n.locale&&(l.locale=n.locale),Y(n.format)?l.key=n.format:ye(n.format)&&(Y(n.format.key)&&(l.key=n.format.key),a=Object.keys(n.format).reduce((p,h)=>t.includes(h)?We(ve(),p,{[h]:n.format[h]}):p,ve()));const c=r(n.value,l,a);let d=[l.key];De(c)?d=c.map((p,h)=>{const m=o[p.type],g=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return DL(g)&&(g[0].key=`${p.type}-${h}`),g}):Y(c)&&(d=[c]);const u=We(ve(),s),f=Y(n.tag)||ye(n.tag)?n.tag:hm();return i.h(f,u,d)}}const ym=i.defineComponent({name:"i18n-n",props:We({value:{type:Number,required:!0},format:{type:[String,Object]}},ac),setup(n,e){const t=n.i18n||cc({useScope:n.scope,__useComponent:!0});return gm(n,e,Kh,(...r)=>t[ec](...r))}});function RL(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const r=t.__getInstance(e);return r!=null?r.__composer:n.global.__composer}}function FL(n){const e=l=>{process.env.NODE_ENV!=="production"&&Ia(jr(Ft.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:a,value:c}=l;if(!a||!a.$)throw wt(Ae.UNEXPECTED_ERROR);const d=RL(n,a.$),u=bm(c);return[Reflect.apply(d.t,d,[...km(u)]),d]};return{created:(l,a)=>{const[c,d]=e(a);Wt&&n.global===d&&(l.__i18nWatcher=i.watch(d.locale,()=>{a.instance&&a.instance.$forceUpdate()})),l.__composer=d,l.textContent=c},unmounted:l=>{Wt&&l.__i18nWatcher&&(l.__i18nWatcher(),l.__i18nWatcher=void 0,delete l.__i18nWatcher),l.__composer&&(l.__composer=void 0,delete l.__composer)},beforeUpdate:(l,{value:a})=>{if(l.__composer){const c=l.__composer,d=bm(a);l.textContent=Reflect.apply(c.t,c,[...km(d)])}},getSSRProps:l=>{const[a]=e(l);return{textContent:a}}}}function bm(n){if(Y(n))return{path:n};if(me(n)){if(!("path"in n))throw wt(Ae.REQUIRED_VALUE,"path");return n}else throw wt(Ae.INVALID_VALUE)}function km(n){const{path:e,locale:t,args:r,choice:o,plural:s}=n,l={},a=r||{};return Y(t)&&(l.locale=t),je(o)&&(l.plural=o),je(s)&&(l.plural=s),[e,a,l]}function PL(n,e,...t){const r=me(t[0])?t[0]:{};(be(r.globalInstall)?r.globalInstall:!0)&&([mm.name,"I18nT"].forEach(s=>n.component(s,mm)),[ym.name,"I18nN"].forEach(s=>n.component(s,ym)),[wm.name,"I18nD"].forEach(s=>n.component(s,wm))),n.directive("t",FL(e))}const $L=nn("global-vue-i18n");function zL(n={}){const e=__VUE_I18N_LEGACY_API__&&be(n.legacy)?n.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&Ia(jr(Ft.DEPRECATE_LEGACY_MODE));const t=be(n.globalInjection)?n.globalInjection:!0,r=new Map,[o,s]=HL(n,e),l=nn(process.env.NODE_ENV!=="production"?"vue-i18n":"");function a(f){return r.get(f)||null}function c(f,p){r.set(f,p)}function d(f){r.delete(f)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(f,...p){if(process.env.NODE_ENV!=="production"&&(f.__VUE_I18N__=u),f.__VUE_I18N_SYMBOL__=l,f.provide(f.__VUE_I18N_SYMBOL__,u),me(p[0])){const g=p[0];u.__composerExtend=g.__composerExtend,u.__vueI18nExtend=g.__vueI18nExtend}let h=null;!e&&t&&(h=YL(f,u.global)),__VUE_I18N_FULL_INSTALL__&&PL(f,u,...p),__VUE_I18N_LEGACY_API__&&e&&f.mixin(OL(s,s.__composer,u));const m=f.unmount;if(f.unmount=()=>{h&&h(),u.dispose(),m()},process.env.NODE_ENV!=="production"){if(!await EL(f,u))throw wt(Ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const y=Fa();if(e){const b=s;b.__enableEmitter&&b.__enableEmitter(y)}else{const b=s;b[kr]&&b[kr](y)}y.on("*",Ro)}},get global(){return s},dispose(){o.stop()},__instances:r,__getInstance:a,__setInstance:c,__deleteInstance:d};return u}function cc(n={}){const e=i.getCurrentInstance();if(e==null)throw wt(Ae.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw wt(Ae.NOT_INSTALLED);const t=jL(e),r=WL(t),o=nm(e),s=UL(n,o);if(s==="global")return rm(r,n,o),r;if(s==="parent"){let c=KL(t,e,n.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&tn(jr(Ft.NOT_FOUND_PARENT_SCOPE)),c=r),c}const l=t;let a=l.__getInstance(e);if(a==null){const c=We({},n);"__i18n"in o&&(c.__i18n=o.__i18n),r&&(c.__root=r),a=rc(c),l.__composerExtend&&(a[tc]=l.__composerExtend(a)),GL(l,e,a),l.__setInstance(e,a)}else process.env.NODE_ENV!=="production"&&s==="local"&&tn(jr(Ft.DUPLICATE_USE_I18N_CALLING));return a}function HL(n,e){const t=i.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?t.run(()=>ic(n)):t.run(()=>rc(n));if(r==null)throw wt(Ae.UNEXPECTED_ERROR);return[t,r]}function jL(n){const e=i.inject(n.isCE?$L:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw wt(n.isCE?Ae.NOT_INSTALLED_WITH_PROVIDE:Ae.UNEXPECTED_ERROR);return e}function UL(n,e){return vl(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function WL(n){return n.mode==="composition"?n.global:n.global.__composer}function KL(n,e,t=!1){let r=null;const o=e.root;let s=qL(e,t);for(;s!=null;){const l=n;if(n.mode==="composition")r=l.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const a=l.__getInstance(s);a!=null&&(r=a.__composer,t&&r&&!r[tm]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function qL(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function GL(n,e,t){let r=null;i.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=t,r=Fa();const o=t;o[kr]&&o[kr](r),r.on("*",Ro)}},e),i.onUnmounted(()=>{const o=t;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",Ro),o[Io]&&o[Io](),delete e.vnode.el.__VUE_I18N__),n.__deleteInstance(e);const s=o[tc];s&&(s(),delete o[tc])},e)}const JL=["locale","fallbackLocale","availableLocales"],xm=["t","rt","d","n","tm","te"];function YL(n,e){const t=Object.create(null);return JL.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw wt(Ae.UNEXPECTED_ERROR);const l=i.isRef(s.value)?{get(){return s.value.value},set(a){s.value.value=a}}:{get(){return s.get&&s.get()}};Object.defineProperty(t,o,l)}),n.config.globalProperties.$i18n=t,xm.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw wt(Ae.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${o}`,s)}),()=>{delete n.config.globalProperties.$i18n,xm.forEach(o=>{delete n.config.globalProperties[`$${o}`]})}}const wm=i.defineComponent({name:"i18n-d",props:We({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},ac),setup(n,e){const t=n.i18n||cc({useScope:n.scope,__useComponent:!0});return gm(n,e,jh,(...r)=>t[Qa](...r))}});if(mL(),PV(yV),$V(OV),zV(Nh),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const n=yr();n.__INTLIFY__=!0,bV(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const XL={},ZL={},QL={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",linkTitle:"Enter Link",create:"Create",cancel:"Cancel"},eO={paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",linkTitle:"Введіть посилання",create:"Створити",cancel:"Скасувати"},dc=zL({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...XL,tiptap:QL},uk:{...ZL,tiptap:eO}}}),tO={install:(n,e={})=>{if(e.i18nConfig){const t=e.i18nConfig,r=dc.global?.messages?.value||dc.messages;r&&t.global?.messages?.value&&Object.keys(r).forEach(o=>{t.global.mergeLocaleMessage?t.global.mergeLocaleMessage(o,r[o]):t.global.setLocaleMessage(o,r[o])})}else n.use(dc);n.component("vs-richtext",El),n.component("vs-richtext-md",El),n.component("vs-richtext-page",lh)}};function Jn(n){return typeof n=="string"||n instanceof String}function Em(n){var e;return typeof n=="object"&&n!=null&&(n==null||(e=n.constructor)==null?void 0:e.name)==="Object"}function Cm(n,e){return Array.isArray(e)?Cm(n,(t,r)=>e.includes(r)):Object.entries(n).reduce((t,r)=>{let[o,s]=r;return e(s,o)&&(t[o]=s),t},{})}const te={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function vm(n){switch(n){case te.LEFT:return te.FORCE_LEFT;case te.RIGHT:return te.FORCE_RIGHT;default:return n}}function uc(n){return n.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Vl(n,e){if(e===n)return!0;const t=Array.isArray(e),r=Array.isArray(n);let o;if(t&&r){if(e.length!=n.length)return!1;for(o=0;o<e.length;o++)if(!Vl(e[o],n[o]))return!1;return!0}if(t!=r)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){const s=e instanceof Date,l=n instanceof Date;if(s&&l)return e.getTime()==n.getTime();if(s!=l)return!1;const a=e instanceof RegExp,c=n instanceof RegExp;if(a&&c)return e.toString()==n.toString();if(a!=c)return!1;const d=Object.keys(e);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(n,d[o]))return!1;for(o=0;o<d.length;o++)if(!Vl(n[d[o]],e[d[o]]))return!1;return!0}else if(e&&n&&typeof e=="function"&&typeof n=="function")return e.toString()===n.toString();return!1}class nO{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?te.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?te.RIGHT:te.LEFT}}function ce(n,e){return new ce.InputMask(n,e)}function _m(n){if(n==null)throw new Error("mask property should be defined");return n instanceof RegExp?ce.MaskedRegExp:Jn(n)?ce.MaskedPattern:n===Date?ce.MaskedDate:n===Number?ce.MaskedNumber:Array.isArray(n)||n===Array?ce.MaskedDynamic:ce.Masked&&n.prototype instanceof ce.Masked?n:ce.Masked&&n instanceof ce.Masked?n.constructor:n instanceof Function?ce.MaskedFunction:(console.warn("Mask not found for mask",n),ce.Masked)}function Ur(n){if(!n)throw new Error("Options in not defined");if(ce.Masked){if(n.prototype instanceof ce.Masked)return{mask:n};const{mask:e=void 0,...t}=n instanceof ce.Masked?{mask:n}:Em(n)&&n.mask instanceof ce.Masked?n:{};if(e){const r=e.mask;return{...Cm(e,(o,s)=>!s.startsWith("_")),mask:e.constructor,_mask:r,...t}}}return Em(n)?{...n}:{mask:n}}function sn(n){if(ce.Masked&&n instanceof ce.Masked)return n;const e=Ur(n),t=_m(e.mask);if(!t)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===t&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new t(e)}ce.createMask=sn;class Ll{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,t){if(!(e==null||t==null||e===this.selectionStart&&t===this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}ce.MaskElement=Ll;const Sm=90,rO=89;class Fo extends Ll{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,r;return(e=(t=(r=this.input).getRootNode)==null?void 0:t.call(r))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===Sm&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===rO&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===Sm&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}ce.HTMLMaskElement=Fo;class Nm extends Fo{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}ce.HTMLMaskElement=Fo;class fc extends Fo{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||r==null||r<o?r:o}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||r==null||r>o?r:o}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,t);const o=this.rootElement,s=o.getSelection&&o.getSelection();s&&(s.removeAllRanges(),s.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}ce.HTMLContenteditableMaskElement=fc;class Ol{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>Ol.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ol.MAX_LENGTH=100;class Mm{constructor(e,t){this.el=e instanceof Ll?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new fc(e):new Nm(e),this.masked=sn(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ol,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return e==null||((t=this.masked)==null?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof ce.Masked)&&this.masked.constructor===_m(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof ce.Masked?e:sn({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const r=this._listeners[e];r&&r.forEach(o=>o(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,r=this.masked.value,o=this.masked.rawInputValue,s=this.displayValue,l=this.unmaskedValue!==t||this.value!==r||this._rawInputValue!==o;this._unmaskedValue=t,this._value=r,this._rawInputValue=o,this.el.value!==s&&(this.el.value=s),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),l&&this._fireChangeEvents(),!this._historyChanging&&(l||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...r}=e,o=!this.maskEquals(t),s=this.masked.optionsIsChanged(r);o&&(this.mask=t),s&&this.masked.updateOptions(r),(o||s)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,te.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const r=this._listeners[e].indexOf(t);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new nO({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,o=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,s=r===this.masked.rawInputValue?t.removeDirection:te.NONE;let l=this.masked.nearestInputPos(t.startChangePos+o,s);s!==te.NONE&&(l=this.masked.nearestInputPos(l,te.NONE)),this.updateControl(l),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}ce.InputMask=Mm;class de{static normalize(e){return Array.isArray(e)?e:[e,new de]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}ce.ChangeDetails=de;class ln{constructor(e,t,r){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=r}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class rt{constructor(e){this._value="",this._update({...rt.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){t===void 0&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ln(this.extractInput(e,t),e)}appendTail(e){return Jn(e)&&(e=new ln(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new de({inserted:e,rawInserted:e})):new de}_appendChar(e,t,r){t===void 0&&(t={});const o=this.state;let s;if([e,s]=this.doPrepareChar(e,t),e&&(s=s.aggregate(this._appendCharRaw(e,t)),!s.rawInserted&&this.autofix==="pad")){const l=this.state;this.state=o;let a=this.pad(t);const c=this._appendCharRaw(e,t);a=a.aggregate(c),c.rawInserted||a.equals(s)?s=a:this.state=l}if(s.inserted){let l,a=this.doValidate(t)!==!1;if(a&&r!=null){const c=this.state;if(this.overwrite===!0){l=r.state;for(let u=0;u<s.rawInserted.length;++u)r.unshift(this.displayValue.length-s.tailShift)}let d=this.appendTail(r);if(a=d.rawInserted.length===r.toString().length,!(a&&d.inserted)&&this.overwrite==="shift"){this.state=c,l=r.state;for(let u=0;u<s.rawInserted.length;++u)r.shift();d=this.appendTail(r),a=d.rawInserted.length===r.toString().length}a&&d.inserted&&(this.state=c)}a||(s=new de,this.state=o,r&&l&&(r.state=l))}return s}_appendPlaceholder(){return new de}_appendEager(){return new de}append(e,t,r){if(!Jn(e))throw new Error("value should be string");const o=Jn(r)?new ln(String(r)):r;t!=null&&t.tail&&(t._beforeTailState=this.state);let s;[e,s]=this.doPrepare(e,t);for(let l=0;l<e.length;++l){const a=this._appendChar(e[l],t,o);if(!a.rawInserted&&!this.doSkipInvalid(e[l],t,o))break;s.aggregate(a)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&s.aggregate(this._appendEager()),o!=null&&(s.tailShift+=this.appendTail(o).tailShift),s}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new de}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,r=this.value,o=e();return this.rawInputValue=t,this.value&&this.value!==r&&r.indexOf(this.value)===0&&(this.append(r.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,r=e(this);return this.state=t,delete this._isolated,r}doSkipInvalid(e,t,r){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),de.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),de.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,r,o,s){r===void 0&&(r=""),o===void 0&&(o=te.NONE),s===void 0&&(s={input:!0});const l=e+t,a=this.extractTail(l),c=this.eager===!0||this.eager==="remove";let d;c&&(o=vm(o),d=this.extractInput(0,l,{raw:!0}));let u=e;const f=new de;if(o!==te.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!c?te.NONE:o),f.tailShift=u-e),f.aggregate(this.remove(u)),c&&o!==te.NONE&&d===this.rawInputValue)if(o===te.FORCE_LEFT){let p;for(;d===this.rawInputValue&&(p=this.displayValue.length);)f.aggregate(new de({tailShift:-1})).aggregate(this.remove(p-1))}else o===te.FORCE_RIGHT&&a.unshift();return f.aggregate(this.append(r,s,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Vl(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||rt.EMPTY_VALUES.includes(e)&&rt.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}rt.DEFAULTS={skipInvalid:!0},rt.EMPTY_VALUES=[void 0,null,""],ce.Masked=rt;class Yn{constructor(e,t){e===void 0&&(e=[]),t===void 0&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=Jn(e)?new ln(String(e)):e;const t=this.chunks[this.chunks.length-1],r=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof ln)r?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof Yn){if(e.stop==null){let o;for(;e.chunks.length&&e.chunks[0].stop==null;)o=e.chunks.shift(),o.from+=e.from,this.extend(o)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof ce.MaskedPattern))return new ln(this.toString()).appendTo(e);const t=new de;for(let r=0;r<this.chunks.length;++r){const o=this.chunks[r],s=e._mapPosToBlock(e.displayValue.length),l=o.stop;let a;if(l!=null&&(!s||s.index<=l)&&((o instanceof Yn||e._stops.indexOf(l)>=0)&&t.aggregate(e._appendPlaceholder(l)),a=o instanceof Yn&&e._blocks[l]),a){const c=a.appendTail(o);t.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&t.aggregate(e.append(d,{tail:!0}))}else t.aggregate(e.append(o.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...r}=e;Object.assign(this,r),this.chunks=t.map(o=>{const s="chunks"in o?new Yn:new ln;return s.state=o,s})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let r=0;for(;r<this.chunks.length;){const o=this.chunks[r],s=o.unshift(t);if(o.toString()){if(!s)break;++r}else this.chunks.splice(r,1);if(s)return s}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],r=t.shift();if(t.toString()){if(!r)break;--e}else this.chunks.splice(e,1);if(r)return r}return""}}class oO{constructor(e,t){this.masked=e,this._log=[];const{offset:r,index:o}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((t=this.block)==null?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,te.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,te.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,te.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,te.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,te.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,te.NONE),!0})}}class pc{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new de}nearestInputPos(e,t){t===void 0&&(t=te.NONE);const r=0,o=this._value.length;switch(t){case te.LEFT:case te.FORCE_LEFT:return r;case te.NONE:case te.RIGHT:case te.FORCE_RIGHT:default:return o}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),r===void 0&&(r={}),r.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new de;const r=this.eager===!0||this.eager==="append",o=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!r)&&!t.tail,s=new de({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(t.raw||t.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new de;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ln("")}appendTail(e){return Jn(e)&&(e=new ln(String(e))),e.appendTo(this)}append(e,t,r){const o=this._appendChar(e[0],t);return r!=null&&(o.tailShift+=this.appendTail(r).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class Po{constructor(e){const{parent:t,isOptional:r,placeholderChar:o,displayChar:s,lazy:l,eager:a,...c}=e;this.masked=sn(c),Object.assign(this,{parent:t,isOptional:r,placeholderChar:o,displayChar:s,lazy:l,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),e===0&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new de}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new de;const r=this.masked.state;let o=this.masked._appendChar(e,this.currentMaskFlags(t));return o.inserted&&this.doValidate(t)===!1&&(o=new de,this.masked.state=r),!o.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(e,t,r){return this.masked.append(e,this.currentMaskFlags(t),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,r)}nearestInputPos(e,t){t===void 0&&(t=te.NONE);const r=0,o=this.value.length,s=Math.min(Math.max(e,r),o);switch(t){case te.LEFT:case te.FORCE_LEFT:return this.isComplete?s:r;case te.RIGHT:case te.FORCE_RIGHT:return this.isComplete?s:o;case te.NONE:default:return s}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(e==null||(t=e._beforeTailState)==null?void 0:t.masked)||e?._beforeTailState}}pad(e){return new de}}Po.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class Tm extends rt{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=r=>r.search(t)>=0),super._update(e)}}ce.MaskedRegExp=Tm;class ot extends rt{constructor(e){super({...ot.DEFAULTS,...e,definitions:Object.assign({},Po.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let r=!1,o=!1;for(let s=0;s<t.length;++s){if(this.blocks){const d=t.slice(s),u=Object.keys(this.blocks).filter(p=>d.indexOf(p)===0);u.sort((p,h)=>h.length-p.length);const f=u[0];if(f){const{expose:p,repeat:h,...m}=Ur(this.blocks[f]),g={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:h,parent:this},y=h!=null?new ce.RepeatBlock(g):sn(g);y&&(this._blocks.push(y),p&&(this.exposeBlock=y),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),s+=f.length-1;continue}}let l=t[s],a=l in e;if(l===ot.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(l==="{"||l==="}"){r=!r;continue}if(l==="["||l==="]"){o=!o;continue}if(l===ot.ESCAPE_CHAR){if(++s,l=t[s],!l)break;a=!1}const c=a?new Po({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ur(e[l]),parent:this}):new pc({char:l,eager:this.eager,isUnmasking:r});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...r}=e;this._blocks.forEach((o,s)=>o.state=t[s]),super.state=r}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+=t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+=t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+=t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new de;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return t;this._blocks[r].isFilled&&++r;for(let o=r;o<this._blocks.length;++o){const s=this._blocks[o]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._mapPosToBlock(this.displayValue.length),o=new de;if(!r)return o;for(let l=r.index,a;a=this._blocks[l];++l){var s;const c=a._appendChar(e,{...t,_beforeTailState:(s=t._beforeTailState)==null||(s=s._blocks)==null?void 0:s[l]});if(o.aggregate(c),c.consumed)break}return o}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=new Yn;return e===t||this._forEachBlocksInRange(e,t,(o,s,l,a)=>{const c=o.extractTail(l,a);c.stop=this._findStopBefore(s),c.from=this._blockStartPos(s),c instanceof Yn&&(c.blockIndex=s),r.extend(c)}),r}extractInput(e,t,r){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),r===void 0&&(r={}),e===t)return"";let o="";return this._forEachBlocksInRange(e,t,(s,l,a,c)=>{o+=s.extractInput(a,c,r)}),o}_findStopBefore(e){let t;for(let r=0;r<this._stops.length;++r){const o=this._stops[r];if(o<=e)t=o;else break}return t}_appendPlaceholder(e){const t=new de;if(this.lazy&&e==null)return t;const r=this._mapPosToBlock(this.displayValue.length);if(!r)return t;const o=r.index,s=e??this._blocks.length;return this._blocks.slice(o,s).forEach(l=>{if(!l.lazy||e!=null){var a;t.aggregate(l._appendPlaceholder((a=l._blocks)==null?void 0:a.length))}}),t}_mapPosToBlock(e){let t="";for(let r=0;r<this._blocks.length;++r){const o=this._blocks[r],s=t.length;if(t+=o.displayValue,e<=t.length)return{index:r,offset:e-s}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,r)=>t+=r.displayValue.length,0)}_forEachBlocksInRange(e,t,r){t===void 0&&(t=this.displayValue.length);const o=this._mapPosToBlock(e);if(o){const s=this._mapPosToBlock(t),l=s&&o.index===s.index,a=o.offset,c=s&&l?s.offset:this._blocks[o.index].displayValue.length;if(r(this._blocks[o.index],o.index,a,c),s&&!l){for(let d=o.index+1;d<s.index;++d)r(this._blocks[d],d,0,this._blocks[d].displayValue.length);r(this._blocks[s.index],s.index,0,s.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._forEachBlocksInRange(e,t,(o,s,l,a)=>{r.aggregate(o.remove(l,a))}),r}nearestInputPos(e,t){if(t===void 0&&(t=te.NONE),!this._blocks.length)return 0;const r=new oO(this,e);if(t===te.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(t===te.LEFT||t===te.FORCE_LEFT){if(t===te.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),t===te.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:t===te.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return t===te.RIGHT||t===te.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:t===te.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,te.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,t,(o,s,l,a)=>{r+=o.totalInputPositions(l,a)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(r=>this._blocks[r]):[]}pad(e){const t=new de;return this._forEachBlocksInRange(0,this.displayValue.length,r=>t.aggregate(r.pad(e))),t}}ot.DEFAULTS={...rt.DEFAULTS,lazy:!0,placeholderChar:"_"},ot.STOP_CHAR="`",ot.ESCAPE_CHAR="\\",ot.InputDefinition=Po,ot.FixedDefinition=pc,ce.MaskedPattern=ot;class $o extends ot{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:r=this.from||0,maxLength:o=this.maxLength||0,autofix:s=this.autofix,...l}=e;this.to=t,this.from=r,this.maxLength=Math.max(String(t).length,o),this.autofix=s;const a=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===a[d];)++d;l.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(l)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",r="";const[,o,s]=e.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(t="0".repeat(o.length)+s,r="9".repeat(o.length)+s),t=t.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[t,r]}doPrepareChar(e,t){t===void 0&&(t={});let r;return[e,r]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(r.skip=!this.isComplete),[e,r]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const r=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[s,l]=this.boundaries(this.value+e);return Number(l)<this.from?super._appendCharRaw(r[this.value.length],t):Number(s)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(r[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(o[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(t.search(/[^0]/)===-1&&t.length<=this._matchFrom)return!0;const[r,o]=this.boundaries(t);return this.from<=Number(o)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const t=new de;if(this.value.length===this.maxLength)return t;const r=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let s=0;s<o;++s)t.aggregate(super._appendCharRaw("0",e));r.split("").forEach(s=>this._appendCharRaw(s))}return t}}ce.MaskedRange=$o;const sO="d{.}`m{.}`Y";class an extends ot{static extractPatternOptions(e){const{mask:t,pattern:r,...o}=e;return{...o,mask:Jn(t)?t:r}}constructor(e){super(an.extractPatternOptions({...an.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:r,blocks:o,...s}={...an.DEFAULTS,...e},l=Object.assign({},an.GET_DEFAULT_BLOCKS());e.min&&(l.Y.from=e.min.getFullYear()),e.max&&(l.Y.to=e.max.getFullYear()),e.min&&e.max&&l.Y.from===l.Y.to&&(l.m.from=e.min.getMonth()+1,l.m.to=e.max.getMonth()+1,l.m.from===l.m.to&&(l.d.from=e.min.getDate(),l.d.to=e.max.getDate())),Object.assign(l,this.blocks,o),super._update({...s,mask:Jn(t)?t:r,blocks:l})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&t!=null&&(this.min==null||this.min<=t)&&(this.max==null||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(an.extractPatternOptions(e))}}an.GET_DEFAULT_BLOCKS=()=>({d:{mask:$o,from:1,to:31,maxLength:2},m:{mask:$o,from:1,to:12,maxLength:2},Y:{mask:$o,from:1900,to:9999}}),an.DEFAULTS={...ot.DEFAULTS,mask:Date,pattern:sO,format:(n,e)=>{if(!n)return"";const t=String(n.getDate()).padStart(2,"0"),r=String(n.getMonth()+1).padStart(2,"0"),o=n.getFullYear();return[t,r,o].join(".")},parse:(n,e)=>{const[t,r,o]=n.split(".").map(Number);return new Date(o,r-1,t)}},ce.MaskedDate=an;class zo extends rt{constructor(e){super({...zo.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(t=>{const{expose:r,...o}=Ur(t),s=sn({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return r&&(this.exposeMask=s),s}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._applyDispatch(e,t);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),r}_applyDispatch(e,t,r){e===void 0&&(e=""),t===void 0&&(t={}),r===void 0&&(r="");const o=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,s=this.rawInputValue,l=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:s,a=s.slice(l.length),c=this.currentMask,d=new de,u=c?.state;return this.currentMask=this.doDispatch(e,{...t},r),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),l&&(this.currentMask.append(l,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),a&&(d.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new de;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,r;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,t,r){return t===void 0&&(t={}),r===void 0&&(r=""),this.dispatch(e,this,t,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[r,o]=super.doPrepare(e,t);if(this.currentMask){let s;[r,s]=super.doPrepare(r,this.currentMaskFlags(t)),o=o.aggregate(s)}return[r,o]}doPrepareChar(e,t){t===void 0&&(t={});let[r,o]=super.doPrepareChar(e,t);if(this.currentMask){let s;[r,s]=super.doPrepareChar(r,this.currentMaskFlags(t)),o=o.aggregate(s)}return[r,o]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,t){const r=new de;return this.currentMask&&r.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),r}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:r,currentMask:o,...s}=e;t&&this.compiledMasks.forEach((l,a)=>l.state=t[a]),r!=null&&(this.currentMask=r,this.currentMask.state=o),super.state=s}extractInput(e,t,r){return this.currentMask?this.currentMask.extractInput(e,t,r):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((t,r)=>{if(!e[r])return;const{mask:o,...s}=e[r];return Vl(t,s)&&t.maskEquals(o)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}zo.DEFAULTS={...rt.DEFAULTS,dispatch:(n,e,t,r)=>{if(!e.compiledMasks.length)return;const o=e.rawInputValue,s=e.compiledMasks.map((l,a)=>{const c=e.currentMask===l,d=c?l.displayValue.length:l.nearestInputPos(l.displayValue.length,te.FORCE_LEFT);return l.rawInputValue!==o?(l.reset(),l.append(o,{raw:!0})):c||l.remove(d),l.append(n,e.currentMaskFlags(t)),l.appendTail(r),{index:a,weight:l.rawInputValue.length,totalInputPositions:l.totalInputPositions(0,Math.max(d,l.nearestInputPos(l.displayValue.length,te.FORCE_LEFT)))}});return s.sort((l,a)=>a.weight-l.weight||a.totalInputPositions-l.totalInputPositions),e.compiledMasks[s[0].index]}},ce.MaskedDynamic=zo;class Ho extends ot{constructor(e){super({...Ho.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...r}=e;if(t){const o=t.map(a=>a.length),s=Math.min(...o),l=Math.max(...o)-s;r.mask="*".repeat(s),l&&(r.mask+="["+"*".repeat(l)+"]"),this.enum=t}super._update(r)}_appendCharRaw(e,t){t===void 0&&(t={});const r=Math.min(this.nearestInputPos(0,te.FORCE_RIGHT),this.value.length),o=this.enum.filter(s=>this.matchValue(s,this.unmaskedValue+e,r));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(l,a)=>{const c=o[0][a];a>=this.value.length||c===l.value||(l.reset(),l._appendChar(c,t))});const s=super._appendCharRaw(o[0][this.value.length],t);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(l=>s.aggregate(super._appendCharRaw(l))),s}return new de({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ln("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new de;const r=Math.min(super.nearestInputPos(0,te.FORCE_RIGHT),this.value.length);let o;for(o=e;o>=0&&!(this.enum.filter(l=>this.matchValue(l,this.value.slice(r,o),r)).length>1);--o);const s=super.remove(o,t);return s.tailShift+=o-e,s}get isComplete(){return this.enum.indexOf(this.value)>=0}}Ho.DEFAULTS={...ot.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},ce.MaskedEnum=Ho;class Am extends rt{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}ce.MaskedFunction=Am;var Bm;class Et extends rt{constructor(e){super({...Et.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",r=(this.scale?"("+uc(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(uc).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(uc(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){t===void 0&&(t={});const[r,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!r&&(o.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&o.aggregate(this._appendChar("-")),[r,o]}_separatorsCount(e,t){t===void 0&&(t=!1);let r=0;for(let o=0;o<e;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++r,t&&(e+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,r))}_appendCharRaw(e,t){t===void 0&&(t={});const r=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const s=this._value;this._value+=e;const l=this.number;let a=!isNaN(l),c=!1;if(a){let p;this.min!=null&&this.min<0&&this.number<this.min&&(p=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(p=this.max),p!=null&&(this.autofix?(this._value=this.format(p,this).replace(Et.UNMASKED_RADIX,this.radix),c||(c=s===this._value&&!t.tail)):a=!1),a&&(a=!!this._value.match(this._numberRegExp))}let d;a?d=new de({inserted:this._value.slice(s.length),rawInserted:c?"":e,skip:c}):(this._value=s,d=new de),this._value=this._insertThousandsSeparators(this._value);const u=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(u);return d.tailShift+=(f-o)*this.thousandsSeparator.length,d}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,t);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,t){const r=this._findSeparatorAround(e);r>=0&&(e=r);const o=this._findSeparatorAround(t);return o>=0&&(t=o+this.thousandsSeparator.length),[e,t]}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const r=this.value.slice(0,e),o=this.value.slice(t),s=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+o));const l=this._separatorsCountFromSlice(r);return new de({tailShift:(l-s)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case te.NONE:case te.LEFT:case te.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const o=r+this.thousandsSeparator.length;if(e<o||this.value.length<=o||t===te.FORCE_LEFT)return r}break}case te.RIGHT:case te.FORCE_RIGHT:{const r=this._findSeparatorAround(e);if(r>=0)return r+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;this.min!=null&&(t=Math.max(t,this.min)),this.max!=null&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(r,o,s,l)=>o+l),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,r){t===void 0&&(t={});const o=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===Et.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,r)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Et.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(Et.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||Et.EMPTY_VALUES.includes(e)&&Et.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Bm=Et,Et.UNMASKED_RADIX=".",Et.EMPTY_VALUES=[...rt.EMPTY_VALUES,0],Et.DEFAULTS={...rt.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Bm.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:n=>n.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},ce.MaskedNumber=Et;const Il={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function hc(n,e,t){e===void 0&&(e=Il.MASKED),t===void 0&&(t=Il.MASKED);const r=sn(n);return o=>r.runIsolated(s=>(s[e]=o,s[t]))}function Vm(n,e,t,r){return hc(e,t,r)(n)}ce.PIPE_TYPE=Il,ce.createPipe=hc,ce.pipe=Vm;class Lm extends ot{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,r,o;const{repeat:s,...l}=Ur(e);this._blockOpts=Object.assign({},this._blockOpts,l);const a=sn(this._blockOpts);this.repeat=(t=(r=s??a.repeat)!=null?r:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:a},eager:a.eager,overwrite:a.overwrite,skipInvalid:a.skipInvalid,lazy:a.lazy,placeholderChar:a.placeholderChar,displayChar:a.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(sn(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const r=new de;for(let c=(o=(s=this._mapPosToBlock(this.displayValue.length))==null?void 0:s.index)!=null?o:Math.max(this._blocks.length-1,0),d,u;d=(l=this._blocks[c])!=null?l:u=!u&&this._allocateBlock(c);++c){var o,s,l,a;const f=d._appendChar(e,{...t,_beforeTailState:(a=t._beforeTailState)==null||(a=a._blocks)==null?void 0:a[c]});if(f.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(f),f.consumed)break}return r}_trimEmptyTail(e,t){var r,o;e===void 0&&(e=0);const s=Math.max(((r=this._mapPosToBlock(e))==null?void 0:r.index)||0,this.repeatFrom,0);let l;t!=null&&(l=(o=this._mapPosToBlock(t))==null?void 0:o.index),l==null&&(l=this._blocks.length-1);let a=0;for(let c=l;s<=c&&!this._blocks[c].unmaskedValue;--c,++a);a&&(this._blocks.splice(l-a+1,a),this.mask=this.mask.slice(a))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._trimEmptyTail(e,t),r}totalInputPositions(e,t){return e===void 0&&(e=0),t==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}ce.RepeatBlock=Lm;try{globalThis.IMask=ce}catch{}const lO=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:Yn,DIRECTION:te,HTMLContenteditableMaskElement:fc,HTMLInputMaskElement:Nm,HTMLMaskElement:Fo,InputMask:Mm,MaskElement:Ll,Masked:rt,MaskedDate:an,MaskedDynamic:zo,MaskedEnum:Ho,MaskedFunction:Am,MaskedNumber:Et,MaskedPattern:ot,MaskedRange:$o,MaskedRegExp:Tm,PIPE_TYPE:Il,PatternFixedDefinition:pc,PatternInputDefinition:Po,RepeatBlock:Lm,createMask:sn,createPipe:hc,default:ce,forceDirection:vm,normalizeOpts:Ur,pipe:Vm},Symbol.toStringTag,{value:"Module"}));Gt.VsRichtext=El,Gt.VsRichtextMd=El,Gt.VsRichtextPage=lh,Gt.default=tO,Object.defineProperties(Gt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
145
+ */const SL="11.1.12";function NL(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(yr().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(yr().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1)}const Ae={UNEXPECTED_RETURN_TYPE:OV,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 wt(n,...e){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:ML,args:e}:void 0)}const ML={[Ae.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Ae.INVALID_ARGUMENT]:"Invalid argument",[Ae.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Ae.NOT_INSTALLED]:"Need to install with `app.use` function",[Ae.UNEXPECTED_ERROR]:"Unexpected error",[Ae.REQUIRED_VALUE]:"Required in value: {0}",[Ae.INVALID_VALUE]:"Invalid value",[Ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Ae.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Ae.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Ae.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},tc=nn("__translateVNode"),nc=nn("__datetimeParts"),rc=nn("__numberParts"),kr=nn("__enableEmitter"),Io=nn("__disableEmitter"),lm=nn("__setPluralRules"),im=nn("__injectWithOption"),oc=nn("__dispose"),Ft={FALLBACK_TO_ROOT:qV,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_LEGACY_MODE:11,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:12,DUPLICATE_USE_I18N_CALLING:13},TL={[Ft.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Ft.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Ft.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Ft.DEPRECATE_LEGACY_MODE]:`Legacy API mode has been deprecated in v11. Use Composition API mode instead.
146
+ About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[Ft.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead.",[Ft.DUPLICATE_USE_I18N_CALLING]:"Duplicate `useI18n` calling by local scope. Please don't call it on local scope, due to it does not work properly in component."};function jr(n,...e){return Cl(TL[n],...e)}function Do(n){if(!ye(n)||Dt(n))return n;for(const e in n)if(Kt(n,e))if(!e.includes("."))ye(n[e])&&Do(n[e]);else{const t=e.split("."),r=t.length-1;let o=n,s=!1;for(let l=0;l<r;l++){if(t[l]==="__proto__")throw new Error(`unsafe key: ${t[l]}`);if(t[l]in o||(o[t[l]]=ve()),!ye(o[t[l]])){process.env.NODE_ENV!=="production"&&tn(jr(Ft.IGNORE_OBJ_FLATTEN,{key:t[l]})),s=!0;break}o=o[t[l]]}if(s||(Dt(o)?Ah.includes(t[r])||delete n[e]:(o[t[r]]=n[e],delete n[e])),!Dt(o)){const l=o[t[r]];ye(l)&&Do(l)}}return n}function sc(n,e){const{messages:t,__i18n:r,messageResolver:o,flatJson:s}=e,l=me(t)?t:De(r)?ve():{[n]:ve()};if(De(r)&&r.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:d}=a;c?(l[c]=l[c]||ve(),Sl(d,l[c])):Sl(d,l)}else X(a)&&Sl(JSON.parse(a),l)}),o==null&&s)for(const a in l)Kt(l,a)&&Do(l[a]);return l}function am(n){return n.type}function cm(n,e,t){let r=ye(e.messages)?e.messages:ve();"__i18nGlobal"in t&&(r=sc(n.locale.value,{messages:r,__i18n:t.__i18nGlobal}));const o=Object.keys(r);o.length&&o.forEach(s=>{n.mergeLocaleMessage(s,r[s])});{if(ye(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(l=>{n.mergeDateTimeFormat(l,e.datetimeFormats[l])})}if(ye(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(l=>{n.mergeNumberFormat(l,e.numberFormats[l])})}}}function dm(n){return i.createVNode(i.Text,null,n,0)}const um="__INTLIFY_META__",fm=()=>[],AL=()=>!1;let pm=0;function hm(n){return((e,t,r,o)=>n(t,r,i.getCurrentInstance()||void 0,o))}const BL=()=>{const n=i.getCurrentInstance();let e=null;return n&&(e=am(n)[um])?{[um]:e}:null};function lc(n={}){const{__root:e,__injectWithOption:t}=n,r=e===void 0,o=n.flatJson,s=Wt?i.ref:i.shallowRef;let l=be(n.inheritLocale)?n.inheritLocale:!0;const a=s(e&&l?e.locale.value:X(n.locale)?n.locale:Lo),c=s(e&&l?e.fallbackLocale.value:X(n.fallbackLocale)||De(n.fallbackLocale)||me(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:a.value),d=s(sc(a.value,n)),u=s(me(n.datetimeFormats)?n.datetimeFormats:{[a.value]:{}}),f=s(me(n.numberFormats)?n.numberFormats:{[a.value]:{}});let p=e?e.missingWarn:be(n.missingWarn)||Fr(n.missingWarn)?n.missingWarn:!0,h=e?e.fallbackWarn:be(n.fallbackWarn)||Fr(n.fallbackWarn)?n.fallbackWarn:!0,m=e?e.fallbackRoot:be(n.fallbackRoot)?n.fallbackRoot:!0,g=!!n.fallbackFormat,y=Ne(n.missing)?n.missing:null,b=Ne(n.missing)?hm(n.missing):null,k=Ne(n.postTranslation)?n.postTranslation:null,E=e?e.warnHtmlMessage:be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,x=!!n.escapeParameter;const C=e?e.modifiers:me(n.modifiers)?n.modifiers:{};let _=n.pluralRules||e&&e.pluralRules,w;w=(()=>{r&&Hh(null);const I={version:SL,locale:a.value,fallbackLocale:c.value,messages:d.value,modifiers:C,pluralRules:_,missing:b===null?void 0:b,missingWarn:p,fallbackWarn:h,fallbackFormat:g,unresolving:!0,postTranslation:k===null?void 0:k,warnHtmlMessage:E,escapeParameter:x,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};I.datetimeFormats=u.value,I.numberFormats=f.value,I.__datetimeFormatters=me(w)?w.__datetimeFormatters:void 0,I.__numberFormatters=me(w)?w.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(I.__v_emitter=me(w)?w.__v_emitter:void 0);const H=rL(I);return r&&Hh(H),H})(),Oo(w,a.value,c.value);function D(){return[a.value,c.value,d.value,u.value,f.value]}const R=i.computed({get:()=>a.value,set:I=>{w.locale=I,a.value=I}}),A=i.computed({get:()=>c.value,set:I=>{w.fallbackLocale=I,c.value=I,Oo(w,a.value,I)}}),B=i.computed(()=>d.value),U=i.computed(()=>u.value),Y=i.computed(()=>f.value);function O(){return Ne(k)?k:null}function z(I){k=I,w.postTranslation=I}function K(){return y}function ee(I){I!==null&&(b=hm(I)),y=I,w.missing=b}function re(I,H){return I!=="translate"||!H.resolvedMessage}const xe=(I,H,he,v,M,W)=>{D();let G;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(w.fallbackContext=e?nL():void 0),G=I(w)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(w.fallbackContext=void 0)}if(he!=="translate exists"&&je(G)&&G===Tl||he==="translate exists"&&!G){const[Q,fe]=H();if(process.env.NODE_ENV!=="production"&&e&&X(Q)&&re(he,fe)&&(m&&(Bl(h,Q)||Uh(p,Q))&&tn(jr(Ft.FALLBACK_TO_ROOT,{key:Q,type:he})),process.env.NODE_ENV!=="production")){const{__v_emitter:V}=w;V&&m&&V.emit("fallback",{type:he,key:Q,to:"global",groupId:`${he}:${Q}`})}return e&&m?v(e):M(Q)}else{if(W(G))return G;throw wt(Ae.UNEXPECTED_RETURN_TYPE)}};function Ze(...I){return xe(H=>Reflect.apply(nm,null,[H,...I]),()=>Qa(...I),"translate",H=>Reflect.apply(H.t,H,[...I]),H=>H,H=>X(H))}function ht(...I){const[H,he,v]=I;if(v&&!ye(v))throw wt(Ae.INVALID_ARGUMENT);return Ze(H,he,We({resolvedMessage:!0},v||{}))}function mt(...I){return xe(H=>Reflect.apply(Gh,null,[H,...I]),()=>Xa(...I),"datetime format",H=>Reflect.apply(H.d,H,[...I]),()=>Al,H=>X(H)||De(H))}function Ke(...I){return xe(H=>Reflect.apply(Xh,null,[H,...I]),()=>Za(...I),"number format",H=>Reflect.apply(H.n,H,[...I]),()=>Al,H=>X(H)||De(H))}function gt(I){return I.map(H=>X(H)||je(H)||be(H)?dm(String(H)):H)}const Cn={normalize:gt,interpolate:I=>I,type:"vnode"};function vn(...I){return xe(H=>{let he;const v=H;try{v.processor=Cn,he=Reflect.apply(nm,null,[v,...I])}finally{v.processor=null}return he},()=>Qa(...I),"translate",H=>H[tc](...I),H=>[dm(H)],H=>De(H))}function xr(...I){return xe(H=>Reflect.apply(Xh,null,[H,...I]),()=>Za(...I),"number format",H=>H[rc](...I),fm,H=>X(H)||De(H))}function yt(...I){return xe(H=>Reflect.apply(Gh,null,[H,...I]),()=>Xa(...I),"datetime format",H=>H[nc](...I),fm,H=>X(H)||De(H))}function Pt(I){_=I,w.pluralRules=_}function cn(I,H){return xe(()=>{if(!I)return!1;const he=X(H)?H:a.value,v=qt(he),M=w.messageResolver(v,I);return Dt(M)||Rt(M)||X(M)},()=>[I],"translate exists",he=>Reflect.apply(he.te,he,[I,H]),AL,he=>be(he))}function qe(I){let H=null;const he=Lh(w,c.value,a.value);for(let v=0;v<he.length;v++){const M=d.value[he[v]]||{},W=w.messageResolver(M,I);if(W!=null){H=W;break}}return H}function $t(I){const H=qe(I);return H??(e?e.tm(I)||{}:{})}function qt(I){return d.value[I]||{}}function dn(I,H){if(o){const he={[I]:H};for(const v in he)Kt(he,v)&&Do(he[v]);H=he[I]}d.value[I]=H,w.messages=d.value}function Xn(I,H){d.value[I]=d.value[I]||{};const he={[I]:H};if(o)for(const v in he)Kt(he,v)&&Do(he[v]);H=he[I],Sl(H,d.value[I]),w.messages=d.value}function S(I){return u.value[I]||{}}function N(I,H){u.value[I]=H,w.datetimeFormats=u.value,Yh(w,I,H)}function P(I,H){u.value[I]=We(u.value[I]||{},H),w.datetimeFormats=u.value,Yh(w,I,H)}function Z(I){return f.value[I]||{}}function Ee(I,H){f.value[I]=H,w.numberFormats=f.value,Qh(w,I,H)}function Be(I,H){f.value[I]=We(f.value[I]||{},H),w.numberFormats=f.value,Qh(w,I,H)}pm++,e&&Wt&&(i.watch(e.locale,I=>{l&&(a.value=I,w.locale=I,Oo(w,a.value,c.value))}),i.watch(e.fallbackLocale,I=>{l&&(c.value=I,w.fallbackLocale=I,Oo(w,a.value,c.value))}));const pe={id:pm,locale:R,fallbackLocale:A,get inheritLocale(){return l},set inheritLocale(I){l=I,I&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,Oo(w,a.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:B,get modifiers(){return C},get pluralRules(){return _||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(I){p=I,w.missingWarn=p},get fallbackWarn(){return h},set fallbackWarn(I){h=I,w.fallbackWarn=h},get fallbackRoot(){return m},set fallbackRoot(I){m=I},get fallbackFormat(){return g},set fallbackFormat(I){g=I,w.fallbackFormat=g},get warnHtmlMessage(){return E},set warnHtmlMessage(I){E=I,w.warnHtmlMessage=I},get escapeParameter(){return x},set escapeParameter(I){x=I,w.escapeParameter=I},t:Ze,getLocaleMessage:qt,setLocaleMessage:dn,mergeLocaleMessage:Xn,getPostTranslationHandler:O,setPostTranslationHandler:z,getMissingHandler:K,setMissingHandler:ee,[lm]:Pt};return pe.datetimeFormats=U,pe.numberFormats=Y,pe.rt=ht,pe.te=cn,pe.tm=$t,pe.d=mt,pe.n=Ke,pe.getDateTimeFormat=S,pe.setDateTimeFormat=N,pe.mergeDateTimeFormat=P,pe.getNumberFormat=Z,pe.setNumberFormat=Ee,pe.mergeNumberFormat=Be,pe[im]=t,pe[tc]=vn,pe[nc]=yt,pe[rc]=xr,process.env.NODE_ENV!=="production"&&(pe[kr]=I=>{w.__v_emitter=I},pe[Io]=()=>{w.__v_emitter=void 0}),pe}const mm="vue-i18n: composer properties",ic={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},VL={"vue-i18n-resource-inspector":"Search for scopes ..."},LL={"vue-i18n-timeline":16764185};let ac;async function OL(n,e){return new Promise((t,r)=>{try{_L({id:"vue-devtools-plugin-vue-i18n",label:ic["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:[mm],app:n},o=>{ac=o,o.on.visitComponentTree(({componentInstance:l,treeNode:a})=>{IL(l,a,e)}),o.on.inspectComponent(({componentInstance:l,instanceData:a})=>{l.vnode.el&&l.vnode.el.__VUE_I18N__&&a&&(e.mode==="legacy"?l.vnode.el.__VUE_I18N__!==e.global.__composer&&ym(a,l.vnode.el.__VUE_I18N__):ym(a,l.vnode.el.__VUE_I18N__))}),o.addInspector({id:"vue-i18n-resource-inspector",label:ic["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:VL["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&$L(l,e)});const s=new Map;o.on.getInspectorState(async l=>{if(l.app===n&&l.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),HL(l,e),l.nodeId==="global"){if(!s.has(l.app)){const[a]=await o.getComponentInstances(l.app);s.set(l.app,a)}o.highlightElement(s.get(l.app))}else{const a=zL(l.nodeId,e);a&&o.highlightElement(a)}}),o.on.editInspectorState(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&UL(l,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:ic["vue-i18n-timeline"],color:LL["vue-i18n-timeline"]}),t(!0)})}catch(o){console.error(o),r(!1)}})}function gm(n){return n.type.name||n.type.displayName||n.type.__file||"Anonymous"}function IL(n,e,t){const r=t.mode==="composition"?t.global:t.global.__composer;if(n&&n.vnode.el&&n.vnode.el.__VUE_I18N__&&n.vnode.el.__VUE_I18N__!==r){const o={label:`i18n (${gm(n)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function ym(n,e){const t=mm;n.state.push({type:t,key:"locale",editable:!0,value:e.locale.value}),n.state.push({type:t,key:"availableLocales",editable:!1,value:e.availableLocales}),n.state.push({type:t,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),n.state.push({type:t,key:"inheritLocale",editable:!0,value:e.inheritLocale}),n.state.push({type:t,key:"messages",editable:!1,value:cc(e.messages.value)}),n.state.push({type:t,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),n.state.push({type:t,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function cc(n){const e={};return Object.keys(n).forEach(t=>{const r=n[t];Ne(r)&&"source"in r?e[t]=PL(r):Dt(r)&&r.loc&&r.loc.source?e[t]=r.loc.source:ye(r)?e[t]=cc(r):e[t]=r}),e}const DL={"<":"&lt;",">":"&gt;",'"':"&quot;","&":"&amp;"};function RL(n){return n.replace(/[<>"&]/g,FL)}function FL(n){return DL[n]||n}function PL(n){return{_custom:{type:"function",display:`<span>ƒ</span> ${n.source?`("${RL(n.source)}")`:"(?)"}`}}}function $L(n,e){n.rootNodes.push({id:"global",label:"Global Scope"});const t=e.mode==="composition"?e.global:e.global.__composer;for(const[r,o]of e.__instances){const s=e.mode==="composition"?o:o.__composer;t!==s&&n.rootNodes.push({id:s.id.toString(),label:`${gm(r)} Scope`})}}function zL(n,e){let t=null;if(n!=="global"){for(const[r,o]of e.__instances.entries())if(o.id.toString()===n){t=r;break}}return t}function bm(n,e){if(n==="global")return e.mode==="composition"?e.global:e.global.__composer;{const t=Array.from(e.__instances.values()).find(r=>r.id.toString()===n);return t?e.mode==="composition"?t:t.__composer:null}}function HL(n,e){const t=bm(n.nodeId,e);return t&&(n.state=jL(t)),null}function jL(n){const e={},t="Locale related info",r=[{type:t,key:"locale",editable:!0,value:n.locale.value},{type:t,key:"fallbackLocale",editable:!0,value:n.fallbackLocale.value},{type:t,key:"availableLocales",editable:!1,value:n.availableLocales},{type:t,key:"inheritLocale",editable:!0,value:n.inheritLocale}];e[t]=r;const o="Locale messages info",s=[{type:o,key:"messages",editable:!1,value:cc(n.messages.value)}];e[o]=s;{const l="Datetime formats info",a=[{type:l,key:"datetimeFormats",editable:!1,value:n.datetimeFormats.value}];e[l]=a;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:n.numberFormats.value}];e[c]=d}return e}function Ro(n,e){if(ac){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),ac.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:n,groupId:t,time:Date.now(),meta:{},data:e||{},logType:n==="compile-error"?"error":n==="fallback"||n==="missing"?"warning":"default"}})}}function UL(n,e){const t=bm(n.nodeId,e);if(t){const[r]=n.path;r==="locale"&&X(n.state.value)?t.locale.value=n.state.value:r==="fallbackLocale"&&(X(n.state.value)||De(n.state.value)||ye(n.state.value))?t.fallbackLocale.value=n.state.value:r==="inheritLocale"&&be(n.state.value)&&(t.inheritLocale=n.state.value)}}function WL(n){const e=X(n.locale)?n.locale:Lo,t=X(n.fallbackLocale)||De(n.fallbackLocale)||me(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:e,r=Ne(n.missing)?n.missing:void 0,o=be(n.silentTranslationWarn)||Fr(n.silentTranslationWarn)?!n.silentTranslationWarn:!0,s=be(n.silentFallbackWarn)||Fr(n.silentFallbackWarn)?!n.silentFallbackWarn:!0,l=be(n.fallbackRoot)?n.fallbackRoot:!0,a=!!n.formatFallbackMessages,c=me(n.modifiers)?n.modifiers:{},d=n.pluralizationRules,u=Ne(n.postTranslation)?n.postTranslation:void 0,f=X(n.warnHtmlInMessage)?n.warnHtmlInMessage!=="off":!0,p=!!n.escapeParameterHtml,h=be(n.sync)?n.sync:!0;let m=n.messages;if(me(n.sharedMessages)){const C=n.sharedMessages;m=Object.keys(C).reduce((w,T)=>{const D=w[T]||(w[T]={});return We(D,C[T]),w},m||{})}const{__i18n:g,__root:y,__injectWithOption:b}=n,k=n.datetimeFormats,E=n.numberFormats,x=n.flatJson;return{locale:e,fallbackLocale:t,messages:m,flatJson:x,datetimeFormats:k,numberFormats:E,missing:r,missingWarn:o,fallbackWarn:s,fallbackRoot:l,fallbackFormat:a,modifiers:c,pluralRules:d,postTranslation:u,warnHtmlMessage:f,escapeParameter:p,messageResolver:n.messageResolver,inheritLocale:h,__i18n:g,__root:y,__injectWithOption:b}}function dc(n={}){const e=lc(WL(n)),{__extender:t}=n,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 be(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(o){e.missingWarn=be(o)?!o:o},get silentFallbackWarn(){return be(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(o){e.fallbackWarn=be(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])},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=t,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=o=>{const s=e;s[kr]&&s[kr](o)},r.__disableEmitter=()=>{const o=e;o[Io]&&o[Io]()}),r}function KL(n,e,t){return{beforeCreate(){const r=i.getCurrentInstance();if(!r)throw wt(Ae.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=km(n,s);else{s.__injectWithOption=!0,s.__extender=t.__vueI18nExtend,this.$i18n=dc(s);const l=this.$i18n;l.__extender&&(l.__disposer=l.__extender(this.$i18n))}}else if(o.__i18n)if(this===this.$root)this.$i18n=km(n,o);else{this.$i18n=dc({__i18n:o.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=n;o.__i18nGlobal&&cm(e,o,o),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$te=(s,l)=>this.$i18n.te(s,l),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),t.__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=za();r.__enableEmitter&&r.__enableEmitter(o),o.on("*",Ro)}},unmounted(){const r=i.getCurrentInstance();if(!r)throw wt(Ae.UNEXPECTED_ERROR);const o=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",Ro),delete this.__v_emitter),this.$i18n&&(o.__disableEmitter&&o.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,o.__disposer&&(o.__disposer(),delete o.__disposer,delete o.__extender),t.__deleteInstance(r),delete this.$i18n}}}function km(n,e){n.locale=e.locale||n.locale,n.fallbackLocale=e.fallbackLocale||n.fallbackLocale,n.missing=e.missing||n.missing,n.silentTranslationWarn=e.silentTranslationWarn||n.silentFallbackWarn,n.silentFallbackWarn=e.silentFallbackWarn||n.silentFallbackWarn,n.formatFallbackMessages=e.formatFallbackMessages||n.formatFallbackMessages,n.postTranslation=e.postTranslation||n.postTranslation,n.warnHtmlInMessage=e.warnHtmlInMessage||n.warnHtmlInMessage,n.escapeParameterHtml=e.escapeParameterHtml||n.escapeParameterHtml,n.sync=e.sync||n.sync,n.__composer[lm](e.pluralizationRules||n.pluralizationRules);const t=sc(n.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(r=>n.mergeLocaleMessage(r,t[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>n.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>n.mergeNumberFormat(r,e.numberFormats[r])),n}const uc={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function qL({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((r,o)=>[...r,...o.type===i.Fragment?o.children:[o]],[]):e.reduce((t,r)=>{const o=n[r];return o&&(t[r]=o()),t},ve())}function xm(){return i.Fragment}const wm=i.defineComponent({name:"i18n-t",props:We({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>je(n)||!isNaN(n)}},uc),setup(n,e){const{slots:t,attrs:r}=e,o=n.i18n||fc({useScope:n.scope,__useComponent:!0});return()=>{const s=Object.keys(t).filter(f=>f[0]!=="_"),l=ve();n.locale&&(l.locale=n.locale),n.plural!==void 0&&(l.plural=X(n.plural)?+n.plural:n.plural);const a=qL(e,s),c=o[tc](n.keypath,a,l),d=We(ve(),r),u=X(n.tag)||ye(n.tag)?n.tag:xm();return i.h(u,d,c)}}});function GL(n){return De(n)&&!X(n[0])}function Em(n,e,t,r){const{slots:o,attrs:s}=e;return()=>{const l={part:!0};let a=ve();n.locale&&(l.locale=n.locale),X(n.format)?l.key=n.format:ye(n.format)&&(X(n.format.key)&&(l.key=n.format.key),a=Object.keys(n.format).reduce((p,h)=>t.includes(h)?We(ve(),p,{[h]:n.format[h]}):p,ve()));const c=r(n.value,l,a);let d=[l.key];De(c)?d=c.map((p,h)=>{const m=o[p.type],g=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return GL(g)&&(g[0].key=`${p.type}-${h}`),g}):X(c)&&(d=[c]);const u=We(ve(),s),f=X(n.tag)||ye(n.tag)?n.tag:xm();return i.h(f,u,d)}}const Cm=i.defineComponent({name:"i18n-n",props:We({value:{type:Number,required:!0},format:{type:[String,Object]}},uc),setup(n,e){const t=n.i18n||fc({useScope:n.scope,__useComponent:!0});return Em(n,e,Zh,(...r)=>t[rc](...r))}});function JL(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const r=t.__getInstance(e);return r!=null?r.__composer:n.global.__composer}}function YL(n){const e=l=>{process.env.NODE_ENV!=="production"&&Fa(jr(Ft.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:a,value:c}=l;if(!a||!a.$)throw wt(Ae.UNEXPECTED_ERROR);const d=JL(n,a.$),u=vm(c);return[Reflect.apply(d.t,d,[..._m(u)]),d]};return{created:(l,a)=>{const[c,d]=e(a);Wt&&n.global===d&&(l.__i18nWatcher=i.watch(d.locale,()=>{a.instance&&a.instance.$forceUpdate()})),l.__composer=d,l.textContent=c},unmounted:l=>{Wt&&l.__i18nWatcher&&(l.__i18nWatcher(),l.__i18nWatcher=void 0,delete l.__i18nWatcher),l.__composer&&(l.__composer=void 0,delete l.__composer)},beforeUpdate:(l,{value:a})=>{if(l.__composer){const c=l.__composer,d=vm(a);l.textContent=Reflect.apply(c.t,c,[..._m(d)])}},getSSRProps:l=>{const[a]=e(l);return{textContent:a}}}}function vm(n){if(X(n))return{path:n};if(me(n)){if(!("path"in n))throw wt(Ae.REQUIRED_VALUE,"path");return n}else throw wt(Ae.INVALID_VALUE)}function _m(n){const{path:e,locale:t,args:r,choice:o,plural:s}=n,l={},a=r||{};return X(t)&&(l.locale=t),je(o)&&(l.plural=o),je(s)&&(l.plural=s),[e,a,l]}function XL(n,e,...t){const r=me(t[0])?t[0]:{};(be(r.globalInstall)?r.globalInstall:!0)&&([wm.name,"I18nT"].forEach(s=>n.component(s,wm)),[Cm.name,"I18nN"].forEach(s=>n.component(s,Cm)),[Nm.name,"I18nD"].forEach(s=>n.component(s,Nm))),n.directive("t",YL(e))}const ZL=nn("global-vue-i18n");function QL(n={}){const e=__VUE_I18N_LEGACY_API__&&be(n.legacy)?n.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&Fa(jr(Ft.DEPRECATE_LEGACY_MODE));const t=be(n.globalInjection)?n.globalInjection:!0,r=new Map,[o,s]=eO(n,e),l=nn(process.env.NODE_ENV!=="production"?"vue-i18n":"");function a(f){return r.get(f)||null}function c(f,p){r.set(f,p)}function d(f){r.delete(f)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(f,...p){if(process.env.NODE_ENV!=="production"&&(f.__VUE_I18N__=u),f.__VUE_I18N_SYMBOL__=l,f.provide(f.__VUE_I18N_SYMBOL__,u),me(p[0])){const g=p[0];u.__composerExtend=g.__composerExtend,u.__vueI18nExtend=g.__vueI18nExtend}let h=null;!e&&t&&(h=aO(f,u.global)),__VUE_I18N_FULL_INSTALL__&&XL(f,u,...p),__VUE_I18N_LEGACY_API__&&e&&f.mixin(KL(s,s.__composer,u));const m=f.unmount;if(f.unmount=()=>{h&&h(),u.dispose(),m()},process.env.NODE_ENV!=="production"){if(!await OL(f,u))throw wt(Ae.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const y=za();if(e){const b=s;b.__enableEmitter&&b.__enableEmitter(y)}else{const b=s;b[kr]&&b[kr](y)}y.on("*",Ro)}},get global(){return s},dispose(){o.stop()},__instances:r,__getInstance:a,__setInstance:c,__deleteInstance:d};return u}function fc(n={}){const e=i.getCurrentInstance();if(e==null)throw wt(Ae.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw wt(Ae.NOT_INSTALLED);const t=tO(e),r=rO(t),o=am(e),s=nO(n,o);if(s==="global")return cm(r,n,o),r;if(s==="parent"){let c=oO(t,e,n.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&tn(jr(Ft.NOT_FOUND_PARENT_SCOPE)),c=r),c}const l=t;let a=l.__getInstance(e);if(a==null){const c=We({},n);"__i18n"in o&&(c.__i18n=o.__i18n),r&&(c.__root=r),a=lc(c),l.__composerExtend&&(a[oc]=l.__composerExtend(a)),lO(l,e,a),l.__setInstance(e,a)}else process.env.NODE_ENV!=="production"&&s==="local"&&tn(jr(Ft.DUPLICATE_USE_I18N_CALLING));return a}function eO(n,e){const t=i.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?t.run(()=>dc(n)):t.run(()=>lc(n));if(r==null)throw wt(Ae.UNEXPECTED_ERROR);return[t,r]}function tO(n){const e=i.inject(n.isCE?ZL:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw wt(n.isCE?Ae.NOT_INSTALLED_WITH_PROVIDE:Ae.UNEXPECTED_ERROR);return e}function nO(n,e){return vl(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function rO(n){return n.mode==="composition"?n.global:n.global.__composer}function oO(n,e,t=!1){let r=null;const o=e.root;let s=sO(e,t);for(;s!=null;){const l=n;if(n.mode==="composition")r=l.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const a=l.__getInstance(s);a!=null&&(r=a.__composer,t&&r&&!r[im]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function sO(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function lO(n,e,t){let r=null;i.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=t,r=za();const o=t;o[kr]&&o[kr](r),r.on("*",Ro)}},e),i.onUnmounted(()=>{const o=t;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",Ro),o[Io]&&o[Io](),delete e.vnode.el.__VUE_I18N__),n.__deleteInstance(e);const s=o[oc];s&&(s(),delete o[oc])},e)}const iO=["locale","fallbackLocale","availableLocales"],Sm=["t","rt","d","n","tm","te"];function aO(n,e){const t=Object.create(null);return iO.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw wt(Ae.UNEXPECTED_ERROR);const l=i.isRef(s.value)?{get(){return s.value.value},set(a){s.value.value=a}}:{get(){return s.get&&s.get()}};Object.defineProperty(t,o,l)}),n.config.globalProperties.$i18n=t,Sm.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw wt(Ae.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${o}`,s)}),()=>{delete n.config.globalProperties.$i18n,Sm.forEach(o=>{delete n.config.globalProperties[`$${o}`]})}}const Nm=i.defineComponent({name:"i18n-d",props:We({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},uc),setup(n,e){const t=n.i18n||fc({useScope:n.scope,__useComponent:!0});return Em(n,e,Jh,(...r)=>t[nc](...r))}});if(NL(),XV(TV),ZV(KV),QV(Lh),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const n=yr();n.__INTLIFY__=!0,AV(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const cO={},dO={},uO={paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",linkTitle:"Enter Link",create:"Create",cancel:"Cancel"},fO={paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",linkTitle:"Введіть посилання",create:"Створити",cancel:"Скасувати"},pc=QL({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...cO,tiptap:uO},uk:{...dO,tiptap:fO}}}),pO={install:(n,e={})=>{if(e.i18nConfig){const t=e.i18nConfig,r=pc.global?.messages?.value||pc.messages;r&&t.global?.messages?.value&&Object.keys(r).forEach(o=>{t.global.mergeLocaleMessage?t.global.mergeLocaleMessage(o,r[o]):t.global.setLocaleMessage(o,r[o])})}else n.use(pc);n.component("vs-richtext",El),n.component("vs-richtext-md",El),n.component("vs-richtext-page",fh)}};function Jn(n){return typeof n=="string"||n instanceof String}function Mm(n){var e;return typeof n=="object"&&n!=null&&(n==null||(e=n.constructor)==null?void 0:e.name)==="Object"}function Tm(n,e){return Array.isArray(e)?Tm(n,(t,r)=>e.includes(r)):Object.entries(n).reduce((t,r)=>{let[o,s]=r;return e(s,o)&&(t[o]=s),t},{})}const te={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Am(n){switch(n){case te.LEFT:return te.FORCE_LEFT;case te.RIGHT:return te.FORCE_RIGHT;default:return n}}function hc(n){return n.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Vl(n,e){if(e===n)return!0;const t=Array.isArray(e),r=Array.isArray(n);let o;if(t&&r){if(e.length!=n.length)return!1;for(o=0;o<e.length;o++)if(!Vl(e[o],n[o]))return!1;return!0}if(t!=r)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){const s=e instanceof Date,l=n instanceof Date;if(s&&l)return e.getTime()==n.getTime();if(s!=l)return!1;const a=e instanceof RegExp,c=n instanceof RegExp;if(a&&c)return e.toString()==n.toString();if(a!=c)return!1;const d=Object.keys(e);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(n,d[o]))return!1;for(o=0;o<d.length;o++)if(!Vl(n[d[o]],e[d[o]]))return!1;return!0}else if(e&&n&&typeof e=="function"&&typeof n=="function")return e.toString()===n.toString();return!1}class hO{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?te.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?te.RIGHT:te.LEFT}}function ce(n,e){return new ce.InputMask(n,e)}function Bm(n){if(n==null)throw new Error("mask property should be defined");return n instanceof RegExp?ce.MaskedRegExp:Jn(n)?ce.MaskedPattern:n===Date?ce.MaskedDate:n===Number?ce.MaskedNumber:Array.isArray(n)||n===Array?ce.MaskedDynamic:ce.Masked&&n.prototype instanceof ce.Masked?n:ce.Masked&&n instanceof ce.Masked?n.constructor:n instanceof Function?ce.MaskedFunction:(console.warn("Mask not found for mask",n),ce.Masked)}function Ur(n){if(!n)throw new Error("Options in not defined");if(ce.Masked){if(n.prototype instanceof ce.Masked)return{mask:n};const{mask:e=void 0,...t}=n instanceof ce.Masked?{mask:n}:Mm(n)&&n.mask instanceof ce.Masked?n:{};if(e){const r=e.mask;return{...Tm(e,(o,s)=>!s.startsWith("_")),mask:e.constructor,_mask:r,...t}}}return Mm(n)?{...n}:{mask:n}}function sn(n){if(ce.Masked&&n instanceof ce.Masked)return n;const e=Ur(n),t=Bm(e.mask);if(!t)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===t&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new t(e)}ce.createMask=sn;class Ll{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,t){if(!(e==null||t==null||e===this.selectionStart&&t===this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}ce.MaskElement=Ll;const Vm=90,mO=89;class Fo extends Ll{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,r;return(e=(t=(r=this.input).getRootNode)==null?void 0:t.call(r))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===Vm&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===mO&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===Vm&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}ce.HTMLMaskElement=Fo;class Lm extends Fo{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}ce.HTMLMaskElement=Fo;class mc extends Fo{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||r==null||r<o?r:o}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,o=t&&t.focusOffset;return o==null||r==null||r>o?r:o}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,t);const o=this.rootElement,s=o.getSelection&&o.getSelection();s&&(s.removeAllRanges(),s.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}ce.HTMLContenteditableMaskElement=mc;class Ol{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>Ol.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ol.MAX_LENGTH=100;class Om{constructor(e,t){this.el=e instanceof Ll?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new mc(e):new Lm(e),this.masked=sn(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ol,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return e==null||((t=this.masked)==null?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof ce.Masked)&&this.masked.constructor===Bm(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof ce.Masked?e:sn({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const r=this._listeners[e];r&&r.forEach(o=>o(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,r=this.masked.value,o=this.masked.rawInputValue,s=this.displayValue,l=this.unmaskedValue!==t||this.value!==r||this._rawInputValue!==o;this._unmaskedValue=t,this._value=r,this._rawInputValue=o,this.el.value!==s&&(this.el.value=s),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),l&&this._fireChangeEvents(),!this._historyChanging&&(l||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...r}=e,o=!this.maskEquals(t),s=this.masked.optionsIsChanged(r);o&&(this.mask=t),s&&this.masked.updateOptions(r),(o||s)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,te.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const r=this._listeners[e].indexOf(t);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new hO({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,o=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,s=r===this.masked.rawInputValue?t.removeDirection:te.NONE;let l=this.masked.nearestInputPos(t.startChangePos+o,s);s!==te.NONE&&(l=this.masked.nearestInputPos(l,te.NONE)),this.updateControl(l),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}ce.InputMask=Om;class de{static normalize(e){return Array.isArray(e)?e:[e,new de]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}ce.ChangeDetails=de;class ln{constructor(e,t,r){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=r}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class rt{constructor(e){this._value="",this._update({...rt.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){t===void 0&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ln(this.extractInput(e,t),e)}appendTail(e){return Jn(e)&&(e=new ln(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new de({inserted:e,rawInserted:e})):new de}_appendChar(e,t,r){t===void 0&&(t={});const o=this.state;let s;if([e,s]=this.doPrepareChar(e,t),e&&(s=s.aggregate(this._appendCharRaw(e,t)),!s.rawInserted&&this.autofix==="pad")){const l=this.state;this.state=o;let a=this.pad(t);const c=this._appendCharRaw(e,t);a=a.aggregate(c),c.rawInserted||a.equals(s)?s=a:this.state=l}if(s.inserted){let l,a=this.doValidate(t)!==!1;if(a&&r!=null){const c=this.state;if(this.overwrite===!0){l=r.state;for(let u=0;u<s.rawInserted.length;++u)r.unshift(this.displayValue.length-s.tailShift)}let d=this.appendTail(r);if(a=d.rawInserted.length===r.toString().length,!(a&&d.inserted)&&this.overwrite==="shift"){this.state=c,l=r.state;for(let u=0;u<s.rawInserted.length;++u)r.shift();d=this.appendTail(r),a=d.rawInserted.length===r.toString().length}a&&d.inserted&&(this.state=c)}a||(s=new de,this.state=o,r&&l&&(r.state=l))}return s}_appendPlaceholder(){return new de}_appendEager(){return new de}append(e,t,r){if(!Jn(e))throw new Error("value should be string");const o=Jn(r)?new ln(String(r)):r;t!=null&&t.tail&&(t._beforeTailState=this.state);let s;[e,s]=this.doPrepare(e,t);for(let l=0;l<e.length;++l){const a=this._appendChar(e[l],t,o);if(!a.rawInserted&&!this.doSkipInvalid(e[l],t,o))break;s.aggregate(a)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&s.aggregate(this._appendEager()),o!=null&&(s.tailShift+=this.appendTail(o).tailShift),s}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new de}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,r=this.value,o=e();return this.rawInputValue=t,this.value&&this.value!==r&&r.indexOf(this.value)===0&&(this.append(r.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,r=e(this);return this.state=t,delete this._isolated,r}doSkipInvalid(e,t,r){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),de.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),de.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,r,o,s){r===void 0&&(r=""),o===void 0&&(o=te.NONE),s===void 0&&(s={input:!0});const l=e+t,a=this.extractTail(l),c=this.eager===!0||this.eager==="remove";let d;c&&(o=Am(o),d=this.extractInput(0,l,{raw:!0}));let u=e;const f=new de;if(o!==te.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!c?te.NONE:o),f.tailShift=u-e),f.aggregate(this.remove(u)),c&&o!==te.NONE&&d===this.rawInputValue)if(o===te.FORCE_LEFT){let p;for(;d===this.rawInputValue&&(p=this.displayValue.length);)f.aggregate(new de({tailShift:-1})).aggregate(this.remove(p-1))}else o===te.FORCE_RIGHT&&a.unshift();return f.aggregate(this.append(r,s,a))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Vl(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||rt.EMPTY_VALUES.includes(e)&&rt.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}rt.DEFAULTS={skipInvalid:!0},rt.EMPTY_VALUES=[void 0,null,""],ce.Masked=rt;class Yn{constructor(e,t){e===void 0&&(e=[]),t===void 0&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=Jn(e)?new ln(String(e)):e;const t=this.chunks[this.chunks.length-1],r=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof ln)r?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof Yn){if(e.stop==null){let o;for(;e.chunks.length&&e.chunks[0].stop==null;)o=e.chunks.shift(),o.from+=e.from,this.extend(o)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof ce.MaskedPattern))return new ln(this.toString()).appendTo(e);const t=new de;for(let r=0;r<this.chunks.length;++r){const o=this.chunks[r],s=e._mapPosToBlock(e.displayValue.length),l=o.stop;let a;if(l!=null&&(!s||s.index<=l)&&((o instanceof Yn||e._stops.indexOf(l)>=0)&&t.aggregate(e._appendPlaceholder(l)),a=o instanceof Yn&&e._blocks[l]),a){const c=a.appendTail(o);t.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&t.aggregate(e.append(d,{tail:!0}))}else t.aggregate(e.append(o.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...r}=e;Object.assign(this,r),this.chunks=t.map(o=>{const s="chunks"in o?new Yn:new ln;return s.state=o,s})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let r=0;for(;r<this.chunks.length;){const o=this.chunks[r],s=o.unshift(t);if(o.toString()){if(!s)break;++r}else this.chunks.splice(r,1);if(s)return s}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],r=t.shift();if(t.toString()){if(!r)break;--e}else this.chunks.splice(e,1);if(r)return r}return""}}class gO{constructor(e,t){this.masked=e,this._log=[];const{offset:r,index:o}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((t=this.block)==null?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,te.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,te.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,te.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,te.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,te.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,te.NONE),!0})}}class gc{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new de}nearestInputPos(e,t){t===void 0&&(t=te.NONE);const r=0,o=this._value.length;switch(t){case te.LEFT:case te.FORCE_LEFT:return r;case te.NONE:case te.RIGHT:case te.FORCE_RIGHT:default:return o}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),r===void 0&&(r={}),r.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new de;const r=this.eager===!0||this.eager==="append",o=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!r)&&!t.tail,s=new de({inserted:this.char,rawInserted:o?this.char:""});return this._value=this.char,this._isRawInput=o&&(t.raw||t.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new de;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ln("")}appendTail(e){return Jn(e)&&(e=new ln(String(e))),e.appendTo(this)}append(e,t,r){const o=this._appendChar(e[0],t);return r!=null&&(o.tailShift+=this.appendTail(r).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class Po{constructor(e){const{parent:t,isOptional:r,placeholderChar:o,displayChar:s,lazy:l,eager:a,...c}=e;this.masked=sn(c),Object.assign(this,{parent:t,isOptional:r,placeholderChar:o,displayChar:s,lazy:l,eager:a})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),e===0&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new de}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new de;const r=this.masked.state;let o=this.masked._appendChar(e,this.currentMaskFlags(t));return o.inserted&&this.doValidate(t)===!1&&(o=new de,this.masked.state=r),!o.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(e,t,r){return this.masked.append(e,this.currentMaskFlags(t),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,r)}nearestInputPos(e,t){t===void 0&&(t=te.NONE);const r=0,o=this.value.length,s=Math.min(Math.max(e,r),o);switch(t){case te.LEFT:case te.FORCE_LEFT:return this.isComplete?s:r;case te.RIGHT:case te.FORCE_RIGHT:return this.isComplete?s:o;case te.NONE:default:return s}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(e==null||(t=e._beforeTailState)==null?void 0:t.masked)||e?._beforeTailState}}pad(e){return new de}}Po.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class Im extends rt{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=r=>r.search(t)>=0),super._update(e)}}ce.MaskedRegExp=Im;class ot extends rt{constructor(e){super({...ot.DEFAULTS,...e,definitions:Object.assign({},Po.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let r=!1,o=!1;for(let s=0;s<t.length;++s){if(this.blocks){const d=t.slice(s),u=Object.keys(this.blocks).filter(p=>d.indexOf(p)===0);u.sort((p,h)=>h.length-p.length);const f=u[0];if(f){const{expose:p,repeat:h,...m}=Ur(this.blocks[f]),g={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:h,parent:this},y=h!=null?new ce.RepeatBlock(g):sn(g);y&&(this._blocks.push(y),p&&(this.exposeBlock=y),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),s+=f.length-1;continue}}let l=t[s],a=l in e;if(l===ot.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(l==="{"||l==="}"){r=!r;continue}if(l==="["||l==="]"){o=!o;continue}if(l===ot.ESCAPE_CHAR){if(++s,l=t[s],!l)break;a=!1}const c=a?new Po({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ur(e[l]),parent:this}):new gc({char:l,eager:this.eager,isUnmasking:r});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...r}=e;this._blocks.forEach((o,s)=>o.state=t[s]),super.state=r}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+=t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+=t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+=t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new de;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return t;this._blocks[r].isFilled&&++r;for(let o=r;o<this._blocks.length;++o){const s=this._blocks[o]._appendEager();if(!s.inserted)break;t.aggregate(s)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._mapPosToBlock(this.displayValue.length),o=new de;if(!r)return o;for(let l=r.index,a;a=this._blocks[l];++l){var s;const c=a._appendChar(e,{...t,_beforeTailState:(s=t._beforeTailState)==null||(s=s._blocks)==null?void 0:s[l]});if(o.aggregate(c),c.consumed)break}return o}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=new Yn;return e===t||this._forEachBlocksInRange(e,t,(o,s,l,a)=>{const c=o.extractTail(l,a);c.stop=this._findStopBefore(s),c.from=this._blockStartPos(s),c instanceof Yn&&(c.blockIndex=s),r.extend(c)}),r}extractInput(e,t,r){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),r===void 0&&(r={}),e===t)return"";let o="";return this._forEachBlocksInRange(e,t,(s,l,a,c)=>{o+=s.extractInput(a,c,r)}),o}_findStopBefore(e){let t;for(let r=0;r<this._stops.length;++r){const o=this._stops[r];if(o<=e)t=o;else break}return t}_appendPlaceholder(e){const t=new de;if(this.lazy&&e==null)return t;const r=this._mapPosToBlock(this.displayValue.length);if(!r)return t;const o=r.index,s=e??this._blocks.length;return this._blocks.slice(o,s).forEach(l=>{if(!l.lazy||e!=null){var a;t.aggregate(l._appendPlaceholder((a=l._blocks)==null?void 0:a.length))}}),t}_mapPosToBlock(e){let t="";for(let r=0;r<this._blocks.length;++r){const o=this._blocks[r],s=t.length;if(t+=o.displayValue,e<=t.length)return{index:r,offset:e-s}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,r)=>t+=r.displayValue.length,0)}_forEachBlocksInRange(e,t,r){t===void 0&&(t=this.displayValue.length);const o=this._mapPosToBlock(e);if(o){const s=this._mapPosToBlock(t),l=s&&o.index===s.index,a=o.offset,c=s&&l?s.offset:this._blocks[o.index].displayValue.length;if(r(this._blocks[o.index],o.index,a,c),s&&!l){for(let d=o.index+1;d<s.index;++d)r(this._blocks[d],d,0,this._blocks[d].displayValue.length);r(this._blocks[s.index],s.index,0,s.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._forEachBlocksInRange(e,t,(o,s,l,a)=>{r.aggregate(o.remove(l,a))}),r}nearestInputPos(e,t){if(t===void 0&&(t=te.NONE),!this._blocks.length)return 0;const r=new gO(this,e);if(t===te.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(t===te.LEFT||t===te.FORCE_LEFT){if(t===te.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),t===te.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:t===te.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return t===te.RIGHT||t===te.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:t===te.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,te.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,t,(o,s,l,a)=>{r+=o.totalInputPositions(l,a)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(r=>this._blocks[r]):[]}pad(e){const t=new de;return this._forEachBlocksInRange(0,this.displayValue.length,r=>t.aggregate(r.pad(e))),t}}ot.DEFAULTS={...rt.DEFAULTS,lazy:!0,placeholderChar:"_"},ot.STOP_CHAR="`",ot.ESCAPE_CHAR="\\",ot.InputDefinition=Po,ot.FixedDefinition=gc,ce.MaskedPattern=ot;class $o extends ot{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:r=this.from||0,maxLength:o=this.maxLength||0,autofix:s=this.autofix,...l}=e;this.to=t,this.from=r,this.maxLength=Math.max(String(t).length,o),this.autofix=s;const a=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===a[d];)++d;l.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(l)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",r="";const[,o,s]=e.match(/^(\D*)(\d*)(\D*)/)||[];return s&&(t="0".repeat(o.length)+s,r="9".repeat(o.length)+s),t=t.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[t,r]}doPrepareChar(e,t){t===void 0&&(t={});let r;return[e,r]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(r.skip=!this.isComplete),[e,r]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const r=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[s,l]=this.boundaries(this.value+e);return Number(l)<this.from?super._appendCharRaw(r[this.value.length],t):Number(s)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(r[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(o[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(t.search(/[^0]/)===-1&&t.length<=this._matchFrom)return!0;const[r,o]=this.boundaries(t);return this.from<=Number(o)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const t=new de;if(this.value.length===this.maxLength)return t;const r=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let s=0;s<o;++s)t.aggregate(super._appendCharRaw("0",e));r.split("").forEach(s=>this._appendCharRaw(s))}return t}}ce.MaskedRange=$o;const yO="d{.}`m{.}`Y";class an extends ot{static extractPatternOptions(e){const{mask:t,pattern:r,...o}=e;return{...o,mask:Jn(t)?t:r}}constructor(e){super(an.extractPatternOptions({...an.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:r,blocks:o,...s}={...an.DEFAULTS,...e},l=Object.assign({},an.GET_DEFAULT_BLOCKS());e.min&&(l.Y.from=e.min.getFullYear()),e.max&&(l.Y.to=e.max.getFullYear()),e.min&&e.max&&l.Y.from===l.Y.to&&(l.m.from=e.min.getMonth()+1,l.m.to=e.max.getMonth()+1,l.m.from===l.m.to&&(l.d.from=e.min.getDate(),l.d.to=e.max.getDate())),Object.assign(l,this.blocks,o),super._update({...s,mask:Jn(t)?t:r,blocks:l})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&t!=null&&(this.min==null||this.min<=t)&&(this.max==null||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(an.extractPatternOptions(e))}}an.GET_DEFAULT_BLOCKS=()=>({d:{mask:$o,from:1,to:31,maxLength:2},m:{mask:$o,from:1,to:12,maxLength:2},Y:{mask:$o,from:1900,to:9999}}),an.DEFAULTS={...ot.DEFAULTS,mask:Date,pattern:yO,format:(n,e)=>{if(!n)return"";const t=String(n.getDate()).padStart(2,"0"),r=String(n.getMonth()+1).padStart(2,"0"),o=n.getFullYear();return[t,r,o].join(".")},parse:(n,e)=>{const[t,r,o]=n.split(".").map(Number);return new Date(o,r-1,t)}},ce.MaskedDate=an;class zo extends rt{constructor(e){super({...zo.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(t=>{const{expose:r,...o}=Ur(t),s=sn({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return r&&(this.exposeMask=s),s}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._applyDispatch(e,t);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),r}_applyDispatch(e,t,r){e===void 0&&(e=""),t===void 0&&(t={}),r===void 0&&(r="");const o=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,s=this.rawInputValue,l=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:s,a=s.slice(l.length),c=this.currentMask,d=new de,u=c?.state;return this.currentMask=this.doDispatch(e,{...t},r),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),l&&(this.currentMask.append(l,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),a&&(d.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new de;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,r;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,t,r){return t===void 0&&(t={}),r===void 0&&(r=""),this.dispatch(e,this,t,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[r,o]=super.doPrepare(e,t);if(this.currentMask){let s;[r,s]=super.doPrepare(r,this.currentMaskFlags(t)),o=o.aggregate(s)}return[r,o]}doPrepareChar(e,t){t===void 0&&(t={});let[r,o]=super.doPrepareChar(e,t);if(this.currentMask){let s;[r,s]=super.doPrepareChar(r,this.currentMaskFlags(t)),o=o.aggregate(s)}return[r,o]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,t){const r=new de;return this.currentMask&&r.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),r}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:r,currentMask:o,...s}=e;t&&this.compiledMasks.forEach((l,a)=>l.state=t[a]),r!=null&&(this.currentMask=r,this.currentMask.state=o),super.state=s}extractInput(e,t,r){return this.currentMask?this.currentMask.extractInput(e,t,r):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((t,r)=>{if(!e[r])return;const{mask:o,...s}=e[r];return Vl(t,s)&&t.maskEquals(o)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}zo.DEFAULTS={...rt.DEFAULTS,dispatch:(n,e,t,r)=>{if(!e.compiledMasks.length)return;const o=e.rawInputValue,s=e.compiledMasks.map((l,a)=>{const c=e.currentMask===l,d=c?l.displayValue.length:l.nearestInputPos(l.displayValue.length,te.FORCE_LEFT);return l.rawInputValue!==o?(l.reset(),l.append(o,{raw:!0})):c||l.remove(d),l.append(n,e.currentMaskFlags(t)),l.appendTail(r),{index:a,weight:l.rawInputValue.length,totalInputPositions:l.totalInputPositions(0,Math.max(d,l.nearestInputPos(l.displayValue.length,te.FORCE_LEFT)))}});return s.sort((l,a)=>a.weight-l.weight||a.totalInputPositions-l.totalInputPositions),e.compiledMasks[s[0].index]}},ce.MaskedDynamic=zo;class Ho extends ot{constructor(e){super({...Ho.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...r}=e;if(t){const o=t.map(a=>a.length),s=Math.min(...o),l=Math.max(...o)-s;r.mask="*".repeat(s),l&&(r.mask+="["+"*".repeat(l)+"]"),this.enum=t}super._update(r)}_appendCharRaw(e,t){t===void 0&&(t={});const r=Math.min(this.nearestInputPos(0,te.FORCE_RIGHT),this.value.length),o=this.enum.filter(s=>this.matchValue(s,this.unmaskedValue+e,r));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(l,a)=>{const c=o[0][a];a>=this.value.length||c===l.value||(l.reset(),l._appendChar(c,t))});const s=super._appendCharRaw(o[0][this.value.length],t);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(l=>s.aggregate(super._appendCharRaw(l))),s}return new de({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ln("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new de;const r=Math.min(super.nearestInputPos(0,te.FORCE_RIGHT),this.value.length);let o;for(o=e;o>=0&&!(this.enum.filter(l=>this.matchValue(l,this.value.slice(r,o),r)).length>1);--o);const s=super.remove(o,t);return s.tailShift+=o-e,s}get isComplete(){return this.enum.indexOf(this.value)>=0}}Ho.DEFAULTS={...ot.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},ce.MaskedEnum=Ho;class Dm extends rt{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}ce.MaskedFunction=Dm;var Rm;class Et extends rt{constructor(e){super({...Et.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",r=(this.scale?"("+hc(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(hc).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(hc(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){t===void 0&&(t={});const[r,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!r&&(o.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&o.aggregate(this._appendChar("-")),[r,o]}_separatorsCount(e,t){t===void 0&&(t=!1);let r=0;for(let o=0;o<e;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++r,t&&(e+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,r))}_appendCharRaw(e,t){t===void 0&&(t={});const r=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const s=this._value;this._value+=e;const l=this.number;let a=!isNaN(l),c=!1;if(a){let p;this.min!=null&&this.min<0&&this.number<this.min&&(p=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(p=this.max),p!=null&&(this.autofix?(this._value=this.format(p,this).replace(Et.UNMASKED_RADIX,this.radix),c||(c=s===this._value&&!t.tail)):a=!1),a&&(a=!!this._value.match(this._numberRegExp))}let d;a?d=new de({inserted:this._value.slice(s.length),rawInserted:c?"":e,skip:c}):(this._value=s,d=new de),this._value=this._insertThousandsSeparators(this._value);const u=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(u);return d.tailShift+=(f-o)*this.thousandsSeparator.length,d}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,t);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,t){const r=this._findSeparatorAround(e);r>=0&&(e=r);const o=this._findSeparatorAround(t);return o>=0&&(t=o+this.thousandsSeparator.length),[e,t]}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const r=this.value.slice(0,e),o=this.value.slice(t),s=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+o));const l=this._separatorsCountFromSlice(r);return new de({tailShift:(l-s)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case te.NONE:case te.LEFT:case te.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const o=r+this.thousandsSeparator.length;if(e<o||this.value.length<=o||t===te.FORCE_LEFT)return r}break}case te.RIGHT:case te.FORCE_RIGHT:{const r=this._findSeparatorAround(e);if(r>=0)return r+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;this.min!=null&&(t=Math.max(t,this.min)),this.max!=null&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(r,o,s,l)=>o+l),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,r){t===void 0&&(t={});const o=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===Et.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,r)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Et.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(Et.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||Et.EMPTY_VALUES.includes(e)&&Et.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Rm=Et,Et.UNMASKED_RADIX=".",Et.EMPTY_VALUES=[...rt.EMPTY_VALUES,0],Et.DEFAULTS={...rt.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Rm.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:n=>n.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},ce.MaskedNumber=Et;const Il={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function yc(n,e,t){e===void 0&&(e=Il.MASKED),t===void 0&&(t=Il.MASKED);const r=sn(n);return o=>r.runIsolated(s=>(s[e]=o,s[t]))}function Fm(n,e,t,r){return yc(e,t,r)(n)}ce.PIPE_TYPE=Il,ce.createPipe=yc,ce.pipe=Fm;class Pm extends ot{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,r,o;const{repeat:s,...l}=Ur(e);this._blockOpts=Object.assign({},this._blockOpts,l);const a=sn(this._blockOpts);this.repeat=(t=(r=s??a.repeat)!=null?r:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:a},eager:a.eager,overwrite:a.overwrite,skipInvalid:a.skipInvalid,lazy:a.lazy,placeholderChar:a.placeholderChar,displayChar:a.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(sn(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const r=new de;for(let c=(o=(s=this._mapPosToBlock(this.displayValue.length))==null?void 0:s.index)!=null?o:Math.max(this._blocks.length-1,0),d,u;d=(l=this._blocks[c])!=null?l:u=!u&&this._allocateBlock(c);++c){var o,s,l,a;const f=d._appendChar(e,{...t,_beforeTailState:(a=t._beforeTailState)==null||(a=a._blocks)==null?void 0:a[c]});if(f.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(f),f.consumed)break}return r}_trimEmptyTail(e,t){var r,o;e===void 0&&(e=0);const s=Math.max(((r=this._mapPosToBlock(e))==null?void 0:r.index)||0,this.repeatFrom,0);let l;t!=null&&(l=(o=this._mapPosToBlock(t))==null?void 0:o.index),l==null&&(l=this._blocks.length-1);let a=0;for(let c=l;s<=c&&!this._blocks[c].unmaskedValue;--c,++a);a&&(this._blocks.splice(l-a+1,a),this.mask=this.mask.slice(a))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._trimEmptyTail(e,t),r}totalInputPositions(e,t){return e===void 0&&(e=0),t==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}ce.RepeatBlock=Pm;try{globalThis.IMask=ce}catch{}const bO=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:Yn,DIRECTION:te,HTMLContenteditableMaskElement:mc,HTMLInputMaskElement:Lm,HTMLMaskElement:Fo,InputMask:Om,MaskElement:Ll,Masked:rt,MaskedDate:an,MaskedDynamic:zo,MaskedEnum:Ho,MaskedFunction:Dm,MaskedNumber:Et,MaskedPattern:ot,MaskedRange:$o,MaskedRegExp:Im,PIPE_TYPE:Il,PatternFixedDefinition:gc,PatternInputDefinition:Po,RepeatBlock:Pm,createMask:sn,createPipe:yc,default:ce,forceDirection:Am,normalizeOpts:Ur,pipe:Fm},Symbol.toStringTag,{value:"Module"}));Gt.VsRichtext=El,Gt.VsRichtextMd=El,Gt.VsRichtextPage=fh,Gt.default=pO,Object.defineProperties(Gt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));