@opengis/richtext 0.0.25 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/richtext.js +7082 -7380
- package/dist/richtext.umd.cjs +34 -48
- package/package.json +1 -1
package/dist/richtext.umd.cjs
CHANGED
|
@@ -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 Qe(n){this.content=n}Qe.prototype={constructor:Qe,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 Qe(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 Qe(t)},addToStart:function(n,e){return new Qe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qe(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 Qe(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=Qe.from(n),n.size?new Qe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qe.from(n),n.size?new Qe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qe.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}},Qe.from=function(n){if(n instanceof Qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qe(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 I{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 I(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 I(r,o)}cutByIndex(e,t){return e==t?I.empty:e==0&&t==this.content.length?this:new I(this.content.slice(e,t))}replaceChild(e,t){let 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 I(o,s)}addToStart(e){return new I([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new I(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,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 I.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new I(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return I.empty;let t,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 I(t||e,r)}static from(e){if(!e)return I.empty;if(e instanceof I)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new I([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}I.empty=new I([],0);const 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 q{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 q(r,this.openStart,this.openEnd)}removeBetween(e,t){return new q(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 q.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 q(I.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 q(e,r,o)}}q.empty=new q(I.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 zm(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}=Hm(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 I(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 I(r)}function Hm(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(I.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 jm);let o=r.elts[r.i]=Gr.resolve(e,t);return r.i=(r.i+1)%Um,o}}class jm{constructor(){this.elts=[],this.i=0}}const Um=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 Wm=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||I.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,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||Wm)&&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 q.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 q(d,o.depth-l,s.depth-l)}replace(e,t,r){return zm(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=I.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=I.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 Km(e,t);if(r.next==null)return er.empty;let o=Bc(r);r.next&&r.err("Unexpected trailing text");let s=Qm(Zm(o));return eg(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 I.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 Km{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(qm(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function qm(n){let e=[];do e.push(Gm(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Gm(n){let e=Xm(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=Jm(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 Jm(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 Ym(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 Xm(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=Ym(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 Zm(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 Qm(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 eg(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 ng(n,r,e[r]);return t}let Pc=class Dm{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),I.from(t),Se.setFrom(r))}createChecked(e=null,t,r){return t=I.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=I.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(I.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 Dm(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 tg(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 ng{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?tg(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=Qe.from(e.nodes),t.marks=Qe.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 rg(n){return n.tag!=null}function og(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(rg(o))this.tags.push(o);else if(og(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),q.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(ig(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},sg={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(I.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=I.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(I.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!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
|
|
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 lg(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 ig(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 ag(n){let e=Jc.get(n);return e===void 0&&Jc.set(n,e=cg(n)),e}function cg(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=ag(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 dg(n,e){return n+e*Xc}function Zc(n){return n&Yc}function ug(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 wt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&wt.empty)return wt.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+ug(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:dg(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 wt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wt.empty:new wt(e<0?[0,-e,0]:[0,0,e])}}wt.empty=new wt([]);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 ot{getMap(){return wt.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 I.fromArray(r)}class Nn extends ot{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 q(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))}}ot.jsonID("addMark",Nn);class zt extends ot{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 q(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))}}ot.jsonID("removeMark",zt);class Mn extends ot{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 q(I.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))}}ot.jsonID("addNodeMark",Mn);class nr extends ot{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 q(I.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))}}ot.jsonID("removeNodeMark",nr);class Ge extends ot{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 wt([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?q.empty:new q(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?q.empty:new q(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,q.fromJSON(e,t.slice),!!t.structure)}}ot.jsonID("replace",Ge);class Je extends ot{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 wt([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,q.fromJSON(e,t.slice),t.insert,!!t.structure)}}ot.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 fg(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 pg(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,q.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 q(I.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(I.empty,!0);n.replace(a,a,new q(c,0,0))}for(let c=l.length-1;c>=0;c--)n.step(l[c])}function hg(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||!hg(o,s,l))break}return null}function mg(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=I.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=I.from(r.node(m).copy(u)),f++):c--;let p=I.empty,h=0;for(let m=s,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,p=I.from(o.node(m).copy(p)),h++):d++;n.step(new Je(c,d,l,a,new q(u.append(p),f,h),u.size-f,!0))}function ql(n,e,t=null,r=n){let o=gg(n,e),s=o&&yg(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 gg(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 yg(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 bg(n,e,t){let r=I.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=I.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 q(r,0,0),t.length,!0))}function kg(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)&&xg(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 q(I.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 xg(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function wg(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 q(I.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 Eg(n,e,t=1,r){let o=n.doc.resolve(e),s=I.empty,l=I.empty;for(let a=o.depth,c=o.depth-t,d=t-1;a>c;a--,d--){s=I.from(o.node(a).copy(s));let u=r&&r[d];l=I.from(u?u.type.create(u.attrs,l):o.node(a).copy(l))}n.step(new Ge(e,e,new q(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 Cg(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&&Cg(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 vg(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),q.empty,!0)),r===!0){let u=n.doc.resolve(d);rd(n,u.node(),u.before(),n.steps.length)}return n}function _g(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=q.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 Sg(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 Sg{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=I.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=I.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 q(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(I.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 q(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 q(Zr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new q(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,I.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?q.empty:new q(Zr(l.content,e-1,1),e-1,h<0?l.openEnd:e-1):new q(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,I.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(I.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(I.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&&!Ng(t,s.content,l)?a:null}function Ng(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Mg(n){return n.spec.defining||n.spec.definingForContent}function Tg(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=Mg(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),w=o.index(y-1);if(k.canReplaceWith(w,w,m.type,m.marks))return n.replace(o.before(y),b?s.after(y):t,new q(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(I.empty,!0))}return n}function Ag(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=_g(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new q(I.from(r),0,0))}function Bg(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 ot{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 q(I.from(o),0,t.isLeaf?0:1))}getMap(){return wt.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)}}ot.jsonID("attr",Cr);class eo extends ot{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 wt.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)}}ot.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=q.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 q(I.from(r),0,0))}delete(e,t){return this.replace(e,t,q.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Tg(this,e,t,r),this}replaceRangeWith(e,t,r){return Ag(this,e,t,r),this}deleteRange(e,t){return Bg(this,e,t),this}lift(e,t){return mg(this,e,t),this}join(e,t=1){return vg(this,e,t),this}wrap(e,t){return bg(this,e,t),this}setBlockType(e,t=e,r,o=null){return kg(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return wg(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 Eg(this,e,t,r),this}addMark(e,t,r){return fg(this,e,t,r),this}removeMark(e,t,r){return pg(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=q.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?q.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 oe(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 Et(e.node(0))}static atStart(e){return _r(e,e,0,0,1)||new Et(e)}static atEnd(e){return _r(e,e,e.content.size,e.childCount,-1)||new Et(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 oe.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 oe 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 oe(o.parent.inlineContent?o:r,r)}replace(e,t=q.empty){if(super.replace(e,t),t==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof oe&&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 oe(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 oe(e,t)}}le.jsonID("text",oe);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 oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class ne 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 ne(s)}content(){return new q(I.from(this.node),0,0)}eq(e){return e instanceof ne&&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 ne(e.resolve(t.anchor))}static create(e,t){return new ne(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ne.prototype.visible=!1,le.jsonID("node",ne);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&&ne.isSelectable(r)?new ne(t):le.near(t)}}class Et extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=q.empty){if(t==q.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 Et(e)}map(e){return new Et(e)}eq(e){return e instanceof Et}getBookmark(){return Vg}}le.jsonID("all",Et);const Vg={map(){return this},resolve(n){return new Et(n)}};function _r(n,e,t,r,o,s=!1){if(e.inlineContent)return oe.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&&ne.isSelectable(a))return ne.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 Lg 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 Og=[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=Og.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 Lg(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")||ne.isSelectable(s)))for(let l=r.depth;;l--){let a=ns(n.doc,r.before(l),r.after(l),q.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):ne.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},Ig=(n,e,t)=>{let r=xd(n,t);if(!r)return!1;let o=ni(r);return o?Ed(n,o,e):!1},Dg=(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,q.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(oe.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||!ne.isSelectable(l)?!1:(e&&e(n.tr.setSelection(ne.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")||ne.isSelectable(s))){let l=ns(n.doc,r.before(),r.after(),q.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):ne.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||!ne.isSelectable(l)?!1:(e&&e(n.tr.setSelection(ne.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 Rg=(n,e)=>{let t=n.selection,r=t instanceof ne,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(ne.create(s.doc,o-n.doc.resolve(o).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Fg=(n,e)=>{let t=n.selection,r;if(t instanceof ne){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},Pg=(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 $g=(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 Et||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(oe.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 zg(n){return(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof ne&&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 oe||e.selection instanceof Et)&&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 Hg=zg(),jg=(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(ne.create(n.doc,o))),!0)};function Ug(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&&Ug(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=I.empty;for(let b=l.length-1;b>=0;b--)m=I.from(l[b].create(null,m));m=I.from(o.copy(m));let g=n.tr.step(new Je(e.pos-1,h,e.pos,h,new q(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=I.empty;for(let w=m.length-1;w>=0;w--)b=I.from(m[w].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 q(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(oe.create(e.doc,n<0?o.start(s):o.end(s)))),!0):!1}}const Wg=Bd(-1),Kg=Bd(1);function qg(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,Hg),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Gg(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 Jg(a,l,n,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Jg(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&&Yg(n,e,a,o,t),!0):!1}function Yg(n,e,t,r,o){let s=I.empty;for(let u=t.length-1;u>=0;u--)s=I.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 q(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 Xg(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?Zg(e,t,n,s):Qg(e,t,s):!0:!1}}function Zg(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 q(I.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 Qg(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?I.empty:I.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 q((a?I.empty:I.from(o.copy(I.empty))).append(c?I.empty:I.from(o.copy(I.empty))),a?0:1,c?0:1),a?0:1)),e(r.scrollIntoView()),!0}function e0(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=I.from(d?n.create():null),f=new q(I.from(n.create(null,I.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 et=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},t0=function(){li=null},rr=function(n,e,t,r){return t&&(Ld(n,e,t,r,-1)||Ld(n,e,t,r,1))},n0=/^(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:Mt(n))){let l=n.parentNode;if(!l||l.nodeType!=1||no(n)||n0.test(n.nodeName)||n.contentEditable=="false")return!1;e=et(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?Mt(n):0}else return!1}}function Mt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function r0(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=Mt(n)}else if(n.parentNode&&!no(n))e=et(n),n=n.parentNode;else return null}}function o0(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=et(n)+1,n=n.parentNode;else return null}}function s0(n,e,t){for(let r=e==0,o=e==Mt(n);r||o;){if(n==t)return!0;let s=et(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,o=o&&s==Mt(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 l0(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function i0(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(Mt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Mt(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),gt=!!(Id||ai||ii),Bn=Id?document.documentMode:ai?+ai[1]:ii?+ii[1]:0,Tt=!gt&&/gecko\/(\d+)/i.test(An);Tt&&+(/Firefox\/(\d+)/.exec(An)||[0,0])[1];const ci=!gt&&/Chrome\/(\d+)/.exec(An),st=!!ci,Dd=ci?+ci[1]:0,dt=!gt&&!!Jt&&/Apple Computer/.test(Jt.vendor),Tr=dt&&(/Mobile\/\w+/.test(An)||!!Jt&&Jt.maxTouchPoints>2),At=Tr||(Jt?/Mac/.test(Jt.platform):!1),a0=Jt?/Win/.test(Jt.platform):!1,pn=/Android \d/.test(An),ro=!!Od&&"webkitFontSmoothing"in Od.documentElement.style,c0=ro?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function d0(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 u0(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?d0(s):u0(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 f0(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 p0({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 h0(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?m0(t,o):!t||r&&t.nodeType==1?{node:n,offset:s}:$d(t,o)}function m0(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 g0(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function y0(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 b0(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 k0(n,e){let t=n.dom.ownerDocument,r,o=0,s=i0(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(dt)for(let d=l;r&&d;d=Mr(d))d.draggable&&(r=void 0);if(l=g0(l,e),r){if(Tt&&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=b0(n,r,o,e))}a==null&&(a=y0(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 x0=/[\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||Tt;if(r.nodeType==3)if(l&&(x0.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let c=Vn(fn(r,o,o),t);if(Tt&&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==Mt(r))){let c=r.childNodes[o-1];if(c.nodeType==1)return ui(c.getBoundingClientRect(),!1)}if(s==null&&o<Mt(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==Mt(r))){let c=r.childNodes[o-1],d=c.nodeType==3?fn(c,Mt(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<Mt(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 w0(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 E0=/[\u0590-\u08ac]/;function C0(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: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 v0(n,e,t){return Wd==e&&Kd==t?qd:(Wd=e,Kd=t,qd=t=="up"||t=="down"?w0(n,e,t):C0(n,e,t))}const Bt=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=Bt,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>et(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?et(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?et(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=et(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=et(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((Tt||dt)&&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:et(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(Tt&&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&&dt)&&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&&Tt)){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==Bt&&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 _0 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!=Bt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Bt}}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 S0(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=()=>I.empty)}return e}matchesNode(e,t,r){return this.dirty==Bt&&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 M0(this,l&&l.node,e);B0(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&&V0(this.dom))}localCompositionInfo(e,t){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof oe)||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=L0(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 _0(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=Bt}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!=Bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Bt||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=Bt,!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==Bt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class S0 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}N0(o,a||ir[0],l)}return o}function N0(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 M0{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=T0(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=Bt,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=Bt),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))&&((dt||st)&&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 T0(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 B0(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 V0(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 L0(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&&ne.isSelectable(f)&&o.parent&&!(f.isInline&&s0(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;d=new ne(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&&st){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)I0(n);else{let{anchor:r,head:o}=t,s,l;ru&&!(t instanceof oe)&&(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&&O0(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const ru=dt||st&&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(dt&&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",dt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function su(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function O0(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 I0(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,et(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&>&&Bn<=11&&(t.disabled=!0,t.disabled=!1)}function lu(n,e){if(e instanceof ne){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))||oe.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 D0(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 oe)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 oe(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=yi(n.state,e);return o&&o instanceof ne?On(n,o):!1}else if(!(At&&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?ne.isSelectable(s)?On(n,new ne(e<0?n.state.doc.resolve(o.pos-s.nodeSize):o)):ro?On(n,new oe(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ne&&r.node.isInline)return On(n,new oe(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?R0(n):F0(n)}function R0(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let o,s,l=!1;for(Tt&&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=et(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 F0(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=et(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 P0(n,e){for(;n&&e==n.childNodes.length&&!no(n);)e=et(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 $0(n,e){for(;n&&!e&&!no(n);)e=et(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=P0(e,t))?(e=l,t=0):(s=$0(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(!(st||a0)&&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 oe&&!r.empty||t.indexOf("s")>-1||At&&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 ne)return On(n,l)}if(!o.parent.inlineContent){let l=e<0?o:s,a=r instanceof Et?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 oe))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 z0(n){if(!dt||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 H0(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function j0(n,e){let t=e.keyCode,r=H0(e);if(t==8||At&&t==72&&r=="c")return hu(n,-1)||Br(n,-1);if(t==46&&!e.shiftKey||At&&t==68&&r=="c")return hu(n,1)||Br(n,1);if(t==13||t==27)return!0;if(t==37||At&&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||At&&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||At&&t==80&&r=="c")return pu(n,-1,r)||Br(n,-1);if(t==40||At&&t==78&&r=="c")return z0(n)||pu(n,1,r)||Br(n,1);if(r==(At?"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 q(I.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=q0(t),ro&&G0(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&&!U0.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)a=J0(xu(a,+u[1],+u[2]),u[4]);else if(a=q.maxOpen(W0(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 U0=/^(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 W0(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 I.from(l)}return n}function yu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,I.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(I.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(I.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(I.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,l.copy(a))}function xu(n,e,t){return e<n.openStart&&(n=new q(xi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new q(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 K0(n){let e=window.trustedTypes;return e?(wi||(wi=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),wi.createHTML(n)):n}function q0(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=K0(n),o)for(let s=0;s<o.length;s++)t=t.querySelector(o[s])||t;return t}function G0(n){let e=n.querySelectorAll(st?"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 J0(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=I.from(c.create(r[a+1],o)),s++,l++}return new q(o,s,l)}const ut={},ft={},Y0={touchstart:!0,touchmove:!0};class X0{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 Z0(n){for(let e in ut){let t=ut[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{ey(n,r)&&!Ci(n,r)&&(n.editable||!(r.type in ft))&&t(n,r)},Y0[e]?{passive:!0}:void 0)}dt&&n.dom.addEventListener("input",()=>null),Ei(n)}function In(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Q0(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 ey(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 ty(n,e){!Ci(n,e)&&ut[e.type]&&(n.editable||!(e.type in ft))&&ut[e.type](n,e)}ft.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&&st&&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))||j0(n,t)?t.preventDefault():In(n,"key")},ft.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},ft.keypress=(n,e)=>{let t=e;if(_u(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||At&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof oe)||!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 ny(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 ry(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&ne.isSelectable(r)?(Vr(n,new ne(t)),!0):!1}function oy(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof ne&&(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(ne.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,ne.create(n.state.doc,o)),!0):!1}function sy(n,e,t,r,o){return vi(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(o?oy(n,t):ry(n,t))}function ly(n,e,t,r){return vi(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",o=>o(n,e,r))}function iy(n,e,t,r){return vi(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",o=>o(n,e,r))||ay(n,t,r)}function ay(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(Vr(n,oe.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,oe.create(r,a+1,a+1+l.content.size));else if(ne.isSelectable(l))Vr(n,ne.create(r,a));else continue;return!0}}function _i(n){return us(n)}const vu=At?"metaKey":"ctrlKey";ut.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&&ny(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 cy(n,l,t,!!r)):(s=="doubleClick"?ly:iy)(n,l.pos,l.inside,t)?t.preventDefault():In(n,"pointer"))};class cy{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 ne&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Tt&&!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"):sy(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||dt&&this.mightDrag&&!this.mightDrag.node.isAtom||st&&!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)}}ut.touchstart=n=>{n.input.lastTouch=Date.now(),_i(n),In(n,"pointer")},ut.touchmove=n=>{n.input.lastTouch=Date.now(),In(n,"pointer")},ut.contextmenu=n=>_i(n);function _u(n,e){return n.composing?!0:dt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const dy=pn?5e3:-1;ft.compositionstart=ft.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof oe&&(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),Tt&&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,dy)},ft.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=fy());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function uy(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=r0(e.focusNode,e.focusOffset),r=o0(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 fy(){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 py(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=gt&&Bn<15||Tr&&c0<604;ut.copy=ft.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)):py(n,a),o&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function hy(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function my(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||q.empty)))return!0;if(!s)return!1;let l=hy(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," "):""}ft.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():my(n,t)};class Tu{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const gy=At?"altKey":"ctrlKey";function Au(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[gy]}ut.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 ne?o.to-1:o.to))){if(r&&r.mightDrag)l=ne.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=ne.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||!st||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)},ut.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},ft.dragover=ft.dragenter=(n,e)=>e.preventDefault(),ft.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||q.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&&ne.isSelectable(l.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(l.content.firstChild))d.setSelection(new ne(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"))},ut.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))},ut.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)},ut.beforeinput=(n,e)=>{if(st&&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 ft)ut[n]=ft[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):lt}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==lt||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?yy(this.children,l||[],e,t,r,o,s):l?new Me(l.sort(cr),Lr):lt}add(e,t){return t.length?this==lt?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==lt?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!=lt?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):lt}forChild(e,t){if(this==lt)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||lt}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==lt)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 lt=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!=lt&&(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 lt;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 yy(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 w=a[b]+u-f;h>=w?a[b+1]=p<=w?-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!=lt?(a[d]=f,a[d+1]=h,a[d+2]=b):(a[d+1]=-2,c=!0)}else c=!0}if(c){let d=by(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 by(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!=lt&&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):lt}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!=lt&&e.push(r)}),n.cursorWrapper&&e.push(Me.create(n.state.doc,[n.cursorWrapper.deco])),Rn.from(e)}const ky={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},xy=gt&&Bn<=11;class wy{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 wy,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]);gt&&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()}),xy&&(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,ky)),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(gt&&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(Tt&&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||_y(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),Cy(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(gt&&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?et(o)+1:0,a=r.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?et(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 Cy(n){if(!Iu.has(n)&&(Iu.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Tt,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 vy(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 _y(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 Sy(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})),st&&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:Ny,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 Ny(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(dt&&/^(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||dt&&/^(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 My=/^(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 Ty(n,e,t,r,o){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let C=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,A=hi(n,C);if(A&&!n.state.selection.eq(A)){if(st&&pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",G=>G(n,or(13,"Enter"))))return;let z=n.state.tr.setSelection(A);C=="pointer"?z.setMeta("pointer",!0):C=="key"&&z.scrollIntoView(),s&&z.setMeta("composition",s),n.dispatch(z)}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=Sy(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=Vy(f.content,d.doc.content,d.from,p,h);if(m&&n.input.domChangeCount++,(Tr&&n.input.lastIOSEnter>Date.now()-225||pn)&&o.some(C=>C.nodeType==1&&!My.test(C.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",C=>C(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof oe&&!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 C=Fu(n,n.state.doc,d.sel);if(C&&!C.eq(n.state.selection)){let A=n.state.tr.setSelection(C);s&&A.setMeta("composition",s),n.dispatch(A)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof oe&&(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)),gt&&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(C=>C.nodeName=="DIV"||C.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",C=>C(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&By(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",C=>C(n,or(8,"Backspace")))){pn&&st&&n.domObserver.suppressSelectionUpdates();return}st&&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(C){return C(n,or(13,"Enter"))})},20));let w=m.start,x=m.endA,E=C=>{let A=C||n.state.tr.replace(w,x,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let z=Fu(n,A.doc,d.sel);z&&!(st&&n.composing&&z.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(z.head==w||z.head==A.mapping.map(x)-1)||gt&&z.empty&&z.head==w)&&A.setSelection(z)}return s&&A.setMeta("composition",s),A.scrollIntoView()},M;if(k){if(g.pos==y.pos){gt&&Bn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>mn(n),20));let C=E(n.state.tr.delete(w,x)),A=u.resolve(m.start).marksAcross(u.resolve(m.endA));A&&C.ensureMarks(A),n.dispatch(C)}else if(m.endA==m.endB&&(M=Ay(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let C=E(n.state.tr);M.type=="add"?C.addMark(w,x,M.mark):C.removeMark(w,x,M.mark),n.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,y.parentOffset),A=()=>E(n.state.tr.insertText(C,w,x));n.someProp("handleTextInput",z=>z(n,w,x,C,A))||n.dispatch(A())}}else n.dispatch(E())}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 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(I.from(d).eq(n))return{mark:a,type:l}}function By(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 Vy(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 X0,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 Ey(this,(r,o,s,l)=>Ty(this,r,o,s,l)),this.domObserver.start(),Z0(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);Oy(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&&f0(this);if(l){this.domObserver.stop();let h=f&&(gt||st)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&Ly(o.selection,e.selection);if(f){let m=st?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=uy(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())&&D0(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&&p0(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 ne){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:ne.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(gt){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&&h0(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 k0(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 v0(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&&(Q0(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,t0())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return ty(this,e)}domSelectionRange(){let e=this.domSelection();return e?dt&&this.root.nodeType===11&&l0(this.dom.ownerDocument)==this.dom&&vy(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 Ly(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 Oy(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:'"'},Iy=typeof navigator<"u"&&/Mac/.test(navigator.platform),Dy=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),tt=0;tt<10;tt++)Fn[48+tt]=Fn[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)Fn[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)Fn[tt]=String.fromCharCode(tt+32),hs[tt]=String.fromCharCode(tt);for(var Ai in Fn)hs.hasOwnProperty(Ai)||(hs[Ai]=Fn[Ai]);function Ry(n){var e=Iy&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Dy&&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 Fy=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Py=typeof navigator<"u"&&/Win/.test(navigator.platform);function $y(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))Fy?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 zy(n){let e=Object.create(null);for(let t in n)e[$y(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 Hy(n){return new Oe({props:{handleKeyDown:Vi(n)}})}function Vi(n){let e=zy(n);return function(t,r){let o=Ry(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)&&!(Py&&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 jy=Object.defineProperty,Li=(n,e)=>{for(var t in e)jy(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:()=>Uy,clearContent:()=>Wy,clearNodes:()=>Ky,command:()=>qy,createParagraphNear:()=>Gy,cut:()=>Jy,deleteCurrentNode:()=>Yy,deleteNode:()=>Xy,deleteRange:()=>Zy,deleteSelection:()=>Qy,enter:()=>eb,exitCode:()=>tb,extendMarkRange:()=>nb,first:()=>rb,focus:()=>sb,forEach:()=>lb,insertContent:()=>ib,insertContentAt:()=>db,joinBackward:()=>pb,joinDown:()=>fb,joinForward:()=>hb,joinItemBackward:()=>mb,joinItemForward:()=>gb,joinTextblockBackward:()=>yb,joinTextblockForward:()=>bb,joinUp:()=>ub,keyboardShortcut:()=>xb,lift:()=>wb,liftEmptyBlock:()=>Eb,liftListItem:()=>Cb,newlineInCode:()=>vb,resetAttributes:()=>_b,scrollIntoView:()=>Sb,selectAll:()=>Nb,selectNodeBackward:()=>Mb,selectNodeForward:()=>Tb,selectParentNode:()=>Ab,selectTextblockEnd:()=>Bb,selectTextblockStart:()=>Vb,setContent:()=>Lb,setMark:()=>Yb,setMeta:()=>Xb,setNode:()=>Zb,setNodeSelection:()=>Qb,setTextSelection:()=>e1,sinkListItem:()=>t1,splitBlock:()=>n1,splitListItem:()=>r1,toggleList:()=>o1,toggleMark:()=>s1,toggleNode:()=>l1,toggleWrap:()=>i1,undoInputRule:()=>a1,unsetAllMarks:()=>c1,unsetMark:()=>d1,updateAttributes:()=>u1,wrapIn:()=>f1,wrapInList:()=>p1});var Uy=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Wy=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),Ky=()=>({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},qy=n=>e=>n(e),Gy=()=>({state:n,dispatch:e})=>Md(n,e),Jy=(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 oe(r.doc.resolve(Math.max(l-1,0)))),!0},Yy=()=>({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 Xy=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},Zy=n=>({tr:e,dispatch:t})=>{const{from:r,to:o}=n;return t&&e.delete(r,o),!0},Qy=()=>({state:n,dispatch:e})=>ti(n,e),eb=()=>({commands:n})=>n.keyboardShortcut("Enter"),tb=()=>({state:n,dispatch:e})=>$g(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 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=Ii(c,s,e);if(f&&f.from<=d&&f.to>=u){const p=oe.create(l,f.from,f.to);t.setSelection(p)}}return!0},rb=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 oe}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"?oe.create(n,dr(0,o,s),dr(n.content.size,o,s)):oe.create(n,dr(e,o,s),dr(e,o,s))}function ob(){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 sb=(n=null,e={})=>({editor:t,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const l=()=>{(Di()||ob())&&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},lb=(n,e)=>t=>n.every((r,o)=>e(r,{...t,index:o})),ib=(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 I)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 I.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 ab(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 cb=n=>!("type"in n),db=(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((cb(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 I){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=a;const y=r.doc.resolve(u),b=y.node(),k=y.parentOffset===0,w=b.isText||b.isTextblock,x=b.content.size>0;k&&w&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,f,g)}t.updateSelection&&ab(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},ub=()=>({state:n,dispatch:e})=>Rg(n,e),fb=()=>({state:n,dispatch:e})=>Fg(n,e),pb=()=>({state:n,dispatch:e})=>wd(n,e),hb=()=>({state:n,dispatch:e})=>_d(n,e),mb=()=>({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}},gb=()=>({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}},yb=()=>({state:n,dispatch:e})=>Ig(n,e),bb=()=>({state:n,dispatch:e})=>Dg(n,e);function Zu(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function kb(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 xb=n=>({editor:e,view:t,tr:r,dispatch:o})=>{const s=kb(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 wb=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?Pg(t,r):!1},Eb=()=>({state:n,dispatch:e})=>Td(n,e),Cb=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return Xg(r)(e,t)},vb=()=>({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 _b=(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},Sb=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Nb=()=>({tr:n,dispatch:e})=>{if(e){const t=new Et(n.doc);n.setSelection(t)}return!0},Mb=()=>({state:n,dispatch:e})=>Cd(n,e),Tb=()=>({state:n,dispatch:e})=>Sd(n,e),Ab=()=>({state:n,dispatch:e})=>jg(n,e),Bb=()=>({state:n,dispatch:e})=>Kg(n,e),Vb=()=>({state:n,dispatch:e})=>Wg(n,e);function Ri(n,e,t={},r={}){return fo(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Lb=(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 Ob(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 Ib(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 te(n,e,t){return n.config[e]===void 0&&n.parent?te(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?te(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=te(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 Db(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=te(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=te(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 xe(...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)=>xe(t,r),{})}function Rb(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):Rb(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"&&Db(t)?!1:t!=null))}function Fb(n,e){var t;const r=of(n),{nodeExtensions:o,markExtensions:s}=po(n),l=(t=o.find(d=>te(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 w=te(k,"extendNodeSchema",f);return{...b,...w?w(d):{}}},{}),h=lf({...p,content:ke(te(d,"content",f)),marks:ke(te(d,"marks",f)),group:ke(te(d,"group",f)),inline:ke(te(d,"inline",f)),atom:ke(te(d,"atom",f)),selectable:ke(te(d,"selectable",f)),draggable:ke(te(d,"draggable",f)),code:ke(te(d,"code",f)),whitespace:ke(te(d,"whitespace",f)),linebreakReplacement:ke(te(d,"linebreakReplacement",f)),defining:ke(te(d,"defining",f)),isolating:ke(te(d,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var k,w;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(w=b?.attribute)==null?void 0:w.validate}]}))}),m=ke(te(d,"parseHTML",f));m&&(h.parseDOM=m.map(b=>sf(b,u)));const g=te(d,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ws(b,u)}));const y=te(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=te(b,"extendMarkSchema",f);return{...y,...k?k(d):{}}},{}),h=lf({...p,inclusive:ke(te(d,"inclusive",f)),excludes:ke(te(d,"excludes",f)),group:ke(te(d,"group",f)),spanning:ke(te(d,"spanning",f)),code:ke(te(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(te(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>sf(y,u)));const g=te(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 Pb(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=te(t,"priority")||100,s=te(r,"priority")||100;return o>s?-1:o<s?1:0})}function af(n){const e=$i(Fi(n)),t=Pb(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 $b(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 zb(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"?zb(n,e):t==="mark"?ef(n,e):{}}function Hb(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 jb(n){const e=Hb(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}})})}),jb(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 Ub=(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 Wb=(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),w=k-b;l+=w,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 Kb(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 qb=(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)},Gb=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(te(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 ne}function Jb(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 Yb=(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 Jb(r,t,c)},Xb=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Zb=(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)},Qb=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,o=dr(n,0,r.content.size),s=ne.create(r,o);e.setSelection(s)}return!0},e1=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:o,to:s}=typeof n=="number"?{from:n,to:n}:n,l=oe.atStart(r).from,a=oe.atEnd(r).to,c=dr(o,l,a),d=dr(s,l,a),u=oe.create(r,c,d);e.setSelection(u)}return!0},t1=n=>({state:e,dispatch:t})=>{const r=He(n,e.schema);return e0(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 n1=({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 ne&&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:Ob(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 oe&&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},r1=(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=I.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let A=c.depth-k;A>=c.depth-3;A-=1)b=I.from(c.node(A).copy(b));const w=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},E=((l=a.contentMatch.defaultType)==null?void 0:l.createAndFill(x))||void 0;b=b.append(I.from(a.createAndFill(null,E)||void 0));const M=c.before(c.depth-(k-1));t.replace(M,c.after(-w),new q(b,4-k,0));let C=-1;t.doc.nodesBetween(M,t.doc.content.size,(A,z)=>{if(C>-1)return!1;A.isTextblock&&A.content.size===0&&(C=z+1)}),C>-1&&t.setSelection(oe.near(t.doc.resolve(C))),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:w}=s.extensionManager,x=k||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!x||!o)return!0;const E=x.filter(M=>w.includes(M.type.name));t.ensureMarks(E)}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},o1=(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,w=b.blockRange(k),x=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const E=xs(M=>hf(M.type.name,f))(g);if(w.depth>=1&&E&&w.depth-E.depth<=1){if(E.node.type===h)return d.liftListItem(m);if(hf(E.node.type.name,f)&&h.validContent(E.node.content)&&a)return c().command(()=>(s.setNodeMarkup(E.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 M=u().wrapInList(h,r),C=x.filter(A=>p.includes(A.type.name));return s.ensureMarks(C),M?!0:d.clearNodes()}).wrapInList(h,r).command(()=>Ui(s,h)).command(()=>Wi(s,h)).run()},s1=(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)},l1=(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})},i1=(n,e={})=>({state:t,commands:r})=>{const o=He(n,t.schema);return Pn(t,o,e)?r.lift(o):r.wrapIn(o,e)},a1=()=>({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},c1=()=>({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},d1=(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},u1=(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),w=Math.min(y+g.nodeSize,u);t.addMark(k,w,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},f1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return qg(o,e)(t,r)},p1=(n,e={})=>({state:t,dispatch:r})=>{const o=He(n,t.schema);return Gg(o,e)(t,r)},h1=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}},m1=(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=Wb(d)+s;return l.forEach(p=>{if(u)return;const h=m1(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:w}=new gs({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:k,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(a,{transform:m,from:r,to:o,text:s}),c.dispatch(m),u=!0)}),u}function g1(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(I.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 y1(n){return Object.prototype.toString.call(n).slice(8,-1)}function Ss(n){return y1(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(te(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(te(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 Rm extends Ki{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Rm(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 b1(n){return typeof n=="number"}var k1=class{constructor(n){this.find=n.find,this.handler=n.handler}},x1=(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 w1(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,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(w=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?w:0,E=Math.max(r,m),M=Math.min(o,m+x);if(E>=M)return;const C=h.isText?h.text||"":h.textBetween(E-m,M-m,void 0,"");x1(C,s.find,l).forEach(z=>{if(z.index===void 0)return;const G=E+z.index+1,V=G+z[0].length,O={from:t.tr.mapping.map(G),to:t.tr.mapping.map(V)},Y=s.handler({state:t,range:O,match:z,commands:c,chain:d,can:u,pasteEvent:l,dropEvent:a});f.push(Y)})}),f.every(h=>h!==null)}var Ns=null,E1=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function C1(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(!(!w1({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:E}=b;typeof E=="string"?E=E:E=Pi(I.from(E),h.schema);const{from:M}=b,C=M+E.length,A=E1(E);return c({rule:u,state:h,from:M,to:{b:C},pasteEvt:A})}const w=p.doc.content.findDiffStart(h.doc.content),x=p.doc.content.findDiffEnd(h.doc.content);if(!(!b1(w)||!x||w===x.b))return c({rule:u,state:h,from:w,to:x,pasteEvt:l})}}))}var Ms=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=af(n),this.schema=Fb(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=te(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=te(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&te(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=Hy(a);s.push(c);const d=te(r,"addInputRules",o);if(pf(r,n.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=g1({editor:n,rules:p}),m=Array.isArray(h)?h:[h];s.push(...m)}}const u=te(r,"addPasteRules",o);if(pf(r,n.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=C1({editor:n,rules:p});s.push(...h)}}const f=te(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=>!!te(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=te(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=>!!te(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=te(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=>{F1(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(te(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const o=te(e,"onBeforeCreate",r),s=te(e,"onCreate",r),l=te(e,"onUpdate",r),a=te(e,"onSelectionUpdate",r),c=te(e,"onTransaction",r),d=te(e,"onFocus",r),u=te(e,"onBlur",r),f=te(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 v1={};Li(v1,{ClipboardTextSerializer:()=>bf,Commands:()=>kf,Delete:()=>xf,Drop:()=>wf,Editable:()=>Ef,FocusEvents:()=>vf,Keymap:()=>_f,Paste:()=>Sf,Tabindex:()=>Nf,focusEventsPluginKey:()=>Cf});var Ee=class Fm extends Ki{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Fm(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},bf=Ee.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=Ee.create({name:"commands",addCommands(){return{...Ku}}}),xf=Ee.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),w=p.invert().map(b,-1),x=p.invert().map(k),E=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(C=>C.eq(h.mark)),M=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(C=>C.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:x},newRange:{from:b,to:k},partial:!!(M||E),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=Ee.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=Ee.create({name:"editable",addProseMirrorPlugins(){return[new Oe({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Cf=new $e("focusEvents"),vf=Ee.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=Ee.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=Ee.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=Ee.create({name:"tabindex",addProseMirrorPlugins(){return[new Oe({key:new $e("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),_1=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)}},S1=`.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 Qe(n){this.content=n}Qe.prototype={constructor:Qe,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 Qe(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 Qe(t)},addToStart:function(n,e){return new Qe([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Qe(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 Qe(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=Qe.from(n),n.size?new Qe(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Qe.from(n),n.size?new Qe(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Qe.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}},Qe.from=function(n){if(n instanceof Qe)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Qe(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 I{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 I(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 I(r,o)}cutByIndex(e,t){return e==t?I.empty:e==0&&t==this.content.length?this:new I(this.content.slice(e,t))}replaceChild(e,t){let 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 I(o,s)}addToStart(e){return new I([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new I(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,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 I.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new I(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return I.empty;let t,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 I(t||e,r)}static from(e){if(!e)return I.empty;if(e instanceof I)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new I([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}I.empty=new I([],0);const 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 q{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 q(r,this.openStart,this.openEnd)}removeBetween(e,t){return new q(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 q.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 q(I.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 q(e,r,o)}}q.empty=new q(I.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 I(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 I(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(I.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||I.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,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 q.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 q(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=I.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=I.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 I.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),I.from(t),Se.setFrom(r))}createChecked(e=null,t,r){return t=I.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=I.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(I.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=Qe.from(e.nodes),t.marks=Qe.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),q.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(I.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=I.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(I.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!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 wt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&wt.empty)return wt.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 wt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wt.empty:new wt(e<0?[0,-e,0]:[0,0,e])}}wt.empty=new wt([]);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 ot{getMap(){return wt.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 I.fromArray(r)}class Nn extends ot{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 q(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))}}ot.jsonID("addMark",Nn);class zt extends ot{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 q(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))}}ot.jsonID("removeMark",zt);class Mn extends ot{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 q(I.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))}}ot.jsonID("addNodeMark",Mn);class nr extends ot{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 q(I.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))}}ot.jsonID("removeNodeMark",nr);class Ge extends ot{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 wt([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?q.empty:new q(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?q.empty:new q(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,q.fromJSON(e,t.slice),!!t.structure)}}ot.jsonID("replace",Ge);class Je extends ot{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 wt([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,q.fromJSON(e,t.slice),t.insert,!!t.structure)}}ot.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,q.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 q(I.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(I.empty,!0);n.replace(a,a,new q(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=I.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=I.from(r.node(m).copy(u)),f++):c--;let p=I.empty,h=0;for(let m=s,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,p=I.from(o.node(m).copy(p)),h++):d++;n.step(new Je(c,d,l,a,new q(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=I.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=I.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 q(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 q(I.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 q(I.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=I.empty,l=I.empty;for(let a=o.depth,c=o.depth-t,d=t-1;a>c;a--,d--){s=I.from(o.node(a).copy(s));let u=r&&r[d];l=I.from(u?u.type.create(u.attrs,l):o.node(a).copy(l))}n.step(new Ge(e,e,new q(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),q.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=q.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=I.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=I.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 q(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(I.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 q(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 q(Zr(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new q(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,I.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?q.empty:new q(Zr(l.content,e-1,1),e-1,h<0?l.openEnd:e-1):new q(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,I.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(I.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(I.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),w=o.index(y-1);if(k.canReplaceWith(w,w,m.type,m.marks))return n.replace(o.before(y),b?s.after(y):t,new q(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(I.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 q(I.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 ot{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 q(I.from(o),0,t.isLeaf?0:1))}getMap(){return wt.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)}}ot.jsonID("attr",Cr);class eo extends ot{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 wt.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)}}ot.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=q.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 q(I.from(r),0,0))}delete(e,t){return this.replace(e,t,q.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=q.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?q.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 oe(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 Et(e.node(0))}static atStart(e){return _r(e,e,0,0,1)||new Et(e)}static atEnd(e){return _r(e,e,e.content.size,e.childCount,-1)||new Et(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 oe.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 oe 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 oe(o.parent.inlineContent?o:r,r)}replace(e,t=q.empty){if(super.replace(e,t),t==q.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof oe&&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 oe(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 oe(e,t)}}le.jsonID("text",oe);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 oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class ne 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 ne(s)}content(){return new q(I.from(this.node),0,0)}eq(e){return e instanceof ne&&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 ne(e.resolve(t.anchor))}static create(e,t){return new ne(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ne.prototype.visible=!1,le.jsonID("node",ne);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&&ne.isSelectable(r)?new ne(t):le.near(t)}}class Et extends le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=q.empty){if(t==q.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 Et(e)}map(e){return new Et(e)}eq(e){return e instanceof Et}getBookmark(){return Ag}}le.jsonID("all",Et);const Ag={map(){return this},resolve(n){return new Et(n)}};function _r(n,e,t,r,o,s=!1){if(e.inlineContent)return oe.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&&ne.isSelectable(a))return ne.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 et=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:Mt(n))){let l=n.parentNode;if(!l||l.nodeType!=1||no(n)||Og.test(n.nodeName)||n.contentEditable=="false")return!1;e=et(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?Mt(n):0}else return!1}}function Mt(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=Mt(n)}else if(n.parentNode&&!no(n))e=et(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=et(n)+1,n=n.parentNode;else return null}}function Rg(n,e,t){for(let r=e==0,o=e==Mt(n);r||o;){if(n==t)return!0;let s=et(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,o=o&&s==Mt(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(Mt(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(Mt(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),gt=!!(kd||ri||ni),Bn=kd?document.documentMode:ri?+ri[1]:ni?+ni[1]:0,Tt=!gt&&/gecko\/(\d+)/i.test(An);Tt&&+(/Firefox\/(\d+)/.exec(An)||[0,0])[1];const oi=!gt&&/Chrome\/(\d+)/.exec(An),st=!!oi,xd=oi?+oi[1]:0,dt=!gt&&!!Jt&&/Apple Computer/.test(Jt.vendor),Mr=dt&&(/Mobile\/\w+/.test(An)||!!Jt&&Jt.maxTouchPoints>2),At=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(dt)for(let d=l;r&&d;d=Nr(d))d.draggable&&(r=void 0);if(l=Gg(l,e),r){if(Tt&&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||Tt;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(Tt&&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==Mt(r))){let c=r.childNodes[o-1];if(c.nodeType==1)return li(c.getBoundingClientRect(),!1)}if(s==null&&o<Mt(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==Mt(r))){let c=r.childNodes[o-1],d=c.nodeType==3?fn(c,Mt(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<Mt(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 Bt=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=Bt,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>et(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?et(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?et(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=et(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=et(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((Tt||dt)&&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:et(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(Tt&&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&&dt)&&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&&Tt)){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==Bt&&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!=Bt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Bt}}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=()=>I.empty)}return e}matchesNode(e,t,r){return this.dirty==Bt&&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 oe)||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=Bt}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!=Bt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=Bt||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=Bt,!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==Bt&&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=Bt,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=Bt),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))&&((dt||st)&&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&&ne.isSelectable(f)&&o.parent&&!(f.isInline&&Rg(t.focusNode,t.focusOffset,o.dom))){let p=o.posBefore;d=new ne(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&&st){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 oe)&&(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=dt||st&&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(dt&&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",dt&&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,et(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&>&&Bn<=11&&(t.disabled=!0,t.disabled=!1)}function Ud(n,e){if(e instanceof ne){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))||oe.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 oe)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 oe(r.$anchor,l))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let o=fi(n.state,e);return o&&o instanceof ne?On(n,o):!1}else if(!(At&&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?ne.isSelectable(s)?On(n,new ne(e<0?n.state.doc.resolve(o.pos-s.nodeSize):o)):ro?On(n,new oe(n.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ne&&r.node.isInline)return On(n,new oe(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(Tt&&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=et(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=et(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=et(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=et(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(!(st||$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 oe&&!r.empty||t.indexOf("s")>-1||At&&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 ne)return On(n,l)}if(!o.parent.inlineContent){let l=e<0?o:s,a=r instanceof Et?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 oe))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(!dt||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||At&&t==72&&r=="c")return Zd(n,-1)||Ar(n,-1);if(t==46&&!e.shiftKey||At&&t==68&&r=="c")return Zd(n,1)||Ar(n,1);if(t==13||t==27)return!0;if(t==37||At&&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||At&&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||At&&t==80&&r=="c")return Xd(n,-1,r)||Ar(n,-1);if(t==40||At&&t==78&&r=="c")return k0(n)||Xd(n,1,r)||Ar(n,1);if(r==(At?"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 q(I.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=q.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 I.from(l)}return n}function tu(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,I.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(I.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(I.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(I.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,l.copy(a))}function ou(n,e,t){return e<n.openStart&&(n=new q(mi(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new q(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(st?"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=I.from(c.create(r[a+1],o)),s++,l++}return new q(o,s,l)}const ut={},ft={},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 ut){let t=ut[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{V0(n,r)&&!bi(n,r)&&(n.editable||!(r.type in ft))&&t(n,r)},M0[e]?{passive:!0}:void 0)}dt&&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)&&ut[e.type]&&(n.editable||!(e.type in ft))&&ut[e.type](n,e)}ft.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&&st&&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")},ft.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},ft.keypress=(n,e)=>{let t=e;if(cu(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||At&&t.metaKey)return;if(n.someProp("handleKeyPress",o=>o(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof oe)||!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&&ne.isSelectable(r)?(Br(n,new ne(t)),!0):!1}function D0(n,e){if(e==-1)return!1;let t=n.state.selection,r,o;t instanceof ne&&(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(ne.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,ne.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,oe.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,oe.create(r,a+1,a+1+l.content.size));else if(ne.isSelectable(l))Br(n,ne.create(r,a));else continue;return!0}}function xi(n){return us(n)}const au=At?"metaKey":"ctrlKey";ut.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 ne&&d.from<=l&&d.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Tt&&!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||dt&&this.mightDrag&&!this.mightDrag.node.isAtom||st&&!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)}}ut.touchstart=n=>{n.input.lastTouch=Date.now(),xi(n),In(n,"pointer")},ut.touchmove=n=>{n.input.lastTouch=Date.now(),In(n,"pointer")},ut.contextmenu=n=>xi(n);function cu(n,e){return n.composing?!0:dt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const H0=pn?5e3:-1;ft.compositionstart=ft.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof oe&&(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),Tt&&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)},ft.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=gt&&Bn<15||Mr&&zg<604;ut.copy=ft.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||q.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," "):""}ft.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=At?"altKey":"ctrlKey";function hu(n,e){let t=n.someProp("dragCopies",r=>!r(e));return t??!e[G0]}ut.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 ne?o.to-1:o.to))){if(r&&r.mightDrag)l=ne.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=ne.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||!st||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)},ut.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},ft.dragover=ft.dragenter=(n,e)=>e.preventDefault(),ft.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||q.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&&ne.isSelectable(l.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(l.content.firstChild))d.setSelection(new ne(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"))},ut.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))},ut.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)},ut.beforeinput=(n,e)=>{if(st&&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 ft)ut[n]=ft[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):lt}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==lt||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):lt}add(e,t){return t.length?this==lt?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==lt?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!=lt?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):lt}forChild(e,t){if(this==lt)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||lt}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==lt)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 lt=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!=lt&&(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 lt;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 w=a[b]+u-f;h>=w?a[b+1]=p<=w?-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!=lt?(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!=lt&&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):lt}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!=lt&&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=gt&&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]);gt&&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(gt&&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(Tt&&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(gt&&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?et(o)+1:0,a=r.localPosFromDOM(e.target,l,-1),c=s&&s.parentNode==e.target?et(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=Tt,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})),st&&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(dt&&/^(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||dt&&/^(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 E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,B=ci(n,E);if(B&&!n.state.selection.eq(B)){if(st&&pn&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",J=>J(n,or(13,"Enter"))))return;let z=n.state.tr.setSelection(B);E=="pointer"?z.setMeta("pointer",!0):E=="key"&&z.scrollIntoView(),s&&z.setMeta("composition",s),n.dispatch(z)}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(E=>E.nodeType==1&&!ly.test(E.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",E=>E(n,or(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof oe&&!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 E=Eu(n,n.state.doc,d.sel);if(E&&!E.eq(n.state.selection)){let B=n.state.tr.setSelection(E);s&&B.setMeta("composition",s),n.dispatch(B)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof oe&&(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)),gt&&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(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",E=>E(n,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",E=>E(n,or(8,"Backspace")))){pn&&st&&n.domObserver.suppressSelectionUpdates();return}st&&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(E){return E(n,or(13,"Enter"))})},20));let w=m.start,x=m.endA,C=E=>{let B=E||n.state.tr.replace(w,x,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let z=Eu(n,B.doc,d.sel);z&&!(st&&n.composing&&z.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(z.head==w||z.head==B.mapping.map(x)-1)||gt&&z.empty&&z.head==w)&&B.setSelection(z)}return s&&B.setMeta("composition",s),B.scrollIntoView()},M;if(k){if(g.pos==y.pos){gt&&Bn<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>mn(n),20));let E=C(n.state.tr.delete(w,x)),B=u.resolve(m.start).marksAcross(u.resolve(m.endA));B&&E.ensureMarks(B),n.dispatch(E)}else if(m.endA==m.endB&&(M=ay(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let E=C(n.state.tr);M.type=="add"?E.addMark(w,x,M.mark):E.removeMark(w,x,M.mark),n.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,y.parentOffset),B=()=>C(n.state.tr.insertText(E,w,x));n.someProp("handleTextInput",z=>z(n,w,x,E,B))||n.dispatch(B())}}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(I.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&&(gt||st)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&uy(o.selection,e.selection);if(f){let m=st?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 ne){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:ne.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(gt){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?dt&&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),tt=0;tt<10;tt++)Fn[48+tt]=Fn[96+tt]=String(tt);for(var tt=1;tt<=24;tt++)Fn[tt+111]="F"+tt;for(var tt=65;tt<=90;tt++)Fn[tt]=String.fromCharCode(tt+32),hs[tt]=String.fromCharCode(tt);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")||ne.isSelectable(s)))for(let l=r.depth;;l--){let a=ns(n.doc,r.before(l),r.after(l),q.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):ne.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,q.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(oe.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||!ne.isSelectable(l)?!1:(e&&e(n.tr.setSelection(ne.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")||ne.isSelectable(s))){let l=ns(n.doc,r.before(),r.after(),q.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):ne.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||!ne.isSelectable(l)?!1:(e&&e(n.tr.setSelection(ne.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 ne,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(ne.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 ne){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 Et||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(oe.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 ne&&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 oe||e.selection instanceof Et)&&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(ne.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=I.empty;for(let b=l.length-1;b>=0;b--)m=I.from(l[b].create(null,m));m=I.from(o.copy(m));let g=n.tr.step(new Je(e.pos-1,h,e.pos,h,new q(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=I.empty;for(let w=m.length-1;w>=0;w--)b=I.from(m[w].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 q(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(oe.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=I.empty;for(let u=t.length-1;u>=0;u--)s=I.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 q(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 q(I.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?I.empty:I.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 q((a?I.empty:I.from(o.copy(I.empty))).append(c?I.empty:I.from(o.copy(I.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=I.from(d?n.create():null),f=new q(I.from(n.create(null,I.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 I)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 I.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 te(n,e,t){return n.config[e]===void 0&&n.parent?te(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?te(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=te(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=te(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=te(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 xe(...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)=>xe(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=>te(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 w=te(k,"extendNodeSchema",f);return{...b,...w?w(d):{}}},{}),h=Yu({...p,content:ke(te(d,"content",f)),marks:ke(te(d,"marks",f)),group:ke(te(d,"group",f)),inline:ke(te(d,"inline",f)),atom:ke(te(d,"atom",f)),selectable:ke(te(d,"selectable",f)),draggable:ke(te(d,"draggable",f)),code:ke(te(d,"code",f)),whitespace:ke(te(d,"whitespace",f)),linebreakReplacement:ke(te(d,"linebreakReplacement",f)),defining:ke(te(d,"defining",f)),isolating:ke(te(d,"isolating",f)),attrs:Object.fromEntries(u.map(b=>{var k,w;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(w=b?.attribute)==null?void 0:w.validate}]}))}),m=ke(te(d,"parseHTML",f));m&&(h.parseDOM=m.map(b=>Ju(b,u)));const g=te(d,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:ks(b,u)}));const y=te(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=te(b,"extendMarkSchema",f);return{...y,...k?k(d):{}}},{}),h=Yu({...p,inclusive:ke(te(d,"inclusive",f)),excludes:ke(te(d,"excludes",f)),group:ke(te(d,"group",f)),spanning:ke(te(d,"spanning",f)),code:ke(te(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(te(d,"parseHTML",f));m&&(h.parseDOM=m.map(y=>Ju(y,u)));const g=te(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=te(t,"priority")||100,s=te(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),w=k-b;l+=w,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(te(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 ne}function cf(n){return n instanceof oe}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"?oe.create(n,dr(0,o,s),dr(n.content.size,o,s)):oe.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:w}=new gs({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:k,can:w})===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(I.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(te(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ke(te(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,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(w=(k=(b=h.content)==null?void 0:b.size)!=null?k:h.nodeSize)!=null?w:0,C=Math.max(r,m),M=Math.min(o,m+x);if(C>=M)return;const E=h.isText?h.text||"":h.textBetween(C-m,M-m,void 0,"");db(E,s.find,l).forEach(z=>{if(z.index===void 0)return;const J=C+z.index+1,V=J+z[0].length,O={from:t.tr.mapping.map(J),to:t.tr.mapping.map(V)},Y=s.handler({state:t,range:O,match:z,commands:c,chain:d,can:u,pasteEvent:l,dropEvent:a});f.push(Y)})}),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(I.from(C),h.schema);const{from:M}=b,E=M+C.length,B=fb(C);return c({rule:u,state:h,from:M,to:{b:E},pasteEvt:B})}const w=p.doc.content.findDiffStart(h.doc.content),x=p.doc.content.findDiffEnd(h.doc.content);if(!(!ab(w)||!x||w===x.b))return c({rule:u,state:h,from:w,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=te(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=te(r,"addKeyboardShortcuts",o);let a={};if(r.type==="mark"&&te(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=te(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=te(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=te(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=>!!te(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=te(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=>!!te(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=te(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(te(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const o=te(e,"onBeforeCreate",r),s=te(e,"onCreate",r),l=te(e,"onUpdate",r),a=te(e,"onSelectionUpdate",r),c=te(e,"onTransaction",r),d=te(e,"onFocus",r),u=te(e,"onBlur",r),f=te(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 Ee=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=Ee.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 oe(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=oe.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 I){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;r.insertText(g,u,f)}else{g=a;const y=r.doc.resolve(u),b=y.node(),k=y.parentOffset===0,w=b.isText||b.isTextblock,x=b.content.size>0;k&&w&&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 Et(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=ne.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=oe.atStart(r).from,a=oe.atEnd(r).to,c=dr(o,l,a),d=dr(s,l,a),u=oe.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 ne&&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 oe&&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=I.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let B=c.depth-k;B>=c.depth-3;B-=1)b=I.from(c.node(B).copy(b));const w=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(I.from(a.createAndFill(null,C)||void 0));const M=c.before(c.depth-(k-1));t.replace(M,c.after(-w),new q(b,4-k,0));let E=-1;t.doc.nodesBetween(M,t.doc.content.size,(B,z)=>{if(E>-1)return!1;B.isTextblock&&B.content.size===0&&(E=z+1)}),E>-1&&t.setSelection(oe.near(t.doc.resolve(E))),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:w}=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(M=>w.includes(M.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,w=b.blockRange(k),x=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const C=bs(M=>lf(M.type.name,f))(g);if(w.depth>=1&&C&&w.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 M=u().wrapInList(h,r),E=x.filter(B=>p.includes(B.type.name));return s.ensureMarks(E),M?!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),w=Math.min(y+g.nodeSize,u);t.addMark(k,w,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=Ee.create({name:"commands",addCommands(){return{...pf}}}),bf=Ee.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),w=p.invert().map(b,-1),x=p.invert().map(k),C=(g=u.doc.nodeAt(b-1))==null?void 0:g.marks.some(E=>E.eq(h.mark)),M=(y=u.doc.nodeAt(k))==null?void 0:y.marks.some(E=>E.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:x},newRange:{from:b,to:k},partial:!!(M||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=Ee.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=Ee.create({name:"editable",addProseMirrorPlugins(){return[new Oe({key:new $e("editable"),props:{editable:()=>this.editor.options.editable}})]}}),wf=new $e("focusEvents"),Ef=Ee.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=Ee.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=Ee.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=Ee.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 {
|
|
14
14
|
position: relative;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -80,23 +80,9 @@ img.ProseMirror-separator {
|
|
|
80
80
|
|
|
81
81
|
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
82
|
display: block;
|
|
83
|
-
}`;function
|
|
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=`
|
|
84
84
|
|
|
85
|
-
`,textSerializers:r={}}=e||{};return $b(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 _1(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 T1(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof ne){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 A1={};Li(A1,{createAtomBlockMarkdownSpec:()=>B1,createBlockMarkdownSpec:()=>V1,createInlineMarkdownSpec:()=>I1,parseAttributes:()=>Gi,parseIndentedBlocks:()=>D1,renderNestedMarkdownContent:()=>R1,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 B1(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 V1(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,w=o(k);let x=1;const E=b.length;let M="";const C=/^:::([\w-]*)(\s.*)?/gm,A=f.slice(E);for(C.lastIndex=0;;){const z=C.exec(A);if(z===null)break;const G=z.index,V=z[1];if(!((m=z[2])!=null&&m.endsWith(":::"))){if(V)x+=1;else if(x-=1,x===0){const O=A.slice(0,G);M=O.trim();const Y=f.slice(0,E+G+z[0].length);let Q=[];if(M)if(a==="block")for(Q=h.blockTokens(O),Q.forEach(P=>{P.text&&(!P.tokens||P.tokens.length===0)&&(P.tokens=h.inlineTokens(P.text))});Q.length>0;){const P=Q[Q.length-1];if(P.type==="paragraph"&&(!P.text||P.text.trim()===""))Q.pop();else break}else Q=h.inlineTokens(M);return{type:e,raw:Y,attributes:w,content:M,tokens:Q}}}}}},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 L1(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 O1(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function I1(n){const{nodeName:e,name:t,getContent:r,parseAttributes:o=L1,serializeAttributes:s=O1,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,E]=y;k=x,b=E||""}const w=o(k.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},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 D1(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 E=a[u];if(E.trim()===""){const C=a.slice(u+1).findIndex(G=>G.trim()!=="");if(C===-1)break;if((((o=(r=a[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:o.length)||0)>g){b.push(E),d=`${d}${E}
|
|
94
|
-
`,u+=1;continue}else break}if((((l=(s=E.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:l.length)||0)>g)b.push(E),d=`${d}${E}
|
|
95
|
-
`,u+=1;else break}let k;const w=b.slice(1);if(w.length>0){const E=w.map(M=>M.slice(g+f)).join(`
|
|
96
|
-
`);E.trim()&&(e.customNestedParser?k=e.customNestedParser(E):k=t.blockTokens(E))}const x=e.createToken(m,k);c.push(x)}if(c.length!==0)return{items:c,raw:d.trim()}}function R1(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 F1(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 Pm extends Ki{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Pm(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 k1({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 P1=class extends M1{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 $1=(n={})=>{const e=i.shallowRef();return i.onMounted(()=>{e.value=new P1(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 z1=20,Bf=(n,e=0)=>{const t=[];return!n.children.length||e>z1||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...Bf(r,e+1))}),t},H1=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&&H1(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",xe(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}}}}),j1=Ee.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()}}}),U1=Ee.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()}}}),W1=Ee.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()}}}),K1=Ee.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()}}}),q1=Ee.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()}}}),G1=Ee.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(j1.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(U1.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(W1.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(K1.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(q1.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 De=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,J1(n))}};function J1(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Y1(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 w=0;w<b;w++){if(w+d>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-w});break}const x=o+w*e;for(let E=0;E<y;E++){r[x+E]==0?r[x+E]=u:(s||(s=[])).push({type:"collision",row:d,pos:u,n:y-E});const M=k&&k[E];if(M){const C=(x+E)%e*2,A=l[C];A==null||A!=M&&l[C+1]==1?(l[C]=M,l[C+1]=1):A==M&&l[C+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 De(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&&X1(a,l,n),a}function Y1(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 X1(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=Z1(c)))[d]=f)}a&&n.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function Z1(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function it(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 Q1(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)||ek(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function ek(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 tk(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=De.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 nk(n,e,t){const r=it(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=De.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 oe.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=De.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(I.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new q(I.from(a),1,1)}replace(e,t=q.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?q.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 q(I.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=De.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=De.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=De.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=De.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 rk(this.$anchorCell.pos,this.$headCell.pos)}};Te.prototype.visible=!1,le.jsonID("cell",Te);var rk=class $m{constructor(e,t){this.anchor=e,this.head=t}map(e){return new $m(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 ok(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 sk({$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 lk({$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 ik(n,e,t){const r=(e||n).selection,o=(e||n).doc;let s,l;if(r instanceof ne&&(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=De.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 oe&&sk(r)?s=oe.create(o,r.from):r instanceof oe&&lk(r)&&(s=oe.create(o,r.$from.start(),r.$from.end()));return s&&(e||(e=n.tr)).setSelection(s),e}var ak=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=ck(n,o,s,t))};return e?e.doc!=n.doc&&Of(e.doc,n.doc,0,r):n.doc.descendants(r),t}function ck(n,e,t,r){const o=De.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=it(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(ak,{fixTables:!0})}function Xt(n){const e=n.selection,t=Ts(n),r=t.node(-1),o=t.start(-1),s=De.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;nk(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?it(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 dk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Df(n.tr,t,t.left))}return!0}function uk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Df(n.tr,t,t.right))}return!0}function fk(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 pk(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;fk(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=De.get(s)}e(r)}return!0}function hk(n,e,t){var r;const o=it(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;hk(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?it(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,it(r.type.schema).row.create(null,a)),n}function mk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Rf(n.tr,t,t.top))}return!0}function gk(n,e){if(!jt(n))return!1;if(e){const t=Xt(n);e(Rf(n.tr,t,t.bottom))}return!0}function yk(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 bk(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;yk(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=De.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 kk({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(kk(o,r))return!1;if(e){const s=n.tr,l={};let a=I.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=it(n.schema);return xk(({node:r})=>t[r.type.spec.tableRole])(n,e)}function xk(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=Q1(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 wk(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 Ek(n){return function(e,t){if(!jt(e))return!1;if(t){const r=it(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?Ek(n):function(t,r){if(!jt(t))return!1;if(r){const o=it(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 Ck=ho("cell",{useDeprecatedLogic:!0});function vk(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=vk(Ts(e),n);if(r==null)return!1;if(t){const o=e.doc.resolve(r);t(e.tr.setSelection(oe.between(o,tk(o))).scrollIntoView())}return!0}}function _k(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=it(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 q(o,0,0))}),r.docChanged&&e(r)}return!0}function Sk(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(it(l).row,new q(d,u,f)).content),a.push(d)}else if(s=="cell"||s=="header_cell")a.push(t||r?ta(it(l).row,new q(e,t,r)).content:e);else return null;return Nk(l,a)}function Nk(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(I.empty),t[o]<r){const s=it(n).cell.createAndFill(),l=[];for(let a=t[o];a<r;a++)l.push(s);e[o]=e[o].append(I.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 Mk({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(I.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(I.from(c))}t=s,e=o}return{width:n,height:e,rows:t}}function Tk(n,e,t,r,o,s,l){const a=n.doc.type.schema,c=it(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,I.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=De.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=De.get(s),p=f.mapping.maps.length}Tk(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 q(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 Ak=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 Bk(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 Vk(n,e,t){if(!jt(n.state))return!1;let r=Sk(t);const o=n.state.selection;if(o instanceof Te){r||(r={width:1,height:1,rows:[I.from(ta(it(n.state.schema).cell,t))]});const s=o.$anchorCell.node(-1),l=o.$anchorCell.start(-1),a=De.get(s).rectBetween(o.$anchorCell.pos-l,o.$headCell.pos-l);return r=Mk(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,De.get(s.node(-1)).findCell(s.pos-l),r),!0}else return!1}function Lk(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 oe))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 Ok=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 Ct=new $e("tableColumnResizing");function Ik({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=Ok,lastColumnResizable:o=!0}={}){const s=new Oe({key:Ct,state:{init(l,a){var c,d;const u=(d=(c=s.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,f=it(a.schema).table.name;return r&&u&&(u[f]=(p,h)=>new r(p,t,h)),new Dk(-1,!1)},apply(l,a){return a.apply(l)}},props:{attributes:l=>{const a=Ct.getState(l);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,a)=>{Rk(l,a,n,o)},mouseleave:l=>{Fk(l)},mousedown:(l,a)=>{Pk(l,a,e,t)}},decorations:l=>{const a=Ct.getState(l);if(a&&a.activeHandle>-1)return Uk(l,a.activeHandle)},nodeViews:{}}});return s}var Dk=class Rl{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(Ct);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 Rk(n,e,t,r){if(!n.editable)return;const o=Ct.getState(n.state);if(o&&!o.dragging){const s=zk(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=De.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 Fk(n){if(!n.editable)return;const e=Ct.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Yf(n,-1)}function Pk(n,e,t,r){var o;if(!n.editable)return!1;const s=(o=n.dom.ownerDocument.defaultView)!=null?o:window,l=Ct.getState(n.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const a=n.state.doc.nodeAt(l.activeHandle),c=$k(n,l.activeHandle,a.attrs);n.dispatch(n.state.tr.setMeta(Ct,{setDragging:{startX:e.clientX,startWidth:c}}));function d(f){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",u);const p=Ct.getState(n.state);p?.dragging&&(Hk(n,p.activeHandle,Jf(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(Ct,{setDragging:null})))}function u(f){if(!f.which)return d(f);const p=Ct.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 $k(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 zk(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=De.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(Ct,{setHandle:e}))}function Hk(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),s=De.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():jk(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=De.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 jk(n){return Array(n).fill(0)}function Uk(n,e){var t;const r=[],o=n.doc.resolve(e),s=o.node(-1);if(!s)return Me.empty;const l=De.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=Ct.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 Wk({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:ok,handleDOMEvents:{mousedown:Lk},createSelectionBetween(e){return zn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Bk,handleKeyDown:Ak,handlePaste:Vk},appendTransaction(e,t,r){return ik(r,If(r,t),n)}})}var Kk=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",xe(this.options.HTMLAttributes,n),0]}}),qk=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",xe(this.options.HTMLAttributes,n),0]}}),Gk=Ue.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",xe(this.options.HTMLAttributes,n),0]}});function oa(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Zf(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,w]=oa(r,y);d.style.setProperty(k,w)}d=d.nextSibling}else{const k=document.createElement("col"),[w,x]=oa(r,y);k.style.setProperty(w,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 Jk=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")),Zf(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,Zf(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 Yk(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 Qf(n,e){return n.createAndFill()}function Xk(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 Zk(n,e,t,r,o){const s=Xk(n),l=[],a=[];for(let d=0;d<t;d+=1){const u=Qf(s.cell);if(u&&a.push(u),r){const f=Qf(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 Qk(n){return n instanceof Te}var Os=({editor:n})=>{const{selection:e}=n.state;if(!Qk(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},ex=Ue.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Jk,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}=Yk(n,this.options.cellMinWidth);return["table",xe(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=Zk(s.schema,n,e,t);if(o){const a=r.selection.from+1;r.replaceSelectionWith(l).scrollIntoView().setSelection(oe.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>dk(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>uk(n,e),deleteColumn:()=>({state:n,dispatch:e})=>pk(n,e),addRowBefore:()=>({state:n,dispatch:e})=>mk(n,e),addRowAfter:()=>({state:n,dispatch:e})=>gk(n,e),deleteRow:()=>({state:n,dispatch:e})=>bk(n,e),deleteTable:()=>({state:n,dispatch:e})=>_k(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})=>Ck(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Pf(n,e)?!0:$f(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>wk(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?[Ik({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Wk({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:ke(te(n,"tableRole",e))}}}),tx=Ee.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(ex.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Kk.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(qk.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(Gk.configure(this.options.tableRow)),n}}),nx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,rx=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ox=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",xe(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:nx,type:this.type})]},addPasteRules(){return[$n({find:rx,type:this.type})]}}),sx=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",xe(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()}}}),lx=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",xe(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]},ix=/^\s*>\s$/,ax=Ue.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return Is("blockquote",{...xe(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:ix,type:this.type})]}}),cx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dx=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ux=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,fx=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,px=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",{...xe(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:cx,type:this.type}),ur({find:ux,type:this.type})]},addPasteRules(){return[$n({find:dx,type:this.type}),$n({find:fx,type:this.type})]}}),hx=/(^|[^`])`([^`]+)`(?!`)$/,mx=/(^|[^`])`([^`]+)`(?!`)/g,gx=Ht.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",xe(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:hx,type:this.type})]},addPasteRules(){return[$n({find:mx,type:this.type})]}}),yx=/^```([a-z]+)?[\s\n]$/,bx=/^~~~([a-z]+)?[\s\n]$/,kx=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",xe(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 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 ne){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",xe(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=Ee.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=Ee.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=Ee.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=Ee.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=Ee.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=Ee.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 De=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 w=0;w<b;w++){if(w+d>=t){(s||(s=[])).push({type:"overlong_rowspan",pos:u,n:b-w});break}const x=o+w*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 M=k&&k[C];if(M){const E=(x+C)%e*2,B=l[E];B==null||B!=M&&l[E+1]==1?(l[E]=M,l[E+1]=1):B==M&&l[E+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 De(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 it(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=De.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=it(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=De.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 oe.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=De.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(I.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new q(I.from(a),1,1)}replace(e,t=q.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?q.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 q(I.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=De.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=De.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=De.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=De.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 ne&&(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=De.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 oe&&J1(r)?s=oe.create(o,r.from):r instanceof oe&&Y1(r)&&(s=oe.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=De.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=it(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=De.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?it(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=De.get(s)}e(r)}return!0}function ok(n,e,t){var r;const o=it(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?it(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,it(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=De.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=I.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=it(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=it(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=it(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(oe.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=it(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 q(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(it(l).row,new q(d,u,f)).content),a.push(d)}else if(s=="cell"||s=="header_cell")a.push(t||r?Zi(it(l).row,new q(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(I.empty),t[o]<r){const s=it(n).cell.createAndFill(),l=[];for(let a=t[o];a<r;a++)l.push(s);e[o]=e[o].append(I.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(I.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(I.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=it(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,I.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=De.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=De.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 q(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:[I.from(Zi(it(n.state.schema).cell,t))]});const s=o.$anchorCell.node(-1),l=o.$anchorCell.start(-1),a=De.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,De.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 oe))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 Ct=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:Ct,state:{init(l,a){var c,d;const u=(d=(c=s.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,f=it(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=Ct.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=Ct.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(Ct);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=Ct.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=De.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=Ct.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=Ct.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(Ct,{setDragging:{startX:e.clientX,startWidth:c}}));function d(f){s.removeEventListener("mouseup",d),s.removeEventListener("mousemove",u);const p=Ct.getState(n.state);p?.dragging&&(Vk(n,p.activeHandle,qf(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(Ct,{setDragging:null})))}function u(f){if(!f.which)return d(f);const p=Ct.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=De.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(Ct,{setHandle:e}))}function Vk(n,e,t){const r=n.state.doc.resolve(e),o=r.node(-1),s=De.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=De.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=De.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=Ct.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",xe(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",xe(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",xe(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,w]=ta(r,y);d.style.setProperty(k,w)}d=d.nextSibling}else{const k=document.createElement("col"),[w,x]=ta(r,y);k.style.setProperty(w,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",xe(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(oe.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(te(n,"tableRole",e))}}}),Wk=Ee.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",xe(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",xe(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",xe(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",{...xe(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",{...xe(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",xe(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",xe(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,`
|
|
100
86
|
`,`
|
|
101
87
|
`).split(`
|
|
102
88
|
`).map(p=>s+p).join(`
|
|
@@ -109,38 +95,38 @@ ${y}
|
|
|
109
95
|
`).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(`
|
|
110
96
|
`);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(`
|
|
111
97
|
|
|
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[
|
|
113
|
-
`));return l.replaceSelectionWith(this.type.create({language:s},c)),l.selection.$from.parent.type!==this.type&&l.setSelection(oe.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),n.dispatch(l),!0}}})]}}),
|
|
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()}}}),ep=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]}`,xe(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}}))}}),Ex=Ue.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",xe(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!T1(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(oe.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(ne.create(s.doc,c.pos)):s.setSelection(oe.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(oe.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Mf({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Cx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,vx=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,_x=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Sx=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Nx=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",xe(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:Cx,type:this.type}),ur({find:_x,type:this.type})]},addPasteRules(){return[$n({find:vx,type:this.type}),$n({find:Sx,type:this.type})]}});const Mx="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Tx="ελ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",tp="emoji",Ax="scheme",Bx="slashscheme",ca="whitespace";function Vx(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[tp]&&(e[aa]=!0);for(const r in e){const o=Vx(r,t);o.indexOf(n)<0&&o.push(n)}}function Lx(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function yt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}yt.groups={},yt.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||yt.groups;let o;return e&&e.j?o=e:(o=new yt(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||yt.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 yt,Object.assign(l.j,a.j),l.jr.push.apply(l.jr,a.jr),l.jd=a.jd,l.t=a.t):l=new yt,s){if(r)if(l.t&&typeof l.t=="string"){const c=Object.assign(Lx(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),Re=(n,e,t,r,o)=>n.tr(e,t,r,o),np=(n,e,t,r,o)=>n.ts(e,t,r,o),$=(n,e,t,r,o)=>n.tt(e,t,r,o),yn="WORD",da="UWORD",rp="ASCIINUMERICAL",op="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",Vt="HYPHEN",xo="PERCENT",sl="PIPE",ll="PLUS",il="POUND",wo="QUERY",ba="QUOTE",sp="FULLWIDTHMIDDLEDOT",ka="SEMI",Qt="SLASH",Eo="TILDE",al="UNDERSCORE",lp="EMOJI",cl="SYM";var ip=Object.freeze({__proto__:null,ALPHANUMERICAL:op,AMPERSAND:Xs,APOSTROPHE:Zs,ASCIINUMERICAL:rp,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:lp,EQUALS:ol,EXCLAMATION:ya,FULLWIDTHGREATERTHAN:Ys,FULLWIDTHLEFTPAREN:js,FULLWIDTHLESSTHAN:Js,FULLWIDTHMIDDLEDOT:sp,FULLWIDTHRIGHTPAREN:Us,HYPHEN:Vt,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/,ap="\r",Ea=`
|
|
115
|
-
`,
|
|
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(oe.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",xe(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]}`,xe(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",xe(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(oe.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(ne.create(s.doc,c.pos)):s.setSelection(oe.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(oe.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",xe(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 yt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}yt.groups={},yt.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||yt.groups;let o;return e&&e.j?o=e:(o=new yt(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||yt.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 yt,Object.assign(l.j,a.j),l.jr.push.apply(l.jr,a.jr),l.jd=a.jd,l.t=a.t):l=new yt,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),Re=(n,e,t,r,o)=>n.tr(e,t,r,o),ep=(n,e,t,r,o)=>n.ts(e,t,r,o),P=(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",Vt="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:Vt,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={};yt.groups=e;const t=new yt;dl==null&&(dl=ap(bx)),ul==null&&(ul=ap(kx)),P(t,"'",Zs),P(t,"{",bo),P(t,"}",ko),P(t,"[",Rs),P(t,"]",Fs),P(t,"(",Ps),P(t,")",$s),P(t,"<",zs),P(t,">",Hs),P(t,"(",js),P(t,")",Us),P(t,"「",Ws),P(t,"」",Ks),P(t,"『",qs),P(t,"』",Gs),P(t,"<",Js),P(t,">",Ys),P(t,"&",Xs),P(t,"*",Qs),P(t,"@",Hn),P(t,"`",tl),P(t,"^",nl),P(t,":",jn),P(t,",",pa),P(t,"$",rl),P(t,".",Zt),P(t,"=",ol),P(t,"!",ha),P(t,"-",Vt),P(t,"%",xo),P(t,"|",sl),P(t,"+",ll),P(t,"#",il),P(t,"?",wo),P(t,'"',ma),P(t,"/",Qt),P(t,";",ga),P(t,"~",Eo),P(t,"_",al),P(t,"\\",el),P(t,"・",rp);const r=Re(t,kn,da,{[na]:!0});Re(r,kn,r);const o=Re(r,bn,tp,{[mo]:!0}),s=Re(r,Co,np,{[go]:!0}),l=Re(t,bn,yn,{[ra]:!0});Re(l,kn,o),Re(l,bn,l),Re(o,kn,o),Re(o,bn,o);const a=Re(t,Co,ia,{[oa]:!0});Re(a,bn),Re(a,kn,s),Re(a,Co,a),Re(s,kn,s),Re(s,bn),Re(s,Co,s);const c=P(t,ka,fa,{[la]:!0}),d=P(t,lp,ua,{[la]:!0}),u=Re(t,ba,ua,{[la]:!0});P(t,xa,u),P(d,ka,c),P(d,xa,u),Re(d,ba,u),P(u,lp),P(u,ka),Re(u,ba,u),P(u,xa,u);const f=Re(t,ya,op,{[Qf]:!0});P(f,"#"),Re(f,ya,f),P(f,vx,f);const p=P(f,_x);P(p,"#"),Re(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 yt(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 yt(r),s.jr=o.slice(),n.j[c]=s),n=s}return s=new yt(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}}),Lt=n=>new yt(n);function Tx({groups:n}){const e=n.domain.concat([Xs,Qs,Hn,el,tl,nl,rl,ol,Vt,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,Vt,bo,ko,xo,sl,ll,il,wo,Qt,cl,Eo,al],o=Lt(),s=P(o,Eo);ue(s,r,s),ue(s,n.domain,s);const l=Lt(),a=Lt(),c=Lt();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=P(l,Hn);P(s,Hn,d),P(a,Hn,d),P(c,Hn,d);const u=P(s,Zt);ue(u,r,s),ue(u,n.domain,s);const f=Lt();ue(d,n.domain,f),ue(f,n.domain,f);const p=P(f,Zt);ue(p,n.domain,f);const h=Lt(up);ue(p,n.tld,h),ue(p,n.utld,h),P(d,yo,h);const m=P(f,Vt);P(m,Vt,m),ue(m,n.domain,f),ue(h,n.domain,f),P(h,Zt,p),P(h,Vt,m);const g=P(h,jn);ue(g,n.numeric,up);const y=P(l,Vt),b=P(l,Zt);P(y,Vt,y),ue(y,n.domain,l),ue(b,r,s),ue(b,n.domain,l);const k=Lt(pl);ue(b,n.tld,k),ue(b,n.utld,k),ue(k,n.domain,l),ue(k,r,s),P(k,Zt,b),P(k,Vt,y),P(k,Hn,d);const w=P(k,jn),x=Lt(pl);ue(w,n.numeric,x);const C=Lt(pl),M=Lt();ue(C,e,C),ue(C,t,M),ue(M,e,C),ue(M,t,M),P(k,Qt,C),P(x,Qt,C);const E=P(a,jn),B=P(c,jn),z=P(B,Qt),J=P(z,Qt);ue(a,n.domain,l),P(a,Zt,b),P(a,Vt,y),ue(c,n.domain,l),P(c,Zt,b),P(c,Vt,y),ue(E,n.domain,C),P(E,Qt,C),P(E,wo,C),ue(J,n.domain,C),ue(J,e,C),P(J,Qt,C);const V=[[bo,ko],[Rs,Fs],[Ps,$s],[zs,Hs],[js,Us],[Ws,Ks],[qs,Gs],[Js,Ys]];for(let O=0;O<V.length;O++){const[Y,ee]=V[O],H=P(C,Y);P(M,Y,H),P(H,ee,C);const K=Lt(pl);ue(H,e,K);const U=Lt();ue(H,t),ue(K,e,K),ue(K,t,U),ue(U,e,K),ue(U,t,U),P(K,ee,C),P(U,ee,C)}return P(o,yo,k),P(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 yt.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.
|
|
116
102
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
117
103
|
2. Cannot start or end with "-"
|
|
118
|
-
3. "-" cannot repeat`);Ve.customSchemes.push([n,e])}function Ux(){Ve.scanner=Dx(Ve.customSchemes);for(let n=0;n<Ve.tokenQueue.length;n++)Ve.tokenQueue[n][1]({scanner:Ve.scanner});Ve.parser=Px(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||Ux(),$x(Ve.parser.start,n,cp(Ve.scanner.start,n))}Sa.scan=cp;function gp(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 ]",Wx=new RegExp(Na),Kx=new RegExp(`${Na}$`),qx=new RegExp(Na,"g");function Gx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Jx(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=Ib(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(!Kx.test(h))return;f=u[0],p=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Wx).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(!Gx(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 Yx(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 Xx(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=gp(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(qx,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var yp=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"){mp(n);return}mp(n.scheme,n.optionalSlashes)})},onDestroy(){jx()},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",xe(this.options.HTMLAttributes,n),0]:["a",xe(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=gp(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(Jx({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(Yx({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(Xx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),Zx=Object.defineProperty,Qx=(n,e)=>{for(var t in e)Zx(n,t,{get:e[t],enumerable:!0})},ew="listItem",bp="textStyle",kp=/^\s*([-+*])\s$/,xp=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",xe(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(ew,this.editor.getAttributes(bp)).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:kp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:kp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(bp),editor:this.editor})),[n]}}),wp=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",xe(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)}}}),tw={};Qx(tw,{findListItemPos:()=>_o,getNextListDepth:()=>Ma,handleBackspace:()=>Ta,handleDelete:()=>Aa,hasListBefore:()=>Ep,hasListItemAfter:()=>nw,hasListItemBefore:()=>Cp,listItemHasSubList:()=>vp,nextListIsDeeper:()=>_p,nextListIsHigher:()=>Sp});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]=Ub(e,n,t.$pos.pos+4);return r},Ep=(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))},Cp=(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)},vp=(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)&&Ep(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)||!Gb(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=vp(e,n.state,s);return Cp(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},_p=(n,e)=>{const t=Ma(n,e),r=_o(n,e);return!r||!t?!1:t>r.depth},Sp=(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)||!qb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:o}=t;return!t.empty&&r.sameParent(o)?!1:_p(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Sp(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},nw=(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)},Np=Ee.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}}}}),rw="listItem",Mp="textStyle",Tp=/^(\d+)\.\s$/,Ap=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",xe(this.options.HTMLAttributes,t),0]:["ol",xe(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(rw,this.editor.getAttributes(Mp)).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:Tp,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:Tp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mp)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),ow=/^\s*(\[([( |x])?\])\s$/,sw=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",xe(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:ow,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),lw=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",xe(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()}}});Ee.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(xp.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(wp.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Np.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Ap.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(sw.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(lw.configure(this.options.taskList)),n}});var Bp=Ue.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),iw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,aw=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,cw=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",xe(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:iw,type:this.type})]},addPasteRules(){return[$n({find:aw,type:this.type})]}}),dw=Ue.create({name:"text",group:"inline"}),uw=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",xe(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 fw(n={}){return new Oe({view(e){return new pw(e,n)}})}class pw{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 Fe extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Fe.valid(r)?new Fe(r):le.near(r)}content(){return q.empty}eq(e){return e instanceof Fe&&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 Fe(e.resolve(t.pos))}getBookmark(){return new Ba(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!hw(e)||!mw(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&&Fe.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(Fe.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!ne.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(Fe.valid(a))return a}return null}}}Fe.prototype.visible=!1,Fe.findFrom=Fe.findGapCursorFrom,le.jsonID("gapcursor",Fe);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 Fe.valid(t)?new Fe(t):le.near(t)}}function hw(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 mw(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 gw(){return new Oe({props:{decorations:xw,createSelectionBetween(n,e,t){return e.pos==t.pos&&Fe.valid(t)?new Fe(t):null},handleClick:bw,handleKeyDown:yw,handleDOMEvents:{beforeinput:kw}}})}const yw=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 oe){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Fe.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Fe(d))),!0):!1}}function bw(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Fe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&ne.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Fe(r))),!0)}function kw(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Fe))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=I.empty;for(let l=r.length-1;l>=0;l--)o=I.from(r[l].createAndFill(null,o));let s=n.state.tr.replace(t.pos,t.pos,new q(o,0,0));return s.setSelection(oe.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function xw(n){if(!(n.selection instanceof Fe))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 ww(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 Vp(e):Xe.empty};var Vp=(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 Vp([]);var ww=(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 Ew=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>vw&&(a=Cw(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()>Ew&&(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 Cw(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 vw=20;function _w(n,e,t,r){let o=t.getMeta(mr),s;if(o)return o.historyState;t.getMeta(Mw)&&(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,Lp(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||!Sw(t,n.prevRanges)),d=l?Va(n.prevRanges,t.mapping):Lp(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 Sw(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 Lp(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 Nw(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,Op=null;function gl(n){let e=n.plugins;if(Op!=e){La=!1,Op=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){La=!0;break}}return La}const mr=new $e("history"),Mw=new $e("closeHistory");function Tw(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 _w(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Dp:r=="historyRedo"?Rp:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Ip(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=Nw(o,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Dp=Ip(!1,!0),Rp=Ip(!0,!0);Ee.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 Aw=Ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[fw(this.options)]}});Ee.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 Bw=Ee.create({name:"gapCursor",addProseMirrorPlugins(){return[gw()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ke(te(n,"allowGapCursor",t)))!=null?e:null}}});Ee.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)}}})]}}),Ee.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 Fp({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Vw=Ee.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!Fp({node:o,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const o=t.doc.lastChild;return!Fp({node:o,types:e})}}})]}}),Lw=Ee.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Dp(n,e),redo:()=>({state:n,dispatch:e})=>Rp(n,e)}},addProseMirrorPlugins(){return[Tw(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()}}}),Ow=Ee.create({name:"starterKit",addExtensions(){var n,e,t,r;const o=[];return this.options.bold!==!1&&o.push(px.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(ax.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(xp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(gx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(kx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(xx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(Aw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(Bw.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(wx.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(ep.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(Lw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(Ex.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(Nx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(wp.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(Np.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&o.push(yp.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Ap.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Bp.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(cw.configure(this.options.strike)),this.options.text!==!1&&o.push(dw.configure(this.options.text)),this.options.underline!==!1&&o.push(uw.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&o.push(Vw.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),Iw=Ow,Dw=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Rw=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",xe(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Mf({find:Dw,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Fw=Ee.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 Pw=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)}},$w=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 Pw(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},zw={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;"},Hw=ep.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:zw[e-1]}}}}}}),jw=Bp.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Uw=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()}}}),Ww=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()}}}),Kw=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 Pp(n){let e=!1;const t=$1({content:n.modelValue,extensions:[Iw.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),lx,sx,G1,Uw,Ww,jw,Hw,ox,Rw,Fw.configure({types:["heading","paragraph"]}),yp.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),tx.configure({table:{HTMLAttributes:{class:"editor-content"},resizable:!0}}),Kw],editorProps:{handlePaste:$w,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 $p(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 zp(){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},qw={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Gw(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 Jw=Le(qw,[["render",Gw]]),Yw={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function Xw(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 Zw=Le(Yw,[["render",Xw]]),Qw={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function eE(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 tE=Le(Qw,[["render",eE]]),nE={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function rE(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 oE=Le(nE,[["render",rE]]),sE={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function lE(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 iE=Le(sE,[["render",lE]]),aE={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function cE(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 dE=Le(aE,[["render",cE]]),uE={__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))}},fE={__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))}},pE={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()}}},hE={key:0,class:"vsTailwind ui-dialog__wrapper"},mE={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},gE={class:"font-medium text-gray-800 dark:text-[#ffffff]"},yE={class:"ui-dialog__content p-4"},bE={key:0,class:"flex justify-end gap-x-2"};function kE(n,e,t,r,o,s){return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[t.visible||t.modelValue?(i.openBlock(),i.createElementBlock("div",hE,[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",mE,[i.createElementVNode("h3",gE,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",yE,[i.renderSlot(n.$slots,"default",{},void 0,!0)]),s.hasSlot?(i.openBlock(),i.createElementBlock("div",bE,[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 Hp=Le(pE,[["render",kE],["__scopeId","data-v-6d0970a6"]]),xE={},wE={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 EE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",wE,[...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 CE=Le(xE,[["render",EE]]),vE={},_E={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 SE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",_E,[...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 NE=Le(vE,[["render",SE]]),ME={},TE={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 AE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",TE,[...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 BE=Le(ME,[["render",AE]]),VE=i.defineComponent({components:{IconClose:CE,IconSearch:NE,IconEmail:BE},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()}}}),LE={class:"vs-form-text relative bg-white rounded-lg"},OE={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},IE=["disabled","type","placeholder"];function DE(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",LE,[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",OE,[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,IE),[[i.vModelDynamic,n.value]])])}const jp=Le(VE,[["render",DE],["__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 RE={class:"flex flex-col gap-3 p-[20px]"},FE={class:"relative flex items-center gap-2"},PE={class:"flex-1"},$E={key:0,class:"flex items-center gap-2 flex-shrink-0"},zE={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},HE=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(Hp,{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",zE,[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",RE,[i.createElementVNode("div",FE,[i.createElementVNode("div",PE,[i.createVNode(jp,{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",$E,[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")},jE={class:"text-center"},UE={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,w=>{w?(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",w)}),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 w=a.value;for(;w&&w!==document.body;)(w.scrollHeight>w.clientHeight||w.scrollWidth>w.clientWidth)&&(w.addEventListener("scroll",g),l.value.push(w)),w=w.parentElement;document.body&&(document.body.addEventListener("scroll",g),l.value.push(document.body))},f=()=>{l.value.forEach(w=>{w.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=w=>{if(!w){s.value=!1;return}c.value?.contains(w.target)||d.value?.contains(w.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=w=>{s.value&&d.value&&!d.value.contains(w.target)&&(s.value=!1)};return e({togglePopover:m}),(w,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[i.createElementVNode("div",jE,[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(w.$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(w.$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",UE,[i.renderSlot(w.$slots,"default",{},()=>[x[2]||(x[2]=i.createElementVNode("span",null,"Popover content",-1))])])],6),[[i.vShow,s.value]])]),_:3})],8,["to"]))])],512))}}),WE={class:"flex flex-col gap-[2px] p-[2px]"},KE=["onClick"],qE={__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",WE,[(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,KE))),128))])]),_:1},512))}},GE={},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-center"};function YE(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:"M8 12l8 0"},null,-1),i.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const XE=Le(GE,[["render",YE]]),ZE={},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-right"};function e2(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:"M10 12l10 0"},null,-1),i.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const t2=Le(ZE,[["render",e2]]),n2={},r2={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 o2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",r2,[...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 s2=Le(n2,[["render",o2]]),l2={},i2={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 a2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",i2,[...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 Up={left:s2,center:XE,right:t2,justify:Le(l2,[["render",a2]])},c2={class:"flex gap-[4px] p-1"},d2=["title","onClick"],u2={__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(Up)[o.value]),{height:"16",width:"16"}))],2)]),default:i.withCtx(()=>[i.createElementVNode("div",c2,[(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(Up)[g?.id]),{height:"16",width:"16"}))],10,d2))),128))])]),_:1},512))}},f2={class:"flex flex-col gap-[2px] p-[2px]"},p2=["onClick"],h2={__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",f2,[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,p2))),128))])]),_:1},512))}},m2={},g2={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 y2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",g2,[...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(m2,[["render",y2]]),b2={components:{VsText:jp},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)}}}},k2={class:"flex items-center w-full max-w-[182px]"},x2=["disabled"];function w2(n,e,t,r,o,s){const l=i.resolveComponent("vs-text");return i.openBlock(),i.createElementBlock("div",k2,[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,x2),[[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 Wp=Le(b2,[["render",w2]]),E2={class:"flex gap-[4px] mb-[8px]"},C2={class:"grid grid-rows-3 grid-cols-7"},v2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},_2=["onClick","title"],S2={__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",E2,[i.createVNode(Wp,{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",C2,[(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",v2,[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,_2)])]))),128))])])]),_:1},512))}},N2={class:"flex gap-[4px] mb-[8px]"},M2={class:"grid grid-rows-3 grid-cols-7"},T2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},A2=["onClick","title"],B2=["onClick","title"],V2={__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",N2,[i.createVNode(Wp,{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",M2,[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",T2,[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,A2)):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,B2)):i.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},L2={__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))}},O2={class:"truncate"},I2={class:"w-[200px]"},D2={class:"max-h-[200px] overflow-y-auto"},R2=["onClick"],F2={__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",O2,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",I2,[i.createElementVNode("ul",D2,[(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,R2))),128))])])]),_:1},512))}},P2={class:"w-[120px]"},$2={class:"max-h-[200px] overflow-y-auto"},z2=["onClick"],H2={__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",P2,[i.createElementVNode("ul",$2,[(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,z2))),128))])])]),_:1},512))}},j2={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function U2(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 W2=Le(j2,[["render",U2]]),K2={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function q2(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 G2=Le(K2,[["render",q2]]),J2={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},Y2={class:"truncate"},X2={class:"max-h-[200px] overflow-y-auto"},Z2=["onClick"],Q2=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",J2,[i.createElementVNode("span",Y2,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",X2,[(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,Z2))),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"]]),eC={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function tC(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 nC=Le(eC,[["render",tC]]),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 rC={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},oC={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},sC={class:"font-medium text-gray-800 dark:text-[#ffffff]"},lC={class:"ui-dialog__content p-4"},iC={key:0,class:"flex justify-end gap-x-2"},aC={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},cC=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",rC,[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",oC,[i.createElementVNode("h3",sC,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",lC,[i.renderSlot(u.$slots,"default",{},void 0,!0)]),u.$slots.footer?(i.openBlock(),i.createElementBlock("div",iC,[i.renderSlot(u.$slots,"footer",{handleClose:a},void 0,!0)])):i.createCommentVNode("",!0),u.buttonText?(i.openBlock(),i.createElementBlock("div",aC,[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(cC,[["__scopeId","data-v-a6807cab"]]),dC={},uC={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 fC(n,e){return i.openBlock(),i.createElementBlock("svg",uC,[...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 pC=Mo(dC,[["render",fC]]),hC={},mC={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 gC(n,e){return i.openBlock(),i.createElementBlock("svg",mC,[...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 yC=Mo(hC,[["render",gC]]),bC={},kC={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 xC(n,e){return i.openBlock(),i.createElementBlock("svg",kC,[...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 wC=Mo(bC,[["render",xC]]),EC={},CC={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 vC(n,e){return i.openBlock(),i.createElementBlock("svg",CC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const _C=Mo(EC,[["render",vC]]),SC={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},NC={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},MC={class:"flex-1"},TC={class:"font-medium text-gray-900"},AC={class:"mt-0.5 text-sm text-gray-700"},BC=i.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:pC,warning:yC,error:_C,info:wC};return(t,r)=>(i.openBlock(),i.createElementBlock("div",SC,[i.createElementVNode("div",NC,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e[t.type]))),i.createElementVNode("div",MC,[i.createElementVNode("strong",TC,i.toDisplayString(t.title),1),i.createElementVNode("p",AC,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 VC=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"},Pe=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(BC,{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)},LC={class:"w-full relative"},OC={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},IC={class:"opacity-100"},DC={key:0,class:"text-red-500 text-[14px]"},RC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},FC=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",LC,[r.ua||r.label?(i.openBlock(),i.createElementBlock("div",OC,[i.createElementVNode("span",IC,i.toDisplayString(r.item[e.value]||r.ua||r.label),1),r.item?.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",DC,"*")):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",RC,i.toDisplayString(r.error),1)):i.createCommentVNode("",!0)]))}}),PC={class:"w-full relative flex flex-row items-center gap-2"},$C={key:0,class:"text-red-500 text-[14px]"},zC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},HC=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",PC,[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",$C,"*")):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",zC,i.toDisplayString(a.error),1)):i.createCommentVNode("",!0)]))}}),jC={class:"w-full relative"},UC={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},WC=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",jC,[i.renderSlot(e.$slots,"default",i.normalizeProps(i.guardReactiveProps(e.$attrs))),e.error?(i.openBlock(),i.createElementBlock("span",UC,i.toDisplayString(e.error),1)):i.createCommentVNode("",!0)]))}}),KC={class:"flex-1 min-w-0"},qC={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},GC={class:"truncate"},JC={key:0,class:"text-red-500 text-[14px]"},YC={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},XC={key:0,class:"mt-1 text-xs text-red-500"},ZC=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",KC,[a.ua||a.label?(i.openBlock(),i.createElementBlock("p",qC,[i.createElementVNode("span",GC,i.toDisplayString(a.item[t.value]||a.ua||a.label),1),o.value?(i.openBlock(),i.createElementBlock("span",JC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("p",YC,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",XC,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0)],2))}}),QC={default:FC,horizontal:HC,inline:WC,settings:ZC};function vt(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 ev=["placeholder","disabled"],tv=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}=vt(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,ev)),[[i.vModelText,r.value]])}}),nv=["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}=vt(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,nv)),[[i.vModelText,r.value]])}}),rv=["placeholder","disabled","min","max"],ov=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}=vt(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,rv)),[[i.vModelText,r.value]])}}),ge=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},sv={},lv={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 iv(n,e){return i.openBlock(),i.createElementBlock("svg",lv,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 av=ge(sv,[["render",iv]]),cv={class:"flex items-center gap-[4px]"},dv=["value","id","disabled"],uv=["for"],fv={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},pv=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",cv,[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,dv),[[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(av,{height:"12",width:"12"})],2),i.createElementVNode("span",fv,[i.renderSlot(l.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(l.label),1)])])],10,uv)]))}}),hv=["name","value","disabled"],mv={class:"flex items-center gap-[6px] text-[14px]"},gv={key:0,class:"text-[16px]"},yv=["src"],bv=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,hv),[[i.vModelCheckbox,o.value]]),i.createElementVNode("span",mv,[a.icon||a.imgUrl?(i.openBlock(),i.createElementBlock("span",gv,[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,yv)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(a.label),1)])])],2))}}),kv={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",kv,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value==="vs-checkbox-buttons"?i.unref(bv):i.unref(pv)),{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"]))]))}}),xv={},wv={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 Ev(n,e){return i.openBlock(),i.createElementBlock("svg",wv,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 Cv=ge(xv,[["render",Ev]]),vv={},_v={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 Sv(n,e){return i.openBlock(),i.createElementBlock("svg",_v,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 Nv=ge(vv,[["render",Sv]]),Mv={},Tv={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 Av(n,e){return i.openBlock(),i.createElementBlock("svg",Tv,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 Bv=ge(Mv,[["render",Av]]),Vv={key:0,class:"flex items-start gap-x-1"},Lv={key:0,class:"text-red-500 text-[14px]"},Ov=["title"],Iv=["disabled"],Kp=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",Vv,[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",Lv,"*")):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(Bv),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Ov)):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,Iv))}}),Dv=["id","innerHTML"],qp=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,Dv))}}),Rv=["placeholder","disabled","name"],Fv=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}=vt(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(()=>dO);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,Rv))}}),Pv={class:"relative w-full bg-white rounded-lg"},$v=["placeholder","disabled"],zv=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}=vt(e.style),r=i.useModel(n,"modelValue");return(o,s)=>(i.openBlock(),i.createElementBlock("div",Pv,[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,$v),[[i.vModelText,r.value]])]))}}),Hv=["value","disabled"],jv={class:"text-[13px] text-gray-700"},Uv=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,Hv),[[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",jv,i.toDisplayString(e.text),1)],2))}}),Wv=["value","disabled"],Kv={class:"text-[13px] text-gray-700"},qv=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,Wv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",Kv,i.toDisplayString(e.text),1)],2))}}),Gv={"vs-input-radio-default":Uv,"vs-input-radio-buttons":qv},Gp=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(()=>Gv[`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))}}),Jv={key:1,class:"w-full flex flex-col gap-4"},Yv={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Xv="Без категорії",Zv=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 w=k[t.group],x=u(w);h.has(x)||h.set(x,[]),h.get(x)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const w=u(k);m.push(w)});const g=new Set,y=k=>{const w=h.get(k)||[];if(!w.length)return null;const x=k===null?"group-null":`group-${String(k)}`,E=k===null?Xv:String(k);return g.add(k),{key:x,label:E,options:w}},b=[];return m.forEach(k=>{const w=y(k);w&&b.push(w)}),h.forEach((k,w)=>{if(g.has(w))return;const x=y(w);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",Jv,[(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",Yv,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))}}),Qv=ge(Zv,[["__scopeId","data-v-8e66207e"]]),e_=["type","placeholder","disabled"],t_=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}=vt(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,e_)),[[i.vModelDynamic,l.value]])}}),Jp=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 Pe({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},n_=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},Yp=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)}},r_={},o_={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 s_(n,e){return i.openBlock(),i.createElementBlock("svg",o_,e[0]||(e[0]=[i.createElementVNode("path",{d:"M5 12h14"},null,-1),i.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const To=ge(r_,[["render",s_]]),l_={},i_={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 a_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",i_,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 c_=ge(l_,[["render",a_]]),d_={},u_={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 f_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",u_,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 p_=ge(d_,[["render",f_]]),h_={},m_={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 g_(n,e){return i.openBlock(),i.createElementBlock("svg",m_,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 Xp=ge(h_,[["render",g_]]),y_={},b_={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 k_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",b_,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 x_=ge(y_,[["render",k_]]),w_={},E_={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 C_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",E_,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 v_=ge(w_,[["render",C_]]),__=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},S_=n=>{const e=__(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)?p_:t.textsFormat.includes(e)?v_:t.documentsFormat.includes(e)?c_:t.archivesFormat.includes(e)?x_:Xp},N_={},M_={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 T_(n,e){return i.openBlock(),i.createElementBlock("svg",M_,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(N_,[["render",T_]]),A_={},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-download"};function V_(n,e){return i.openBlock(),i.createElementBlock("svg",B_,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 Zp=ge(A_,[["render",V_]]),L_=["title"],O_={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},I_=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(S_)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=l=>i.unref(Yp)(t.value))},null,8,["src"])),i.createElementVNode("div",O_,[i.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=l=>{i.unref(n_)(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(Yp)(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(Zp,{class:"w-4 h-4"})])])],8,L_))}}),Qp=ge(I_,[["__scopeId","data-v-286cdbc0"]]),D_={class:"flex items-center gap-x-2"},R_=["multiple","disabled"],F_={key:1,class:"flex items-center flex-wrap gap-2"},P_={key:1,class:"loader"},$_={key:1,class:"loader"},z_=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 Pe({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 Jp(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 Jp(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",D_,[i.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:u.multiple,onChange:d,disabled:l.value||u.disabled},null,40,R_),!u.multiple&&r.value?(i.openBlock(),i.createBlock(Qp,{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",F_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(p,h)=>(i.openBlock(),i.createBlock(Qp,{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",P_)):(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",$_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2))]))}}),H_=ge(z_,[["__scopeId","data-v-e613a523"]]),j_={class:"max-w-[55vw]"},U_={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},W_={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},K_={class:"px-[5px]"},q_={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",j_,[i.createElementVNode("p",U_,i.toDisplayString(o.item?.uploaded_name),1),i.createElementVNode("p",W_,[i.createElementVNode("span",null,i.toDisplayString(o.item?.username),1),i.withDirectives(i.createElementVNode("span",K_,"|",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",q_,i.toDisplayString(r(o.item?.size)),1)])])],64))}}),G_={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},J_={key:0,class:"flex w-full gap-x-3 items-center"},Y_={key:1,class:"flex gap-x-3 w-full items-center"},X_={key:2,class:"flex gap-x-3 w-full items-center"},Z_=["href"],Q_={key:3,class:"flex gap-x-3 w-full items-center"},eS={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},tS={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"},nS={class:"inline-block"},rS={class:"inline-block"},oS=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",G_,[u.item.ext==="jpg"||u.item.ext==="png"?(i.openBlock(),i.createElementBlock("div",J_,[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",Y_,[i.createVNode(xl,{item:u.item},null,8,["item"])])):s(u.item)?(i.openBlock(),i.createElementBlock("div",X_,[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,Z_)])):(i.openBlock(),i.createElementBlock("div",Q_,[i.createVNode(xl,{item:u.item},null,8,["item"])])),i.createElementVNode("div",eS,[i.createElementVNode("div",tS,[i.createElementVNode("div",nS,[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(Zp,{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",rS,[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"})])])])])]))}}),sS={},lS={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 iS(n,e){return i.openBlock(),i.createElementBlock("svg",lS,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 aS=ge(sS,[["render",iS]]),cS={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},dS={class:"flex w-full mb-[12px] items-center gap-x-2"},uS={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},fS={class1:"ml-auto"},pS={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"},hS={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},mS={class:"relative"},gS={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"},yS={key:0},bS=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(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),h=i.computed(()=>f.value===""?u.value:u.value.filter(w=>w?.uploaded_name?.includes(f.value))),m=w=>{const x=p.value.findIndex(E=>E===w.item.file_path);x!==-1&&(s.value=!0,l.value=x)},g=async()=>{try{const w=await fetch(`${t.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=w?.rows}catch(w){console.error(w)}},y=async w=>{await Promise.all(Array.from(w.target.files).map(async x=>{const E=new FormData;E.append("file",x);try{const M=`${t.prefix}/widget/file/${o.value}`,C=await fetch(M,{method:"POST",body:E});return C.ok?(a("update","file-list"),x):(Pe({type:C.status>=400&&C.status<500?"warning":"error",title:"Error",message:`Error code: ${C.status}`}),null)}catch(M){return Pe({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await g()},b=w=>{const x={...w};return w.cancel||(x.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(x.confirm=async()=>{await w.confirm(),c.value=!1,g()}),x},k=w=>{d.value=b(w),c.value=!0};return i.watch(o,w=>{w&&g()}),i.onMounted(()=>{o.value&&g()}),(w,x)=>{const E=i.resolveComponent("Lightbox"),M=i.resolveComponent("MessageBox");return i.openBlock(),i.createElementBlock("div",cS,[i.createElementVNode("div",dS,[i.createElementVNode("h2",uS," Файлів: "+i.toDisplayString(u.value?.length),1),i.createElementVNode("div",fS,[i.createElementVNode("label",null,[i.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=C=>y(C))},null,32),i.createElementVNode("div",pS,[i.createVNode(aS,{height:"16",width:"16"})])])])]),u.value?.length>4?(i.openBlock(),i.createElementBlock("div",hS,[i.createElementVNode("div",null,[i.createElementVNode("div",mS,[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]=C=>f.value=C),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",gS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(C,A)=>(i.openBlock(),i.createBlock(oS,{key:A,prefix:w.prefix,item:C,index:A,onUpdate:x[2]||(x[2]=z=>w.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=z=>k(z)),onOpenLightbox:x[4]||(x[4]=z=>m(z))},null,8,["prefix","item","index"]))),128)),h.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",yS,x[9]||(x[9]=[i.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):i.createCommentVNode("",!0),i.createVNode(E,{modelValue:s.value,"onUpdate:modelValue":x[5]||(x[5]=C=>s.value=C),startIndex:l.value,"onUpdate:index":x[6]||(x[6]=C=>l.value=C),images:p.value},null,8,["modelValue","startIndex","images"]),i.createVNode(M,i.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=C=>c.value=C),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),kS={class:"flex items-center justify-between"},xS={class:"text-[16px] text-gray-900 font-medium"},wS={class:"grid gap-3"},ES=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",kS,[i.createElementVNode("p",xS,i.toDisplayString(n.title),1),i.createVNode(Kp,{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",wS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),CS=ge(ES,[["__scopeId","data-v-90320b87"]]),vS={class:"text-[16px] text-gray-900 font-medium"},_S={class:"grid gap-3"},SS=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(Cv),{class:i.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),i.createElementVNode("span",vS,i.toDisplayString(n.title),1)]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",_S,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),NS=ge(SS,[["__scopeId","data-v-590eff11"]]),MS={class:"flex items-center justify-between"},TS=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",MS,[i.createElementVNode("p",null,i.toDisplayString(n.title),1)]),i.renderSlot(e.$slots,"default")]))}}),AS={switcher:CS,accordion:NS,default:TS},Ot={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},BS=(n,e)=>String(n)===String(e),VS=(n,e)=>String(n)!==String(e),LS=(n,e)=>n>e,OS=(n,e)=>n>=e,IS=(n,e)=>n<e,DS=(n,e)=>n<=e,RS=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,FS=(n,e)=>String(n).startsWith(String(e)),PS=(n,e)=>String(n).endsWith(String(e)),$S=(n,e)=>String(n).includes(String(e)),zS=(n,e)=>Array.isArray(e)?e.includes(n):!1,HS=(n,e)=>Array.isArray(e)?!e.includes(n):!0,eh=(n,e)=>{if(!e)return!0;switch(e?.[1]){case Ot.Equal:return BS(n,e?.[2]);case Ot.Inequal:return VS(n,e?.[2]);case Ot.Higer:return LS(n,e?.[2]);case Ot.HigerOrEqual:return OS(n,e?.[2]);case Ot.Lower:return IS(n,e?.[2]);case Ot.LowerOrEqual:return DS(n,e?.[2]);case Ot.Between:return RS(n,e?.[2]);case Ot.StartWith:return FS(n,e?.[2]);case Ot.EndWith:return PS(n,e?.[2]);case Ot.Contain:return $S(n,e?.[2]);case Ot.In:return zS(n,e?.[2]);case Ot.NotIn:return HS(n,e?.[2]);default:return!0}},jS=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 eh(u,c)})),s=i.computed(()=>AS[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(rh,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)}}),US=["aria-expanded","data-focus"],WS={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},KS={class:"flex items-center min-w-0"},qS=["title"],GS=["innerHTML"],JS=["onClick"],YS={class:"flex-1 min-w-[2px]"},XS=["placeholder"],ZS=["title"],QS=["innerHTML"],eN={key:2,class:"flex-1 min-w-[2px]"},tN=["placeholder"],nN={class:"flex items-center shrink-0"},rN=["disabled"],oN=["disabled","title"],sN=["aria-disabled","onClick"],lN=["innerHTML"],iN={key:1,class:"px-3 py-2 text-center text-gray-500"},aN=["disabled"],th=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);vt(t.style);const l=i.computed({get:()=>t.modelValue,set:T=>r("update:modelValue",T)});!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),w=i.ref("bottom"),x=i.ref({}),E=i.ref([]),M=i.computed(()=>{if(!E.value.length)return[];const T=m.value,R=new Map(T.map(j=>[j.id?.toString(),j]));return E.value.map(j=>R.get(j?.toString())).filter(j=>!!j)}),C=i.computed(()=>t.placeholder||"Select..."),A=i.computed(()=>U(h.value));i.computed(()=>o.value?!E.value.length&&b.value==="":!A.value&&b.value==="");const z=i.computed(()=>s.value?!1:o.value?E.value.length>0:!!l.value),G=T=>o.value?E.value.some(R=>R?.toString()===T?.toString()):l.value?.toString()===T?.toString(),V=i.computed(()=>{let T=m.value??[];if(!t.data&&b.value.trim()!==""){const R=b.value.toLowerCase();T=T.filter(j=>{const ae=U(j).toLowerCase(),_e=j.text?.toLowerCase?.()||"";return ae.includes(R)||_e.includes(R)})}if(o.value&&E.value.length){const R=new Set(E.value.map(j=>j?.toString()));T=T.filter(j=>!R.has(j.id?.toString()))}return T}),O=i.inject("values"),Y=/\{\{\s*([^}]+?)\s*\}\}/g,Q=T=>(T?String(T):"").replace(/<[^>]*>/g,"").trim(),P=i.computed(()=>t.slot??t?.optionTemplate??""),K=T=>{if(!T)return"";const R=P.value;return R?R.replace(Y,(j,ae)=>{const _e=ae.trim(),Ze=T[_e];return Ze!=null?String(Ze):""}):T.text??""},U=T=>{if(!T)return"";if(!P.value)return T.text??"";const R=K(T);return Q(R)||T.text||""},re=T=>{t.set&&O?.value&&Object.entries(t.set).forEach(([R,j])=>{if(!R)return;const ae=T?T[j]:null;O.value[R]=ae??null})},se=i.computed(()=>t.parent?O?.value?.[t.parent]?.toString()??null:null),ve=async T=>{if(!t.data){let R=t.options??[];if(T?.trim()){const j=T.toLowerCase();R=R.filter(ae=>{const _e=U(ae).toLowerCase(),Ze=ae.text?.toLowerCase?.()||"";return _e.includes(j)||Ze.includes(j)})}return R}try{const R=t.host??"",j=t.prefix??"api",ae=t.api??`/${j}/suggest/${t.data}`,_e=`${R}${ae}`,Ze=new URLSearchParams;return Ze.set("json","1"),T&&Ze.set("key",T),se.value!==void 0&&se.value!==null&&se.value!==""&&Ze.set("parent",se.value),(await fetch(`${_e}?${Ze.toString()}`).then(Nt=>Nt.json()))?.data??[]}catch{return[]}},pt=async()=>{t.data?m.value=await ve(b.value):m.value=t.options?[...t.options]:[]},St=async T=>{if(T==null)return null;const R=m.value?.find(j=>j?.id?.toString()===String(T));if(R)return R;if(t.data)try{const j=t.host??"",ae=t.prefix??"api",_e=t.api??`/${ae}/suggest/${t.data}`,Ze=`${j}${_e}`,Nt=new URLSearchParams;return Nt.set("json","1"),Nt.set("val",String(T)),se.value!==void 0&&se.value!==null&&se.value!==""&&Nt.set("parent",se.value),((await fetch(`${Ze}?${Nt.toString()}`).then(Wr=>Wr.json()))?.data??[])?.[0]??null}catch{return null}return null},Ft=async T=>{const R=new Set(m.value.map(ae=>ae.id?.toString())),j=T.filter(ae=>!R.has(ae?.toString()));j.length&&await j.reduce(async(ae,_e)=>{await ae;const Ze=await St(_e);Ze&&m.value.push(Ze)},Promise.resolve())},Ke=async()=>{s.value||(f.value=!0,await pt(),await i.nextTick(()=>{$t(),k.value?.focus(),V.value.length?g.value=0:g.value=-1}))},ht=()=>{f.value=!1,g.value=-1},En=async T=>{s.value||(f.value?ht():await Ke())},Cn=async()=>{f.value?k.value?.focus():await Ke()},vn=()=>{o.value?(E.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null)),re(null),b.value="",i.nextTick(()=>k.value?.focus())},xr=T=>{o.value&&(E.value=E.value.filter(R=>R?.toString()!==T?.toString()),l.value=[...E.value],r("change",l.value),i.nextTick(()=>k.value?.focus()))},mt=T=>{o.value?(G(T.id)||(E.value=[...E.value,T.id],l.value=[...E.value],r("change",l.value)),b.value="",i.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,V.value.length-1)}),re(null)):(h.value=T,l.value=T.id,r("change",l.value),b.value="",ht(),re(T))},Pt=T=>{G(T.id)||mt(T)},cn=(T,R)=>{if(!T||!R)return;const j=T.offsetTop,ae=j+T.offsetHeight,_e=R.scrollTop,Ze=_e+R.clientHeight;let Nt=R.scrollTop;j<_e?Nt=j-80:ae>Ze&&(Nt=ae-R.clientHeight+4);const Wr=R;Wr.scrollTop=Nt},qe=T=>{let R=T.parentElement;for(;R;){if(R.classList.contains("ui-dialog__content"))return R;const j=window.getComputedStyle(R),ae=j.overflow+j.overflowY+j.overflowX;if(ae.includes("auto")||ae.includes("scroll")||R===document.body||R===document.documentElement)return R;R=R.parentElement}return document.body},$t=()=>{if(!c.value)return;const T=c.value.getBoundingClientRect(),R=window.innerHeight||document.documentElement.clientHeight,j=window.innerWidth||document.documentElement.clientWidth,ae=8,_e=8,Ze=t.maxHeight||300,Nt=R-T.bottom-_e-ae,Wr=T.top-_e-ae,Dl=Nt>=Wr,bc=Math.max(j-ae*2,0);let{width:jo}=T;bc>0&&jo>bc&&(jo=bc);let{left:Uo}=T;Uo+jo+ae>j&&(Uo=j-jo-ae),Uo=Math.max(Uo,ae);const uO=Math.min(Ze,Math.max(Dl?Nt:Wr,50));w.value=Dl?"bottom":"top",x.value={position:"fixed",left:`${Uo}px`,width:`${jo}px`,minWidth:"300px",maxHeight:`${uO}px`,transform:Dl?"none":"translateY(-100%)",top:Dl?`${T.bottom+_e}px`:`${T.top-_e}px`}},qt=async T=>{s.value||!f.value&&(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),await Ke())},dn=T=>{if(!f.value)return;const{key:R}=T;if(R==="ArrowDown")T.preventDefault(),g.value+1<V.value.length&&(g.value+=1,cn(y.value[g.value],d.value));else if(R==="ArrowUp")T.preventDefault(),g.value>0&&(g.value-=1,cn(y.value[g.value],d.value));else if(R==="Enter"){T.preventDefault();const j=V.value[g.value];j&&mt(j),k.value?.blur()}else R==="Escape"?(T.preventDefault(),ht()):R==="Backspace"?o.value&&b.value===""&&E.value.length&&(E.value=E.value.slice(0,-1),l.value=[...E.value],r("change",l.value)):R==="Home"?(g.value=0,cn(y.value[0],d.value)):R==="End"?(g.value=V.value.length-1,cn(y.value[g.value],d.value)):R==="Tab"&&ht()},Xn=()=>{s.value||(p.value=!0)},_=()=>{p.value=!1,b.value=""},S=T=>{T.key==="Escape"&&f.value&&ht()},D=T=>{const R=T.target;a.value?.contains(R)||u.value?.contains(R)||ht()},X=T=>{f.value&&d.value&&!d.value.contains(T.target)&&$t()},we=()=>{f.value&&$t()},Be=()=>{f.value&&$t()};i.watch(()=>t.options,T=>{T?.length&&(m.value=[...T],pe())},{immediate:!0});async function pe(){if(o.value)Array.isArray(l.value)?E.value=[...l.value]:(E.value=l.value==null?[]:[l.value],l.value=[...E.value]),t.data&&E.value.length&&(await Ft(E.value),await i.nextTick());else{if(Array.isArray(l.value)){const T=l.value[0]??null;l.value=T??null}l.value!=null&&(h.value=await St(l.value)),re(h.value??null)}}i.watch(l,()=>{pe()}),i.onMounted(async()=>{addEventListener("keydown",S),addEventListener("scroll",X,!0),addEventListener("resize",we),document.addEventListener("click",D,!0),c.value&&qe(c.value).addEventListener("scroll",Be,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await ve("")),await pe(),fe.value=!1}),i.onUnmounted(()=>{removeEventListener("keydown",S),removeEventListener("scroll",X,!0),removeEventListener("resize",we),document.removeEventListener("click",D,!0),c.value&&qe(c.value).removeEventListener("scroll",Be,!0)});const B=i.ref(!1),F=i.ref({}),he=i.ref([]),v=i.ref(null);async function N(){if(!t.add?.token||v?.value.validate())return;const T=t.add.api??`/api/table/${t.add.token}`,{id:R}=await fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F.value)}).then(j=>j.json());if(!t.options?.length&&t.data){const{data:j}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${R}`).then(ae=>ae.json());h.value=j[0],m.value.push(j[0]),l.value=R}B.value=!1,Pe({title:"Success!",message:"Object created."})}async function H(){if(!t.add)return null;const T=await fetch(`/api/template/form/${t.add.form}`).then(R=>R.json());return he.value=T.schema,B.value=!0,null}function W(T,R=200){let j;return(...ae)=>{j&&clearTimeout(j),j=window.setTimeout(()=>T(...ae),R)}}const Z=W(async T=>{m.value=await ve(T)},200);i.watch(b,T=>{t.data&&Z(T.trim())}),i.watch(()=>t.options,T=>{!t.data&&T?.length&&(m.value=[...T],pe())},{immediate:!0}),i.watch(()=>t.parent??t.parentValue,()=>{t.data&&pt()});const fe=i.ref(!0);return i.watch(se,async()=>{if(t.data&&(fe.value||(o.value?(E.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null))),await pt(),t.auto===1&&se.value&&m.value.length>0)){const T=m.value[0];T&&mt(T)}}),(T,R)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(i.unref(Ia),{visible:B.value,"onUpdate:visible":R[1]||(R[1]=j=>B.value=j),title:"Додати",buttonText:"Додати",onDone:N,teleport:T.teleport},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:he.value,modelValue:F.value,"onUpdate:modelValue":R[0]||(R[0]=j=>F.value=j),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:R[5]||(R[5]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass])},[R[10]||(R[10]=i.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),R[11]||(R[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",WS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(M.value,j=>(i.openBlock(),i.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:j.id},[i.createElementVNode("div",KS,[j?.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:j?.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:U(j)},[P.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,GS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.text),1)],64))],8,qS)]),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(j.id),["stop"])},R[6]||(R[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,JS)]))),128)),i.createElementVNode("div",YS,[!s.value&&T.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:E.value.length?" ":C.value,"onUpdate:modelValue":R[2]||(R[2]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,XS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)])])):!o.value&&!p.value&&A.value&&b.value===""?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["truncate text-gray-900"]),title:A.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),P.value?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({"pl-5":h.value?.color}),innerHTML:K(h.value)},null,10,QS)):(i.openBlock(),i.createElementBlock("span",{key:2,class:i.normalizeClass({"pl-5":h.value?.color})},i.toDisplayString(h.value?.text),3))],8,ZS)):i.createCommentVNode("",!0),o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",eN,[!s.value&&T.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:A.value?" ":C.value,"onUpdate:modelValue":R[3]||(R[3]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,tN)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)]))],512),i.createElementVNode("div",nN,[z.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"])},R[7]||(R[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,rN)):i.createCommentVNode("",!0),R[9]||(R[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:R[4]||(R[4]=i.withModifiers(j=>En(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},R[8]||(R[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,oN)])],42,US),(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},[V.value.length?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(V.value,(j,ae)=>(i.openBlock(),i.createElementBlock("div",{key:j.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 ",G(j.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===ae&&!G(j.id)?"bg-blue-100":""]),"aria-disabled":G(j.id)?"true":"false",role:"option",tabindex:"-1",onClick:_e=>Pt(j)},[j?.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:j?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["leading-[19px]",g.value===j.id?"text-white":"",(g.value,"")])},[P.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,lN)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.text),1)],64))],2)],10,sN))),128)):(i.openBlock(),i.createElementBlock("div",iN," No options "))],4)],4)):i.createCommentVNode("",!0)]))],2),t.add?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:H,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"}),R[12]||(R[12]=i.createElementVNode("span",null,"Додати",-1))],8,aN)):i.createCommentVNode("",!0)],512)],64))}}),cN=["placeholder","disabled"],dN=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}=vt(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,cN)),[[i.vModelText,r.value]])}}),uN={},fN={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 pN(n,e){return i.openBlock(),i.createElementBlock("svg",fN,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 hN=ge(uN,[["render",pN]]),mN={},gN={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 yN(n,e){return i.openBlock(),i.createElementBlock("svg",gN,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 bN=ge(mN,[["render",yN]]),kN={},xN={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 wN(n,e){return i.openBlock(),i.createElementBlock("svg",xN,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 EN=ge(kN,[["render",wN]]),CN={},vN={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 _N(n,e){return i.openBlock(),i.createElementBlock("svg",vN,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 SN=ge(CN,[["render",_N]]),NN={},MN={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 TN(n,e){return i.openBlock(),i.createElementBlock("svg",MN,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 nh=ge(NN,[["render",TN]]),AN={},BN={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function VN(n,e){return i.openBlock(),i.createElementBlock("svg",BN,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 LN=ge(AN,[["render",VN]]),ON={},IN={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 DN(n,e){return i.openBlock(),i.createElementBlock("svg",IN,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 RN=ge(ON,[["render",DN]]),FN={class:"vs-datatable border rounded-xl w-full flex-grow"},PN={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},$N={class:"relative w-full"},zN={class:"table-wrapper flex gap-2"},HN={class:"vs-popover inline-block text-slate-700"},jN={class:"text-center"},UN={class:""},WN={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"},KN={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},qN={class:"text-sm items-center text-gray-800 flex gap-1"},GN={class:"w-full overflow-x-auto"},JN={class:"w-full table-auto caption-bottom text-sm"},YN={class:"[&_tr]:border-b"},XN={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"},ZN={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"},QN={key:0,colspan:"100%",class:"text-center"},eM={class:"w-full"},tM={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},nM=["onDragstart","onDragover","onDrop"],rM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},oM={class:"flex items-center justify-center"},sM={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"},lM={key:0},iM=["src"],aM={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},cM=["innerHTML"],dM={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"},uM={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"},fM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},pM={class:"flex items-center justify-center gap-2"},hM=["onClick"],mM=["onClick"],gM={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},yM=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 P=o.value.toLowerCase();return t.value.filter(K=>e.colModel?.some(U=>{const re=K[U.key];return re?Array.isArray(re)?re.join(", ").toLowerCase().includes(P):String(re).toLowerCase().includes(P):!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=P=>{l.value=P},p=P=>{a.value=P},h=P=>{if(l.value===null||l.value===P){l.value=null,a.value=null;return}const K=[...t.value],[U]=K.splice(l.value,1);K.splice(P,0,U),t.value=K,l.value=null,a.value=null},m=P=>{const K=P.currentTarget.getBoundingClientRect();u.value={top:K.bottom+window.scrollY,left:K.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=P=>{const K=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],U=P.toLowerCase();return K.some(re=>U.endsWith(re))},b=P=>{const K=P.target.files?.[0];if(!K)return;const U=new FileReader;U.onload=re=>{try{const se=re.target?.result;if(typeof se=="string"){const ve=JSON.parse(se);Array.isArray(ve)&&t.value.push(...ve)}}catch(se){console.error("Error parsing file:",se)}},U.readAsText(K)},k=()=>{const P=JSON.stringify(t.value,null,2),K=new Blob([P],{type:"application/json"}),U=URL.createObjectURL(K),re=document.createElement("a");re.href=U,re.download="data.json",re.click(),URL.revokeObjectURL(U)};i.onMounted(async()=>{const P=e.colModel?.filter(K=>K.data);P?.length&&Promise.all(P.map(async K=>{const U=await(await fetch(`/api/suggest/${K.data}`)).json();r.value[K.key]=U.data}))});const w=i.ref(""),x=i.ref(!1);let E="edit",M=0;const C=i.ref({}),A=i.ref({});async function z(){w.value="Додати",x.value=!0,E="add",C.value={}}function G(P,K){const U=K.key||K.name;return r.value[U]&&P[U]?r.value[U].find(re=>re.id.toString()===P[U].toString())?.text??P[U]:P[U]||"-"}async function V(P,K){w.value="Редагувати",x.value=!0,E="edit",M=K,C.value={...P}}function O(){const P=A.value.validate();if(P){Pe({type:"warning",title:"Помилка валідації",message:Object.entries(P).map(([K,U])=>`${K}: ${U}`).join(`
|
|
119
|
-
`)});return}E==="add"?Array.isArray(t.value)?t.value=[...t.value,C.value]:t.value=[C.value]:t.value=t.value.map((K,U)=>U===M?C.value:K),x.value=!1}function Y(P){t.value=t.value.filter((K,U)=>U!==P)}function Q(){x.value=!1}return(P,K)=>(i.openBlock(),i.createElementBlock("div",FN,[i.createElementVNode("div",PN,[i.createElementVNode("div",$N,[i.createVNode(hN,{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":K[0]||(K[0]=U=>o.value=U),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",zN,[i.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),i.createElementVNode("div",HN,[i.createElementVNode("div",jN,[i.createElementVNode("div",UN,[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(bN,{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",WN,[i.createElementVNode("div",KN,[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(EN,{class:"text-black",width:"14",height:"14"}),K[4]||(K[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",qN,[i.createVNode(SN,{class:"text-black",width:"14",height:"14"}),K[5]||(K[5]=i.createTextVNode(" Експортувати ",-1))])])])])],4)):i.createCommentVNode("",!0)])),i.createElementVNode("button",{onClick:z,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),K[6]||(K[6]=i.createTextVNode(" Додати ",-1))])]),i.createElementVNode("div",GN,[i.createElementVNode("table",JN,[i.createElementVNode("thead",YN,[i.createElementVNode("tr",XN,[i.createElementVNode("th",ZN,[i.createVNode(nh,{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(P.colModel,U=>(i.openBlock(),i.createElementBlock("th",{key:U.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(U.ua||U.label),1))),128)),K[7]||(K[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",QN,[i.createElementVNode("div",eM,[i.createElementVNode("div",tM,[i.createVNode(LN,{class:"w-48 mx-auto"}),K[8]||(K[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,(U,re)=>(i.openBlock(),i.createElementBlock("tr",{key:U.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===re,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":a.value===re}]),draggable:"true",onDragstart:se=>f(re),onDragover:i.withModifiers(se=>p(re),["prevent"]),onDrop:se=>h(re)},[i.createElementVNode("td",rM,[i.createElementVNode("div",oM,[i.createVNode(nh,{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(P.colModel,se=>(i.openBlock(),i.createElementBlock("td",{key:se.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[se.type==="file"?(i.openBlock(),i.createElementBlock("div",sM,[y(G(U,se))?(i.openBlock(),i.createElementBlock("div",lM,[i.createElementVNode("img",{src:G(U,se),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,iM)])):(i.openBlock(),i.createElementBlock("div",aM,[i.createVNode(Xp,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):se.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:G(U,se)},null,8,cM)):se.type==="reference"?(i.openBlock(),i.createElementBlock("div",dM,i.toDisplayString(G(U,se)),1)):(i.openBlock(),i.createElementBlock("div",uM,i.toDisplayString(G(U,se)),1))]))),128)),i.createElementVNode("td",fM,[i.createElementVNode("div",pM,[i.createElementVNode("button",{onClick:se=>V(U,re),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(RN,{width:"24",height:"24",class:"w-3 h-3"})],8,hM),i.createElementVNode("button",{onClick:se=>Y(re),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,mM)])])],42,nM))),128))],2)])]),i.createVNode(i.unref(Ia),{teleport:"#modal",visible:x.value,title:w.value,size:"lg",onClose:Q},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:e.colModel,values:C.value,"onUpdate:values":K[1]||(K[1]=U=>C.value=U),form:A.value,"onUpdate:form":K[2]||(K[2]=U=>A.value=U)},null,8,["schema","values","form"]),i.createElementVNode("div",gM,[i.createElementVNode("button",{type:"button",onClick:K[3]||(K[3]=U=>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:O,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"])]))}}),bM={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 kM(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 xM={},wM={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 EM(n,e){return i.openBlock(),i.createElementBlock("svg",wM,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 CM=ge(xM,[["render",EM]]),vM={},_M={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 SM(n,e){return i.openBlock(),i.createElementBlock("svg",_M,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 NM=ge(vM,[["render",SM]]),MM={},TM={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 AM(n,e){return i.openBlock(),i.createElementBlock("svg",TM,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 BM=ge(MM,[["render",AM]]),VM={},LM={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 OM(n,e){return i.openBlock(),i.createElementBlock("svg",LM,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 IM=ge(VM,[["render",OM]]),DM={},RM={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 FM(n,e){return i.openBlock(),i.createElementBlock("svg",RM,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 PM=ge(DM,[["render",FM]]),$M={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},zM={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"},HM=["onClick"],jM={class:"relative flex-1 min-w-[140px]"},UM=["placeholder"],WM="https://data.softpro.ua/api-user/gis-url-proxy",KM="https://geo.rv.ua/api-user/dzk.api",qM=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(E=>o.includes(E));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 E=u.value;E&&!E.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 E=x.replace(/[,]+/g," ").trim();if(!E)return null;const M=E.split(/\s+/).filter(Boolean);if(M.length<2)return null;const C=M.slice(0,2).map(Number);if(!C.every(Q=>Number.isFinite(Q)))return null;let[A,z]=C,G=A,V=z;const O=Q=>Math.abs(Q)<=90,Y=Q=>Math.abs(Q)<=180;if(!O(G)||!Y(V))if(O(V)&&Y(G))G=z,V=A;else return null;return{lat:G,lng:V}}function g(x){return(x?.items||[]).map((E,M)=>({id:String(E?.id??M),title:E?.title||E?.address?.label||"Знайдений обʼєкт",lat:Number(E?.position?.lat),lng:Number(E?.position?.lng)})).filter(E=>Number.isFinite(E.lat)&&Number.isFinite(E.lng))}function y(x){const E=x?.result||x?.data||x;if(!E)return[];const M=E.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[C,A]=M.coordinates;return!Number.isFinite(A)||!Number.isFinite(C)?[]:[{id:"parcel",title:E.cadnum||E.cad_num||"Земельна ділянка",lat:A,lng:C}]}function b(x){const E=x.replace(/\s+/g,"").split(":");if(E.length!==4)return!1;const M=[10,2,3,4];return E.every((C,A)=>C.length===M[A]&&/^\d+$/.test(C))}function k(x){r("goToCoordinates",[x.lat,x.lng])}async function w(){const x=c.value.trim();if(x){if(a.value==="xy"){const E=m(x);if(!E){Pe({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(E),c.value="";return}try{const E=new URL(a.value==="here"?WM:KM);if(a.value==="here")E.searchParams.set("searchtext",x);else{if(!b(x)){Pe({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}E.searchParams.set("cad_num",x)}const M=await fetch(E.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const C=await M.json(),A=a.value==="here"?g(C):y(C);if(!A.length)Pe({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const z=A[0];k(z),c.value=""}}catch(E){const M=E?.message||"Помилка пошуку";Pe({type:"error",title:"Пошук",message:M})}}}return(x,E)=>(i.openBlock(),i.createElementBlock("div",$M,[i.createElementVNode("form",{class:"flex gap-2",onSubmit:i.withModifiers(w,["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:E[0]||(E[0]=M=>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"},E[2]||(E[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",zM,[i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,M=>(i.openBlock(),i.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:C=>f(M)},i.toDisplayString(h(M)),9,HM))),128))])])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createElementVNode("div",jM,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":E[1]||(E[1]=M=>c.value=M),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,UM),[[i.vModelText,c.value,void 0,{trim:!0}]]),E[3]||(E[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)]))}}),GM=ge(qM,[["__scopeId","data-v-3048520a"]]),JM={class:"bg-white/30 p-1 rounded-md shadow"},YM={class:"flex gap-2"},XM=["onClick","title"],ZM=["src"],QM=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",JM,[i.createElementVNode("div",YM,[(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,ZM)],10,XM))),128))])]))}}),eT={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},tT={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},nT={class:"text-sm font-medium"},rT={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},oT={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},sT={class:"flex items-center gap-1"},lT=["disabled"],iT=["disabled"],aT=["disabled"],cT={class:"absolute top-4 right-4 z-[1000]"},dT={class:"flex flex-col gap-[2px]"},uT=["disabled"],fT=["disabled"],pT=["disabled"],hT=["disabled"],mT={class:"flex flex-col gap-2"},gT={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]"},yT={class:"flex flex-col gap-1"},bT=["checked","disabled","onChange"],kT={class:"text-gray-700 text-xs font-medium"},xT={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"},wT={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},ET={class:"shrink-0"},CT={class:"font-bold"},vT={class:"flex items-center"},_T={class:"text-xs mr-2"},ST={key:0,class:"text-xs"},NT={key:1,class:"text-xs"},MT=["disabled"],TT=["disabled"],AT=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 N=new Set(r.tools.map(H=>H.toLowerCase()));return{search:N.has("search"),import:N.has("import"),export:N.has("export"),point:N.has("point"),line:N.has("line"),polygon:N.has("polygon"),rectangle:N.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 w(){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),E=i.ref(null);let M=null;const C=i.ref(null),A=v=>{v.ctrlKey&&v.preventDefault()};function z(v,N){return v?.id?String(v.id):v?.url?`${v.url}-${N}`:`layer-${N}`}function G(v){if(!v)return"";if(/^https?:\/\//i.test(v))return v.replace(/\/+$/,"");const N=v.replace(/^\/+/,"").replace(/\/+$/,"");return N?`/${N}`:""}function V(v){const N=v?.url??"";if(!N||/^https?:\/\//i.test(N))return N;const H=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(N.startsWith("/"))return H?`${H}${N}`:N;const W=G(v?.prefix),Z=G(r.prefix),fe=W||Z,T=N.replace(/^\/+/,""),R=fe?`${fe.replace(/\/$/,"")}/${T}`:`/${T}`;return H?`${H}${R}`:R}function O(v){const N=v?.style??{};return H=>{const W=N.colorAttr,Z=N.colorSet??{},fe=typeof W=="string"?Z?.[H?.[W]]??N.color??"#3388ff":N.color??"#3388ff",T=N.stroke??fe;return{weight:N.width??1,color:T,opacity:N.opacity??1,fill:N.type?N.type!=="polyline":!0,fillColor:fe,fillOpacity:N.opacity??.5}}}function Y(v){const N=v?.colorSet||v?.colors;if(v?.colorAttr&&N){const H=Object.entries(N).flat();return["match",["get",v.colorAttr],...H,v.color??"#94a3b8"]}return v?.color??"#3388ff"}function Q(v,N,H){if(!v)return[];const W=[],Z=Y(v);return v.icon&&W.push({id:`${N}-icon`,type:"symbol",source:N,"source-layer":H,minzoom:v.iconZoom||0,layout:{"icon-image":v.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),v.pointZoom&&W.push({id:`${N}-point`,type:"circle",source:N,"source-layer":H,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"?W.push({id:`${N}-fill`,type:"fill",source:N,"source-layer":H,minzoom:v.pointZoom||0,paint:{"fill-color":Z,"fill-opacity":v.opacity??.5,"fill-outline-color":v.stroke||Z}}):v.type==="line"?W.push({id:`${N}-line`,type:"line",source:N,"source-layer":H,paint:{"line-color":Z,"line-opacity":v.opacity??1,"line-width":v.width??1.5}}):v.icon||W.push({id:`${N}-circle`,type:"circle",source:N,"source-layer":H,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}}),W}function P(v,N){const H=v.id||`source-${Math.random().toString(36).slice(2,8)}`,W=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name||H,Z=Q(v.style||{},H,W||H);return Z.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[H]:{type:"vector",tiles:[N],minzoom:v.minzoom??0,maxzoom:v.maxzoom??19}},layers:Z}:null}function K(v){const N=(v?.service??"").toLowerCase(),H=V(v),W=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:N,url:H,sourceLayer:W,hasSourceLayer:!!W}),N==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(H,{interactive:!0,vectorTileLayerStyles:{default:O(v)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const Z=P(v,H);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 N==="tile"||/^https?:\/\//i.test(H)||H.includes("{z}")?L.tileLayer(H,{opacity:v?.style?.opacity??1}):L.tileLayer(H,{opacity:v?.style?.opacity??1})}function U(){y&&h.value.forEach(v=>{const N=p[v];N&&(N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)?(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y)):N.layer||console.warn("[vs-input-map] overlay layer is null",N.id)):N.layer&&y.hasLayer(N.layer)&&(console.info("[vs-input-map] remove overlay layer from map",N.id),y.removeLayer(N.layer)))})}function re(v){if(l.value)return;const N=p[v];N&&(N.visible=!N.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:v,nextVisible:N.visible,hasLayerInstance:!!N.layer}),N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)&&(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y))):N.layer&&y.hasLayer(N.layer)&&y.removeLayer(N.layer)))}function se(){if(!r.handleZoom)return null;let v;const N=W=>{const Z=W.ctrlKey||W.metaKey,fe=W.shiftKey;if(!Z&&!fe){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},H=W=>{if(W.touches.length===1){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return E.value&&(E.value.addEventListener("wheel",N,{passive:!1}),E.value.addEventListener("touchstart",H,{passive:!0})),y&&y.on("wheel",W=>{const Z=W.originalEvent.ctrlKey||W.originalEvent.metaKey,fe=W.originalEvent.shiftKey;!Z&&!fe&&(W.originalEvent.preventDefault(),W.originalEvent.stopPropagation())}),()=>{E.value&&(E.value.removeEventListener("wheel",N),E.value.removeEventListener("touchstart",H)),y&&y.off("wheel"),clearTimeout(v)}}const ve=i.ref(null),pt=i.ref(6),St=i.ref(0),Ft=i.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),Ke=i.ref(null),ht=F();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,N)=>{window.L&&window.L.Draw&&v(0);const H=fe=>{if(Array.from(document.styleSheets).some(R=>R?.href?.includes(fe)))return;const T=document.createElement("link");T.rel="stylesheet",T.href=fe,document.head.appendChild(T)},W=fe=>new Promise((T,R)=>{const j=Array.from(document.scripts).find(_e=>_e.src===fe);if(j){j.addEventListener("load",()=>T()),j.addEventListener("error",_e=>R(_e));return}const ae=document.createElement("script");ae.src=fe,ae.async=!0,ae.onload=()=>T(),ae.onerror=_e=>R(_e),document.body.appendChild(ae)});H("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),H("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&H("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let Z=W("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>W("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?Z=Z.then(()=>W("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),W("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):Z=Z.then(()=>W("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),Z.then(()=>v(0)).catch(N)})}function mt(){const v=b.toGeoJSON(),N=[];let H=null;const W=fe=>{if(fe)switch(fe.type){case"Point":H=fe;break;case"Polygon":N.push(fe.coordinates);break;case"MultiPolygon":N.push(...fe.coordinates);break;case"GeometryCollection":(fe.geometries||[]).forEach(W);break}};(v?.features||[]).forEach(fe=>W(fe.geometry));const Z=H||(N.length?{type:"MultiPolygon",coordinates:N}:null);o("update:modelValue",Z?vn(Z):null),St.value=b.getLayers().length}function Pt(v=30){const N=b.getLayers();if(!N.length)return;const H=L.featureGroup(N).getBounds();H&&H.isValid()&&y.fitBounds(H,{padding:[v,v]})}function cn(){l.value||C.value?.click()}const qe=i.ref("");i.watch(s,v=>{qe.value&&!Object.entries(v).filter(([N,H])=>H).map(([N])=>N).includes(qe.value)&&(k?.disable&&k.disable(),qe.value="")}),i.watch(()=>r.layers,v=>{const N=Array.isArray(v)?v:[],H=[],W=new Set;N.forEach((Z,fe)=>{if(!Z)return;const T=z(Z,fe);H.push(T),W.add(T),console.info("[vs-input-map] overlay register",{id:T,service:Z?.service,url:Z?.url});const R=p[T];R?p[T]={...R,config:{...Z,id:T}}:p[T]={id:T,config:{...Z,id:T},visible:Z?.overlay!==!1,layer:null}}),Object.keys(p).forEach(Z=>{if(W.has(Z))return;const fe=p[Z];fe?.layer&&y?.hasLayer&&y.hasLayer(fe.layer)&&y.removeLayer(fe.layer),delete p[Z]}),h.value=H,U()},{immediate:!0,deep:!0}),i.watch(l,v=>{v&&k&&(k.disable(),qe.value=""),b&&b.eachLayer(N=>{v?N.dragging?.disable?.():N.dragging?.enable&&(N.dragging.enable(),N.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 N=v.getRadius();return Math.PI*(N*N)/1e6}if(v instanceof L.Polygon||v instanceof L.Rectangle)try{const N=v.getLatLngs(),H=Array.isArray(N[0])?N[0]:N,W=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(H):0;return W?W/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,N){if(x.value="",!r.api?.length)return;const[H,W]=r.api;try{const Z=new URL(H);Z.searchParams.set("lat",String(v)),Z.searchParams.set("lon",String(N));const fe=await fetch(Z.toString());if(!fe.ok)throw new Error("Request failed");const T=await fe.json();W&&T[W]!==void 0?x.value=String(T[W]):x.value=JSON.stringify(T)}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,St.value=0;return}const N=v[v.length-1],H=$t(N),W=dn(N),Z=qt(N);Ke.value={type:H,center:W,areaKm2:Z,layer:N},St.value=v.length,Xn(W.lat,W.lng)}function S(){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(pt.value,14)))}function D(){if(l.value)return;const v=Ke.value?.layer;v&&(b.removeLayer(v),mt(),_())}i.onMounted(async()=>{document.addEventListener("wheel",A,{passive:!1}),await xr(),L.drawLocal=bM;const v=r.handleZoom;y=L.map(E.value,{zoomControl:!1,scrollWheelZoom:!v}).setView(Ft.value,10),setTimeout(()=>{M=se()},100),L.control.zoom({position:"bottomright"}).addTo(y),Cn.value=Object.keys(ht)[0],En=L.tileLayer(ht[Cn.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,W=>{if(l.value)return;const{layer:Z}=W;b.clearLayers(),b.addLayer(Z),mt(),Pt(),qe.value=""}),y.on(L.Draw.Event.EDITED,()=>{l.value||(mt(),_(),Pt())}),y.on(L.Draw.Event.DELETED,()=>{l.value||(mt(),_(),Pt())});let N=!1;y.on("mousemove",W=>{N||(y.invalidateSize(),N=!0),ve.value=W.latlng}),y.on("zoomend",()=>{pt.value=y.getZoom()});const H=kM(r.modelValue);if(H){const W=[];L.geoJSON(H).eachLayer(Z=>W.push(Z)),W.length&&b.addLayer(W[0]),mt(),_(),Pt()}U()}),i.onUnmounted(()=>{document.removeEventListener("wheel",A),M&&M(),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 we(){if(l.value)return;const v=b.toGeoJSON(),N=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),H=URL.createObjectURL(N),W=document.createElement("a");W.href=H,W.download="data.geojson",W.click(),URL.revokeObjectURL(H)}function Be(v){if(l.value)return;const N=v.target,H=N.files?.[0];if(!H)return;const W=new FileReader;W.onload=()=>{if(typeof W.result=="string")try{const Z=JSON.parse(W.result);b.clearLayers(),Z&&L.geoJSON({type:"Feature",geometry:Z}).eachLayer(fe=>{b.addLayer(fe)}),mt(),_(),Pt()}finally{N.value=""}},W.readAsText(H)}function pe(v){y&&(En&&y.removeLayer(En),En=L.tileLayer(ht[v].url,{maxZoom:19,minZoom:6}).addTo(y),Cn.value=v)}function B(v){const N=L.latLng(v[0],v[1]);y.setView(N,13)}i.watch(()=>r.modelValue,v=>{const N=vn(v);if(v&&N!==v){o("update:modelValue",N);return}b.clearLayers(),N&&L.geoJSON({type:"Feature",geometry:N}).eachLayer(H=>{if(b.addLayer(H),l.value){H.dragging?.disable?.();return}H.dragging?.enable?.(),H.dragging?.enabled?.(),H.on("dragend",W=>{const Z=W.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[Z.lng,Z.lat]})})}),St.value=b.getLayers().length,_(),Pt()});function F(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((v,N)=>Object.assign(v,{key:`b${N}`,preview:v.preview||v.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((v,N)=>({...v,[N.key]:N}),{}):{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 N=d.value.getBoundingClientRect();c.value={top:N.bottom+6,left:N.left}}),i.onUnmounted(()=>{a.value=!1,c.value=null}),(v,N)=>(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:E,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",eT,[i.createElementVNode("div",tT,[i.createElementVNode("p",nT,i.toDisplayString(f.value),1)])])):i.createCommentVNode("",!0)]),_:1}),s.value.search||s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",rT,[s.value.search?(i.openBlock(),i.createBlock(GM,{key:0,onGoToCoordinates:B})):i.createCommentVNode("",!0),s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",oT,[i.createElementVNode("div",sT,[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,lT)):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:we,disabled:l.value||St.value===0}," Export ",8,iT)):i.createCommentVNode("",!0)]),i.createElementVNode("input",{ref_key:"importRef",ref:C,type:"file",onChange:Be,accept:".json,.geojson",class:"hidden",disabled:l.value},null,40,aT)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("div",cT,[i.createElementVNode("div",dT,[s.value.point?(i.openBlock(),i.createElementBlock("button",{key:0,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="marker"}]),title:"Point",onClick:N[0]||(N[0]=H=>X("marker")),disabled:l.value},[i.createVNode(CM)],10,uT)):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:N[1]||(N[1]=H=>X("polyline")),disabled:l.value},[i.createVNode(NM)],10,fT)):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:N[2]||(N[2]=H=>X("polygon")),disabled:l.value},[i.createVNode(BM)],10,pT)):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:N[3]||(N[3]=H=>X("rectangle")),disabled:l.value},[i.createVNode(IM)],10,hT)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"vs-btn mt-5",onClick:N[4]||(N[4]=H=>he.value=!he.value),title:"Full Screen"},[i.createVNode(PM,{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",mT,[i.createVNode(QM,{basemaps:i.unref(ht),onOnLayerChange:pe},null,8,["basemaps"]),m.value.length?(i.openBlock(),i.createElementBlock("div",gT,[N[9]||(N[9]=i.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),i.createElementVNode("div",yT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,H=>(i.openBlock(),i.createElementBlock("label",{key:H.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:H.visible,disabled:l.value,onChange:W=>re(H.id)},null,40,bT),i.createElementVNode("span",kT,i.toDisplayString(H.config.title||H.config.name||H.id),1)]))),128))])])):i.createCommentVNode("",!0)])],2),i.createElementVNode("div",xT,[Ke.value?(i.openBlock(),i.createElementBlock("div",wT,[i.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:N[5]||(N[5]=H=>a.value=!0),onMouseleave:N[6]||(N[6]=H=>a.value=!1)},[i.createElementVNode("div",ET,[N[10]||(N[10]=i.createTextVNode(" Type: ",-1)),i.createElementVNode("span",CT,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",vT,[i.createElementVNode("div",_T,[N[11]||(N[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",ST,[N[12]||(N[12]=i.createTextVNode(" Area: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.areaKm2.toFixed(1))+" km²",1)])):(i.openBlock(),i.createElementBlock("div",NT,N[13]||(N[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:N[7]||(N[7]=H=>S()),disabled:l.value},N[14]||(N[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,MT),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:N[8]||(N[8]=H=>D()),disabled:l.value},[i.createVNode(kl,{class:"w-3 h-3"})],8,TT)])])):i.createCommentVNode("",!0)])],2))}}),BT=ge(AT,[["__scopeId","data-v-150e767b"]]),VT=["data-focus"],LT={class:"flex items-center"},OT={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},IT=["onClick","aria-label"],DT={key:0,class:"absolute text-gray-500 truncate pl-2"},RT={class:"flex-1 min-w-[2px]"},FT=["placeholder"],PT={class:"flex items-center shrink-0"},$T=["disabled"],zT=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;vt(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=M=>{const C=M.trim();C!==""&&(!d.value||!Array.isArray(d.value)?d.value=[C]:t.unique?d.value.includes(C)||(d.value=[...d.value,C]):d.value=[...d.value,C],c.value="")},y=()=>{const M=c.value;M.trim()!==""&&g(M),c.value=""},b=M=>{const C=d.value.slice();C.splice(M,1),r("update:modelValue",C)},k=()=>{r("update:modelValue",[])},w=()=>{h.value||(a.value=!0)},x=()=>{a.value=!1,!h.value&&y()},E=M=>{const{key:C}=M;C==="Enter"?(M.preventDefault(),y()):C==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(M,C)=>(i.openBlock(),i.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:C[1]||(C[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,(A,z)=>(i.openBlock(),i.createElementBlock("div",{key:z,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[i.createElementVNode("div",LT,[i.createElementVNode("div",OT,i.toDisplayString(A),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(G=>b(z),["stop"]),"aria-label":`Remove ${A}`},C[2]||(C[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,IT)]))),128)),f.value?(i.openBlock(),i.createElementBlock("div",DT,i.toDisplayString(u.value),1)):i.createCommentVNode("",!0),i.createElementVNode("div",RT,[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":C[0]||(C[0]=A=>c.value=A),onFocus:w,onBlur:x,onKeydown:E,placeholder:d.value&&d.value.length?"":void 0},null,40,FT)),[[i.vModelText,c.value]])])],512),i.createElementVNode("div",PT,[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"])},C[3]||(C[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,$T)):i.createCommentVNode("",!0)])],10,VT)],2)],512))}}),HT={class:"relative flex gap-1 bg-white w-full"},jT=["disabled","placeholder"],UT=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",HT,[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,jT),[[i.vModelText,r.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),WT=ge(UT,[["__scopeId","data-v-b0eba370"]]),KT={class:"relative flex gap-1 bg-white w-full"},qT=["disabled","placeholder"],GT=["disabled"],JT={key:0},YT={key:1},XT=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",KT,[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,qT),[[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",YT,"...")):(i.openBlock(),i.createElementBlock("span",JT,"Gen"))],8,GT)]))}}),ZT=ge(XT,[["__scopeId","data-v-6ee5237d"]]),QT={class:"w-full"},eA={ref:"sortableContainer",class:"flex flex-col gap-1"},tA=["onDragstart","onDrop"],nA={class:"w-1/3"},rA={class:"w-2/3"},oA=["onClick"],sA={key:0,class:"text-[14px] text-gray-700"},lA={class:"mt-2 w-full flex items-center"},iA=["disabled"],aA=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",QT,[i.createElementVNode("div",eA,[(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:w=>u(k),onDragover:y[0]||(y[0]=i.withModifiers(()=>{},["prevent"])),onDrop:w=>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",nA,[i.createVNode(bl,{modelValue:b.key,"onUpdate:modelValue":w=>b.key=w,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("div",rA,[i.createVNode(bl,{modelValue:b.value,"onUpdate:modelValue":w=>b.value=w,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("button",{onClick:w=>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(Nv),{height:"16",width:"16"})],8,oA)],42,tA))),128))],512),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",sA," Дані для відображення відсутні ")),i.createElementVNode("div",lA,[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,iA)])]))}}),cA=ge(aA,[["__scopeId","data-v-a0f7fbfc"]]),dA={class:"flex items-center gap-2 w-full"},uA=["disabled"],fA=["disabled"],pA=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}=vt(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",dA,[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,uA),[[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,fA),[[i.vModelText,s.value]])]))}}),hA={class:"flex items-center gap-2 w-full"},mA=["min","max","step","disabled"],gA=["disabled"],yA=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}=vt(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",hA,[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,mA),[[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,gA),[[i.vModelText,s.value]])]))}}),bA=["type","value","onInput","placeholder","disabled"],kA=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}=vt(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,bA))),256))],2))}}),xA={class:"flex items-center gap-2 w-full"},wA={class:"relative flex-1"},EA=["placeholder","disabled","onKeydown"],CA=["disabled"],vA={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"},_A={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"},SA={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},NA={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},MA={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},TA=["onClick"],AA={key:0,class:"p-4 text-sm text-gray-500"},BA=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}=vt(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(E=>p.value?.[E]).filter(Boolean);x.length&&(k=`${x.join(", ")}, ${b}`)}const w=t.api.replace("{{value}}",encodeURIComponent(k));a.value=!0;try{const x=await(await fetch(w)).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),w={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&p?.value&&(p.value[t.geom]=w),r("update:geom",w)}return(b,k)=>(i.openBlock(),i.createElementBlock("div",xA,[i.createElementVNode("div",wA,[i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":k[0]||(k[0]=w=>l.value=w),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,EA),[[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",_A,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",vA,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,CA),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[d.value?(i.openBlock(),i.createElementBlock("div",SA,[i.createElementVNode("div",NA,[i.createElementVNode("div",MA,[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]=w=>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,(w,x)=>(i.openBlock(),i.createElementBlock("li",{key:x,onClick:E=>y(w),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},i.toDisplayString(w.display_name),9,TA))),128))]),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",AA," No results found "))])])):i.createCommentVNode("",!0)]))]))}}),VA={VsInputText:bl,VsInputRadio:Gp,"vs-input-text":bl,"vs-input-password":tv,"vs-input-textarea":dN,"vs-input-mask":Fv,"vs-input-number":ov,"vs-input-radio":Gp,"vs-input-select":th,"vs-input-switcher":Kp,"vs-input-static":qp,"vs-input-container":jS,"vs-input-date":t_,"vs-input-checkbox":Qv,"vs-input-file":H_,"vs-input-html":qp,"vs-input-email":zv,"vs-input-datatable":yM,"vs-input-map":BT,"vs-input-file-list":bS,"vs-input-tags":zT,"vs-input-slug":WT,"vs-input-codegen":ZT,"vs-input-key-value":cA,"vs-input-range":yA,"vs-input-color":pA,"vs-input-native-select":th,"vs-input-array":kA,"vs-input-address":BA},LA=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){Pe({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))}}),OA={class:"flex flex-col gap-1 w-full"},IA={key:0,class:"text-sm text-gray-500"},rh=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(()=>QC[`${e.layout}`]),o=i.computed(()=>VA?.[`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",OA,[(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",IA,i.toDisplayString(a.item.description),1)):i.createCommentVNode("",!0)]),a.item.behavior?.api&&a.item.behavior?.button?(i.openBlock(),i.createBlock(LA,i.mergeProps({key:0},a.item.behavior,{value:t.value}),null,16,["value"])):i.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),DA={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},RA={class:"vs-compact-form-navigation__rail mt-[6px]"},FA=["onClick"],PA=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 V=t.width;if(V==null)return{};const O=typeof V=="number"?`${V}px`:`${V}`;return{width:O,minWidth:O}});let d=null,u=0,f=0,p=null,h=null,m=null;const g=()=>z(),y=()=>k();i.watch(()=>t.target,async V=>{if(M(),!V){p=null,r.value=[],o.value="";return}p=V,l.value&&(await i.nextTick(),E(V),k())},{immediate:!0}),i.watch(()=>t.scrollContainer,V=>{if(!l.value){h=V??null;return}b(V??null),i.nextTick(()=>k())},{immediate:!0}),i.onMounted(()=>{t.scrollContainer||b(null),k()}),i.onBeforeUnmount(()=>{M(),b(null,!0),p=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),f&&window.cancelAnimationFrame(f))});function b(V,O=!1){if(m&&(m(),m=null),O){h=null;return}if(h=V??null,typeof window>"u")return;const Y=V??window,Q=window;Y.addEventListener("scroll",g,{passive:!0}),Q.addEventListener("resize",y),m=()=>{Y.removeEventListener("scroll",g),Q.removeEventListener("resize",y)}}function k(){if(!l.value||!p)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const V=()=>{w(),u=0};typeof window>"u"?V():u=window.requestAnimationFrame(V)}function w(){if(!l.value||!p)return;const V=Array.from(p.querySelectorAll("h1, h2")),O=new Set,Y=[];V.forEach((Q,P)=>{const K=Q.textContent?.trim()??"";if(!K)return;let U=(Q.getAttribute("id")??"").trim();U||(U=x(K)||`heading-${P+1}`);let re=U,se=1;for(;O.has(re);)re=`${U}-${se+=1}`;Q.id!==re&&Object.assign(Q,{id:re}),O.add(re),Y.push({id:re,text:K,level:Q.tagName.toLowerCase()==="h1"?1:2})}),r.value=Y,Y.length||(o.value=""),A()}function x(V){return V.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function E(V){!V||!l.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>k()),d.observe(V,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function C(V){const O=h;if(!O)return typeof window>"u"?V.offsetTop:V.getBoundingClientRect().top+window.scrollY;const Y=V.getBoundingClientRect(),Q=O.getBoundingClientRect();return Y.top-Q.top+O.scrollTop}function A(){if(!l.value||!r.value.length)return;const V=h,O=(V?V.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Y=(V?V.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=O+Y;let P=null;for(let U=0;U<r.value.length;U+=1){const re=r.value[U],se=document.getElementById(re.id);if(se){const ve=C(se);ve+se.offsetHeight>O&&ve<Q&&(P=re.id)}}!P&&s.value&&(P=s.value),P&&(s.value=P);const K=V?V.scrollHeight-V.clientHeight:document.documentElement.scrollHeight-window.innerHeight;O+5>=K&&(P=r.value[r.value.length-1].id),P&&(o.value=P)}function z(){l.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{A(),f=0}))}function G(V){if(!l.value)return;const O=document.getElementById(V);if(!O)return;const Y=h,Q=Math.max(0,C(O));Y?Y.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return e({refresh:k}),(V,O)=>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",DA,i.toDisplayString(V.title),1),i.createElementVNode("div",RA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,Y=>(i.openBlock(),i.createElementBlock("div",{key:Y.id,class:i.normalizeClass(["vs-compact-form-navigation__item relative",Y.level===2?"vs-compact-form-navigation__item--nested":"",Y.id===o.value?"vs-compact-form-navigation__item--active":""])},[i.createElementVNode("button",{type:"button",onClick:Q=>G(Y.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",Y.level===2?"pl-[15px]":"pl-[18px]",Y.id===o.value?"text-gray-800":"text-gray-500"])},[i.createElementVNode("span",null,i.toDisplayString(Y.text),1)],10,FA)],2))),128))])],6)):i.createCommentVNode("",!0)}}),$A=ge(PA,[["__scopeId","data-v-1584a562"]]),oh={required:"Це поле є обов’язковим",email:"Неправильний email"},zA=n=>n?!1:oh.required,HA=n=>n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?!1:oh.email:!1,jA=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},UA=(n,e)=>!1,WA=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return zA(n);case"email":return HA(n);case"regexp":return jA(n,e);case"custom":return UA();default:return!1}},KA={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function sh(n){const e=n.toLowerCase();return KA[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=sh(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:sh(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 qA(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 eh(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=WA(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 GA={class:"flex w-full h-full min-h-0 gap-6"},JA={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}=qA(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),w=i.computed(()=>k.value?"horizontal":o.layout),x=A=>A?.columns?"horizontal":w.value,E=A=>A?.columns??b.value,M=()=>{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 C(A,z){if(A===z)return!0;if(typeof A!="object"||typeof z!="object"||!A||!z)return!1;const G=Object.keys(A),V=Object.keys(z);return G.length!==V.length?!1:G.every(O=>A[O]===z[O])}return i.provide("form",s),i.provide("values",l),(A,z)=>(i.openBlock(),i.createElementBlock("div",GA,[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(M,["prevent"]),class:i.normalizeClass(["grid grid-cols-12 p-1",w.value==="default"?"gap-6":"gap-4"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(u),(G,V)=>(i.openBlock(),i.createElementBlock("div",{key:G.name,class:i.normalizeClass(x(G)==="horizontal"?"col-span-12":`col-span-${G.col||12}`)},[i.createVNode(rh,{style:i.normalizeStyle(A.style),item:G,layout:x(G),columns:E(G),"model-value":l.value[G.name],"onUpdate:modelValue":O=>{const Y=l.value[G.name];C(Y,O)||(l.value[G.name]=O)},error:i.unref(a)[G.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),x(G)==="settings"&&V+1!==i.unref(u).length?(i.openBlock(),i.createElementBlock("div",JA)):i.createCommentVNode("",!0)],2))),128))],34)],512),i.createVNode($A,{target:f.value,"scroll-container":p.value,enabled:h.value,width:m.value},null,8,["target","scroll-container","enabled","width"])]))}}),YA={class:"relative"},XA={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},ZA={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"},QA={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},eB={class:"font-medium text-gray-800 dark:text-[#ffffff]"},tB={class:"p-4 mim-h-0 h-full overflow-auto"},nB=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){Pe({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(),Pe({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Pe({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Pe({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Pe({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Pe({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){Pe({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){Pe({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){Pe({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",YA,[i.createElementVNode("div",XA,[i.createElementVNode("div",ZA,[i.createElementVNode("div",QA,[i.createElementVNode("h3",eB,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",tB,[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"}," Зберегти ")])])])]))}}),lh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=VC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:nB,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:lh}),n.provide("form",lh),window.v3plugin||(window.v3plugin={})};const rB={class:"relative"},oB={key:0,class:"mt-4"},sB=["src","alt","title"],lB={key:0,class:"text-sm text-red-500"},iB=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({src:"",alt:"",title:""}),l=i.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!0,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл",type:"file",required:!1,placeholder:"Шлях до файлу зображення"},{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:"Заголовок зображення"}]),a=()=>{s.value={src:"",alt:"",title:""},r.value=!1,t.value=!0},c=()=>{t.value=!1,r.value=!1},d=async()=>{if(await o.value.validate()){Pe({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(!s.value.src){Pe({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення"});return}e.editor&&e.editor.chain().focus().setImage({src:s.value.src||s.value.file,alt:s.value.alt||"",title:s.value.title||"",width:s.value.width||"",height:s.value.height||""}).run(),c()},u=async()=>{await d()},f=()=>{c()};return i.watch(()=>s.value.src,()=>{r.value=!1}),(p,h)=>(i.openBlock(),i.createElementBlock("div",rB,[i.createElementVNode("button",{onClick:a,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:"Додати зображення"},[...h[4]||(h[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(Hp,{modelValue:t.value,"onUpdate:modelValue":h[3]||(h[3]=m=>t.value=m),title:"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",{class:"flex justify-end gap-x-2 p-[20px]"},[i.createElementVNode("button",{onClick:f,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:u,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"}," Додати зображення ")])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:s.value,"onUpdate:modelValue":h[0]||(h[0]=m=>s.value=m),schema:l.value,form:o.value,"onUpdate:form":h[1]||(h[1]=m=>o.value=m)},null,8,["modelValue","schema","form"]),s.value.src?(i.openBlock(),i.createElementBlock("div",oB,[h[5]||(h[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:s.value.src,alt:s.value.alt||"Попередній перегляд зображення",title:s.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:h[2]||(h[2]=m=>r.value=!0)},null,40,sB),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",lB," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},8,["modelValue"])]))}}),aB={class:"flex items-center"},cB=["disabled"],dB=["disabled"],uB=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",aB,[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,cB),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,dB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),fB={class:"relative"},pB=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",fB,[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 (>) 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></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"]]),hB={__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)])]))}},mB={__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)])]))}},gB=["title"],yB={class:"vs-editor-html-mode__text"},ih={bold:iE,italic:dE,color:S2,background_color:V2,highlight:L2,bullet_list:Zw,ordered_list:tE,blockquote:Jw,codeblock:oE,underline:uE,strike:fE,link:HE,table:qE,text_align:u2,type_tag:h2,font_family:F2,font_size:H2,superscript:W2,subscript:G2,heading:Q2,clear_formatting:nC,image:iB,history:uB,help:pB,horizontal_rule:hB,fullscreen:mB,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",yB,i.toDisplayString((r.value,"HTML")),1)],10,gB))}},[["__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"]},bB=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 V=document.querySelector("link[data-monaco-editor-css]");if(!V)return!1;try{return V.sheet||V.styleSheet||V.href}catch{return!1}},f=()=>u()?new Promise(V=>setTimeout(V,50)):new Promise((V,O)=>{const Y=document.createElement("link");Y.rel="stylesheet",Y.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",Y.setAttribute("data-monaco-editor-css","true");const Q=()=>{const re=()=>{u()?setTimeout(()=>V(),100):setTimeout(re,50)};re()};Y.addEventListener?(Y.addEventListener("load",Q),Y.addEventListener("error",()=>O(new Error("Failed to load Monaco Editor CSS")))):(Y.onload=Q,Y.onerror=()=>O(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(Y);let P=0;const K=20,U=setInterval(()=>{P++,u()?(clearInterval(U),setTimeout(()=>V(),100)):P>=K&&(clearInterval(U),setTimeout(()=>V(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((O,Y)=>{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=()=>O(),Q.onerror=()=>Y(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((V,O)=>{if(c){const Y=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(Y),a=window.monaco,V(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const Y=setInterval(()=>{window.require&&(clearInterval(Y),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,V(a)},Q=>{c=!1,console.error("Failed to load Monaco Editor:",Q),O(Q)}))},50);setTimeout(()=>{clearInterval(Y),c=!1,O(new Error("Monaco Editor loader not found"))},1e4)}).catch(Y=>{c=!1,O(Y)})}),d)),m=V=>{try{const O=document.createElement("div");O.innerHTML=V;const Y=(P,K=0)=>{const U=" ".repeat(K);let re="";if(P.nodeType===Node.TEXT_NODE){const se=P.textContent.trim();return se&&(re+=U+se+`
|
|
121
|
-
`),re}if(
|
|
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",xe(this.options.HTMLAttributes,n),0]:["a",xe(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",xe(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",xe(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=Ee.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",xe(this.options.HTMLAttributes,t),0]:["ol",xe(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",xe(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",xe(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()}}});Ee.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",xe(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",xe(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",xe(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 Fe extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Fe.valid(r)?new Fe(r):le.near(r)}content(){return q.empty}eq(e){return e instanceof Fe&&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 Fe(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&&Fe.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(Fe.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!ne.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(Fe.valid(a))return a}return null}}}Fe.prototype.visible=!1,Fe.findFrom=Fe.findGapCursorFrom,le.jsonID("gapcursor",Fe);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 Fe.valid(t)?new Fe(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&&Fe.valid(t)?new Fe(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 oe){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Fe.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Fe(d))),!0):!1}}function aw(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Fe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&ne.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Fe(r))),!0)}function cw(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Fe))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=I.empty;for(let l=r.length-1;l>=0;l--)o=I.from(r[l].createAndFill(null,o));let s=n.state.tr.replace(t.pos,t.pos,new q(o,0,0));return s.setSelection(oe.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function dw(n){if(!(n.selection instanceof Fe))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);Ee.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=Ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[nw(this.options)]}});Ee.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=Ee.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(te(n,"allowGapCursor",t)))!=null?e:null}}});Ee.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)}}})]}}),Ee.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=Ee.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=Ee.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=Ee.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",xe(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=Ee.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,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,w=>{w?(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",w)}),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 w=a.value;for(;w&&w!==document.body;)(w.scrollHeight>w.clientHeight||w.scrollWidth>w.clientWidth)&&(w.addEventListener("scroll",g),l.value.push(w)),w=w.parentElement;document.body&&(document.body.addEventListener("scroll",g),l.value.push(document.body))},f=()=>{l.value.forEach(w=>{w.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=w=>{if(!w){s.value=!1;return}c.value?.contains(w.target)||d.value?.contains(w.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=w=>{s.value&&d.value&&!d.value.contains(w.target)&&(s.value=!1)};return e({togglePopover:m}),(w,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(w.$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(w.$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(w.$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"},Pe=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 vt(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}=vt(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}=vt(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}=vt(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}=vt(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(()=>tO);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}=vt(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 w=k[t.group],x=u(w);h.has(x)||h.set(x,[]),h.get(x)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const w=u(k);m.push(w)});const g=new Set,y=k=>{const w=h.get(k)||[];if(!w.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:w}},b=[];return m.forEach(k=>{const w=y(k);w&&b.push(w)}),h.forEach((k,w)=>{if(g.has(w))return;const x=y(w);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}=vt(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 Pe({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 Pe({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(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),h=i.computed(()=>f.value===""?u.value:u.value.filter(w=>w?.uploaded_name?.includes(f.value))),m=w=>{const x=p.value.findIndex(C=>C===w.item.file_path);x!==-1&&(s.value=!0,l.value=x)},g=async()=>{try{const w=await fetch(`${t.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=w?.rows}catch(w){console.error(w)}},y=async w=>{await Promise.all(Array.from(w.target.files).map(async x=>{const C=new FormData;C.append("file",x);try{const M=`${t.prefix}/widget/file/${o.value}`,E=await fetch(M,{method:"POST",body:C});return E.ok?(a("update","file-list"),x):(Pe({type:E.status>=400&&E.status<500?"warning":"error",title:"Error",message:`Error code: ${E.status}`}),null)}catch(M){return Pe({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await g()},b=w=>{const x={...w};return w.cancel||(x.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(x.confirm=async()=>{await w.confirm(),c.value=!1,g()}),x},k=w=>{d.value=b(w),c.value=!0};return i.watch(o,w=>{w&&g()}),i.onMounted(()=>{o.value&&g()}),(w,x)=>{const C=i.resolveComponent("Lightbox"),M=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]=E=>y(E))},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]=E=>f.value=E),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,(E,B)=>(i.openBlock(),i.createBlock(G_,{key:B,prefix:w.prefix,item:E,index:B,onUpdate:x[2]||(x[2]=z=>w.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=z=>k(z)),onOpenLightbox:x[4]||(x[4]=z=>m(z))},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]=E=>s.value=E),startIndex:l.value,"onUpdate:index":x[6]||(x[6]=E=>l.value=E),images:p.value},null,8,["modelValue","startIndex","images"]),i.createVNode(M,i.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=E=>c.value=E),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},Ot={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 Ot.Equal:return wS(n,e?.[2]);case Ot.Inequal:return ES(n,e?.[2]);case Ot.Higer:return CS(n,e?.[2]);case Ot.HigerOrEqual:return vS(n,e?.[2]);case Ot.Lower:return _S(n,e?.[2]);case Ot.LowerOrEqual:return SS(n,e?.[2]);case Ot.Between:return NS(n,e?.[2]);case Ot.StartWith:return MS(n,e?.[2]);case Ot.EndWith:return TS(n,e?.[2]);case Ot.Contain:return AS(n,e?.[2]);case Ot.In:return BS(n,e?.[2]);case Ot.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);vt(t.style);const l=i.computed({get:()=>t.modelValue,set:T=>r("update:modelValue",T)});!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),w=i.ref("bottom"),x=i.ref({}),C=i.ref([]),M=i.computed(()=>{if(!C.value.length)return[];const T=m.value,R=new Map(T.map(j=>[j.id?.toString(),j]));return C.value.map(j=>R.get(j?.toString())).filter(j=>!!j)}),E=i.computed(()=>t.placeholder||"Select..."),B=i.computed(()=>U(h.value));i.computed(()=>o.value?!C.value.length&&b.value==="":!B.value&&b.value==="");const z=i.computed(()=>s.value?!1:o.value?C.value.length>0:!!l.value),J=T=>o.value?C.value.some(R=>R?.toString()===T?.toString()):l.value?.toString()===T?.toString(),V=i.computed(()=>{let T=m.value??[];if(!t.data&&b.value.trim()!==""){const R=b.value.toLowerCase();T=T.filter(j=>{const ae=U(j).toLowerCase(),_e=j.text?.toLowerCase?.()||"";return ae.includes(R)||_e.includes(R)})}if(o.value&&C.value.length){const R=new Set(C.value.map(j=>j?.toString()));T=T.filter(j=>!R.has(j.id?.toString()))}return T}),O=i.inject("values"),Y=/\{\{\s*([^}]+?)\s*\}\}/g,ee=T=>(T?String(T):"").replace(/<[^>]*>/g,"").trim(),H=i.computed(()=>t.slot??t?.optionTemplate??""),K=T=>{if(!T)return"";const R=H.value;return R?R.replace(Y,(j,ae)=>{const _e=ae.trim(),Ze=T[_e];return Ze!=null?String(Ze):""}):T.text??""},U=T=>{if(!T)return"";if(!H.value)return T.text??"";const R=K(T);return ee(R)||T.text||""},re=T=>{t.set&&O?.value&&Object.entries(t.set).forEach(([R,j])=>{if(!R)return;const ae=T?T[j]:null;O.value[R]=ae??null})},se=i.computed(()=>t.parent?O?.value?.[t.parent]?.toString()??null:null),ve=async T=>{if(!t.data){let R=t.options??[];if(T?.trim()){const j=T.toLowerCase();R=R.filter(ae=>{const _e=U(ae).toLowerCase(),Ze=ae.text?.toLowerCase?.()||"";return _e.includes(j)||Ze.includes(j)})}return R}try{const R=t.host??"",j=t.prefix??"api",ae=t.api??`/${j}/suggest/${t.data}`,_e=`${R}${ae}`,Ze=new URLSearchParams;return Ze.set("json","1"),T&&Ze.set("key",T),se.value!==void 0&&se.value!==null&&se.value!==""&&Ze.set("parent",se.value),(await fetch(`${_e}?${Ze.toString()}`).then(Nt=>Nt.json()))?.data??[]}catch{return[]}},pt=async()=>{t.data?m.value=await ve(b.value):m.value=t.options?[...t.options]:[]},St=async T=>{if(T==null)return null;const R=m.value?.find(j=>j?.id?.toString()===String(T));if(R)return R;if(t.data)try{const j=t.host??"",ae=t.prefix??"api",_e=t.api??`/${ae}/suggest/${t.data}`,Ze=`${j}${_e}`,Nt=new URLSearchParams;return Nt.set("json","1"),Nt.set("val",String(T)),se.value!==void 0&&se.value!==null&&se.value!==""&&Nt.set("parent",se.value),((await fetch(`${Ze}?${Nt.toString()}`).then(Wr=>Wr.json()))?.data??[])?.[0]??null}catch{return null}return null},Ft=async T=>{const R=new Set(m.value.map(ae=>ae.id?.toString())),j=T.filter(ae=>!R.has(ae?.toString()));j.length&&await j.reduce(async(ae,_e)=>{await ae;const Ze=await St(_e);Ze&&m.value.push(Ze)},Promise.resolve())},Ke=async()=>{s.value||(f.value=!0,await pt(),await i.nextTick(()=>{$t(),k.value?.focus(),V.value.length?g.value=0:g.value=-1}))},ht=()=>{f.value=!1,g.value=-1},En=async T=>{s.value||(f.value?ht():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)),re(null),b.value="",i.nextTick(()=>k.value?.focus())},xr=T=>{o.value&&(C.value=C.value.filter(R=>R?.toString()!==T?.toString()),l.value=[...C.value],r("change",l.value),i.nextTick(()=>k.value?.focus()))},mt=T=>{o.value?(J(T.id)||(C.value=[...C.value,T.id],l.value=[...C.value],r("change",l.value)),b.value="",i.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,V.value.length-1)}),re(null)):(h.value=T,l.value=T.id,r("change",l.value),b.value="",ht(),re(T))},Pt=T=>{J(T.id)||mt(T)},cn=(T,R)=>{if(!T||!R)return;const j=T.offsetTop,ae=j+T.offsetHeight,_e=R.scrollTop,Ze=_e+R.clientHeight;let Nt=R.scrollTop;j<_e?Nt=j-80:ae>Ze&&(Nt=ae-R.clientHeight+4);const Wr=R;Wr.scrollTop=Nt},qe=T=>{let R=T.parentElement;for(;R;){if(R.classList.contains("ui-dialog__content"))return R;const j=window.getComputedStyle(R),ae=j.overflow+j.overflowY+j.overflowX;if(ae.includes("auto")||ae.includes("scroll")||R===document.body||R===document.documentElement)return R;R=R.parentElement}return document.body},$t=()=>{if(!c.value)return;const T=c.value.getBoundingClientRect(),R=window.innerHeight||document.documentElement.clientHeight,j=window.innerWidth||document.documentElement.clientWidth,ae=8,_e=8,Ze=t.maxHeight||300,Nt=R-T.bottom-_e-ae,Wr=T.top-_e-ae,Dl=Nt>=Wr,mc=Math.max(j-ae*2,0);let{width:jo}=T;mc>0&&jo>mc&&(jo=mc);let{left:Uo}=T;Uo+jo+ae>j&&(Uo=j-jo-ae),Uo=Math.max(Uo,ae);const nO=Math.min(Ze,Math.max(Dl?Nt:Wr,50));w.value=Dl?"bottom":"top",x.value={position:"fixed",left:`${Uo}px`,width:`${jo}px`,minWidth:"300px",maxHeight:`${nO}px`,transform:Dl?"none":"translateY(-100%)",top:Dl?`${T.bottom+_e}px`:`${T.top-_e}px`}},qt=async T=>{s.value||!f.value&&(T.key==="ArrowDown"||T.key==="ArrowUp")&&(T.preventDefault(),await Ke())},dn=T=>{if(!f.value)return;const{key:R}=T;if(R==="ArrowDown")T.preventDefault(),g.value+1<V.value.length&&(g.value+=1,cn(y.value[g.value],d.value));else if(R==="ArrowUp")T.preventDefault(),g.value>0&&(g.value-=1,cn(y.value[g.value],d.value));else if(R==="Enter"){T.preventDefault();const j=V.value[g.value];j&&mt(j),k.value?.blur()}else R==="Escape"?(T.preventDefault(),ht()):R==="Backspace"?o.value&&b.value===""&&C.value.length&&(C.value=C.value.slice(0,-1),l.value=[...C.value],r("change",l.value)):R==="Home"?(g.value=0,cn(y.value[0],d.value)):R==="End"?(g.value=V.value.length-1,cn(y.value[g.value],d.value)):R==="Tab"&&ht()},Xn=()=>{s.value||(p.value=!0)},_=()=>{p.value=!1,b.value=""},S=T=>{T.key==="Escape"&&f.value&&ht()},D=T=>{const R=T.target;a.value?.contains(R)||u.value?.contains(R)||ht()},X=T=>{f.value&&d.value&&!d.value.contains(T.target)&&$t()},we=()=>{f.value&&$t()},Be=()=>{f.value&&$t()};i.watch(()=>t.options,T=>{T?.length&&(m.value=[...T],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 Ft(C.value),await i.nextTick());else{if(Array.isArray(l.value)){const T=l.value[0]??null;l.value=T??null}l.value!=null&&(h.value=await St(l.value)),re(h.value??null)}}i.watch(l,()=>{pe()}),i.onMounted(async()=>{addEventListener("keydown",S),addEventListener("scroll",X,!0),addEventListener("resize",we),document.addEventListener("click",D,!0),c.value&&qe(c.value).addEventListener("scroll",Be,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await ve("")),await pe(),fe.value=!1}),i.onUnmounted(()=>{removeEventListener("keydown",S),removeEventListener("scroll",X,!0),removeEventListener("resize",we),document.removeEventListener("click",D,!0),c.value&&qe(c.value).removeEventListener("scroll",Be,!0)});const A=i.ref(!1),F=i.ref({}),he=i.ref([]),v=i.ref(null);async function N(){if(!t.add?.token||v?.value.validate())return;const T=t.add.api??`/api/table/${t.add.token}`,{id:R}=await fetch(T,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F.value)}).then(j=>j.json());if(!t.options?.length&&t.data){const{data:j}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${R}`).then(ae=>ae.json());h.value=j[0],m.value.push(j[0]),l.value=R}A.value=!1,Pe({title:"Success!",message:"Object created."})}async function $(){if(!t.add)return null;const T=await fetch(`/api/template/form/${t.add.form}`).then(R=>R.json());return he.value=T.schema,A.value=!0,null}function W(T,R=200){let j;return(...ae)=>{j&&clearTimeout(j),j=window.setTimeout(()=>T(...ae),R)}}const Z=W(async T=>{m.value=await ve(T)},200);i.watch(b,T=>{t.data&&Z(T.trim())}),i.watch(()=>t.options,T=>{!t.data&&T?.length&&(m.value=[...T],pe())},{immediate:!0}),i.watch(()=>t.parent??t.parentValue,()=>{t.data&&pt()});const fe=i.ref(!0);return i.watch(se,async()=>{if(t.data&&(fe.value||(o.value?(C.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null))),await pt(),t.auto===1&&se.value&&m.value.length>0)){const T=m.value[0];T&&mt(T)}}),(T,R)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(i.unref(Va),{visible:A.value,"onUpdate:visible":R[1]||(R[1]=j=>A.value=j),title:"Додати",buttonText:"Додати",onDone:N,teleport:T.teleport},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:he.value,modelValue:F.value,"onUpdate:modelValue":R[0]||(R[0]=j=>F.value=j),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:R[5]||(R[5]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass])},[R[10]||(R[10]=i.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),R[11]||(R[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(M.value,j=>(i.openBlock(),i.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:j.id},[i.createElementVNode("div",DS,[j?.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:j?.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:U(j)},[H.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,FS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.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(j.id),["stop"])},R[6]||(R[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&&T.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?" ":E.value,"onUpdate:modelValue":R[2]||(R[2]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,zS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)])])):!o.value&&!p.value&&B.value&&b.value===""?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["truncate text-gray-900"]),title:B.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),H.value?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({"pl-5":h.value?.color}),innerHTML:K(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&&T.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:B.value?" ":E.value,"onUpdate:modelValue":R[3]||(R[3]=j=>b.value=j),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,WS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)]))],512),i.createElementVNode("div",KS,[z.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"])},R[7]||(R[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),R[9]||(R[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:R[4]||(R[4]=i.withModifiers(j=>En(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},R[8]||(R[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},[V.value.length?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(V.value,(j,ae)=>(i.openBlock(),i.createElementBlock("div",{key:j.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 ",J(j.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===ae&&!J(j.id)?"bg-blue-100":""]),"aria-disabled":J(j.id)?"true":"false",role:"option",tabindex:"-1",onClick:_e=>Pt(j)},[j?.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:j?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["leading-[19px]",g.value===j.id?"text-white":"",(g.value,"")])},[H.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(j)},null,8,YS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(j.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:$,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"}),R[12]||(R[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}=vt(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 H=o.value.toLowerCase();return t.value.filter(K=>e.colModel?.some(U=>{const re=K[U.key];return re?Array.isArray(re)?re.join(", ").toLowerCase().includes(H):String(re).toLowerCase().includes(H):!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=H=>{l.value=H},p=H=>{a.value=H},h=H=>{if(l.value===null||l.value===H){l.value=null,a.value=null;return}const K=[...t.value],[U]=K.splice(l.value,1);K.splice(H,0,U),t.value=K,l.value=null,a.value=null},m=H=>{const K=H.currentTarget.getBoundingClientRect();u.value={top:K.bottom+window.scrollY,left:K.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=H=>{const K=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],U=H.toLowerCase();return K.some(re=>U.endsWith(re))},b=H=>{const K=H.target.files?.[0];if(!K)return;const U=new FileReader;U.onload=re=>{try{const se=re.target?.result;if(typeof se=="string"){const ve=JSON.parse(se);Array.isArray(ve)&&t.value.push(...ve)}}catch(se){console.error("Error parsing file:",se)}},U.readAsText(K)},k=()=>{const H=JSON.stringify(t.value,null,2),K=new Blob([H],{type:"application/json"}),U=URL.createObjectURL(K),re=document.createElement("a");re.href=U,re.download="data.json",re.click(),URL.revokeObjectURL(U)};i.onMounted(async()=>{const H=e.colModel?.filter(K=>K.data);H?.length&&Promise.all(H.map(async K=>{const U=await(await fetch(`/api/suggest/${K.data}`)).json();r.value[K.key]=U.data}))});const w=i.ref(""),x=i.ref(!1);let C="edit",M=0;const E=i.ref({}),B=i.ref({});async function z(){w.value="Додати",x.value=!0,C="add",E.value={}}function J(H,K){const U=K.key||K.name;return r.value[U]&&H[U]?r.value[U].find(re=>re.id.toString()===H[U].toString())?.text??H[U]:H[U]||"-"}async function V(H,K){w.value="Редагувати",x.value=!0,C="edit",M=K,E.value={...H}}function O(){const H=B.value.validate();if(H){Pe({type:"warning",title:"Помилка валідації",message:Object.entries(H).map(([K,U])=>`${K}: ${U}`).join(`
|
|
105
|
+
`)});return}C==="add"?Array.isArray(t.value)?t.value=[...t.value,E.value]:t.value=[E.value]:t.value=t.value.map((K,U)=>U===M?E.value:K),x.value=!1}function Y(H){t.value=t.value.filter((K,U)=>U!==H)}function ee(){x.value=!1}return(H,K)=>(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":K[0]||(K[0]=U=>o.value=U),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"}),K[4]||(K[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"}),K[5]||(K[5]=i.createTextVNode(" Експортувати ",-1))])])])])],4)):i.createCommentVNode("",!0)])),i.createElementVNode("button",{onClick:z,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),K[6]||(K[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(H.colModel,U=>(i.openBlock(),i.createElementBlock("th",{key:U.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(U.ua||U.label),1))),128)),K[7]||(K[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"}),K[8]||(K[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,(U,re)=>(i.openBlock(),i.createElementBlock("tr",{key:U.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===re,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":a.value===re}]),draggable:"true",onDragstart:se=>f(re),onDragover:i.withModifiers(se=>p(re),["prevent"]),onDrop:se=>h(re)},[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(H.colModel,se=>(i.openBlock(),i.createElementBlock("td",{key:se.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[se.type==="file"?(i.openBlock(),i.createElementBlock("div",JN,[y(J(U,se))?(i.openBlock(),i.createElementBlock("div",YN,[i.createElementVNode("img",{src:J(U,se),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]"})]))])):se.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:J(U,se)},null,8,QN)):se.type==="reference"?(i.openBlock(),i.createElementBlock("div",eM,i.toDisplayString(J(U,se)),1)):(i.openBlock(),i.createElementBlock("div",tM,i.toDisplayString(J(U,se)),1))]))),128)),i.createElementVNode("td",nM,[i.createElementVNode("div",rM,[i.createElementVNode("button",{onClick:se=>V(U,re),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:se=>Y(re),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:w.value,size:"lg",onClose:ee},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:e.colModel,values:E.value,"onUpdate:values":K[1]||(K[1]=U=>E.value=U),form:B.value,"onUpdate:form":K[2]||(K[2]=U=>B.value=U)},null,8,["schema","values","form"]),i.createElementVNode("div",lM,[i.createElementVNode("button",{type:"button",onClick:K[3]||(K[3]=U=>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:O,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 M=C.split(/\s+/).filter(Boolean);if(M.length<2)return null;const E=M.slice(0,2).map(Number);if(!E.every(ee=>Number.isFinite(ee)))return null;let[B,z]=E,J=B,V=z;const O=ee=>Math.abs(ee)<=90,Y=ee=>Math.abs(ee)<=180;if(!O(J)||!Y(V))if(O(V)&&Y(J))J=z,V=B;else return null;return{lat:J,lng:V}}function g(x){return(x?.items||[]).map((C,M)=>({id:String(C?.id??M),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 M=C.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[E,B]=M.coordinates;return!Number.isFinite(B)||!Number.isFinite(E)?[]:[{id:"parcel",title:C.cadnum||C.cad_num||"Земельна ділянка",lat:B,lng:E}]}function b(x){const C=x.replace(/\s+/g,"").split(":");if(C.length!==4)return!1;const M=[10,2,3,4];return C.every((E,B)=>E.length===M[B]&&/^\d+$/.test(E))}function k(x){r("goToCoordinates",[x.lat,x.lng])}async function w(){const x=c.value.trim();if(x){if(a.value==="xy"){const C=m(x);if(!C){Pe({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)){Pe({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}C.searchParams.set("cad_num",x)}const M=await fetch(C.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const E=await M.json(),B=a.value==="here"?g(E):y(E);if(!B.length)Pe({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const z=B[0];k(z),c.value=""}}catch(C){const M=C?.message||"Помилка пошуку";Pe({type:"error",title:"Пошук",message:M})}}}return(x,C)=>(i.openBlock(),i.createElementBlock("div",AM,[i.createElementVNode("form",{class:"flex gap-2",onSubmit:i.withModifiers(w,["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]=M=>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,M=>(i.openBlock(),i.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:E=>f(M)},i.toDisplayString(h(M)),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]=M=>c.value=M),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 N=new Set(r.tools.map($=>$.toLowerCase()));return{search:N.has("search"),import:N.has("import"),export:N.has("export"),point:N.has("point"),line:N.has("line"),polygon:N.has("polygon"),rectangle:N.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 w(){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 M=null;const E=i.ref(null),B=v=>{v.ctrlKey&&v.preventDefault()};function z(v,N){return v?.id?String(v.id):v?.url?`${v.url}-${N}`:`layer-${N}`}function J(v){if(!v)return"";if(/^https?:\/\//i.test(v))return v.replace(/\/+$/,"");const N=v.replace(/^\/+/,"").replace(/\/+$/,"");return N?`/${N}`:""}function V(v){const N=v?.url??"";if(!N||/^https?:\/\//i.test(N))return N;const $=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(N.startsWith("/"))return $?`${$}${N}`:N;const W=J(v?.prefix),Z=J(r.prefix),fe=W||Z,T=N.replace(/^\/+/,""),R=fe?`${fe.replace(/\/$/,"")}/${T}`:`/${T}`;return $?`${$}${R}`:R}function O(v){const N=v?.style??{};return $=>{const W=N.colorAttr,Z=N.colorSet??{},fe=typeof W=="string"?Z?.[$?.[W]]??N.color??"#3388ff":N.color??"#3388ff",T=N.stroke??fe;return{weight:N.width??1,color:T,opacity:N.opacity??1,fill:N.type?N.type!=="polyline":!0,fillColor:fe,fillOpacity:N.opacity??.5}}}function Y(v){const N=v?.colorSet||v?.colors;if(v?.colorAttr&&N){const $=Object.entries(N).flat();return["match",["get",v.colorAttr],...$,v.color??"#94a3b8"]}return v?.color??"#3388ff"}function ee(v,N,$){if(!v)return[];const W=[],Z=Y(v);return v.icon&&W.push({id:`${N}-icon`,type:"symbol",source:N,"source-layer":$,minzoom:v.iconZoom||0,layout:{"icon-image":v.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),v.pointZoom&&W.push({id:`${N}-point`,type:"circle",source:N,"source-layer":$,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"?W.push({id:`${N}-fill`,type:"fill",source:N,"source-layer":$,minzoom:v.pointZoom||0,paint:{"fill-color":Z,"fill-opacity":v.opacity??.5,"fill-outline-color":v.stroke||Z}}):v.type==="line"?W.push({id:`${N}-line`,type:"line",source:N,"source-layer":$,paint:{"line-color":Z,"line-opacity":v.opacity??1,"line-width":v.width??1.5}}):v.icon||W.push({id:`${N}-circle`,type:"circle",source:N,"source-layer":$,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}}),W}function H(v,N){const $=v.id||`source-${Math.random().toString(36).slice(2,8)}`,W=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name||$,Z=ee(v.style||{},$,W||$);return Z.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[$]:{type:"vector",tiles:[N],minzoom:v.minzoom??0,maxzoom:v.maxzoom??19}},layers:Z}:null}function K(v){const N=(v?.service??"").toLowerCase(),$=V(v),W=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:N,url:$,sourceLayer:W,hasSourceLayer:!!W}),N==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf($,{interactive:!0,vectorTileLayerStyles:{default:O(v)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const Z=H(v,$);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 N==="tile"||/^https?:\/\//i.test($)||$.includes("{z}")?L.tileLayer($,{opacity:v?.style?.opacity??1}):L.tileLayer($,{opacity:v?.style?.opacity??1})}function U(){y&&h.value.forEach(v=>{const N=p[v];N&&(N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)?(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y)):N.layer||console.warn("[vs-input-map] overlay layer is null",N.id)):N.layer&&y.hasLayer(N.layer)&&(console.info("[vs-input-map] remove overlay layer from map",N.id),y.removeLayer(N.layer)))})}function re(v){if(l.value)return;const N=p[v];N&&(N.visible=!N.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:v,nextVisible:N.visible,hasLayerInstance:!!N.layer}),N.visible?(N.layer||(N.layer=K(N.config)),N.layer&&!y.hasLayer(N.layer)&&(console.info("[vs-input-map] add overlay layer to map",N.id),N.layer.addTo(y))):N.layer&&y.hasLayer(N.layer)&&y.removeLayer(N.layer)))}function se(){if(!r.handleZoom)return null;let v;const N=W=>{const Z=W.ctrlKey||W.metaKey,fe=W.shiftKey;if(!Z&&!fe){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},$=W=>{if(W.touches.length===1){u.value=!0,f.value=w(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return C.value&&(C.value.addEventListener("wheel",N,{passive:!1}),C.value.addEventListener("touchstart",$,{passive:!0})),y&&y.on("wheel",W=>{const Z=W.originalEvent.ctrlKey||W.originalEvent.metaKey,fe=W.originalEvent.shiftKey;!Z&&!fe&&(W.originalEvent.preventDefault(),W.originalEvent.stopPropagation())}),()=>{C.value&&(C.value.removeEventListener("wheel",N),C.value.removeEventListener("touchstart",$)),y&&y.off("wheel"),clearTimeout(v)}}const ve=i.ref(null),pt=i.ref(6),St=i.ref(0),Ft=i.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),Ke=i.ref(null),ht=F();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,N)=>{window.L&&window.L.Draw&&v(0);const $=fe=>{if(Array.from(document.styleSheets).some(R=>R?.href?.includes(fe)))return;const T=document.createElement("link");T.rel="stylesheet",T.href=fe,document.head.appendChild(T)},W=fe=>new Promise((T,R)=>{const j=Array.from(document.scripts).find(_e=>_e.src===fe);if(j){j.addEventListener("load",()=>T()),j.addEventListener("error",_e=>R(_e));return}const ae=document.createElement("script");ae.src=fe,ae.async=!0,ae.onload=()=>T(),ae.onerror=_e=>R(_e),document.body.appendChild(ae)});$("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),$("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&$("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let Z=W("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>W("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?Z=Z.then(()=>W("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),W("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):Z=Z.then(()=>W("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),Z.then(()=>v(0)).catch(N)})}function mt(){const v=b.toGeoJSON(),N=[];let $=null;const W=fe=>{if(fe)switch(fe.type){case"Point":$=fe;break;case"Polygon":N.push(fe.coordinates);break;case"MultiPolygon":N.push(...fe.coordinates);break;case"GeometryCollection":(fe.geometries||[]).forEach(W);break}};(v?.features||[]).forEach(fe=>W(fe.geometry));const Z=$||(N.length?{type:"MultiPolygon",coordinates:N}:null);o("update:modelValue",Z?vn(Z):null),St.value=b.getLayers().length}function Pt(v=30){const N=b.getLayers();if(!N.length)return;const $=L.featureGroup(N).getBounds();$&&$.isValid()&&y.fitBounds($,{padding:[v,v]})}function cn(){l.value||E.value?.click()}const qe=i.ref("");i.watch(s,v=>{qe.value&&!Object.entries(v).filter(([N,$])=>$).map(([N])=>N).includes(qe.value)&&(k?.disable&&k.disable(),qe.value="")}),i.watch(()=>r.layers,v=>{const N=Array.isArray(v)?v:[],$=[],W=new Set;N.forEach((Z,fe)=>{if(!Z)return;const T=z(Z,fe);$.push(T),W.add(T),console.info("[vs-input-map] overlay register",{id:T,service:Z?.service,url:Z?.url});const R=p[T];R?p[T]={...R,config:{...Z,id:T}}:p[T]={id:T,config:{...Z,id:T},visible:Z?.overlay!==!1,layer:null}}),Object.keys(p).forEach(Z=>{if(W.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()},{immediate:!0,deep:!0}),i.watch(l,v=>{v&&k&&(k.disable(),qe.value=""),b&&b.eachLayer(N=>{v?N.dragging?.disable?.():N.dragging?.enable&&(N.dragging.enable(),N.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 N=v.getRadius();return Math.PI*(N*N)/1e6}if(v instanceof L.Polygon||v instanceof L.Rectangle)try{const N=v.getLatLngs(),$=Array.isArray(N[0])?N[0]:N,W=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea($):0;return W?W/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,N){if(x.value="",!r.api?.length)return;const[$,W]=r.api;try{const Z=new URL($);Z.searchParams.set("lat",String(v)),Z.searchParams.set("lon",String(N));const fe=await fetch(Z.toString());if(!fe.ok)throw new Error("Request failed");const T=await fe.json();W&&T[W]!==void 0?x.value=String(T[W]):x.value=JSON.stringify(T)}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,St.value=0;return}const N=v[v.length-1],$=$t(N),W=dn(N),Z=qt(N);Ke.value={type:$,center:W,areaKm2:Z,layer:N},St.value=v.length,Xn(W.lat,W.lng)}function S(){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(pt.value,14)))}function D(){if(l.value)return;const v=Ke.value?.layer;v&&(b.removeLayer(v),mt(),_())}i.onMounted(async()=>{document.addEventListener("wheel",B,{passive:!1}),await xr(),L.drawLocal=aM;const v=r.handleZoom;y=L.map(C.value,{zoomControl:!1,scrollWheelZoom:!v}).setView(Ft.value,10),setTimeout(()=>{M=se()},100),L.control.zoom({position:"bottomright"}).addTo(y),Cn.value=Object.keys(ht)[0],En=L.tileLayer(ht[Cn.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,W=>{if(l.value)return;const{layer:Z}=W;b.clearLayers(),b.addLayer(Z),mt(),Pt(),qe.value=""}),y.on(L.Draw.Event.EDITED,()=>{l.value||(mt(),_(),Pt())}),y.on(L.Draw.Event.DELETED,()=>{l.value||(mt(),_(),Pt())});let N=!1;y.on("mousemove",W=>{N||(y.invalidateSize(),N=!0),ve.value=W.latlng}),y.on("zoomend",()=>{pt.value=y.getZoom()});const $=cM(r.modelValue);if($){const W=[];L.geoJSON($).eachLayer(Z=>W.push(Z)),W.length&&b.addLayer(W[0]),mt(),_(),Pt()}U()}),i.onUnmounted(()=>{document.removeEventListener("wheel",B),M&&M(),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 we(){if(l.value)return;const v=b.toGeoJSON(),N=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),$=URL.createObjectURL(N),W=document.createElement("a");W.href=$,W.download="data.geojson",W.click(),URL.revokeObjectURL($)}function Be(v){if(l.value)return;const N=v.target,$=N.files?.[0];if(!$)return;const W=new FileReader;W.onload=()=>{if(typeof W.result=="string")try{const Z=JSON.parse(W.result);b.clearLayers(),Z&&L.geoJSON({type:"Feature",geometry:Z}).eachLayer(fe=>{b.addLayer(fe)}),mt(),_(),Pt()}finally{N.value=""}},W.readAsText($)}function pe(v){y&&(En&&y.removeLayer(En),En=L.tileLayer(ht[v].url,{maxZoom:19,minZoom:6}).addTo(y),Cn.value=v)}function A(v){const N=L.latLng(v[0],v[1]);y.setView(N,13)}i.watch(()=>r.modelValue,v=>{const N=vn(v);if(v&&N!==v){o("update:modelValue",N);return}b.clearLayers(),N&&L.geoJSON({type:"Feature",geometry:N}).eachLayer($=>{if(b.addLayer($),l.value){$.dragging?.disable?.();return}$.dragging?.enable?.(),$.dragging?.enabled?.(),$.on("dragend",W=>{const Z=W.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[Z.lng,Z.lat]})})}),St.value=b.getLayers().length,_(),Pt()});function F(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((v,N)=>Object.assign(v,{key:`b${N}`,preview:v.preview||v.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((v,N)=>({...v,[N.key]:N}),{}):{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 N=d.value.getBoundingClientRect();c.value={top:N.bottom+6,left:N.left}}),i.onUnmounted(()=>{a.value=!1,c.value=null}),(v,N)=>(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:A})):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:we,disabled:l.value||St.value===0}," Export ",8,XM)):i.createCommentVNode("",!0)]),i.createElementVNode("input",{ref_key:"importRef",ref:E,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:N[0]||(N[0]=$=>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:N[1]||(N[1]=$=>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:N[2]||(N[2]=$=>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:N[3]||(N[3]=$=>X("rectangle")),disabled:l.value},[i.createVNode(_M)],10,oT)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"vs-btn mt-5",onClick:N[4]||(N[4]=$=>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(ht),onOnLayerChange:pe},null,8,["basemaps"]),m.value.length?(i.openBlock(),i.createElementBlock("div",lT,[N[9]||(N[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,$=>(i.openBlock(),i.createElementBlock("label",{key:$.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:$.visible,disabled:l.value,onChange:W=>re($.id)},null,40,aT),i.createElementVNode("span",cT,i.toDisplayString($.config.title||$.config.name||$.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:N[5]||(N[5]=$=>a.value=!0),onMouseleave:N[6]||(N[6]=$=>a.value=!1)},[i.createElementVNode("div",fT,[N[10]||(N[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,[N[11]||(N[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,[N[12]||(N[12]=i.createTextVNode(" Area: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.areaKm2.toFixed(1))+" km²",1)])):(i.openBlock(),i.createElementBlock("div",yT,N[13]||(N[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:N[7]||(N[7]=$=>S()),disabled:l.value},N[14]||(N[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:N[8]||(N[8]=$=>D()),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;vt(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=M=>{const E=M.trim();E!==""&&(!d.value||!Array.isArray(d.value)?d.value=[E]:t.unique?d.value.includes(E)||(d.value=[...d.value,E]):d.value=[...d.value,E],c.value="")},y=()=>{const M=c.value;M.trim()!==""&&g(M),c.value=""},b=M=>{const E=d.value.slice();E.splice(M,1),r("update:modelValue",E)},k=()=>{r("update:modelValue",[])},w=()=>{h.value||(a.value=!0)},x=()=>{a.value=!1,!h.value&&y()},C=M=>{const{key:E}=M;E==="Enter"?(M.preventDefault(),y()):E==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(M,E)=>(i.openBlock(),i.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:E[1]||(E[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,(B,z)=>(i.openBlock(),i.createElementBlock("div",{key:z,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[i.createElementVNode("div",CT,[i.createElementVNode("div",vT,i.toDisplayString(B),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(J=>b(z),["stop"]),"aria-label":`Remove ${B}`},E[2]||(E[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":E[0]||(E[0]=B=>c.value=B),onFocus:w,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"])},E[3]||(E[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:w=>u(k),onDragover:y[0]||(y[0]=i.withModifiers(()=>{},["prevent"])),onDrop:w=>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":w=>b.key=w,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("div",qT,[i.createVNode(bl,{modelValue:b.value,"onUpdate:modelValue":w=>b.value=w,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("button",{onClick:w=>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}=vt(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}=vt(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}=vt(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}=vt(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 w=t.api.replace("{{value}}",encodeURIComponent(k));a.value=!0;try{const x=await(await fetch(w)).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),w={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&p?.value&&(p.value[t.geom]=w),r("update:geom",w)}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]=w=>l.value=w),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]=w=>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,(w,x)=>(i.openBlock(),i.createElementBlock("li",{key:x,onClick:C=>y(w),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},i.toDisplayString(w.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){Pe({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 V=t.width;if(V==null)return{};const O=typeof V=="number"?`${V}px`:`${V}`;return{width:O,minWidth:O}});let d=null,u=0,f=0,p=null,h=null,m=null;const g=()=>z(),y=()=>k();i.watch(()=>t.target,async V=>{if(M(),!V){p=null,r.value=[],o.value="";return}p=V,l.value&&(await i.nextTick(),C(V),k())},{immediate:!0}),i.watch(()=>t.scrollContainer,V=>{if(!l.value){h=V??null;return}b(V??null),i.nextTick(()=>k())},{immediate:!0}),i.onMounted(()=>{t.scrollContainer||b(null),k()}),i.onBeforeUnmount(()=>{M(),b(null,!0),p=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),f&&window.cancelAnimationFrame(f))});function b(V,O=!1){if(m&&(m(),m=null),O){h=null;return}if(h=V??null,typeof window>"u")return;const Y=V??window,ee=window;Y.addEventListener("scroll",g,{passive:!0}),ee.addEventListener("resize",y),m=()=>{Y.removeEventListener("scroll",g),ee.removeEventListener("resize",y)}}function k(){if(!l.value||!p)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const V=()=>{w(),u=0};typeof window>"u"?V():u=window.requestAnimationFrame(V)}function w(){if(!l.value||!p)return;const V=Array.from(p.querySelectorAll("h1, h2")),O=new Set,Y=[];V.forEach((ee,H)=>{const K=ee.textContent?.trim()??"";if(!K)return;let U=(ee.getAttribute("id")??"").trim();U||(U=x(K)||`heading-${H+1}`);let re=U,se=1;for(;O.has(re);)re=`${U}-${se+=1}`;ee.id!==re&&Object.assign(ee,{id:re}),O.add(re),Y.push({id:re,text:K,level:ee.tagName.toLowerCase()==="h1"?1:2})}),r.value=Y,Y.length||(o.value=""),B()}function x(V){return V.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function C(V){!V||!l.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>k()),d.observe(V,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function E(V){const O=h;if(!O)return typeof window>"u"?V.offsetTop:V.getBoundingClientRect().top+window.scrollY;const Y=V.getBoundingClientRect(),ee=O.getBoundingClientRect();return Y.top-ee.top+O.scrollTop}function B(){if(!l.value||!r.value.length)return;const V=h,O=(V?V.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Y=(V?V.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),ee=O+Y;let H=null;for(let U=0;U<r.value.length;U+=1){const re=r.value[U],se=document.getElementById(re.id);if(se){const ve=E(se);ve+se.offsetHeight>O&&ve<ee&&(H=re.id)}}!H&&s.value&&(H=s.value),H&&(s.value=H);const K=V?V.scrollHeight-V.clientHeight:document.documentElement.scrollHeight-window.innerHeight;O+5>=K&&(H=r.value[r.value.length-1].id),H&&(o.value=H)}function z(){l.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{B(),f=0}))}function J(V){if(!l.value)return;const O=document.getElementById(V);if(!O)return;const Y=h,ee=Math.max(0,E(O));Y?Y.scrollTo({top:ee,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:ee,behavior:"smooth"})}return e({refresh:k}),(V,O)=>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(V.title),1),i.createElementVNode("div",NA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,Y=>(i.openBlock(),i.createElementBlock("div",{key:Y.id,class:i.normalizeClass(["vs-compact-form-navigation__item relative",Y.level===2?"vs-compact-form-navigation__item--nested":"",Y.id===o.value?"vs-compact-form-navigation__item--active":""])},[i.createElementVNode("button",{type:"button",onClick:ee=>J(Y.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",Y.level===2?"pl-[15px]":"pl-[18px]",Y.id===o.value?"text-gray-800":"text-gray-500"])},[i.createElementVNode("span",null,i.toDisplayString(Y.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),w=i.computed(()=>k.value?"horizontal":o.layout),x=B=>B?.columns?"horizontal":w.value,C=B=>B?.columns??b.value,M=()=>{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 E(B,z){if(B===z)return!0;if(typeof B!="object"||typeof z!="object"||!B||!z)return!1;const J=Object.keys(B),V=Object.keys(z);return J.length!==V.length?!1:J.every(O=>B[O]===z[O])}return i.provide("form",s),i.provide("values",l),(B,z)=>(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(M,["prevent"]),class:i.normalizeClass(["grid grid-cols-12 p-1",w.value==="default"?"gap-6":"gap-4"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(u),(J,V)=>(i.openBlock(),i.createElementBlock("div",{key:J.name,class:i.normalizeClass(x(J)==="horizontal"?"col-span-12":`col-span-${J.col||12}`)},[i.createVNode(th,{style:i.normalizeStyle(B.style),item:J,layout:x(J),columns:C(J),"model-value":l.value[J.name],"onUpdate:modelValue":O=>{const Y=l.value[J.name];E(Y,O)||(l.value[J.name]=O)},error:i.unref(a)[J.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),x(J)==="settings"&&V+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){Pe({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(),Pe({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Pe({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Pe({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Pe({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Pe({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){Pe({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){Pe({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){Pe({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={class:"flex justify-end gap-x-2 p-[20px]"},ZA=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({src:"",file:"",alt:"",title:"",width:"",height:""}),a=i.computed(()=>l.value.src||l.value.file||""),c=i.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл",type:"file",required:!1,placeholder:"Шлях до файлу зображення"},{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:"Заголовок зображення"}]),d=()=>{if(!e.editor)return;if(e.editor.isActive("image")){e.editor.chain().focus().selectParentNode().run();const g=e.editor.getAttributes("image");s.value=!0,l.value={src:g.src||"",file:g.src||"",alt:g.alt||"",title:g.title||"",width:g.width||"",height:g.height||""}}else s.value=!1,l.value={src:"",file:"",alt:"",title:"",width:"",height:""};r.value=!1,t.value=!0},u=()=>{t.value=!1,r.value=!1,s.value=!1,l.value={src:"",file:"",alt:"",title:"",width:"",height:""}},f=async()=>{if(await o.value.validate()){Pe({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(!l.value.src&&!l.value.file){Pe({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}if(e.editor){const g=l.value.src||l.value.file;s.value?e.editor.chain().focus().updateAttributes("image",{src:g,alt:l.value.alt||"",title:l.value.title||"",width:l.value.width||"",height:l.value.height||""}).run():e.editor.chain().focus().setImage({src:g,alt:l.value.alt||"",title:l.value.title||"",width:l.value.width||"",height:l.value.height||""}).run()}u()},p=async()=>{await f()},h=()=>{u()};return i.watch(()=>[l.value.src,l.value.file],()=>{r.value=!1}),(m,g)=>(i.openBlock(),i.createElementBlock("div",qA,[i.createElementVNode("button",{onClick:d,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:"Додати зображення"},[...g[4]||(g[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":g[3]||(g[3]=y=>t.value=y),title:s.value?"Редагувати зображення":"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",XA,[i.createElementVNode("button",{onClick:h,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:p,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:l.value,"onUpdate:modelValue":g[0]||(g[0]=y=>l.value=y),schema:c.value,form:o.value,"onUpdate:form":g[1]||(g[1]=y=>o.value=y)},null,8,["modelValue","schema","form"]),a.value?(i.openBlock(),i.createElementBlock("div",GA,[g[5]||(g[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:a.value,alt:l.value.alt||"Попередній перегляд зображення",title:l.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:g[2]||(g[2]=y=>r.value=!0)},null,40,JA),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",YA," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])]))}}),QA={class:"flex items-center"},eB=["disabled"],tB=["disabled"],nB=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",QA,[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,eB),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,tB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),rB={class:"relative"},oB=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",rB,[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 (>) 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></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"]]),sB={__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)])]))}},lB={__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)])]))}},iB=["title"],aB={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:ZA,history:nB,help:oB,horizontal_rule:sB,fullscreen:lB,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",aB,i.toDisplayString((r.value,"HTML")),1)],10,iB))}},[["__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"]},cB=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 V=document.querySelector("link[data-monaco-editor-css]");if(!V)return!1;try{return V.sheet||V.styleSheet||V.href}catch{return!1}},f=()=>u()?new Promise(V=>setTimeout(V,50)):new Promise((V,O)=>{const Y=document.createElement("link");Y.rel="stylesheet",Y.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",Y.setAttribute("data-monaco-editor-css","true");const ee=()=>{const re=()=>{u()?setTimeout(()=>V(),100):setTimeout(re,50)};re()};Y.addEventListener?(Y.addEventListener("load",ee),Y.addEventListener("error",()=>O(new Error("Failed to load Monaco Editor CSS")))):(Y.onload=ee,Y.onerror=()=>O(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(Y);let H=0;const K=20,U=setInterval(()=>{H++,u()?(clearInterval(U),setTimeout(()=>V(),100)):H>=K&&(clearInterval(U),setTimeout(()=>V(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((O,Y)=>{const ee=document.createElement("script");ee.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",ee.setAttribute("data-monaco-editor-loader","true"),ee.onload=()=>O(),ee.onerror=()=>Y(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(ee)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((V,O)=>{if(c){const Y=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(Y),a=window.monaco,V(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const Y=setInterval(()=>{window.require&&(clearInterval(Y),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,V(a)},ee=>{c=!1,console.error("Failed to load Monaco Editor:",ee),O(ee)}))},50);setTimeout(()=>{clearInterval(Y),c=!1,O(new Error("Monaco Editor loader not found"))},1e4)}).catch(Y=>{c=!1,O(Y)})}),d)),m=V=>{try{const O=document.createElement("div");O.innerHTML=V;const Y=(H,K=0)=>{const U=" ".repeat(K);let re="";if(H.nodeType===Node.TEXT_NODE){const se=H.textContent.trim();return se&&(re+=U+se+`
|
|
107
|
+
`),re}if(H.nodeType===Node.ELEMENT_NODE){const se=H.tagName.toLowerCase(),ve=Array.from(H.attributes).map(Ft=>`${Ft.name}="${Ft.value}"`).join(" "),pt=H.children.length>0;H.textContent.trim()&&!pt?re+=U+`<${se}${ve?" "+ve:""}>${H.textContent}</${se}>
|
|
122
108
|
`:pt?(re+=U+`<${se}${ve?" "+ve:""}>
|
|
123
|
-
`,Array.from(
|
|
109
|
+
`,Array.from(H.childNodes).forEach(Ft=>{re+=Y(Ft,K+1)}),re+=U+`</${se}>
|
|
124
110
|
`):re+=U+`<${se}${ve?" "+ve:""} />
|
|
125
|
-
`}return re};let Q="";return Array.from(O.childNodes).forEach(P=>{Q+=Y(P)}),Q.trim()}catch(O){return console.warn("HTML formatting error:",O),V}},g=async()=>{if(!s.value)return;if(!a)try{await h();let O=!1,Y=0;for(;!O&&Y<10;){const Q=document.querySelector("link[data-monaco-editor-css]");if(Q&&(Q.sheet||Q.styleSheet))try{const P=Q.sheet||Q.styleSheet;P&&P.cssRules&&P.cssRules.length>0&&(O=!0)}catch{O=!0}O||(await new Promise(P=>setTimeout(P,50)),Y++)}}catch(O){console.error("Failed to load Monaco Editor:",O);return}const V=r.language;if(l=a.editor.create(s.value,{value:r.modelValue,language:V,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(O){console.warn("HTML language configuration failed:",O)}}l.onDidChangeModelContent(()=>{const O=l.getValue();o("update:modelValue",O),o("change",O)})},y=V=>{l&&V!==l.getValue()&&l.setValue(V)},b=V=>{if(l&&a)if(r.language==="html"){const O=V==="vs-dark"||V==="hc-black";a.editor.defineTheme("html-custom",{base:O?"vs-dark":"vs",inherit:!0,rules:[{token:"tag",foreground:O?"#4FC1FF":"#0066CC",fontStyle:"bold"},{token:"attribute",foreground:O?"#9CDCFE":"#0000FF"},{token:"string",foreground:O?"#FF6B6B":"#CC0000"},{token:"comment",foreground:O?"#6A9955":"#008000",fontStyle:"italic"},{token:"keyword",foreground:O?"#FFA500":"#FF6600",fontStyle:"bold"},{token:"number",foreground:O?"#B5CEA8":"#098658"},{token:"text",foreground:O?"#D4D4D4":"#000000"},{token:"white",foreground:O?"#D4D4D4":"#000000"}],colors:{"editor.background":O?"#1e1e1e":"#ffffff","editor.foreground":O?"#d4d4d4":"#000000"}}),a.editor.setTheme("html-custom")}else a.editor.setTheme(V)},k=V=>{l&&a&&a.editor.setModelLanguage(l.getModel(),V)},w=()=>{l&&l.focus()},x=()=>l?l.getPosition():null,E=V=>{l&&V&&(l.setPosition(V),l.revealPosition(V))},M=()=>{if(l){const V=l.getSelection();return l.getModel().getValueInRange(V)}return""},C=V=>{if(l){const O=l.getSelection();l.executeEdits("replace-selection",[{range:O,text:V,forceMoveMarkers:!0}])}},A=()=>{if(l){const V=l.getValue(),O=m(V);O!==V&&(l.setValue(O),l.setPosition({lineNumber:1,column:1}))}},z=()=>{if(r.language==="html"&&a)try{a.languages.registerCompletionItemProvider("html",{provideCompletionItems:(V,O)=>({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(V){console.warn("HTML completion provider failed:",V)}},G=()=>{l&&l.layout()};return i.onMounted(async()=>{await i.nextTick();try{await h(),await i.nextTick(),await g(),z(),window.addEventListener("resize",G)}catch(V){console.error("Failed to initialize Monaco Editor:",V)}}),i.onUnmounted(()=>{l&&l.dispose(),window.removeEventListener("resize",G)}),i.watch(()=>r.modelValue,y),i.watch(()=>r.theme,b),i.watch(()=>r.language,k),i.watch(()=>r.height,()=>{i.nextTick(()=>{G()})}),e({editor:l,focus:w,getPosition:x,setPosition:E,getSelectedText:M,replaceSelection:C,formatCode:A}),(V,O)=>(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"]]),kB={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},xB={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}=Pp(e),{isHtmlMode:l,htmlContent:a,htmlTextarea:c,toggleHtmlMode:d,onHtmlInput:u}=$p(r,(g,y)=>{g==="update:modelValue"&&(t.value=y)}),{isFullscreen:f,toggleFullscreen:p}=zp(),h=i.computed(()=>typeof e.toolbar=="string"?wl[e.toolbar]||wl.default:e.toolbar),m=i.computed(()=>h.value.map(g=>ih[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",kB,[(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",xB,[i.createVNode(bB,{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))}}),wB={class:"bg-white border-b flex-wrap border-b-gray-200 px-[10px] py-3 border-solid border-transparent"},EB={class:"flex flex-col mx-auto max-w-6xl"},CB={class:"flex justify-center gap-x-2"},ah=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}=Pp(e),{toggleHtmlMode:a}=$p(o,(f,p)=>{f==="update:modelValue"&&(t.value=p)}),{toggleFullscreen:c}=zp(),d=i.computed(()=>typeof r=="string"?wl[r]||wl.default:r),u=i.computed(()=>d.value.map(f=>ih[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",wB,[i.createElementVNode("div",EB,[i.renderSlot(f.$slots,"header"),i.createElementVNode("div",CB,[(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))}});/*!
|
|
111
|
+
`}return re};let ee="";return Array.from(O.childNodes).forEach(H=>{ee+=Y(H)}),ee.trim()}catch(O){return console.warn("HTML formatting error:",O),V}},g=async()=>{if(!s.value)return;if(!a)try{await h();let O=!1,Y=0;for(;!O&&Y<10;){const ee=document.querySelector("link[data-monaco-editor-css]");if(ee&&(ee.sheet||ee.styleSheet))try{const H=ee.sheet||ee.styleSheet;H&&H.cssRules&&H.cssRules.length>0&&(O=!0)}catch{O=!0}O||(await new Promise(H=>setTimeout(H,50)),Y++)}}catch(O){console.error("Failed to load Monaco Editor:",O);return}const V=r.language;if(l=a.editor.create(s.value,{value:r.modelValue,language:V,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(O){console.warn("HTML language configuration failed:",O)}}l.onDidChangeModelContent(()=>{const O=l.getValue();o("update:modelValue",O),o("change",O)})},y=V=>{l&&V!==l.getValue()&&l.setValue(V)},b=V=>{if(l&&a)if(r.language==="html"){const O=V==="vs-dark"||V==="hc-black";a.editor.defineTheme("html-custom",{base:O?"vs-dark":"vs",inherit:!0,rules:[{token:"tag",foreground:O?"#4FC1FF":"#0066CC",fontStyle:"bold"},{token:"attribute",foreground:O?"#9CDCFE":"#0000FF"},{token:"string",foreground:O?"#FF6B6B":"#CC0000"},{token:"comment",foreground:O?"#6A9955":"#008000",fontStyle:"italic"},{token:"keyword",foreground:O?"#FFA500":"#FF6600",fontStyle:"bold"},{token:"number",foreground:O?"#B5CEA8":"#098658"},{token:"text",foreground:O?"#D4D4D4":"#000000"},{token:"white",foreground:O?"#D4D4D4":"#000000"}],colors:{"editor.background":O?"#1e1e1e":"#ffffff","editor.foreground":O?"#d4d4d4":"#000000"}}),a.editor.setTheme("html-custom")}else a.editor.setTheme(V)},k=V=>{l&&a&&a.editor.setModelLanguage(l.getModel(),V)},w=()=>{l&&l.focus()},x=()=>l?l.getPosition():null,C=V=>{l&&V&&(l.setPosition(V),l.revealPosition(V))},M=()=>{if(l){const V=l.getSelection();return l.getModel().getValueInRange(V)}return""},E=V=>{if(l){const O=l.getSelection();l.executeEdits("replace-selection",[{range:O,text:V,forceMoveMarkers:!0}])}},B=()=>{if(l){const V=l.getValue(),O=m(V);O!==V&&(l.setValue(O),l.setPosition({lineNumber:1,column:1}))}},z=()=>{if(r.language==="html"&&a)try{a.languages.registerCompletionItemProvider("html",{provideCompletionItems:(V,O)=>({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(V){console.warn("HTML completion provider failed:",V)}},J=()=>{l&&l.layout()};return i.onMounted(async()=>{await i.nextTick();try{await h(),await i.nextTick(),await g(),z(),window.addEventListener("resize",J)}catch(V){console.error("Failed to initialize Monaco Editor:",V)}}),i.onUnmounted(()=>{l&&l.dispose(),window.removeEventListener("resize",J)}),i.watch(()=>r.modelValue,y),i.watch(()=>r.theme,b),i.watch(()=>r.language,k),i.watch(()=>r.height,()=>{i.nextTick(()=>{J()})}),e({editor:l,focus:w,getPosition:x,setPosition:C,getSelectedText:M,replaceSelection:E,formatCode:B}),(V,O)=>(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"]]),dB={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},uB={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",dB,[(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",uB,[i.createVNode(cB,{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))}}),fB={class:"bg-white border-b flex-wrap border-b-gray-200 px-[10px] py-3 border-solid border-transparent"},pB={class:"flex flex-col mx-auto max-w-6xl"},hB={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",fB,[i.createElementVNode("div",pB,[i.renderSlot(f.$slots,"header"),i.createElementVNode("div",hB,[(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))}});/*!
|
|
126
112
|
* shared v11.1.12
|
|
127
113
|
* (c) 2025 kazuya kawaguchi
|
|
128
114
|
* Released under the MIT License.
|
|
129
|
-
*/function tn(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const
|
|
130
|
-
`)}function
|
|
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 _t,gr;if(process.env.NODE_ENV!=="production"){const n=Wt&&window.performance;n&&n.mark&&n.measure&&n.clearMarks&&n.clearMeasures&&(_t=e=>{n.mark(e)},gr=(e,t,r)=>{n.measure(e,t,r),n.clearMarks(t),n.clearMarks(r)})}const mB=/\{([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(mB,(t,r)=>e.hasOwnProperty(r)?e[r]:"")}const nn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),gB=(n,e,t)=>yB({l:n,k:e,s:t}),yB=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),je=n=>typeof n=="number"&&isFinite(n),bB=n=>Da(n)==="[object Date]",Fr=n=>Da(n)==="[object RegExp]",vl=n=>me(n)&&Object.keys(n).length===0,We=Object.assign,kB=Object.create,Ce=(n=null)=>kB(n);let ah;const yr=()=>ah||(ah=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Ce());function ch(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function dh(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function xB(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,"$1on$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:")}),n}const wB=Object.prototype.hasOwnProperty;function Kt(n,e){return wB.call(n,e)}const Ie=Array.isArray,Ne=n=>typeof n=="function",G=n=>typeof n=="string",be=n=>typeof n=="boolean",ye=n=>n!==null&&typeof n=="object",EB=n=>ye(n)&&Ne(n.then)&&Ne(n.catch),uh=Object.prototype.toString,Da=n=>uh.call(n),me=n=>Da(n)==="[object Object]",CB=n=>n==null?"":Ie(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 vB(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)||Ie(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])?[]:Ce()),_l(o[s])||_l(r[s])?o[s]=r[s]:t.push({src:r[s],des:o[s]}))})}}/*!
|
|
131
117
|
* message-compiler v11.1.12
|
|
132
118
|
* (c) 2025 kazuya kawaguchi
|
|
133
119
|
* Released under the MIT License.
|
|
134
|
-
*/function
|
|
135
|
-
`,zB="\u2028",HB="\u2029";function jB(n){const e=n;let t=0,r=1,o=1,s=0;const l=C=>e[C]===$B&&e[C+1]===at,a=C=>e[C]===at,c=C=>e[C]===HB,d=C=>e[C]===zB,u=C=>l(C)||a(C)||c(C)||d(C),f=()=>t,p=()=>r,h=()=>o,m=()=>s,g=C=>l(C)||c(C)||d(C)?at:e[C],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 w(){return l(t+s)&&s++,s++,e[t+s]}function x(){t=0,r=1,o=1,s=0}function E(C=0){s=C}function M(){const C=t+s;for(;C!==t;)k();s=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:k,peek:w,reset:x,resetPeek:E,skipToPeek:M}}const xn=void 0,UB=".",mh="'",WB="tokenizer";function KB(n,e={}){const t=e.location!==!1,r=jB(n),o=()=>r.index(),s=()=>OB(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,D,...X){const we=d();if(S.column+=D,S.offset+=D,u){const Be=t?Ha(we.startLoc,S):null,pe=Pr(_,Be,{domain:WB,args:X});u(pe)}}function p(_,S,D){_.endLoc=s(),_.currentType=S;const X={type:S};return t&&(X.loc=Ha(_.startLoc,_.endLoc)),D!=null&&(X.value=D),X}const h=_=>p(_,13);function m(_,S){return _.currentChar()===S?(_.next(),S):(f(ie.EXPECTED_TOKEN,s(),0,S),"")}function g(_){let S="";for(;_.currentPeek()===rn||_.currentPeek()===at;)S+=_.currentPeek(),_.peek();return S}function y(_){const S=g(_);return _.skipToPeek(),S}function b(_){if(_===xn)return!1;const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S===95}function k(_){if(_===xn)return!1;const S=_.charCodeAt(0);return S>=48&&S<=57}function w(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function x(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=_.currentPeek()==="-"?_.peek():_.currentPeek(),we=k(X);return _.resetPeek(),we}function E(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=_.currentPeek()===mh;return _.resetPeek(),X}function M(_,S){const{currentType:D}=S;if(D!==7)return!1;g(_);const X=_.currentPeek()===".";return _.resetPeek(),X}function C(_,S){const{currentType:D}=S;if(D!==8)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function A(_,S){const{currentType:D}=S;if(!(D===7||D===11))return!1;g(_);const X=_.currentPeek()===":";return _.resetPeek(),X}function z(_,S){const{currentType:D}=S;if(D!==9)return!1;const X=()=>{const Be=_.currentPeek();return Be==="{"?b(_.peek()):Be==="@"||Be==="|"||Be===":"||Be==="."||Be===rn||!Be?!1:Be===at?(_.peek(),X()):V(_,!1)},we=X();return _.resetPeek(),we}function G(_){g(_);const S=_.currentPeek()==="|";return _.resetPeek(),S}function V(_,S=!0){const D=(we=!1,Be="")=>{const pe=_.currentPeek();return pe==="{"||pe==="@"||!pe?we:pe==="|"?!(Be===rn||Be===at):pe===rn?(_.peek(),D(!0,rn)):pe===at?(_.peek(),D(!0,at)):!0},X=D();return S&&_.resetPeek(),X}function O(_,S){const D=_.currentChar();return D===xn?xn:S(D)?(_.next(),D):null}function Y(_){const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36}function Q(_){return O(_,Y)}function P(_){const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36||S===45}function K(_){return O(_,P)}function U(_){const S=_.charCodeAt(0);return S>=48&&S<=57}function re(_){return O(_,U)}function se(_){const S=_.charCodeAt(0);return S>=48&&S<=57||S>=65&&S<=70||S>=97&&S<=102}function ve(_){return O(_,se)}function pt(_){let S="",D="";for(;S=re(_);)D+=S;return D}function St(_){let S="";for(;;){const D=_.currentChar();if(D==="{"||D==="}"||D==="@"||D==="|"||!D)break;if(D===rn||D===at)if(V(_))S+=D,_.next();else{if(G(_))break;S+=D,_.next()}else S+=D,_.next()}return S}function Ft(_){y(_);let S="",D="";for(;S=K(_);)D+=S;const X=_.currentChar();if(X&&X!=="}"&&X!==xn&&X!==rn&&X!==at&&X!==" "){const we=mt(_);return f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,D+we),D+we}return _.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D}function Ke(_){y(_);let S="";return _.currentChar()==="-"?(_.next(),S+=`-${pt(_)}`):S+=pt(_),_.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),S}function ht(_){return _!==mh&&_!==at}function En(_){y(_),m(_,"'");let S="",D="";for(;S=O(_,ht);)S==="\\"?D+=Cn(_):D+=S;const X=_.currentChar();return X===at||X===xn?(f(ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),X===at&&(_.next(),m(_,"'")),D):(m(_,"'"),D)}function Cn(_){const S=_.currentChar();switch(S){case"\\":case"'":return _.next(),`\\${S}`;case"u":return vn(_,S,4);case"U":return vn(_,S,6);default:return f(ie.UNKNOWN_ESCAPE_SEQUENCE,s(),0,S),""}}function vn(_,S,D){m(_,S);let X="";for(let we=0;we<D;we++){const Be=ve(_);if(!Be){f(ie.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${S}${X}${_.currentChar()}`);break}X+=Be}return`\\${S}${X}`}function xr(_){return _!=="{"&&_!=="}"&&_!==rn&&_!==at}function mt(_){y(_);let S="",D="";for(;S=O(_,xr);)D+=S;return D}function Pt(_){let S="",D="";for(;S=Q(_);)D+=S;return D}function cn(_){const S=D=>{const X=_.currentChar();return X==="{"||X==="@"||X==="|"||X==="("||X===")"||!X||X===rn?D:(D+=X,_.next(),S(D))};return S("")}function qe(_){y(_);const S=m(_,"|");return y(_),S}function $t(_,S){let D=null;switch(_.currentChar()){case"{":return S.braceNest>=1&&f(ie.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),_.next(),D=p(S,2,"{"),y(_),S.braceNest++,D;case"}":return S.braceNest>0&&S.currentType===2&&f(ie.EMPTY_PLACEHOLDER,s(),0),_.next(),D=p(S,3,"}"),S.braceNest--,S.braceNest>0&&y(_),S.inLinked&&S.braceNest===0&&(S.inLinked=!1),D;case"@":return S.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D=qt(_,S)||h(S),S.braceNest=0,D;default:{let we=!0,Be=!0,pe=!0;if(G(_))return S.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,D;if(S.braceNest>0&&(S.currentType===4||S.currentType===5||S.currentType===6))return f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),S.braceNest=0,dn(_,S);if(we=w(_,S))return D=p(S,4,Ft(_)),y(_),D;if(Be=x(_,S))return D=p(S,5,Ke(_)),y(_),D;if(pe=E(_,S))return D=p(S,6,En(_)),y(_),D;if(!we&&!Be&&!pe)return D=p(S,12,mt(_)),f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,D.value),y(_),D;break}}return D}function qt(_,S){const{currentType:D}=S;let X=null;const we=_.currentChar();switch((D===7||D===8||D===11||D===9)&&(we===at||we===rn)&&f(ie.INVALID_LINKED_FORMAT,s(),0),we){case"@":return _.next(),X=p(S,7,"@"),S.inLinked=!0,X;case".":return y(_),_.next(),p(S,8,".");case":":return y(_),_.next(),p(S,9,":");default:return G(_)?(X=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,X):M(_,S)||A(_,S)?(y(_),qt(_,S)):C(_,S)?(y(_),p(S,11,Pt(_))):z(_,S)?(y(_),we==="{"?$t(_,S)||X:p(S,10,cn(_))):(D===7&&f(ie.INVALID_LINKED_FORMAT,s(),0),S.braceNest=0,S.inLinked=!1,dn(_,S))}}function dn(_,S){let D={type:13};if(S.braceNest>0)return $t(_,S)||h(S);if(S.inLinked)return qt(_,S)||h(S);switch(_.currentChar()){case"{":return $t(_,S)||h(S);case"}":return f(ie.UNBALANCED_CLOSING_BRACE,s(),0),_.next(),p(S,3,"}");case"@":return qt(_,S)||h(S);default:{if(G(_))return D=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,D;if(V(_))return p(S,0,St(_));break}}return D}function Xn(){const{currentType:_,offset:S,startLoc:D,endLoc:X}=c;return c.lastType=_,c.lastOffset=S,c.lastStartLoc=D,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 qB="parser",GB=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function JB(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 YB(n={}){const e=n.location!==!1,{onError:t}=n;function r(b,k,w,x,...E){const M=b.currentPosition();if(M.offset+=x,M.column+=x,t){const C=e?Ha(w,M):null,A=Pr(k,C,{domain:qB,args:E});t(A)}}function o(b,k,w){const x={type:b};return e&&(x.start=k,x.end=k,x.loc={start:w,end:w}),x}function s(b,k,w,x){e&&(b.end=k,b.loc&&(b.loc.end=w))}function l(b,k){const w=b.context(),x=o(3,w.offset,w.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function a(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(5,x,E);return M.index=parseInt(k,10),b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function c(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(4,x,E);return M.key=k,b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function d(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(9,x,E);return M.value=k.replace(GB,JB),b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function u(b){const k=b.nextToken(),w=b.context(),{lastOffset:x,lastStartLoc:E}=w,M=o(8,x,E);return k.type!==11?(r(b,ie.UNEXPECTED_EMPTY_LINKED_MODIFIER,w.lastStartLoc,0),M.value="",s(M,x,E),{nextConsumeToken:k,node:M}):(k.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,on(k)),M.value=k.value||"",s(M,b.currentOffset(),b.currentPosition()),{node:M})}function f(b,k){const w=b.context(),x=o(7,w.offset,w.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function p(b){const k=b.context(),w=o(6,k.offset,k.startLoc);let x=b.nextToken();if(x.type===8){const E=u(b);w.modifier=E.node,x=E.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)),w.key=f(b,x.value||"");break;case 4:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=c(b,x.value||"");break;case 5:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=a(b,x.value||"");break;case 6:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=d(b,x.value||"");break;default:{r(b,ie.UNEXPECTED_EMPTY_LINKED_KEY,k.lastStartLoc,0);const E=b.context(),M=o(7,E.offset,E.startLoc);return M.value="",s(M,E.offset,E.startLoc),w.key=M,s(w,E.offset,E.startLoc),{nextConsumeToken:x,node:w}}}return s(w,b.currentOffset(),b.currentPosition()),{node:w}}function h(b){const k=b.context(),w=k.currentType===1?b.currentOffset():k.offset,x=k.currentType===1?k.endLoc:k.startLoc,E=o(2,w,x);E.items=[];let M=null;do{const z=M||b.nextToken();switch(M=null,z.type){case 0:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(l(b,z.value||""));break;case 5:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(a(b,z.value||""));break;case 4:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(c(b,z.value||""));break;case 6:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),E.items.push(d(b,z.value||""));break;case 7:{const G=p(b);E.items.push(G.node),M=G.nextConsumeToken||null;break}}}while(k.currentType!==13&&k.currentType!==1);const C=k.currentType===1?k.lastOffset:b.currentOffset(),A=k.currentType===1?k.lastEndLoc:b.currentPosition();return s(E,C,A),E}function m(b,k,w,x){const E=b.context();let M=x.items.length===0;const C=o(1,k,w);C.cases=[],C.cases.push(x);do{const A=h(b);M||(M=A.items.length===0),C.cases.push(A)}while(E.currentType!==13);return M&&r(b,ie.MUST_HAVE_MESSAGES_IN_PLURAL,w,0),s(C,b.currentOffset(),b.currentPosition()),C}function g(b){const k=b.context(),{offset:w,startLoc:x}=k,E=h(b);return k.currentType===13?E:m(b,w,x,E)}function y(b){const k=KB(b,We({},n)),w=k.context(),x=o(0,w.offset,w.startLoc);return e&&x.loc&&(x.loc.source=b),x.body=g(k),n.onCacheKey&&(x.cacheKey=n.onCacheKey(b)),w.currentType!==13&&r(k,ie.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,b[w.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 XB(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:s=>(t.helpers.add(s),s)}}function gh(n,e){for(let t=0;t<n.length;t++)ja(n[t],e)}function ja(n,e){switch(n.type){case 1:gh(n.cases,e),e.helper("plural");break;case 2:gh(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 ZB(n,e={}){const t=XB(n);t.helper("normalize"),n.body&&ja(n.body,t);const r=t.context();n.helpers=Array.from(r.helpers)}function QB(n){const e=n.body;return e.type===2?yh(e):e.cases.forEach(t=>yh(t)),n}function yh(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 eV="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:eV,args:[n.type]})}delete n.type}const tV="parser";function nV(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 rV(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 oV(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 sV(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 lV(n,e){e.body?zr(n,e.body):n.push("null")}function zr(n,e){const{helper:t}=n;switch(e.type){case 0:lV(n,e);break;case 1:sV(n,e);break;case 2:oV(n,e);break;case 6:rV(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:tV,args:[e.type]})}}const iV=(n,e={})=>{const t=J(e.mode)?e.mode:"normal",r=J(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=
|
|
120
|
+
*/function _B(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},SB=17,NB={[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||NB)[n]||"",...s||[]):n,a=new SyntaxError(String(l));return a.code=n,e&&(a.location=e),a.domain=r,a}function MB(n){throw n}const TB=/<\/?[\w\s="/.':;#-\/]+>/,AB=n=>TB.test(n),rn=" ",BB="\r",at=`
|
|
121
|
+
`,VB="\u2028",LB="\u2029";function OB(n){const e=n;let t=0,r=1,o=1,s=0;const l=E=>e[E]===BB&&e[E+1]===at,a=E=>e[E]===at,c=E=>e[E]===LB,d=E=>e[E]===VB,u=E=>l(E)||a(E)||c(E)||d(E),f=()=>t,p=()=>r,h=()=>o,m=()=>s,g=E=>l(E)||c(E)||d(E)?at:e[E],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 w(){return l(t+s)&&s++,s++,e[t+s]}function x(){t=0,r=1,o=1,s=0}function C(E=0){s=E}function M(){const E=t+s;for(;E!==t;)k();s=0}return{index:f,line:p,column:h,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:k,peek:w,reset:x,resetPeek:C,skipToPeek:M}}const xn=void 0,IB=".",ph="'",DB="tokenizer";function RB(n,e={}){const t=e.location!==!1,r=OB(n),o=()=>r.index(),s=()=>_B(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,D,...X){const we=d();if(S.column+=D,S.offset+=D,u){const Be=t?Pa(we.startLoc,S):null,pe=Pr(_,Be,{domain:DB,args:X});u(pe)}}function p(_,S,D){_.endLoc=s(),_.currentType=S;const X={type:S};return t&&(X.loc=Pa(_.startLoc,_.endLoc)),D!=null&&(X.value=D),X}const h=_=>p(_,13);function m(_,S){return _.currentChar()===S?(_.next(),S):(f(ie.EXPECTED_TOKEN,s(),0,S),"")}function g(_){let S="";for(;_.currentPeek()===rn||_.currentPeek()===at;)S+=_.currentPeek(),_.peek();return S}function y(_){const S=g(_);return _.skipToPeek(),S}function b(_){if(_===xn)return!1;const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S===95}function k(_){if(_===xn)return!1;const S=_.charCodeAt(0);return S>=48&&S<=57}function w(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function x(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=_.currentPeek()==="-"?_.peek():_.currentPeek(),we=k(X);return _.resetPeek(),we}function C(_,S){const{currentType:D}=S;if(D!==2)return!1;g(_);const X=_.currentPeek()===ph;return _.resetPeek(),X}function M(_,S){const{currentType:D}=S;if(D!==7)return!1;g(_);const X=_.currentPeek()===".";return _.resetPeek(),X}function E(_,S){const{currentType:D}=S;if(D!==8)return!1;g(_);const X=b(_.currentPeek());return _.resetPeek(),X}function B(_,S){const{currentType:D}=S;if(!(D===7||D===11))return!1;g(_);const X=_.currentPeek()===":";return _.resetPeek(),X}function z(_,S){const{currentType:D}=S;if(D!==9)return!1;const X=()=>{const Be=_.currentPeek();return Be==="{"?b(_.peek()):Be==="@"||Be==="|"||Be===":"||Be==="."||Be===rn||!Be?!1:Be===at?(_.peek(),X()):V(_,!1)},we=X();return _.resetPeek(),we}function J(_){g(_);const S=_.currentPeek()==="|";return _.resetPeek(),S}function V(_,S=!0){const D=(we=!1,Be="")=>{const pe=_.currentPeek();return pe==="{"||pe==="@"||!pe?we:pe==="|"?!(Be===rn||Be===at):pe===rn?(_.peek(),D(!0,rn)):pe===at?(_.peek(),D(!0,at)):!0},X=D();return S&&_.resetPeek(),X}function O(_,S){const D=_.currentChar();return D===xn?xn:S(D)?(_.next(),D):null}function Y(_){const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36}function ee(_){return O(_,Y)}function H(_){const S=_.charCodeAt(0);return S>=97&&S<=122||S>=65&&S<=90||S>=48&&S<=57||S===95||S===36||S===45}function K(_){return O(_,H)}function U(_){const S=_.charCodeAt(0);return S>=48&&S<=57}function re(_){return O(_,U)}function se(_){const S=_.charCodeAt(0);return S>=48&&S<=57||S>=65&&S<=70||S>=97&&S<=102}function ve(_){return O(_,se)}function pt(_){let S="",D="";for(;S=re(_);)D+=S;return D}function St(_){let S="";for(;;){const D=_.currentChar();if(D==="{"||D==="}"||D==="@"||D==="|"||!D)break;if(D===rn||D===at)if(V(_))S+=D,_.next();else{if(J(_))break;S+=D,_.next()}else S+=D,_.next()}return S}function Ft(_){y(_);let S="",D="";for(;S=K(_);)D+=S;const X=_.currentChar();if(X&&X!=="}"&&X!==xn&&X!==rn&&X!==at&&X!==" "){const we=mt(_);return f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,D+we),D+we}return _.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D}function Ke(_){y(_);let S="";return _.currentChar()==="-"?(_.next(),S+=`-${pt(_)}`):S+=pt(_),_.currentChar()===xn&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),S}function ht(_){return _!==ph&&_!==at}function En(_){y(_),m(_,"'");let S="",D="";for(;S=O(_,ht);)S==="\\"?D+=Cn(_):D+=S;const X=_.currentChar();return X===at||X===xn?(f(ie.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),X===at&&(_.next(),m(_,"'")),D):(m(_,"'"),D)}function Cn(_){const S=_.currentChar();switch(S){case"\\":case"'":return _.next(),`\\${S}`;case"u":return vn(_,S,4);case"U":return vn(_,S,6);default:return f(ie.UNKNOWN_ESCAPE_SEQUENCE,s(),0,S),""}}function vn(_,S,D){m(_,S);let X="";for(let we=0;we<D;we++){const Be=ve(_);if(!Be){f(ie.INVALID_UNICODE_ESCAPE_SEQUENCE,s(),0,`\\${S}${X}${_.currentChar()}`);break}X+=Be}return`\\${S}${X}`}function xr(_){return _!=="{"&&_!=="}"&&_!==rn&&_!==at}function mt(_){y(_);let S="",D="";for(;S=O(_,xr);)D+=S;return D}function Pt(_){let S="",D="";for(;S=ee(_);)D+=S;return D}function cn(_){const S=D=>{const X=_.currentChar();return X==="{"||X==="@"||X==="|"||X==="("||X===")"||!X||X===rn?D:(D+=X,_.next(),S(D))};return S("")}function qe(_){y(_);const S=m(_,"|");return y(_),S}function $t(_,S){let D=null;switch(_.currentChar()){case"{":return S.braceNest>=1&&f(ie.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),_.next(),D=p(S,2,"{"),y(_),S.braceNest++,D;case"}":return S.braceNest>0&&S.currentType===2&&f(ie.EMPTY_PLACEHOLDER,s(),0),_.next(),D=p(S,3,"}"),S.braceNest--,S.braceNest>0&&y(_),S.inLinked&&S.braceNest===0&&(S.inLinked=!1),D;case"@":return S.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D=qt(_,S)||h(S),S.braceNest=0,D;default:{let we=!0,Be=!0,pe=!0;if(J(_))return S.braceNest>0&&f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),D=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,D;if(S.braceNest>0&&(S.currentType===4||S.currentType===5||S.currentType===6))return f(ie.UNTERMINATED_CLOSING_BRACE,s(),0),S.braceNest=0,dn(_,S);if(we=w(_,S))return D=p(S,4,Ft(_)),y(_),D;if(Be=x(_,S))return D=p(S,5,Ke(_)),y(_),D;if(pe=C(_,S))return D=p(S,6,En(_)),y(_),D;if(!we&&!Be&&!pe)return D=p(S,12,mt(_)),f(ie.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,D.value),y(_),D;break}}return D}function qt(_,S){const{currentType:D}=S;let X=null;const we=_.currentChar();switch((D===7||D===8||D===11||D===9)&&(we===at||we===rn)&&f(ie.INVALID_LINKED_FORMAT,s(),0),we){case"@":return _.next(),X=p(S,7,"@"),S.inLinked=!0,X;case".":return y(_),_.next(),p(S,8,".");case":":return y(_),_.next(),p(S,9,":");default:return J(_)?(X=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,X):M(_,S)||B(_,S)?(y(_),qt(_,S)):E(_,S)?(y(_),p(S,11,Pt(_))):z(_,S)?(y(_),we==="{"?$t(_,S)||X:p(S,10,cn(_))):(D===7&&f(ie.INVALID_LINKED_FORMAT,s(),0),S.braceNest=0,S.inLinked=!1,dn(_,S))}}function dn(_,S){let D={type:13};if(S.braceNest>0)return $t(_,S)||h(S);if(S.inLinked)return qt(_,S)||h(S);switch(_.currentChar()){case"{":return $t(_,S)||h(S);case"}":return f(ie.UNBALANCED_CLOSING_BRACE,s(),0),_.next(),p(S,3,"}");case"@":return qt(_,S)||h(S);default:{if(J(_))return D=p(S,1,qe(_)),S.braceNest=0,S.inLinked=!1,D;if(V(_))return p(S,0,St(_));break}}return D}function Xn(){const{currentType:_,offset:S,startLoc:D,endLoc:X}=c;return c.lastType=_,c.lastOffset=S,c.lastStartLoc=D,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 FB="parser",PB=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function $B(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 zB(n={}){const e=n.location!==!1,{onError:t}=n;function r(b,k,w,x,...C){const M=b.currentPosition();if(M.offset+=x,M.column+=x,t){const E=e?Pa(w,M):null,B=Pr(k,E,{domain:FB,args:C});t(B)}}function o(b,k,w){const x={type:b};return e&&(x.start=k,x.end=k,x.loc={start:w,end:w}),x}function s(b,k,w,x){e&&(b.end=k,b.loc&&(b.loc.end=w))}function l(b,k){const w=b.context(),x=o(3,w.offset,w.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function a(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:C}=w,M=o(5,x,C);return M.index=parseInt(k,10),b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function c(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:C}=w,M=o(4,x,C);return M.key=k,b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function d(b,k){const w=b.context(),{lastOffset:x,lastStartLoc:C}=w,M=o(9,x,C);return M.value=k.replace(PB,$B),b.nextToken(),s(M,b.currentOffset(),b.currentPosition()),M}function u(b){const k=b.nextToken(),w=b.context(),{lastOffset:x,lastStartLoc:C}=w,M=o(8,x,C);return k.type!==11?(r(b,ie.UNEXPECTED_EMPTY_LINKED_MODIFIER,w.lastStartLoc,0),M.value="",s(M,x,C),{nextConsumeToken:k,node:M}):(k.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,on(k)),M.value=k.value||"",s(M,b.currentOffset(),b.currentPosition()),{node:M})}function f(b,k){const w=b.context(),x=o(7,w.offset,w.startLoc);return x.value=k,s(x,b.currentOffset(),b.currentPosition()),x}function p(b){const k=b.context(),w=o(6,k.offset,k.startLoc);let x=b.nextToken();if(x.type===8){const C=u(b);w.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)),w.key=f(b,x.value||"");break;case 4:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=c(b,x.value||"");break;case 5:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=a(b,x.value||"");break;case 6:x.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(x)),w.key=d(b,x.value||"");break;default:{r(b,ie.UNEXPECTED_EMPTY_LINKED_KEY,k.lastStartLoc,0);const C=b.context(),M=o(7,C.offset,C.startLoc);return M.value="",s(M,C.offset,C.startLoc),w.key=M,s(w,C.offset,C.startLoc),{nextConsumeToken:x,node:w}}}return s(w,b.currentOffset(),b.currentPosition()),{node:w}}function h(b){const k=b.context(),w=k.currentType===1?b.currentOffset():k.offset,x=k.currentType===1?k.endLoc:k.startLoc,C=o(2,w,x);C.items=[];let M=null;do{const z=M||b.nextToken();switch(M=null,z.type){case 0:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),C.items.push(l(b,z.value||""));break;case 5:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),C.items.push(a(b,z.value||""));break;case 4:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),C.items.push(c(b,z.value||""));break;case 6:z.value==null&&r(b,ie.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,on(z)),C.items.push(d(b,z.value||""));break;case 7:{const J=p(b);C.items.push(J.node),M=J.nextConsumeToken||null;break}}}while(k.currentType!==13&&k.currentType!==1);const E=k.currentType===1?k.lastOffset:b.currentOffset(),B=k.currentType===1?k.lastEndLoc:b.currentPosition();return s(C,E,B),C}function m(b,k,w,x){const C=b.context();let M=x.items.length===0;const E=o(1,k,w);E.cases=[],E.cases.push(x);do{const B=h(b);M||(M=B.items.length===0),E.cases.push(B)}while(C.currentType!==13);return M&&r(b,ie.MUST_HAVE_MESSAGES_IN_PLURAL,w,0),s(E,b.currentOffset(),b.currentPosition()),E}function g(b){const k=b.context(),{offset:w,startLoc:x}=k,C=h(b);return k.currentType===13?C:m(b,w,x,C)}function y(b){const k=RB(b,We({},n)),w=k.context(),x=o(0,w.offset,w.startLoc);return e&&x.loc&&(x.loc.source=b),x.body=g(k),n.onCacheKey&&(x.cacheKey=n.onCacheKey(b)),w.currentType!==13&&r(k,ie.UNEXPECTED_LEXICAL_ANALYSIS,w.lastStartLoc,0,b[w.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 HB(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 jB(n,e={}){const t=HB(n);t.helper("normalize"),n.body&&$a(n.body,t);const r=t.context();n.helpers=Array.from(r.helpers)}function UB(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 WB="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:WB,args:[n.type]})}delete n.type}const KB="parser";function qB(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 GB(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 JB(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 YB(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 XB(n,e){e.body?zr(n,e.body):n.push("null")}function zr(n,e){const{helper:t}=n;switch(e.type){case 0:XB(n,e);break;case 1:YB(n,e);break;case 2:JB(n,e);break;case 6:GB(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:KB,args:[e.type]})}}const ZB=(n,e={})=>{const t=G(e.mode)?e.mode:"normal",r=G(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=qB(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 QB(n,e={}){const t=We({},e),r=!!t.jit,o=!!t.minify,s=t.optimize==null?!0:t.optimize,a=zB(t).parse(n);return r?(s&&UB(a),o&&$r(a),{ast:a,code:""}):(jB(a,t),ZB(a,t))}/*!
|
|
137
123
|
* core-base v11.1.12
|
|
138
124
|
* (c) 2025 kazuya kawaguchi
|
|
139
125
|
* Released under the MIT License.
|
|
140
|
-
*/function cV(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function It(n){return ye(n)&&Ua(n)===0&&(Kt(n,"b")||Kt(n,"body"))}const bh=["b","body"];function dV(n){return qn(n,bh)}const kh=["c","cases"];function uV(n){return qn(n,kh,[])}const xh=["s","static"];function fV(n){return qn(n,xh)}const wh=["i","items"];function pV(n){return qn(n,wh,[])}const Eh=["t","type"];function Ua(n){return qn(n,Eh)}const Ch=["v","value"];function Nl(n,e){const t=qn(n,Ch);if(t!=null)return t;throw Bo(e)}const vh=["m","modifier"];function hV(n){return qn(n,vh)}const _h=["k","key"];function mV(n){const e=qn(n,_h);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 Sh=[...bh,...kh,...xh,...wh,..._h,...vh,...Ch,...Eh];function Bo(n){return new Error(`unhandled node type: ${n}`)}function Wa(n){return t=>gV(t,n)}function gV(n,e){const t=dV(e);if(t==null)throw Bo(0);if(Ua(t)===1){const s=uV(t);return n.plural(s.reduce((l,a)=>[...l,Nh(n,a)],[]))}else return Nh(n,t)}function Nh(n,e){const t=fV(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const r=pV(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=hV(r),s=mV(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 yV="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function bV(n,e){e&&PB(n)&&tn(Cl(yV,{source:n}))}const kV=n=>n;let Ml=Ce();function xV(n,e={}){let t=!1;const r=e.onError||RB;return e.onError=o=>{t=!0,r(o)},{...aV(n,e),detectError:t}}function wV(n,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&J(n)){const t=be(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&bV(n,t);const o=(e.onCacheKey||kV)(n),s=Ml[o];if(s)return s;const{ast:l,detectError:a}=xV(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"&&!It(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 EV(n){Vo=n}function CV(n,e,t){Vo&&Vo.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const vV=_V("function:translate");function _V(n){return e=>Vo&&Vo.emit(n,e)}const ct={INVALID_ARGUMENT:IB,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},SV=24;function wn(n){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:NV}:void 0)}const NV={[ct.INVALID_ARGUMENT]:"Invalid arguments",[ct.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[ct.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[ct.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[ct.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[ct.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[ct.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function qa(n,e){return e.locale!=null?Mh(e.locale):Mh(n.locale)}let Ga;function Mh(n){if(J(n))return n;if(Ne(n)){if(n.resolvedOnce&&Ga!=null)return Ga;if(n.constructor.name==="Function"){const e=n();if(BB(e))throw wn(ct.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ga=e}else throw wn(ct.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw wn(ct.NOT_SUPPORT_LOCALE_TYPE)}function MV(n,e,t){return[...new Set([t,...Ie(e)?e:ye(e)?Object.keys(e):J(e)?[e]:[t]])]}function Th(n,e,t){const r=J(t)?t:Lo,o=n;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let l=[t];for(;Ie(l);)l=Ah(s,l,e);const a=Ie(e)||!me(e)?e:e.default?e.default:null;l=J(a)?[a]:a,Ie(l)&&Ah(s,l,!1),o.__localeChainCache.set(r,s)}return s}function Ah(n,e,t){let r=!0;for(let o=0;o<e.length&&be(r);o++){const s=e[o];J(s)&&(r=TV(n,e[o],t))}return r}function TV(n,e,t){let r;const o=e.split("-");do{const s=o.join("-");r=AV(n,s,t),o.splice(-1,1)}while(o.length&&r===!0);return r}function AV(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),(Ie(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 BV=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function VV(n){return BV.test(n)}function LV(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 OV(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 IV(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:VV(e)?LV(e):"*"+e}function DV(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=IV(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=OV(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 Bh=new Map;function RV(n,e){return ye(n)?n[e]:null}function FV(n,e){if(!ye(n))return null;let t=Bh.get(e);if(t||(t=DV(e),t&&Bh.set(e,t)),!t)return null;const r=t.length;let o=n,s=0;for(;s<r;){const l=t[s];if(Sh.includes(l)&&It(o))return null;const a=o[l];if(a===void 0||Ne(o))return null;o=a,s++}return o}const bt={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},PV=8,$V={[bt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[bt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[bt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[bt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[bt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[bt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[bt.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($V[n],...e)}const zV="11.1.12",Tl=-1,Lo="en-US",Al="",Vh=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function HV(){return{upper:(n,e)=>e==="text"&&J(n)?n.toUpperCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&J(n)?n.toLowerCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&J(n)?Vh(n):e==="vnode"&&ye(n)&&"__v_isVNode"in n?Vh(n.children):n}}let Lh;function jV(n){Lh=n}let Oh;function UV(n){Oh=n}let Ih;function WV(n){Ih=n}let Dh=null;const KV=n=>{Dh=n},qV=()=>Dh;let Rh=null;const Fh=n=>{Rh=n},GV=()=>Rh;let Ph=0;function JV(n={}){const e=Ne(n.onWarn)?n.onWarn:tn,t=J(n.version)?n.version:zV,r=J(n.locale)||Ne(n.locale)?n.locale:Lo,o=Ne(r)?Lo:r,s=Ie(n.fallbackLocale)||me(n.fallbackLocale)||J(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(Ce(),n.modifiers,HV()),u=n.pluralRules||Ce(),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,w=!!n.escapeParameter,x=Ne(n.messageCompiler)?n.messageCompiler:Lh;process.env.NODE_ENV!=="production"&&Ne(n.messageCompiler)&&Fa(br(bt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const E=Ne(n.messageResolver)?n.messageResolver:Oh||RV,M=Ne(n.localeFallbacker)?n.localeFallbacker:Ih||MV,C=ye(n.fallbackContext)?n.fallbackContext:void 0,A=n,z=ye(A.__datetimeFormatters)?A.__datetimeFormatters:new Map,G=ye(A.__numberFormatters)?A.__numberFormatters:new Map,V=ye(A.__meta)?A.__meta:{};Ph++;const O={version:t,cid:Ph,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:w,messageCompiler:x,messageResolver:E,localeFallbacker:M,fallbackContext:C,onWarn:e,__meta:V};return O.datetimeFormats=a,O.numberFormats=c,O.__datetimeFormatters=z,O.__numberFormatters=G,process.env.NODE_ENV!=="production"&&(O.__v_emitter=A.__v_emitter!=null?A.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&CV(O,t,V),O}const Ja=n=>({[n]:Ce()});function Bl(n,e){return n instanceof RegExp?n.test(e):n}function $h(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 J(a)?a:e}else return process.env.NODE_ENV!=="production"&&$h(r,e)&&l(br(bt.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 zh(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function YV(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let r=t+1;r<e.length;r++)if(zh(n,e[r]))return!0;return!1}const Hh=typeof Intl<"u",jh={dateTimeFormat:Hh&&typeof Intl.DateTimeFormat<"u",numberFormat:Hh&&typeof Intl.NumberFormat<"u"};function Uh(n,...e){const{datetimeFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__datetimeFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!jh.dateTimeFormat)return s(br(bt.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(!J(c)||c==="")return new Intl.DateTimeFormat(g,f).format(d);let b={},k,w=null,x=g,E=null;const M="datetime format";for(let z=0;z<y.length;z++){if(k=E=y[z],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(bt.FALLBACK_TO_DATE_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const G=n.__v_emitter;G&&G.emit("fallback",{type:M,key:c,from:x,to:E,groupId:`${M}:${c}`})}if(b=t[k]||{},w=b[c],me(w))break;Ya(n,c,k,p,M),x=E}if(!me(w)||!J(k))return r?Tl:c;let C=`${k}__${c}`;vl(f)||(C=`${C}__${JSON.stringify(f)}`);let A=a.get(C);return A||(A=new Intl.DateTimeFormat(k,We({},w,f)),a.set(C,A)),m?A.formatToParts(d):A.format(d)}const Wh=["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=Ce();let l=Ce(),a;if(J(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw wn(ct.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(ct.INVALID_ISO_DATE_ARGUMENT)}}else if(NB(e)){if(isNaN(e.getTime()))throw wn(ct.INVALID_DATE_ARGUMENT);a=e}else if(je(e))a=e;else throw wn(ct.INVALID_ARGUMENT);return J(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Wh.includes(c)?l[c]=t[c]:s[c]=t[c]}),J(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function Kh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__datetimeFormatters.has(s)&&r.__datetimeFormatters.delete(s)}}function qh(n,...e){const{numberFormats:t,unresolving:r,fallbackLocale:o,onWarn:s,localeFallbacker:l}=n,{__numberFormatters:a}=n;if(process.env.NODE_ENV!=="production"&&!jh.numberFormat)return s(br(bt.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(!J(c)||c==="")return new Intl.NumberFormat(g,f).format(d);let b={},k,w=null,x=g,E=null;const M="number format";for(let z=0;z<y.length;z++){if(k=E=y[z],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(bt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const G=n.__v_emitter;G&&G.emit("fallback",{type:M,key:c,from:x,to:E,groupId:`${M}:${c}`})}if(b=t[k]||{},w=b[c],me(w))break;Ya(n,c,k,p,M),x=E}if(!me(w)||!J(k))return r?Tl:c;let C=`${k}__${c}`;vl(f)||(C=`${C}__${JSON.stringify(f)}`);let A=a.get(C);return A||(A=new Intl.NumberFormat(k,We({},w,f)),a.set(C,A)),m?A.formatToParts(d):A.format(d)}const Gh=["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=Ce();let l=Ce();if(!je(e))throw wn(ct.INVALID_ARGUMENT);const a=e;return J(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Gh.includes(c)?l[c]=t[c]:s[c]=t[c]}),J(r)?s.locale=r:me(r)&&(l=r),me(o)&&(l=o),[s.key||"",a,s,l]}function Jh(n,e,t){const r=n;for(const o in t){const s=`${e}__${o}`;r.__numberFormatters.has(s)&&r.__numberFormatters.delete(s)}}const XV=n=>n,ZV=n=>"",QV="text",eL=n=>n.length===0?"":$a(n),tL=VB;function Yh(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function nL(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 rL(n,e){e.count||(e.count=n),e.n||(e.n=n)}function oL(n={}){const e=n.locale,t=nL(n),r=ye(n.pluralRules)&&J(e)&&Ne(n.pluralRules[e])?n.pluralRules[e]:Yh,o=ye(n.pluralRules)&&J(e)&&Ne(n.pluralRules[e])?Yh:void 0,s=b=>b[r(t,b.length,o)],l=n.list||[],a=b=>l[b],c=n.named||Ce();je(n.pluralIndex)&&rL(t,c);const d=b=>c[b];function u(b,k){const w=Ne(n.messages)?n.messages(b,!!k):ye(n.messages)?n.messages[b]:!1;return w||(n.parent?n.parent.message(b):ZV)}const f=b=>n.modifiers?n.modifiers[b]:XV,p=me(n.processor)&&Ne(n.processor.normalize)?n.processor.normalize:eL,h=me(n.processor)&&Ne(n.processor.interpolate)?n.processor.interpolate:tL,m=me(n.processor)&&J(n.processor.type)?n.processor.type:QV,y={list:a,named:d,plural:s,linked:(b,...k)=>{const[w,x]=k;let E="text",M="";k.length===1?ye(w)?(M=w.modifier||M,E=w.type||E):J(w)&&(M=w||M):k.length===2&&(J(w)&&(M=w||M),J(x)&&(E=x||E));const C=u(b,!0)(y),A=E==="vnode"&&Ie(C)&&M?C[0]:C;return M?f(M)(A,E):A},message:u,type:m,interpolate:h,normalize:p,values:We(Ce(),l,c)};return y}const Xh=()=>"",Dt=n=>Ne(n);function Zh(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=J(d.default)||be(d.default)?be(d.default)?s?c:()=>c:d.default:t?s?c:()=>c:null,g=t||m!=null&&(J(m)||Ne(m)),y=qa(n,d);p&&sL(d);let[b,k,w]=h?[c,y,a[y]||Ce()]:Qh(n,c,y,l,f,u),x=b,E=c;if(!h&&!(J(x)||It(x)||Dt(x))&&g&&(x=m,E=x),!h&&(!(J(x)||It(x)||Dt(x))||!J(k)))return o?Tl:c;if(process.env.NODE_ENV!=="production"&&J(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 M=!1;const C=()=>{M=!0},A=Dt(x)?x:em(n,c,k,x,E,C);if(M)return x;const z=cL(n,k,w,d),G=oL(z),V=lL(n,A,G);let O=r?r(V,c):V;if(p&&J(O)&&(O=TB(O)),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const Y={timestamp:Date.now(),key:J(c)?c:Dt(x)?x.key:"",locale:k||(Dt(x)?x.locale:""),format:J(x)?x:Dt(x)?x.source:"",message:O};Y.meta=We({},n.__meta,qV()||{}),vV(Y)}return O}function sL(n){Ie(n.list)?n.list=n.list.map(e=>J(e)?uh(e):e):ye(n.named)&&Object.keys(n.named).forEach(e=>{J(n.named[e])&&(n.named[e]=uh(n.named[e]))})}function Qh(n,e,t,r,o,s){const{messages:l,onWarn:a,messageResolver:c,localeFallbacker:d}=n,u=d(n,r,t);let f=Ce(),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&&!zh(t,p)&&Bl(o,e)&&a(br(bt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&t!==p){const E=n.__v_emitter;E&&E.emit("fallback",{type:y,key:e,from:m,to:g,groupId:`${y}:${e}`})}f=l[p]||Ce();let k=null,w,x;if(process.env.NODE_ENV!=="production"&&Wt&&(k=window.performance.now(),w="intlify-message-resolve-start",x="intlify-message-resolve-end",_t&&_t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&Wt){const E=window.performance.now(),M=n.__v_emitter;M&&k&&h&&M.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:E-k,groupId:`${y}:${e}`}),w&&x&&_t&&gr&&(_t(x),gr("intlify message resolve",w,x))}if(J(h)||It(h)||Dt(h))break;if(!YV(p,u)){const E=Ya(n,e,p,s,y);E!==e&&(h=E)}m=g}return[h,p,f]}function em(n,e,t,r,o,s){const{messageCompiler:l,warnHtmlMessage:a}=n;if(Dt(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",_t&&_t(d));const f=l(r,iL(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&&_t&&gr&&(_t(u),gr("intlify message compilation",d,u))}return f.locale=t,f.key=e,f.source=r,f}function lL(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",_t&&_t(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&&_t&&gr&&(_t(s),gr("intlify message evaluation",o,s))}return l}function Qa(...n){const[e,t,r]=n,o=Ce();if(!J(e)&&!je(e)&&!Dt(e)&&!It(e))throw wn(ct.INVALID_ARGUMENT);const s=je(e)?String(e):(Dt(e),e);return je(t)?o.plural=t:J(t)?o.default=t:me(t)&&!vl(t)?o.named=t:Ie(t)&&(o.list=t),je(r)?o.plural=r:J(r)?o.default=r:me(r)&&We(o,r),[s,o]}function iL(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=aL(r),c=`Message compilation error: ${l.message}`,d=l.location&&a&&LB(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=>
|
|
126
|
+
*/function eV(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(yr().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(yr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function It(n){return ye(n)&&za(n)===0&&(Kt(n,"b")||Kt(n,"body"))}const gh=["b","body"];function tV(n){return qn(n,gh)}const yh=["c","cases"];function nV(n){return qn(n,yh,[])}const bh=["s","static"];function rV(n){return qn(n,bh)}const kh=["i","items"];function oV(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 sV(n){return qn(n,Eh)}const Ch=["k","key"];function lV(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=>iV(t,n)}function iV(n,e){const t=tV(e);if(t==null)throw Bo(0);if(za(t)===1){const s=nV(t);return n.plural(s.reduce((l,a)=>[...l,_h(n,a)],[]))}else return _h(n,t)}function _h(n,e){const t=rV(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const r=oV(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=sV(r),s=lV(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 aV="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function cV(n,e){e&&AB(n)&&tn(Cl(aV,{source:n}))}const dV=n=>n;let Ml=Ce();function uV(n,e={}){let t=!1;const r=e.onError||MB;return e.onError=o=>{t=!0,r(o)},{...QB(n,e),detectError:t}}function fV(n,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&G(n)){const t=be(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&cV(n,t);const o=(e.onCacheKey||dV)(n),s=Ml[o];if(s)return s;const{ast:l,detectError:a}=uV(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"&&!It(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 pV(n){Vo=n}function hV(n,e,t){Vo&&Vo.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const mV=gV("function:translate");function gV(n){return e=>Vo&&Vo.emit(n,e)}const ct={INVALID_ARGUMENT:SB,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},yV=24;function wn(n){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:bV}:void 0)}const bV={[ct.INVALID_ARGUMENT]:"Invalid arguments",[ct.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[ct.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[ct.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[ct.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[ct.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[ct.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(G(n))return n;if(Ne(n)){if(n.resolvedOnce&&Wa!=null)return Wa;if(n.constructor.name==="Function"){const e=n();if(EB(e))throw wn(ct.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Wa=e}else throw wn(ct.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw wn(ct.NOT_SUPPORT_LOCALE_TYPE)}function kV(n,e,t){return[...new Set([t,...Ie(e)?e:ye(e)?Object.keys(e):G(e)?[e]:[t]])]}function Nh(n,e,t){const r=G(t)?t:Lo,o=n;o.__localeChainCache||(o.__localeChainCache=new Map);let s=o.__localeChainCache.get(r);if(!s){s=[];let l=[t];for(;Ie(l);)l=Mh(s,l,e);const a=Ie(e)||!me(e)?e:e.default?e.default:null;l=G(a)?[a]:a,Ie(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];G(s)&&(r=xV(n,e[o],t))}return r}function xV(n,e,t){let r;const o=e.split("-");do{const s=o.join("-");r=wV(n,s,t),o.splice(-1,1)}while(o.length&&r===!0);return r}function wV(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),(Ie(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 EV=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function CV(n){return EV.test(n)}function vV(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 _V(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 SV(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:CV(e)?vV(e):"*"+e}function NV(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=SV(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=_V(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 MV(n,e){return ye(n)?n[e]:null}function TV(n,e){if(!ye(n))return null;let t=Th.get(e);if(t||(t=NV(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)&&It(o))return null;const a=o[l];if(a===void 0||Ne(o))return null;o=a,s++}return o}const bt={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},AV=8,BV={[bt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[bt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[bt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[bt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[bt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[bt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[bt.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(BV[n],...e)}const VV="11.1.12",Tl=-1,Lo="en-US",Al="",Ah=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function LV(){return{upper:(n,e)=>e==="text"&&G(n)?n.toUpperCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&G(n)?n.toLowerCase():e==="vnode"&&ye(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&G(n)?Ah(n):e==="vnode"&&ye(n)&&"__v_isVNode"in n?Ah(n.children):n}}let Bh;function OV(n){Bh=n}let Vh;function IV(n){Vh=n}let Lh;function DV(n){Lh=n}let Oh=null;const RV=n=>{Oh=n},FV=()=>Oh;let Ih=null;const Dh=n=>{Ih=n},PV=()=>Ih;let Rh=0;function $V(n={}){const e=Ne(n.onWarn)?n.onWarn:tn,t=G(n.version)?n.version:VV,r=G(n.locale)||Ne(n.locale)?n.locale:Lo,o=Ne(r)?Lo:r,s=Ie(n.fallbackLocale)||me(n.fallbackLocale)||G(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(Ce(),n.modifiers,LV()),u=n.pluralRules||Ce(),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,w=!!n.escapeParameter,x=Ne(n.messageCompiler)?n.messageCompiler:Bh;process.env.NODE_ENV!=="production"&&Ne(n.messageCompiler)&&Ia(br(bt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const C=Ne(n.messageResolver)?n.messageResolver:Vh||MV,M=Ne(n.localeFallbacker)?n.localeFallbacker:Lh||kV,E=ye(n.fallbackContext)?n.fallbackContext:void 0,B=n,z=ye(B.__datetimeFormatters)?B.__datetimeFormatters:new Map,J=ye(B.__numberFormatters)?B.__numberFormatters:new Map,V=ye(B.__meta)?B.__meta:{};Rh++;const O={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:w,messageCompiler:x,messageResolver:C,localeFallbacker:M,fallbackContext:E,onWarn:e,__meta:V};return O.datetimeFormats=a,O.numberFormats=c,O.__datetimeFormatters=z,O.__numberFormatters=J,process.env.NODE_ENV!=="production"&&(O.__v_emitter=B.__v_emitter!=null?B.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&hV(O,t,V),O}const Ka=n=>({[n]:Ce()});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 G(a)?a:e}else return process.env.NODE_ENV!=="production"&&Fh(r,e)&&l(br(bt.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 zV(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(bt.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(!G(c)||c==="")return new Intl.DateTimeFormat(g,f).format(d);let b={},k,w=null,x=g,C=null;const M="datetime format";for(let z=0;z<y.length;z++){if(k=C=y[z],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(bt.FALLBACK_TO_DATE_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const J=n.__v_emitter;J&&J.emit("fallback",{type:M,key:c,from:x,to:C,groupId:`${M}:${c}`})}if(b=t[k]||{},w=b[c],me(w))break;qa(n,c,k,p,M),x=C}if(!me(w)||!G(k))return r?Tl:c;let E=`${k}__${c}`;vl(f)||(E=`${E}__${JSON.stringify(f)}`);let B=a.get(E);return B||(B=new Intl.DateTimeFormat(k,We({},w,f)),a.set(E,B)),m?B.formatToParts(d):B.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=Ce();let l=Ce(),a;if(G(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw wn(ct.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(ct.INVALID_ISO_DATE_ARGUMENT)}}else if(bB(e)){if(isNaN(e.getTime()))throw wn(ct.INVALID_DATE_ARGUMENT);a=e}else if(je(e))a=e;else throw wn(ct.INVALID_ARGUMENT);return G(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{jh.includes(c)?l[c]=t[c]:s[c]=t[c]}),G(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(bt.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(!G(c)||c==="")return new Intl.NumberFormat(g,f).format(d);let b={},k,w=null,x=g,C=null;const M="number format";for(let z=0;z<y.length;z++){if(k=C=y[z],process.env.NODE_ENV!=="production"&&g!==k&&Bl(h,c)&&s(br(bt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const J=n.__v_emitter;J&&J.emit("fallback",{type:M,key:c,from:x,to:C,groupId:`${M}:${c}`})}if(b=t[k]||{},w=b[c],me(w))break;qa(n,c,k,p,M),x=C}if(!me(w)||!G(k))return r?Tl:c;let E=`${k}__${c}`;vl(f)||(E=`${E}__${JSON.stringify(f)}`);let B=a.get(E);return B||(B=new Intl.NumberFormat(k,We({},w,f)),a.set(E,B)),m?B.formatToParts(d):B.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=Ce();let l=Ce();if(!je(e))throw wn(ct.INVALID_ARGUMENT);const a=e;return G(t)?s.key=t:me(t)&&Object.keys(t).forEach(c=>{Kh.includes(c)?l[c]=t[c]:s[c]=t[c]}),G(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 HV=n=>n,jV=n=>"",UV="text",WV=n=>n.length===0?"":Ra(n),KV=CB;function Gh(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function qV(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 GV(n,e){e.count||(e.count=n),e.n||(e.n=n)}function JV(n={}){const e=n.locale,t=qV(n),r=ye(n.pluralRules)&&G(e)&&Ne(n.pluralRules[e])?n.pluralRules[e]:Gh,o=ye(n.pluralRules)&&G(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||Ce();je(n.pluralIndex)&&GV(t,c);const d=b=>c[b];function u(b,k){const w=Ne(n.messages)?n.messages(b,!!k):ye(n.messages)?n.messages[b]:!1;return w||(n.parent?n.parent.message(b):jV)}const f=b=>n.modifiers?n.modifiers[b]:HV,p=me(n.processor)&&Ne(n.processor.normalize)?n.processor.normalize:WV,h=me(n.processor)&&Ne(n.processor.interpolate)?n.processor.interpolate:KV,m=me(n.processor)&&G(n.processor.type)?n.processor.type:UV,y={list:a,named:d,plural:s,linked:(b,...k)=>{const[w,x]=k;let C="text",M="";k.length===1?ye(w)?(M=w.modifier||M,C=w.type||C):G(w)&&(M=w||M):k.length===2&&(G(w)&&(M=w||M),G(x)&&(C=x||C));const E=u(b,!0)(y),B=C==="vnode"&&Ie(E)&&M?E[0]:E;return M?f(M)(B,C):B},message:u,type:m,interpolate:h,normalize:p,values:We(Ce(),l,c)};return y}const Jh=()=>"",Dt=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=G(d.default)||be(d.default)?be(d.default)?s?c:()=>c:d.default:t?s?c:()=>c:null,g=t||m!=null&&(G(m)||Ne(m)),y=Ua(n,d);p&&YV(d);let[b,k,w]=h?[c,y,a[y]||Ce()]:Xh(n,c,y,l,f,u),x=b,C=c;if(!h&&!(G(x)||It(x)||Dt(x))&&g&&(x=m,C=x),!h&&(!(G(x)||It(x)||Dt(x))||!G(k)))return o?Tl:c;if(process.env.NODE_ENV!=="production"&&G(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 M=!1;const E=()=>{M=!0},B=Dt(x)?x:Zh(n,c,k,x,C,E);if(M)return x;const z=eL(n,k,w,d),J=JV(z),V=XV(n,B,J);let O=r?r(V,c):V;if(p&&G(O)&&(O=xB(O)),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const Y={timestamp:Date.now(),key:G(c)?c:Dt(x)?x.key:"",locale:k||(Dt(x)?x.locale:""),format:G(x)?x:Dt(x)?x.source:"",message:O};Y.meta=We({},n.__meta,FV()||{}),mV(Y)}return O}function YV(n){Ie(n.list)?n.list=n.list.map(e=>G(e)?ch(e):e):ye(n.named)&&Object.keys(n.named).forEach(e=>{G(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=Ce(),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(bt.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]||Ce();let k=null,w,x;if(process.env.NODE_ENV!=="production"&&Wt&&(k=window.performance.now(),w="intlify-message-resolve-start",x="intlify-message-resolve-end",_t&&_t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&Wt){const C=window.performance.now(),M=n.__v_emitter;M&&k&&h&&M.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:C-k,groupId:`${y}:${e}`}),w&&x&&_t&&gr&&(_t(x),gr("intlify message resolve",w,x))}if(G(h)||It(h)||Dt(h))break;if(!zV(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(Dt(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",_t&&_t(d));const f=l(r,ZV(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&&_t&&gr&&(_t(u),gr("intlify message compilation",d,u))}return f.locale=t,f.key=e,f.source=r,f}function XV(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",_t&&_t(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&&_t&&gr&&(_t(s),gr("intlify message evaluation",o,s))}return l}function Ya(...n){const[e,t,r]=n,o=Ce();if(!G(e)&&!je(e)&&!Dt(e)&&!It(e))throw wn(ct.INVALID_ARGUMENT);const s=je(e)?String(e):(Dt(e),e);return je(t)?o.plural=t:G(t)?o.default=t:me(t)&&!vl(t)?o.named=t:Ie(t)&&(o.list=t),je(r)?o.plural=r:G(r)?o.default=r:me(r)&&We(o,r),[s,o]}function ZV(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=QV(r),c=`Message compilation error: ${l.message}`,d=l.location&&a&&vB(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=>gB(e,t,l)}}function QV(n){if(G(n))return n;if(n.loc&&n.loc.source)return n.loc.source}function eL(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(G(g)||It(g)){let y=!1;const k=Zh(n,h,e,g,h,()=>{y=!0});return y?Jh:k}else return Dt(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}eV();function tL(){return Qh().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Qh(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const nL=typeof Proxy=="function",rL="devtools-plugin:setup",oL="plugin:settings:set";let Hr,Xa;function sL(){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 lL(){return sL()?Xa.now():Date.now()}class iL{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 lL()}},t&&t.on(oL,(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 aL(n,e){const t=n,r=Qh(),o=tL(),s=nL&&t.enableEarlyProxy;if(o&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!s))o.emit(rL,n,e);else{const l=s?new iL(t,o):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:l}),l&&e(l.proxiedTarget)}}/*!
|
|
142
128
|
* vue-i18n v11.1.12
|
|
143
129
|
* (c) 2025 kazuya kawaguchi
|
|
144
130
|
* Released under the MIT License.
|
|
145
|
-
*/const
|
|
146
|
-
About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[Rt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead.",[Rt.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(wL[n],...e)}function Do(n){if(!ye(n)||It(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]]=Ce()),!ye(o[t[l]])){process.env.NODE_ENV!=="production"&&tn(jr(Rt.IGNORE_OBJ_FLATTEN,{key:t[l]})),s=!0;break}o=o[t[l]]}if(s||(It(o)?Sh.includes(t[r])||delete n[e]:(o[t[r]]=n[e],delete n[e])),!It(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:Ie(r)?Ce():{[n]:Ce()};if(Ie(r)&&r.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:d}=a;c?(l[c]=l[c]||Ce(),Sl(d,l[c])):Sl(d,l)}else J(a)&&Sl(JSON.parse(a),l)}),o==null&&s)for(const a in l)Kt(l,a)&&Do(l[a]);return l}function om(n){return n.type}function sm(n,e,t){let r=ye(e.messages)?e.messages:Ce();"__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 lm(n){return i.createVNode(i.Text,null,n,0)}const im="__INTLIFY_META__",am=()=>[],EL=()=>!1;let cm=0;function dm(n){return((e,t,r,o)=>n(t,r,i.getCurrentInstance()||void 0,o))}const CL=()=>{const n=i.getCurrentInstance();let e=null;return n&&(e=om(n)[im])?{[im]: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:J(n.locale)?n.locale:Lo),c=s(e&&l?e.fallbackLocale.value:J(n.fallbackLocale)||Ie(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)?dm(n.missing):null,k=Ne(n.postTranslation)?n.postTranslation:null,w=e?e.warnHtmlMessage:be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,x=!!n.escapeParameter;const E=e?e.modifiers:me(n.modifiers)?n.modifiers:{};let M=n.pluralRules||e&&e.pluralRules,C;C=(()=>{r&&Fh(null);const B={version:bL,locale:a.value,fallbackLocale:c.value,messages:d.value,modifiers:E,pluralRules:M,missing:b===null?void 0:b,missingWarn:p,fallbackWarn:h,fallbackFormat:g,unresolving:!0,postTranslation:k===null?void 0:k,warnHtmlMessage:w,escapeParameter:x,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};B.datetimeFormats=u.value,B.numberFormats=f.value,B.__datetimeFormatters=me(C)?C.__datetimeFormatters:void 0,B.__numberFormatters=me(C)?C.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(B.__v_emitter=me(C)?C.__v_emitter:void 0);const F=JV(B);return r&&Fh(F),F})(),Oo(C,a.value,c.value);function z(){return[a.value,c.value,d.value,u.value,f.value]}const G=i.computed({get:()=>a.value,set:B=>{C.locale=B,a.value=B}}),V=i.computed({get:()=>c.value,set:B=>{C.fallbackLocale=B,c.value=B,Oo(C,a.value,B)}}),O=i.computed(()=>d.value),Y=i.computed(()=>u.value),Q=i.computed(()=>f.value);function P(){return Ne(k)?k:null}function K(B){k=B,C.postTranslation=B}function U(){return y}function re(B){B!==null&&(b=dm(B)),y=B,C.missing=b}function se(B,F){return B!=="translate"||!F.resolvedMessage}const ve=(B,F,he,v,N,H)=>{z();let W;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(C.fallbackContext=e?GV():void 0),W=B(C)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(C.fallbackContext=void 0)}if(he!=="translate exists"&&je(W)&&W===Tl||he==="translate exists"&&!W){const[Z,fe]=F();if(process.env.NODE_ENV!=="production"&&e&&J(Z)&&se(he,fe)&&(m&&(Bl(h,Z)||$h(p,Z))&&tn(jr(Rt.FALLBACK_TO_ROOT,{key:Z,type:he})),process.env.NODE_ENV!=="production")){const{__v_emitter:T}=C;T&&m&&T.emit("fallback",{type:he,key:Z,to:"global",groupId:`${he}:${Z}`})}return e&&m?v(e):N(Z)}else{if(H(W))return W;throw kt(Ae.UNEXPECTED_RETURN_TYPE)}};function pt(...B){return ve(F=>Reflect.apply(Zh,null,[F,...B]),()=>Qa(...B),"translate",F=>Reflect.apply(F.t,F,[...B]),F=>F,F=>J(F))}function St(...B){const[F,he,v]=B;if(v&&!ye(v))throw kt(Ae.INVALID_ARGUMENT);return pt(F,he,We({resolvedMessage:!0},v||{}))}function Ft(...B){return ve(F=>Reflect.apply(Uh,null,[F,...B]),()=>Xa(...B),"datetime format",F=>Reflect.apply(F.d,F,[...B]),()=>Al,F=>J(F)||Ie(F))}function Ke(...B){return ve(F=>Reflect.apply(qh,null,[F,...B]),()=>Za(...B),"number format",F=>Reflect.apply(F.n,F,[...B]),()=>Al,F=>J(F)||Ie(F))}function ht(B){return B.map(F=>J(F)||je(F)||be(F)?lm(String(F)):F)}const Cn={normalize:ht,interpolate:B=>B,type:"vnode"};function vn(...B){return ve(F=>{let he;const v=F;try{v.processor=Cn,he=Reflect.apply(Zh,null,[v,...B])}finally{v.processor=null}return he},()=>Qa(...B),"translate",F=>F[tc](...B),F=>[lm(F)],F=>Ie(F))}function xr(...B){return ve(F=>Reflect.apply(qh,null,[F,...B]),()=>Za(...B),"number format",F=>F[rc](...B),am,F=>J(F)||Ie(F))}function mt(...B){return ve(F=>Reflect.apply(Uh,null,[F,...B]),()=>Xa(...B),"datetime format",F=>F[nc](...B),am,F=>J(F)||Ie(F))}function Pt(B){M=B,C.pluralRules=M}function cn(B,F){return ve(()=>{if(!B)return!1;const he=J(F)?F:a.value,v=qt(he),N=C.messageResolver(v,B);return It(N)||Dt(N)||J(N)},()=>[B],"translate exists",he=>Reflect.apply(he.te,he,[B,F]),EL,he=>be(he))}function qe(B){let F=null;const he=Th(C,c.value,a.value);for(let v=0;v<he.length;v++){const N=d.value[he[v]]||{},H=C.messageResolver(N,B);if(H!=null){F=H;break}}return F}function $t(B){const F=qe(B);return F??(e?e.tm(B)||{}:{})}function qt(B){return d.value[B]||{}}function dn(B,F){if(o){const he={[B]:F};for(const v in he)Kt(he,v)&&Do(he[v]);F=he[B]}d.value[B]=F,C.messages=d.value}function Xn(B,F){d.value[B]=d.value[B]||{};const he={[B]:F};if(o)for(const v in he)Kt(he,v)&&Do(he[v]);F=he[B],Sl(F,d.value[B]),C.messages=d.value}function _(B){return u.value[B]||{}}function S(B,F){u.value[B]=F,C.datetimeFormats=u.value,Kh(C,B,F)}function D(B,F){u.value[B]=We(u.value[B]||{},F),C.datetimeFormats=u.value,Kh(C,B,F)}function X(B){return f.value[B]||{}}function we(B,F){f.value[B]=F,C.numberFormats=f.value,Jh(C,B,F)}function Be(B,F){f.value[B]=We(f.value[B]||{},F),C.numberFormats=f.value,Jh(C,B,F)}cm++,e&&Wt&&(i.watch(e.locale,B=>{l&&(a.value=B,C.locale=B,Oo(C,a.value,c.value))}),i.watch(e.fallbackLocale,B=>{l&&(c.value=B,C.fallbackLocale=B,Oo(C,a.value,c.value))}));const pe={id:cm,locale:G,fallbackLocale:V,get inheritLocale(){return l},set inheritLocale(B){l=B,B&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,Oo(C,a.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:O,get modifiers(){return E},get pluralRules(){return M||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(B){p=B,C.missingWarn=p},get fallbackWarn(){return h},set fallbackWarn(B){h=B,C.fallbackWarn=h},get fallbackRoot(){return m},set fallbackRoot(B){m=B},get fallbackFormat(){return g},set fallbackFormat(B){g=B,C.fallbackFormat=g},get warnHtmlMessage(){return w},set warnHtmlMessage(B){w=B,C.warnHtmlMessage=B},get escapeParameter(){return x},set escapeParameter(B){x=B,C.escapeParameter=B},t:pt,getLocaleMessage:qt,setLocaleMessage:dn,mergeLocaleMessage:Xn,getPostTranslationHandler:P,setPostTranslationHandler:K,getMissingHandler:U,setMissingHandler:re,[nm]:Pt};return pe.datetimeFormats=Y,pe.numberFormats=Q,pe.rt=St,pe.te=cn,pe.tm=$t,pe.d=Ft,pe.n=Ke,pe.getDateTimeFormat=_,pe.setDateTimeFormat=S,pe.mergeDateTimeFormat=D,pe.getNumberFormat=X,pe.setNumberFormat=we,pe.mergeNumberFormat=Be,pe[rm]=t,pe[tc]=vn,pe[nc]=mt,pe[rc]=xr,process.env.NODE_ENV!=="production"&&(pe[kr]=B=>{C.__v_emitter=B},pe[Io]=()=>{C.__v_emitter=void 0}),pe}const um="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 ..."},_L={"vue-i18n-timeline":16764185};let ac;async function SL(n,e){return new Promise((t,r)=>{try{yL({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:[um],app:n},o=>{ac=o,o.on.visitComponentTree(({componentInstance:l,treeNode:a})=>{NL(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&&pm(a,l.vnode.el.__VUE_I18N__):pm(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"&&VL(l,e)});const s=new Map;o.on.getInspectorState(async l=>{if(l.app===n&&l.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),OL(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=LL(l.nodeId,e);a&&o.highlightElement(a)}}),o.on.editInspectorState(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&DL(l,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:ic["vue-i18n-timeline"],color:_L["vue-i18n-timeline"]}),t(!0)})}catch(o){console.error(o),r(!1)}})}function fm(n){return n.type.name||n.type.displayName||n.type.__file||"Anonymous"}function NL(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 (${fm(n)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(o)}}function pm(n,e){const t=um;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]=BL(r):It(r)&&r.loc&&r.loc.source?e[t]=r.loc.source:ye(r)?e[t]=cc(r):e[t]=r}),e}const ML={"<":"<",">":">",'"':""","&":"&"};function TL(n){return n.replace(/[<>"&]/g,AL)}function AL(n){return ML[n]||n}function BL(n){return{_custom:{type:"function",display:`<span>ƒ</span> ${n.source?`("${TL(n.source)}")`:"(?)"}`}}}function VL(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:`${fm(r)} Scope`})}}function LL(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 hm(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 OL(n,e){const t=hm(n.nodeId,e);return t&&(n.state=IL(t)),null}function IL(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 DL(n,e){const t=hm(n.nodeId,e);if(t){const[r]=n.path;r==="locale"&&J(n.state.value)?t.locale.value=n.state.value:r==="fallbackLocale"&&(J(n.state.value)||Ie(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 RL(n){const e=J(n.locale)?n.locale:Lo,t=J(n.fallbackLocale)||Ie(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=J(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 E=n.sharedMessages;m=Object.keys(E).reduce((C,A)=>{const z=C[A]||(C[A]={});return We(z,E[A]),C},m||{})}const{__i18n:g,__root:y,__injectWithOption:b}=n,k=n.datetimeFormats,w=n.numberFormats,x=n.flatJson;return{locale:e,fallbackLocale:t,messages:m,flatJson:x,datetimeFormats:k,numberFormats:w,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(RL(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 FL(n,e,t){return{beforeCreate(){const r=i.getCurrentInstance();if(!r)throw kt(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=mm(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=mm(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&&sm(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 kt(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 mm(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[nm](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 PL({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},Ce())}function gm(){return i.Fragment}const ym=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=Ce();n.locale&&(l.locale=n.locale),n.plural!==void 0&&(l.plural=J(n.plural)?+n.plural:n.plural);const a=PL(e,s),c=o[tc](n.keypath,a,l),d=We(Ce(),r),u=J(n.tag)||ye(n.tag)?n.tag:gm();return i.h(u,d,c)}}});function $L(n){return Ie(n)&&!J(n[0])}function bm(n,e,t,r){const{slots:o,attrs:s}=e;return()=>{const l={part:!0};let a=Ce();n.locale&&(l.locale=n.locale),J(n.format)?l.key=n.format:ye(n.format)&&(J(n.format.key)&&(l.key=n.format.key),a=Object.keys(n.format).reduce((p,h)=>t.includes(h)?We(Ce(),p,{[h]:n.format[h]}):p,Ce()));const c=r(n.value,l,a);let d=[l.key];Ie(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 $L(g)&&(g[0].key=`${p.type}-${h}`),g}):J(c)&&(d=[c]);const u=We(Ce(),s),f=J(n.tag)||ye(n.tag)?n.tag:gm();return i.h(f,u,d)}}const km=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 bm(n,e,Gh,(...r)=>t[rc](...r))}});function zL(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 HL(n){const e=l=>{process.env.NODE_ENV!=="production"&&Fa(jr(Rt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:a,value:c}=l;if(!a||!a.$)throw kt(Ae.UNEXPECTED_ERROR);const d=zL(n,a.$),u=xm(c);return[Reflect.apply(d.t,d,[...wm(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=xm(a);l.textContent=Reflect.apply(c.t,c,[...wm(d)])}},getSSRProps:l=>{const[a]=e(l);return{textContent:a}}}}function xm(n){if(J(n))return{path:n};if(me(n)){if(!("path"in n))throw kt(Ae.REQUIRED_VALUE,"path");return n}else throw kt(Ae.INVALID_VALUE)}function wm(n){const{path:e,locale:t,args:r,choice:o,plural:s}=n,l={},a=r||{};return J(t)&&(l.locale=t),je(o)&&(l.plural=o),je(s)&&(l.plural=s),[e,a,l]}function jL(n,e,...t){const r=me(t[0])?t[0]:{};(be(r.globalInstall)?r.globalInstall:!0)&&([ym.name,"I18nT"].forEach(s=>n.component(s,ym)),[km.name,"I18nN"].forEach(s=>n.component(s,km)),[Cm.name,"I18nD"].forEach(s=>n.component(s,Cm))),n.directive("t",HL(e))}const UL=nn("global-vue-i18n");function WL(n={}){const e=__VUE_I18N_LEGACY_API__&&be(n.legacy)?n.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&Fa(jr(Rt.DEPRECATE_LEGACY_MODE));const t=be(n.globalInjection)?n.globalInjection:!0,r=new Map,[o,s]=KL(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=eO(f,u.global)),__VUE_I18N_FULL_INSTALL__&&jL(f,u,...p),__VUE_I18N_LEGACY_API__&&e&&f.mixin(FL(s,s.__composer,u));const m=f.unmount;if(f.unmount=()=>{h&&h(),u.dispose(),m()},process.env.NODE_ENV!=="production"){if(!await SL(f,u))throw kt(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 kt(Ae.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw kt(Ae.NOT_INSTALLED);const t=qL(e),r=JL(t),o=om(e),s=GL(n,o);if(s==="global")return sm(r,n,o),r;if(s==="parent"){let c=YL(t,e,n.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&tn(jr(Rt.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)),ZL(l,e,a),l.__setInstance(e,a)}else process.env.NODE_ENV!=="production"&&s==="local"&&tn(jr(Rt.DUPLICATE_USE_I18N_CALLING));return a}function KL(n,e){const t=i.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?t.run(()=>dc(n)):t.run(()=>lc(n));if(r==null)throw kt(Ae.UNEXPECTED_ERROR);return[t,r]}function qL(n){const e=i.inject(n.isCE?UL:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw kt(n.isCE?Ae.NOT_INSTALLED_WITH_PROVIDE:Ae.UNEXPECTED_ERROR);return e}function GL(n,e){return vl(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function JL(n){return n.mode==="composition"?n.global:n.global.__composer}function YL(n,e,t=!1){let r=null;const o=e.root;let s=XL(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[rm]&&(r=null))}if(r!=null||o===s)break;s=s.parent}return r}function XL(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function ZL(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 QL=["locale","fallbackLocale","availableLocales"],Em=["t","rt","d","n","tm","te"];function eO(n,e){const t=Object.create(null);return QL.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw kt(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,Em.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s||!s.value)throw kt(Ae.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${o}`,s)}),()=>{delete n.config.globalProperties.$i18n,Em.forEach(o=>{delete n.config.globalProperties[`$${o}`]})}}const Cm=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 bm(n,e,Wh,(...r)=>t[nc](...r))}});if(kL(),jV(wV),UV(FV),WV(Th),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const n=yr();n.__INTLIFY__=!0,EV(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const tO={},nO={},rO={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"},oO={paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",linkTitle:"Введіть посилання",create:"Створити",cancel:"Скасувати"},pc=WL({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...tO,tiptap:rO},uk:{...nO,tiptap:oO}}}),sO={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",ah)}};function Jn(n){return typeof n=="string"||n instanceof String}function vm(n){var e;return typeof n=="object"&&n!=null&&(n==null||(e=n.constructor)==null?void 0:e.name)==="Object"}function _m(n,e){return Array.isArray(e)?_m(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 ee={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Sm(n){switch(n){case ee.LEFT:return ee.FORCE_LEFT;case ee.RIGHT:return ee.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 lO{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?ee.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?ee.RIGHT:ee.LEFT}}function ce(n,e){return new ce.InputMask(n,e)}function Nm(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}:vm(n)&&n.mask instanceof ce.Masked?n:{};if(e){const r=e.mask;return{..._m(e,(o,s)=>!s.startsWith("_")),mask:e.constructor,_mask:r,...t}}}return vm(n)?{...n}:{mask:n}}function sn(n){if(ce.Masked&&n instanceof ce.Masked)return n;const e=Ur(n),t=Nm(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 Mm=90,iO=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===Mm&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===iO&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===Mm&&(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 Tm 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 Am{constructor(e,t){this.el=e instanceof Ll?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new mc(e):new Tm(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===Nm(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,ee.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 lO({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:ee.NONE;let l=this.masked.nearestInputPos(t.startChangePos+o,s);s!==ee.NONE&&(l=this.masked.nearestInputPos(l,ee.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=Am;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 nt{constructor(e){this._value="",this._update({...nt.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=ee.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=Sm(o),d=this.extractInput(0,l,{raw:!0}));let u=e;const f=new de;if(o!==ee.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!c?ee.NONE:o),f.tailShift=u-e),f.aggregate(this.remove(u)),c&&o!==ee.NONE&&d===this.rawInputValue)if(o===ee.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===ee.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||nt.EMPTY_VALUES.includes(e)&&nt.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}nt.DEFAULTS={skipInvalid:!0},nt.EMPTY_VALUES=[void 0,null,""],ce.Masked=nt;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 aO{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,ee.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ee.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ee.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ee.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,ee.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ee.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=ee.NONE);const r=0,o=this._value.length;switch(t){case ee.LEFT:case ee.FORCE_LEFT:return r;case ee.NONE:case ee.RIGHT:case ee.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=ee.NONE);const r=0,o=this.value.length,s=Math.min(Math.max(e,r),o);switch(t){case ee.LEFT:case ee.FORCE_LEFT:return this.isComplete?s:r;case ee.RIGHT:case ee.FORCE_RIGHT:return this.isComplete?s:o;case ee.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 Bm extends nt{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=r=>r.search(t)>=0),super._update(e)}}ce.MaskedRegExp=Bm;class rt extends nt{constructor(e){super({...rt.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===rt.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(l==="{"||l==="}"){r=!r;continue}if(l==="["||l==="]"){o=!o;continue}if(l===rt.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=ee.NONE),!this._blocks.length)return 0;const r=new aO(this,e);if(t===ee.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(t===ee.LEFT||t===ee.FORCE_LEFT){if(t===ee.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),t===ee.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===ee.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return t===ee.RIGHT||t===ee.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:t===ee.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,ee.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}}rt.DEFAULTS={...nt.DEFAULTS,lazy:!0,placeholderChar:"_"},rt.STOP_CHAR="`",rt.ESCAPE_CHAR="\\",rt.InputDefinition=Po,rt.FixedDefinition=gc,ce.MaskedPattern=rt;class $o extends rt{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 cO="d{.}`m{.}`Y";class an extends rt{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={...rt.DEFAULTS,mask:Date,pattern:cO,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 nt{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={...nt.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,ee.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,ee.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 rt{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,ee.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,ee.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={...rt.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},ce.MaskedEnum=Ho;class Vm extends nt{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}ce.MaskedFunction=Vm;var Lm;class xt extends nt{constructor(e){super({...xt.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(xt.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 ee.NONE:case ee.LEFT:case ee.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===ee.FORCE_LEFT)return r}break}case ee.RIGHT:case ee.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===xt.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,xt.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(xt.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)||xt.EMPTY_VALUES.includes(e)&&xt.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Lm=xt,xt.UNMASKED_RADIX=".",xt.EMPTY_VALUES=[...nt.EMPTY_VALUES,0],xt.DEFAULTS={...nt.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Lm.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=xt;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 Om(n,e,t,r){return yc(e,t,r)(n)}ce.PIPE_TYPE=Il,ce.createPipe=yc,ce.pipe=Om;class Im extends rt{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=Im;try{globalThis.IMask=ce}catch{}const dO=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:Yn,DIRECTION:ee,HTMLContenteditableMaskElement:mc,HTMLInputMaskElement:Tm,HTMLMaskElement:Fo,InputMask:Am,MaskElement:Ll,Masked:nt,MaskedDate:an,MaskedDynamic:zo,MaskedEnum:Ho,MaskedFunction:Vm,MaskedNumber:xt,MaskedPattern:rt,MaskedRange:$o,MaskedRegExp:Bm,PIPE_TYPE:Il,PatternFixedDefinition:gc,PatternInputDefinition:Po,RepeatBlock:Im,createMask:sn,createPipe:yc,default:ce,forceDirection:Sm,normalizeOpts:Ur,pipe:Om},Symbol.toStringTag,{value:"Module"}));Gt.VsRichtext=El,Gt.VsRichtextMd=El,Gt.VsRichtextPage=ah,Gt.default=sO,Object.defineProperties(Gt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
131
|
+
*/const cL="11.1.12";function dL(){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:yV,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 kt(n,...e){return Pr(n,null,process.env.NODE_ENV!=="production"?{messages:uL,args:e}:void 0)}const uL={[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"),Rt={FALLBACK_TO_ROOT:AV,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_LEGACY_MODE:11,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:12,DUPLICATE_USE_I18N_CALLING:13},fL={[Rt.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Rt.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Rt.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Rt.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`,[Rt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead.",[Rt.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(fL[n],...e)}function Do(n){if(!ye(n)||It(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]]=Ce()),!ye(o[t[l]])){process.env.NODE_ENV!=="production"&&tn(jr(Rt.IGNORE_OBJ_FLATTEN,{key:t[l]})),s=!0;break}o=o[t[l]]}if(s||(It(o)?vh.includes(t[r])||delete n[e]:(o[t[r]]=n[e],delete n[e])),!It(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:Ie(r)?Ce():{[n]:Ce()};if(Ie(r)&&r.forEach(a=>{if("locale"in a&&"resource"in a){const{locale:c,resource:d}=a;c?(l[c]=l[c]||Ce(),Sl(d,l[c])):Sl(d,l)}else G(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:Ce();"__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=()=>[],pL=()=>!1;let im=0;function am(n){return((e,t,r,o)=>n(t,r,i.getCurrentInstance()||void 0,o))}const hL=()=>{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:G(n.locale)?n.locale:Lo),c=s(e&&l?e.fallbackLocale.value:G(n.fallbackLocale)||Ie(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,w=e?e.warnHtmlMessage:be(n.warnHtmlMessage)?n.warnHtmlMessage:!0,x=!!n.escapeParameter;const C=e?e.modifiers:me(n.modifiers)?n.modifiers:{};let M=n.pluralRules||e&&e.pluralRules,E;E=(()=>{r&&Dh(null);const A={version:cL,locale:a.value,fallbackLocale:c.value,messages:d.value,modifiers:C,pluralRules:M,missing:b===null?void 0:b,missingWarn:p,fallbackWarn:h,fallbackFormat:g,unresolving:!0,postTranslation:k===null?void 0:k,warnHtmlMessage:w,escapeParameter:x,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};A.datetimeFormats=u.value,A.numberFormats=f.value,A.__datetimeFormatters=me(E)?E.__datetimeFormatters:void 0,A.__numberFormatters=me(E)?E.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(A.__v_emitter=me(E)?E.__v_emitter:void 0);const F=$V(A);return r&&Dh(F),F})(),Oo(E,a.value,c.value);function z(){return[a.value,c.value,d.value,u.value,f.value]}const J=i.computed({get:()=>a.value,set:A=>{E.locale=A,a.value=A}}),V=i.computed({get:()=>c.value,set:A=>{E.fallbackLocale=A,c.value=A,Oo(E,a.value,A)}}),O=i.computed(()=>d.value),Y=i.computed(()=>u.value),ee=i.computed(()=>f.value);function H(){return Ne(k)?k:null}function K(A){k=A,E.postTranslation=A}function U(){return y}function re(A){A!==null&&(b=am(A)),y=A,E.missing=b}function se(A,F){return A!=="translate"||!F.resolvedMessage}const ve=(A,F,he,v,N,$)=>{z();let W;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(E.fallbackContext=e?PV():void 0),W=A(E)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(E.fallbackContext=void 0)}if(he!=="translate exists"&&je(W)&&W===Tl||he==="translate exists"&&!W){const[Z,fe]=F();if(process.env.NODE_ENV!=="production"&&e&&G(Z)&&se(he,fe)&&(m&&(Bl(h,Z)||Fh(p,Z))&&tn(jr(Rt.FALLBACK_TO_ROOT,{key:Z,type:he})),process.env.NODE_ENV!=="production")){const{__v_emitter:T}=E;T&&m&&T.emit("fallback",{type:he,key:Z,to:"global",groupId:`${he}:${Z}`})}return e&&m?v(e):N(Z)}else{if($(W))return W;throw kt(Ae.UNEXPECTED_RETURN_TYPE)}};function pt(...A){return ve(F=>Reflect.apply(Yh,null,[F,...A]),()=>Ya(...A),"translate",F=>Reflect.apply(F.t,F,[...A]),F=>F,F=>G(F))}function St(...A){const[F,he,v]=A;if(v&&!ye(v))throw kt(Ae.INVALID_ARGUMENT);return pt(F,he,We({resolvedMessage:!0},v||{}))}function Ft(...A){return ve(F=>Reflect.apply(Hh,null,[F,...A]),()=>Ga(...A),"datetime format",F=>Reflect.apply(F.d,F,[...A]),()=>Al,F=>G(F)||Ie(F))}function Ke(...A){return ve(F=>Reflect.apply(Wh,null,[F,...A]),()=>Ja(...A),"number format",F=>Reflect.apply(F.n,F,[...A]),()=>Al,F=>G(F)||Ie(F))}function ht(A){return A.map(F=>G(F)||je(F)||be(F)?om(String(F)):F)}const Cn={normalize:ht,interpolate:A=>A,type:"vnode"};function vn(...A){return ve(F=>{let he;const v=F;try{v.processor=Cn,he=Reflect.apply(Yh,null,[v,...A])}finally{v.processor=null}return he},()=>Ya(...A),"translate",F=>F[Za](...A),F=>[om(F)],F=>Ie(F))}function xr(...A){return ve(F=>Reflect.apply(Wh,null,[F,...A]),()=>Ja(...A),"number format",F=>F[ec](...A),lm,F=>G(F)||Ie(F))}function mt(...A){return ve(F=>Reflect.apply(Hh,null,[F,...A]),()=>Ga(...A),"datetime format",F=>F[Qa](...A),lm,F=>G(F)||Ie(F))}function Pt(A){M=A,E.pluralRules=M}function cn(A,F){return ve(()=>{if(!A)return!1;const he=G(F)?F:a.value,v=qt(he),N=E.messageResolver(v,A);return It(N)||Dt(N)||G(N)},()=>[A],"translate exists",he=>Reflect.apply(he.te,he,[A,F]),pL,he=>be(he))}function qe(A){let F=null;const he=Nh(E,c.value,a.value);for(let v=0;v<he.length;v++){const N=d.value[he[v]]||{},$=E.messageResolver(N,A);if($!=null){F=$;break}}return F}function $t(A){const F=qe(A);return F??(e?e.tm(A)||{}:{})}function qt(A){return d.value[A]||{}}function dn(A,F){if(o){const he={[A]:F};for(const v in he)Kt(he,v)&&Do(he[v]);F=he[A]}d.value[A]=F,E.messages=d.value}function Xn(A,F){d.value[A]=d.value[A]||{};const he={[A]:F};if(o)for(const v in he)Kt(he,v)&&Do(he[v]);F=he[A],Sl(F,d.value[A]),E.messages=d.value}function _(A){return u.value[A]||{}}function S(A,F){u.value[A]=F,E.datetimeFormats=u.value,Uh(E,A,F)}function D(A,F){u.value[A]=We(u.value[A]||{},F),E.datetimeFormats=u.value,Uh(E,A,F)}function X(A){return f.value[A]||{}}function we(A,F){f.value[A]=F,E.numberFormats=f.value,qh(E,A,F)}function Be(A,F){f.value[A]=We(f.value[A]||{},F),E.numberFormats=f.value,qh(E,A,F)}im++,e&&Wt&&(i.watch(e.locale,A=>{l&&(a.value=A,E.locale=A,Oo(E,a.value,c.value))}),i.watch(e.fallbackLocale,A=>{l&&(c.value=A,E.fallbackLocale=A,Oo(E,a.value,c.value))}));const pe={id:im,locale:J,fallbackLocale:V,get inheritLocale(){return l},set inheritLocale(A){l=A,A&&e&&(a.value=e.locale.value,c.value=e.fallbackLocale.value,Oo(E,a.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:O,get modifiers(){return C},get pluralRules(){return M||{}},get isGlobal(){return r},get missingWarn(){return p},set missingWarn(A){p=A,E.missingWarn=p},get fallbackWarn(){return h},set fallbackWarn(A){h=A,E.fallbackWarn=h},get fallbackRoot(){return m},set fallbackRoot(A){m=A},get fallbackFormat(){return g},set fallbackFormat(A){g=A,E.fallbackFormat=g},get warnHtmlMessage(){return w},set warnHtmlMessage(A){w=A,E.warnHtmlMessage=A},get escapeParameter(){return x},set escapeParameter(A){x=A,E.escapeParameter=A},t:pt,getLocaleMessage:qt,setLocaleMessage:dn,mergeLocaleMessage:Xn,getPostTranslationHandler:H,setPostTranslationHandler:K,getMissingHandler:U,setMissingHandler:re,[em]:Pt};return pe.datetimeFormats=Y,pe.numberFormats=ee,pe.rt=St,pe.te=cn,pe.tm=$t,pe.d=Ft,pe.n=Ke,pe.getDateTimeFormat=_,pe.setDateTimeFormat=S,pe.mergeDateTimeFormat=D,pe.getNumberFormat=X,pe.setNumberFormat=we,pe.mergeNumberFormat=Be,pe[tm]=t,pe[Za]=vn,pe[Qa]=mt,pe[ec]=xr,process.env.NODE_ENV!=="production"&&(pe[kr]=A=>{E.__v_emitter=A},pe[Io]=()=>{E.__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"},mL={"vue-i18n-resource-inspector":"Search for scopes ..."},gL={"vue-i18n-timeline":16764185};let sc;async function yL(n,e){return new Promise((t,r)=>{try{aL({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})=>{bL(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:mL["vue-i18n-resource-inspector"]}),o.on.getInspectorTree(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&CL(l,e)});const s=new Map;o.on.getInspectorState(async l=>{if(l.app===n&&l.inspectorId==="vue-i18n-resource-inspector")if(o.unhighlightElement(),_L(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=vL(l.nodeId,e);a&&o.highlightElement(a)}}),o.on.editInspectorState(l=>{l.app===n&&l.inspectorId==="vue-i18n-resource-inspector"&&NL(l,e)}),o.addTimelineLayer({id:"vue-i18n-timeline",label:oc["vue-i18n-timeline"],color:gL["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 bL(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]=EL(r):It(r)&&r.loc&&r.loc.source?e[t]=r.loc.source:ye(r)?e[t]=lc(r):e[t]=r}),e}const kL={"<":"<",">":">",'"':""","&":"&"};function xL(n){return n.replace(/[<>"&]/g,wL)}function wL(n){return kL[n]||n}function EL(n){return{_custom:{type:"function",display:`<span>ƒ</span> ${n.source?`("${xL(n.source)}")`:"(?)"}`}}}function CL(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 vL(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 _L(n,e){const t=fm(n.nodeId,e);return t&&(n.state=SL(t)),null}function SL(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 NL(n,e){const t=fm(n.nodeId,e);if(t){const[r]=n.path;r==="locale"&&G(n.state.value)?t.locale.value=n.state.value:r==="fallbackLocale"&&(G(n.state.value)||Ie(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 ML(n){const e=G(n.locale)?n.locale:Lo,t=G(n.fallbackLocale)||Ie(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=G(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((E,B)=>{const z=E[B]||(E[B]={});return We(z,C[B]),E},m||{})}const{__i18n:g,__root:y,__injectWithOption:b}=n,k=n.datetimeFormats,w=n.numberFormats,x=n.flatJson;return{locale:e,fallbackLocale:t,messages:m,flatJson:x,datetimeFormats:k,numberFormats:w,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(ML(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 TL(n,e,t){return{beforeCreate(){const r=i.getCurrentInstance();if(!r)throw kt(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 kt(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 AL({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},Ce())}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=Ce();n.locale&&(l.locale=n.locale),n.plural!==void 0&&(l.plural=G(n.plural)?+n.plural:n.plural);const a=AL(e,s),c=o[Za](n.keypath,a,l),d=We(Ce(),r),u=G(n.tag)||ye(n.tag)?n.tag:hm();return i.h(u,d,c)}}});function BL(n){return Ie(n)&&!G(n[0])}function gm(n,e,t,r){const{slots:o,attrs:s}=e;return()=>{const l={part:!0};let a=Ce();n.locale&&(l.locale=n.locale),G(n.format)?l.key=n.format:ye(n.format)&&(G(n.format.key)&&(l.key=n.format.key),a=Object.keys(n.format).reduce((p,h)=>t.includes(h)?We(Ce(),p,{[h]:n.format[h]}):p,Ce()));const c=r(n.value,l,a);let d=[l.key];Ie(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 BL(g)&&(g[0].key=`${p.type}-${h}`),g}):G(c)&&(d=[c]);const u=We(Ce(),s),f=G(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 VL(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 LL(n){const e=l=>{process.env.NODE_ENV!=="production"&&Ia(jr(Rt.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:a,value:c}=l;if(!a||!a.$)throw kt(Ae.UNEXPECTED_ERROR);const d=VL(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(G(n))return{path:n};if(me(n)){if(!("path"in n))throw kt(Ae.REQUIRED_VALUE,"path");return n}else throw kt(Ae.INVALID_VALUE)}function km(n){const{path:e,locale:t,args:r,choice:o,plural:s}=n,l={},a=r||{};return G(t)&&(l.locale=t),je(o)&&(l.plural=o),je(s)&&(l.plural=s),[e,a,l]}function OL(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",LL(e))}const IL=nn("global-vue-i18n");function DL(n={}){const e=__VUE_I18N_LEGACY_API__&&be(n.legacy)?n.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&Ia(jr(Rt.DEPRECATE_LEGACY_MODE));const t=be(n.globalInjection)?n.globalInjection:!0,r=new Map,[o,s]=RL(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=WL(f,u.global)),__VUE_I18N_FULL_INSTALL__&&OL(f,u,...p),__VUE_I18N_LEGACY_API__&&e&&f.mixin(TL(s,s.__composer,u));const m=f.unmount;if(f.unmount=()=>{h&&h(),u.dispose(),m()},process.env.NODE_ENV!=="production"){if(!await yL(f,u))throw kt(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 kt(Ae.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw kt(Ae.NOT_INSTALLED);const t=FL(e),r=$L(t),o=nm(e),s=PL(n,o);if(s==="global")return rm(r,n,o),r;if(s==="parent"){let c=zL(t,e,n.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&tn(jr(Rt.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)),jL(l,e,a),l.__setInstance(e,a)}else process.env.NODE_ENV!=="production"&&s==="local"&&tn(jr(Rt.DUPLICATE_USE_I18N_CALLING));return a}function RL(n,e){const t=i.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?t.run(()=>ic(n)):t.run(()=>rc(n));if(r==null)throw kt(Ae.UNEXPECTED_ERROR);return[t,r]}function FL(n){const e=i.inject(n.isCE?IL:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw kt(n.isCE?Ae.NOT_INSTALLED_WITH_PROVIDE:Ae.UNEXPECTED_ERROR);return e}function PL(n,e){return vl(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function $L(n){return n.mode==="composition"?n.global:n.global.__composer}function zL(n,e,t=!1){let r=null;const o=e.root;let s=HL(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 HL(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function jL(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 UL=["locale","fallbackLocale","availableLocales"],xm=["t","rt","d","n","tm","te"];function WL(n,e){const t=Object.create(null);return UL.forEach(o=>{const s=Object.getOwnPropertyDescriptor(e,o);if(!s)throw kt(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 kt(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(dL(),OV(fV),IV(TV),DV(Nh),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const n=yr();n.__INTLIFY__=!0,pV(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const KL={},qL={},GL={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"},JL={paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",linkTitle:"Введіть посилання",create:"Створити",cancel:"Скасувати"},dc=DL({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...KL,tiptap:GL},uk:{...qL,tiptap:JL}}}),YL={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 Q={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function vm(n){switch(n){case Q.LEFT:return Q.FORCE_LEFT;case Q.RIGHT:return Q.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 XL{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?Q.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Q.RIGHT:Q.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,ZL=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===ZL&&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,Q.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 XL({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:Q.NONE;let l=this.masked.nearestInputPos(t.startChangePos+o,s);s!==Q.NONE&&(l=this.masked.nearestInputPos(l,Q.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 nt{constructor(e){this._value="",this._update({...nt.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=Q.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!==Q.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!c?Q.NONE:o),f.tailShift=u-e),f.aggregate(this.remove(u)),c&&o!==Q.NONE&&d===this.rawInputValue)if(o===Q.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===Q.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||nt.EMPTY_VALUES.includes(e)&&nt.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new de}}nt.DEFAULTS={skipInvalid:!0},nt.EMPTY_VALUES=[void 0,null,""],ce.Masked=nt;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 QL{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,Q.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Q.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,Q.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.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=Q.NONE);const r=0,o=this._value.length;switch(t){case Q.LEFT:case Q.FORCE_LEFT:return r;case Q.NONE:case Q.RIGHT:case Q.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=Q.NONE);const r=0,o=this.value.length,s=Math.min(Math.max(e,r),o);switch(t){case Q.LEFT:case Q.FORCE_LEFT:return this.isComplete?s:r;case Q.RIGHT:case Q.FORCE_RIGHT:return this.isComplete?s:o;case Q.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 nt{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 rt extends nt{constructor(e){super({...rt.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===rt.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(l==="{"||l==="}"){r=!r;continue}if(l==="["||l==="]"){o=!o;continue}if(l===rt.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=Q.NONE),!this._blocks.length)return 0;const r=new QL(this,e);if(t===Q.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(t===Q.LEFT||t===Q.FORCE_LEFT){if(t===Q.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),t===Q.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===Q.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return t===Q.RIGHT||t===Q.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:t===Q.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,Q.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}}rt.DEFAULTS={...nt.DEFAULTS,lazy:!0,placeholderChar:"_"},rt.STOP_CHAR="`",rt.ESCAPE_CHAR="\\",rt.InputDefinition=Po,rt.FixedDefinition=pc,ce.MaskedPattern=rt;class $o extends rt{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 eO="d{.}`m{.}`Y";class an extends rt{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={...rt.DEFAULTS,mask:Date,pattern:eO,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 nt{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={...nt.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,Q.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,Q.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 rt{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,Q.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,Q.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={...rt.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},ce.MaskedEnum=Ho;class Am extends nt{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}ce.MaskedFunction=Am;var Bm;class xt extends nt{constructor(e){super({...xt.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(xt.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 Q.NONE:case Q.LEFT:case Q.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===Q.FORCE_LEFT)return r}break}case Q.RIGHT:case Q.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===xt.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,xt.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(xt.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)||xt.EMPTY_VALUES.includes(e)&&xt.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Bm=xt,xt.UNMASKED_RADIX=".",xt.EMPTY_VALUES=[...nt.EMPTY_VALUES,0],xt.DEFAULTS={...nt.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=xt;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 rt{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 tO=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:Yn,DIRECTION:Q,HTMLContenteditableMaskElement:fc,HTMLInputMaskElement:Nm,HTMLMaskElement:Fo,InputMask:Mm,MaskElement:Ll,Masked:nt,MaskedDate:an,MaskedDynamic:zo,MaskedEnum:Ho,MaskedFunction:Am,MaskedNumber:xt,MaskedPattern:rt,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=YL,Object.defineProperties(Gt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|